Geeks With Blogs

News My Blog has been MOVED to https://mfreidge.wordpress.com
Michael Freidgeim's OLD Blog My Blog has been MOVED to https://mfreidge.wordpress.com

I've rebuild ''DotNetNuke.Modules.Html.SqlDataProvider'.DLL' from the downloaded source code and started to receive errors: 

System.TypeLoadException: Could not load type ''DotNetNuke.Modules.Html.SqlDataProvider'' from assembly ''DotNetNuke.Modules.Html.SqlDataProvider''.
   at System.RuntimeTypeHandle._GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName)
   at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
   at System.RuntimeType.PrivateGetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
   at System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase)
   at System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase)
   at System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError)
   at DotNetNuke.Framework.Reflection.CreateObject(String TypeName, String CacheKey, Boolean UseCache) in C:\Projects\DNNLibrary\Components\Shared\Reflection.vb:line 241

After investigation I noticed that caller specify provider namespace as ''DotNetNuke.Modules.Html", but the actual namespace in SqlDataProvider'.vb is ''DotNetNuke.Modules.HTML".

Because current code in DotNetNuke.Framework.Reflection.CreateObject loads case-sensitive names, the error occured.

It will be bettter to change core code to use BuildManager.GetType overload that ignores case.

objType = BuildManager.GetType(TypeName, True, True)

I've reported a bug in DNN support. Update: It will be fixed in DNN 4.1

Posted on Wednesday, February 15, 2006 12:32 PM DotNetNuke | Back to top


Comments on this post: DNN 4.0 loads Provider classes with case-sensitive names.

# re: DNN 4.0 loads Provider classes with case-sensitive names.
Requesting Gravatar...
Hi Chen,
Sorry, but I am not an expert in DNN.
I beleive that in DNN 4 it is still quite valid to create separate DLLs for DataProvider and SqlDataProvider. In this case you will have full control under assembly name( but will be less convinient debugging,because edit and continue will not work for loaded DLLs).
>>2) Why do these modules work when we actually run them, but not under unit testing? >>Do the modules get instantiated differently?
As I understand, ASP.NET runtime is searching bin folder for assemblies, that have requested to load classes. Unit test framework probably not as smart.
If you are using VSTS for unit testing, this link can be useful for you.
Left by Michael Freidgeim on Feb 19, 2006 7:30 PM

# re: DNN 4.0 loads Provider classes with case-sensitive names.
Requesting Gravatar...
Visual Studio Team System
How to: Create an ASP.NET Unit Test : http://msdn2.microsoft.com/en-us/library/ms182526.aspx .
Left by Michael Freidgeim on Feb 19, 2006 7:36 PM

Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net