<data name="UnauthorizedAccess_RegistryKeyGeneric_Key" xml:space="preserve">
<value>Access to the registry key '{0}' is denied.</value>
</data>
- <data name="UnauthorizedAccess_SystemDomain" xml:space="preserve">
- <value>Cannot execute an assembly in the system domain.</value>
- </data>
<data name="UnknownError_Num" xml:space="preserve">
<value>Unknown error "{0}".</value>
</data>
<Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\Marshal.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\PInvokeMap.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\PInvokeMarshal.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\RuntimeEnvironment.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\SEHException.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\SafeHandle.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\BStrWrapper.cs" />
<Compile Include="$(BclSourcesRoot)\System\MulticastDelegate.cs" />
<Compile Include="$(BclSourcesRoot)\System\Activator.cs" />
<Compile Include="$(BclSourcesRoot)\System\AppDomain.cs" />
- <Compile Include="$(BclSourcesRoot)\System\AppDomainSetup.cs" />
- <Compile Include="$(BclSourcesRoot)\System\AppDomainManager.cs" />
<Compile Include="$(BclSourcesRoot)\System\AppDomainUnloadedException.cs" />
<Compile Include="$(BclSourcesRoot)\System\ArgIterator.cs" />
<Compile Include="$(BclSourcesRoot)\System\Attribute.cs" />
Assembly assembly = null;
if (assemblyString == null)
{
- assembly = RuntimeAssembly.GetExecutingAssembly(ref stackMark);
+ assembly = Assembly.GetExecutingAssembly(ref stackMark);
}
else
{
using System.Collections.Generic;
+using System.IO;
using System.Reflection;
using System.Runtime.Versioning;
{
// The value of APP_CONTEXT_BASE_DIRECTORY key has to be a string and it is not allowed to be any other type.
// Otherwise the caller will get invalid cast exception
- return (string)AppDomain.CurrentDomain.GetData("APP_CONTEXT_BASE_DIRECTORY") ?? AppDomain.CurrentDomain.BaseDirectory;
+ string baseDirectory = (string)AppDomain.CurrentDomain.GetData("APP_CONTEXT_BASE_DIRECTORY");
+ if (baseDirectory != null)
+ return baseDirectory;
+
+ // Fallback path for hosts that do not set APP_CONTEXT_BASE_DIRECTORY explicitly
+ string directory = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
+ if (directory != null && !PathInternal.EndsInDirectorySeparator(directory))
+ directory += Path.DirectorySeparatorChar;
+ return directory;
}
}
// of these fields cannot be changed without changing the layout in
// the EE- AppDomainBaseObject in this case)
- private AppDomainManager _domainManager;
private Dictionary<string, object> _LocalStore;
- private AppDomainSetup _FusionStore;
public event AssemblyLoadEventHandler AssemblyLoad;
private ResolveEventHandler _TypeResolve;
private UnhandledExceptionEventHandler _unhandledException;
- // The compat flags are set at domain creation time to indicate that the given breaking
- // changes (named in the strings) should not be used in this domain. We only use the
- // keys, the vhe values are ignored.
- private Dictionary<string, object> _compatFlags;
-
// Delegate that will hold references to FirstChance exception notifications
private EventHandler<FirstChanceExceptionEventArgs> _firstChanceException;
private IntPtr _pDomain; // this is an unmanaged pointer (AppDomain * m_pDomain)` used from the VM.
- private bool _compatFlagsInitialized;
-
#if FEATURE_APPX
private static APPX_FLAGS s_flags;
/// </summary>
private void CreateAppDomainManager()
{
- Debug.Assert(_domainManager == null, "_domainManager == null");
-
- AppDomainSetup adSetup = FusionStore;
string trustedPlatformAssemblies = (string)GetData("TRUSTED_PLATFORM_ASSEMBLIES");
if (trustedPlatformAssemblies != null)
{
string appLocalWinMD = (string)GetData("APP_LOCAL_WINMETADATA") ?? string.Empty;
SetupBindingPaths(trustedPlatformAssemblies, platformResourceRoots, appPaths, appNiPaths, appLocalWinMD);
}
-
- InitializeCompatibilityFlags();
- }
-
- /// <summary>
- /// Initialize the compatibility flags to non-NULL values.
- /// This method is also called from the VM when the default domain doesn't have a domain manager.
- /// </summary>
- private void InitializeCompatibilityFlags()
- {
- AppDomainSetup adSetup = FusionStore;
-
- // set up shim flags regardless of whether we create a DomainManager in this method.
- if (adSetup.GetCompatibilityFlags() != null)
- {
- _compatFlags = new Dictionary<string, object>(adSetup.GetCompatibilityFlags(), StringComparer.OrdinalIgnoreCase);
- }
-
- // for perf, we don't intialize the _compatFlags dictionary when we don't need to. However, we do need to make a
- // note that we've run this method, because IsCompatibilityFlagsSet needs to return different values for the
- // case where the compat flags have been setup.
- Debug.Assert(!_compatFlagsInitialized);
- _compatFlagsInitialized = true;
}
/// <summary>
#endif
}
- public AppDomainManager DomainManager => _domainManager;
-
public static AppDomain CurrentDomain => Thread.GetDomain();
- public string BaseDirectory => FusionStore.ApplicationBase;
-
[MethodImpl(MethodImplOptions.InternalCall)]
private extern Assembly[] nGetAssemblies(bool forIntrospection);
Debug.Fail("Object cannot be created through this constructor.");
}
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal extern void nCreateContext();
-
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
private static extern void nSetupBindingPaths(string trustedPlatformAssemblies, string platformResourceRoots, string appPath, string appNiPaths, string appLocalWinMD);
}
#endif // FEATURE_COMINTEROP
- internal AppDomainSetup FusionStore
- {
- get
- {
- Debug.Assert(_FusionStore != null, "Fusion store has not been correctly setup in this domain");
- return _FusionStore;
- }
- }
-
private static RuntimeAssembly GetRuntimeAssembly(Assembly asm)
{
return
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
private static extern void nSetNativeDllSearchDirectories(string paths);
- private void SetupFusionStore(AppDomainSetup info, AppDomainSetup oldInfo)
- {
- Debug.Assert(info != null);
-
- if (info.ApplicationBase == null)
- {
- info.SetupDefaults(RuntimeEnvironment.GetModuleFileName(), imageLocationAlreadyNormalized: true);
- }
-
- nCreateContext();
-
- // This must be the last action taken
- _FusionStore = info;
- }
-
- // Used to switch into other AppDomain and call SetupRemoteDomain.
- // We cannot simply call through the proxy, because if there
- // are any remoting sinks registered, they can add non-mscorlib
- // objects to the message (causing an assembly load exception when
- // we try to deserialize it on the other side)
- private static object PrepareDataForSetup(string friendlyName,
- AppDomainSetup setup,
- string[] propertyNames,
- string[] propertyValues)
- {
- var newSetup = new AppDomainSetup(setup);
-
- // Remove the special AppDomainCompatSwitch entries from the set of name value pairs
- // And add them to the AppDomainSetup
- //
- // This is only supported on CoreCLR through ICLRRuntimeHost2.CreateAppDomainWithManager
- // Desktop code should use System.AppDomain.CreateDomain() or
- // System.AppDomainManager.CreateDomain() and add the flags to the AppDomainSetup
- var compatList = new List<string>();
-
- if (propertyNames != null && propertyValues != null)
- {
- for (int i = 0; i < propertyNames.Length; i++)
- {
- if (string.Equals(propertyNames[i], "AppDomainCompatSwitch", StringComparison.OrdinalIgnoreCase))
- {
- compatList.Add(propertyValues[i]);
- propertyNames[i] = null;
- propertyValues[i] = null;
- }
- }
-
- if (compatList.Count > 0)
- {
- newSetup.SetCompatibilitySwitches(compatList);
- }
- }
-
- return new object[]
- {
- friendlyName,
- newSetup,
- propertyNames,
- propertyValues
- };
- } // PrepareDataForSetup
-
- private static object Setup(object arg)
+ private static void Setup(string friendlyName,
+ string[] propertyNames,
+ string[] propertyValues)
{
- var args = (object[])arg;
- var friendlyName = (string)args[0];
- var setup = (AppDomainSetup)args[1];
- var propertyNames = (string[])args[2]; // can contain null elements
- var propertyValues = (string[])args[3]; // can contain null elements
-
AppDomain ad = CurrentDomain;
- var newSetup = new AppDomainSetup(setup);
if (propertyNames != null && propertyValues != null)
{
for (int i = 0; i < propertyNames.Length; i++)
{
- if (propertyNames[i] == "APPBASE") // make sure in sync with Fusion
- {
- if (propertyValues[i] == null)
- throw new ArgumentNullException("APPBASE");
-
- if (PathInternal.IsPartiallyQualified(propertyValues[i]))
- throw new ArgumentException(SR.Argument_AbsolutePathRequired);
-
- newSetup.ApplicationBase = NormalizePath(propertyValues[i], fullCheck: true);
- }
- else if (propertyNames[i] == "TRUSTED_PLATFORM_ASSEMBLIES" ||
- propertyNames[i] == "PLATFORM_RESOURCE_ROOTS" ||
- propertyNames[i] == "APP_PATHS" ||
- propertyNames[i] == "APP_NI_PATHS")
- {
- string values = propertyValues[i];
- if (values == null)
- throw new ArgumentNullException(propertyNames[i]);
-
- ad.SetData(propertyNames[i], NormalizeAppPaths(values));
- }
- else if (propertyNames[i] != null)
+ if (propertyNames[i] != null)
{
- ad.SetData(propertyNames[i], propertyValues[i]); // just propagate
+ ad.SetData(propertyNames[i], propertyValues[i]);
}
}
}
- ad.SetupFusionStore(newSetup, null); // makes FusionStore a ref to newSetup
-
- // technically, we don't need this, newSetup refers to the same object as FusionStore
- // but it's confusing since it isn't immediately obvious whether we have a ref or a copy
- AppDomainSetup adSetup = ad.FusionStore;
-
// set up the friendly name
ad.nSetupFriendlyName(friendlyName);
ad.CreateAppDomainManager(); // could modify FusionStore's object
-
- return null;
- }
-
- private static string NormalizeAppPaths(string values)
- {
- int estimatedLength = values.Length + 1; // +1 for extra separator temporarily added at end
- StringBuilder sb = StringBuilderCache.Acquire(estimatedLength);
-
- for (int pos = 0; pos < values.Length; pos++)
- {
- string path;
-
- int nextPos = values.IndexOf(Path.PathSeparator, pos);
- if (nextPos == -1)
- {
- path = values.Substring(pos);
- pos = values.Length - 1;
- }
- else
- {
- path = values.Substring(pos, nextPos - pos);
- pos = nextPos;
- }
-
- // Skip empty directories
- if (path.Length == 0)
- continue;
-
- if (PathInternal.IsPartiallyQualified(path))
- throw new ArgumentException(SR.Argument_AbsolutePathRequired);
-
- string appPath = NormalizePath(path, fullCheck: true);
- sb.Append(appPath);
- sb.Append(Path.PathSeparator);
- }
-
- // Strip the last separator
- if (sb.Length > 0)
- {
- sb.Remove(sb.Length - 1, 1);
- }
-
- return StringBuilderCache.GetStringAndRelease(sb);
- }
-
- internal static string NormalizePath(string path, bool fullCheck) => Path.GetFullPath(path);
-
- // This routine is called from unmanaged code to
- // set the default fusion context.
- private void SetupDomain(bool allowRedirects, string path, string configFile, string[] propertyNames, string[] propertyValues)
- {
- // It is possible that we could have multiple threads initializing
- // the default domain. We will just take the winner of these two.
- // (eg. one thread doing a com call and another doing attach for IJW)
- lock (this)
- {
- if (_FusionStore == null)
- {
- // always use internet permission set
- SetupFusionStore(new AppDomainSetup(), null);
- }
- }
}
[MethodImpl(MethodImplOptions.InternalCall)]
+++ /dev/null
-// 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.
-
-
-//
-// An AppDomainManager gives a hosting application the chance to
-// participate in the creation and control the settings of new AppDomains.
-//
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Security;
-using System.Runtime.InteropServices;
-
-namespace System
-{
- internal class AppDomainManager : MarshalByRefObject
- {
- public AppDomainManager() { }
-
- public virtual void InitializeNewDomain(AppDomainSetup appDomainInfo)
- {
- // By default, InitializeNewDomain does nothing. AppDomain.CreateAppDomainManager relies on this fact.
- }
-
- [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
- private static extern void GetEntryAssembly(ObjectHandleOnStack retAssembly);
-
- private Assembly m_entryAssembly = null;
- public virtual Assembly EntryAssembly
- {
- get
- {
- // The default AppDomainManager sets the EntryAssembly depending on whether the
- // AppDomain is a manifest application domain or not. In the first case, we parse
- // the application manifest to find out the entry point assembly and return that assembly.
- // In the second case, we maintain the old behavior by calling GetEntryAssembly().
- if (m_entryAssembly == null)
- {
- {
- RuntimeAssembly entryAssembly = null;
- GetEntryAssembly(JitHelpers.GetObjectHandleOnStack(ref entryAssembly));
- m_entryAssembly = entryAssembly;
- }
- }
- return m_entryAssembly;
- }
- }
-
- internal static AppDomainManager CurrentAppDomainManager
- {
- get
- {
- return AppDomain.CurrentDomain.DomainManager;
- }
- }
- }
-}
+++ /dev/null
-// 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.
-
-using System.Collections.Generic;
-using System.Reflection;
-using System.Runtime.Versioning;
-using System.IO;
-
-namespace System
-{
- internal sealed class AppDomainSetup
- {
- private string _appBase;
-
- // A collection of strings used to indicate which breaking changes shouldn't be applied
- // to an AppDomain. We only use the keys, the values are ignored.
- private Dictionary<string, object> _CompatFlags;
-
- internal AppDomainSetup(AppDomainSetup copy)
- {
- if (copy != null)
- {
- _appBase = copy._appBase;
-
- if (copy._CompatFlags != null)
- {
- SetCompatibilitySwitches(copy._CompatFlags.Keys);
- }
- }
- }
-
- public AppDomainSetup()
- {
- }
-
- internal void SetupDefaults(string imageLocation, bool imageLocationAlreadyNormalized = false)
- {
- char[] sep = { '\\', '/' };
- int i = imageLocation.LastIndexOfAny(sep);
-
- if (i != -1)
- {
- string appBase = imageLocation.Substring(0, i + 1);
-
- if (imageLocationAlreadyNormalized)
- _appBase = appBase;
- else
- ApplicationBase = appBase;
- }
- }
-
- public string ApplicationBase
- {
- get
- {
- return _appBase;
- }
-
- set
- {
- _appBase = (value == null || value.Length == 0)? null:Path.GetFullPath(value);
- }
- }
-
- // only needed by AppDomain.Setup(). Not really needed by users.
- internal Dictionary<string, object> GetCompatibilityFlags()
- {
- return _CompatFlags;
- }
-
- public void SetCompatibilitySwitches(IEnumerable<string> switches)
- {
- if (switches != null)
- {
- _CompatFlags = new Dictionary<string, object>();
- foreach (string str in switches)
- {
- _CompatFlags.Add(str, null);
- }
- }
- else
- {
- _CompatFlags = null;
- }
- }
- }
-}
using System.Collections.Generic;
using System.IO;
using System.Configuration.Assemblies;
-using StackCrawlMark = System.Threading.StackCrawlMark;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Loader;
+using StackCrawlMark = System.Threading.StackCrawlMark;
namespace System.Reflection
{
// Loads the assembly with a COFF based IMAGE containing
// an emitted assembly. The assembly is loaded into a fully isolated ALC with resolution fully deferred to the AssemblyLoadContext.Default.
// The second parameter is the raw bytes representing the symbol store that matches the assembly.
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
public static Assembly Load(byte[] rawAssembly,
byte[] rawSymbolStore)
{
return result;
}
+ [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
+ private static extern void GetExecutingAssembly(StackCrawlMarkHandle stackMark, ObjectHandleOnStack retAssembly);
+
+ internal static RuntimeAssembly GetExecutingAssembly(ref StackCrawlMark stackMark)
+ {
+ RuntimeAssembly retAssembly = null;
+ GetExecutingAssembly(JitHelpers.GetStackCrawlMarkHandle(ref stackMark), JitHelpers.GetObjectHandleOnStack(ref retAssembly));
+ return retAssembly;
+ }
+
// Get the assembly that the current code is running from.
[System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
public static Assembly GetExecutingAssembly()
{
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- return RuntimeAssembly.GetExecutingAssembly(ref stackMark);
+ return GetExecutingAssembly(ref stackMark);
}
[System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
// because of inlining, tail calls, etc. As a result GetCallingAssembly is not
// guaranteed to return the correct result. It's also documented as such.
StackCrawlMark stackMark = StackCrawlMark.LookForMyCallersCaller;
- return RuntimeAssembly.GetExecutingAssembly(ref stackMark);
+ return GetExecutingAssembly(ref stackMark);
}
+ [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
+ private static extern void GetEntryAssembly(ObjectHandleOnStack retAssembly);
+
+ // internal test hook
+ private static bool s_forceNullEntryPoint = false;
+
public static Assembly GetEntryAssembly()
{
- AppDomainManager domainManager = AppDomain.CurrentDomain.DomainManager;
- if (domainManager == null)
- domainManager = new AppDomainManager();
- return domainManager.EntryAssembly;
+ if (s_forceNullEntryPoint)
+ return null;
+
+ RuntimeAssembly entryAssembly = null;
+ GetEntryAssembly(JitHelpers.GetObjectHandleOnStack(ref entryAssembly));
+ return entryAssembly;
}
}
}
throw new NotSupportedException(SR.NotSupported_DynamicAssembly);
}
- public override string ImageRuntimeVersion => RuntimeEnvironment.GetSystemVersion();
+ public override string ImageRuntimeVersion => Assembly.GetExecutingAssembly().ImageRuntimeVersion;
#endregion
}
return GetManifestResourceNames(GetNativeHandle());
}
- [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
- private static extern void GetExecutingAssembly(StackCrawlMarkHandle stackMark, ObjectHandleOnStack retAssembly);
-
- internal static RuntimeAssembly GetExecutingAssembly(ref StackCrawlMark stackMark)
- {
- RuntimeAssembly retAssembly = null;
- GetExecutingAssembly(JitHelpers.GetStackCrawlMarkHandle(ref stackMark), JitHelpers.GetObjectHandleOnStack(ref retAssembly));
- return retAssembly;
- }
-
// Returns the names of all the resources
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern AssemblyName[] GetReferencedAssemblies(RuntimeAssembly assembly);
+++ /dev/null
-// 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: Runtime information
-**
-**
-=============================================================================*/
-
-using System;
-using System.Text;
-using System.IO;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Security;
-using System.Reflection;
-using Microsoft.Win32;
-using System.Runtime.Versioning;
-using StackCrawlMark = System.Threading.StackCrawlMark;
-
-namespace System.Runtime.InteropServices
-{
- internal static class RuntimeEnvironment
- {
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern string GetModuleFileName();
-
- public static string GetSystemVersion()
- {
- return Assembly.GetExecutingAssembly().ImageRuntimeVersion;
- }
- }
-}
#include "utils.hpp"
#include "variables.hpp"
#include "ex.h"
+#include "clr/fs/path.h"
+using namespace clr::fs;
namespace BINDER_SPACE
{
break;
}
+#ifndef CROSSGEN_COMPILE
+ if (Path::IsRelative(fileName))
+ {
+ BINDER_LOG_STRING(W("ApplicationContext::SetupBindingPaths: Relative path not allowed"), fileName);
+ GO_WITH_HRESULT(E_INVALIDARG);
+ }
+#endif
+
// Find the beginning of the simple name
SString::Iterator iSimpleNameStart = fileName.End();
if (!fileName.FindBack(iSimpleNameStart, DIRECTORY_SEPARATOR_CHAR_W))
{
-#ifdef CROSSGEN_COMPILE
iSimpleNameStart = fileName.Begin();
-#else
- // Couldn't find a directory separator. File must have been specified as a relative path. Not allowed.
- GO_WITH_HRESULT(E_INVALIDARG);
-#endif
}
else
{
break;
}
+#ifndef CROSSGEN_COMPILE
+ if (Path::IsRelative(pathName))
+ {
+ BINDER_LOG_STRING(W("ApplicationContext::SetupBindingPaths: Relative path not allowed"), pathName);
+ GO_WITH_HRESULT(E_INVALIDARG);
+ }
+#endif
+
m_platformResourceRoots.Append(pathName);
BINDER_LOG_STRING(W("ApplicationContext::SetupBindingPaths: Added resource root"), pathName);
}
break;
}
+#ifndef CROSSGEN_COMPILE
+ if (Path::IsRelative(pathName))
+ {
+ BINDER_LOG_STRING(W("ApplicationContext::SetupBindingPaths: Relative path not allowed"), pathName);
+ GO_WITH_HRESULT(E_INVALIDARG);
+ }
+#endif
+
m_appPaths.Append(pathName);
BINDER_LOG_STRING(W("ApplicationContext::SetupBindingPaths: Added App Path"), pathName);
}
break;
}
+#ifndef CROSSGEN_COMPILE
+ if (Path::IsRelative(pathName))
+ {
+ BINDER_LOG_STRING(W("ApplicationContext::SetupBindingPaths: Relative path not allowed"), pathName);
+ GO_WITH_HRESULT(E_INVALIDARG);
+ }
+#endif
+
m_appNiPaths.Append(pathName);
BINDER_LOG_STRING(W("ApplicationContext::SetupBindingPaths: Added App NI Path"), pathName);
}
LPCWSTR commandLine;
- if (g_pCachedCommandLine != NULL)
- {
- // Use the cached command line if available
- commandLine = g_pCachedCommandLine;
- }
- else
- {
- commandLine = WszGetCommandLine();
- if (commandLine==NULL)
- COMPlusThrowOM();
- }
+ commandLine = WszGetCommandLine();
+ if (commandLine==NULL)
+ COMPlusThrowOM();
retString.Set(commandLine);
LPWSTR commandLine;
- if (g_pCachedCommandLine != NULL)
- {
- // Use the cached command line if available
- commandLine = g_pCachedCommandLine;
- }
- else
- {
- commandLine = WszGetCommandLine();
- if (commandLine==NULL)
- COMPlusThrowOM();
- }
+ commandLine = WszGetCommandLine();
+ if (commandLine==NULL)
+ COMPlusThrowOM();
DWORD numArgs = 0;
LPWSTR* argv = SegmentCommandLine(commandLine, &numArgs);
}
FCIMPLEND
-FCIMPL0(StringObject*, SystemNative::_GetModuleFileName)
-{
- FCALL_CONTRACT;
-
- STRINGREF refRetVal = NULL;
-
- HELPER_METHOD_FRAME_BEGIN_RET_1(refRetVal);
- if (g_pCachedModuleFileName)
- {
- refRetVal = StringObject::NewString(g_pCachedModuleFileName);
- }
- else
- {
- PathString wszFilePathString;
-
-
- DWORD lgth = WszGetModuleFileName(NULL, wszFilePathString);
- if (!lgth)
- {
- COMPlusThrowWin32();
- }
-
-
- refRetVal = StringObject::NewString(wszFilePathString.GetUnicode());
- }
- HELPER_METHOD_FRAME_END();
-
- return (StringObject*)OBJECTREFToObject(refRetVal);
-}
-FCIMPLEND
-
-FCIMPL0(StringObject*, SystemNative::GetRuntimeDirectory)
-{
- FCALL_CONTRACT;
-
- STRINGREF refRetVal = NULL;
- DWORD dwFile = MAX_LONGPATH+1;
-
- HELPER_METHOD_FRAME_BEGIN_RET_1(refRetVal);
- SString wszFilePathString;
-
- WCHAR * wszFile = wszFilePathString.OpenUnicodeBuffer(dwFile);
- HRESULT hr = GetInternalSystemDirectory(wszFile, &dwFile);
- wszFilePathString.CloseBuffer(dwFile);
-
- if(FAILED(hr))
- COMPlusThrowHR(hr);
-
- dwFile--; // remove the trailing NULL
-
- if(dwFile)
- refRetVal = StringObject::NewString(wszFile, dwFile);
-
- HELPER_METHOD_FRAME_END();
- return (StringObject*)OBJECTREFToObject(refRetVal);
-}
-FCIMPLEND
-
INT32 QCALLTYPE SystemNative::GetProcessorCount()
{
QCALL_CONTRACT;
static FCDECL2(VOID, FailFastWithException, StringObject* refMessageUNSAFE, ExceptionObject* refExceptionUNSAFE);
static FCDECL3(VOID, FailFastWithExceptionAndSource, StringObject* refMessageUNSAFE, ExceptionObject* refExceptionUNSAFE, StringObject* errorSourceUNSAFE);
- static FCDECL0(StringObject*, _GetModuleFileName);
- static FCDECL0(StringObject*, GetRuntimeDirectory);
-
// Returns the number of logical processors that can be used by managed code
static INT32 QCALLTYPE GetProcessorCount();
#if defined(FEATURE_COMINTEROP_APARTMENT_SUPPORT) && !defined(CROSSGEN_COMPILE)
-#ifdef _DEBUG
-int g_fMainThreadApartmentStateSet = 0;
-#endif
-
Thread::ApartmentState SystemDomain::GetEntryPointThreadAptState(IMDInternalImport* pScope, mdMethodDef mdMethod)
{
STANDARD_VM_CONTRACT;
Thread::ApartmentState pState = pThread->SetApartment(Thread::AS_InMTA, TRUE);
_ASSERTE(pState == Thread::AS_InMTA);
}
-
-#ifdef _DEBUG
- g_fMainThreadApartmentStateSet++;
-#endif
}
#endif // defined(FEATURE_COMINTEROP_APARTMENT_SUPPORT) && !defined(CROSSGEN_COMPILE)
return FALSE;
}
-void SystemDomain::SetupDefaultDomain()
-{
- CONTRACT_VOID
- {
- THROWS;
- GC_TRIGGERS;
- MODE_ANY;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACT_END;
-
-
- Thread *pThread = GetThread();
- _ASSERTE(pThread);
-
- AppDomain *pDomain;
- pDomain = pThread->GetDomain();
- _ASSERTE(pDomain);
-
- GCX_COOP();
-
- ENTER_DOMAIN_PTR(SystemDomain::System()->DefaultDomain(),ADV_DEFAULTAD)
- {
- // Push this frame around loading the main assembly to ensure the
- // debugger can properly recgonize any managed code that gets run
- // as "class initializaion" code.
- FrameWithCookie<DebuggerClassInitMarkFrame> __dcimf;
-
- {
- GCX_PREEMP();
- InitializeDefaultDomain(TRUE);
- }
-
- __dcimf.Pop();
- }
- END_DOMAIN_TRANSITION;
-
- RETURN;
-}
-
-HRESULT SystemDomain::SetupDefaultDomainNoThrow()
-{
- CONTRACTL
- {
- NOTHROW;
- MODE_ANY;
- }
- CONTRACTL_END;
-
- HRESULT hr = S_OK;
-
- EX_TRY
- {
- SystemDomain::SetupDefaultDomain();
- }
- EX_CATCH_HRESULT(hr);
-
- return hr;
-}
-
-#ifdef _DEBUG
-int g_fInitializingInitialAD = 0;
-#endif
-
-// This routine completes the initialization of the default domaine.
-// After this call mananged code can be executed.
-void SystemDomain::InitializeDefaultDomain(
- BOOL allowRedirects,
- ICLRPrivBinder * pBinder)
-{
- STANDARD_VM_CONTRACT;
-
- WCHAR* pwsConfig = NULL;
- WCHAR* pwsPath = NULL;
-
- ETWOnStartup (InitDefaultDomain_V1, InitDefaultDomainEnd_V1);
-
-
- // Setup the default AppDomain.
-
-#ifdef _DEBUG
- g_fInitializingInitialAD++;
-#endif
-
- AppDomain* pDefaultDomain = SystemDomain::System()->DefaultDomain();
-
- if (pBinder != nullptr)
- {
- pDefaultDomain->SetLoadContextHostBinder(pBinder);
- }
-
- {
- GCX_COOP();
-
- pDefaultDomain->InitializeDomainContext(allowRedirects, pwsPath, pwsConfig);
-
-#ifndef CROSSGEN_COMPILE
- if (!NingenEnabled())
- {
-
- if (!IsSingleAppDomain())
- {
- pDefaultDomain->InitializeDefaultDomainManager();
- }
- }
-#endif // CROSSGEN_COMPILE
- }
-
- // DefaultDomain Load event
- ETW::LoaderLog::DomainLoad(pDefaultDomain);
-
-#ifdef _DEBUG
- g_fInitializingInitialAD--;
-#endif
-
- TESTHOOKCALL(RuntimeStarted(RTS_DEFAULTADREADY));
-}
-
-
-
-#ifndef CROSSGEN_COMPILE
-
-#ifdef _DEBUG
-Volatile<LONG> g_fInExecuteMainMethod = 0;
-#endif
-
-
-
-
-#endif // CROSSGEN_COMPILE
-
-
-
// Helper function to load an assembly. This is called from LoadCOMClass.
/* static */
return ref;
}
-
-
-OBJECTREF AppDomain::DoSetup(OBJECTREF* setupInfo)
-{
- CONTRACTL
- {
- MODE_COOPERATIVE;
- THROWS;
- GC_TRIGGERS;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACTL_END;
-
- ADID adid=GetAppDomain()->GetId();
-
- OBJECTREF retval=NULL;
- GCPROTECT_BEGIN(retval);
-
- ENTER_DOMAIN_PTR(this,ADV_CREATING);
-
- MethodDescCallSite setup(METHOD__APP_DOMAIN__SETUP);
-
- ARG_SLOT args[1];
-
- args[0]=ObjToArgSlot(*setupInfo);
-
- OBJECTREF activator;
- activator=setup.Call_RetOBJECTREF(args);
- _ASSERTE(activator==NULL);
-
-#if defined(FEATURE_MULTICOREJIT)
- // Disable AutoStartProfile in default domain from this code path.
- // It's called from SystemDomain::ExecuteMainMethod for normal program, not needed for SL and Asp.Net
- if (! IsDefaultDomain())
- {
- GCX_PREEMP();
-
- GetMulticoreJitManager().AutoStartProfile(this);
- }
-#endif
-
- END_DOMAIN_TRANSITION;
- GCPROTECT_END();
- return retval;
-}
-
#endif // !CROSSGEN_COMPILE
#ifdef FEATURE_COMINTEROP
return result;
}
-
-
#endif // CROSSGEN_COMPILE
-// You must be in the correct context before calling this
-// routine. Therefore, it is only good for initializing the
-// default domain.
-void AppDomain::InitializeDomainContext(BOOL allowRedirects,
- LPCWSTR pwszPath,
- LPCWSTR pwszConfig)
-{
- CONTRACTL
- {
- MODE_COOPERATIVE;
- GC_TRIGGERS;
- THROWS;
- INJECT_FAULT(COMPlusThrowOM(););
- }
- CONTRACTL_END;
-
- if (NingenEnabled())
- {
-
- CreateFusionContext();
-
- return;
- }
-
-#ifndef CROSSGEN_COMPILE
- struct _gc {
- STRINGREF pFilePath;
- STRINGREF pConfig;
- OBJECTREF ref;
- PTRARRAYREF propertyNames;
- PTRARRAYREF propertyValues;
- } gc;
- ZeroMemory(&gc, sizeof(gc));
-
- GCPROTECT_BEGIN(gc);
- if(pwszPath)
- {
- gc.pFilePath = StringObject::NewString(pwszPath);
- }
-
- if(pwszConfig)
- {
- gc.pConfig = StringObject::NewString(pwszConfig);
- }
-
-
- if ((gc.ref = GetExposedObject()) != NULL)
- {
- MethodDescCallSite setupDomain(METHOD__APP_DOMAIN__SETUP_DOMAIN);
-
- ARG_SLOT args[] =
- {
- ObjToArgSlot(gc.ref),
- BoolToArgSlot(allowRedirects),
- ObjToArgSlot(gc.pFilePath),
- ObjToArgSlot(gc.pConfig),
- ObjToArgSlot(gc.propertyNames),
- ObjToArgSlot(gc.propertyValues)
- };
- setupDomain.Call(args);
- }
- GCPROTECT_END();
-#endif // CROSSGEN_COMPILE
-}
-
-
IUnknown *AppDomain::CreateFusionContext()
{
CONTRACT(IUnknown *)
} // AppDomain::RaiseAssemblyResolveEvent
-//---------------------------------------------------------------------------------------
-//
-// Determine the type of AppDomainManager to use for the default AppDomain
-//
-// Notes:
-// v2.0 of the CLR used environment variables APPDOMAIN_MANAGER_ASM and APPDOMAIN_MANAGER_TYPE to set the
-// domain manager. For compatibility these are still supported, along with appDomainManagerAsm and
-// appDomainManagerType config file switches. If the config switches are supplied, the entry point must be
-// fully trusted.
-//
-
-void AppDomain::InitializeDefaultDomainManager()
-{
- CONTRACTL
- {
- MODE_COOPERATIVE;
- GC_TRIGGERS;
- THROWS;
- INJECT_FAULT(COMPlusThrowOM(););
- PRECONDITION(GetId().m_dwId == DefaultADID);
- }
- CONTRACTL_END;
-
- OBJECTREF orThis = GetExposedObject();
- GCPROTECT_BEGIN(orThis);
-
- MethodDescCallSite initCompatFlags(METHOD__APP_DOMAIN__INITIALIZE_COMPATIBILITY_FLAGS);
- ARG_SLOT args[] =
- {
- ObjToArgSlot(orThis)
- };
-
- initCompatFlags.Call(args);
-
- GCPROTECT_END();
-}
-
ULONGLONG g_ObjFinalizeStartTime = 0;
Volatile<BOOL> g_FinalizerIsRunning = FALSE;
Volatile<ULONG> g_FinalizerLoopCount = 0;
virtual BOOL IsAppDomain() { LIMITED_METHOD_DAC_CONTRACT; return TRUE; }
virtual PTR_AppDomain AsAppDomain() { LIMITED_METHOD_CONTRACT; return dac_cast<PTR_AppDomain>(this); }
-
- OBJECTREF DoSetup(OBJECTREF* setupInfo);
-
OBJECTREF GetExposedObject();
OBJECTREF GetRawExposedObject() {
CONTRACTL
return m_tpIndex;
}
- void InitializeDomainContext(BOOL allowRedirects, LPCWSTR pwszPath, LPCWSTR pwszConfig);
-
IUnknown *CreateFusionContext();
void OverrideDefaultContextBinder(IUnknown *pOverrideBinder)
DispIDCache* SetupRefDispIDCache();
#endif // FEATURE_COMINTEROP
- void InitializeDefaultDomainManager ();
-
-public:
-
protected:
BOOL PostBindResolveAssembly(AssemblySpec *pPrePolicySpec,
AssemblySpec *pPostPolicySpec,
}
#endif // DACCESS_COMPILE
- static void ActivateApplication(int *pReturnValue);
-
- static void InitializeDefaultDomain(BOOL allowRedirects, ICLRPrivBinder * pBinder = NULL);
- static void SetupDefaultDomain();
- static HRESULT SetupDefaultDomainNoThrow();
-
#if defined(FEATURE_COMINTEROP_APARTMENT_SUPPORT) && !defined(CROSSGEN_COMPILE)
static Thread::ApartmentState GetEntryPointThreadAptState(IMDInternalImport* pScope, mdMethodDef mdMethod);
static void SetThreadAptState(Thread::ApartmentState state);
}
FCIMPLEND
-FCIMPL1(void,
- AppDomainNative::CreateContext,
- AppDomainBaseObject *refThisUNSAFE)
-{
- FCALL_CONTRACT;
-
- struct _gc
- {
- APPDOMAINREF refThis;
- } gc;
-
- gc.refThis = (APPDOMAINREF) refThisUNSAFE;
-
- HELPER_METHOD_FRAME_BEGIN_PROTECT(gc);
-
- AppDomain* pDomain = ValidateArg(gc.refThis);
-
- if((BaseDomain*) pDomain == SystemDomain::System())
- {
- COMPlusThrow(kUnauthorizedAccessException, W("UnauthorizedAccess_SystemDomain"));
- }
-
- pDomain->CreateFusionContext();
-
- HELPER_METHOD_FRAME_END();
-}
-FCIMPLEND
-
void QCALLTYPE AppDomainNative::SetupBindingPaths(__in_z LPCWSTR wszTrustedPlatformAssemblies, __in_z LPCWSTR wszPlatformResourceRoots, __in_z LPCWSTR wszAppPaths, __in_z LPCWSTR wszAppNiPaths, __in_z LPCWSTR appLocalWinMD)
{
QCALL_CONTRACT;
}
#endif // CALLDESCR_REGTYPEMAP
-#if defined(_DEBUG) && defined(FEATURE_COMINTEROP)
-extern int g_fMainThreadApartmentStateSet;
-extern int g_fInitializingInitialAD;
-extern Volatile<LONG> g_fInExecuteMainMethod;
-#endif
-
//*******************************************************************************
#ifdef FEATURE_INTERPRETER
void MethodDescCallSite::CallTargetWorker(const ARG_SLOT *pArguments, ARG_SLOT *pReturnValue, int cbReturnValue, bool transitionToPreemptive)
MODE_COOPERATIVE;
PRECONDITION(GetAppDomain()->CheckCanExecuteManagedCode(m_pMD));
PRECONDITION(m_pMD->CheckActivated()); // EnsureActive will trigger, so we must already be activated
-
-#ifdef FEATURE_COMINTEROP
- // If we're an exe, then we must either be initializing the first AD, or have already setup the main thread's
- // COM apartment state.
- // If you hit this assert, then you likely introduced code during startup that could inadvertently
- // initialize the COM apartment state of the main thread before we set it based on the user attribute.
- PRECONDITION(g_fInExecuteMainMethod ? (g_fMainThreadApartmentStateSet || g_fInitializingInitialAD) : TRUE);
-#endif // FEATURE_COMINTEROP
}
CONTRACTL_END;
HRESULT EEStartup(COINITIEE fFlags);
-BOOL STDMETHODCALLTYPE ExecuteEXE(HMODULE hMod);
-BOOL STDMETHODCALLTYPE ExecuteEXE(__in LPWSTR pImageNameIn);
-
#ifndef CROSSGEN_COMPILE
static void InitializeGarbageCollector();
}
PAL_ENDTRY
-#ifndef CROSSGEN_COMPILE
- if(SUCCEEDED(g_EEStartupStatus) && (fFlags & COINITEE_MAIN) == 0)
- g_EEStartupStatus = SystemDomain::SetupDefaultDomainNoThrow();
-#endif
-
return g_EEStartupStatus;
}
ENTER_DOMAIN_PTR(pCompilationDomain,ADV_COMPILATION)
{
- pCompilationDomain->InitializeDomainContext(TRUE, NULL, NULL);
+ pCompilationDomain->CreateFusionContext();
pCompilationDomain->SetFriendlyName(W("Compilation Domain"));
SystemDomain::System()->LoadDomain(pCompilationDomain);
if (dwFlags & APPDOMAIN_FORCE_TRIVIAL_WAIT_OPERATIONS)
pDomain->SetForceTrivialWaitOperations();
+ pDomain->CreateFusionContext();
+
{
GCX_COOP();
STRINGREF friendlyName;
PTRARRAYREF propertyNames;
PTRARRAYREF propertyValues;
- OBJECTREF setupInfo;
- OBJECTREF adSetup;
} _gc;
ZeroMemory(&_gc,sizeof(_gc));
GCPROTECT_BEGIN(_gc)
_gc.friendlyName=StringObject::NewString(wszFriendlyName);
- if(nProperties>0)
+ if (nProperties>0)
{
_gc.propertyNames = (PTRARRAYREF) AllocateObjectArray(nProperties, g_pStringClass);
_gc.propertyValues= (PTRARRAYREF) AllocateObjectArray(nProperties, g_pStringClass);
}
}
- MethodDescCallSite prepareDataForSetup(METHOD__APP_DOMAIN__PREPARE_DATA_FOR_SETUP);
+ MethodDescCallSite setup(METHOD__APP_DOMAIN__SETUP);
- ARG_SLOT args[4];
+ ARG_SLOT args[3];
args[0]=ObjToArgSlot(_gc.friendlyName);
- args[1]=ObjToArgSlot(NULL);
- args[2]=ObjToArgSlot(_gc.propertyNames);
- args[3]=ObjToArgSlot(_gc.propertyValues);
-
- _gc.setupInfo=prepareDataForSetup.Call_RetOBJECTREF(args);
-
- //
- // Get the new flag values and set it to the domain
- //
- PTRARRAYREF handleArrayObj = (PTRARRAYREF) ObjectToOBJECTREF(_gc.setupInfo);
- _gc.adSetup = ObjectToOBJECTREF(handleArrayObj->GetAt(1));
-
+ args[1]=ObjToArgSlot(_gc.propertyNames);
+ args[2]=ObjToArgSlot(_gc.propertyValues);
- pDomain->DoSetup(&_gc.setupInfo);
+ setup.Call(args);
GCPROTECT_END();
FCFuncElementSig("FailFast", &gsig_SM_Str_Exception_Str_RetVoid, SystemNative::FailFastWithExceptionAndSource)
FCFuncEnd()
-FCFuncStart(gRuntimeEnvironmentFuncs)
- FCFuncElement("GetModuleFileName", SystemNative::_GetModuleFileName)
-FCFuncEnd()
-
FCFuncStart(gSerializationFuncs)
FCFuncElement("nativeGetUninitializedObject", ReflectionSerialization::GetUninitializedObject)
FCFuncEnd()
FCFuncEnd()
-FCFuncStart(gAppDomainManagerFuncs)
- QCFuncElement("GetEntryAssembly", AssemblyNative::GetEntryAssembly)
-FCFuncEnd()
-
FCFuncStart(gAppDomainFuncs)
FCFuncElement("IsStringInterned", AppDomainNative::IsStringInterned)
#endif
FCFuncElement("nSetupFriendlyName", AppDomainNative::SetupFriendlyName)
FCFuncElement("nGetAssemblies", AppDomainNative::GetAssemblies)
- FCFuncElement("nCreateContext", AppDomainNative::CreateContext)
FCFuncElement("GetId", AppDomainNative::GetId)
FCFuncElement("GetOrInternString", AppDomainNative::GetOrInternString)
QCFuncElement("nSetupBindingPaths", AppDomainNative::SetupBindingPaths)
QCFuncElement("GetNeutralResourcesLanguageAttribute", AssemblyNative::GetNeutralResourcesLanguageAttribute)
FCFuncEnd()
-FCFuncStart(gAssemblyFuncs)
+FCFuncStart(gRuntimeAssemblyFuncs)
QCFuncElement("GetFullName", AssemblyNative::GetFullName)
QCFuncElement("GetLocation", AssemblyNative::GetLocation)
QCFuncElement("GetResource", AssemblyNative::GetResource)
QCFuncElement("GetCodeBase", AssemblyNative::GetCodeBase)
- QCFuncElement("GetExecutingAssembly", AssemblyNative::GetExecutingAssembly)
QCFuncElement("GetFlags", AssemblyNative::GetFlags)
QCFuncElement("GetHashAlgorithm", AssemblyNative::GetHashAlgorithm)
QCFuncElement("GetLocale", AssemblyNative::GetLocale)
QCFuncElement("Destroy", LoaderAllocator::Destroy)
FCFuncEnd()
+FCFuncStart(gAssemblyFuncs)
+ QCFuncElement("GetEntryAssembly", AssemblyNative::GetEntryAssembly)
+ QCFuncElement("GetExecutingAssembly", AssemblyNative::GetExecutingAssembly)
+FCFuncEnd()
+
FCFuncStart(gAssemblyBuilderFuncs)
FCFuncElement("nCreateDynamicAssembly", AppDomainNative::CreateDynamicAssembly)
FCFuncElement("GetInMemoryAssemblyModule", AssemblyNative::GetInMemoryAssemblyModule)
// The sorting is case-sensitive
FCClassElement("AppDomain", "System", gAppDomainFuncs)
-FCClassElement("AppDomainManager", "System", gAppDomainManagerFuncs)
FCClassElement("ArgIterator", "System", gVarArgFuncs)
FCClassElement("Array", "System", gArrayFuncs)
FCClassElement("ArrayWithOffset", "System.Runtime.InteropServices", gArrayWithOffsetFuncs)
+FCClassElement("Assembly", "System.Reflection", gAssemblyFuncs)
FCClassElement("AssemblyBuilder", "System.Reflection.Emit", gAssemblyBuilderFuncs)
FCClassElement("AssemblyExtensions", "System.Reflection.Metadata", gAssemblyExtensionsFuncs)
#endif // FEATURE_COMINTEROP_MANAGED_ACTIVATION
#endif // FEATURE_COMINTEROP
-FCClassElement("RuntimeAssembly", "System.Reflection", gAssemblyFuncs)
+FCClassElement("RuntimeAssembly", "System.Reflection", gRuntimeAssemblyFuncs)
#ifdef FEATURE_COMINTEROP
FCClassElement("RuntimeClass", "System.Runtime.InteropServices.WindowsRuntime", gRuntimeClassFuncs)
#endif // FEATURE_COMINTEROP
-FCClassElement("RuntimeEnvironment", "System.Runtime.InteropServices", gRuntimeEnvironmentFuncs)
FCClassElement("RuntimeFieldHandle", "System", gCOMFieldHandleNewFuncs)
FCClassElement("RuntimeHelpers", "System.Runtime.CompilerServices", gCompilerFuncs)
FCClassElement("RuntimeImports", "System.Runtime", gRuntimeImportsFuncs)
// App Domain related defines
DEFINE_METASIG(IM(Bool_Str_Str_ArrStr_ArrStr_RetVoid, F s s a(s) a(s), v))
DEFINE_METASIG_T(SM(Str_RetAppDomain, s, C(APP_DOMAIN)))
-DEFINE_METASIG_T(SM(Str_AppDomainSetup_ArrStr_ArrStr_RetObj, s C(APPDOMAIN_SETUP) a(s) a(s), j))
+DEFINE_METASIG(SM(Str_ArrStr_ArrStr_RetVoid, s a(s) a(s), v))
#ifdef FEATURE_COMINTEROP
// System.AppDomain.OnReflectionOnlyNamespaceResolveEvent
DEFINE_METASIG_T(IM(Assembly_Str_RetArrAssembly, C(ASSEMBLY) s, a(C(ASSEMBLY))))
DEFINE_FIELD(ACCESS_VIOLATION_EXCEPTION, ACCESSTYPE, _accessType)
DEFINE_CLASS_U(System, AppDomain, AppDomainBaseObject)
-DEFINE_FIELD_U(_domainManager, AppDomainBaseObject, m_pDomainManager)
DEFINE_FIELD_U(_LocalStore, AppDomainBaseObject, m_LocalStore)
-DEFINE_FIELD_U(_FusionStore, AppDomainBaseObject, m_FusionTable)
DEFINE_FIELD_U(AssemblyLoad, AppDomainBaseObject, m_pAssemblyEventHandler)
DEFINE_FIELD_U(_TypeResolve, AppDomainBaseObject, m_pTypeEventHandler)
DEFINE_FIELD_U(_ResourceResolve, AppDomainBaseObject, m_pResourceEventHandler)
DEFINE_FIELD_U(_processExit, AppDomainBaseObject, m_pProcessExitEventHandler)
DEFINE_FIELD_U(_domainUnload, AppDomainBaseObject, m_pDomainUnloadEventHandler)
DEFINE_FIELD_U(_unhandledException, AppDomainBaseObject, m_pUnhandledExceptionEventHandler)
-DEFINE_FIELD_U(_compatFlags, AppDomainBaseObject, m_compatFlags)
DEFINE_FIELD_U(_firstChanceException, AppDomainBaseObject, m_pFirstChanceExceptionHandler)
DEFINE_FIELD_U(_pDomain, AppDomainBaseObject, m_pDomain)
-DEFINE_FIELD_U(_compatFlagsInitialized, AppDomainBaseObject, m_compatFlagsInitialized)
DEFINE_CLASS(APP_DOMAIN, System, AppDomain)
-DEFINE_METHOD(APP_DOMAIN, PREPARE_DATA_FOR_SETUP,PrepareDataForSetup,SM_Str_AppDomainSetup_ArrStr_ArrStr_RetObj)
-DEFINE_METHOD(APP_DOMAIN, SETUP,Setup,SM_Obj_RetObj)
+DEFINE_METHOD(APP_DOMAIN, SETUP,Setup,SM_Str_ArrStr_ArrStr_RetVoid)
DEFINE_METHOD(APP_DOMAIN, ON_ASSEMBLY_LOAD, OnAssemblyLoadEvent, IM_Assembly_RetVoid)
DEFINE_METHOD(APP_DOMAIN, ON_RESOURCE_RESOLVE, OnResourceResolveEvent, IM_Assembly_Str_RetAssembly)
DEFINE_METHOD(APP_DOMAIN, ON_TYPE_RESOLVE, OnTypeResolveEvent, IM_Assembly_Str_RetAssembly)
#ifdef FEATURE_COMINTEROP
DEFINE_METHOD(APP_DOMAIN, ON_DESIGNER_NAMESPACE_RESOLVE, OnDesignerNamespaceResolveEvent, IM_Str_RetArrStr)
#endif //FEATURE_COMINTEROP
-DEFINE_METHOD(APP_DOMAIN, SETUP_DOMAIN, SetupDomain, IM_Bool_Str_Str_ArrStr_ArrStr_RetVoid)
-DEFINE_METHOD(APP_DOMAIN, INITIALIZE_COMPATIBILITY_FLAGS, InitializeCompatibilityFlags, IM_RetVoid)
DEFINE_CLASS(CLEANUP_WORK_LIST_ELEMENT, StubHelpers, CleanupWorkListElement)
#endif
-DEFINE_CLASS(APPDOMAIN_SETUP, System, AppDomainSetup)
-
DEFINE_CLASS(ARG_ITERATOR, System, ArgIterator)
DEFINE_CLASS_U(System, ArgIterator, VARARGS) // Includes a SigPointer.
DEFINE_METHOD(ARG_ITERATOR, CTOR2, .ctor, IM_RuntimeArgumentHandle_PtrVoid_RetVoid)
// READ ME:
// Modifying the order or fields of this object may require other changes to the
// classlib class definition of this object.
- OBJECTREF m_pDomainManager; // AppDomainManager for host settings.
OBJECTREF m_LocalStore;
- OBJECTREF m_FusionTable;
OBJECTREF m_pAssemblyEventHandler; // Delegate for 'loading assembly' event
OBJECTREF m_pTypeEventHandler; // Delegate for 'resolve type' event
OBJECTREF m_pResourceEventHandler; // Delegate for 'resolve resource' event
OBJECTREF m_pDomainUnloadEventHandler; // Delegate for 'about to unload domain' event
OBJECTREF m_pUnhandledExceptionEventHandler; // Delegate for 'unhandled exception' event
- OBJECTREF m_compatFlags;
-
OBJECTREF m_pFirstChanceExceptionHandler; // Delegate for 'FirstChance Exception' event
AppDomain* m_pDomain; // Pointer to the BaseDomain Structure
- CLR_BOOL m_compatFlagsInitialized;
protected:
AppDomainBaseObject() { LIMITED_METHOD_CONTRACT; }
return m_pDomain;
}
- OBJECTREF GetAppDomainManager()
- {
- LIMITED_METHOD_CONTRACT;
- return m_pDomainManager;
- }
-
// Returns the reference to the delegate of the first chance exception notification handler
OBJECTREF GetFirstChanceExceptionNotificationHandler()
{
bool g_fInControlC = false;
//
-// Cached command line file provided by the host.
-//
-LPWSTR g_pCachedCommandLine = NULL;
-LPWSTR g_pCachedModuleFileName = 0;
-
//
// IJW needs the shim HINSTANCE
//
extern const DWORD g_rgPrimes[71];
//
-// Cached command line file provided by the host.
-//
-extern LPWSTR g_pCachedCommandLine;
-extern LPWSTR g_pCachedModuleFileName;
-
-//
// Macros to check debugger and profiler settings.
//
inline bool CORDebuggerPendingAttach()
[
{
+ "name": "System.Diagnostics.TraceSource.Tests",
+ "enabled": true,
+ "exclusions": {
+ "namespaces": null,
+ "classes": null,
+ "methods": [
+ {
+ "name": "System.Diagnostics.TraceSourceTests.DefaultTraceListenerClassTests.EntryAssemblyName_Null_NotIncludedInTrace",
+ "reason": "outdated"
+ }
+ ]
+ }
+ },
+ {
"name": "System.Globalization.Tests",
"enabled": true,
"exclusions": {
cultures = new List<CultureInfo>();
cultures.Add(CultureInfo.CurrentUICulture);
}
-#if ES_BUILD_STANDALONE || ES_BUILD_PN
- var sortedStrings = new List<string>(stringTab.Keys);
- sortedStrings.Sort();
-#else
- // DD 947936
+
var sortedStrings = new string[stringTab.Keys.Count];
stringTab.Keys.CopyTo(sortedStrings, 0);
- // Avoid using public Array.Sort as that attempts to access BinaryCompatibility. Unfortunately FrameworkEventSource gets called
- // very early in the app domain creation, when _FusionStore is not set up yet, resulting in a failure to run the static constructory
- // for BinaryCompatibility. This failure is then cached and a TypeInitializationException is thrown every time some code attampts to
- // access BinaryCompatibility.
- ArraySortHelper<string>.IntrospectiveSort(sortedStrings, 0, sortedStrings.Length, string.Compare);
-#endif
+ Array.Sort<string>(sortedStrings, 0, sortedStrings.Length);
+
foreach (var ci in cultures)
{
sb.Append(" <resources culture=\"").Append(ci.Name).Append("\">").AppendLine();