Using WPF components in NUnit tests - how to use STA?

后端 未结 3 1169
耶瑟儿~
耶瑟儿~ 2021-02-02 06:16

I need to use some WPF components in an NUnit unit test. I run the test through ReSharper, and it fails with the following error when using the WPF object:

S

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-02 07:04

    With more recent versions, the attribute has changed :

    [Apartment(ApartmentState.STA)]
    public class MyTestClass
    {}
    

提交回复
热议问题