diff options
author | Jiyoung Yun <jy910.yun@samsung.com> | 2017-06-13 18:47:36 +0900 |
---|---|---|
committer | Jiyoung Yun <jy910.yun@samsung.com> | 2017-06-13 18:47:36 +0900 |
commit | 61d6a817e39d3bae0f47dbc09838d51db22a5d30 (patch) | |
tree | cb37caa1784bc738b976273335d6ed04a7cc80b0 /src/mscorlib/src/System/Reflection/AssemblyName.cs | |
parent | 5b975f8233e8c8d17b215372f89ca713b45d6a0b (diff) | |
download | coreclr-61d6a817e39d3bae0f47dbc09838d51db22a5d30.tar.gz coreclr-61d6a817e39d3bae0f47dbc09838d51db22a5d30.tar.bz2 coreclr-61d6a817e39d3bae0f47dbc09838d51db22a5d30.zip |
Imported Upstream version 2.0.0.11992upstream/2.0.0.11992
Diffstat (limited to 'src/mscorlib/src/System/Reflection/AssemblyName.cs')
-rw-r--r-- | src/mscorlib/src/System/Reflection/AssemblyName.cs | 67 |
1 files changed, 7 insertions, 60 deletions
diff --git a/src/mscorlib/src/System/Reflection/AssemblyName.cs b/src/mscorlib/src/System/Reflection/AssemblyName.cs index 80fdf5d162..6bfc5b7496 100644 --- a/src/mscorlib/src/System/Reflection/AssemblyName.cs +++ b/src/mscorlib/src/System/Reflection/AssemblyName.cs @@ -27,7 +27,6 @@ namespace System.Reflection using System.Diagnostics.Contracts; using System.Text; - [Serializable] public sealed class AssemblyName : ICloneable, ISerializable, IDeserializationCallback { // @@ -279,7 +278,11 @@ namespace System.Reflection { get { - return nToString(); + if (this.Name == null) + return string.Empty; + // Do not call GetPublicKeyToken() here - that latches the result into AssemblyName which isn't a side effect we want. + byte[] pkt = _PublicKeyToken ?? nGetPublicKeyToken(); + return AssemblyNameFormatter.ComputeDisplayName(Name, Version, CultureName, pkt, Flags, ContentType); } } @@ -295,68 +298,12 @@ namespace System.Reflection public void GetObjectData(SerializationInfo info, StreamingContext context) { - if (info == null) - throw new ArgumentNullException(nameof(info)); - Contract.EndContractBlock(); - - //Allocate the serialization info and serialize our static data. - info.AddValue("_Name", _Name); - info.AddValue("_PublicKey", _PublicKey, typeof(byte[])); - info.AddValue("_PublicKeyToken", _PublicKeyToken, typeof(byte[])); -#if FEATURE_USE_LCID - info.AddValue("_CultureInfo", (_CultureInfo == null) ? -1 : _CultureInfo.LCID); -#endif - info.AddValue("_CodeBase", _CodeBase); - info.AddValue("_Version", _Version); - info.AddValue("_HashAlgorithm", _HashAlgorithm, typeof(AssemblyHashAlgorithm)); - info.AddValue("_HashAlgorithmForControl", _HashAlgorithmForControl, typeof(AssemblyHashAlgorithm)); - info.AddValue("_StrongNameKeyPair", _StrongNameKeyPair, typeof(StrongNameKeyPair)); - info.AddValue("_VersionCompatibility", _VersionCompatibility, typeof(AssemblyVersionCompatibility)); - info.AddValue("_Flags", _Flags, typeof(AssemblyNameFlags)); - info.AddValue("_HashForControl", _HashForControl, typeof(byte[])); + throw new PlatformNotSupportedException(); } public void OnDeserialization(Object sender) { - // Deserialization has already been performed - if (m_siInfo == null) - return; - - _Name = m_siInfo.GetString("_Name"); - _PublicKey = (byte[])m_siInfo.GetValue("_PublicKey", typeof(byte[])); - _PublicKeyToken = (byte[])m_siInfo.GetValue("_PublicKeyToken", typeof(byte[])); -#if FEATURE_USE_LCID - int lcid = (int)m_siInfo.GetInt32("_CultureInfo"); - if (lcid != -1) - _CultureInfo = new CultureInfo(lcid); -#endif - - _CodeBase = m_siInfo.GetString("_CodeBase"); - _Version = (Version)m_siInfo.GetValue("_Version", typeof(Version)); - _HashAlgorithm = (AssemblyHashAlgorithm)m_siInfo.GetValue("_HashAlgorithm", typeof(AssemblyHashAlgorithm)); - _StrongNameKeyPair = (StrongNameKeyPair)m_siInfo.GetValue("_StrongNameKeyPair", typeof(StrongNameKeyPair)); - _VersionCompatibility = (AssemblyVersionCompatibility)m_siInfo.GetValue("_VersionCompatibility", typeof(AssemblyVersionCompatibility)); - _Flags = (AssemblyNameFlags)m_siInfo.GetValue("_Flags", typeof(AssemblyNameFlags)); - - try - { - _HashAlgorithmForControl = (AssemblyHashAlgorithm)m_siInfo.GetValue("_HashAlgorithmForControl", typeof(AssemblyHashAlgorithm)); - _HashForControl = (byte[])m_siInfo.GetValue("_HashForControl", typeof(byte[])); - } - catch (SerializationException) - { // RTM did not have these defined - _HashAlgorithmForControl = AssemblyHashAlgorithm.None; - _HashForControl = null; - } - - m_siInfo = null; - } - - // Constructs a new AssemblyName during deserialization. - internal AssemblyName(SerializationInfo info, StreamingContext context) - { - //The graph is not valid until OnDeserialization() has been called. - m_siInfo = info; + throw new PlatformNotSupportedException(); } public AssemblyName(String assemblyName) |