[Mono-bugs] [Bug 81307][Nor] New - Custom ProfileProvider causes exception on app start

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Apr 4 01:05:19 EDT 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by mmorano at mikeandwan.us.

http://bugzilla.ximian.com/show_bug.cgi?id=81307

--- shadow/81307	2007-04-04 01:05:19.000000000 -0400
+++ shadow/81307.tmp.28104	2007-04-04 01:05:19.000000000 -0400
@@ -0,0 +1,88 @@
+Bug#: 81307
+Product: Mono: Class Libraries
+Version: 1.2
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.Web
+AssignedTo: mhabersack at novell.com                            
+ReportedBy: mmorano at mikeandwan.us               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Custom ProfileProvider causes exception on app start
+
+When trying to use a custom profile provider (defined in app_code), there
+is an exception raised early in the life of the application when it
+attempts to compile the app_code directory.
+
+This is triggered when a custom profile provider is configured in the
+web.config such as:
+
+<profile defaultProvider="MyProfileProvider">
+	<providers>
+		<clear />
+		<add name="MyProfileProvider" 
+		     type="Blah.MyProfileProvider" />
+	</providers>
+	<properties>
+		<clear />
+			<add name="FirstName" type="string" />
+			...	
+	</properties>
+</profile>
+
+The exception raised is as follows:
+
+System.Web.HttpException: Profile provider type not found:
+MikeAndWanUS.Users.MawProfileProvider
+  at System.Web.Compilation.AppCodeCompiler.GetProfileProviderAttribute
+(System.Web.Configuration.ProfileSection ps,
+System.CodeDom.CodeAttributeDeclarationCollection collection, System.String
+providerName) [0x00000] 
+  at System.Web.Compilation.AppCodeCompiler.AddProfileClassProperty
+(System.Web.Configuration.ProfileSection ps,
+System.CodeDom.CodeTypeDeclaration profileClass,
+System.Web.Configuration.ProfilePropertySettings pset) [0x00000] 
+  at System.Web.Compilation.AppCodeCompiler.BuildProfileClass
+(System.Web.Configuration.ProfileSection ps, System.String className,
+System.Web.Configuration.ProfilePropertySettingsCollection psc,
+System.CodeDom.CodeNamespace ns, System.String baseClass, Boolean
+baseIsGlobal, System.Collections.Generic.SortedList`2 groupProperties)
+[0x00000] 
+  at System.Web.Compilation.AppCodeCompiler.ProcessCustomProfile
+(System.Web.Configuration.ProfileSection ps,
+System.Web.Compilation.AppCodeAssembly defasm) [0x00000] 
+  at System.Web.Compilation.AppCodeCompiler.Compile () [0x00000] 
+  at System.Web.HttpApplicationFactory.InitType (System.Web.HttpContext
+context) [0x00000] 
+
+
+
+After looking into this further, the issue is contained in the
+AppCodeCompiler.GetProfileProviderAttribute method.  In this method, it
+starts by successfully pulling the providerTypeName from the configuration
+settings.  However, it then tries to affirm that the type is indeed valid
+by the following block of code (around line 405):
+
+Type type = Type.GetType (providerTypeName, false);
+if (type == null) {
+    type = GetTypeFromBin (providerTypeName);
+	if (type == null)
+		throw new HttpException (String.Format ("Profile provider type not found:
+{0}", providerTypeName));
+			}
+
+The problem here, is that if your custom profile provider is in the
+App_Code directory - this dll has not yet been built.  Therefore, this
+check can not succeed in this case.  After commenting out this code, the
+application loads and it appears that the provider is then available to the
+application.  
+
+The fix would seem to be to remove this check, or to delay the creation of
+the profile class until everything in app_code is available, and then add
+the profile class to an existing / new app code assembly somehow.


More information about the mono-bugs mailing list