Author: miguel
Date: 2006-10-06 10:22:38 -0400 (Fri, 06 Oct 2006)
New Revision: 66351

Modified:
   trunk/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs
   trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog
Log:
2006-10-06  Miguel de Icaza  <[EMAIL PROTECTED]>

        * AssemblyBuilder.cs: Am doing a try/catch for pulling the LCID
        from the AssemblyCulture that is provided, as Microsoft allows
        arbitrary locales (even non-existing ones) to be specified.

        The .locale information is actually pulled from the AssemblyName,
        not from this lcid.  But this LCID is used to encode the
        resource.  In my exploration of this, we are setting this field,
        even if CSC never sets the field itself (its always zero).

        Maybe we should completely remove this.



Modified: trunk/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs
===================================================================
--- trunk/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs    
2006-10-06 14:02:25 UTC (rev 66350)
+++ trunk/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs    
2006-10-06 14:22:38 UTC (rev 66351)
@@ -479,8 +479,24 @@
                                                version_res.LegalCopyright = 
cb.string_arg ();
                                        else if (attrname == 
"System.Reflection.AssemblyTrademarkAttribute")
                                                version_res.LegalTrademarks = 
cb.string_arg ();
-                                       else if (attrname == 
"System.Reflection.AssemblyCultureAttribute")
-                                               version_res.FileLanguage = new 
CultureInfo (GetCultureString (cb.string_arg ())).LCID;
+                                       else if (attrname == 
"System.Reflection.AssemblyCultureAttribute"){
+                                               int lcid;
+                                               
+                                               try {
+                                                       lcid = new CultureInfo 
(GetCultureString (cb.string_arg ())).LCID;
+                                               } catch (ArgumentException){
+                                                       //
+                                                       // This means that the 
resource is set to the invariant, but
+                                                       // the locale encoded 
will come from the AssemblyName anyways.
+                                                       //
+                                                       // In fact, my 
exploration of MS.NEt shows that this is always
+                                                       // set to zero, so I 
wonder if we should completely drop this
+                                                       // code from here. 
+                                                       //
+                                                       lcid = 
CultureInfo.InvariantCulture.LCID;
+                                               }
+                                               version_res.FileLanguage = lcid;
+                                       }
                                        else if (attrname == 
"System.Reflection.AssemblyFileVersionAttribute")
                                                version_res.FileVersion = 
cb.string_arg ();
                                        else if (attrname == 
"System.Reflection.AssemblyInformationalVersionAttribute")

Modified: trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog
===================================================================
--- trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog     2006-10-06 
14:02:25 UTC (rev 66350)
+++ trunk/mcs/class/corlib/System.Reflection.Emit/ChangeLog     2006-10-06 
14:22:38 UTC (rev 66351)
@@ -1,3 +1,16 @@
+2006-10-06  Miguel de Icaza  <[EMAIL PROTECTED]>
+
+       * AssemblyBuilder.cs: Am doing a try/catch for pulling the LCID
+       from the AssemblyCulture that is provided, as Microsoft allows
+       arbitrary locales (even non-existing ones) to be specified.
+
+       The .locale information is actually pulled from the AssemblyName,
+       not from this lcid.  But this LCID is used to encode the
+       resource.  In my exploration of this, we are setting this field,
+       even if CSC never sets the field itself (its always zero).
+
+       Maybe we should completely remove this.
+
 2006-09-12  Mart Roosma  <[EMAIL PROTECTED]>
 
        * DynamicMethod.cs: Allow empty name and null return type. 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to