[Mono-bugs] [Bug 388425] Mono loads assembly from bin/ referenced in web. config regardless of its version number

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Jul 30 10:37:56 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=388425

User mhabersack at novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=388425#c14





--- Comment #14 from Marek Habersack <mhabersack at novell.com>  2008-07-30 08:37:54 MDT ---
After more investigation I know what's happening. It seems we have a
bug in our assembly loader which is partially responsible for the
double free error shown above, but also it seems the 2.1 profile
bootstrap process is somewhat flawed (it wouldn't ever work on
NET). 

First, let me describe what's happening. After applying the above
patch, the mono_domain_assembly_preload function in appdomain.c checks
whether the found assembly has the same version as the one requested
in the aname parameter to the function. This fails during the 2.1
profile bootstrap as smcs.exe references mscorlib 2.0.0.0 and System
2.0.0.0 while both mscorlib.dll and System.dll found in the
class/lib/net_2_1_bootstrap/ directory are version 2.0.5.0. Both of
the assemblies get loaded because MONO_PATH is set to point to the
bootstrap directory. mono_domain_assembly_preload function notices the
version difference and proceeds to unload the resulting assembly which
leads to the double free as by that time the 2.0.5.0 assembly is
already unloaded.

The new version of the patch adds a restriction present also on .NET
that the requested referenced assembly version must match the actual
version from the loaded assembly. A test case which shows how it works
on .NET is attached above - the program.exe from bin/2 directory
should fail to load (and it does fail to load on .NET and, with the
patch applied, on Mono). .NET doesn't seem to mind the difference in
mscorlib version - no matter what the executable references, it will
load the current runtime's mscorlib.

After applying the current version of the patch and explicitly
unsetting the MONO_PATH variable in the mono-wrapper script I no
longer get the double free error, but the bootstrap still fails with:

make[1]: Entering directory `/usr/src/tmp/mono/mcs/class/System'
MONO_PATH="../../class/lib/net_2_1_bootstrap:$MONO_PATH"
/usr/src/tmp/mono/mono/runtime/mono-wrapper  --security=temporary-smcs-hack
./../class/lib/net_2_1_bootstrap/smcs.exe /codepage:65001  -optimize
-d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -debug /noconfig -nowarn:618
-d:CONFIGURATION_2_0 -unsafe  -target:library -out:System.dll 
@System.dll.sources
System.ComponentModel/ComponentCollection.cs(69,43): warning CS0114:
`System.ComponentModel.ComponentCollection.this[int]' hides inherited member
`System.Collections.Generic.List<System.ComponentModel.IComponent>.this[int]'.
To make the current member override that implementation, add the override
keyword. Otherwise add the new keyword
/home/devel/lib/mono/2.0/mscorlib.dll (Location of the symbol related to
previous warning)
System.ComponentModel/ComponentCollection.cs(88,29): warning CS0114:
`System.ComponentModel.ComponentCollection.CopyTo(System.ComponentModel.IComponent[],
int)' hides inherited member
`System.Collections.Generic.List<System.ComponentModel.IComponent>.CopyTo(System.ComponentModel.IComponent[],
int)'. To make the current member override that implementation, add the
override keyword. Otherwise add the new keyword
/home/devel/lib/mono/2.0/mscorlib.dll (Location of the symbol related to
previous warning)
System.Diagnostics/ProcessModuleCollection.cs(61,38): warning CS0114:
`System.Diagnostics.ProcessModuleCollection.this[int]' hides inherited member
`System.Collections.Generic.List<System.Diagnostics.ProcessModule>.this[int]'.
To make the current member override that implementation, add the override
keyword. Otherwise add the new keyword
/home/devel/lib/mono/2.0/mscorlib.dll (Location of the symbol related to
previous warning)
System.Diagnostics/ProcessModuleCollection.cs(67,29): warning CS0114:
`System.Diagnostics.ProcessModuleCollection.Contains(System.Diagnostics.ProcessModule)'
hides inherited member
`System.Collections.Generic.List<System.Diagnostics.ProcessModule>.Contains(System.Diagnostics.ProcessModule)'.
To make the current member override that implementation, add the override
keyword. Otherwise add the new keyword
/home/devel/lib/mono/2.0/mscorlib.dll (Location of the symbol related to
previous warning)
System.Diagnostics/ProcessModuleCollection.cs(72,29): warning CS0114:
`System.Diagnostics.ProcessModuleCollection.CopyTo(System.Diagnostics.ProcessModule[],
int)' hides inherited member
`System.Collections.Generic.List<System.Diagnostics.ProcessModule>.CopyTo(System.Diagnostics.ProcessModule[],
int)'. To make the current member override that implementation, add the
override keyword. Otherwise add the new keyword
/home/devel/lib/mono/2.0/mscorlib.dll (Location of the symbol related to
previous warning)
System.Diagnostics/ProcessModuleCollection.cs(77,28): warning CS0114:
`System.Diagnostics.ProcessModuleCollection.IndexOf(System.Diagnostics.ProcessModule)'
hides inherited member
`System.Collections.Generic.List<System.Diagnostics.ProcessModule>.IndexOf(System.Diagnostics.ProcessModule)'.
To make the current member override that implementation, add the override
keyword. Otherwise add the new keyword
/home/devel/lib/mono/2.0/mscorlib.dll (Location of the symbol related to
previous warning)
System.Diagnostics/ProcessThreadCollection.cs(72,38): warning CS0114:
`System.Diagnostics.ProcessThreadCollection.this[int]' hides inherited member
`System.Collections.Generic.List<System.Diagnostics.ProcessThread>.this[int]'.
To make the current member override that implementation, add the override
keyword. Otherwise add the new keyword
/home/devel/lib/mono/2.0/mscorlib.dll (Location of the symbol related to
previous warning)
System.Diagnostics/ProcessThreadCollection.cs(78,28): warning CS0108:
`System.Diagnostics.ProcessThreadCollection.Add(System.Diagnostics.ProcessThread)'
hides inherited member
`System.Diagnostics.ProcessThreadCollectionBase.Add(System.Diagnostics.ProcessThread)'.
Use the new keyword if hiding was intended
System.Diagnostics/ProcessThreadCollection.cs(43,32): (Location of the symbol
related to previous warning)
System.Diagnostics/ProcessThreadCollection.cs(83,29): warning CS0114:
`System.Diagnostics.ProcessThreadCollection.Contains(System.Diagnostics.ProcessThread)'
hides inherited member
`System.Collections.Generic.List<System.Diagnostics.ProcessThread>.Contains(System.Diagnostics.ProcessThread)'.
To make the current member override that implementation, add the override
keyword. Otherwise add the new keyword
/home/devel/lib/mono/2.0/mscorlib.dll (Location of the symbol related to
previous warning)
System.Diagnostics/ProcessThreadCollection.cs(88,29): warning CS0114:
`System.Diagnostics.ProcessThreadCollection.CopyTo(System.Diagnostics.ProcessThread[],
int)' hides inherited member
`System.Collections.Generic.List<System.Diagnostics.ProcessThread>.CopyTo(System.Diagnostics.ProcessThread[],
int)'. To make the current member override that implementation, add the
override keyword. Otherwise add the new keyword
/home/devel/lib/mono/2.0/mscorlib.dll (Location of the symbol related to
previous warning)
System.Diagnostics/ProcessThreadCollection.cs(93,28): warning CS0114:
`System.Diagnostics.ProcessThreadCollection.IndexOf(System.Diagnostics.ProcessThread)'
hides inherited member
`System.Collections.Generic.List<System.Diagnostics.ProcessThread>.IndexOf(System.Diagnostics.ProcessThread)'.
To make the current member override that implementation, add the override
keyword. Otherwise add the new keyword
/home/devel/lib/mono/2.0/mscorlib.dll (Location of the symbol related to
previous warning)
System.Diagnostics/ProcessThreadCollection.cs(98,29): warning CS0114:
`System.Diagnostics.ProcessThreadCollection.Insert(int,
System.Diagnostics.ProcessThread)' hides inherited member
`System.Collections.Generic.List<System.Diagnostics.ProcessThread>.Insert(int,
System.Diagnostics.ProcessThread)'. To make the current member override that
implementation, add the override keyword. Otherwise add the new keyword
/home/devel/lib/mono/2.0/mscorlib.dll (Location of the symbol related to
previous warning)
System.Diagnostics/ProcessThreadCollection.cs(103,29): warning CS0114:
`System.Diagnostics.ProcessThreadCollection.Remove(System.Diagnostics.ProcessThread)'
hides inherited member
`System.Collections.Generic.List<System.Diagnostics.ProcessThread>.Remove(System.Diagnostics.ProcessThread)'.
To make the current member override that implementation, add the override
keyword. Otherwise add the new keyword
/home/devel/lib/mono/2.0/mscorlib.dll (Location of the symbol related to
previous warning)
System.Net/HttpWebRequest.cs(688,69): error CS1061: Type
`System.Net.ServicePoint' does not contain a definition for `SendRequest' and
no extension method `SendRequest' of type `System.Net.ServicePoint' could be
found (are you missing a using directive or an assembly reference?)
System.Net/HttpWebRequest.cs(775,61): error CS1061: Type
`System.Net.ServicePoint' does not contain a definition for `SendRequest' and
no extension method `SendRequest' of type `System.Net.ServicePoint' could be
found (are you missing a using directive or an assembly reference?)
System.Net/HttpWebRequest.cs(1192,77): error CS1061: Type
`System.Net.ServicePoint' does not contain a definition for `SendRequest' and
no extension method `SendRequest' of type `System.Net.ServicePoint' could be
found (are you missing a using directive or an assembly reference?)
Compilation failed: 3 error(s), 13 warnings
make[1]: *** [../../class/lib/net_2_1/System.dll] Error 1
make[1]: Leaving directory `/usr/src/tmp/mono/mcs/class/System'

This is because the smcs.exe _should_ be linked against the 2.0.5.0
mscorlib/System and that's the version of the assemblies it
expects. As long as the patch introduces correct behavior (as
evidenced by running the test case on .NET), it breaks the 2.1
bootstrap process. 

Could anyone familiar with the 2.1 bootstrap take a look at the issue
and propose a solution to this problem? Or point out that my analysis
and patch are wrong and should be reimplemented?

thanks


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list