Search code examples
c#reflectioncompact-frameworktypesruntime

BuildManager.GetType on the Compact Framework ( resolving a class name at runtime on all appdomain )


Is there any way to search for a Type with only its type name in all application domain on the Compact Framework 2.0? Type.GetType's behavior needs one to specify the assembly name on where to look. BuildManager.GetType does exactly that, but it isn't available for the CF. While this would be fine if I could call AppDomain.CurrentDomain.GetAssemblies() , I can't do that either on the CF.

If there is no better way to solve this, is there any way to intercept the assembly loading process by the main exe, so I could maintain a list of the current assemblies loaded, even those that are directly referenced by my application?

Thanks! Cauê


Solution

  • For me, what solved the problem was invoking Assembly.GetCallingAssembly().GetType(s) and Assembly.GetEntryAssembly().GetType(s) .

    It really isn't a 1:1 substitute, and in more complex cases this will fail, but it really did the job if I wanted to put in separate assemblies the GetType() logic and the calling assembly's type. I am still looking for a way to iterate over all assemblies on an appdomain on the Compact Framework, though.