My variable GACPath may be misnamed. I had thought that the stuff in "C:\WINNT\Microsoft.NET\Framework\v1.0.3705\" was the real stuff (at least for this release) and the "GAC" just had pointers to this directory. Looking at the GAC in Windows Explorer kind of hides this level of detail, but I can see what you're talking about when I poke around in a shell.
I'm still not sure if this is a System.Reflection bug or my bug either. I can use Assembly.LoadFrom on most of the System.* assemblies using the path mentioned above with no problem. I'm not sure what's different about System.ServiceProcess. When I "diff" the System.ServiceProcess from the GAC with the one I'm trying to load I see no difference. But there is a larger question here: If you're writing a design time reflection based tool[1], and you load an assembly by path (Assembly.LoadFrom) because your user's project info says to get that particular one. How do you set things up so that any referenced assemblies will be correctly located by the system when needed? Chris [1] - like Lutz Roeder's .Net reflector(which exhibits this problem) or the VS.Net object browser(which doesn't exhibit this problem as far as I can tell) > -----Original Message----- > From: John Lewicki [mailto:[EMAIL PROTECTED]] > Sent: Thursday, June 06, 2002 2:10 PM > To: [EMAIL PROTECTED] > Subject: Re: [ADVANCED-DOTNET] Bug in System.Reflection? > > > I would be curious to know more about this issue as well, > because I cant > tell either if its a feature or a bug. > > >> If I load the latter assembly > >first (see the commented out code below) everything works fine. > >However I would expect the referenced assemblies to get loaded > >automatically when needed (they are all in the GAC). > > I observe that the referenced assemblies do get loaded automatically. > During the call to serviceProcess.GetTypes(), the > System.Configuration.Install assembly is loaded. However, > the assembly > that gets loaded is not the one in the directory specified by > your GACPath > variable. In fact the one that gets loaded is the one in the > true GAC, the > one located at C:/WINNT/assembly/GAC... > > Interestingly, if the System.ServiceProcess assembly is > loaded directly > from the GAC like so > > serviceProcess = Assembly.LoadFrom > (@"C:\WINNT\assembly\GAC\System.ServiceProcess\1.0.3300.0__b03 > f5f7f11d50a3a\ > " + "System.ServiceProcess.dll"); > > then no exception is thrown. So it seems like if both the > Service.Configuration.Install and System.ServiceProcess assemblies are > loaded from the same place (i.e both come from the GAC, or > both come from > C:\WINNT\Microsoft.NET\Framework\v1.0.3705\), then things > seem ok, but if > each assembly comes from a different place, then we get the exception. > Something seems fishy here, or Im very confused... > > Any takers? > > -John > > You can read messages from the Advanced DOTNET archive, > unsubscribe from Advanced DOTNET, or > subscribe to other DevelopMentor lists at http://discuss.develop.com. > You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.