Author: mhabersack
Date: 2007-08-21 17:13:54 -0400 (Tue, 21 Aug 2007)
New Revision: 84589

Modified:
   trunk/mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs
   trunk/mcs/class/System.Web/System.Web.Compilation/BuildProvider.cs
   trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
   trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ChangeLog
   trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ProvidersHelper.cs
   trunk/mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs
   trunk/mcs/class/System.Web/System.Web.Hosting/ChangeLog
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
   trunk/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceView.cs
   trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
   trunk/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs
   trunk/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs
   trunk/mcs/class/System.Web/System.Web.UI/TemplateParser.cs
   trunk/mcs/class/System.Web/System.Web/ChangeLog
   trunk/mcs/class/System.Web/System.Web/HttpApplication.cs
   trunk/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs
   trunk/mcs/class/System.Web/Test/System.Web.Hosting/ApplicationHostTest.cs
   trunk/mcs/class/System.Web/Test/System.Web.Hosting/ChangeLog
Log:
2007-08-21  Marek Habersack  <[EMAIL PROTECTED]>

        * ApplicationHostTest.cs: adjust the test for the PrivateBinPath
        changes.

2007-08-21  Marek Habersack  <[EMAIL PROTECTED]>

        * ProvidersHelper.cs: use HttpApplication.LoadTypeFromPrivateBin
        to get the provider settings type.

2007-08-21  Marek Habersack  <[EMAIL PROTECTED]>

        * HttpApplicationFactory.cs: watch for changes in all the
        private binary directories for the current application domain.

        * HttpApplication.cs: turn the PrivateBinPath property into an
        internal enumerable, so that code throughout the assembly can
        iterate over the list of private bin directories configured for
        the application domain.
        Added a new internal method LoadTypeFromPrivateBin, for sharing
        with other parts of the assembly.

2007-08-21  Marek Habersack  <[EMAIL PROTECTED]>

        * SimpleWebHandlerParser.cs: use HttpApplication.PrivateBinPath
        enumerator when loading or adding assemblies from binary
        directories. Remove unused PrivateBinPath property.

        * ControlBuilder.cs: remove unused PrivateBinPath property.

        * TemplateParser.cs: use HttpApplication.PrivateBinPath when
        adding assemblis and loading types.

2007-08-21  Marek Habersack  <[EMAIL PROTECTED]>

        * ApplicationHost.cs: AppDomainSetup.PrivateBinPath should contain
        a list of paths relative to AppDomainSetup.ApplicationBase, not a
        full path.
        We no longer check if the bin directories exist, the user can
        create them while the application is running.

2007-08-21  Marek Habersack  <[EMAIL PROTECTED]>

        * ObjectDataSourceView.cs: get rid of PrivateBinPath property,
        it's unused.

2007-08-21  Marek Habersack  <[EMAIL PROTECTED]>

        * BuildProvider.cs: use HttpApplication.PrivateBinPath enumerator
        to look up assemblies in the binary path(s).


Modified: trunk/mcs/class/System.Web/System.Web/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web/ChangeLog     2007-08-21 20:59:57 UTC 
(rev 84588)
+++ trunk/mcs/class/System.Web/System.Web/ChangeLog     2007-08-21 21:13:54 UTC 
(rev 84589)
@@ -1,3 +1,15 @@
+2007-08-21  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * HttpApplicationFactory.cs: watch for changes in all the
+       private binary directories for the current application domain.
+
+       * HttpApplication.cs: turn the PrivateBinPath property into an
+       internal enumerable, so that code throughout the assembly can
+       iterate over the list of private bin directories configured for
+       the application domain.
+       Added a new internal method LoadTypeFromPrivateBin, for sharing
+       with other parts of the assembly.
+
 2007-08-18  Juraj Skripsky <[EMAIL PROTECTED]>
 
        * HttpRequest.cs (StripPath): Fix off-by-one error, make static.

Modified: trunk/mcs/class/System.Web/System.Web/HttpApplication.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web/HttpApplication.cs    2007-08-21 
20:59:57 UTC (rev 84588)
+++ trunk/mcs/class/System.Web/System.Web/HttpApplication.cs    2007-08-21 
21:13:54 UTC (rev 84589)
@@ -1292,18 +1292,20 @@
                }
 #endregion
 
-               private static string privateBinPath;
-               private static string PrivateBinPath {
+               internal static IEnumerable PrivateBinPath
+               {
                        get {
-                               if (privateBinPath != null)
-                                       return privateBinPath;
+                               AppDomainSetup setup = 
AppDomain.CurrentDomain.SetupInformation;
+                               string baseDir = setup.ApplicationBase;
                                
-                               AppDomainSetup setup = 
AppDomain.CurrentDomain.SetupInformation;
-                               privateBinPath = 
Path.Combine(setup.ApplicationBase, setup.PrivateBinPath);
-                               return privateBinPath;
+                               string pbp = setup.PrivateBinPath;
+                               if (pbp == null || pbp.Length == 0)
+                                       return false;
+                               foreach (string d in pbp.Split (':'))
+                                       yield return Path.Combine (baseDir, d);
                        }
-               }               
-
+               }
+                       
                internal static Type LoadType (string typeName)
                {
                        return LoadType (typeName, false);
@@ -1334,23 +1336,36 @@
                                }
                        }
 #endif
+
+                       type = LoadTypeFromPrivateBin (typeName);
+                       if (type != null)
+                               return type;
                        
-                       if (!Directory.Exists (PrivateBinPath))
-                               return null;
+                       if (throwOnMissing)
+                               throw new TypeLoadException (String.Format 
("Type '{0}' cannot be found", typeName));
                        
-                       string[] binDlls = Directory.GetFiles(PrivateBinPath, 
"*.dll");
-                       foreach (string s in binDlls) {
-                               Assembly binA = Assembly.LoadFrom (s);
-                               type = binA.GetType (typeName, false);
-                               if (type == null)
+                       return null;
+               }
+
+               internal static Type LoadTypeFromPrivateBin (string typeName)
+               {
+                       Type type = null;
+                       
+                       foreach (string dir in PrivateBinPath) {
+                               if (!Directory.Exists (dir))
                                        continue;
+                       
+                               string[] binDlls = Directory.GetFiles(dir, 
"*.dll");
+                               foreach (string s in binDlls) {
+                                       Assembly binA = Assembly.LoadFrom (s);
+                                       type = binA.GetType (typeName, false);
+                                       if (type == null)
+                                               continue;
                                
-                               return type;
+                                       return type;
+                               }
                        }
 
-                       if (throwOnMissing)
-                               throw new TypeLoadException (String.Format 
("Type '{0}' cannot be found", typeName));
-                       
                        return null;
                }
        }

Modified: trunk/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs     
2007-08-21 20:59:57 UTC (rev 84588)
+++ trunk/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs     
2007-08-21 21:13:54 UTC (rev 84589)
@@ -445,8 +445,8 @@
                                factory.InitType (context);
                                lock (factory) {
                                        if (factory.app_start_needed) {
-                                               WatchLocationForRestart 
(AppDomain.CurrentDomain.SetupInformation.PrivateBinPath,
-                                                                        
"*.dll");
+                                               foreach (string dir in 
HttpApplication.PrivateBinPath)
+                                                       WatchLocationForRestart 
(dir, "*.dll");
 #if NET_2_0
                                                WatchLocationForRestart 
("App_Code", "*", true);
                                                WatchLocationForRestart 
("App_Browsers", "*");

Modified: trunk/mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs        
2007-08-21 20:59:57 UTC (rev 84588)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs        
2007-08-21 21:13:54 UTC (rev 84589)
@@ -349,7 +349,6 @@
                // unambiguous language assigned to them (e.g. .wsdl files), are
                // built using the default website compiler.
                private List<AppCodeAssembly> assemblies;
-               string _bindir = null;
                string providerTypeName = null;
                
                public AppCodeCompiler ()
@@ -382,28 +381,6 @@
                        return new CodeTypeReference (type);
                }
 
-               Type GetTypeFromBin (string typeName)
-               {
-                       string bindir = BinDir;
-                       if (!Directory.Exists (bindir))
-                               return null;
-                       
-                       string [] binDlls = Directory.GetFiles (bindir, 
"*.dll");
-                       Type ret = null;
-                       foreach (string dll in binDlls) {
-                               try {
-                                       Assembly asm = Assembly.LoadFrom (dll);
-                                       ret = asm.GetType (typeName, false);
-                                       if (ret != null)
-                                               break;
-                               } catch (Exception) {
-                                       continue;
-                               }
-                       }
-
-                       return ret;
-               }
-
                string FindProviderTypeName (ProfileSection ps, string 
providerName)
                {
                        if (ps.Providers == null || ps.Providers.Count == 0)
@@ -662,10 +639,19 @@
                                return;
 
                        HttpRuntime.EnableAssemblyMapping (true);
-                       string bindir = BinDir;
+                       ArrayList binAssembliesAl = null;
                        string[] binAssemblies = null;
-                       if (Directory.Exists (bindir))
-                               binAssemblies = Directory.GetFiles (bindir, 
"*.dll");
+                       
+                       foreach (string bindir in 
HttpApplication.PrivateBinPath) {
+                               if (!Directory.Exists (bindir))
+                                       continue;
+                               if (binAssemblies == null)
+                                       binAssembliesAl = new ArrayList ();
+                               binAssembliesAl.AddRange (Directory.GetFiles 
(bindir, "*.dll"));
+                       }
+                       if (binAssembliesAl != null)
+                               binAssemblies = 
(string[])binAssembliesAl.ToArray (typeof (string));
+                       
                        foreach (AppCodeAssembly aca in assemblies)
                                aca.Build (binAssemblies);
                        _alreadyCompiled = true;
@@ -683,7 +669,7 @@
                                } else
                                        return;
 
-                               if (GetTypeFromBin (providerTypeName) == null)
+                               if (HttpApplication.LoadTypeFromPrivateBin 
(providerTypeName) == null)
                                        throw new HttpException (String.Format 
("Profile provider type not found: {0}",
                                                                                
providerTypeName));
                        }
@@ -711,16 +697,6 @@
                        }
                        return haveFiles;
                }
-
-               private string BinDir {
-                       get {
-                               if (_bindir != null)
-                                       return _bindir;
-                               AppDomainSetup setup = 
AppDomain.CurrentDomain.SetupInformation;
-                               _bindir = Path.Combine (setup.ApplicationBase, 
setup.PrivateBinPath);
-                               return _bindir;
-                       }
-               }
        }
 }
 #endif

Modified: trunk/mcs/class/System.Web/System.Web.Compilation/BuildProvider.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/BuildProvider.cs  
2007-08-21 20:59:57 UTC (rev 84588)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/BuildProvider.cs  
2007-08-21 21:13:54 UTC (rev 84589)
@@ -44,9 +44,6 @@
 namespace System.Web.Compilation {
 
        public abstract class BuildProvider {
-               static object locker = new object ();
-               static string private_bin_path;
-
                string virtual_path;
                ArrayList ref_assemblies;
 
@@ -94,28 +91,17 @@
                        // embedded? linked?/resources
                }
 
-               
-               static void InitPath ()
-               {
-                       lock (locker) {
-                               if (private_bin_path != null)
-                                       return;
-
-                               AppDomainSetup setup = 
AppDomain.CurrentDomain.SetupInformation;
-                               private_bin_path = Path.Combine 
(setup.ApplicationBase, setup.PrivateBinPath);
-                       }
-               }
-
                void AddAssembliesInBin (StringCollection coll)
                {
-                       InitPath ();
-                       if (!Directory.Exists (private_bin_path))
-                               return;
+                       foreach (string private_bin_path in 
HttpApplication.PrivateBinPath) {
+                               if (!Directory.Exists (private_bin_path))
+                                       continue;
 
-                       string [] binDlls = Directory.GetFiles 
(private_bin_path, "*.dll");
-                       foreach (string s in binDlls) {
-                               coll.Add (s);
-                               ref_assemblies.Add (s);
+                               string [] binDlls = Directory.GetFiles 
(private_bin_path, "*.dll");
+                               foreach (string s in binDlls) {
+                                       coll.Add (s);
+                                       ref_assemblies.Add (s);
+                               }
                        }
                }
 

Modified: trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2007-08-21 
20:59:57 UTC (rev 84588)
+++ trunk/mcs/class/System.Web/System.Web.Compilation/ChangeLog 2007-08-21 
21:13:54 UTC (rev 84589)
@@ -1,3 +1,8 @@
+2007-08-21  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * BuildProvider.cs: use HttpApplication.PrivateBinPath enumerator
+       to look up assemblies in the binary path(s).
+
 2007-08-19  Juraj Skripsky <[EMAIL PROTECTED]>
 
        * GlobalAsaxCompiler.cs (ProcessObjects): Make string comparison

Modified: trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ChangeLog   
2007-08-21 20:59:57 UTC (rev 84588)
+++ trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ChangeLog   
2007-08-21 21:13:54 UTC (rev 84589)
@@ -1,3 +1,8 @@
+2007-08-21  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * ProvidersHelper.cs: use HttpApplication.LoadTypeFromPrivateBin
+       to get the provider settings type.
+
 2007-08-10  Gert Driesen  <[EMAIL PROTECTED]>
 
        * PagesEnableSessionState.cs: Marked internal on 1.0 profile.

Modified: 
trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ProvidersHelper.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ProvidersHelper.cs  
2007-08-21 20:59:57 UTC (rev 84588)
+++ trunk/mcs/class/System.Web/System.Web.Configuration_2.0/ProvidersHelper.cs  
2007-08-21 21:13:54 UTC (rev 84589)
@@ -37,26 +37,19 @@
 using System.Data.SqlClient;
 using System.IO;
 using System.Reflection;
+using System.Web;
 using System.Web.Compilation;
 
 namespace System.Web.Configuration {
 
        public static class ProvidersHelper
        {
-               private static string privateBinPath = null;
-               
                public static ProviderBase InstantiateProvider 
(ProviderSettings providerSettings, Type providerType)
                {
                        Type settingsType = Type.GetType 
(providerSettings.Type);
-                       if (settingsType == null && Directory.Exists 
(PrivateBinPath)) {
-                               string [] binDlls = Directory.GetFiles 
(PrivateBinPath, "*.dll");
-                               foreach (string s in binDlls) {
-                                       Assembly binA = Assembly.LoadFrom (s);
-                                       settingsType = binA.GetType 
(providerSettings.Type);
-                                       if (settingsType != null)
-                                               break;
-                               }
-                       }
+                       
+                       if (settingsType == null)
+                               settingsType = 
HttpApplication.LoadTypeFromPrivateBin (providerSettings.Type);
 
                        // check App_Code dlls
                        if (settingsType == null) {
@@ -89,18 +82,6 @@
                        return provider;
                }
 
-               private static string PrivateBinPath {
-                       get {
-                               if (privateBinPath != null)
-                                       return privateBinPath;
-
-                               AppDomainSetup setup = 
AppDomain.CurrentDomain.SetupInformation;
-                               privateBinPath = Path.Combine 
(setup.ApplicationBase, setup.PrivateBinPath);
-
-                               return privateBinPath;
-                       }
-               }
-
                public static void InstantiateProviders 
(ProviderSettingsCollection configProviders, ProviderCollection providers, Type 
providerType)
                {
                        if (!typeof (ProviderBase).IsAssignableFrom 
(providerType))

Modified: trunk/mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs    
2007-08-21 20:59:57 UTC (rev 84588)
+++ trunk/mcs/class/System.Web/System.Web.Hosting/ApplicationHost.cs    
2007-08-21 21:13:54 UTC (rev 84589)
@@ -117,15 +117,6 @@
                        }
 #endif
                }
-
-               static string GetBinPath (string physicalDir)
-               {
-                       string ret = Path.Combine (physicalDir, "Bin");
-                       if (Directory.Exists (ret))
-                               return ret;
-                       ret = Path.Combine (physicalDir, "bin");
-                       return ret;
-               }
                
                //
                // For further details see `Hosting the ASP.NET runtime'
@@ -163,11 +154,15 @@
                        setup.CachePath = null;
                        setup.ConfigurationFile = FindWebConfig (physicalDir);
                        setup.DisallowCodeDownload = true;
-                       string bin_path = GetBinPath (physicalDir);
-                       setup.PrivateBinPath = bin_path;
+
+                       //
+                       // We use Path.PathSeparator even though MSDN says 
semicolons are used. Our
+                       // runtime expects a Path.PathSeparator.
+                       //
+                       setup.PrivateBinPath = String.Format ("Bin{0}bin", 
Path.PathSeparator);
                        setup.PrivateBinPathProbe = "*";
                        setup.ShadowCopyFiles = "true";
-                       setup.ShadowCopyDirectories = bin_path;
+                       setup.ShadowCopyDirectories = setup.PrivateBinPath;
 
                        string dynamic_dir = null;
                        string user = Environment.UserName;

Modified: trunk/mcs/class/System.Web/System.Web.Hosting/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Hosting/ChangeLog     2007-08-21 
20:59:57 UTC (rev 84588)
+++ trunk/mcs/class/System.Web/System.Web.Hosting/ChangeLog     2007-08-21 
21:13:54 UTC (rev 84589)
@@ -1,3 +1,11 @@
+2007-08-21  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * ApplicationHost.cs: AppDomainSetup.PrivateBinPath should contain
+       a list of paths relative to AppDomainSetup.ApplicationBase, not a
+       full path.
+       We no longer check if the bin directories exist, the user can
+       create them while the application is running.
+
 2007-07-21  Marek Habersack  <[EMAIL PROTECTED]>
 
        * ApplicationHost.cs: ClearDynamicBaseDirectory becomes an

Modified: trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/ChangeLog  2007-08-21 20:59:57 UTC 
(rev 84588)
+++ trunk/mcs/class/System.Web/System.Web.UI/ChangeLog  2007-08-21 21:13:54 UTC 
(rev 84589)
@@ -1,3 +1,14 @@
+2007-08-21  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * SimpleWebHandlerParser.cs: use HttpApplication.PrivateBinPath
+       enumerator when loading or adding assemblies from binary
+       directories. Remove unused PrivateBinPath property.
+
+       * ControlBuilder.cs: remove unused PrivateBinPath property.
+
+       * TemplateParser.cs: use HttpApplication.PrivateBinPath when
+       adding assemblis and loading types.
+
 2007-08-21 Igor Zelmanovich <[EMAIL PROTECTED]>
 
        * ClientScriptManager.cs: fixed onsubmit script for MultiForm 
environment 

Modified: trunk/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs  2007-08-21 
20:59:57 UTC (rev 84588)
+++ trunk/mcs/class/System.Web/System.Web.UI/ControlBuilder.cs  2007-08-21 
21:13:54 UTC (rev 84589)
@@ -159,20 +159,6 @@
                                return ptype;
                        }
                }
-
-#if NET_2_0
-               private static string PrivateBinPath {
-                        get {
-                                if (privateBinPath != null)
-                                        return privateBinPath;
-
-                                AppDomainSetup setup = 
AppDomain.CurrentDomain.SetupInformation;
-                                privateBinPath = Path.Combine 
(setup.ApplicationBase, setup.PrivateBinPath);
-
-                                return privateBinPath;
-                        }
-                }
-#endif
                
 #if NET_2_0
                public virtual

Modified: trunk/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs  
2007-08-21 20:59:57 UTC (rev 84588)
+++ trunk/mcs/class/System.Web/System.Web.UI/SimpleWebHandlerParser.cs  
2007-08-21 21:13:54 UTC (rev 84589)
@@ -341,37 +341,42 @@
 
                void AddAssembliesInBin ()
                {
-                       if (!Directory.Exists (PrivateBinPath))
-                               return;
+                       foreach (string bindir in 
HttpApplication.PrivateBinPath) {
+                               if (!Directory.Exists (bindir))
+                                       continue;
 
-                       string [] binDlls = Directory.GetFiles (PrivateBinPath, 
"*.dll");
-                       foreach (string dll in binDlls) {
-                               try {
-                                       Assembly assembly = Assembly.LoadFrom 
(dll);
-                                       AddAssembly (assembly, true);
-                               } catch (Exception e) {
-                                       throw new Exception ("Error while 
loading " + dll, e);
+                               string [] binDlls = Directory.GetFiles (bindir, 
"*.dll");
+                               foreach (string s in binDlls) {
+                                       try {
+                                               Assembly assembly = 
Assembly.LoadFrom (s);
+                                               AddAssembly (assembly, true);
+                                       } catch (Exception e) {
+                                               throw new Exception ("Error 
while loading " + s, e);
+                                       }
                                }
+                                       
                        }
                }
 
                Assembly LoadAssemblyFromBin (string name)
                {
-                       Assembly assembly;
-                       if (!Directory.Exists (PrivateBinPath))
-                               return null;
-
-                       string [] binDlls = Directory.GetFiles (PrivateBinPath, 
"*.dll");
-                       foreach (string dll in binDlls) {
-                               string fn = Path.GetFileName (dll);
-                               fn = Path.ChangeExtension (fn, null);
-                               if (fn != name)
+                       Assembly assembly = null;
+                       foreach (string bindir in 
HttpApplication.PrivateBinPath) {
+                               if (!Directory.Exists (bindir))
                                        continue;
 
-                               assembly = Assembly.LoadFrom (dll);
-                               return assembly;
-                       }
+                               string [] binDlls = Directory.GetFiles (bindir, 
"*.dll");
+                               foreach (string dll in binDlls) {
+                                       string fn = Path.GetFileName (dll);
+                                       fn = Path.ChangeExtension (fn, null);
+                                       if (fn != name)
+                                               continue;
 
+                                       assembly = Assembly.LoadFrom (dll);
+                                       return assembly;
+                               }
+                       }
+                       
                        return null;
                }
 
@@ -397,11 +402,13 @@
                internal Type GetTypeFromBin (string typeName)
                {
                        Type result = null;
+                       Type type = 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);
+                                       type = asm.GetType (typeName, false);
                                        if (type != null) {
                                                if (result != null)
                                                        throw new HttpException 
(String.Format ("Type {0} is not unique.", typeName));
@@ -410,24 +417,24 @@
                                }
                        }
 #endif
-                       if (!Directory.Exists (PrivateBinPath))
-                               if (result == null)
-                                       throw new HttpException (String.Format 
("Type {0} not found.", typeName));
-                               else
-                                       return result;
-                       
-                       string [] binDlls = Directory.GetFiles (PrivateBinPath, 
"*.dll");
-                       foreach (string dll in binDlls) {
-                               Assembly assembly = Assembly.LoadFrom (dll);
-                               Type type = assembly.GetType (typeName, false);
-                               if (type != null) {
-                                       if (result != null) 
-                                               throw new HttpException 
(String.Format ("Type {0} is not unique.", typeName));
 
-                                       result = type;
-                               } 
+                       foreach (string bindir in  
HttpApplication.PrivateBinPath) {
+                               if (!Directory.Exists (bindir))
+                                       continue;
+                       
+                               string [] binDlls = Directory.GetFiles (bindir, 
"*.dll");
+                               foreach (string dll in binDlls) {
+                                       Assembly assembly = Assembly.LoadFrom 
(dll);
+                                       type = assembly.GetType (typeName, 
false);
+                                       if (type != null) {
+                                               if (result != null) 
+                                                       throw new HttpException 
(String.Format ("Type {0} is not unique.", typeName));
+                                               
+                                               result = type;
+                                       } 
+                               }
                        }
-
+                       
                        if (result == null)
                                throw new HttpException (String.Format ("Type 
{0} not found.", typeName));
 
@@ -491,28 +498,6 @@
                        get { return dependencies; }
                }
 
-               internal string PrivateBinPath {
-                       get {
-                               if (privateBinPath != null)
-                                       return privateBinPath;
-
-                               AppDomainSetup setup = 
AppDomain.CurrentDomain.SetupInformation;
-                               privateBinPath = setup.PrivateBinPath;
-                                       
-                               if (!Path.IsPathRooted (privateBinPath)) {
-                                       string appbase = setup.ApplicationBase;
-                                       if (appbase.StartsWith ("file://")) {
-                                               appbase = appbase.Substring (7);
-                                               if (Path.DirectorySeparatorChar 
!= '/')
-                                                       appbase = 
appbase.Replace ('/', Path.DirectorySeparatorChar);
-                                       }
-                                       privateBinPath = Path.Combine (appbase, 
privateBinPath);
-                               }
-
-                               return privateBinPath;
-                       }
-               }
-
                internal string BaseDir {
                        get {
                                if (baseDir == null)

Modified: trunk/mcs/class/System.Web/System.Web.UI/TemplateParser.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/TemplateParser.cs  2007-08-21 
20:59:57 UTC (rev 84588)
+++ trunk/mcs/class/System.Web/System.Web.UI/TemplateParser.cs  2007-08-21 
21:13:54 UTC (rev 84589)
@@ -370,7 +370,16 @@
                        string location = asm.Location;
                        
                        AddDependency (location);
-                       if (Path.GetDirectoryName (location) != PrivateBinPath)
+                       string dirname = Path.GetDirectoryName (location);
+                       bool doAddAssembly = true;
+                       foreach (string dir in HttpApplication.PrivateBinPath) {
+                               if (dirname == dir) {
+                                       doAddAssembly = false;
+                                       break;
+                               }
+                       }
+
+                       if (doAddAssembly)
                                AddAssembly (asm, true);
 
                        return type;
@@ -378,12 +387,14 @@
 
                void AddAssembliesInBin ()
                {
-                       if (!Directory.Exists (PrivateBinPath))
-                               return;
+                       foreach (string bindir in 
HttpApplication.PrivateBinPath) {
+                               if (!Directory.Exists (bindir))
+                                       continue;
 
-                       string [] binDlls = Directory.GetFiles (PrivateBinPath, 
"*.dll");
-                       foreach (string s in binDlls)
-                               assemblies.Add (s);
+                               string [] binDlls = Directory.GetFiles (bindir, 
"*.dll");
+                               foreach (string s in binDlls)
+                                       assemblies.Add (s);
+                       }
                }
                
                internal virtual void AddInterface (string iface)
@@ -824,18 +835,6 @@
                        }
                }
 
-               internal string PrivateBinPath {
-                       get {
-                               if (privateBinPath != null)
-                                       return privateBinPath;
-
-                               AppDomainSetup setup = 
AppDomain.CurrentDomain.SetupInformation;
-                               privateBinPath = Path.Combine 
(setup.ApplicationBase, setup.PrivateBinPath);
-
-                               return privateBinPath;
-                       }
-               }
-
                internal ArrayList Scripts {
                        get {
                                if (scripts == null)

Modified: trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2007-08-21 20:59:57 UTC (rev 84588)
+++ trunk/mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog      
2007-08-21 21:13:54 UTC (rev 84589)
@@ -1,3 +1,8 @@
+2007-08-21  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * ObjectDataSourceView.cs: get rid of PrivateBinPath property,
+       it's unused.
+
 2007-08-20  Marek Habersack  <[EMAIL PROTECTED]>
 
        * ContentPlaceHolderBuilder.cs: store place holder id in the

Modified: 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceView.cs
===================================================================
--- 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceView.cs    
    2007-08-21 20:59:57 UTC (rev 84588)
+++ 
trunk/mcs/class/System.Web/System.Web.UI.WebControls/ObjectDataSourceView.cs    
    2007-08-21 21:13:54 UTC (rev 84589)
@@ -503,18 +503,6 @@
                                return updateParameters;
                        }
                }
-
-               private static string PrivateBinPath {
-                       get {
-                               if (privateBinPath != null)
-                                       return privateBinPath;
-
-                               AppDomainSetup setup = 
AppDomain.CurrentDomain.SetupInformation;
-                               privateBinPath = Path.Combine 
(setup.ApplicationBase, setup.PrivateBinPath);
-
-                               return privateBinPath;
-                       }
-               }
     
                Type ObjectType {
                        get {

Modified: 
trunk/mcs/class/System.Web/Test/System.Web.Hosting/ApplicationHostTest.cs
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web.Hosting/ApplicationHostTest.cs   
2007-08-21 20:59:57 UTC (rev 84588)
+++ trunk/mcs/class/System.Web/Test/System.Web.Hosting/ApplicationHostTest.cs   
2007-08-21 21:13:54 UTC (rev 84589)
@@ -169,8 +169,7 @@
                        Assert.AreEqual (null, setup.LicenseFile, "D8");
                        //Assert.AreEqual (LoaderOptimization.NotSpecified, 
setup.LoaderOptimization);
                        p ("LoaderOptimization is: ", setup.LoaderOptimization);
-                       string expected = Path.Combine 
(Environment.CurrentDirectory, "bin");
-                       Assert.AreEqual (expected, setup.PrivateBinPath, "D9");
+                       Assert.AreEqual ("Bin:bin", setup.PrivateBinPath, "D9");
                        Assert.AreEqual (setup.PrivateBinPathProbe, "*", "D10");
                        p ("ShadowCopyDirs: ", setup.ShadowCopyDirectories);
                        Assert.AreEqual (true, 
setup.ShadowCopyDirectories.EndsWith ("bin"), "D11");

Modified: trunk/mcs/class/System.Web/Test/System.Web.Hosting/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web.Hosting/ChangeLog        
2007-08-21 20:59:57 UTC (rev 84588)
+++ trunk/mcs/class/System.Web/Test/System.Web.Hosting/ChangeLog        
2007-08-21 21:13:54 UTC (rev 84589)
@@ -1,3 +1,8 @@
+2007-08-21  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * ApplicationHostTest.cs: adjust the test for the PrivateBinPath
+       changes.
+
 2006-03-23 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
        * SimpleWorkerRequestTest.cs: new tests for PathInfo and disabled a test

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

Reply via email to