Author: mhabersack
Date: 2006-11-27 14:24:29 -0500 (Mon, 27 Nov 2006)
New Revision: 68528

Modified:
   trunk/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs
   trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
   trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
   trunk/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs
Log:
App_Code assemblies fix

Modified: trunk/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs        
2006-11-27 19:00:16 UTC (rev 68527)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/CachingCompiler.cs        
2006-11-27 19:24:29 UTC (rev 68528)
@@ -123,6 +123,9 @@
                                SimpleWebHandlerParser parser = compiler.Parser;
                                CompilerParameters options = 
compiler.CompilerOptions;
                                options.IncludeDebugInformation = parser.Debug;
+#if NET_2_0
+                               GetExtraAssemblies (options);
+#endif
                                results = 
compiler.Compiler.CompileAssemblyFromFile (options, compiler.InputFile);
                                string [] deps = (string []) 
parser.Dependencies.ToArray (typeof (string));
                                cache.InsertPrivate (key, results, new 
CacheDependency (deps));
@@ -143,7 +146,9 @@
                                foreach (string str in assemblies)
                                        coll.Add (str);
                        }
-
+#if NET_2_0
+                       GetExtraAssemblies (options);
+#endif
                        return options;
                }
 
@@ -225,6 +230,25 @@
                        return type;
                }
 
+#if NET_2_0
+               static void GetExtraAssemblies (CompilerParameters options)
+               {
+                       ArrayList al = WebConfigurationManager.ExtraAssemblies;
+                       if (al != null && al.Count > 0) {
+                               foreach (object o in al)
+                                       if (o is string)
+                                               
options.ReferencedAssemblies.Add ((string) o);
+                       }
+
+                       IList list = BuildManager.CodeAssemblies;
+                       if (list != null && list.Count > 0) {
+                               foreach (object o in list)
+                                       if (o is string)
+                                               
options.ReferencedAssemblies.Add ((string) o);
+                       }
+               }
+#endif
+
                static bool AcquireCompilationTicket (string key, out object 
ticket)
                {
                        lock (compilationTickets.SyncRoot) {

Modified: trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2006-11-27 
19:00:16 UTC (rev 68527)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2006-11-27 
19:24:29 UTC (rev 68528)
@@ -1,5 +1,8 @@
 2006-11-27  Marek Habersack  <[EMAIL PROTECTED]>
 
+       * CachingCompiler.cs: Automatically reference App_Code
+       assemblies.
+
        * AppCodeCompiler.cs: Add ~/bin/*.dll to the referenced assemblies
        when compiling.
 

Modified: trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/ChangeLog  2006-11-27 19:00:16 UTC 
(rev 68527)
+++ trunk/mcs/class/System.Web/System.Web.UI/ChangeLog  2006-11-27 19:24:29 UTC 
(rev 68528)
@@ -1,3 +1,8 @@
+2006-11-27  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * SimpleWebHandlerParser.cs: Added support for looking up types in
+       the top-level assemblies (App_Code et al)
+
 2006-11-27 Igor Zelmanovich <[EMAIL PROTECTED]>
 
        * Control.cs: implemented EnsureID method.

Modified: trunk/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs  
2006-11-27 19:00:16 UTC (rev 68527)
+++ trunk/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs  
2006-11-27 19:24:29 UTC (rev 68528)
@@ -351,11 +351,27 @@
                
                internal Type GetTypeFromBin (string typeName)
                {
+                       Type result = null;
+#if NET_2_0
+                       IList toplevelAssemblies = 
BuildManager.TopLevelAssemblies;
+                       if (toplevelAssemblies != null && 
toplevelAssemblies.Count > 0) {
+                               foreach (Assembly asm in toplevelAssemblies) {
+                                       Type type = asm.GetType (typeName, 
false);
+                                       if (type != null) {
+                                               if (result != null)
+                                                       throw new HttpException 
(String.Format ("Type {0} is not unique.", typeName));
+                                       }
+                                       result = type;
+                               }
+                       }
+#endif
                        if (!Directory.Exists (PrivateBinPath))
-                               throw new HttpException (String.Format ("Type 
{0} not found.", typeName));
-
+                               if (result == null)
+                                       throw new HttpException (String.Format 
("Type {0} not found.", typeName));
+                               else
+                                       return result;
+                       
                        string [] binDlls = Directory.GetFiles (PrivateBinPath, 
"*.dll");
-                       Type result = null;
                        foreach (string dll in binDlls) {
                                Assembly assembly = Assembly.LoadFrom (dll);
                                Type type = assembly.GetType (typeName, false);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to