} else
return;
- if (HttpApplication.LoadTypeFromBin (providerTypeName) == null)
- throw new HttpException (String.Format ("Profile provider type not found: {0}",
- providerTypeName));
+ Exception noTypeException = null;
+ Type ptype = null;
+
+ try {
+ ptype = HttpApplication.LoadTypeFromBin (providerTypeName);
+ } catch (Exception ex) {
+ noTypeException = ex;
+ }
+
+ if (ptype == null)
+ throw new HttpException (String.Format ("Profile provider type not found: {0}", providerTypeName), noTypeException);
}
}
+2009-07-13 Marek Habersack <mhabersack@novell.com>
+
+ * AppCodeCompiler.cs: wrap HttpApplication.LoadTypeFromBin call in
+ try/catch, so that we can wrap the possible exception in
+ HttpException.
+
2009-07-09 Marek Habersack <mhabersack@novell.com>
* DefaultResourceProvider.cs, DefaultResourceProviderFactory.cs:
+2009-07-13 Marek Habersack <mhabersack@novell.com>
+
+ * ProvidersHelper.cs: InstantiateProvider doesn't have to
+ explicitly look for types in App_Code assemblies - this is done in
+ HttpApplication.LoadType.
+
2009-07-09 Gonzalo Paniagua Javier <gonzalo@novell.com>
* WebConfigurationHost.cs: null means MachineToApplication.
public static ProviderBase InstantiateProvider (ProviderSettings providerSettings, Type providerType)
{
Type settingsType = HttpApplication.LoadType (providerSettings.Type);
-
- if (settingsType == null)
- settingsType = HttpApplication.LoadTypeFromBin (providerSettings.Type);
-
- // check App_Code dlls
- if (settingsType == null) {
- IList appCode = BuildManager.CodeAssemblies;
-
- if (appCode != null && appCode.Count > 0) {
- Assembly asm;
- foreach (object o in appCode) {
- asm = o as Assembly;
- if (asm == null)
- continue;
- settingsType = asm.GetType (providerSettings.Type);
- if (settingsType != null)
- break;
- }
- }
- }
-
if (settingsType == null)
throw new ConfigurationErrorsException (String.Format ("Could not find type: {0}",
providerSettings.Type));
+2009-07-13 Marek Habersack <mhabersack@novell.com>
+
+ * HttpApplication.cs: LoadType - wrap call to LoadTypeFromBin in
+ try/catch so that we can decide whether or not to throw
+ exceptions. LoadTypeFromBin - ignore the FileLoadException and
+ BadImageException exceptions as they don't matter in this
+ context.
+
2009-07-13 Gert Driesen <drieseng@users.sourceforge.net>
* HttpResponseStream.cs: Added argument checks to Write. Modified
}
#endif
- type = LoadTypeFromBin (typeName);
+ Exception loadException = null;
+ try {
+ type = null;
+ type = LoadTypeFromBin (typeName);
+ } catch (Exception ex) {
+ loadException = ex;
+ }
+
if (type != null)
return type;
#endif
if (throwOnMissing)
- throw new TypeLoadException (String.Format ("Type '{0}' cannot be found", typeName));
+ throw new TypeLoadException (String.Format ("Type '{0}' cannot be found", typeName), loadException);
return null;
}
Type type = null;
foreach (string s in BinDirectoryAssemblies) {
- Assembly binA = Assembly.LoadFrom (s);
+ Assembly binA = null;
+
+ try {
+ binA = Assembly.LoadFrom (s);
+ } catch (FileLoadException) {
+ // ignore
+ continue;
+ } catch (BadImageFormatException) {
+ // ignore
+ continue;
+ }
+
type = binA.GetType (typeName, false);
if (type == null)
continue;