Geeks With Blogs
Adrian Hara Working through the .NET maze

I found another oddity today, although if I think about it it's rather more of a cruel irony .

The MSDN docs for Activator.CreateInstance(AppDomain domain, string assemblyName, string typeName) state that if you pass in a null value for the "assemblyName" then the current assembly is searched. Unfortunetely, upon calling it I found that a System.NullReference exception is thrown instead.

And now the cruel irony: Activator.CreateInstance(AppDomain someDomain...) indeed doesn't check for the "assemblyName" parameter being null and just calls someDomain.CreateInstance(string assemblyName, string typeName). Unfortunately this does check and throw a NullReferenceException. Oops! :)

Posted on Friday, November 24, 2006 9:23 AM | Back to top


Comments on this post: Activator.CreateInstance in another AppDomain

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Adrian Hara | Powered by: GeeksWithBlogs.net