[Mono-devel-list] System assembly remapping

Paolo Molaro lupus at ximian.com
Fri Jan 28 12:22:27 EST 2005


On 01/28/05 Lluis Sanchez wrote:
> assembly expected by the runtime. This was partially supported by the
> runtime (with mapping from 1.0.3300 to 1.0.5000) but the new
> implementation supports mapping from any framework version, and works

Does it remap also when a 2.0 assembly is loaded on a 1.1 initialized
runtime? Maybe we should disable when it goes backwards in the major
version.

> --- metadata/assembly.c	(revision 39700)
> +++ metadata/assembly.c	(working copy)
> @@ -43,6 +43,55 @@
>  /* Contains the list of directories that point to auxiliary GACs */
>  static char **extra_gac_paths = NULL;
>  
> +static const char *framework_assemblies [] = {
> +	"Accessibility",
[...]
> +	"System.Xml"
> +};
> +	
>  /*
>   * keeps track of loaded assemblies
>   */
> @@ -314,6 +363,42 @@
>  	LeaveCriticalSection (&assemblies_mutex);
>  }
>  
> +static MonoAssemblyName *
> +mono_assembly_remap_version (MonoAssemblyName *aname, MonoAssemblyName *dest_aname)
> +{
> +	MonoRuntimeInfo *current_runtime;
> +	int n;
> +
> +	if (aname->name == NULL) return aname;
> +	current_runtime = mono_get_runtime_info ();
> +
> +	if (aname->major != current_runtime->assembly_major ||
> +		aname->minor != current_runtime->assembly_minor ||
> +		aname->build != current_runtime->assembly_build ||
> +		aname->revision != current_runtime->assembly_revision) {
> +
> +		for (n = 0; n < G_N_ELEMENTS (framework_assemblies); n++) {
> +			if (strcmp (framework_assemblies[n], aname->name) == 0) {

framework_assemblies should be kept sorted and we should do a binary search here.

> +				int warn = (aname->major | aname->minor | aname->build | aname->revision) != 0;
> +				if (warn && g_getenv ("MONO_SILENT_WARNING") == NULL)

While you are at it, please remove this MONO_SILENT_WARNING check and just log
using the mono_trace_warning() API.

The rest looks fine to me, please commit with the changes.
Thanks.

lupus

-- 
-----------------------------------------------------------------
lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better



More information about the Mono-devel-list mailing list