Imported Upstream version 5.0.0.42

Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-04-10 11:41:01 +00:00
parent 1190d13a04
commit 6bdd276d05
19939 changed files with 3099680 additions and 93811 deletions

View File

@@ -59,12 +59,16 @@ namespace System.Reflection {
#endif
{
internal class ResolveEventHolder {
#pragma warning disable 67
public event ModuleResolveEventHandler ModuleResolve;
#pragma warning restore
}
internal class UnmanagedMemoryStreamForModule : UnmanagedMemoryStream
{
#pragma warning disable 414
Module module;
#pragma warning restore
public unsafe UnmanagedMemoryStreamForModule (byte* pointer, long length, Module module)
: base (pointer, length)
@@ -424,7 +428,7 @@ namespace System.Reflection {
internal extern Type InternalGetType (Module module, String name, Boolean throwOnError, Boolean ignoreCase);
[MethodImplAttribute (MethodImplOptions.InternalCall)]
internal extern static void InternalGetAssemblyName (string assemblyFile, AssemblyName aname);
internal extern unsafe static void InternalGetAssemblyName (string assemblyFile, out Mono.MonoAssemblyName aname, out string codebase);
public virtual AssemblyName GetName (Boolean copiedName)
{
@@ -643,7 +647,7 @@ namespace System.Reflection {
return LoadFrom (assemblyFile, true);
}
[Obsolete]
[Obsolete("This method has been deprecated. Please use Assembly.Load() instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public static Assembly LoadWithPartialName (string partialName)
{
return LoadWithPartialName (partialName, null);
@@ -666,7 +670,7 @@ namespace System.Reflection {
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private static extern Assembly load_with_partial_name (string name, Evidence e);
[Obsolete]
[Obsolete("This method has been deprecated. Please use Assembly.Load() instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public static Assembly LoadWithPartialName (string partialName, Evidence securityEvidence)
{
return LoadWithPartialName (partialName, securityEvidence, true);
@@ -750,7 +754,37 @@ namespace System.Reflection {
public extern static Assembly GetCallingAssembly ();
[MethodImplAttribute (MethodImplOptions.InternalCall)]
internal static extern AssemblyName[] GetReferencedAssemblies (Assembly module);
internal static extern IntPtr InternalGetReferencedAssemblies (Assembly module);
internal static AssemblyName[] GetReferencedAssemblies (Assembly module)
{
using (var nativeNames = new Mono.SafeGPtrArrayHandle (InternalGetReferencedAssemblies (module))) {
var numAssemblies = nativeNames.Length;
try {
AssemblyName [] result = new AssemblyName[numAssemblies];
const bool addVersion = true;
const bool addPublicKey = false;
const bool defaultToken = true;
const bool assemblyRef = true;
for (int i = 0; i < numAssemblies; i++) {
AssemblyName name = new AssemblyName ();
unsafe {
Mono.MonoAssemblyName *nativeName = (Mono.MonoAssemblyName*) nativeNames[i];
name.FillName (nativeName, null, addVersion, addPublicKey, defaultToken, assemblyRef);
result[i] = name;
}
}
return result;
} finally {
for (int i = 0; i < numAssemblies; i++) {
unsafe {
Mono.MonoAssemblyName* nativeName = (Mono.MonoAssemblyName*) nativeNames[i];
Mono.RuntimeMarshal.FreeAssemblyName (ref *nativeName, true);
}
}
}
}
}
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern bool GetManifestResourceInfoInternal (String name, ManifestResourceInfo info);

View File

@@ -102,10 +102,10 @@ namespace System.Reflection {
throw new FileLoadException ("The assembly name is invalid.");
try {
unsafe {
this.FillName (&nativeName, null, isVersionDefined, false, isTokenDefined);
this.FillName (&nativeName, null, isVersionDefined, false, isTokenDefined, false);
}
} finally {
RuntimeMarshal.FreeAssemblyName (ref nativeName);
RuntimeMarshal.FreeAssemblyName (ref nativeName, false);
}
}
}
@@ -415,7 +415,16 @@ namespace System.Reflection {
throw new ArgumentNullException ("assemblyFile");
AssemblyName aname = new AssemblyName ();
Assembly.InternalGetAssemblyName (Path.GetFullPath (assemblyFile), aname);
unsafe {
Mono.MonoAssemblyName nativeName;
string codebase;
Assembly.InternalGetAssemblyName (Path.GetFullPath (assemblyFile), out nativeName, out codebase);
try {
aname.FillName (&nativeName, codebase, true, false, true, false);
} finally {
RuntimeMarshal.FreeAssemblyName (ref nativeName, false);
}
}
return aname;
}
@@ -464,7 +473,7 @@ namespace System.Reflection {
[MethodImplAttribute (MethodImplOptions.InternalCall)]
static extern unsafe MonoAssemblyName* GetNativeName (IntPtr assembly_ptr);
internal unsafe void FillName (MonoAssemblyName *native, string codeBase, bool addVersion, bool addPublickey, bool defaultToken)
internal unsafe void FillName (MonoAssemblyName *native, string codeBase, bool addVersion, bool addPublickey, bool defaultToken, bool assemblyRef)
{
this.name = RuntimeMarshal.PtrToUtf8String (native->name);
@@ -486,7 +495,7 @@ namespace System.Reflection {
this.codebase = codeBase;
if (native->culture != IntPtr.Zero)
this.cultureinfo = CultureInfo.CreateCulture ( RuntimeMarshal.PtrToUtf8String (native->culture), false);
this.cultureinfo = CultureInfo.CreateCulture ( RuntimeMarshal.PtrToUtf8String (native->culture), assemblyRef);
if (native->public_key != IntPtr.Zero) {
this.publicKey = RuntimeMarshal.DecodeBlobArray (native->public_key);
@@ -514,7 +523,7 @@ namespace System.Reflection {
AssemblyName aname = new AssemblyName ();
unsafe {
MonoAssemblyName *native = GetNativeName (assembly._mono_assembly);
aname.FillName (native, fillCodebase ? assembly.CodeBase : null, true, true, true);
aname.FillName (native, fillCodebase ? assembly.CodeBase : null, true, true, true, false);
}
return aname;
}

View File

@@ -131,7 +131,7 @@ namespace System.Reflection {
if (!suppressSecurityChecks)
{
#if FEATURE_MONO_CAS
#if MONO_FEATURE_CAS
#pragma warning disable 618
new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
#pragma warning restore 618

File diff suppressed because it is too large Load Diff

View File

@@ -1,60 +0,0 @@
//
// System.Reflection.MonoGenericMethod
//
// Martin Baulig (martin@ximian.com)
//
// (C) 2004 Novell, Inc.
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace System.Reflection
{
[Serializable]
[StructLayout (LayoutKind.Sequential)]
internal class MonoGenericMethod : MonoMethod
{
internal MonoGenericMethod ()
{
// this should not be used
throw new InvalidOperationException ();
}
}
[Serializable]
[StructLayout (LayoutKind.Sequential)]
internal class MonoGenericCMethod : MonoCMethod
{
internal MonoGenericCMethod ()
{
// this should not be used
throw new InvalidOperationException ();
}
}
}