DNN 4.0 loads Provider classes with case-sensitive names.

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 @ Wednesday, February 15, 2006 12:32 PM

Print

Comments on this entry:

# re: DNN 4.0 loads Provider classes with case-sensitive names.

Left by Jeff at 2/18/2006 6:55 AM
Gravatar
Hi Michael,

I also had problems with the Bulidmananger, and I thought I'd post a comment here since you seem like an expert:

We are developing custom modules for our own use with DNN 4. Under the new architecture, all the custom modules will go into a single assembly (versus the old architecture where all the modules are seperate, each with 2 assemblies, one for the Type and one for the sqldataprovider).

The problem comes with unit testing indivituals. When we call dataprovider.Instance(), the Buildmanager, by default, looks for the assemblies that have the same name as the namespace...which does not exist...

So I have 2 questions
1) I have tried giving the name of the assembly as a string arg in my call to CreateObject, but it seems to make no difference. Is there an easy solution to this problem?

2) Why do these modules work when we actually run them, but not under unit testing? Do the modules get instantiated differently?



My email is chen.jeff 'at' gmail.com . If you can also email the reply there, I would greatly appreciate it! Or if you can refer me to someone would be great also.

# re: DNN 4.0 loads Provider classes with case-sensitive names.

Left by Michael Freidgeim at 2/19/2006 7:30 PM
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.

# re: DNN 4.0 loads Provider classes with case-sensitive names.

Left by Michael Freidgeim at 2/19/2006 7:36 PM
Gravatar
Visual Studio Team System
How to: Create an ASP.NET Unit Test : http://msdn2.microsoft.com/en-us/library/ms182526.aspx .

Your comment:



 (will not be displayed)


 
 
 
 
 

Live Comment Preview:

 
«November»
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345