Imported Upstream version 6.4.0.137

Former-commit-id: 943baa9f16a098c33e129777827f3a9d20da00d6
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-07-26 19:53:28 +00:00
parent e9207cf623
commit ef583813eb
2712 changed files with 74169 additions and 40587 deletions

View File

@ -239,6 +239,20 @@ namespace System.Reflection.Emit
[StructLayout (LayoutKind.Sequential)]
public sealed partial class AssemblyBuilder : Assembly
{
//
// AssemblyBuilder inherits from Assembly, but the runtime thinks its layout inherits from RuntimeAssembly
//
#region Sync with RuntimeAssembly.cs and ReflectionAssembly in object-internals.h
#pragma warning disable 649
internal IntPtr _mono_assembly;
#pragma warning restore 649
#if !MOBILE
internal Evidence _evidence;
#else
object _evidence;
#endif
#endregion
#pragma warning disable 169, 414, 649
#region Sync with object-internals.h
private UIntPtr dynamic_assembly; /* GC-tracked */
@ -268,7 +282,17 @@ namespace System.Reflection.Emit
byte[] pktoken;
#endregion
#pragma warning restore 169, 414, 649
#if !MOBILE
internal PermissionSet _minimum; // for SecurityAction.RequestMinimum
internal PermissionSet _optional; // for SecurityAction.RequestOptional
internal PermissionSet _refuse; // for SecurityAction.RequestRefuse
internal PermissionSet _granted; // for the resolved assembly granted permissions
internal PermissionSet _denied; // for the resolved assembly denied permissions
#else
object _minimum, _optional, _refuse, _granted, _denied;
#endif
string assemblyName;
internal Type corlib_object_type = typeof (System.Object);
internal Type corlib_value_type = typeof (System.ValueType);
internal Type corlib_enum_type = typeof (System.Enum);
@ -352,9 +376,11 @@ namespace System.Reflection.Emit
}
public override string CodeBase {
get {
throw not_supported ();
}
get { throw not_supported (); }
}
public override string EscapedCodeBase {
get { return RuntimeAssembly.GetCodeBase (this, true); }
}
public override MethodInfo EntryPoint {
@ -372,13 +398,14 @@ namespace System.Reflection.Emit
/* This is to keep signature compatibility with MS.NET */
public override string ImageRuntimeVersion {
get {
return base.ImageRuntimeVersion;
return RuntimeAssembly.InternalImageRuntimeVersion (this);
}
}
[MonoTODO]
public override bool ReflectionOnly {
get { return base.ReflectionOnly; }
get {
return access == (uint)AssemblyBuilderAccess.ReflectionOnly;
}
}
public void AddResourceFile (string name, string fileName)
@ -891,7 +918,7 @@ namespace System.Reflection.Emit
ModuleBuilder mainModule = null;
if (modules != null) {
foreach (ModuleBuilder module in modules)
if (module.FullyQualifiedName == assemblyFileName)
if (module.FileName == assemblyFileName)
mainModule = module;
}
if (mainModule == null)
@ -1203,23 +1230,59 @@ namespace System.Reflection.Emit
return base.GetHashCode ();
}
public override string ToString ()
{
if (assemblyName != null)
return assemblyName;
assemblyName = FullName;
return assemblyName;
}
public override bool IsDefined (Type attributeType, bool inherit)
{
return base.IsDefined (attributeType, inherit);
return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
}
public override object[] GetCustomAttributes (bool inherit)
{
return base.GetCustomAttributes (inherit);
return MonoCustomAttrs.GetCustomAttributes (this, inherit);
}
public override object[] GetCustomAttributes (Type attributeType, bool inherit)
{
return base.GetCustomAttributes (attributeType, inherit);
return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
}
public override string FullName {
get { return base.FullName; }
get { return RuntimeAssembly.get_fullname (this); }
}
internal override IntPtr MonoAssembly {
get {
return _mono_assembly;
}
}
public override Evidence Evidence {
[SecurityPermission (SecurityAction.Demand, ControlEvidence = true)]
get { return UnprotectedGetEvidence (); }
}
internal override Evidence UnprotectedGetEvidence ()
{
#if MOBILE || DISABLE_SECURITY
return null;
#else
// if the host (runtime) hasn't provided it's own evidence...
if (_evidence == null) {
// ... we will provide our own
lock (this) {
_evidence = Evidence.GetDefaultHostEvidence (this);
}
}
return _evidence;
#endif
}
}
}