Imported Upstream version 4.2.0.179

Former-commit-id: 4610231f55806d2a05ed69e5ff3faa7336cc1479
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent aa7da660d6
commit c042cd0c52
7507 changed files with 90259 additions and 657307 deletions

View File

@ -35,6 +35,10 @@ using System.Reflection.Emit;
#endif
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Threading;
using System.Diagnostics.Contracts;
using System.Security.Policy;
using System.Security.Permissions;
namespace System.Reflection {
@ -50,6 +54,101 @@ namespace System.Reflection {
this.FullName,
this);
}
internal static RuntimeAssembly GetExecutingAssembly (ref StackCrawlMark stackMark)
{
// Mono runtime does not support StackCrawlMark, The easiest workaround is to replace use
// of StackCrawlMark.LookForMyCaller with GetCallingAssembly
throw new NotSupportedException ();
}
// Creates AssemblyName. Fills assembly if AssemblyResolve event has been raised.
[System.Security.SecurityCritical] // auto-generated
internal static AssemblyName CreateAssemblyName(
String assemblyString,
bool forIntrospection,
out RuntimeAssembly assemblyFromResolveEvent)
{
if (assemblyString == null)
throw new ArgumentNullException("assemblyString");
Contract.EndContractBlock();
if ((assemblyString.Length == 0) ||
(assemblyString[0] == '\0'))
throw new ArgumentException(Environment.GetResourceString("Format_StringZeroLength"));
if (forIntrospection)
AppDomain.CheckReflectionOnlyLoadSupported();
AssemblyName an = new AssemblyName();
an.Name = assemblyString;
assemblyFromResolveEvent = null; // instead of an.nInit(out assemblyFromResolveEvent, forIntrospection, true);
return an;
}
internal static RuntimeAssembly InternalLoadAssemblyName(
AssemblyName assemblyRef,
Evidence assemblySecurity,
RuntimeAssembly reqAssembly,
ref StackCrawlMark stackMark,
#if FEATURE_HOSTED_BINDER
IntPtr pPrivHostBinder,
#endif
bool throwOnFileNotFound,
bool forIntrospection,
bool suppressSecurityChecks)
{
if (assemblyRef == null)
throw new ArgumentNullException("assemblyRef");
Contract.EndContractBlock();
if (assemblyRef.CodeBase != null)
{
AppDomain.CheckLoadFromSupported();
}
assemblyRef = (AssemblyName)assemblyRef.Clone();
#if FEATURE_VERSIONING
if (!forIntrospection &&
(assemblyRef.ProcessorArchitecture != ProcessorArchitecture.None)) {
// PA does not have a semantics for by-name binds for execution
assemblyRef.ProcessorArchitecture = ProcessorArchitecture.None;
}
#endif
if (assemblySecurity != null)
{
#if FEATURE_CAS_POLICY
if (!AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled)
{
throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
}
#endif // FEATURE_CAS_POLICY
if (!suppressSecurityChecks)
{
#pragma warning disable 618
new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
#pragma warning restore 618
}
}
return (RuntimeAssembly) Assembly.Load (assemblyRef);
}
internal static RuntimeAssembly LoadWithPartialNameInternal (String partialName, Evidence securityEvidence, ref StackCrawlMark stackMark)
{
// Mono runtime does not support StackCrawlMark
//FIXME stackMark should probably change method behavior in some cases.
return (RuntimeAssembly) Assembly.LoadWithPartialName (partialName, securityEvidence);
}
internal static RuntimeAssembly LoadWithPartialNameInternal (AssemblyName an, Evidence securityEvidence, ref StackCrawlMark stackMark)
{
return LoadWithPartialNameInternal (an.ToString (), securityEvidence, ref stackMark);
}
}
[ComVisible (true)]