Is it possible to use the logical call context within a unit test in VS 2010?

后端 未结 4 553
予麋鹿
予麋鹿 2020-12-30 03:32

Is it possible to make this test not throw an exception? It appears that adding any non-GACed class into the logical call context causes an exception to be thrown in line 2

4条回答
  •  臣服心动
    2020-12-30 04:27

    This problem can be solved by having Bar implement MarshalByRefObject. This allows the class to be referenced in the AppDomain that the test runner is running inside.

    [ Serializable]
    public class Bar : MarshalByRefObject {
    
    }
    

提交回复
热议问题