Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2017-01-19 04:51:19 +0300
committerGitHub <noreply@github.com>2017-01-19 04:51:19 +0300
commita19086d7a7f246280b842782bc0934f1524d35a0 (patch)
treec8c3fada66ad6b709bf82877968d087181e48d06
parent3e29cbe31a0ed5b6eee72fe579a3f220fa530eff (diff)
parent9158af3dd51243cc7ee457b7deed6dbe2afe0019 (diff)
Merge pull request #2540 from dotnet/nmirror
Merge nmirror to master
-rw-r--r--src/System.Private.CoreLib/src/System.Private.CoreLib.csproj1
-rw-r--r--src/System.Private.CoreLib/src/System/Delegate.cs8
-rw-r--r--src/System.Private.CoreLib/src/System/MulticastDelegate.cs8
-rw-r--r--src/System.Private.CoreLib/src/System/Reflection/Assembly.cs32
-rw-r--r--src/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs14
-rw-r--r--src/System.Private.CoreLib/src/System/Reflection/StrongNameKeyPair.cs73
-rw-r--r--src/System.Private.CoreLib/src/System/Security/Attributes.cs7
7 files changed, 141 insertions, 2 deletions
diff --git a/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj b/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj
index baf7c70b5..4998a45c6 100644
--- a/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj
+++ b/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj
@@ -194,6 +194,7 @@
<Compile Include="System\Reflection\ReflectionContext.cs" />
<Compile Include="System\Reflection\ReflectionTypeLoadException.cs" />
<Compile Include="System\Reflection\ResourceLocation.cs" />
+ <Compile Include="System\Reflection\StrongNameKeyPair.cs" />
<Compile Include="System\Reflection\TargetException.cs" />
<Compile Include="System\Reflection\TypeAttributes.cs" />
<Compile Include="System\Reflection\TypeFilter.cs" />
diff --git a/src/System.Private.CoreLib/src/System/Delegate.cs b/src/System.Private.CoreLib/src/System/Delegate.cs
index 8263a8ac6..47b253e2c 100644
--- a/src/System.Private.CoreLib/src/System/Delegate.cs
+++ b/src/System.Private.CoreLib/src/System/Delegate.cs
@@ -5,6 +5,7 @@
using System.Text;
using System.Runtime;
using System.Reflection;
+using System.Runtime.Serialization;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Diagnostics;
@@ -19,7 +20,7 @@ namespace System
// sequential layout directive so that Bartok matches it.
[StructLayout(LayoutKind.Sequential)]
[DebuggerDisplay("Target method(s) = {GetTargetMethodsDescriptionForDebugger()}")]
- public abstract partial class Delegate : ICloneable
+ public abstract partial class Delegate : ICloneable, ISerializable
{
// This ctor exists solely to prevent C# from generating a protected .ctor that violates the surface area. I really want this to be a
// "protected-and-internal" rather than "internal" but C# has no keyword for the former.
@@ -707,6 +708,11 @@ namespace System
return MemberwiseClone();
}
+ public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ throw new NotSupportedException();
+ }
+
internal bool IsOpenStatic
{
get
diff --git a/src/System.Private.CoreLib/src/System/MulticastDelegate.cs b/src/System.Private.CoreLib/src/System/MulticastDelegate.cs
index 7caec691c..55b550239 100644
--- a/src/System.Private.CoreLib/src/System/MulticastDelegate.cs
+++ b/src/System.Private.CoreLib/src/System/MulticastDelegate.cs
@@ -3,13 +3,14 @@
// See the LICENSE file in the project root for more information.
using System.Diagnostics;
+using System.Runtime.Serialization;
using System.Runtime.CompilerServices;
using Internal.Runtime.CompilerServices;
namespace System
{
- public abstract class MulticastDelegate : Delegate
+ public abstract class MulticastDelegate : Delegate, ISerializable
{
// This ctor exists solely to prevent C# from generating a protected .ctor that violates the surface area. I really want this to be a
// "protected-and-internal" rather than "internal" but C# has no keyword for the former.
@@ -114,5 +115,10 @@ namespace System
{
return base.GetInvocationList();
}
+
+ public override void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ throw new NotImplementedException();
+ }
}
}
diff --git a/src/System.Private.CoreLib/src/System/Reflection/Assembly.cs b/src/System.Private.CoreLib/src/System/Reflection/Assembly.cs
index 66f68e474..969324709 100644
--- a/src/System.Private.CoreLib/src/System/Reflection/Assembly.cs
+++ b/src/System.Private.CoreLib/src/System/Reflection/Assembly.cs
@@ -5,7 +5,9 @@
using System.IO;
using System.Globalization;
using System.Collections.Generic;
+using System.Configuration.Assemblies;
using System.Runtime.Serialization;
+using System.Security;
using Internal.Reflection.Augments;
@@ -75,6 +77,8 @@ namespace System.Reflection
public virtual Stream GetManifestResourceStream(string name) { throw NotImplemented.ByDesign; }
public virtual Stream GetManifestResourceStream(Type type, string name) { throw NotImplemented.ByDesign; }
+ public bool IsFullyTrusted => true;
+
public virtual AssemblyName GetName() => GetName(copiedName: false);
public virtual AssemblyName GetName(bool copiedName) { throw NotImplemented.ByDesign; }
@@ -90,6 +94,8 @@ namespace System.Reflection
public virtual object[] GetCustomAttributes(bool inherit) { throw NotImplemented.ByDesign; }
public virtual object[] GetCustomAttributes(Type attributeType, bool inherit) { throw NotImplemented.ByDesign; }
+ public virtual String EscapedCodeBase => AssemblyName.EscapeCodeBase(CodeBase);
+
public object CreateInstance(string typeName) => CreateInstance(typeName, false, BindingFlags.Public | BindingFlags.Instance, binder: null, args: null, culture: null, activationAttributes: null);
public object CreateInstance(string typeName, bool ignoreCase) => CreateInstance(typeName, ignoreCase, BindingFlags.Public | BindingFlags.Instance, binder: null, args: null, culture: null, activationAttributes: null);
public virtual object CreateInstance(string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes)
@@ -129,6 +135,12 @@ namespace System.Reflection
return displayName;
}
+ /*
+ Returns true if the assembly was loaded from the global assembly cache.
+ */
+ public virtual bool GlobalAssemblyCache { get { throw NotImplemented.ByDesign; } }
+ public virtual Int64 HostContext { get { throw NotImplemented.ByDesign; } }
+
public override bool Equals(object o) => base.Equals(o);
public override int GetHashCode() => base.GetHashCode();
@@ -179,8 +191,28 @@ namespace System.Reflection
return Load(name);
}
+ public static Assembly LoadFile(String path) { throw new PlatformNotSupportedException(); }
+ public static Assembly LoadFrom(String assemblyFile) { throw new PlatformNotSupportedException(); }
+ public static Assembly LoadFrom(String assemblyFile, byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm) { throw new PlatformNotSupportedException(); }
+
+ [Obsolete("This method has been deprecated. Please use Assembly.Load() instead. http://go.microsoft.com/fwlink/?linkid=14202")]
+ public static Assembly LoadWithPartialName(String partialName)
+ {
+ if (partialName == null)
+ throw new ArgumentNullException(nameof(partialName));
+
+ return Load(partialName);
+ }
+
+ public static Assembly UnsafeLoadFrom(string assemblyFile) => LoadFrom(assemblyFile);
+
+ public Module LoadModule(String moduleName, byte[] rawModule) => LoadModule(moduleName, rawModule, null);
+ public virtual Module LoadModule(String moduleName, byte[] rawModule, byte[] rawSymbolStore) { throw NotImplemented.ByDesign; }
+
public static Assembly ReflectionOnlyLoad(byte[] rawAssembly) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ReflectionOnly); }
public static Assembly ReflectionOnlyLoad(string assemblyString) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ReflectionOnly); }
public static Assembly ReflectionOnlyLoadFrom(string assemblyFile) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ReflectionOnly); }
+
+ public virtual SecurityRuleSet SecurityRuleSet => SecurityRuleSet.None;
}
}
diff --git a/src/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs b/src/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs
index 0eed90c2a..d4b8cebef 100644
--- a/src/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs
+++ b/src/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs
@@ -129,6 +129,18 @@ namespace System.Reflection
public string CodeBase { get; set; }
public AssemblyHashAlgorithm HashAlgorithm { get; set; }
public AssemblyVersionCompatibility VersionCompatibility { get; set; }
+ public StrongNameKeyPair KeyPair { get; set; }
+
+ public String EscapedCodeBase
+ {
+ get
+ {
+ if (CodeBase == null)
+ return null;
+ else
+ return EscapeCodeBase(CodeBase);
+ }
+ }
public byte[] GetPublicKey()
{
@@ -172,6 +184,8 @@ namespace System.Reflection
public static AssemblyName GetAssemblyName(String assemblyFile) { throw new NotImplementedException(); }
public static bool ReferenceMatchesDefinition(AssemblyName reference, AssemblyName definition) { throw new NotImplementedException(); }
+ internal static String EscapeCodeBase(String codebase) { throw new PlatformNotSupportedException(); }
+
private AssemblyNameFlags _flags;
private byte[] _publicKey;
private byte[] _publicKeyToken;
diff --git a/src/System.Private.CoreLib/src/System/Reflection/StrongNameKeyPair.cs b/src/System.Private.CoreLib/src/System/Reflection/StrongNameKeyPair.cs
new file mode 100644
index 000000000..db3e92423
--- /dev/null
+++ b/src/System.Private.CoreLib/src/System/Reflection/StrongNameKeyPair.cs
@@ -0,0 +1,73 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================
+**
+**
+**
+**
+**
+** Purpose: Encapsulate access to a public/private key pair
+** used to sign strong name assemblies.
+**
+**
+===========================================================*/
+
+using System;
+using System.Runtime.Serialization;
+
+namespace System.Reflection
+{
+ [Serializable]
+ public class StrongNameKeyPair : IDeserializationCallback, ISerializable
+ {
+ private bool _keyPairExported;
+ private byte[] _keyPairArray;
+ private String _keyPairContainer;
+ private byte[] _publicKey;
+
+ // Build key pair from byte array in memory.
+ public StrongNameKeyPair(byte[] keyPairArray)
+ {
+ if (keyPairArray == null)
+ throw new ArgumentNullException(nameof(keyPairArray));
+
+ _keyPairArray = new byte[keyPairArray.Length];
+ Array.Copy(keyPairArray, _keyPairArray, keyPairArray.Length);
+
+ _keyPairExported = true;
+ }
+
+ protected StrongNameKeyPair(SerializationInfo info, StreamingContext context)
+ {
+ _keyPairExported = (bool)info.GetValue("_keyPairExported", typeof(bool));
+ _keyPairArray = (byte[])info.GetValue("_keyPairArray", typeof(byte[]));
+ _keyPairContainer = (string)info.GetValue("_keyPairContainer", typeof(string));
+ _publicKey = (byte[])info.GetValue("_publicKey", typeof(byte[]));
+ }
+
+ public StrongNameKeyPair(String keyPairContainer)
+ {
+ throw new PlatformNotSupportedException();
+ }
+
+ public byte[] PublicKey
+ {
+ get
+ {
+ throw new PlatformNotSupportedException();
+ }
+ }
+
+ void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ info.AddValue("_keyPairExported", _keyPairExported);
+ info.AddValue("_keyPairArray", _keyPairArray);
+ info.AddValue("_keyPairContainer", _keyPairContainer);
+ info.AddValue("_publicKey", _publicKey);
+ }
+
+ void IDeserializationCallback.OnDeserialization(Object sender) { }
+ }
+}
diff --git a/src/System.Private.CoreLib/src/System/Security/Attributes.cs b/src/System.Private.CoreLib/src/System/Security/Attributes.cs
index 538fbf15d..fcb292cd2 100644
--- a/src/System.Private.CoreLib/src/System/Security/Attributes.cs
+++ b/src/System.Private.CoreLib/src/System/Security/Attributes.cs
@@ -71,4 +71,11 @@ namespace System.Security
{
public SecurityTransparentAttribute() { }
}
+
+ public enum SecurityRuleSet : byte
+ {
+ None = 0,
+ Level1 = 1, // v2.0 transparency model
+ Level2 = 2, // v4.0 transparency model
+ }
}