Merge pull request #3224 from ludovic-henry/iolayer-extract-wait-handle
[mono.git] / mcs / class / corlib / System.Reflection / AssemblyName.cs
index 1daa3d0e5e7b3137dc641e41a1e43711f629c8cc..9da34563f241ccf3e575df1e5acc425dfae28f90 100644 (file)
@@ -54,8 +54,11 @@ namespace System.Reflection {
        [Serializable]
        [ClassInterfaceAttribute (ClassInterfaceType.None)]
        [StructLayout (LayoutKind.Sequential)]
+#if MOBILE
+       public sealed class AssemblyName  : ICloneable, ISerializable, IDeserializationCallback {
+#else
        public sealed class AssemblyName  : ICloneable, ISerializable, IDeserializationCallback, _AssemblyName {
-
+#endif
 #pragma warning disable 169
                #region Synch with object-internals.h
                string name;
@@ -72,7 +75,8 @@ namespace System.Reflection {
                ProcessorArchitecture processor_architecture = ProcessorArchitecture.None;
                #endregion
 #pragma warning restore 169            
-               
+
+               AssemblyContentType contentType;
                public AssemblyName ()
                {
                        // defaults
@@ -320,16 +324,16 @@ namespace System.Reflection {
                        return token;
                }
 
-               [MonoTODO]
                public static bool ReferenceMatchesDefinition (AssemblyName reference, AssemblyName definition)
                {
                        if (reference == null)
                                throw new ArgumentNullException ("reference");
                        if (definition == null)
                                throw new ArgumentNullException ("definition");
-                       if (reference.Name != definition.Name)
-                               return false;
-                       throw new NotImplementedException ();
+                       
+                       // we only compare the simple assembly name to be consistent with MS .NET,
+                       // which is the result of a bug in their implementation (see https://connect.microsoft.com/VisualStudio/feedback/details/752902)
+                       return string.Equals (reference.Name, definition.Name, StringComparison.OrdinalIgnoreCase);
                }
 
                public void SetPublicKey (byte[] publicKey) 
@@ -383,6 +387,7 @@ namespace System.Reflection {
                        an.publicKey = publicKey;
                        an.keyToken = keyToken;
                        an.versioncompat = versioncompat;
+                       an.processor_architecture = processor_architecture;
                        return an;
                }
 
@@ -401,6 +406,7 @@ namespace System.Reflection {
                        return aname;
                }
 
+#if !MOBILE
                void _AssemblyName.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
                {
                        throw new NotImplementedException ();
@@ -421,5 +427,22 @@ namespace System.Reflection {
                {
                        throw new NotImplementedException ();
                }
+#endif
+
+               public string CultureName {
+                       get {
+                               return (cultureinfo == null)? null : cultureinfo.Name;
+                       }
+               }
+
+               [ComVisibleAttribute(false)]
+               public AssemblyContentType ContentType {
+                       get {
+                               return contentType;
+                       }
+                       set {
+                               contentType = value;
+                       }
+               }
        }
 }