Skip to content

Commit

Permalink
Backport of r137811
Browse files Browse the repository at this point in the history
svn path=/branches/mono-2-4-2/mcs/; revision=138560
  • Loading branch information
grendello committed Jul 23, 2009
1 parent 439e543 commit c9239c8
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 28 deletions.
14 changes: 11 additions & 3 deletions mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -668,9 +668,17 @@ public void Compile ()
} 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);
}
}

Expand Down
6 changes: 6 additions & 0 deletions mcs/class/System.Web/System.Web.Compilation/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
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-23 Marek Habersack <mhabersack@novell.com>

* AspGenerator.cs: TextParsed takes a different approach to
Expand Down
7 changes: 6 additions & 1 deletion mcs/class/System.Web/System.Web.Configuration_2.0/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
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-06-12 Gonzalo Paniagua Javier <gonzalo@novell.com>

* WebConfigurationHost.cs: workaround to avoid definition errors when
a null config path is passed.


2009-06-05 Marek Habersack <mhabersack@novell.com>

* WebConfigurationManager.cs: OpenWebConfiguration caches
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,6 @@ public static class ProvidersHelper
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));
Expand Down
8 changes: 8 additions & 0 deletions mcs/class/System.Web/System.Web/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
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-23 Marek Habersack <mhabersack@novell.com>

* HttpException.cs: if an exception is processed which refers to
Expand Down
24 changes: 21 additions & 3 deletions mcs/class/System.Web/System.Web/HttpApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1840,12 +1840,19 @@ internal static Type LoadType (string typeName, bool throwOnMissing)
}
#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;
}
Expand All @@ -1855,7 +1862,18 @@ internal static Type LoadTypeFromBin (string typeName)
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;
Expand Down

0 comments on commit c9239c8

Please sign in to comment.