Adrian Hara

Working through the .NET maze

  Home  |   Contact  |   Syndication    |   Login
  42 Posts | 0 Stories | 83 Comments | 10 Trackbacks

News

Archives

Post Categories

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