[Mono-list] strange behavior while doing side-by-side execution

Jonathan Pryor jonpryor@vt.edu
Sun, 28 Sep 2003 11:33:57 -0400


--=-l27HAH1TUNWZrwX3LGmw
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

I'm guessing that was a bug in mono-0.25, then.  I'm using mono-0.26,
and I'm not seeing the behavior you're describing.

The attached tarball is the example code I'm using, which is mostly
identical to the code you posted before.

	tmp$ tar zxf sbse.tgz
	tmp$ cd sbse
	sbse$ make
	sbse$ mono --version
	Mono JIT compiler version 0.26, (C) 2002, 2003 Ximian, Inc.
	sbse$ mono main.exe
	This is version 1
	This is version 2

 - Jon

On Sun, 2003-09-28 at 08:43, Piyush Garyali wrote:
> Hello Jonathan,
> 
> I reckon you misunderstood my question. I am aware of the fact 
> that mono has not implemented a GAC. My question was more about 
> the output of that particular program.
> 
> Even after changing the name of the dlls to "first1.dll" and 
> "first2.dll" and keeping them in the same folder I fail to 
> understand why mono still prints "This is version 1" for the 
> second time when it ought to have printed "This is verison 2"
> 
> >Output on MS-CLR:
> >This is version 1
> >This is version 2
> >
> >Output on mono-0.25
> >This is version 1
> >This is version 1
> 
> I mean, when I am loading the "first2.dll" using LoadFrom and 
> creating an instance out of it, logically speaking, it ought to 
> have given me the one from first2.dll so that when I invoke the 
> Print() method it should have printed "This is verison 2"
> 
> I am using MSVS.Net(csc) for compiling the program and mono-0.25 
> on Cygwin to run it. Sorry for the typo in the code.
> 
> -pG-
> 
> 
> 
> On Fri, 26 Sep 2003 Jonathan Pryor wrote :
> >How are you compiling & running your program?
> >
> >Mono doesn't have a Global Assembly Cache.  Thus, there is no way 
> >to
> >install two different "versions" of the same assembly.  At least, 
> >not
> >for "version" defined as "having
> >System.Reflection.AssemblyFileVersionAttribute specified in the
> >assembly."
> >
> >You can always rename the assemblies, having (e.g.) first-1.dll 
> >and
> >first-2.dll, to correspond to the different library versions.  
> >That
> >works under mono, as expected.
> >
> >Well, it *almost* works.  I couldn't get your code to compile 
> >as-is,
> >because [first-1.dll]first.ClassFirst was not declared as 
> >"public," and
> >thus couldn't be used from MainApplication.exe.  After changing
> >first.ClassFirst to be a public class, it could compile.
> >
> >The one other change required was changing the Assembly.LoadFrom 
> >path,
> >as I'm doing this on Linux and C:\ doesn't exist, and I was 
> >loading
> >"first-2.dll", explicitly specifying the version to load.
> >
> >  - Jon
> >
> >On Thu, 2003-09-25 at 09:09, Piyush Garyali wrote:
> > > Hello everybody,
> > >
> > > I found a strange behavior with mono when I ran the following 
> >code
> > > snippet for side-by-side execution.
> > >
> > > <first.dll version 1.0.1>
> > > using System;
> > > namespace first
> > > {
> > >      class ClassFirst
> > >      {
> > >          public void Print()
> > >          {
> > >              Console.WriteLine("This is version 1");
> > >          }
> > >      }
> > > }
> > >
> > > <first.dll version 1.0.2>
> > > using System;
> > > namespace first
> > > {
> > >      class ClassFirst
> > >      {
> > >          public void Print()
> > >          {
> > >              Console.WriteLine("This is version 2");
> > >          }
> > >      }
> > > }
> > >
> > > <MainApplication.exe>
> > > using System;
> > > using System.Reflection;
> > > using first;
> > >
> > > namespace MainApplication
> > > {
> > >      class Class1
> > >      {
> > >          static void Main()
> > >          {
> > >              // creating instance from the version 1.0.1
> > > assembly
> > >              ClassFirst cf = new ClassFirst();
> > >              cf.Print();
> > >
> > >              // loading the version 1.0.2 dll
> > >              Assembly ass =
> > > Assembly.LoadFrom("C:\\NewVersion\\first.dll");
> > >              type [] t =  ass.GetTypes();
> > >              object o = 
> >System.Activator.CreateInstance(t[0]);
> > >              MethodInfo method = t[0].GetMethod("Print");
> > >              method.Invoke(o, null);
> > >
> > >          }
> > >      }
> > > }
> > >
> > > Output on MS-CLR:
> > > This is version 1
> > > This is version 2
> > >
> > > Output on mono-0.25
> > > This is version 1
> > > This is version 1
> > >
> > >
> > > <..>
> > >
> > > I can't figure out any reason as to why this thing is not 
> >working
> > > on mono.
> > > Is it a bug or am I missing something ??
> > >
> > > -pG-
> > > ___________________________________________________
> > > Television meets Accounts; Jyoti Weds Rajaram.
> > > Rediff Matchmaker strikes another interesting match !!
> > > Visit http://matchmaker.rediff.com?1
> > >
> > > _______________________________________________
> > > Mono-list maillist  -  Mono-list@lists.ximian.com
> > > http://lists.ximian.com/mailman/listinfo/mono-list
> >
> 
> ___________________________________________________
> Television meets Accounts; Jyoti Weds Rajaram.
> Rediff Matchmaker strikes another interesting match !!
> Visit http://matchmaker.rediff.com?1
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list

--=-l27HAH1TUNWZrwX3LGmw
Content-Disposition: attachment; filename=sbse.tgz
Content-Type: application/x-compressed-tar; name=sbse.tgz
Content-Transfer-Encoding: base64

H4sIAC7+dj8AA+2YbWvbMBDH87b6FEfoCxdWx3acGlIG67JuBNptrB3bKB04jryqlaVgOdnC6Hff
SXGcOCnNXjQpY/oRYtm6k846398PaqBoq7FdPC/0oqiDW8+LjsLatqSBBu1OJ4q8Dh73vcD3G9DZ
clyGsSriHKBxK8Wjdpv6/1GUzv9F/80pvP4GZnv69bT3+bL/4f2TzYH59I5W8v5Q/sMIjwfY9tt+
J2iA92QRPILNP21lMRNuorY1x4b8+/5Rlf8ADdHeD8PI5n8XjBUTP+BiqgqaHZPlPfcTTTlNCibF
vCNluSqOCRFxRtUoTiic45VzMhpxlsTakPwmoEl4rBT09L8/O1J2aHDBC5bARLKh8XcOFn1LZppW
C5KcojlOzgQ6CpwzzWUGxQ2FCc0VTgq+67k+4Fw0G/BpfQQTsmsieaubkKTwEgT9udbjHBzXXZPU
/ZgzYTrWwuIyHuqoVuMIYMh53fqkDExHiHNX++4ZjvEWT8ZpcjY4DFz0bK4GcTkdUbi6hkJ74gDu
O1roY2otXDm4xWyBRMMygSeYvElcyNzt6UWk/XIFneLKu151P6fFjRz2RSohM00cR9vpCWd9TtMs
x1qIM3O3LybyjjryBYgx57U1uyfl5p489/VuqWP0X19+/vZuAJvu/0EQLfRfPyei/rft/X8n1PV/
IexGHY2cj8YDlPdlSTdySeZiXfYbOS/1kixLeU8KJTl1v+SsoGdMUKd5ecMU4K8SzrmmaKHQKmFl
YldU9R88Z/1Xz39+4LVN/fuhrf9dsLn+t1n4gS38Z8bU/3l8R1PG6Zbm2FT/bd2ef//R3wLwjTD0
bP3vgt5FDx/0s0QREnPehdmjIL6JQPVOAubzAP1FyR4h83YXyo8GZG/fwUEOoCXHRXf/FbTy7mKQ
/e+EVHvz0R9yKrRTHufTyiVYuAR/4ZJwGosu2TvMsyrgh86GWI2xWCwWi8VisVgsFovFYrH8P/wB
gIeeJQAoAAA=

--=-l27HAH1TUNWZrwX3LGmw--