You've already forked linux-packaging-mono
Imported Upstream version 4.0.0~alpha1
Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
@ -51,15 +51,38 @@ namespace System.Reflection {
|
||||
[StructLayout (LayoutKind.Sequential)]
|
||||
#if MOBILE
|
||||
public partial class Assembly : ICustomAttributeProvider {
|
||||
#elif NET_4_0
|
||||
public abstract class Assembly : ICustomAttributeProvider, _Assembly, IEvidenceFactory, ISerializable {
|
||||
#else
|
||||
public partial class Assembly : ICustomAttributeProvider, _Assembly, IEvidenceFactory, ISerializable {
|
||||
public abstract class Assembly : ICustomAttributeProvider, _Assembly, IEvidenceFactory, ISerializable {
|
||||
#endif
|
||||
internal class ResolveEventHolder {
|
||||
public event ModuleResolveEventHandler ModuleResolve;
|
||||
}
|
||||
|
||||
internal class UnmanagedMemoryStreamForModule : UnmanagedMemoryStream
|
||||
{
|
||||
Module module;
|
||||
|
||||
public unsafe UnmanagedMemoryStreamForModule (byte* pointer, long length, Module module)
|
||||
: base (pointer, length)
|
||||
{
|
||||
this.module = module;
|
||||
}
|
||||
|
||||
protected override void Dispose (bool disposing)
|
||||
{
|
||||
if (!closed) {
|
||||
/*
|
||||
* The returned pointer points inside metadata, so
|
||||
* we have to increase the refcount of the module, and decrease
|
||||
* it when the stream is finalized.
|
||||
*/
|
||||
module = null;
|
||||
}
|
||||
|
||||
base.Dispose (disposing);
|
||||
}
|
||||
}
|
||||
|
||||
// Note: changes to fields must be reflected in _MonoReflectionAssembly struct (object-internals.h)
|
||||
#pragma warning disable 649
|
||||
private IntPtr _mono_assembly;
|
||||
@ -79,11 +102,7 @@ namespace System.Reflection {
|
||||
private bool fromByteArray;
|
||||
private string assemblyName;
|
||||
|
||||
#if NET_4_0
|
||||
protected
|
||||
#else
|
||||
internal
|
||||
#endif
|
||||
Assembly ()
|
||||
{
|
||||
resolve_event_holder = new ResolveEventHolder ();
|
||||
@ -207,13 +226,9 @@ namespace System.Reflection {
|
||||
}
|
||||
}
|
||||
|
||||
[SecurityPermission (SecurityAction.LinkDemand, SerializationFormatter = true)]
|
||||
public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
if (info == null)
|
||||
throw new ArgumentNullException ("info");
|
||||
|
||||
UnitySerializationHolder.GetAssemblyData (this, info, context);
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public virtual bool IsDefined (Type attributeType, bool inherit)
|
||||
@ -314,14 +329,8 @@ namespace System.Reflection {
|
||||
else {
|
||||
UnmanagedMemoryStream stream;
|
||||
unsafe {
|
||||
stream = new UnmanagedMemoryStream ((byte*) data, size);
|
||||
stream = new UnmanagedMemoryStreamForModule ((byte*) data, size, module);
|
||||
}
|
||||
/*
|
||||
* The returned pointer points inside metadata, so
|
||||
* we have to increase the refcount of the module, and decrease
|
||||
* it when the stream is finalized.
|
||||
*/
|
||||
stream.Closed += new EventHandler (new ResourceCloseHandler (module).OnClose);
|
||||
return stream;
|
||||
}
|
||||
}
|
||||
@ -478,9 +487,7 @@ namespace System.Reflection {
|
||||
return LoadFrom (assemblyFile, false);
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
[Obsolete]
|
||||
#endif
|
||||
public static Assembly LoadFrom (String assemblyFile, Evidence securityEvidence)
|
||||
{
|
||||
Assembly a = LoadFrom (assemblyFile, false);
|
||||
@ -493,9 +500,7 @@ namespace System.Reflection {
|
||||
return a;
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
[Obsolete]
|
||||
#endif
|
||||
[MonoTODO("This overload is not currently implemented")]
|
||||
// FIXME: What are we missing?
|
||||
public static Assembly LoadFrom (String assemblyFile, Evidence securityEvidence, byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
|
||||
@ -503,24 +508,18 @@ namespace System.Reflection {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
[MonoTODO]
|
||||
public static Assembly LoadFrom (String assemblyFile, byte [] hashValue, AssemblyHashAlgorithm hashAlgorithm)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NET_4_0
|
||||
public static Assembly UnsafeLoadFrom (String assemblyFile)
|
||||
{
|
||||
return LoadFrom (assemblyFile);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NET_4_0
|
||||
[Obsolete]
|
||||
#endif
|
||||
public static Assembly LoadFile (String path, Evidence securityEvidence)
|
||||
{
|
||||
if (path == null)
|
||||
@ -541,9 +540,7 @@ namespace System.Reflection {
|
||||
return AppDomain.CurrentDomain.Load (assemblyString);
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
[Obsolete]
|
||||
#endif
|
||||
public static Assembly Load (String assemblyString, Evidence assemblySecurity)
|
||||
{
|
||||
return AppDomain.CurrentDomain.Load (assemblyString, assemblySecurity);
|
||||
@ -554,9 +551,7 @@ namespace System.Reflection {
|
||||
return AppDomain.CurrentDomain.Load (assemblyRef);
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
[Obsolete]
|
||||
#endif
|
||||
public static Assembly Load (AssemblyName assemblyRef, Evidence assemblySecurity)
|
||||
{
|
||||
return AppDomain.CurrentDomain.Load (assemblyRef, assemblySecurity);
|
||||
@ -572,22 +567,18 @@ namespace System.Reflection {
|
||||
return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore);
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
[Obsolete]
|
||||
#endif
|
||||
public static Assembly Load (Byte[] rawAssembly, Byte[] rawSymbolStore,
|
||||
Evidence securityEvidence)
|
||||
{
|
||||
return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore, securityEvidence);
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
[MonoLimitation ("Argument securityContextSource is ignored")]
|
||||
public static Assembly Load (byte [] rawAssembly, byte [] rawSymbolStore, SecurityContextSource securityContextSource)
|
||||
{
|
||||
return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore);
|
||||
}
|
||||
#endif
|
||||
|
||||
public static Assembly ReflectionOnlyLoad (byte[] rawAssembly)
|
||||
{
|
||||
@ -621,9 +612,7 @@ namespace System.Reflection {
|
||||
|
||||
[MonoTODO ("Not implemented")]
|
||||
public
|
||||
#if NET_4_0
|
||||
virtual
|
||||
#endif
|
||||
Module LoadModule (string moduleName, byte [] rawModule, byte [] rawSymbolStore)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
@ -676,9 +665,7 @@ namespace System.Reflection {
|
||||
}
|
||||
|
||||
public
|
||||
#if NET_4_0
|
||||
virtual
|
||||
#endif
|
||||
Object CreateInstance (String typeName, Boolean ignoreCase,
|
||||
BindingFlags bindingAttr, Binder binder,
|
||||
Object[] args, CultureInfo culture,
|
||||
@ -737,27 +724,10 @@ namespace System.Reflection {
|
||||
return null;
|
||||
}
|
||||
|
||||
private class ResourceCloseHandler {
|
||||
#pragma warning disable 169, 414
|
||||
Module module;
|
||||
#pragma warning restore 169, 414
|
||||
|
||||
public ResourceCloseHandler (Module module) {
|
||||
this.module = module;
|
||||
}
|
||||
|
||||
public void OnClose (object sender, EventArgs e) {
|
||||
// The module dtor will take care of things
|
||||
module = null;
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO ("Currently it always returns zero")]
|
||||
[ComVisible (false)]
|
||||
public
|
||||
#if NET_4_0
|
||||
virtual
|
||||
#endif
|
||||
long HostContext {
|
||||
get { return 0; }
|
||||
}
|
||||
@ -875,7 +845,6 @@ namespace System.Reflection {
|
||||
}
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
public virtual PermissionSet PermissionSet {
|
||||
get { return this.GrantedPermissionSet; }
|
||||
}
|
||||
@ -883,11 +852,9 @@ namespace System.Reflection {
|
||||
public virtual SecurityRuleSet SecurityRuleSet {
|
||||
get { throw CreateNIE (); }
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if NET_4_0
|
||||
static Exception CreateNIE ()
|
||||
{
|
||||
return new NotImplementedException ("Derived classes must implement it");
|
||||
@ -968,9 +935,7 @@ namespace System.Reflection {
|
||||
return true;
|
||||
return !left.Equals (right);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NET_4_5
|
||||
public virtual IEnumerable<TypeInfo> DefinedTypes {
|
||||
get {
|
||||
foreach (var type in GetTypes ()) {
|
||||
@ -990,6 +955,5 @@ namespace System.Reflection {
|
||||
public virtual IEnumerable<CustomAttributeData> CustomAttributes {
|
||||
get { return GetCustomAttributesData (); }
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user