mercredi 10 février 2016

Why doesn't the calling assembly show up in the current app domain in c#?

I'm using MonoDevelop and I have one library project and one NUnit project in the same solution. The NUnit project references the library and contains my tests. Some of the behavior that I would like to test involves inspecting types and methods in loaded assemblies. I tried using AppDomain.CurrentDomain.GetAssemblies() but neither the library nor the NUnit tests are in any of these assemblies. I'm sure that I'm misunderstanding something here but I expected to find them both here. I can get the library by calling AppDomain.GetExecutingAssembly() and the tests by calling AppDomain.GetCallingAssembly() but the latter is not totally reliable based on what I've read (because of possible inlining for one thing).

Could somebody please clear up for me why the executing and calling assemblies aren't in the current app domain? Is it possible to loop over a collection of assemblies that would include both of these? I've found an example of looping over all app domains but it requires mscoree which is not available in MonoDevelop.





Aucun commentaire:

Enregistrer un commentaire