{"action":"created","issue":{"url":"https://api.github.com/repos/xunit/xunit/issues/764","repository_url":"https://api.github.com/repos/xunit/xunit","labels_url":"https://api.github.com/repos/xunit/xunit/issues/764/labels{/name}","comments_url":"https://api.github.com/repos/xunit/xunit/issues/764/comments","events_url":"https://api.github.com/repos/xunit/xunit/issues/764/events","html_url":"https://github.com/xunit/xunit/issues/764","id":131770299,"number":764,"title":"Test cases with discoverer in separate assembly are not executed unless test case inherits MarshalByRefObject","user":{"login":"natemcmaster","id":2696087,"avatar_url":"https://avatars.githubusercontent.com/u/2696087?v=3","gravatar_id":"","url":"https://api.github.com/users/natemcmaster","html_url":"https://github.com/natemcmaster","followers_url":"https://api.github.com/users/natemcmaster/followers","following_url":"https://api.github.com/users/natemcmaster/following{/other_user}","gists_url":"https://api.github.com/users/natemcmaster/gists{/gist_id}","starred_url":"https://api.github.com/users/natemcmaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natemcmaster/subscriptions","organizations_url":"https://api.github.com/users/natemcmaster/orgs","repos_url":"https://api.github.com/users/natemcmaster/repos","events_url":"https://api.github.com/users/natemcmaster/events{/privacy}","received_events_url":"https://api.github.com/users/natemcmaster/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-05T22:07:36Z","updated_at":"2016-02-05T23:15:41Z","closed_at":null,"body":"Using xunit 2.2.0-beta1-build3239. \r\n\r\nTest cases using custom discoverers *in a different assembly* are not recognized as discovered unless the test case inherits from `MarshalByRefObject`. Any test case that implements `IXunitTestCase` but fails to extend from `MarshalByRefObject` will disappear silently from discovery.\r\n\r\nSetup:\r\n```\r\nX.Lib/\r\n    CustomFactAttribute : FactAttribute\r\n    CustomDiscoverer : IXunitTestCaseDiscoverer\r\n    CustomTestCase : IXunitTestCase\r\n\r\nX.Test/\r\n    Test\r\n         [CustomFact]\r\n         ItWorks()\r\n```\r\nrunning xunit.runner.console on `X.Test.lib` will show no errors and not tests. The test case just disappears silently.\r\n```\r\nxUnit.net Console Runner (64-bit .NET 4.0.30319.42000)\r\n  Discovering: X.Test (app domain = on [shadow copy], method display = ClassAndMethod)\r\n  Discovered:  X.Test (running 0 test cases)\r\n=== TEST EXECUTION SUMMARY ===\r\n   X.Test.dll  Total: 0\r\n```\r\n\r\nIf CustomTestCase is changed in inherit from `MarshalByRefObject`, everything works:\r\n```\r\nxUnit.net Console Runner (64-bit .NET 4.0.30319.42000)\r\n  Discovering: X.Test (app domain = on [shadow copy], method display = ClassAndMethod)\r\n  Discovered:  X.Test (running 1 test case)\r\n  Starting:    X.Test (parallel test collections = on, max threads = 12)\r\n   X.Test: Fake run\r\n  Finished:    X.Test\r\n=== TEST EXECUTION SUMMARY ===\r\n   X.Test  Total: 1, Errors: 0, Failed: 0, Skipped: 0, Time: 0.098s\r\n```\r\n\r\nRepro here: [repro.zip](https://github.com/xunit/xunit/files/119926/dotnet-xunit.zip)\r\n"},"comment":{"url":"https://api.github.com/repos/xunit/xunit/issues/comments/180617075","html_url":"https://github.com/xunit/xunit/issues/764#issuecomment-180617075","issue_url":"https://api.github.com/repos/xunit/xunit/issues/764","id":180617075,"user":{"login":"bradwilson","id":16944,"avatar_url":"https://avatars.githubusercontent.com/u/16944?v=3","gravatar_id":"","url":"https://api.github.com/users/bradwilson","html_url":"https://github.com/bradwilson","followers_url":"https://api.github.com/users/bradwilson/followers","following_url":"https://api.github.com/users/bradwilson/following{/other_user}","gists_url":"https://api.github.com/users/bradwilson/gists{/gist_id}","starred_url":"https://api.github.com/users/bradwilson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradwilson/subscriptions","organizations_url":"https://api.github.com/users/bradwilson/orgs","repos_url":"https://api.github.com/users/bradwilson/repos","events_url":"https://api.github.com/users/bradwilson/events{/privacy}","received_events_url":"https://api.github.com/users/bradwilson/received_events","type":"User","site_admin":false},"created_at":"2016-02-05T23:15:41Z","updated_at":"2016-02-05T23:15:41Z","body":"This is not a bug; this is a requirement for test cases.\r\n\r\nhttps://github.com/xunit/xunit/blob/10ac1bc821b28f9cc310a9c448f173760f9b05d6/src/xunit.execution/Sdk/Frameworks/TestMethodTestCase.cs#L16\r\n\r\nIf you are really providing an implementation of `IXunitTestCase`, I would strongly recommend you use [`XunitTestCase`](https://github.com/xunit/xunit/blob/10ac1bc821b28f9cc310a9c448f173760f9b05d6/src/xunit.execution/Sdk/Frameworks/XunitTestCase.cs) as your base class rather than attempting to re-implement from scratch. There are a lot of extensibility points already available through that and `TestMethodTestCase`, including the required support for serialization of test cases."}}