<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16587" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>
<DIV><FONT face=Arial size=2>After having setup a minimum repro case for a MSDN
Forum (<A
href="http://forums.microsoft.com/Forums/ShowPost.aspx?PostID=2735385&SiteID=1">http://forums.microsoft.com/Forums/ShowPost.aspx?PostID=2735385&SiteID=1</A>),
I came up with a simple workaround that suits me for now...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>The problems comes for the AssemblyManager, it
seems that on dynamic Assemblies, the AssemblyLoad event is called before the
Assembly object is properly set up, and that the GetTypes() call issued in
ScanAssembly messes up the internal state of the newly created
Assembly....</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>As, dynamic assemblies are empty when created,
there's no point is scanning them - at least, this is the case of assemblies
created by Python.Runtime.CodeGenerator and
Python.Runtime.NativeCall.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>So, checking is an assembly is dynamic before
calling ScanAssembly does the trick, see the following patch :</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Index:
pythonnet/src/runtime/assemblymanager.cs<BR>===================================================================<BR>---
pythonnet/src/runtime/assemblymanager.cs (révision 90)<BR>+++
pythonnet/src/runtime/assemblymanager.cs (copie de
travail)<BR>@@ -87,7 +87,12
@@<BR> static void
AssemblyLoadHandler(Object ob, AssemblyLoadEventArgs
args){<BR>
Assembly assembly =
args.LoadedAssembly;<BR>
assemblies.Add(assembly);<BR>-
ScanAssembly(assembly);<BR>+
// .NET v2.0 SP1 bug workaround ; ScanAssembly called on newly created
DynamicAssembly causes
problems<BR>+
// only scan non-dynamic
assemblies...<BR>+
if ( !(assembly is System.Reflection.Emit.AssemblyBuilder)
)<BR>+
{<BR>+
ScanAssembly(assembly);<BR>+
}<BR> }</FONT></DIV><FONT
face=Arial size=2>
<DIV><BR>It fixes the issue, as I'm quite new to .NET I may miss something
obvious...</DIV>
<DIV> </DIV>
<DIV>Any thoughts ?</DIV>
<DIV> </DIV>
<DIV>Cheers,</DIV>
<DIV>Nicolas.</FONT></DIV>
<DIV> </DIV></DIV></BODY></HTML>