#endregion
}
-
-#if FEATURE_CORECLR
internal sealed class PinnableBufferCacheEventSource
{
public static readonly PinnableBufferCacheEventSource Log = new PinnableBufferCacheEventSource();
return 0;
}
}
-#else
- /// <summary>
- /// PinnableBufferCacheEventSource is a private eventSource that we are using to
- /// debug and monitor the effectiveness of PinnableBufferCache
- /// </summary>
-#if PINNABLEBUFFERCACHE_MSCORLIB
- [EventSource(Name = "Microsoft-DotNETRuntime-PinnableBufferCache")]
-#else
- [EventSource(Name = "Microsoft-DotNETRuntime-PinnableBufferCache-System")]
-#endif
- internal sealed class PinnableBufferCacheEventSource : EventSource
- {
- public static readonly PinnableBufferCacheEventSource Log = new PinnableBufferCacheEventSource();
-
- [Event(1, Level = EventLevel.Verbose)]
- public void DebugMessage(string message) { if (IsEnabled()) WriteEvent(1, message); }
- [Event(2, Level = EventLevel.Verbose)]
- public void DebugMessage1(string message, long value) { if (IsEnabled()) WriteEvent(2, message, value); }
- [Event(3, Level = EventLevel.Verbose)]
- public void DebugMessage2(string message, long value1, long value2) { if (IsEnabled()) WriteEvent(3, message, value1, value2); }
- [Event(18, Level = EventLevel.Verbose)]
- public void DebugMessage3(string message, long value1, long value2, long value3) { if (IsEnabled()) WriteEvent(18, message, value1, value2, value3); }
-
- [Event(4)]
- public void Create(string cacheName) { if (IsEnabled()) WriteEvent(4, cacheName); }
-
- [Event(5, Level = EventLevel.Verbose)]
- public void AllocateBuffer(string cacheName, ulong objectId, int objectHash, int objectGen, int freeCountAfter) { if (IsEnabled()) WriteEvent(5, cacheName, objectId, objectHash, objectGen, freeCountAfter); }
- [Event(6)]
- public void AllocateBufferFromNotGen2(string cacheName, int notGen2CountAfter) { if (IsEnabled()) WriteEvent(6, cacheName, notGen2CountAfter); }
- [Event(7)]
- public void AllocateBufferCreatingNewBuffers(string cacheName, int totalBuffsBefore, int objectCount) { if (IsEnabled()) WriteEvent(7, cacheName, totalBuffsBefore, objectCount); }
- [Event(8)]
- public void AllocateBufferAged(string cacheName, int agedCount) { if (IsEnabled()) WriteEvent(8, cacheName, agedCount); }
- [Event(9)]
- public void AllocateBufferFreeListEmpty(string cacheName, int notGen2CountBefore) { if (IsEnabled()) WriteEvent(9, cacheName, notGen2CountBefore); }
-
- [Event(10, Level = EventLevel.Verbose)]
- public void FreeBuffer(string cacheName, ulong objectId, int objectHash, int freeCountBefore) { if (IsEnabled()) WriteEvent(10, cacheName, objectId, objectHash, freeCountBefore); }
- [Event(11)]
- public void FreeBufferStillTooYoung(string cacheName, int notGen2CountBefore) { if (IsEnabled()) WriteEvent(11, cacheName, notGen2CountBefore); }
-
- [Event(13)]
- public void TrimCheck(string cacheName, int totalBuffs, bool neededMoreThanFreeList, int deltaMSec) { if (IsEnabled()) WriteEvent(13, cacheName, totalBuffs, neededMoreThanFreeList, deltaMSec); }
- [Event(14)]
- public void TrimFree(string cacheName, int totalBuffs, int freeListCount, int toBeFreed) { if (IsEnabled()) WriteEvent(14, cacheName, totalBuffs, freeListCount, toBeFreed); }
- [Event(15)]
- public void TrimExperiment(string cacheName, int totalBuffs, int freeListCount, int numTrimTrial) { if (IsEnabled()) WriteEvent(15, cacheName, totalBuffs, freeListCount, numTrimTrial); }
- [Event(16)]
- public void TrimFreeSizeOK(string cacheName, int totalBuffs, int freeListCount) { if (IsEnabled()) WriteEvent(16, cacheName, totalBuffs, freeListCount); }
- [Event(17)]
- public void TrimFlush(string cacheName, int totalBuffs, int freeListCount, int notGen2CountBefore) { if (IsEnabled()) WriteEvent(17, cacheName, totalBuffs, freeListCount, notGen2CountBefore); }
- [Event(20)]
- public void AgePendingBuffersResults(string cacheName, int promotedToFreeListCount, int heldBackCount) { if (IsEnabled()) WriteEvent(20, cacheName, promotedToFreeListCount, heldBackCount); }
- [Event(21)]
- public void WalkFreeListResult(string cacheName, int freeListCount, int gen0BuffersInFreeList) { if (IsEnabled()) WriteEvent(21, cacheName, freeListCount, gen0BuffersInFreeList); }
-
-
- static internal ulong AddressOf(object obj)
- {
- var asByteArray = obj as byte[];
- if (asByteArray != null)
- return (ulong)AddressOfByteArray(asByteArray);
- return 0;
- }
-
- static internal unsafe long AddressOfByteArray(byte[] array)
- {
- if (array == null)
- return 0;
- fixed (byte* ptr = array)
- return (long)(ptr - 2 * sizeof(void*));
- }
- }
-#endif
}
internal NativeOverlapped* Overlapped
{
- [SecurityCritical]get { return _overlapped; }
+ get { return _overlapped; }
}
public void SetCompletedSynchronously(int numBytes)
<InteropSources Include="$(BclSourcesRoot)\System\Runtime\InteropServices\IRegistrationServices.cs" />
<InteropSources Include="$(BclSourcesRoot)\System\Runtime\InteropServices\ITypeLibConverter.cs" />
<InteropSources Include="$(BclSourcesRoot)\System\Runtime\InteropServices\RegistrationServices.cs" />
- <InteropSources Include="$(BclSourcesRoot)\System\Runtime\InteropServices\TypeLibConverter.cs" />
<InteropSources Include="$(BclSourcesRoot)\System\Runtime\InteropServices\UCOMIBindCtx.cs" />
<InteropSources Include="$(BclSourcesRoot)\System\Runtime\InteropServices\UCOMIConnectionPointContainer.cs" />
<InteropSources Include="$(BclSourcesRoot)\System\Runtime\InteropServices\UCOMIConnectionPoint.cs" />
** thread is not currently blocked in that manner, it will be interrupted
** when it next begins to block.
=========================================================================*/
-#if FEATURE_CORECLR
-#else
-#endif
#pragma warning disable 618 // obsolete types: SecurityPermissionAttribute, SecurityAction
#pragma warning restore 618 // obsolete types: SecurityPermissionAttribute, SecurityAction
public void Interrupt() => InterruptInternal();
*
* @return the Subkey requested, or <b>null</b> if the operation failed.
*/
- #if FEATURE_CORECLR
- #else
- #endif
public RegistryKey OpenSubKey(string name, bool writable ) {
ValidateKeyName(name);
EnsureNotDisposed();
*
* @return the Subkey requested, or <b>null</b> if the operation failed.
*/
-#if FEATURE_CORECLR
-#endif
public RegistryKey OpenSubKey(String name) {
return OpenSubKey(name, false);
}
*
* @return all subkey names.
*/
- #if FEATURE_CORECLR
- #else
- #endif
public String[] GetSubKeyNames() {
CheckPermission(RegistryInternalCheck.CheckKeyReadPermission, null, false, RegistryKeyPermissionCheck.Default);
return InternalGetSubKeyNames();
*
* @return the data associated with the value.
*/
- #if FEATURE_CORECLR
- #else
- #endif
public Object GetValue(String name, Object defaultValue) {
CheckPermission(RegistryInternalCheck.CheckValueReadPermission, name, false, RegistryKeyPermissionCheck.Default);
return InternalGetValue(name, defaultValue, false, true);
}
- #if FEATURE_CORECLR
- #else
- #endif
[ComVisible(false)]
public Object GetValue(String name, Object defaultValue, RegistryValueOptions options) {
if( options < RegistryValueOptions.None || options > RegistryValueOptions.DoNotExpandEnvironmentNames) {
// See the LICENSE file in the project root for more information.
namespace Microsoft.Win32 {
- using Microsoft.Win32;
using Microsoft.Win32.SafeHandles;
- using System;
- using System.Runtime.CompilerServices;
- using System.Runtime.ConstrainedExecution;
- using System.Runtime.InteropServices;
- using System.Runtime.Serialization;
- using System.Runtime.Versioning;
- using System.Security;
using System.Security.Permissions;
- using System.Text;
[HostProtectionAttribute(MayLeakOnAbort = true)]
sealed internal class SafeLibraryHandle : SafeHandleZeroOrMinusOneIsInvalid {
// 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.
-namespace Microsoft.Win32.SafeHandles {
+
+namespace Microsoft.Win32.SafeHandles
+{
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[In] uint dwFlags);
#endif // FEATURE_LEGACYSURFACE
-#if FEATURE_CORECLR
[DllImport(NTDLL, CharSet=CharSet.Unicode, SetLastError=true)]
internal static extern
int RtlNtStatusToDosError (
[In] int status);
-#else
- // identical to RtlNtStatusToDosError, but we are in ask mode for desktop CLR
- [DllImport(ADVAPI32, CharSet = CharSet.Unicode, SetLastError = true)]
- internal static extern
- int LsaNtStatusToWinError (
- [In] int status);
-#endif
+
// Get the current FIPS policy setting on Vista and above
[DllImport("bcrypt.dll")]
internal static extern uint BCryptGetFipsAlgorithmMode(
byte[] dacl,
byte[] sacl );
-#if FEATURE_CORECLR
[DllImport(KERNEL32, CharSet=CharSet.Unicode)]
[SuppressUnmanagedCodeSecurityAttribute()]
internal unsafe static extern int WideCharToMultiByte(
int cchMultiByte,
char* lpWideCharStr,
int cchWideChar);
-#endif // FEATURE_CORECLR
[DllImport(KERNEL32, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal extern static bool QueryUnbiasedInterruptTime(out ulong UnbiasedTime);
-#if FEATURE_CORECLR
#if FEATURE_PAL
[DllImport(KERNEL32, EntryPoint = "PAL_Random")]
internal extern static bool Random(bool bStrong,
}
}
#endif
-#endif
}
}
NoDebugResources = [{0}]\r\nArguments: {1}\r\nDebugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version={2}&File={3}&Key={4}
#endif // INCLUDE_RUNTIME
-#if !FEATURE_CORECLR
-UnknownError = Unknown error.
-#endif // !FEATURE_CORECLR
-
#if INCLUDE_DEBUG
; For code contracts
Arg_TypedReference_Null = The TypedReference must be initialized.
Argument_AddingDuplicate__ = Item has already been added. Key in dictionary: '{0}' Key being added: '{1}'
Argument_AddingDuplicate = An item with the same key has already been added.
-#if FEATURE_CORECLR
Argument_AddingDuplicateWithKey = An item with the same key has already been added. Key: {0}
-#endif // FEATURE_CORECLR
Argument_MethodDeclaringTypeGenericLcg = Method '{0}' has a generic declaring type '{1}'. Explicitly provide the declaring type to GetTokenFor.
Argument_MethodDeclaringTypeGeneric = Cannot resolve method {0} because the declaring type of the method handle {1} is generic. Explicitly provide the declaring type to GetMethodFromHandle.
Argument_FieldDeclaringTypeGeneric = Cannot resolve field {0} because the declaring type of the field handle {1} is generic. Explicitly provide the declaring type to GetFieldFromHandle.
; PathTooLongException
IO.PathTooLong = The specified file name or path is too long, or a component of the specified path is too long.
-#if FEATURE_CORECLR
; SecurityException
FileSecurityState_OperationNotPermitted = File operation not permitted. Access to path '{0}' is denied.
-#endif
; PrivilegeNotHeldException
PrivilegeNotHeld_Default = The process does not possess some privilege required for this operation.
; Buffers
ArgumentException_BufferNotFromPool=The buffer is not associated with this pool and may not be returned to it.
-; Globalization resources
-;------------------
-
-#if !FEATURE_CORECLR
-Globalization.LegacyModifier = Legacy
-
-;
-;Total items: 809
-;
-Globalization.ci_ = Invariant Language (Invariant Country)
-Globalization.ci_aa = Afar
-Globalization.ci_aa-DJ = Afar (Djibouti)
-Globalization.ci_aa-ER = Afar (Eritrea)
-Globalization.ci_aa-ET = Afar (Ethiopia)
-Globalization.ci_af = Afrikaans
-Globalization.ci_af-NA = Afrikaans (Namibia)
-Globalization.ci_af-ZA = Afrikaans (South Africa)
-Globalization.ci_agq = Aghem
-Globalization.ci_agq-CM = Aghem (Cameroon)
-Globalization.ci_ak = Akan
-Globalization.ci_ak-GH = Akan (Ghana)
-Globalization.ci_am = Amharic
-Globalization.ci_am-ET = Amharic (Ethiopia)
-Globalization.ci_ar = Arabic
-Globalization.ci_ar-001 = Arabic (World)
-Globalization.ci_ar-AE = Arabic (U.A.E.)
-Globalization.ci_ar-BH = Arabic (Bahrain)
-Globalization.ci_ar-DJ = Arabic (Djibouti)
-Globalization.ci_ar-DZ = Arabic (Algeria)
-Globalization.ci_ar-EG = Arabic (Egypt)
-Globalization.ci_ar-ER = Arabic (Eritrea)
-Globalization.ci_ar-IL = Arabic (Israel)
-Globalization.ci_ar-IQ = Arabic (Iraq)
-Globalization.ci_ar-JO = Arabic (Jordan)
-Globalization.ci_ar-KM = Arabic (Comoros)
-Globalization.ci_ar-KW = Arabic (Kuwait)
-Globalization.ci_ar-LB = Arabic (Lebanon)
-Globalization.ci_ar-LY = Arabic (Libya)
-Globalization.ci_ar-MA = Arabic (Morocco)
-Globalization.ci_ar-MR = Arabic (Mauritania)
-Globalization.ci_ar-OM = Arabic (Oman)
-Globalization.ci_ar-PS = Arabic (Palestinian Authority)
-Globalization.ci_ar-QA = Arabic (Qatar)
-Globalization.ci_ar-SA = Arabic (Saudi Arabia)
-Globalization.ci_ar-SD = Arabic (Sudan)
-Globalization.ci_ar-SO = Arabic (Somalia)
-Globalization.ci_ar-SS = Arabic (South Sudan)
-Globalization.ci_ar-SY = Arabic (Syria)
-Globalization.ci_ar-TD = Arabic (Chad)
-Globalization.ci_ar-TN = Arabic (Tunisia)
-Globalization.ci_ar-YE = Arabic (Yemen)
-Globalization.ci_arn = Mapudungun
-Globalization.ci_arn-CL = Mapudungun (Chile)
-Globalization.ci_as = Assamese
-Globalization.ci_as-IN = Assamese (India)
-Globalization.ci_asa = Asu
-Globalization.ci_asa-TZ = Asu (Tanzania)
-Globalization.ci_ast = Asturian
-Globalization.ci_ast-ES = Asturian (Spain)
-Globalization.ci_az = Azerbaijani
-Globalization.ci_az-Cyrl = Azerbaijani (Cyrillic)
-Globalization.ci_az-Cyrl-AZ = Azerbaijani (Cyrillic, Azerbaijan)
-Globalization.ci_az-Latn = Azerbaijani (Latin)
-Globalization.ci_az-Latn-AZ = Azerbaijani (Latin, Azerbaijan)
-Globalization.ci_ba = Bashkir
-Globalization.ci_ba-RU = Bashkir (Russia)
-Globalization.ci_bas = Basaa
-Globalization.ci_bas-CM = Basaa (Cameroon)
-Globalization.ci_be = Belarusian
-Globalization.ci_be-BY = Belarusian (Belarus)
-Globalization.ci_bem = Bemba
-Globalization.ci_bem-ZM = Bemba (Zambia)
-Globalization.ci_bez = Bena
-Globalization.ci_bez-TZ = Bena (Tanzania)
-Globalization.ci_bg = Bulgarian
-Globalization.ci_bg-BG = Bulgarian (Bulgaria)
-Globalization.ci_bm = Bambara
-Globalization.ci_bm-Latn = Bambara (Latin)
-Globalization.ci_bm-Latn-ML = Bambara (Latin, Mali)
-Globalization.ci_bm-ML = Bamanankan (Latin, Mali)
-Globalization.ci_bn = Bangla
-Globalization.ci_bn-BD = Bangla (Bangladesh)
-Globalization.ci_bn-IN = Bangla (India)
-Globalization.ci_bo = Tibetan
-Globalization.ci_bo-CN = Tibetan (PRC)
-Globalization.ci_bo-IN = Tibetan (India)
-Globalization.ci_br = Breton
-Globalization.ci_br-FR = Breton (France)
-Globalization.ci_brx = Bodo
-Globalization.ci_brx-IN = Bodo (India)
-Globalization.ci_bs = Bosnian
-Globalization.ci_bs-Cyrl = Bosnian (Cyrillic)
-Globalization.ci_bs-Cyrl-BA = Bosnian (Cyrillic, Bosnia and Herzegovina)
-Globalization.ci_bs-Latn = Bosnian (Latin)
-Globalization.ci_bs-Latn-BA = Bosnian (Latin, Bosnia and Herzegovina)
-Globalization.ci_byn = Blin
-Globalization.ci_byn-ER = Blin (Eritrea)
-Globalization.ci_ca = Catalan
-Globalization.ci_ca-AD = Catalan (Andorra)
-Globalization.ci_ca-ES = Catalan (Catalan)
-Globalization.ci_ca-ES-valencia = Valencian (Spain)
-Globalization.ci_ca-FR = Catalan (France)
-Globalization.ci_ca-IT = Catalan (Italy)
-Globalization.ci_cgg = Chiga
-Globalization.ci_cgg-UG = Chiga (Uganda)
-Globalization.ci_chr = Cherokee
-Globalization.ci_chr-Cher = Cherokee (Cherokee)
-Globalization.ci_chr-Cher-US = Cherokee (Cherokee)
-Globalization.ci_co = Corsican
-Globalization.ci_co-FR = Corsican (France)
-Globalization.ci_cs = Czech
-Globalization.ci_cs-CZ = Czech (Czech Republic)
-Globalization.ci_cy = Welsh
-Globalization.ci_cy-GB = Welsh (United Kingdom)
-Globalization.ci_da = Danish
-Globalization.ci_da-DK = Danish (Denmark)
-Globalization.ci_da-GL = Danish (Greenland)
-Globalization.ci_dav = Taita
-Globalization.ci_dav-KE = Taita (Kenya)
-Globalization.ci_de = German
-Globalization.ci_de-AT = German (Austria)
-Globalization.ci_de-BE = German (Belgium)
-Globalization.ci_de-CH = German (Switzerland)
-Globalization.ci_de-DE = German (Germany)
-Globalization.ci_de-DE_phoneb = German (Germany)
-Globalization.ci_de-LI = German (Liechtenstein)
-Globalization.ci_de-LU = German (Luxembourg)
-Globalization.ci_dje = Zarma
-Globalization.ci_dje-NE = Zarma (Niger)
-Globalization.ci_dsb = Lower Sorbian
-Globalization.ci_dsb-DE = Lower Sorbian (Germany)
-Globalization.ci_dua = Duala
-Globalization.ci_dua-CM = Duala (Cameroon)
-Globalization.ci_dv = Divehi
-Globalization.ci_dv-MV = Divehi (Maldives)
-Globalization.ci_dyo = Jola-Fonyi
-Globalization.ci_dyo-SN = Jola-Fonyi (Senegal)
-Globalization.ci_dz = Dzongkha
-Globalization.ci_dz-BT = Dzongkha (Bhutan)
-Globalization.ci_ebu = Embu
-Globalization.ci_ebu-KE = Embu (Kenya)
-Globalization.ci_ee = Ewe
-Globalization.ci_ee-GH = Ewe (Ghana)
-Globalization.ci_ee-TG = Ewe (Togo)
-Globalization.ci_el = Greek
-Globalization.ci_el-CY = Greek (Cyprus)
-Globalization.ci_el-GR = Greek (Greece)
-Globalization.ci_en = English
-Globalization.ci_en-001 = English (World)
-Globalization.ci_en-029 = English (Caribbean)
-Globalization.ci_en-150 = English (Europe)
-Globalization.ci_en-AG = English (Antigua and Barbuda)
-Globalization.ci_en-AI = English (Anguilla)
-Globalization.ci_en-AS = English (American Samoa)
-Globalization.ci_en-AU = English (Australia)
-Globalization.ci_en-BB = English (Barbados)
-Globalization.ci_en-BE = English (Belgium)
-Globalization.ci_en-BM = English (Bermuda)
-Globalization.ci_en-BS = English (Bahamas)
-Globalization.ci_en-BW = English (Botswana)
-Globalization.ci_en-BZ = English (Belize)
-Globalization.ci_en-CA = English (Canada)
-Globalization.ci_en-CC = English (Cocos [Keeling] Islands)
-Globalization.ci_en-CK = English (Cook Islands)
-Globalization.ci_en-CM = English (Cameroon)
-Globalization.ci_en-CX = English (Christmas Island)
-Globalization.ci_en-DM = English (Dominica)
-Globalization.ci_en-ER = English (Eritrea)
-Globalization.ci_en-FJ = English (Fiji)
-Globalization.ci_en-FK = English (Falkland Islands)
-Globalization.ci_en-FM = English (Micronesia)
-Globalization.ci_en-GB = English (United Kingdom)
-Globalization.ci_en-GD = English (Grenada)
-Globalization.ci_en-GG = English (Guernsey)
-Globalization.ci_en-GH = English (Ghana)
-Globalization.ci_en-GI = English (Gibraltar)
-Globalization.ci_en-GM = English (Gambia)
-Globalization.ci_en-GU = English (Guam)
-Globalization.ci_en-GY = English (Guyana)
-Globalization.ci_en-HK = English (Hong Kong SAR)
-Globalization.ci_en-IE = English (Ireland)
-Globalization.ci_en-IM = English (Isle of Man)
-Globalization.ci_en-IN = English (India)
-Globalization.ci_en-IO = English (British Indian Ocean Territory)
-Globalization.ci_en-JE = English (Jersey)
-Globalization.ci_en-JM = English (Jamaica)
-Globalization.ci_en-KE = English (Kenya)
-Globalization.ci_en-KI = English (Kiribati)
-Globalization.ci_en-KN = English (Saint Kitts and Nevis)
-Globalization.ci_en-KY = English (Cayman Islands)
-Globalization.ci_en-LC = English (Saint Lucia)
-Globalization.ci_en-LR = English (Liberia)
-Globalization.ci_en-LS = English (Lesotho)
-Globalization.ci_en-MG = English (Madagascar)
-Globalization.ci_en-MH = English (Marshall Islands)
-Globalization.ci_en-MO = English (Macao SAR)
-Globalization.ci_en-MP = English (Northern Mariana Islands)
-Globalization.ci_en-MS = English (Montserrat)
-Globalization.ci_en-MT = English (Malta)
-Globalization.ci_en-MU = English (Mauritius)
-Globalization.ci_en-MW = English (Malawi)
-Globalization.ci_en-MY = English (Malaysia)
-Globalization.ci_en-NA = English (Namibia)
-Globalization.ci_en-NF = English (Norfolk Island)
-Globalization.ci_en-NG = English (Nigeria)
-Globalization.ci_en-NR = English (Nauru)
-Globalization.ci_en-NU = English (Niue)
-Globalization.ci_en-NZ = English (New Zealand)
-Globalization.ci_en-PG = English (Papua New Guinea)
-Globalization.ci_en-PH = English (Republic of the Philippines)
-Globalization.ci_en-PK = English (Pakistan)
-Globalization.ci_en-PN = English (Pitcairn Islands)
-Globalization.ci_en-PR = English (Puerto Rico)
-Globalization.ci_en-PW = English (Palau)
-Globalization.ci_en-RW = English (Rwanda)
-Globalization.ci_en-SB = English (Solomon Islands)
-Globalization.ci_en-SC = English (Seychelles)
-Globalization.ci_en-SD = English (Sudan)
-Globalization.ci_en-SG = English (Singapore)
-Globalization.ci_en-SH = English (St Helena, Ascension, Tristan da Cunha)
-Globalization.ci_en-SL = English (Sierra Leone)
-Globalization.ci_en-SS = English (South Sudan)
-Globalization.ci_en-SX = English (Sint Maarten)
-Globalization.ci_en-SZ = English (Swaziland)
-Globalization.ci_en-TC = English (Turks and Caicos Islands)
-Globalization.ci_en-TK = English (Tokelau)
-Globalization.ci_en-TO = English (Tonga)
-Globalization.ci_en-TT = English (Trinidad and Tobago)
-Globalization.ci_en-TV = English (Tuvalu)
-Globalization.ci_en-TZ = English (Tanzania)
-Globalization.ci_en-UG = English (Uganda)
-Globalization.ci_en-UM = English (US Minor Outlying Islands)
-Globalization.ci_en-US = English (United States)
-Globalization.ci_en-VC = English (Saint Vincent and the Grenadines)
-Globalization.ci_en-VG = English (British Virgin Islands)
-Globalization.ci_en-VI = English (US Virgin Islands)
-Globalization.ci_en-VU = English (Vanuatu)
-Globalization.ci_en-WS = English (Samoa)
-Globalization.ci_en-ZA = English (South Africa)
-Globalization.ci_en-ZM = English (Zambia)
-Globalization.ci_en-ZW = English (Zimbabwe)
-Globalization.ci_eo = Esperanto
-Globalization.ci_eo-001 = Esperanto (World)
-Globalization.ci_es = Spanish
-Globalization.ci_es-419 = Spanish (Latin America)
-Globalization.ci_es-AR = Spanish (Argentina)
-Globalization.ci_es-BO = Spanish (Bolivia)
-Globalization.ci_es-CL = Spanish (Chile)
-Globalization.ci_es-CO = Spanish (Colombia)
-Globalization.ci_es-CR = Spanish (Costa Rica)
-Globalization.ci_es-CU = Spanish (Cuba)
-Globalization.ci_es-DO = Spanish (Dominican Republic)
-Globalization.ci_es-EC = Spanish (Ecuador)
-Globalization.ci_es-ES = Spanish (Spain)
-Globalization.ci_es-ES_tradnl = Spanish (Spain)
-Globalization.ci_es-GQ = Spanish (Equatorial Guinea)
-Globalization.ci_es-GT = Spanish (Guatemala)
-Globalization.ci_es-HN = Spanish (Honduras)
-Globalization.ci_es-MX = Spanish (Mexico)
-Globalization.ci_es-NI = Spanish (Nicaragua)
-Globalization.ci_es-PA = Spanish (Panama)
-Globalization.ci_es-PE = Spanish (Peru)
-Globalization.ci_es-PH = Spanish (Philippines)
-Globalization.ci_es-PR = Spanish (Puerto Rico)
-Globalization.ci_es-PY = Spanish (Paraguay)
-Globalization.ci_es-SV = Spanish (El Salvador)
-Globalization.ci_es-US = Spanish (United States)
-Globalization.ci_es-UY = Spanish (Uruguay)
-Globalization.ci_es-VE = Spanish (Bolivarian Republic of Venezuela)
-Globalization.ci_et = Estonian
-Globalization.ci_et-EE = Estonian (Estonia)
-Globalization.ci_eu = Basque
-Globalization.ci_eu-ES = Basque (Basque)
-Globalization.ci_ewo = Ewondo
-Globalization.ci_ewo-CM = Ewondo (Cameroon)
-Globalization.ci_fa = Persian
-Globalization.ci_fa-AF = Persian (Afghanistan)
-Globalization.ci_fa-IR = Persian (Iran)
-Globalization.ci_ff = Fulah
-Globalization.ci_ff-CM = Fulah (Cameroon)
-Globalization.ci_ff-GN = Fulah (Guinea)
-Globalization.ci_ff-Latn = Fulah (Latin)
-Globalization.ci_ff-Latn-SN = Fulah (Latin, Senegal)
-Globalization.ci_ff-MR = Fulah (Mauritania)
-Globalization.ci_fi = Finnish
-Globalization.ci_fi-FI = Finnish (Finland)
-Globalization.ci_fil = Filipino
-Globalization.ci_fil-PH = Filipino (Philippines)
-Globalization.ci_fo = Faroese
-Globalization.ci_fo-FO = Faroese (Faroe Islands)
-Globalization.ci_fr = French
-Globalization.ci_fr-BE = French (Belgium)
-Globalization.ci_fr-BF = French (Burkina Faso)
-Globalization.ci_fr-BI = French (Burundi)
-Globalization.ci_fr-BJ = French (Benin)
-Globalization.ci_fr-BL = French (Saint Barthélemy)
-Globalization.ci_fr-CA = French (Canada)
-Globalization.ci_fr-CD = French (Congo DRC)
-Globalization.ci_fr-CF = French (Central African Republic)
-Globalization.ci_fr-CG = French (Congo)
-Globalization.ci_fr-CH = French (Switzerland)
-Globalization.ci_fr-CI = French (Côte d’Ivoire)
-Globalization.ci_fr-CM = French (Cameroon)
-Globalization.ci_fr-DJ = French (Djibouti)
-Globalization.ci_fr-DZ = French (Algeria)
-Globalization.ci_fr-FR = French (France)
-Globalization.ci_fr-GA = French (Gabon)
-Globalization.ci_fr-GF = French (French Guiana)
-Globalization.ci_fr-GN = French (Guinea)
-Globalization.ci_fr-GP = French (Guadeloupe)
-Globalization.ci_fr-GQ = French (Equatorial Guinea)
-Globalization.ci_fr-HT = French (Haiti)
-Globalization.ci_fr-KM = French (Comoros)
-Globalization.ci_fr-LU = French (Luxembourg)
-Globalization.ci_fr-MA = French (Morocco)
-Globalization.ci_fr-MC = French (Monaco)
-Globalization.ci_fr-MF = French (Saint Martin)
-Globalization.ci_fr-MG = French (Madagascar)
-Globalization.ci_fr-ML = French (Mali)
-Globalization.ci_fr-MQ = French (Martinique)
-Globalization.ci_fr-MR = French (Mauritania)
-Globalization.ci_fr-MU = French (Mauritius)
-Globalization.ci_fr-NC = French (New Caledonia)
-Globalization.ci_fr-NE = French (Niger)
-Globalization.ci_fr-PF = French (French Polynesia)
-Globalization.ci_fr-PM = French (Saint Pierre and Miquelon)
-Globalization.ci_fr-RE = French (Reunion)
-Globalization.ci_fr-RW = French (Rwanda)
-Globalization.ci_fr-SC = French (Seychelles)
-Globalization.ci_fr-SN = French (Senegal)
-Globalization.ci_fr-SY = French (Syria)
-Globalization.ci_fr-TD = French (Chad)
-Globalization.ci_fr-TG = French (Togo)
-Globalization.ci_fr-TN = French (Tunisia)
-Globalization.ci_fr-VU = French (Vanuatu)
-Globalization.ci_fr-WF = French (Wallis and Futuna)
-Globalization.ci_fr-YT = French (Mayotte)
-Globalization.ci_fur = Friulian
-Globalization.ci_fur-IT = Friulian (Italy)
-Globalization.ci_fy = Frisian
-Globalization.ci_fy-NL = Frisian (Netherlands)
-Globalization.ci_ga = Irish
-Globalization.ci_ga-IE = Irish (Ireland)
-Globalization.ci_gd = Scottish Gaelic
-Globalization.ci_gd-GB = Scottish Gaelic (United Kingdom)
-Globalization.ci_gl = Galician
-Globalization.ci_gl-ES = Galician (Galician)
-Globalization.ci_gn = Guarani
-Globalization.ci_gn-PY = Guarani (Paraguay)
-Globalization.ci_gsw = Alsatian
-Globalization.ci_gsw-CH = Alsatian (Switzerland)
-Globalization.ci_gsw-FR = Alsatian (France)
-Globalization.ci_gsw-LI = Alsatian (Liechtenstein)
-Globalization.ci_gu = Gujarati
-Globalization.ci_gu-IN = Gujarati (India)
-Globalization.ci_guz = Gusii
-Globalization.ci_guz-KE = Gusii (Kenya)
-Globalization.ci_gv = Manx
-Globalization.ci_gv-IM = Manx (Isle of Man)
-Globalization.ci_ha = Hausa
-Globalization.ci_ha-Latn = Hausa (Latin)
-Globalization.ci_ha-Latn-GH = Hausa (Latin, Ghana)
-Globalization.ci_ha-Latn-NE = Hausa (Latin, Niger)
-Globalization.ci_ha-Latn-NG = Hausa (Latin, Nigeria)
-Globalization.ci_haw = Hawaiian
-Globalization.ci_haw-US = Hawaiian (United States)
-Globalization.ci_he = Hebrew
-Globalization.ci_he-IL = Hebrew (Israel)
-Globalization.ci_hi = Hindi
-Globalization.ci_hi-IN = Hindi (India)
-Globalization.ci_hr = Croatian
-Globalization.ci_hr-BA = Croatian (Latin, Bosnia and Herzegovina)
-Globalization.ci_hr-HR = Croatian (Croatia)
-Globalization.ci_hsb = Upper Sorbian
-Globalization.ci_hsb-DE = Upper Sorbian (Germany)
-Globalization.ci_hu = Hungarian
-Globalization.ci_hu-HU = Hungarian (Hungary)
-Globalization.ci_hu-HU_technl = Hungarian (Hungary)
-Globalization.ci_hy = Armenian
-Globalization.ci_hy-AM = Armenian (Armenia)
-Globalization.ci_ia = Interlingua
-Globalization.ci_ia-001 = Interlingua (World)
-Globalization.ci_ia-FR = Interlingua (France)
-Globalization.ci_id = Indonesian
-Globalization.ci_id-ID = Indonesian (Indonesia)
-Globalization.ci_ig = Igbo
-Globalization.ci_ig-NG = Igbo (Nigeria)
-Globalization.ci_ii = Yi
-Globalization.ci_ii-CN = Yi (PRC)
-Globalization.ci_is = Icelandic
-Globalization.ci_is-IS = Icelandic (Iceland)
-Globalization.ci_it = Italian
-Globalization.ci_it-CH = Italian (Switzerland)
-Globalization.ci_it-IT = Italian (Italy)
-Globalization.ci_it-SM = Italian (San Marino)
-Globalization.ci_iu = Inuktitut
-Globalization.ci_iu-Cans = Inuktitut (Syllabics)
-Globalization.ci_iu-Cans-CA = Inuktitut (Syllabics, Canada)
-Globalization.ci_iu-Latn = Inuktitut (Latin)
-Globalization.ci_iu-Latn-CA = Inuktitut (Latin, Canada)
-Globalization.ci_ja = Japanese
-Globalization.ci_ja-JP = Japanese (Japan)
-Globalization.ci_ja-JP_radstr = Japanese (Japan)
-Globalization.ci_jgo = Ngomba
-Globalization.ci_jgo-CM = Ngomba (Cameroon)
-Globalization.ci_jmc = Machame
-Globalization.ci_jmc-TZ = Machame (Tanzania)
-Globalization.ci_jv = Javanese
-Globalization.ci_jv-Latn = Javanese
-Globalization.ci_jv-Latn-ID = Javanese (Indonesia)
-Globalization.ci_ka = Georgian
-Globalization.ci_ka-GE = Georgian (Georgia)
-Globalization.ci_ka-GE_modern = Georgian (Georgia)
-Globalization.ci_kab = Kabyle
-Globalization.ci_kab-DZ = Kabyle (Algeria)
-Globalization.ci_kam = Kamba
-Globalization.ci_kam-KE = Kamba (Kenya)
-Globalization.ci_kde = Makonde
-Globalization.ci_kde-TZ = Makonde (Tanzania)
-Globalization.ci_kea = Kabuverdianu
-Globalization.ci_kea-CV = Kabuverdianu (Cabo Verde)
-Globalization.ci_khq = Koyra Chiini
-Globalization.ci_khq-ML = Koyra Chiini (Mali)
-Globalization.ci_ki = Kikuyu
-Globalization.ci_ki-KE = Kikuyu (Kenya)
-Globalization.ci_kk = Kazakh
-Globalization.ci_kk-KZ = Kazakh (Kazakhstan)
-Globalization.ci_kkj = Kako
-Globalization.ci_kkj-CM = Kako (Cameroon)
-Globalization.ci_kl = Greenlandic
-Globalization.ci_kl-GL = Greenlandic (Greenland)
-Globalization.ci_kln = Kalenjin
-Globalization.ci_kln-KE = Kalenjin (Kenya)
-Globalization.ci_km = Khmer
-Globalization.ci_km-KH = Khmer (Cambodia)
-Globalization.ci_kn = Kannada
-Globalization.ci_kn-IN = Kannada (India)
-Globalization.ci_ko = Korean
-Globalization.ci_ko-KR = Korean (Korea)
-Globalization.ci_kok = Konkani
-Globalization.ci_kok-IN = Konkani (India)
-Globalization.ci_ks = Kashmiri
-Globalization.ci_ks-Arab = Kashmiri (Perso-Arabic)
-Globalization.ci_ks-Arab-IN = Kashmiri (Perso-Arabic)
-Globalization.ci_ksb = Shambala
-Globalization.ci_ksb-TZ = Shambala (Tanzania)
-Globalization.ci_ksf = Bafia
-Globalization.ci_ksf-CM = Bafia (Cameroon)
-Globalization.ci_ksh = Colognian
-Globalization.ci_ksh-DE = Ripuarian (Germany)
-Globalization.ci_ku = Central Kurdish
-Globalization.ci_ku-Arab = Central Kurdish (Arabic)
-Globalization.ci_ku-Arab-IQ = Central Kurdish (Iraq)
-Globalization.ci_kw = Cornish
-Globalization.ci_kw-GB = Cornish (United Kingdom)
-Globalization.ci_ky = Kyrgyz
-Globalization.ci_ky-KG = Kyrgyz (Kyrgyzstan)
-Globalization.ci_lag = Langi
-Globalization.ci_lag-TZ = Langi (Tanzania)
-Globalization.ci_lb = Luxembourgish
-Globalization.ci_lb-LU = Luxembourgish (Luxembourg)
-Globalization.ci_lg = Ganda
-Globalization.ci_lg-UG = Ganda (Uganda)
-Globalization.ci_lkt = Lakota
-Globalization.ci_lkt-US = Lakota (United States)
-Globalization.ci_ln = Lingala
-Globalization.ci_ln-AO = Lingala (Angola)
-Globalization.ci_ln-CD = Lingala (Congo DRC)
-Globalization.ci_ln-CF = Lingala (Central African Republic)
-Globalization.ci_ln-CG = Lingala (Congo)
-Globalization.ci_lo = Lao
-Globalization.ci_lo-LA = Lao (Lao P.D.R.)
-Globalization.ci_lt = Lithuanian
-Globalization.ci_lt-LT = Lithuanian (Lithuania)
-Globalization.ci_lu = Luba-Katanga
-Globalization.ci_lu-CD = Luba-Katanga (Congo DRC)
-Globalization.ci_luo = Luo
-Globalization.ci_luo-KE = Luo (Kenya)
-Globalization.ci_luy = Luyia
-Globalization.ci_luy-KE = Luyia (Kenya)
-Globalization.ci_lv = Latvian
-Globalization.ci_lv-LV = Latvian (Latvia)
-Globalization.ci_mas = Masai
-Globalization.ci_mas-KE = Masai (Kenya)
-Globalization.ci_mas-TZ = Masai (Tanzania)
-Globalization.ci_mer = Meru
-Globalization.ci_mer-KE = Meru (Kenya)
-Globalization.ci_mfe = Morisyen
-Globalization.ci_mfe-MU = Morisyen (Mauritius)
-Globalization.ci_mg = Malagasy
-Globalization.ci_mg-MG = Malagasy (Madagascar)
-Globalization.ci_mgh = Makhuwa-Meetto
-Globalization.ci_mgh-MZ = Makhuwa-Meetto (Mozambique)
-Globalization.ci_mgo = Meta'
-Globalization.ci_mgo-CM = Meta' (Cameroon)
-Globalization.ci_mi = Maori
-Globalization.ci_mi-NZ = Maori (New Zealand)
-Globalization.ci_mk = Macedonian (FYROM)
-Globalization.ci_mk-MK = Macedonian (Former Yugoslav Republic of Macedonia)
-Globalization.ci_ml = Malayalam
-Globalization.ci_ml-IN = Malayalam (India)
-Globalization.ci_mn = Mongolian
-Globalization.ci_mn-Cyrl = Mongolian (Cyrillic)
-Globalization.ci_mn-MN = Mongolian (Cyrillic, Mongolia)
-Globalization.ci_mn-Mong = Mongolian (Traditional Mongolian)
-Globalization.ci_mn-Mong-CN = Mongolian (Traditional Mongolian, PRC)
-Globalization.ci_mn-Mong-MN = Mongolian (Traditional Mongolian, Mongolia)
-Globalization.ci_moh = Mohawk
-Globalization.ci_moh-CA = Mohawk (Mohawk)
-Globalization.ci_mr = Marathi
-Globalization.ci_mr-IN = Marathi (India)
-Globalization.ci_ms = Malay
-Globalization.ci_ms-BN = Malay (Brunei Darussalam)
-Globalization.ci_ms-MY = Malay (Malaysia)
-Globalization.ci_ms-SG = Malay (Latin, Singapore)
-Globalization.ci_mt = Maltese
-Globalization.ci_mt-MT = Maltese (Malta)
-Globalization.ci_mua = Mundang
-Globalization.ci_mua-CM = Mundang (Cameroon)
-Globalization.ci_my = Burmese
-Globalization.ci_my-MM = Burmese (Myanmar)
-Globalization.ci_naq = Nama
-Globalization.ci_naq-NA = Nama (Namibia)
-Globalization.ci_nb = Norwegian (Bokmål)
-Globalization.ci_nb-NO = Norwegian, Bokmål (Norway)
-Globalization.ci_nb-SJ = Norwegian, Bokmål (Svalbard and Jan Mayen)
-Globalization.ci_nd = North Ndebele
-Globalization.ci_nd-ZW = North Ndebele (Zimbabwe)
-Globalization.ci_ne = Nepali
-Globalization.ci_ne-IN = Nepali (India)
-Globalization.ci_ne-NP = Nepali (Nepal)
-Globalization.ci_nl = Dutch
-Globalization.ci_nl-AW = Dutch (Aruba)
-Globalization.ci_nl-BE = Dutch (Belgium)
-Globalization.ci_nl-BQ = Dutch (Bonaire, Sint Eustatius and Saba)
-Globalization.ci_nl-CW = Dutch (Curaçao)
-Globalization.ci_nl-NL = Dutch (Netherlands)
-Globalization.ci_nl-SR = Dutch (Suriname)
-Globalization.ci_nl-SX = Dutch (Sint Maarten)
-Globalization.ci_nmg = Kwasio
-Globalization.ci_nmg-CM = Kwasio (Cameroon)
-Globalization.ci_nn = Norwegian (Nynorsk)
-Globalization.ci_nn-NO = Norwegian, Nynorsk (Norway)
-Globalization.ci_nnh = Ngiemboon
-Globalization.ci_nnh-CM = Ngiemboon (Cameroon)
-Globalization.ci_no = Norwegian
-Globalization.ci_nqo = N'ko
-Globalization.ci_nqo-GN = N'ko (Guinea)
-Globalization.ci_nr = South Ndebele
-Globalization.ci_nr-ZA = South Ndebele (South Africa)
-Globalization.ci_nso = Sesotho sa Leboa
-Globalization.ci_nso-ZA = Sesotho sa Leboa (South Africa)
-Globalization.ci_nus = Nuer
-Globalization.ci_nus-SD = Nuer (Sudan)
-Globalization.ci_nyn = Nyankole
-Globalization.ci_nyn-UG = Nyankole (Uganda)
-Globalization.ci_oc = Occitan
-Globalization.ci_oc-FR = Occitan (France)
-Globalization.ci_om = Oromo
-Globalization.ci_om-ET = Oromo (Ethiopia)
-Globalization.ci_om-KE = Oromo (Kenya)
-Globalization.ci_or = Odia
-Globalization.ci_or-IN = Odia (India)
-Globalization.ci_os = Ossetic
-Globalization.ci_os-GE = Ossetian (Cyrillic, Georgia)
-Globalization.ci_os-RU = Ossetian (Cyrillic, Russia)
-Globalization.ci_pa = Punjabi
-Globalization.ci_pa-Arab = Punjabi (Arabic)
-Globalization.ci_pa-Arab-PK = Punjabi (Islamic Republic of Pakistan)
-Globalization.ci_pa-IN = Punjabi (India)
-Globalization.ci_pl = Polish
-Globalization.ci_pl-PL = Polish (Poland)
-Globalization.ci_prs = Dari
-Globalization.ci_prs-AF = Dari (Afghanistan)
-Globalization.ci_ps = Pashto
-Globalization.ci_ps-AF = Pashto (Afghanistan)
-Globalization.ci_pt = Portuguese
-Globalization.ci_pt-AO = Portuguese (Angola)
-Globalization.ci_pt-BR = Portuguese (Brazil)
-Globalization.ci_pt-CV = Portuguese (Cabo Verde)
-Globalization.ci_pt-GW = Portuguese (Guinea-Bissau)
-Globalization.ci_pt-MO = Portuguese (Macao SAR)
-Globalization.ci_pt-MZ = Portuguese (Mozambique)
-Globalization.ci_pt-PT = Portuguese (Portugal)
-Globalization.ci_pt-ST = Portuguese (São Tomé and PrÃncipe)
-Globalization.ci_pt-TL = Portuguese (Timor-Leste)
-Globalization.ci_qps-ploc = Pseudo Language (Pseudo)
-Globalization.ci_qps-ploca = Pseudo Language (Pseudo Asia)
-Globalization.ci_qps-plocm = Pseudo Language (Pseudo Mirrored)
-Globalization.ci_qu = Quechua
-Globalization.ci_qu-BO = Quechua (Bolivia)
-Globalization.ci_qu-EC = Quechua (Ecuador)
-Globalization.ci_qu-PE = Quechua (Peru)
-Globalization.ci_quc = K'iche'
-Globalization.ci_quc-Latn = K'iche'
-Globalization.ci_quc-Latn-GT = K'iche' (Guatemala)
-Globalization.ci_qut = K'iche
-Globalization.ci_qut-GT = K'iche (Guatemala)
-Globalization.ci_quz = Quechua
-Globalization.ci_quz-BO = Quechua (Bolivia)
-Globalization.ci_quz-EC = Quechua (Ecuador)
-Globalization.ci_quz-PE = Quechua (Peru)
-Globalization.ci_rm = Romansh
-Globalization.ci_rm-CH = Romansh (Switzerland)
-Globalization.ci_rn = Rundi
-Globalization.ci_rn-BI = Rundi (Burundi)
-Globalization.ci_ro = Romanian
-Globalization.ci_ro-MD = Romanian (Moldova)
-Globalization.ci_ro-RO = Romanian (Romania)
-Globalization.ci_rof = Rombo
-Globalization.ci_rof-TZ = Rombo (Tanzania)
-Globalization.ci_ru = Russian
-Globalization.ci_ru-BY = Russian (Belarus)
-Globalization.ci_ru-KG = Russian (Kyrgyzstan)
-Globalization.ci_ru-KZ = Russian (Kazakhstan)
-Globalization.ci_ru-MD = Russian (Moldova)
-Globalization.ci_ru-RU = Russian (Russia)
-Globalization.ci_ru-UA = Russian (Ukraine)
-Globalization.ci_rw = Kinyarwanda
-Globalization.ci_rw-RW = Kinyarwanda (Rwanda)
-Globalization.ci_rwk = Rwa
-Globalization.ci_rwk-TZ = Rwa (Tanzania)
-Globalization.ci_sa = Sanskrit
-Globalization.ci_sa-IN = Sanskrit (India)
-Globalization.ci_sah = Sakha
-Globalization.ci_sah-RU = Sakha (Russia)
-Globalization.ci_saq = Samburu
-Globalization.ci_saq-KE = Samburu (Kenya)
-Globalization.ci_sbp = Sangu
-Globalization.ci_sbp-TZ = Sangu (Tanzania)
-Globalization.ci_sd = Sindhi
-Globalization.ci_sd-Arab = Sindhi (Arabic)
-Globalization.ci_sd-Arab-PK = Sindhi (Islamic Republic of Pakistan)
-Globalization.ci_se = Sami (Northern)
-Globalization.ci_se-FI = Sami, Northern (Finland)
-Globalization.ci_se-NO = Sami, Northern (Norway)
-Globalization.ci_se-SE = Sami, Northern (Sweden)
-Globalization.ci_seh = Sena
-Globalization.ci_seh-MZ = Sena (Mozambique)
-Globalization.ci_ses = Koyraboro Senni
-Globalization.ci_ses-ML = Koyraboro Senni (Mali)
-Globalization.ci_sg = Sango
-Globalization.ci_sg-CF = Sango (Central African Republic)
-Globalization.ci_shi = Tachelhit
-Globalization.ci_shi-Latn = Tachelhit (Latin)
-Globalization.ci_shi-Latn-MA = Tachelhit (Latin, Morocco)
-Globalization.ci_shi-Tfng = Tachelhit (Tifinagh)
-Globalization.ci_shi-Tfng-MA = Tachelhit (Tifinagh, Morocco)
-Globalization.ci_si = Sinhala
-Globalization.ci_si-LK = Sinhala (Sri Lanka)
-Globalization.ci_sk = Slovak
-Globalization.ci_sk-SK = Slovak (Slovakia)
-Globalization.ci_sl = Slovenian
-Globalization.ci_sl-SI = Slovenian (Slovenia)
-Globalization.ci_sma = Sami (Southern)
-Globalization.ci_sma-NO = Sami, Southern (Norway)
-Globalization.ci_sma-SE = Sami, Southern (Sweden)
-Globalization.ci_smj = Sami (Lule)
-Globalization.ci_smj-NO = Sami, Lule (Norway)
-Globalization.ci_smj-SE = Sami, Lule (Sweden)
-Globalization.ci_smn = Sami (Inari)
-Globalization.ci_smn-FI = Sami, Inari (Finland)
-Globalization.ci_sms = Sami (Skolt)
-Globalization.ci_sms-FI = Sami, Skolt (Finland)
-Globalization.ci_sn = Shona
-Globalization.ci_sn-Latn = Shona (Latin)
-Globalization.ci_sn-Latn-ZW = Shona (Latin, Zimbabwe)
-Globalization.ci_so = Somali
-Globalization.ci_so-DJ = Somali (Djibouti)
-Globalization.ci_so-ET = Somali (Ethiopia)
-Globalization.ci_so-KE = Somali (Kenya)
-Globalization.ci_so-SO = Somali (Somalia)
-Globalization.ci_sq = Albanian
-Globalization.ci_sq-AL = Albanian (Albania)
-Globalization.ci_sq-MK = Albanian (Macedonia, FYRO)
-Globalization.ci_sr = Serbian
-Globalization.ci_sr-Cyrl = Serbian (Cyrillic)
-Globalization.ci_sr-Cyrl-BA = Serbian (Cyrillic, Bosnia and Herzegovina)
-Globalization.ci_sr-Cyrl-CS = Serbian (Cyrillic, Serbia and Montenegro (Former))
-Globalization.ci_sr-Cyrl-ME = Serbian (Cyrillic, Montenegro)
-Globalization.ci_sr-Cyrl-RS = Serbian (Cyrillic, Serbia)
-Globalization.ci_sr-Latn = Serbian (Latin)
-Globalization.ci_sr-Latn-BA = Serbian (Latin, Bosnia and Herzegovina)
-Globalization.ci_sr-Latn-CS = Serbian (Latin, Serbia and Montenegro (Former))
-Globalization.ci_sr-Latn-ME = Serbian (Latin, Montenegro)
-Globalization.ci_sr-Latn-RS = Serbian (Latin, Serbia)
-Globalization.ci_ss = Swati
-Globalization.ci_ss-SZ = Swati (Swaziland)
-Globalization.ci_ss-ZA = Swati (South Africa)
-Globalization.ci_ssy = Saho
-Globalization.ci_ssy-ER = Saho (Eritrea)
-Globalization.ci_st = Southern Sotho
-Globalization.ci_st-LS = Sesotho (Lesotho)
-Globalization.ci_st-ZA = Southern Sotho (South Africa)
-Globalization.ci_sv = Swedish
-Globalization.ci_sv-AX = Swedish (Ã…land Islands)
-Globalization.ci_sv-FI = Swedish (Finland)
-Globalization.ci_sv-SE = Swedish (Sweden)
-Globalization.ci_sw = Kiswahili
-Globalization.ci_sw-KE = Kiswahili (Kenya)
-Globalization.ci_sw-TZ = Kiswahili (Tanzania)
-Globalization.ci_sw-UG = Kiswahili (Uganda)
-Globalization.ci_swc = Congo Swahili
-Globalization.ci_swc-CD = Congo Swahili (Congo DRC)
-Globalization.ci_syr = Syriac
-Globalization.ci_syr-SY = Syriac (Syria)
-Globalization.ci_ta = Tamil
-Globalization.ci_ta-IN = Tamil (India)
-Globalization.ci_ta-LK = Tamil (Sri Lanka)
-Globalization.ci_ta-MY = Tamil (Malaysia)
-Globalization.ci_ta-SG = Tamil (Singapore)
-Globalization.ci_te = Telugu
-Globalization.ci_te-IN = Telugu (India)
-Globalization.ci_teo = Teso
-Globalization.ci_teo-KE = Teso (Kenya)
-Globalization.ci_teo-UG = Teso (Uganda)
-Globalization.ci_tg = Tajik
-Globalization.ci_tg-Cyrl = Tajik (Cyrillic)
-Globalization.ci_tg-Cyrl-TJ = Tajik (Cyrillic, Tajikistan)
-Globalization.ci_th = Thai
-Globalization.ci_th-TH = Thai (Thailand)
-Globalization.ci_ti = Tigrinya
-Globalization.ci_ti-ER = Tigrinya (Eritrea)
-Globalization.ci_ti-ET = Tigrinya (Ethiopia)
-Globalization.ci_tig = Tigre
-Globalization.ci_tig-ER = Tigre (Eritrea)
-Globalization.ci_tk = Turkmen
-Globalization.ci_tk-TM = Turkmen (Turkmenistan)
-Globalization.ci_tn = Setswana
-Globalization.ci_tn-BW = Setswana (Botswana)
-Globalization.ci_tn-ZA = Setswana (South Africa)
-Globalization.ci_to = Tongan
-Globalization.ci_to-TO = Tongan (Tonga)
-Globalization.ci_tr = Turkish
-Globalization.ci_tr-CY = Turkish (Cyprus)
-Globalization.ci_tr-TR = Turkish (Turkey)
-Globalization.ci_ts = Tsonga
-Globalization.ci_ts-ZA = Tsonga (South Africa)
-Globalization.ci_tt = Tatar
-Globalization.ci_tt-RU = Tatar (Russia)
-Globalization.ci_twq = Tasawaq
-Globalization.ci_twq-NE = Tasawaq (Niger)
-Globalization.ci_tzm = Tamazight
-Globalization.ci_tzm-Latn = Tamazight (Latin)
-Globalization.ci_tzm-Latn-DZ = Tamazight (Latin, Algeria)
-Globalization.ci_tzm-Latn-MA = Central Atlas Tamazight (Latin, Morocco)
-Globalization.ci_tzm-Tfng = Tamazight (Tifinagh)
-Globalization.ci_tzm-Tfng-MA = Central Atlas Tamazight (Tifinagh, Morocco)
-Globalization.ci_ug = Uyghur
-Globalization.ci_ug-CN = Uyghur (PRC)
-Globalization.ci_uk = Ukrainian
-Globalization.ci_uk-UA = Ukrainian (Ukraine)
-Globalization.ci_ur = Urdu
-Globalization.ci_ur-IN = Urdu (India)
-Globalization.ci_ur-PK = Urdu (Islamic Republic of Pakistan)
-Globalization.ci_uz = Uzbek
-Globalization.ci_uz-Arab = Uzbek (Perso-Arabic)
-Globalization.ci_uz-Arab-AF = Uzbek (Perso-Arabic, Afghanistan)
-Globalization.ci_uz-Cyrl = Uzbek (Cyrillic)
-Globalization.ci_uz-Cyrl-UZ = Uzbek (Cyrillic, Uzbekistan)
-Globalization.ci_uz-Latn = Uzbek (Latin)
-Globalization.ci_uz-Latn-UZ = Uzbek (Latin, Uzbekistan)
-Globalization.ci_vai = Vai
-Globalization.ci_vai-Latn = Vai (Latin)
-Globalization.ci_vai-Latn-LR = Vai (Latin, Liberia)
-Globalization.ci_vai-Vaii = Vai (Vai)
-Globalization.ci_vai-Vaii-LR = Vai (Vai, Liberia)
-Globalization.ci_ve = Venda
-Globalization.ci_ve-ZA = Venda (South Africa)
-Globalization.ci_vi = Vietnamese
-Globalization.ci_vi-VN = Vietnamese (Vietnam)
-Globalization.ci_vo = Volapük
-Globalization.ci_vo-001 = Volapük (World)
-Globalization.ci_vun = Vunjo
-Globalization.ci_vun-TZ = Vunjo (Tanzania)
-Globalization.ci_wae = Walser
-Globalization.ci_wae-CH = Walser (Switzerland)
-Globalization.ci_wal = Wolaytta
-Globalization.ci_wal-ET = Wolaytta (Ethiopia)
-Globalization.ci_wo = Wolof
-Globalization.ci_wo-SN = Wolof (Senegal)
-Globalization.ci_x-IV = Invariant Language (Invariant Country)
-Globalization.ci_x-IV_mathan = Invariant Language (Invariant Country)
-Globalization.ci_xh = isiXhosa
-Globalization.ci_xh-ZA = isiXhosa (South Africa)
-Globalization.ci_xog = Soga
-Globalization.ci_xog-UG = Soga (Uganda)
-Globalization.ci_yav = Yangben
-Globalization.ci_yav-CM = Yangben (Cameroon)
-Globalization.ci_yi = Yiddish
-Globalization.ci_yi-001 = Yiddish (World)
-Globalization.ci_yo = Yoruba
-Globalization.ci_yo-BJ = Yoruba (Benin)
-Globalization.ci_yo-NG = Yoruba (Nigeria)
-Globalization.ci_zgh = Standard Moroccan Tamazight
-Globalization.ci_zgh-Tfng = Standard Moroccan Tamazight (Tifinagh)
-Globalization.ci_zgh-Tfng-MA = Standard Moroccan Tamazight (Tifinagh, Morocco)
-Globalization.ci_zh = Chinese
-Globalization.ci_zh-CHS = Chinese (Simplified) Legacy
-Globalization.ci_zh-CHT = Chinese (Traditional) Legacy
-Globalization.ci_zh-CN = Chinese (Simplified, PRC)
-Globalization.ci_zh-CN_stroke = Chinese (Simplified, PRC)
-Globalization.ci_zh-Hans = Chinese (Simplified)
-Globalization.ci_zh-Hant = Chinese (Traditional)
-Globalization.ci_zh-HK = Chinese (Traditional, Hong Kong S.A.R.)
-Globalization.ci_zh-HK_radstr = Chinese (Traditional, Hong Kong S.A.R.)
-Globalization.ci_zh-MO = Chinese (Traditional, Macao S.A.R.)
-Globalization.ci_zh-MO_radstr = Chinese (Traditional, Macao S.A.R.)
-Globalization.ci_zh-MO_stroke = Chinese (Traditional, Macao S.A.R.)
-Globalization.ci_zh-SG = Chinese (Simplified, Singapore)
-Globalization.ci_zh-SG_stroke = Chinese (Simplified, Singapore)
-Globalization.ci_zh-TW = Chinese (Traditional, Taiwan)
-Globalization.ci_zh-TW_pronun = Chinese (Traditional, Taiwan)
-Globalization.ci_zh-TW_radstr = Chinese (Traditional, Taiwan)
-Globalization.ci_zu = isiZulu
-Globalization.ci_zu-ZA = isiZulu (South Africa)
-;------------------
-;
-;Total items: 129
-;
-Globalization.ri_029 = Caribbean
-Globalization.ri_AE = U.A.E.
-Globalization.ri_AF = Afghanistan
-Globalization.ri_AL = Albania
-Globalization.ri_AM = Armenia
-Globalization.ri_AR = Argentina
-Globalization.ri_AT = Austria
-Globalization.ri_AU = Australia
-Globalization.ri_AZ = Azerbaijan
-Globalization.ri_BA = Bosnia and Herzegovina
-Globalization.ri_BD = Bangladesh
-Globalization.ri_BE = Belgium
-Globalization.ri_BG = Bulgaria
-Globalization.ri_BH = Bahrain
-Globalization.ri_BN = Brunei Darussalam
-Globalization.ri_BO = Bolivia
-Globalization.ri_BR = Brazil
-Globalization.ri_BY = Belarus
-Globalization.ri_BZ = Belize
-Globalization.ri_CA = Canada
-Globalization.ri_CH = Switzerland
-Globalization.ri_CL = Chile
-Globalization.ri_CN = People's Republic of China
-Globalization.ri_CO = Colombia
-Globalization.ri_CR = Costa Rica
-Globalization.ri_CS = Serbia and Montenegro (Former)
-Globalization.ri_CZ = Czech Republic
-Globalization.ri_DE = Germany
-Globalization.ri_DK = Denmark
-Globalization.ri_DO = Dominican Republic
-Globalization.ri_DZ = Algeria
-Globalization.ri_EC = Ecuador
-Globalization.ri_EE = Estonia
-Globalization.ri_EG = Egypt
-Globalization.ri_ER = Eritrea
-Globalization.ri_ES = Spain
-Globalization.ri_ET = Ethiopia
-Globalization.ri_FI = Finland
-Globalization.ri_FO = Faroe Islands
-Globalization.ri_FR = France
-Globalization.ri_GB = United Kingdom
-Globalization.ri_GE = Georgia
-Globalization.ri_GL = Greenland
-Globalization.ri_GR = Greece
-Globalization.ri_GT = Guatemala
-Globalization.ri_HK = Hong Kong S.A.R.
-Globalization.ri_HN = Honduras
-Globalization.ri_HR = Croatia
-Globalization.ri_HU = Hungary
-Globalization.ri_ID = Indonesia
-Globalization.ri_IE = Ireland
-Globalization.ri_IL = Israel
-Globalization.ri_IN = India
-Globalization.ri_IQ = Iraq
-Globalization.ri_IR = Iran
-Globalization.ri_IS = Iceland
-Globalization.ri_IT = Italy
-Globalization.ri_IV = Invariant Country
-Globalization.ri_JM = Jamaica
-Globalization.ri_JO = Jordan
-Globalization.ri_JP = Japan
-Globalization.ri_KE = Kenya
-Globalization.ri_KG = Kyrgyzstan
-Globalization.ri_KH = Cambodia
-Globalization.ri_KR = Korea
-Globalization.ri_KW = Kuwait
-Globalization.ri_KZ = Kazakhstan
-Globalization.ri_LA = Lao P.D.R.
-Globalization.ri_LB = Lebanon
-Globalization.ri_LI = Liechtenstein
-Globalization.ri_LK = Sri Lanka
-Globalization.ri_LT = Lithuania
-Globalization.ri_LU = Luxembourg
-Globalization.ri_LV = Latvia
-Globalization.ri_LY = Libya
-Globalization.ri_MA = Morocco
-Globalization.ri_MC = Principality of Monaco
-Globalization.ri_ME = Montenegro
-Globalization.ri_MK = Macedonia (FYROM)
-Globalization.ri_MN = Mongolia
-Globalization.ri_MO = Macao S.A.R.
-Globalization.ri_MT = Malta
-Globalization.ri_MV = Maldives
-Globalization.ri_MX = Mexico
-Globalization.ri_MY = Malaysia
-Globalization.ri_NG = Nigeria
-Globalization.ri_NI = Nicaragua
-Globalization.ri_NL = Netherlands
-Globalization.ri_NO = Norway
-Globalization.ri_NP = Nepal
-Globalization.ri_NZ = New Zealand
-Globalization.ri_OM = Oman
-Globalization.ri_PA = Panama
-Globalization.ri_PE = Peru
-Globalization.ri_PH = Philippines
-Globalization.ri_PK = Islamic Republic of Pakistan
-Globalization.ri_PL = Poland
-Globalization.ri_PR = Puerto Rico
-Globalization.ri_PT = Portugal
-Globalization.ri_PY = Paraguay
-Globalization.ri_QA = Qatar
-Globalization.ri_RO = Romania
-Globalization.ri_RS = Serbia
-Globalization.ri_RU = Russia
-Globalization.ri_RW = Rwanda
-Globalization.ri_SA = Saudi Arabia
-Globalization.ri_SE = Sweden
-Globalization.ri_SG = Singapore
-Globalization.ri_SI = Slovenia
-Globalization.ri_SK = Slovakia
-Globalization.ri_SN = Senegal
-Globalization.ri_SV = El Salvador
-Globalization.ri_SY = Syria
-Globalization.ri_TH = Thailand
-Globalization.ri_TJ = Tajikistan
-Globalization.ri_TM = Turkmenistan
-Globalization.ri_TN = Tunisia
-Globalization.ri_TR = Turkey
-Globalization.ri_TT = Trinidad and Tobago
-Globalization.ri_TW = Taiwan
-Globalization.ri_UA = Ukraine
-Globalization.ri_US = United States
-Globalization.ri_UY = Uruguay
-Globalization.ri_UZ = Uzbekistan
-Globalization.ri_VE = Bolivarian Republic of Venezuela
-Globalization.ri_VN = Vietnam
-Globalization.ri_YE = Yemen
-Globalization.ri_ZA = South Africa
-Globalization.ri_ZW = Zimbabwe
-#endif //!FEATURE_CORECLR
-
;------------------
; Encoding names:
;
if (!TryParseFrameworkName(targetFrameworkMoniker, out identifier, out version, out profile))
{
-#if FEATURE_CORECLR
// If we can't parse the TFM or we don't have a TFM, default to latest behavior for all
// switches (ie. all of them false).
// If we want to use the latest behavior it is enough to set the value of the switch to string.Empty.
// identifier we are simply saying -- don't turn on any switches, and we are going to get the latest
// behavior for all the switches
identifier = string.Empty;
-#else
- identifier = ".NETFramework";
- version = 40000;
- profile = string.Empty;
-#endif
}
}
// Neither Exception nor ApplicationException are the "right" exceptions here.
// Desktop throws ApplicationException for backwards compatibility.
// On Silverlight we don't have ApplicationException, so fall back to Exception.
-#if FEATURE_CORECLR
throw new Exception(message, inner);
-#else
- throw new ApplicationException(message, inner);
-#endif
}
return rootNode;
}
// Neither Exception nor ApplicationException are the "right" exceptions here.
// Desktop throws ApplicationException for backwards compatibility.
// On Silverlight we don't have ApplicationException, so fall back to Exception.
-#if FEATURE_CORECLR
throw new Exception(message);
-#else
- throw new ApplicationException(message);
-#endif
}
}
}
// of the ArrayList is automatically increased as required by reallocating the
// internal array.
//
-#if FEATURE_CORECLR
[FriendAccessAllowed]
-#endif
[DebuggerTypeProxy(typeof(System.Collections.ArrayList.ArrayListDebugView))]
[DebuggerDisplay("Count = {Count}")]
[Serializable]
// Returns a read-only IList wrapper for the given IList.
//
-#if FEATURE_CORECLR
[FriendAccessAllowed]
-#endif
public static IList ReadOnly(IList list) {
if (list==null)
throw new ArgumentNullException(nameof(list));
if (capacity > 0) Initialize(capacity);
this.comparer = comparer ?? EqualityComparer<TKey>.Default;
-#if FEATURE_RANDOMIZED_STRING_HASHING && FEATURE_CORECLR
+#if FEATURE_RANDOMIZED_STRING_HASHING
if (HashHelpers.s_UseRandomizedStringHashing && comparer == EqualityComparer<string>.Default)
{
this.comparer = (IEqualityComparer<TKey>) NonRandomizedStringEqualityComparer.Default;
}
-#endif // FEATURE_RANDOMIZED_STRING_HASHING && FEATURE_CORECLR
+#endif // FEATURE_RANDOMIZED_STRING_HASHING
}
public Dictionary(IDictionary<TKey,TValue> dictionary): this(dictionary, null) {}
for (int i = buckets[targetBucket]; i >= 0; i = entries[i].next) {
if (entries[i].hashCode == hashCode && comparer.Equals(entries[i].key, key)) {
if (add) {
-#if FEATURE_CORECLR
ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException(key);
-#else
- ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_AddingDuplicate);
-#endif
}
entries[i].value = value;
version++;
version++;
#if FEATURE_RANDOMIZED_STRING_HASHING
-
-#if FEATURE_CORECLR
// In case we hit the collision threshold we'll need to switch to the comparer which is using randomized string hashing
// in this case will be EqualityComparer<string>.Default.
// Note, randomized string hashing is turned on by default on coreclr so EqualityComparer<string>.Default will
comparer = (IEqualityComparer<TKey>) EqualityComparer<string>.Default;
Resize(entries.Length, true);
}
-#else
- if(collisionCount > HashHelpers.HashCollisionThreshold && HashHelpers.IsWellKnownEqualityComparer(comparer))
- {
- comparer = (IEqualityComparer<TKey>) HashHelpers.GetRandomizedEqualityComparer(comparer);
- Resize(entries.Length, true);
- }
-#endif // FEATURE_CORECLR
-
#endif
}
GetType().GetHashCode();
}
-#if FEATURE_CORECLR
// NonRandomizedStringEqualityComparer is the comparer used by default with the Dictionary<string,...>
// As the randomized string hashing is turned on by default on coreclr, we need to keep the performance not affected
// as much as possible in the main stream scenarios like Dictionary<string,>
return obj.GetLegacyNonRandomizedHashCode();
}
}
-#endif // FEATURE_CORECLR
// Performance of IndexOf on byte array is very important for some scenarios.
// We will call the C runtime function memchr, which is optimized.
//
[DebuggerTypeProxy(typeof(System.Collections.SortedList.SortedListDebugView))]
[DebuggerDisplay("Count = {Count}")]
-[System.Runtime.InteropServices.ComVisible(true)]
-#if FEATURE_CORECLR
+ [System.Runtime.InteropServices.ComVisible(true)]
[Obsolete("Non-generic collections have been deprecated. Please use collections in System.Collections.Generic.")]
-#endif
[Serializable]
public class SortedList : IDictionary, ICloneable
{
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
-#if FEATURE_CORECLR
[Obsolete("System.CurrentSystemTimeZone has been deprecated. Please investigate the use of System.TimeZoneInfo.Local instead.")]
-#endif
[Serializable]
internal class CurrentSystemTimeZone : TimeZone
{
return millis * TicksPerMillisecond;
}
-#if !FEATURE_CORECLR
- [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
- [SuppressUnmanagedCodeSecurity]
- [return: MarshalAs(UnmanagedType.Bool)]
- internal static extern bool LegacyParseMode();
-
- [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
- [SuppressUnmanagedCodeSecurity]
- [return: MarshalAs(UnmanagedType.Bool)]
- internal static extern bool EnableAmPmParseAdjustment();
-#endif
-
// Checks if this DateTime is equal to a given object. Returns
// true if the given object is a boxed DateTime and its value
// is equal to the value of this DateTime. Returns false
}
else if (iResult == AssertFilters.FailTerminate)
{
-#if FEATURE_CORECLR
// We want to exit the Silverlight application, after displaying a message.
// Our best known way to emulate this is to exit the process with a known
// error code. Jolt may not be prepared for an appdomain to be unloaded.
Environment._Exit(exitCode);
-#else
- // This assert dialog will be common for code contract failures. If a code contract failure
- // occurs on an end user machine, we believe the right experience is to do a FailFast, which
- // will report this error via Watson, so someone could theoretically fix the bug.
- // However, in CLR v4, Environment.FailFast when a debugger is attached gives you an MDA
- // saying you've hit a bug in the runtime or unsafe managed code, and this is most likely caused
- // by heap corruption or a stack imbalance from COM Interop or P/Invoke. That extremely
- // misleading error isn't right, and we can temporarily work around this by using Environment.Exit
- // if a debugger is attached. The right fix is to plumb FailFast correctly through our native
- // Watson code, adding in a TypeOfReportedError for fatal managed errors.
- if (Debugger.IsAttached)
- Environment._Exit(exitCode);
- else
- Environment.FailFast(message, unchecked((uint) exitCode));
-#endif
}
}
if (!s_EventSourceShutdownRegistered)
{
s_EventSourceShutdownRegistered = true;
-#if (!ES_BUILD_PCL && !FEATURE_CORECLR && !PROJECTN)
- AppDomain.CurrentDomain.ProcessExit += DisposeOnShutdown;
- AppDomain.CurrentDomain.DomainUnload += DisposeOnShutdown;
-#endif
}
IntPtr inMemoryPdbAddress, int inMemoryPdbSize, int methodToken, int ilOffset,
out string sourceFile, out int sourceLine, out int sourceColumn);
-#if FEATURE_CORECLR
private static Type s_symbolsType = null;
private static MethodInfo s_symbolsMethodInfo = null;
[ThreadStatic]
private static int t_reentrancy = 0;
-#endif
-
+
public StackFrameHelper(Thread target)
{
targetThread = target;
{
StackTrace.GetStackFramesInternal(this, iSkip, fNeedFileInfo, exception);
-#if FEATURE_CORECLR
if (!fNeedFileInfo)
return;
{
t_reentrancy--;
}
-#endif
}
void IDisposable.Dispose()
{
-#if FEATURE_CORECLR
if (getSourceLineInfo != null)
{
IDisposable disposable = getSourceLineInfo.Target as IDisposable;
disposable.Dispose();
}
}
-#endif
}
public virtual MethodBase GetMethodBase(int i)
// In order to ensure trusted code can trust the data it gets from a
// StackTrace, we use an InheritanceDemand to prevent partially-trusted
// subclasses.
-#if !FEATURE_CORECLR
-#endif
[Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public class StackTrace
else
fFirstTyParam = false;
- sb.Append(typars[k].Name);
+ sb.Append(typars[k].Name);
k++;
}
sb.Append(']');
}
ParameterInfo[] pi = null;
-#if FEATURE_CORECLR
try
{
-#endif
pi = mb.GetParameters();
-#if FEATURE_CORECLR
}
catch
{
// The parameter info cannot be loaded, so we don't
// append the parameter list.
}
-#endif
if (pi != null)
{
// arguments printing
private static extern void GetMessageFromNativeResources(ExceptionMessageKind kind, StringHandleOnStack retMesg);
}
-
-
-#if FEATURE_CORECLR
-
//--------------------------------------------------------------------------
// Telesto: Telesto doesn't support appdomain marshaling of objects so
// managed exceptions that leak across appdomain boundaries are flatted to
{
return Message;
}
-
}
-#endif
-
-
}
// Want 1st calendar to be default
// Prior to Vista the enumeration didn't have default calendar first
// Only a coreclr concern, culture.dll does the right thing.
-#if FEATURE_CORECLR
if (temp.Length > 1)
{
int i = DoGetLocaleInfoInt(LOCALE_ICALENDARTYPE);
temp[0] = i;
}
}
-#endif
this.waCalendars = temp;
}
#if FEATURE_LEAK_CULTURE_INFO
[NonSerialized]private bool m_isSafeCrossDomain;
[NonSerialized]private int m_createdDomainID;
-#endif // !FEATURE_CORECLR
+#endif // !FEATURE_LEAK_CULTURE_INFO
[NonSerialized]private CultureInfo m_consoleFallbackCulture;
// Names are confusing. Here are 3 names we have:
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool InternalGetSystemDefaultUILanguage(StringHandleOnStack systemDefaultUiLanguage);
-// Added but disabled from desktop in .NET 4.0, stayed disabled in .NET 4.5
-#if FEATURE_CORECLR
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern String[] nativeGetResourceFallbackArray();
-#endif
}
}
// accurate than the system's current offset because of daylight saving time.
offset = TimeZoneInfo.GetLocalUtcOffset(DateTime.Now, TimeZoneInfoOptions.NoThrowOnInvalidTime);
} else if (dateTime.Kind == DateTimeKind.Utc) {
-#if FEATURE_CORECLR
offset = TimeSpan.Zero;
-#else // FEATURE_CORECLR
- // This code path points to a bug in user code. It would make sense to return a 0 offset in this case.
- // However, because it was only possible to detect this in Whidbey, there is user code that takes a
- // dependency on being serialize a UTC DateTime using the 'z' format, and it will work almost all the
- // time if it is offset by an incorrect conversion to local time when parsed. Therefore, we need to
- // explicitly emit the local time offset, which we can do by removing the UTC flag.
- InvalidFormatForUtc(format, dateTime);
- dateTime = DateTime.SpecifyKind(dateTime, DateTimeKind.Local);
- offset = TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
-#endif // FEATURE_CORECLR
} else {
offset = TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
}
}
if (offset >= TimeSpan.Zero) {
- result.Append('+');
+ result.Append('+');
}
else {
result.Append('-');
{
get
{
-#if FEATURE_CORECLR
if (this.amDesignator == null)
{
this.amDesignator = this.m_cultureData.SAM1159;
}
-#endif
+
Contract.Assert(this.amDesignator != null, "DateTimeFormatInfo.AMDesignator, amDesignator != null");
return (this.amDesignator);
}
{
get
{
-#if FEATURE_CORECLR
if (this.dateSeparator == null)
{
this.dateSeparator = this.m_cultureData.DateSeparator(Calendar.ID);
}
-#endif
+
Contract.Assert(this.dateSeparator != null, "DateTimeFormatInfo.DateSeparator, dateSeparator != null");
return (this.dateSeparator);
}
{
get
{
-#if FEATURE_CORECLR
if (this.firstDayOfWeek == -1)
{
this.firstDayOfWeek = this.m_cultureData.IFIRSTDAYOFWEEK;
}
-#endif
+
Contract.Assert(this.firstDayOfWeek != -1, "DateTimeFormatInfo.FirstDayOfWeek, firstDayOfWeek != -1");
-
return ((DayOfWeek)this.firstDayOfWeek);
}
{
get
{
-#if FEATURE_CORECLR
if (this.calendarWeekRule == -1)
{
this.calendarWeekRule = this.m_cultureData.IFIRSTWEEKOFYEAR;
}
-#endif
+
Contract.Assert(this.calendarWeekRule != -1, "DateTimeFormatInfo.CalendarWeekRule, calendarWeekRule != -1");
return ((CalendarWeekRule)this.calendarWeekRule);
}
{
get
{
-#if FEATURE_CORECLR
if (this.pmDesignator == null)
{
this.pmDesignator = this.m_cultureData.SPM2359;
}
-#endif
+
Contract.Assert(this.pmDesignator != null, "DateTimeFormatInfo.PMDesignator, pmDesignator != null");
return (this.pmDesignator);
}
{
get
{
-#if FEATURE_CORECLR
if (timeSeparator == null)
{
timeSeparator = this.m_cultureData.TimeSeparator;
}
-#endif
+
Contract.Assert(this.timeSeparator != null, "DateTimeFormatInfo.TimeSeparator, timeSeparator != null");
return (timeSeparator);
}
// no adjustment is required in most cases
return DateTimeOffsetTimeZonePostProcessing(ref result, styles);
}
-#if FEATURE_CORECLR // on CoreCLR DateTime is also restricted to +- 14:00, just like DateTimeOffset
else {
Int64 offsetTicks = result.timeZoneOffset.Ticks;
-
+
// the DateTime offset must be within +- 14:00 hours.
if (offsetTicks < DateTimeOffset.MinOffset || offsetTicks > DateTimeOffset.MaxOffset) {
result.SetFailure(ParseFailureKind.Format, "Format_OffsetOutOfRange", null);
return false;
}
}
-#endif // FEATURE_CORECLR
// The flags AssumeUniveral and AssumeLocal only apply when the input does not have a time zone
if ((result.flags & ParseFlags.TimeZoneUsed) == 0) {
private void SetName(string name)
{
-#if FEATURE_CORECLR
// Use the name of the region we found
this.m_name = this.m_cultureData.SREGIONNAME;
-#else
- // when creating region by culture name, we keep the region name as the culture name so regions
- // created by custom culture names can be differentiated from built in regions.
- this.m_name = name.Equals(this.m_cultureData.SREGIONNAME, StringComparison.OrdinalIgnoreCase) ?
- this.m_cultureData.SREGIONNAME :
- this.m_cultureData.CultureName;
-#endif // FEATURE_CORECLR
}
-
#region Serialization
//
if (PathInternal.IsDirectoryTooLong(destPath))
throw new PathTooLongException(Environment.GetResourceString("IO.PathTooLong"));
-#if FEATURE_CORECLR
if (checkHost) {
FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.Write | FileSecurityStateAccess.Read, sourceDirName, sourcePath);
FileSecurityState destState = new FileSecurityState(FileSecurityStateAccess.Write, destDirName, destPath);
sourceState.EnsureState();
destState.EnsureState();
}
-#else
- FileIOPermission.QuickDemand(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, sourcePath, false, false);
- FileIOPermission.QuickDemand(FileIOPermissionAccess.Write, destPath, false, false);
-#endif
if (String.Compare(sourcePath, destPath, StringComparison.OrdinalIgnoreCase) == 0)
throw new IOException(Environment.GetResourceString("IO.IO_SourceDestMustBeDifferent"));
// If not recursive, do permission check only on this directory
// else check for the whole directory structure rooted below
demandPath = GetDemandDir(fullPath, !recursive);
-
-#if FEATURE_CORECLR
+
if (checkHost)
{
FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Write, userPath, demandPath);
state.EnsureState();
}
-#else
- // Make sure we have write permission to this directory
- new FileIOPermission(FileIOPermissionAccess.Write, new String[] { demandPath }, false, false ).Demand();
-#endif
// Do not recursively delete through reparse points. Perhaps in a
// future version we will add a new flag to control this behavior,
if (parentName==null)
return null;
DirectoryInfo dir = new DirectoryInfo(parentName,false);
-#if FEATURE_CORECLR
+
FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.PathDiscovery | FileSecurityStateAccess.Read, String.Empty, dir.demandDir[0]);
state.EnsureState();
-#else
- new FileIOPermission(FileIOPermissionAccess.PathDiscovery | FileIOPermissionAccess.Read, dir.demandDir, false, false).Demand();
-#endif
+
return dir;
}
}
String rootPath = FullPath.Substring(0, rootLength);
demandPath = Directory.GetDemandDir(rootPath, true);
-#if FEATURE_CORECLR
FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandPath);
sourceState.EnsureState();
-#else
- new FileIOPermission(FileIOPermissionAccess.PathDiscovery, new String[] { demandPath }, false, false).Demand();
-#endif
+
return new DirectoryInfo(rootPath);
}
}
if (destDirName.Length==0)
throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), nameof(destDirName));
Contract.EndContractBlock();
-
-#if FEATURE_CORECLR
+
FileSecurityState sourceState = new FileSecurityState(FileSecurityStateAccess.Write | FileSecurityStateAccess.Read, DisplayPath, Directory.GetDemandDir(FullPath, true));
sourceState.EnsureState();
-#else
- new FileIOPermission(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, demandDir, false, false).Demand();
-#endif
+
String fullDestDirName = Path.GetFullPath(destDirName);
String demandPath;
if (!fullDestDirName.EndsWith(Path.DirectorySeparatorChar))
// had the ability to read the file contents in the old location,
// but you technically also need read permissions to the new
// location as well, and write is not a true superset of read.
-#if FEATURE_CORECLR
FileSecurityState destState = new FileSecurityState(FileSecurityStateAccess.Write, destDirName, demandPath);
destState.EnsureState();
-#else
- new FileIOPermission(FileIOPermissionAccess.Write | FileIOPermissionAccess.Read, demandPath).Demand();
-#endif
-
+
String fullSourcePath;
if (FullPath.EndsWith(Path.DirectorySeparatorChar))
fullSourcePath = FullPath;
}
else
{
-#if FEATURE_CORECLR
displayName = GetDirName(fullPath);
-#else
- displayName = originalPath;
-#endif
}
return displayName;
}
return false;
}
-#if FEATURE_CORECLR
if (checkHost)
{
FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, path);
state.EnsureState();
}
-#else
- FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, path, false, false);
-#endif
return InternalExists(path);
}
// Do a demand on the combined path so that we can fail early in case of deny
demandPaths[1] = Directory.GetDemandDir(normalizedSearchPath, true);
_checkHost = checkHost;
-#if FEATURE_CORECLR
+
if (checkHost)
{
FileSecurityState state1 = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandPaths[0]);
FileSecurityState state2 = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandPaths[1]);
state2.EnsureState();
}
-#else
- new FileIOPermission(FileIOPermissionAccess.PathDiscovery, demandPaths, false, false).Demand();
-#endif
// normalize search criteria
searchCriteria = GetNormalizedSearchCriteria(fullSearchString, normalizedSearchPath);
// For filters like foo\*.cs we need to verify if the directory foo is not denied access.
// Do a demand on the combined path so that we can fail early in case of deny
demandPaths[1] = Directory.GetDemandDir(normalizedSearchPath, true);
-#if FEATURE_CORECLR
+
if (checkHost)
{
FileSecurityState state1 = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandPaths[0]);
FileSecurityState state2 = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandPaths[1]);
state2.EnsureState();
}
-#else
- new FileIOPermission(FileIOPermissionAccess.PathDiscovery, demandPaths, false, false).Demand();
-#endif
+
searchData = new Directory.SearchData(normalizedSearchPath, userPath, searchOption);
CommonInit();
}
internal void DoDemand(String fullPathToDemand)
{
-#if FEATURE_CORECLR
if(_checkHost) {
String demandDir = Directory.GetDemandDir(fullPathToDemand, true);
FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.PathDiscovery, String.Empty, demandDir);
state.EnsureState();
}
-#else
- String demandDir = Directory.GetDemandDir(fullPathToDemand, true);
- String[] demandPaths = new String[] { demandDir };
- new FileIOPermission(FileIOPermissionAccess.PathDiscovery, demandPaths, false, false).Demand();
-#endif
}
private static String NormalizeSearchPattern(String searchPattern)
internal override FileInfo CreateObject(SearchResult result)
{
String name = result.FullPath;
-#if FEATURE_CORECLR
+
FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, name);
state.EnsureState();
-#else
- String[] names = new String[] { name };
- new FileIOPermission(FileIOPermissionAccess.Read, names, false, false).Demand();
-#endif
+
FileInfo fi = new FileInfo(name, false);
fi.InitializeFrom(result.FindData);
return fi;
{
String name = result.FullPath;
String permissionName = name + "\\.";
-
-#if FEATURE_CORECLR
+
FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, permissionName);
state.EnsureState();
-#else
- String[] permissionNames = new String[] { permissionName };
- new FileIOPermission(FileIOPermissionAccess.Read, permissionNames, false, false).Demand();
-#endif
+
DirectoryInfo di = new DirectoryInfo(name, false);
di.InitializeFrom(result.FindData);
return di;
String name = result.FullPath;
String permissionName = name + "\\.";
-#if FEATURE_CORECLR
FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, permissionName);
state.EnsureState();
-#else
- String[] permissionNames = new String[] { permissionName };
- new FileIOPermission(FileIOPermissionAccess.Read, permissionNames, false, false).Demand();
-#endif
+
DirectoryInfo di = new DirectoryInfo(name, false);
di.InitializeFrom(result.FindData);
return di;
Contract.Assert(isFile);
String name = result.FullPath;
-#if FEATURE_CORECLR
FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, name);
state.EnsureState();
-#else
- String[] names = new String[] { name };
- new FileIOPermission(FileIOPermissionAccess.Read, names, false, false).Demand();
-#endif
+
FileInfo fi = new FileInfo(name, false);
fi.InitializeFrom(result.FindData);
return fi;
**
===========================================================*/
using System;
-#if FEATURE_CORECLR
using System.Buffers;
-#endif
using System.Threading;
using System.Threading.Tasks;
-
using System.Runtime;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
{
int bufferSize = _DefaultCopyBufferSize;
-#if FEATURE_CORECLR
if (CanSeek)
{
long length = Length;
bufferSize = (int)Math.Min(bufferSize, remaining);
}
}
-#endif // FEATURE_CORECLR
-
+
return CopyToAsync(destination, bufferSize);
}
Contract.Requires(CanRead);
Contract.Requires(destination.CanWrite);
-#if FEATURE_CORECLR
byte[] buffer = ArrayPool<byte>.Shared.Rent(bufferSize);
bufferSize = 0; // reuse same field for high water mark to avoid needing another field in the state machine
try
Array.Clear(buffer, 0, bufferSize); // clear only the most we used
ArrayPool<byte>.Shared.Return(buffer, clearArray: false);
}
-#else
- byte[] buffer = new byte[bufferSize];
- while (true)
- {
- int bytesRead = await ReadAsync(buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false);
- if (bytesRead == 0) break;
- await destination.WriteAsync(buffer, 0, bytesRead, cancellationToken).ConfigureAwait(false);
- }
-#endif
}
// Reads the bytes from the current stream and writes the bytes to
{
int bufferSize = _DefaultCopyBufferSize;
-#if FEATURE_CORECLR
if (CanSeek)
{
long length = Length;
bufferSize = (int)Math.Min(bufferSize, remaining);
}
}
-#endif // FEATURE_CORECLR
-
+
CopyTo(destination, bufferSize);
}
{
StreamHelpers.ValidateCopyToArgs(this, destination, bufferSize);
-#if FEATURE_CORECLR
byte[] buffer = ArrayPool<byte>.Shared.Rent(bufferSize);
int highwaterMark = 0;
try
Array.Clear(buffer, 0, highwaterMark); // clear only the most we used
ArrayPool<byte>.Shared.Return(buffer, clearArray: false);
}
-#else
- byte[] buffer = new byte[bufferSize];
- int read;
- while ((read = Read(buffer, 0, buffer.Length)) != 0)
- {
- destination.Write(buffer, 0, read);
- }
-#endif
}
// Stream used to require that all cleanup logic went into Close(),
// is generally the right thing to do.
if (stream != null) {
// Note: flush on the underlying stream can throw (ex., low disk space)
-#if FEATURE_CORECLR
if (disposing)
-#else
- if (disposing || (LeaveOpen && stream is __ConsoleStream))
-#endif
{
CheckAsyncTaskInProgress();
}
public unsafe override int GetHashCode() {
-#if FEATURE_CORECLR
#if BIT64
long l = (long)m_value;
return (unchecked((int)l) ^ (int)(l >> 32));
#else // !BIT64 (32)
return unchecked((int)m_value);
#endif
-#else
- return unchecked((int)((long)m_value));
-#endif
}
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
new Dictionary<Object, UInt32>();
new Dictionary<UInt32, Object>();
new Dictionary<Int64, Object>();
-#if FEATURE_CORECLR
+
// to genereate mdil for Dictionary instantiation when key is user defined value type
new Dictionary<Guid, Int32>();
-#endif
- // Microsoft.Windows.Design
+ // Microsoft.Windows.Design
new Dictionary<System.Reflection.MemberTypes, Object>();
new EnumEqualityComparer<System.Reflection.MemberTypes>();
- // Microsoft.Expression.DesignModel
+ // Microsoft.Expression.DesignModel
new Dictionary<Object, KeyValuePair<Object,Object>>();
new Dictionary<KeyValuePair<Object,Object>, Object>();
SZArrayHelper<CustomAttributeTypedArgument>(null);
SZArrayHelper<CustomAttributeNamedArgument>(null);
-#if FEATURE_CORECLR
#pragma warning disable 4014
// This is necessary to generate MDIL for AsyncVoidMethodBuilder
AsyncHelper<int>();
AsyncHelper2<int>();
AsyncHelper3();
#pragma warning restore 4014
-#endif
}
static T NullableHelper<T>() where T : struct
oSZArrayHelper.GetEnumerator<T>();
}
-#if FEATURE_CORECLR
// System.Runtime.CompilerServices.AsyncVoidMethodBuilder
// System.Runtime.CompilerServices.TaskAwaiter
static async void AsyncHelper<T>()
{
await Task.FromResult<string>("");
}
-#endif
#if FEATURE_COMINTEROP
/// </remarks>
[Serializable]
[ComVisible(false)]
-#if !FEATURE_CORECLR
- [HostProtection(Synchronization = true, ExternalThreading = true)]
-#endif
[DebuggerTypeProxy(typeof(System_LazyDebugView<>))]
[DebuggerDisplay("ThreadSafetyMode={Mode}, IsValueCreated={IsValueCreated}, IsValueFaulted={IsValueFaulted}, Value={ValueForDebugDisplay}")]
public class Lazy<T>
}
// Fall through to the slow path.
-#if !FEATURE_CORECLR
- // We call NOCTD to abort attempts by the debugger to funceval this property (e.g. on mouseover)
- // (the debugger proxy is the correct way to look at state/value of this object)
- Debugger.NotifyOfCrossThreadDependency();
-#endif
return LazyInitValue();
-
}
}
// This class is used to define the name of the base class library
internal class CoreLib
{
-
-#if FEATURE_CORECLR
public const string Name = "System.Private.CoreLib";
-#else
- public const string Name = "mscorlib";
-#endif
public static string FixupCoreLibName(string strToFixup)
{
-#if FEATURE_CORECLR
if (!String.IsNullOrEmpty(strToFixup))
{
strToFixup = strToFixup.Replace("mscorlib", System.CoreLib.Name);
}
-#endif
- return strToFixup;
+
+ return strToFixup;
}
}
return Enum.Parse(type, value.ToString());
}
-#if !FEATURE_CORECLR
- // Special case the convertion from DBNull.
- if (srcType == typeof(DBNull))
- {
- // The requested type is a DBNull so no convertion is required.
- if (type == typeof(DBNull))
- return value;
-
- // Visual J++ supported converting from DBNull to null so customers
- // have requested (via a CDCR) that DBNull be convertible to null.
- // We don't however allow this when converting to a value class, since null
- // doesn't make sense for these, or to object since this would change existing
- // semantics.
- if ((type.IsClass && type != typeof(Object)) || type.IsInterface)
- return null;
- }
-#endif //!FEATURE_CORECLR
-
// Use the OA variant lib to convert primitive types.
try
{
throw new COMException(Environment.GetResourceString("Interop.COM_TypeMismatch"), unchecked((int)0x80020005));
}
}
-
-
}
}
// 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;
-using System.Globalization;
-using System.IO;
-using System.Reflection;
-using System.Runtime.InteropServices;
-using System.Runtime.Serialization;
-using System.Security.Permissions;
-using System.Security.Policy;
-
namespace System.Runtime.InteropServices
{
[GuidAttribute("BCA8B44D-AAD6-3A86-8AB7-03349F4F2DA2")]
[CLSCompliant(false)]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[TypeLibImportClassAttribute(typeof(System.Type))]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public interface _Type
{
-#if !FEATURE_CORECLR
- #region IDispatch Members
- void GetTypeInfoCount(out uint pcTInfo);
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
- #endregion
-
- #region Object Members
- String ToString();
- bool Equals(Object other);
- int GetHashCode();
- Type GetType();
- #endregion
-
- #region MemberInfo Members
- MemberTypes MemberType { get; }
- String Name { get; }
- Type DeclaringType { get; }
- Type ReflectedType { get; }
- Object[] GetCustomAttributes(Type attributeType, bool inherit);
- Object[] GetCustomAttributes(bool inherit);
- bool IsDefined(Type attributeType, bool inherit);
- #endregion
-
- #region Type Members
- Guid GUID { get; }
- Module Module { get; }
- Assembly Assembly { get; }
- RuntimeTypeHandle TypeHandle { get; }
- String FullName { get; }
- String Namespace { get; }
- String AssemblyQualifiedName { get; }
- int GetArrayRank();
- Type BaseType { get; }
-
- ConstructorInfo[] GetConstructors(BindingFlags bindingAttr);
- Type GetInterface(String name, bool ignoreCase);
- Type[] GetInterfaces();
- Type[] FindInterfaces(TypeFilter filter,Object filterCriteria);
- EventInfo GetEvent(String name,BindingFlags bindingAttr);
- EventInfo[] GetEvents();
- EventInfo[] GetEvents(BindingFlags bindingAttr);
- Type[] GetNestedTypes(BindingFlags bindingAttr);
- Type GetNestedType(String name, BindingFlags bindingAttr);
- MemberInfo[] GetMember(String name, MemberTypes type, BindingFlags bindingAttr);
- MemberInfo[] GetDefaultMembers();
- MemberInfo[] FindMembers(MemberTypes memberType,BindingFlags bindingAttr,MemberFilter filter,Object filterCriteria);
- Type GetElementType();
- bool IsSubclassOf(Type c);
- bool IsInstanceOfType(Object o);
- bool IsAssignableFrom(Type c);
- InterfaceMapping GetInterfaceMap(Type interfaceType);
- MethodInfo GetMethod(String name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers);
- MethodInfo GetMethod(String name, BindingFlags bindingAttr);
- MethodInfo[] GetMethods(BindingFlags bindingAttr);
- FieldInfo GetField(String name, BindingFlags bindingAttr);
- FieldInfo[] GetFields(BindingFlags bindingAttr);
- PropertyInfo GetProperty(String name, BindingFlags bindingAttr);
- PropertyInfo GetProperty(String name,BindingFlags bindingAttr,Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers);
- PropertyInfo[] GetProperties(BindingFlags bindingAttr);
- MemberInfo[] GetMember(String name, BindingFlags bindingAttr);
- MemberInfo[] GetMembers(BindingFlags bindingAttr);
- Object InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters);
- Type UnderlyingSystemType
- {
- get;
- }
-
- Object InvokeMember(String name,BindingFlags invokeAttr,Binder binder, Object target, Object[] args, CultureInfo culture);
- Object InvokeMember(String name,BindingFlags invokeAttr,Binder binder, Object target, Object[] args);
- ConstructorInfo GetConstructor(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers);
- ConstructorInfo GetConstructor(BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers);
- ConstructorInfo GetConstructor(Type[] types);
- ConstructorInfo[] GetConstructors();
- ConstructorInfo TypeInitializer
- {
- get;
- }
-
- MethodInfo GetMethod(String name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers);
- MethodInfo GetMethod(String name, Type[] types, ParameterModifier[] modifiers);
- MethodInfo GetMethod(String name, Type[] types);
- MethodInfo GetMethod(String name);
- MethodInfo[] GetMethods();
- FieldInfo GetField(String name);
- FieldInfo[] GetFields();
- Type GetInterface(String name);
- EventInfo GetEvent(String name);
- PropertyInfo GetProperty(String name, Type returnType, Type[] types,ParameterModifier[] modifiers);
- PropertyInfo GetProperty(String name, Type returnType, Type[] types);
- PropertyInfo GetProperty(String name, Type[] types);
- PropertyInfo GetProperty(String name, Type returnType);
- PropertyInfo GetProperty(String name);
- PropertyInfo[] GetProperties();
- Type[] GetNestedTypes();
- Type GetNestedType(String name);
- MemberInfo[] GetMember(String name);
- MemberInfo[] GetMembers();
- TypeAttributes Attributes { get; }
- bool IsNotPublic { get; }
- bool IsPublic { get; }
- bool IsNestedPublic { get; }
- bool IsNestedPrivate { get; }
- bool IsNestedFamily { get; }
- bool IsNestedAssembly { get; }
- bool IsNestedFamANDAssem { get; }
- bool IsNestedFamORAssem { get; }
- bool IsAutoLayout { get; }
- bool IsLayoutSequential { get; }
- bool IsExplicitLayout { get; }
- bool IsClass { get; }
- bool IsInterface { get; }
- bool IsValueType { get; }
- bool IsAbstract { get; }
- bool IsSealed { get; }
- bool IsEnum { get; }
- bool IsSpecialName { get; }
- bool IsImport { get; }
- bool IsSerializable { get; }
- bool IsAnsiClass { get; }
- bool IsUnicodeClass { get; }
- bool IsAutoClass { get; }
- bool IsArray { get; }
- bool IsByRef { get; }
- bool IsPointer { get; }
- bool IsPrimitive { get; }
- bool IsCOMObject { get; }
- bool HasElementType { get; }
- bool IsContextful { get; }
- bool IsMarshalByRef { get; }
- bool Equals(Type o);
- #endregion
-#endif
}
[GuidAttribute("17156360-2f1a-384a-bc52-fde93c215c5b")]
[System.Runtime.InteropServices.ComVisible(true)]
public interface _MemberInfo
{
-#if !FEATURE_CORECLR
- #region IDispatch Members
- void GetTypeInfoCount(out uint pcTInfo);
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
- #endregion
-
- #region Object Members
- String ToString();
- bool Equals(Object other);
- int GetHashCode();
- Type GetType();
- #endregion
-
- #region MemberInfo Members
- MemberTypes MemberType { get; }
- String Name { get; }
- Type DeclaringType { get; }
- Type ReflectedType { get; }
- Object[] GetCustomAttributes(Type attributeType, bool inherit);
- Object[] GetCustomAttributes(bool inherit);
- bool IsDefined(Type attributeType, bool inherit);
- #endregion
-#endif
}
-
[GuidAttribute("6240837A-707F-3181-8E98-A36AE086766B")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[CLSCompliant(false)]
[System.Runtime.InteropServices.ComVisible(true)]
public interface _MethodBase
{
-#if !FEATURE_CORECLR
- #region IDispatch Members
- void GetTypeInfoCount(out uint pcTInfo);
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
- #endregion
-
- #region Object Members
- String ToString();
- bool Equals(Object other);
- int GetHashCode();
- Type GetType();
- #endregion
-
- #region MemberInfo Members
- MemberTypes MemberType { get; }
- String Name { get; }
- Type DeclaringType { get; }
- Type ReflectedType { get; }
- Object[] GetCustomAttributes(Type attributeType, bool inherit);
- Object[] GetCustomAttributes(bool inherit);
- bool IsDefined(Type attributeType, bool inherit);
- #endregion
-
- #region MethodBase Members
- ParameterInfo[] GetParameters();
- MethodImplAttributes GetMethodImplementationFlags();
- RuntimeMethodHandle MethodHandle { get; }
- MethodAttributes Attributes { get; }
- CallingConventions CallingConvention { get; }
- Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture);
- bool IsPublic { get; }
- bool IsPrivate { get; }
- bool IsFamily { get; }
- bool IsAssembly { get; }
- bool IsFamilyAndAssembly { get; }
- bool IsFamilyOrAssembly { get; }
- bool IsStatic { get; }
- bool IsFinal { get; }
- bool IsVirtual { get; }
- bool IsHideBySig { get; }
- bool IsAbstract { get; }
- bool IsSpecialName { get; }
- bool IsConstructor { get; }
- Object Invoke(Object obj, Object[] parameters);
- #endregion
-#endif
}
-
[GuidAttribute("FFCC1B5D-ECB8-38DD-9B01-3DC8ABC2AA5F")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[CLSCompliant(false)]
[System.Runtime.InteropServices.ComVisible(true)]
public interface _MethodInfo
{
-#if !FEATURE_CORECLR
- #region IDispatch Members
- void GetTypeInfoCount(out uint pcTInfo);
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
- #endregion
-
- #region Object Members
- String ToString();
- bool Equals(Object other);
- int GetHashCode();
- Type GetType();
- #endregion
-
- #region MemberInfo Members
- MemberTypes MemberType { get; }
- String Name { get; }
- Type DeclaringType { get; }
- Type ReflectedType { get; }
- Object[] GetCustomAttributes(Type attributeType, bool inherit);
- Object[] GetCustomAttributes(bool inherit);
- bool IsDefined(Type attributeType, bool inherit);
- #endregion
-
- #region MethodBase Members
- ParameterInfo[] GetParameters();
- MethodImplAttributes GetMethodImplementationFlags();
- RuntimeMethodHandle MethodHandle { get; }
- MethodAttributes Attributes { get; }
- CallingConventions CallingConvention { get; }
- Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture);
- bool IsPublic { get; }
- bool IsPrivate { get; }
- bool IsFamily { get; }
- bool IsAssembly { get; }
- bool IsFamilyAndAssembly { get; }
- bool IsFamilyOrAssembly { get; }
- bool IsStatic { get; }
- bool IsFinal { get; }
- bool IsVirtual { get; }
- bool IsHideBySig { get; }
- bool IsAbstract { get; }
- bool IsSpecialName { get; }
- bool IsConstructor { get; }
- Object Invoke(Object obj, Object[] parameters);
- #endregion
-
- #region MethodInfo Members
- Type ReturnType { get; }
- ICustomAttributeProvider ReturnTypeCustomAttributes { get; }
- MethodInfo GetBaseDefinition();
- #endregion
-#endif
}
-
[GuidAttribute("E9A19478-9646-3679-9B10-8411AE1FD57D")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[System.Runtime.InteropServices.ComVisible(true)]
public interface _ConstructorInfo
{
-#if !FEATURE_CORECLR
- #region IDispatch Members
- void GetTypeInfoCount(out uint pcTInfo);
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
- #endregion
-
- #region Object Members
- String ToString();
- bool Equals(Object other);
- int GetHashCode();
- Type GetType();
- #endregion
-
- #region MemberInfo Members
- MemberTypes MemberType { get; }
- String Name { get; }
- Type DeclaringType { get; }
- Type ReflectedType { get; }
- Object[] GetCustomAttributes(Type attributeType, bool inherit);
- Object[] GetCustomAttributes(bool inherit);
- bool IsDefined(Type attributeType, bool inherit);
- #endregion
-
- #region MethodBase Members
- ParameterInfo[] GetParameters();
- MethodImplAttributes GetMethodImplementationFlags();
- RuntimeMethodHandle MethodHandle { get; }
- MethodAttributes Attributes { get; }
- CallingConventions CallingConvention { get; }
- Object Invoke_2(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture);
- bool IsPublic { get; }
- bool IsPrivate { get; }
- bool IsFamily { get; }
- bool IsAssembly { get; }
- bool IsFamilyAndAssembly { get; }
- bool IsFamilyOrAssembly { get; }
- bool IsStatic { get; }
- bool IsFinal { get; }
- bool IsVirtual { get; }
- bool IsHideBySig { get; }
- bool IsAbstract { get; }
- bool IsSpecialName { get; }
- bool IsConstructor { get; }
- Object Invoke_3(Object obj, Object[] parameters);
- #endregion
-
- #region ConstructorInfo
- Object Invoke_4(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture);
- Object Invoke_5(Object[] parameters);
- #endregion
-#endif
}
-
[GuidAttribute("8A7C1442-A9FB-366B-80D8-4939FFA6DBE0")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[CLSCompliant(false)]
[TypeLibImportClassAttribute(typeof(System.Reflection.FieldInfo))]
[System.Runtime.InteropServices.ComVisible(true)]
public interface _FieldInfo
- {
-#if !FEATURE_CORECLR
- #region IDispatch Members
- void GetTypeInfoCount(out uint pcTInfo);
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
- #endregion
-
- #region Object Members
- String ToString();
- bool Equals(Object other);
- int GetHashCode();
- Type GetType();
- #endregion
-
- #region MemberInfo Members
- MemberTypes MemberType { get; }
- String Name { get; }
- Type DeclaringType { get; }
- Type ReflectedType { get; }
- Object[] GetCustomAttributes(Type attributeType, bool inherit);
- Object[] GetCustomAttributes(bool inherit);
- bool IsDefined(Type attributeType, bool inherit);
- #endregion
-
- #region FieldInfo Members
- Type FieldType { get; }
- Object GetValue(Object obj);
- Object GetValueDirect(TypedReference obj);
- void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture);
- void SetValueDirect(TypedReference obj,Object value);
- RuntimeFieldHandle FieldHandle { get; }
- FieldAttributes Attributes { get; }
- void SetValue(Object obj, Object value);
- bool IsPublic { get; }
- bool IsPrivate { get; }
- bool IsFamily { get; }
- bool IsAssembly { get; }
- bool IsFamilyAndAssembly { get; }
- bool IsFamilyOrAssembly { get; }
- bool IsStatic { get; }
- bool IsInitOnly { get; }
- bool IsLiteral { get; }
- bool IsNotSerialized { get; }
- bool IsSpecialName { get; }
- bool IsPinvokeImpl { get; }
- #endregion
-#endif
+ {
}
-
[GuidAttribute("F59ED4E4-E68F-3218-BD77-061AA82824BF")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[CLSCompliant(false)]
[TypeLibImportClassAttribute(typeof(System.Reflection.PropertyInfo))]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public interface _PropertyInfo
{
-#if !FEATURE_CORECLR
- #region IDispatch Members
- void GetTypeInfoCount(out uint pcTInfo);
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
- #endregion
-
- #region Object Members
- String ToString();
- bool Equals(Object other);
- int GetHashCode();
- Type GetType();
- #endregion
-
- #region MemberInfo Members
- MemberTypes MemberType { get; }
- String Name { get; }
- Type DeclaringType { get; }
- Type ReflectedType { get; }
- Object[] GetCustomAttributes(Type attributeType, bool inherit);
- Object[] GetCustomAttributes(bool inherit);
- bool IsDefined(Type attributeType, bool inherit);
- #endregion
-
- #region Property Members
- Type PropertyType { get; }
- Object GetValue(Object obj,Object[] index);
- Object GetValue(Object obj,BindingFlags invokeAttr,Binder binder, Object[] index, CultureInfo culture);
- void SetValue(Object obj, Object value, Object[] index);
- void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture);
- MethodInfo[] GetAccessors(bool nonPublic);
- MethodInfo GetGetMethod(bool nonPublic);
- MethodInfo GetSetMethod(bool nonPublic);
- ParameterInfo[] GetIndexParameters();
- PropertyAttributes Attributes { get; }
- bool CanRead { get; }
- bool CanWrite { get; }
- MethodInfo[] GetAccessors();
- MethodInfo GetGetMethod();
- MethodInfo GetSetMethod();
- bool IsSpecialName { get; }
- #endregion
-#endif
}
-
[GuidAttribute("9DE59C64-D889-35A1-B897-587D74469E5B")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[CLSCompliant(false)]
[System.Runtime.InteropServices.ComVisible(true)]
public interface _EventInfo
{
-#if !FEATURE_CORECLR
- #region IDispatch Members
- void GetTypeInfoCount(out uint pcTInfo);
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
- #endregion
-
- #region Object Members
- String ToString();
- bool Equals(Object other);
- int GetHashCode();
- Type GetType();
- #endregion
-
- #region MemberInfo Members
- MemberTypes MemberType { get; }
- String Name { get; }
- Type DeclaringType { get; }
- Type ReflectedType { get; }
- Object[] GetCustomAttributes(Type attributeType, bool inherit);
- Object[] GetCustomAttributes(bool inherit);
- bool IsDefined(Type attributeType, bool inherit);
- #endregion
-
- #region EventInfo Members
- MethodInfo GetAddMethod(bool nonPublic);
- MethodInfo GetRemoveMethod(bool nonPublic);
- MethodInfo GetRaiseMethod(bool nonPublic);
- EventAttributes Attributes { get; }
- MethodInfo GetAddMethod();
- MethodInfo GetRemoveMethod();
- MethodInfo GetRaiseMethod();
- void AddEventHandler(Object target, Delegate handler);
- void RemoveEventHandler(Object target, Delegate handler);
- Type EventHandlerType { get; }
- bool IsSpecialName { get; }
- bool IsMulticast { get; }
- #endregion
-#endif
}
[GuidAttribute("993634C4-E47A-32CC-BE08-85F567DC27D6")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[CLSCompliant(false)]
[TypeLibImportClassAttribute(typeof(System.Reflection.ParameterInfo))]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public interface _ParameterInfo
{
-#if !FEATURE_CORECLR
- void GetTypeInfoCount(out uint pcTInfo);
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
-#endif
}
[GuidAttribute("D002E9BA-D9E3-3749-B1D3-D565A08B13E7")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[CLSCompliant(false)]
[TypeLibImportClassAttribute(typeof(System.Reflection.Module))]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public interface _Module
{
-#if !FEATURE_CORECLR
- void GetTypeInfoCount(out uint pcTInfo);
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
-#endif
}
[GuidAttribute("B42B6AAC-317E-34D5-9FA9-093BB4160C50")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[CLSCompliant(false)]
[TypeLibImportClassAttribute(typeof(System.Reflection.AssemblyName))]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public interface _AssemblyName
{
-#if !FEATURE_CORECLR
- void GetTypeInfoCount(out uint pcTInfo);
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
-#endif
}
}
return Invoke(BindingFlags.Default, null, parameters, null);
}
#endregion
-
-#if !FEATURE_CORECLR
- #region COM Interop Support
- Type _ConstructorInfo.GetType()
- {
- return base.GetType();
- }
-
- Object _ConstructorInfo.Invoke_2(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
- {
- return Invoke(obj, invokeAttr, binder, parameters, culture);
- }
-
- Object _ConstructorInfo.Invoke_3(Object obj, Object[] parameters)
- {
- return Invoke(obj, parameters);
- }
-
- Object _ConstructorInfo.Invoke_4(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
- {
- return Invoke(invokeAttr, binder, parameters, culture);
- }
-
- Object _ConstructorInfo.Invoke_5(Object[] parameters)
- {
- return Invoke(parameters);
- }
-
- void _ConstructorInfo.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _ConstructorInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _ConstructorInfo.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- // If you implement this method, make sure to include _ConstructorInfo.Invoke in VM\DangerousAPIs.h and
- // include _ConstructorInfo in SystemDomain::IsReflectionInvocationMethod in AppDomain.cpp.
- void _ConstructorInfo.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
- #endregion
-#endif
}
[Serializable]
if (obj != null)
{
-
-#if FEATURE_CORECLR
// For unverifiable code, we require the caller to be critical.
// Adding the INVOCATION_FLAGS_NEED_SECURITY flag makes that check happen
invocationFlags |= INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY;
-#else // FEATURE_CORECLR
- new SecurityPermission(SecurityPermissionFlag.SkipVerification).Demand();
-#endif // FEATURE_CORECLR
-
}
-#if !FEATURE_CORECLR
- if ((invocationFlags &(INVOCATION_FLAGS.INVOCATION_FLAGS_RISKY_METHOD | INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY)) != 0)
- {
- if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_RISKY_METHOD) != 0)
- CodeAccessPermission.Demand(PermissionType.ReflectionMemberAccess);
- if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY) != 0)
- RuntimeMethodHandle.PerformSecurityCheck(obj, this, m_declaringType, (uint)m_invocationFlags);
- }
-#endif // !FEATURE_CORECLR
-
Signature sig = Signature;
// get the signature
public override bool IsSecurityCritical
{
-#if FEATURE_CORECLR
get { return true; }
-#else
- get { return RuntimeMethodHandle.IsSecurityCritical(this); }
-#endif
}
public override bool IsSecuritySafeCritical
{
-#if FEATURE_CORECLR
get { return false; }
-#else
- get { return RuntimeMethodHandle.IsSecuritySafeCritical(this); }
-#endif
}
public override bool IsSecurityTransparent
{
-#if FEATURE_CORECLR
get { return false; }
-#else
- get { return RuntimeMethodHandle.IsSecurityTransparent(this); }
-#endif
}
public override bool ContainsGenericParameters
}
#endif
-#if !FEATURE_CORECLR
- if ((invocationFlags & (INVOCATION_FLAGS.INVOCATION_FLAGS_RISKY_METHOD | INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY | INVOCATION_FLAGS.INVOCATION_FLAGS_IS_DELEGATE_CTOR)) != 0)
- {
- if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_RISKY_METHOD) != 0)
- CodeAccessPermission.Demand(PermissionType.ReflectionMemberAccess);
- if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY) != 0)
- RuntimeMethodHandle.PerformSecurityCheck(null, this, m_declaringType, (uint)(m_invocationFlags | INVOCATION_FLAGS.INVOCATION_FLAGS_CONSTRUCTOR_INVOKE));
- if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_IS_DELEGATE_CTOR) != 0)
- new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand();
- }
-#endif // !FEATURE_CORECLR
-
// get the signature
Signature sig = Signature;
}
#endregion
}
-
}
private static bool SpecialAllowCriticalAttributes(RuntimeType type)
{
- // Types participating in Type Equivalence are always transparent.
- // See TokenSecurityDescriptor::VerifySemanticDataComputed in securitymeta.cpp.
- // Because of that we allow critical attributes applied to full trust equivalent types.
- // DeclaringType is null for global methods and fields and the global type never participates in type equivalency.
-
-#if FEATURE_CORECLR
return false;
-#else
- return type != null && type.Assembly.IsFullyTrusted && RuntimeTypeHandle.IsEquivalentType(type);
-#endif //!FEATURE_CORECLR
}
private static bool AllowCriticalCustomAttributes(MethodBase method)
return AssemblyBuilder.GetInMemoryAssemblyModule(GetNativeHandle());
}
-#if !FEATURE_CORECLR
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static extern RuntimeModule GetOnDiskAssemblyModule(RuntimeAssembly assembly);
-
- private ModuleBuilder GetOnDiskAssemblyModuleBuilder()
- {
- if (m_onDiskAssemblyModuleBuilder == null)
- {
- Module module = AssemblyBuilder.GetOnDiskAssemblyModule(InternalAssembly.GetNativeHandle());
- ModuleBuilder modBuilder = new ModuleBuilder(this, (InternalModuleBuilder)module);
- modBuilder.Init("RefEmit_OnDiskManifestModule", null, 0);
- m_onDiskAssemblyModuleBuilder = modBuilder;
- }
-
- return m_onDiskAssemblyModuleBuilder;
- }
-#endif // FEATURE_CORECLR
-
#endregion
#region Internal Data Members
// Set to true if the manifest module was returned by code:DefineDynamicModule to the user
private bool m_fManifestModuleUsedAsDefinedModule;
internal const string MANIFEST_MODULE_NAME = "RefEmit_InMemoryManifestModule";
-#if !FEATURE_CORECLR
- private ModuleBuilder m_onDiskAssemblyModuleBuilder;
-#endif // !FEATURE_CORECLR
#if FEATURE_APPX
private bool m_profileAPICheck;
lock(SyncRoot)
{
-#if !FEATURE_CORECLR
- foreach (ModuleBuilder modBuilder in m_assemblyData.m_moduleBuilderList)
- {
- if (modBuilder.InternalModule == module)
- return modBuilder;
- }
-
- // m_onDiskAssemblyModuleBuilder is null before Save
- if (m_onDiskAssemblyModuleBuilder != null && m_onDiskAssemblyModuleBuilder.InternalModule == module)
- return m_onDiskAssemblyModuleBuilder;
-#endif // !FEATURE_CORECLR
-
// in CoreCLR there is only one module in each dynamic assembly, the manifest module
if (m_manifestModuleBuilder.InternalModule == module)
return m_manifestModuleBuilder;
throw new ArgumentNullException(nameof(name));
if (access != AssemblyBuilderAccess.Run
-#if !FEATURE_CORECLR
- && access != AssemblyBuilderAccess.Save
- && access != AssemblyBuilderAccess.RunAndSave
-#endif // !FEATURE_CORECLR
#if FEATURE_REFLECTION_ONLY_LOAD
&& access != AssemblyBuilderAccess.ReflectionOnly
#endif // FEATURE_REFLECTION_ONLY_LOAD
// Clone the name in case the caller modifies it underneath us.
name = (AssemblyName)name.Clone();
-
-#if !FEATURE_CORECLR
- // Set the public key from the key pair if one has been provided.
- // (Overwite any public key in the Assembly name, since it's no
- // longer valid to have a disparity).
- if (name.KeyPair != null)
- name.SetPublicKey(name.KeyPair.PublicKey);
-#endif
// If the caller is trusted they can supply identity
// evidence for the new assembly. Otherwise we copy the
new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
#pragma warning restore 618
-#if FEATURE_COLLECTIBLE_TYPES && !FEATURE_CORECLR
- // Collectible assemblies require FullTrust. This demand may be removed if we deem the
- // feature robust enough to be used directly by untrusted API consumers.
- if (access == AssemblyBuilderAccess.RunAndCollect)
- new PermissionSet(PermissionState.Unrestricted).Demand();
-#endif // FEATURE_COLLECTIBLE_TYPES && !FEATURE_CORECLR
-
// Scan the assembly level attributes for any attributes which modify how we create the
// assembly. Currently, we look for any attribute which modifies the security transparency
// of the assembly.
}
}
-#if !FEATURE_CORECLR
- /**********************************************
- *
- * Define stand alone managed resource for Assembly
- *
- **********************************************/
- public IResourceWriter DefineResource(
- String name,
- String description,
- String fileName)
- {
- return DefineResource(name, description, fileName, ResourceAttributes.Public);
- }
-
- /**********************************************
- *
- * Define stand alone managed resource for Assembly
- *
- **********************************************/
- public IResourceWriter DefineResource(
- String name,
- String description,
- String fileName,
- ResourceAttributes attribute)
- {
- lock(SyncRoot)
- {
- return DefineResourceNoLock(name, description, fileName, attribute);
- }
- }
-
- private IResourceWriter DefineResourceNoLock(
- String name,
- String description,
- String fileName,
- ResourceAttributes attribute)
- {
- if (name == null)
- throw new ArgumentNullException(nameof(name));
- if (name.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), name);
- if (fileName == null)
- throw new ArgumentNullException(nameof(fileName));
- if (fileName.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), nameof(fileName));
- if (!String.Equals(fileName, Path.GetFileName(fileName)))
- throw new ArgumentException(Environment.GetResourceString("Argument_NotSimpleFileName"), nameof(fileName));
- Contract.EndContractBlock();
-
- BCLDebug.Log("DYNIL", "## DYNIL LOGGING: AssemblyBuilder.DefineResource( " + name + ", " + fileName + ")");
-
- m_assemblyData.CheckResNameConflict(name);
- m_assemblyData.CheckFileNameConflict(fileName);
-
- ResourceWriter resWriter;
- String fullFileName;
-
- if (m_assemblyData.m_strDir == null)
- {
- // If assembly directory is null, use current directory
- fullFileName = Path.Combine(Directory.GetCurrentDirectory(), fileName);
- resWriter = new ResourceWriter(fullFileName);
- }
- else
- {
- // Form the full path given the directory provided by user
- fullFileName = Path.Combine(m_assemblyData.m_strDir, fileName);
- resWriter = new ResourceWriter(fullFileName);
- }
- // get the full path
- fullFileName = Path.GetFullPath(fullFileName);
-
- // retrieve just the file name
- fileName = Path.GetFileName(fullFileName);
-
- m_assemblyData.AddResWriter( new ResWriterData( resWriter, null, name, fileName, fullFileName, attribute) );
- return resWriter;
- }
-
- /**********************************************
- *
- * Add an existing resource file to the Assembly
- *
- **********************************************/
- public void AddResourceFile(
- String name,
- String fileName)
- {
- AddResourceFile(name, fileName, ResourceAttributes.Public);
- }
-
- /**********************************************
- *
- * Add an existing resource file to the Assembly
- *
- **********************************************/
- public void AddResourceFile(
- String name,
- String fileName,
- ResourceAttributes attribute)
- {
- lock(SyncRoot)
- {
- AddResourceFileNoLock(name, fileName, attribute);
- }
- }
-
- private void AddResourceFileNoLock(
- String name,
- String fileName,
- ResourceAttributes attribute)
- {
- if (name == null)
- throw new ArgumentNullException(nameof(name));
- if (name.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), name);
- if (fileName == null)
- throw new ArgumentNullException(nameof(fileName));
- if (fileName.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyFileName"), fileName);
- if (!String.Equals(fileName, Path.GetFileName(fileName)))
- throw new ArgumentException(Environment.GetResourceString("Argument_NotSimpleFileName"), nameof(fileName));
- Contract.EndContractBlock();
-
- BCLDebug.Log("DYNIL", "## DYNIL LOGGING: AssemblyBuilder.AddResourceFile( " + name + ", " + fileName + ")");
-
- m_assemblyData.CheckResNameConflict(name);
- m_assemblyData.CheckFileNameConflict(fileName);
-
- String fullFileName;
-
- if (m_assemblyData.m_strDir == null)
- {
- // If assembly directory is null, use current directory
- fullFileName = Path.Combine(Directory.GetCurrentDirectory(), fileName);
- }
- else
- {
- // Form the full path given the directory provided by user
- fullFileName = Path.Combine(m_assemblyData.m_strDir, fileName);
- }
-
- // get the full path
- fullFileName = Path.UnsafeGetFullPath(fullFileName);
-
- // retrieve just the file name
- fileName = Path.GetFileName(fullFileName);
-
- if (File.UnsafeExists(fullFileName) == false)
- throw new FileNotFoundException(Environment.GetResourceString(
- "IO.FileNotFound_FileName",
- fileName), fileName);
- m_assemblyData.AddResWriter( new ResWriterData( null, null, name, fileName, fullFileName, attribute) );
- }
-#endif // !FEATURE_CORECLR
-
#region object overrides
public override bool Equals(object obj)
{
#endregion
-#if !FEATURE_CORECLR
- /**********************************************
- *
- * Add an unmanaged Version resource to the
- * assembly
- *
- **********************************************/
- public void DefineVersionInfoResource(
- String product,
- String productVersion,
- String company,
- String copyright,
- String trademark)
- {
- lock(SyncRoot)
- {
- DefineVersionInfoResourceNoLock(
- product,
- productVersion,
- company,
- copyright,
- trademark);
- }
- }
-
- private void DefineVersionInfoResourceNoLock(
- String product,
- String productVersion,
- String company,
- String copyright,
- String trademark)
- {
- if (m_assemblyData.m_strResourceFileName != null ||
- m_assemblyData.m_resourceBytes != null ||
- m_assemblyData.m_nativeVersion != null)
- throw new ArgumentException(Environment.GetResourceString("Argument_NativeResourceAlreadyDefined"));
-
- m_assemblyData.m_nativeVersion = new NativeVersionInfo();
-
- m_assemblyData.m_nativeVersion.m_strCopyright = copyright;
- m_assemblyData.m_nativeVersion.m_strTrademark = trademark;
- m_assemblyData.m_nativeVersion.m_strCompany = company;
- m_assemblyData.m_nativeVersion.m_strProduct = product;
- m_assemblyData.m_nativeVersion.m_strProductVersion = productVersion;
- m_assemblyData.m_hasUnmanagedVersionInfo = true;
- m_assemblyData.m_OverrideUnmanagedVersionInfo = true;
-
- }
-
- public void DefineVersionInfoResource()
- {
- lock(SyncRoot)
- {
- DefineVersionInfoResourceNoLock();
- }
- }
-
- private void DefineVersionInfoResourceNoLock()
- {
- if (m_assemblyData.m_strResourceFileName != null ||
- m_assemblyData.m_resourceBytes != null ||
- m_assemblyData.m_nativeVersion != null)
- throw new ArgumentException(Environment.GetResourceString("Argument_NativeResourceAlreadyDefined"));
-
- m_assemblyData.m_hasUnmanagedVersionInfo = true;
- m_assemblyData.m_nativeVersion = new NativeVersionInfo();
- }
-
- public void DefineUnmanagedResource(Byte[] resource)
- {
- if (resource == null)
- throw new ArgumentNullException(nameof(resource));
- Contract.EndContractBlock();
-
- lock(SyncRoot)
- {
- DefineUnmanagedResourceNoLock(resource);
- }
- }
-
- private void DefineUnmanagedResourceNoLock(Byte[] resource)
- {
- if (m_assemblyData.m_strResourceFileName != null ||
- m_assemblyData.m_resourceBytes != null ||
- m_assemblyData.m_nativeVersion != null)
- throw new ArgumentException(Environment.GetResourceString("Argument_NativeResourceAlreadyDefined"));
-
- m_assemblyData.m_resourceBytes = new byte[resource.Length];
- Buffer.BlockCopy(resource, 0, m_assemblyData.m_resourceBytes, 0, resource.Length);
- }
-
- public void DefineUnmanagedResource(String resourceFileName)
- {
- if (resourceFileName == null)
- throw new ArgumentNullException(nameof(resourceFileName));
- Contract.EndContractBlock();
-
- lock(SyncRoot)
- {
- DefineUnmanagedResourceNoLock(resourceFileName);
- }
- }
-
- private void DefineUnmanagedResourceNoLock(String resourceFileName)
- {
- if (m_assemblyData.m_strResourceFileName != null ||
- m_assemblyData.m_resourceBytes != null ||
- m_assemblyData.m_nativeVersion != null)
- throw new ArgumentException(Environment.GetResourceString("Argument_NativeResourceAlreadyDefined"));
-
- // Check caller has the right to read the file.
- string strFullFileName;
- if (m_assemblyData.m_strDir == null)
- {
- // If assembly directory is null, use current directory
- strFullFileName = Path.Combine(Directory.GetCurrentDirectory(), resourceFileName);
- }
- else
- {
- // Form the full path given the directory provided by user
- strFullFileName = Path.Combine(m_assemblyData.m_strDir, resourceFileName);
- }
- strFullFileName = Path.GetFullPath(resourceFileName);
- new FileIOPermission(FileIOPermissionAccess.Read, strFullFileName).Demand();
-
- if (File.Exists(strFullFileName) == false)
- throw new FileNotFoundException(Environment.GetResourceString(
- "IO.FileNotFound_FileName",
- resourceFileName), resourceFileName);
- m_assemblyData.m_strResourceFileName = strFullFileName;
- }
-#endif // !FEATURE_CORECLR
-
-
/**********************************************
*
* return a dynamic module with the specified name.
m_assemblyData.m_entryPointMethod = entryMethod;
m_assemblyData.m_peFileKind = fileKind;
-
-#if !FEATURE_CORECLR
- // Setting the entry point
- ModuleBuilder tmpMB = tmpModule as ModuleBuilder;
- if (tmpMB != null)
- m_assemblyData.m_entryPointModule = tmpMB;
- else
- m_assemblyData.m_entryPointModule = GetModuleBuilder((InternalModuleBuilder)tmpModule);
-
- MethodToken entryMethodToken = m_assemblyData.m_entryPointModule.GetMethodToken(entryMethod);
- m_assemblyData.m_entryPointModule.SetEntryPoint(entryMethodToken);
-#endif //!FEATURE_CORECLR
}
private void SaveNoLock(String assemblyFileName,
PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine)
{
- // AssemblyBuilderAccess.Save can never be set with FEATURE_CORECLR
+ // AssemblyBuilderAccess.Save can never be set in CoreCLR
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CantSaveTransientAssembly"));
}
**********************************************/
private AssemblyBuilder() {}
-#if !FEATURE_CORECLR
- void _AssemblyBuilder.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _AssemblyBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _AssemblyBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- // If you implement this method, make sure to include _AssemblyBuilder.Invoke in VM\DangerousAPIs.h and
- // include _AssemblyBuilder in SystemDomain::IsReflectionInvocationMethod in AppDomain.cpp.
- void _AssemblyBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
-
// Create a new module in which to emit code. This module will not contain the manifest.
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
[SuppressUnmanagedCodeSecurity]
// EE uses these enum values..look for m_dwDynamicAssemblyAccess in Assembly.hpp
namespace System.Reflection.Emit
-{
+{
[Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
[Flags]
public enum AssemblyBuilderAccess
{
Run = 1,
-#if !FEATURE_CORECLR // these are unsupported
- Save = 2,
- RunAndSave = Run | Save,
-#endif // !FEATURE_CORECLR
#if FEATURE_REFLECTION_ONLY_LOAD
ReflectionOnly = 6, // 4 | Save,
#endif // FEATURE_REFLECTION_ONLY_LOAD
using System.Security;
using System.Diagnostics;
using CultureInfo = System.Globalization.CultureInfo;
-#if !FEATURE_CORECLR
- using ResourceWriter = System.Resources.ResourceWriter;
-#else // FEATURE_CORECLR
using IResourceWriter = System.Resources.IResourceWriter;
-#endif // !FEATURE_CORECLR
using System.IO;
using System.Runtime.Versioning;
using System.Diagnostics.SymbolStore;
// hard coding the assembly def token
internal const int m_tkAssembly = 0x20000001;
-
+
// Security permission requests
internal PermissionSet m_RequiredPset;
internal PermissionSet m_OptionalPset;
internal MethodInfo m_entryPointMethod;
internal Assembly m_ISymWrapperAssembly;
-#if !FEATURE_CORECLR
- internal ModuleBuilder m_entryPointModule;
-#endif //!FEATURE_CORECLR
-
// For unmanaged resources
internal String m_strResourceFileName;
internal byte[] m_resourceBytes;
**********************************************/
internal class ResWriterData
{
-#if FEATURE_CORECLR
internal ResWriterData(
IResourceWriter resWriter,
Stream memoryStream,
m_nextResWriter = null;
m_attribute = attribute;
}
-#else
- internal ResWriterData(
- ResourceWriter resWriter,
- Stream memoryStream,
- String strName,
- String strFileName,
- String strFullFileName,
- ResourceAttributes attribute)
- {
- m_resWriter = resWriter;
- m_memoryStream = memoryStream;
- m_strName = strName;
- m_strFileName = strFileName;
- m_strFullFileName = strFullFileName;
- m_nextResWriter = null;
- m_attribute = attribute;
- }
-#endif
-#if !FEATURE_CORECLR
- internal ResourceWriter m_resWriter;
-#else // FEATURE_CORECLR
- internal IResourceWriter m_resWriter;
-#endif // !FEATURE_CORECLR
+
+ internal IResourceWriter m_resWriter;
internal String m_strName;
internal String m_strFileName;
internal String m_strFullFileName;
// 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;
-using System.Globalization;
-using System.IO;
-using System.Reflection;
-using System.Runtime.InteropServices;
-using System.Runtime.Serialization;
-using System.Security.Permissions;
-using System.Security.Policy;
-
namespace System.Runtime.InteropServices
{
[GuidAttribute("BEBB2505-8B54-3443-AEAD-142A16DD9CC7")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[CLSCompliant(false)]
[TypeLibImportClassAttribute(typeof(System.Reflection.Emit.AssemblyBuilder))]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public interface _AssemblyBuilder
{
-#if !FEATURE_CORECLR
- void GetTypeInfoCount(out uint pcTInfo);
-
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
-#endif
}
[GuidAttribute("ED3E4384-D7E2-3FA7-8FFD-8940D330519A")]
[System.Runtime.InteropServices.ComVisible(true)]
public interface _ConstructorBuilder
{
-#if !FEATURE_CORECLR
- void GetTypeInfoCount(out uint pcTInfo);
-
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
-#endif
}
[GuidAttribute("BE9ACCE8-AAFF-3B91-81AE-8211663F5CAD")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[CLSCompliant(false)]
[TypeLibImportClassAttribute(typeof(System.Reflection.Emit.CustomAttributeBuilder))]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public interface _CustomAttributeBuilder
{
-#if !FEATURE_CORECLR
- void GetTypeInfoCount(out uint pcTInfo);
-
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
-#endif
}
[GuidAttribute("C7BD73DE-9F85-3290-88EE-090B8BDFE2DF")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[CLSCompliant(false)]
[TypeLibImportClassAttribute(typeof(System.Reflection.Emit.EnumBuilder))]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public interface _EnumBuilder
{
-#if !FEATURE_CORECLR
- void GetTypeInfoCount(out uint pcTInfo);
-
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
-#endif
}
[GuidAttribute("AADABA99-895D-3D65-9760-B1F12621FAE8")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[CLSCompliant(false)]
[TypeLibImportClassAttribute(typeof(System.Reflection.Emit.EventBuilder))]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public interface _EventBuilder
{
-#if !FEATURE_CORECLR
- void GetTypeInfoCount(out uint pcTInfo);
-
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
-#endif
}
[GuidAttribute("CE1A3BF5-975E-30CC-97C9-1EF70F8F3993")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[CLSCompliant(false)]
[TypeLibImportClassAttribute(typeof(System.Reflection.Emit.FieldBuilder))]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public interface _FieldBuilder
{
-#if !FEATURE_CORECLR
- void GetTypeInfoCount(out uint pcTInfo);
-
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
-#endif
}
[GuidAttribute("A4924B27-6E3B-37F7-9B83-A4501955E6A7")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[CLSCompliant(false)]
[TypeLibImportClassAttribute(typeof(System.Reflection.Emit.ILGenerator))]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public interface _ILGenerator
{
-#if !FEATURE_CORECLR
- void GetTypeInfoCount(out uint pcTInfo);
-
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
-#endif
}
[GuidAttribute("4E6350D1-A08B-3DEC-9A3E-C465F9AEEC0C")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[CLSCompliant(false)]
[TypeLibImportClassAttribute(typeof(System.Reflection.Emit.LocalBuilder))]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public interface _LocalBuilder
{
-#if !FEATURE_CORECLR
- void GetTypeInfoCount(out uint pcTInfo);
-
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
-#endif
}
[GuidAttribute("007D8A14-FDF3-363E-9A0B-FEC0618260A2")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[CLSCompliant(false)]
[TypeLibImportClassAttribute(typeof(System.Reflection.Emit.MethodBuilder))]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public interface _MethodBuilder
{
-#if !FEATURE_CORECLR
- void GetTypeInfoCount(out uint pcTInfo);
-
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
-#endif
}
#if FEATURE_METHOD_RENTAL
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[CLSCompliant(false)]
[TypeLibImportClassAttribute(typeof(System.Reflection.Emit.MethodRental))]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public interface _MethodRental
{
-#if !FEATURE_CORECLR
- void GetTypeInfoCount(out uint pcTInfo);
-
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
-#endif
}
#endif
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[CLSCompliant(false)]
[TypeLibImportClassAttribute(typeof(System.Reflection.Emit.ModuleBuilder))]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public interface _ModuleBuilder
{
-#if !FEATURE_CORECLR
- void GetTypeInfoCount(out uint pcTInfo);
-
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
-#endif
}
[GuidAttribute("36329EBA-F97A-3565-BC07-0ED5C6EF19FC")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[CLSCompliant(false)]
[TypeLibImportClassAttribute(typeof(System.Reflection.Emit.ParameterBuilder))]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public interface _ParameterBuilder
{
-#if !FEATURE_CORECLR
- void GetTypeInfoCount(out uint pcTInfo);
-
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
-#endif
}
[GuidAttribute("15F9A479-9397-3A63-ACBD-F51977FB0F02")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[CLSCompliant(false)]
[TypeLibImportClassAttribute(typeof(System.Reflection.Emit.PropertyBuilder))]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public interface _PropertyBuilder
{
-#if !FEATURE_CORECLR
- void GetTypeInfoCount(out uint pcTInfo);
-
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
-#endif
}
[GuidAttribute("7D13DD37-5A04-393C-BBCA-A5FEA802893D")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[CLSCompliant(false)]
[TypeLibImportClassAttribute(typeof(System.Reflection.Emit.SignatureHelper))]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public interface _SignatureHelper
{
-#if !FEATURE_CORECLR
- void GetTypeInfoCount(out uint pcTInfo);
-
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
-#endif
}
[GuidAttribute("7E5678EE-48B3-3F83-B076-C58543498A58")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
[CLSCompliant(false)]
[TypeLibImportClassAttribute(typeof(System.Reflection.Emit.TypeBuilder))]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public interface _TypeBuilder
{
-#if !FEATURE_CORECLR
- void GetTypeInfoCount(out uint pcTInfo);
-
- void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo);
-
- void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
-
- void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
-#endif
}
-
}
}
#endregion
-
-#if !FEATURE_CORECLR
- void _ConstructorBuilder.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _ConstructorBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _ConstructorBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- void _ConstructorBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
}
}
typeof(System.Diagnostics.DebuggableAttribute) == m_con.DeclaringType);
}
-#if !FEATURE_CORECLR
- void _CustomAttributeBuilder.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _CustomAttributeBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _CustomAttributeBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- void _CustomAttributeBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
-
internal ConstructorInfo m_con;
internal Object[] m_constructorArgs;
internal byte[] m_blob;
CustomAttributeBuilder transparencyAttribute = new CustomAttributeBuilder(transparencyCtor, EmptyArray<Object>.Value);
List<CustomAttributeBuilder> assemblyAttributes = new List<CustomAttributeBuilder>();
assemblyAttributes.Add(transparencyAttribute);
-#if !FEATURE_CORECLR
- // On the desktop, we need to use the security rule set level 1 for anonymously hosted
- // dynamic methods. In level 2, transparency rules are strictly enforced, which leads to
- // errors when a fully trusted application causes a dynamic method to be generated that tries
- // to call a method with a LinkDemand or a SecurityCritical method. To retain compatibility
- // with the v2.0 and v3.x frameworks, these calls should be allowed.
- //
- // If this rule set was not explicitly called out, then the anonymously hosted dynamic methods
- // assembly would inherit the rule set from the creating assembly - which would cause it to
- // be level 2 because mscorlib.dll is using the level 2 rules.
- ConstructorInfo securityRulesCtor = typeof(SecurityRulesAttribute).GetConstructor(new Type[] { typeof(SecurityRuleSet) });
- CustomAttributeBuilder securityRulesAttribute =
- new CustomAttributeBuilder(securityRulesCtor, new object[] { SecurityRuleSet.Level1 });
- assemblyAttributes.Add(securityRulesAttribute);
-#endif // !FEATURE_CORECLR
AssemblyName assemblyName = new AssemblyName("Anonymously Hosted DynamicMethods Assembly");
StackCrawlMark stackMark = StackCrawlMark.LookForMe;
if (m == null)
throw new ArgumentNullException(nameof(m));
Contract.EndContractBlock();
-#if !FEATURE_CORECLR
-
- RuntimeModule rtModule;
- ModuleBuilder mb = m as ModuleBuilder;
- if (mb != null)
- rtModule = mb.InternalModule;
- else
- rtModule = m as RuntimeModule;
-
- if (rtModule == null)
- {
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeModule"), nameof(m));
- }
-
- // The user cannot explicitly use this assembly
- if (rtModule == s_anonymouslyHostedDynamicMethodsModule)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidValue"), nameof(m));
-
- // ask for member access if skip visibility
- if (skipVisibility)
- new ReflectionPermission(ReflectionPermissionFlag.MemberAccess).Demand();
-
-#if !FEATURE_CORECLR
- // ask for control evidence if outside of the caller assembly
- RuntimeType callingType = RuntimeMethodHandle.GetCallerType(ref stackMark);
- m_creatorAssembly = callingType.GetRuntimeAssembly();
- if (m.Assembly != m_creatorAssembly)
- {
- // Demand the permissions of the assembly where the DynamicMethod will live
- CodeAccessSecurityEngine.ReflectionTargetDemandHelper(PermissionType.SecurityControlEvidence,
- m.Assembly.PermissionSet);
- }
-#else //FEATURE_CORECLR
-#pragma warning disable 618
- new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
-#pragma warning restore 618
-#endif //FEATURE_CORECLR
-#endif //!FEATURE_CORECLR
}
private void PerformSecurityCheck(Type owner, ref StackCrawlMark stackMark, bool skipVisibility)
{
if (owner == null)
throw new ArgumentNullException(nameof(owner));
-#if !FEATURE_CORECLR
-
- RuntimeType rtOwner = owner as RuntimeType;
- if (rtOwner == null)
- rtOwner = owner.UnderlyingSystemType as RuntimeType;
-
- if (rtOwner == null)
- throw new ArgumentNullException(nameof(owner), Environment.GetResourceString("Argument_MustBeRuntimeType"));
-
- // get the type the call is coming from
- RuntimeType callingType = RuntimeMethodHandle.GetCallerType(ref stackMark);
-
- // ask for member access if skip visibility
- if (skipVisibility)
- new ReflectionPermission(ReflectionPermissionFlag.MemberAccess).Demand();
- else
- {
- // if the call is not coming from the same class ask for member access
- if (callingType != rtOwner)
- new ReflectionPermission(ReflectionPermissionFlag.MemberAccess).Demand();
- }
-#if !FEATURE_CORECLR
- m_creatorAssembly = callingType.GetRuntimeAssembly();
-
- // ask for control evidence if outside of the caller module
- if (rtOwner.Assembly != m_creatorAssembly)
- {
- // Demand the permissions of the assembly where the DynamicMethod will live
- CodeAccessSecurityEngine.ReflectionTargetDemandHelper(PermissionType.SecurityControlEvidence,
- owner.Assembly.PermissionSet);
- }
-#else //FEATURE_CORECLR
-#pragma warning disable 618
- new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
-#pragma warning restore 618
-#endif //FEATURE_CORECLR
-#endif //!FEATURE_CORECLR
}
//
public override bool IsSecurityCritical
{
-#if FEATURE_CORECLR
get { return true; }
-#else
- get
- {
- if (m_methodHandle != null)
- {
- return RuntimeMethodHandle.IsSecurityCritical(m_methodHandle);
- }
- else if (m_typeOwner != null)
- {
- RuntimeAssembly assembly = m_typeOwner.Assembly as RuntimeAssembly;
- Contract.Assert(assembly != null);
-
- return assembly.IsAllSecurityCritical();
- }
- else
- {
- RuntimeAssembly assembly = m_module.Assembly as RuntimeAssembly;
- Contract.Assert(assembly != null);
-
- return assembly.IsAllSecurityCritical();
- }
- }
-#endif
}
public override bool IsSecuritySafeCritical
{
-#if FEATURE_CORECLR
get { return false; }
-#else
- get
- {
- if (m_methodHandle != null)
- {
- return RuntimeMethodHandle.IsSecuritySafeCritical(m_methodHandle);
- }
- else if (m_typeOwner != null)
- {
- RuntimeAssembly assembly = m_typeOwner.Assembly as RuntimeAssembly;
- Contract.Assert(assembly != null);
-
- return assembly.IsAllPublicAreaSecuritySafeCritical();
- }
- else
- {
- RuntimeAssembly assembly = m_module.Assembly as RuntimeAssembly;
- Contract.Assert(assembly != null);
-
- return assembly.IsAllSecuritySafeCritical();
- }
- }
-#endif
}
public override bool IsSecurityTransparent
{
-#if FEATURE_CORECLR
get { return false; }
-#else
- get
- {
- if (m_methodHandle != null)
- {
- return RuntimeMethodHandle.IsSecurityTransparent(m_methodHandle);
- }
- else if (m_typeOwner != null)
- {
- RuntimeAssembly assembly = m_typeOwner.Assembly as RuntimeAssembly;
- Contract.Assert(assembly != null);
-
- return !assembly.IsAllSecurityCritical();
- }
- else
- {
- RuntimeAssembly assembly = m_module.Assembly as RuntimeAssembly;
- Contract.Assert(assembly != null);
-
- return !assembly.IsAllSecurityCritical();
- }
- }
-#endif
}
public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) {
m_underlyingField = m_typeBuilder.DefineField("value__", underlyingType, FieldAttributes.Public | FieldAttributes.SpecialName | FieldAttributes.RTSpecialName);
}
-#if !FEATURE_CORECLR
- void _EnumBuilder.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _EnumBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _EnumBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- void _EnumBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
-
-
/*****************************************************
*
* private data members
customBuilder.CreateCustomAttribute(m_module, m_evToken.Token);
}
-#if !FEATURE_CORECLR
- void _EventBuilder.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _EventBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _EventBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- void _EventBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
-
-
// These are package private so that TypeBuilder can access them.
private String m_name; // The name of the event
private EventToken m_evToken; // The token of this event
private EventAttributes m_attributes;
private TypeBuilder m_type;
}
-
-
-
-
}
}
#endregion
-
-#if !FEATURE_CORECLR
- void _FieldBuilder.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _FieldBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _FieldBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- void _FieldBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
}
}
#endregion
#endregion
-
-#if !FEATURE_CORECLR
- void _ILGenerator.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _ILGenerator.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _ILGenerator.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- void _ILGenerator.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
}
internal struct __FixupData
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-//
-
-#if FEATURE_CORECLR
-
namespace System.Reflection.Emit
{
using System;
using System.Runtime.CompilerServices;
using System.Diagnostics.SymbolStore;
-
//-----------------------------------------------------------------------------------
// On Telesto, we don't ship the ISymWrapper.dll assembly. However, ReflectionEmit
// relies on that assembly to write out managed PDBs.
m_Release = (DRelease)(Marshal.GetDelegateForFunctionPointer(nGetDReleaseTarget(), typeof(DRelease)));
m_Release((IntPtr)0); // make one call to make sure the delegate is fully prepped before we're in the critical finalizer situation.
}
-
} // PunkSafeHandle
-
} //namespace System.Reflection.Emit
-
-
-#endif //FEATURE_CORECLR
-
}
}
#endregion
-
-#if !FEATURE_CORECLR
- void _LocalBuilder.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _LocalBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _LocalBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- void _LocalBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
}
}
[HostProtection(MayLeakOnAbort = true)]
[ClassInterface(ClassInterfaceType.None)]
[ComDefaultInterface(typeof(_MethodBuilder))]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public sealed class MethodBuilder : MethodInfo, _MethodBuilder
{
#region Private Data Members
public override bool IsSecurityCritical
{
-#if FEATURE_CORECLR
get { return true; }
-#else
- get { throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule")); }
-#endif
}
public override bool IsSecuritySafeCritical
{
-#if FEATURE_CORECLR
get { return false; }
-#else
- get { throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule")); }
-#endif
}
public override bool IsSecurityTransparent
{
-#if FEATURE_CORECLR
get { return false; }
-#else
- get { throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule")); }
-#endif
}
#endregion
internal bool m_isDllImport = false;
#endregion
-
-#if !FEATURE_CORECLR
- void _MethodBuilder.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _MethodBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _MethodBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- void _MethodBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
-
}
internal class LocalSymInfo
private Dictionary<string, Type> m_TypeBuilderDict;
private ISymbolWriter m_iSymWriter;
internal ModuleBuilderData m_moduleData;
-#if !FEATURE_CORECLR
- private MethodToken m_EntryPoint;
-#endif //!FEATURE_CORECLR
internal InternalModuleBuilder m_internalModuleBuilder;
// This is the "external" AssemblyBuilder
// only the "external" ModuleBuilder has this set
return null;
}
-
-#if !FEATURE_CORECLR
- internal void SetEntryPoint(MethodToken entryPoint)
- {
- // Sets the entry point of the module to be a given method. If no entry point
- // is specified, calling EmitPEFile will generate a dll.
- // AssemblyBuilder.SetEntryPoint has already demanded required permission
- m_EntryPoint = entryPoint;
- }
-#endif //!FEATURE_CORECLR
-
-
-#if !FEATURE_CORECLR
- // This is a helper called by AssemblyBuilder save to presave information for the persistable modules.
- // no need to lock here because we have already taken the lock in AssemblyBuilder.Save
- internal void PreSave(String fileName,
- PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine)
- {
- if (m_moduleData.m_isSaved == true)
- {
- // can only save once
- throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture,
- Environment.GetResourceString("InvalidOperation_ModuleHasBeenSaved"),
- m_moduleData.m_strModuleName));
- }
-
- if (m_moduleData.m_fGlobalBeenCreated == false && m_moduleData.m_fHasGlobal == true)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_GlobalFunctionNotBaked"));
-
- TypeBuilder typeBuilder;
- foreach (Type item in m_TypeBuilderDict.Values)
- {
- if (item is TypeBuilder)
- {
- typeBuilder = (TypeBuilder)item;
- }
- else
- {
- EnumBuilder enumBuilder = (EnumBuilder)item;
- typeBuilder = enumBuilder.m_typeBuilder;
- }
-
- if (!typeBuilder.IsCreated())
- {
- // cannot save to PE file without creating all of the types first
- throw new NotSupportedException(String.Format(CultureInfo.InvariantCulture,
- Environment.GetResourceString("NotSupported_NotAllTypesAreBaked"),
- typeBuilder.FullName));
- }
- }
-
- PreSavePEFile(GetNativeHandle(), (int)portableExecutableKind, (int)imageFileMachine);
- }
-
- // no need to lock here because we have already taken the lock in AssemblyBuilder.Save
- internal void Save(String fileName, bool isAssemblyFile, PortableExecutableKinds portableExecutableKind,
- ImageFileMachine imageFileMachine)
- {
- // This is a helper called by AssemblyBuilder save to save information for the persistable modules.
- if (m_moduleData.m_embeddedRes != null)
- {
- // There are embedded resources for this module
- ResWriterData resWriter;
-
- // Add each resource content into the to be saved PE file
- for (resWriter = m_moduleData.m_embeddedRes; resWriter != null; resWriter = resWriter.m_nextResWriter)
- {
- if (resWriter.m_resWriter != null)
- resWriter.m_resWriter.Generate();
-
- byte[] resBytes = new byte[resWriter.m_memoryStream.Length];
- resWriter.m_memoryStream.Flush();
- resWriter.m_memoryStream.Position = 0;
- resWriter.m_memoryStream.Read(resBytes, 0, resBytes.Length);
-
- AddResource(GetNativeHandle(),
- resWriter.m_strName,
- resBytes,
- resBytes.Length,
- m_moduleData.FileToken,
- (int)resWriter.m_attribute,
- (int)portableExecutableKind,
- (int)imageFileMachine);
- }
- }
-
- DefineNativeResource(portableExecutableKind, imageFileMachine);
-
- PEFileKinds pekind = isAssemblyFile ? ContainingAssemblyBuilder.m_assemblyData.m_peFileKind : PEFileKinds.Dll;
-
- SavePEFile(GetNativeHandle(), fileName, m_EntryPoint.Token, (int)pekind, isAssemblyFile);
-
- m_moduleData.m_isSaved = true;
- }
-#endif // !FEATURE_CORECLR
private int GetTypeRefNested(Type type, Module refedModule, String strRefedModuleFileName)
{
#endregion
#region Define Resource
-#if !FEATURE_CORECLR
- public IResourceWriter DefineResource(String name, String description)
- {
- // Define embedded managed resource to be stored in this module
- Contract.Ensures(Contract.Result<IResourceWriter>() != null);
-
- return DefineResource(name, description, ResourceAttributes.Public);
- }
-
- public IResourceWriter DefineResource(String name, String description, ResourceAttributes attribute)
- {
- // Define embedded managed resource to be stored in this module
- Contract.Ensures(Contract.Result<IResourceWriter>() != null);
-
- lock(SyncRoot)
- {
- return DefineResourceNoLock(name, description, attribute);
- }
- }
-
- private IResourceWriter DefineResourceNoLock(String name, String description, ResourceAttributes attribute)
- {
- // Define embedded managed resource to be stored in this module
-
- if (IsTransient())
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadResourceContainer"));
-
- if (name == null)
- throw new ArgumentNullException(nameof(name));
- if (name.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(name));
- Contract.Ensures(Contract.Result<IResourceWriter>() != null);
- Contract.EndContractBlock();
-
- if (m_assemblyBuilder.IsPersistable())
- {
- m_assemblyBuilder.m_assemblyData.CheckResNameConflict(name);
-
- MemoryStream stream = new MemoryStream();
- ResourceWriter resWriter = new ResourceWriter(stream);
- ResWriterData resWriterData = new ResWriterData( resWriter, stream, name, String.Empty, String.Empty, attribute);
-
- // chain it to the embedded resource list
- resWriterData.m_nextResWriter = m_moduleData.m_embeddedRes;
- m_moduleData.m_embeddedRes = resWriterData;
- return resWriter;
- }
- else
- {
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadResourceContainer"));
- }
- }
-
- public void DefineManifestResource(String name, Stream stream, ResourceAttributes attribute)
- {
- if (name == null)
- throw new ArgumentNullException(nameof(name));
-
- if (stream == null)
- throw new ArgumentNullException(nameof(stream));
- Contract.EndContractBlock();
-
- // Define embedded managed resource to be stored in this module
- lock(SyncRoot)
- {
- DefineManifestResourceNoLock(name, stream, attribute);
- }
- }
-
- private void DefineManifestResourceNoLock(String name, Stream stream, ResourceAttributes attribute)
- {
- // Define embedded managed resource to be stored in this module
- if (IsTransient())
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadResourceContainer"));
- Contract.EndContractBlock();
-
- if (name == null)
- throw new ArgumentNullException(nameof(name));
- if (name.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(name));
-
- if (m_assemblyBuilder.IsPersistable())
- {
- m_assemblyBuilder.m_assemblyData.CheckResNameConflict(name);
-
- ResWriterData resWriterData = new ResWriterData( null, stream, name, String.Empty, String.Empty, attribute);
-
- // chain it to the embedded resource list
- resWriterData.m_nextResWriter = m_moduleData.m_embeddedRes;
- m_moduleData.m_embeddedRes = resWriterData;
- }
- else
- {
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadResourceContainer"));
- }
- }
-
-
- public void DefineUnmanagedResource(Byte[] resource)
- {
- lock(SyncRoot)
- {
- DefineUnmanagedResourceInternalNoLock(resource);
- }
- }
-
- internal void DefineUnmanagedResourceInternalNoLock(Byte[] resource)
- {
- if (resource == null)
- throw new ArgumentNullException(nameof(resource));
- Contract.EndContractBlock();
-
- if (m_moduleData.m_strResourceFileName != null || m_moduleData.m_resourceBytes != null)
- throw new ArgumentException(Environment.GetResourceString("Argument_NativeResourceAlreadyDefined"));
-
- m_moduleData.m_resourceBytes = new byte[resource.Length];
- Buffer.BlockCopy(resource, 0, m_moduleData.m_resourceBytes, 0, resource.Length);
- }
-
- public void DefineUnmanagedResource(String resourceFileName)
- {
- lock(SyncRoot)
- {
- DefineUnmanagedResourceFileInternalNoLock(resourceFileName);
- }
- }
-
- internal void DefineUnmanagedResourceFileInternalNoLock(String resourceFileName)
- {
- if (resourceFileName == null)
- throw new ArgumentNullException(nameof(resourceFileName));
- Contract.EndContractBlock();
-
- if (m_moduleData.m_resourceBytes != null || m_moduleData.m_strResourceFileName != null)
- throw new ArgumentException(Environment.GetResourceString("Argument_NativeResourceAlreadyDefined"));
-
- // Check caller has the right to read the file.
- string strFullFileName;
- strFullFileName = Path.UnsafeGetFullPath(resourceFileName);
- new FileIOPermission(FileIOPermissionAccess.Read, strFullFileName).Demand();
-
- new EnvironmentPermission(PermissionState.Unrestricted).Assert();
- try
- {
- if (File.UnsafeExists(resourceFileName) == false)
- throw new FileNotFoundException(Environment.GetResourceString(
- "IO.FileNotFound_FileName",
- resourceFileName), resourceFileName);
- }
- finally
- {
- CodeAccessPermission.RevertAssert();
- }
-
- m_moduleData.m_strResourceFileName = strFullFileName;
- }
-#endif // !FEATURE_CORECLR
#endregion
#region Define Global Method
//
ModuleBuilder refedModuleBuilder = refedModule as ModuleBuilder;
-#if !FEATURE_CORECLR
- Contract.Assert(refedModuleBuilder != null || refedModule is RuntimeModule);
- bool isRefedModuleTransient = refedModuleBuilder != null ?
- refedModuleBuilder.IsTransient() :
- ((RuntimeModule)refedModule).IsTransientInternal();
-
- // We cannot have a non-transient module referencing to a transient module.
- if (IsTransient() == false && isRefedModuleTransient)
- {
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadTransientModuleReference"));
- }
-#endif // !FEATURE_CORECLR
-
String strRefedModuleFileName = String.Empty;
if (refedModule.Assembly.Equals(this.Assembly))
{
internal const int StackChangeShift = 28; // XXXX0000000000000000000000000000
-#if FEATURE_CORECLR
private OpCodeValues m_value;
private int m_flags;
}
}
-
public StackBehaviour StackBehaviourPop
{
get
return (short)m_value;
}
}
-#else // FEATURE_CORECLR
- //
- // The exact layout is part of the legacy COM mscorlib surface, so it is
- // pretty much set in stone for desktop CLR. Ideally, we would use the packed
- // bit field like for CoreCLR, but that would be a breaking change.
- //
-
-// disable csharp compiler warning #0414: field assigned unused value
-#pragma warning disable 0414
- private String m_stringname; // not used - computed lazily
-#pragma warning restore 0414
- private StackBehaviour m_pop;
- private StackBehaviour m_push;
- private OperandType m_operand;
- private OpCodeType m_type;
- private int m_size;
- private byte m_s1;
- private byte m_s2;
- private FlowControl m_ctrl;
-
- // Specifies whether the current instructions causes the control flow to
- // change unconditionally.
- private bool m_endsUncondJmpBlk;
-
-
- // Specifies the stack change that the current instruction causes not
- // taking into account the operand dependant stack changes.
- private int m_stackChange;
-
-
- internal OpCode(OpCodeValues value, int flags)
- {
- m_stringname = null; // computed lazily
- m_pop = (StackBehaviour)((flags >> StackBehaviourPopShift) & StackBehaviourMask);
- m_push = (StackBehaviour)((flags >> StackBehaviourPushShift) & StackBehaviourMask);
- m_operand = (OperandType)(flags & OperandTypeMask);
- m_type = (OpCodeType)((flags >> OpCodeTypeShift) & OpCodeTypeMask);
- m_size = (flags >> SizeShift) & SizeMask;
- m_s1 = (byte)((int)value >> 8);
- m_s2 = (byte)(int)value;
- m_ctrl = (FlowControl)((flags >> FlowControlShift) & FlowControlMask);
- m_endsUncondJmpBlk = (flags & EndsUncondJmpBlkFlag) != 0;
- m_stackChange = (flags >> StackChangeShift);
- }
-
- internal bool EndsUncondJmpBlk()
- {
- return m_endsUncondJmpBlk;
- }
-
- internal int StackChange()
- {
- return m_stackChange;
- }
-
- public OperandType OperandType
- {
- get
- {
- return (m_operand);
- }
- }
-
- public FlowControl FlowControl
- {
- get
- {
- return (m_ctrl);
- }
- }
-
- public OpCodeType OpCodeType
- {
- get
- {
- return (m_type);
- }
- }
-
-
- public StackBehaviour StackBehaviourPop
- {
- get
- {
- return (m_pop);
- }
- }
-
- public StackBehaviour StackBehaviourPush
- {
- get
- {
- return (m_push);
- }
- }
-
- public int Size
- {
- get
- {
- return (m_size);
- }
- }
-
- public short Value
- {
- get
- {
- if (m_size == 2)
- return (short)(m_s1 << 8 | m_s2);
- return (short)m_s2;
- }
- }
-#endif // FEATURE_CORECLR
-
private static volatile string[] g_nameCache;
return Name;
}
}
-
}
return m_pdToken;
}
-#if !FEATURE_CORECLR
- void _ParameterBuilder.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _ParameterBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _ParameterBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- void _ParameterBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
-
internal int MetadataTokenInternal { get { return m_pdToken.Token; } }
public virtual String Name {
throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
}
-#if !FEATURE_CORECLR
- void _PropertyBuilder.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _PropertyBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _PropertyBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- void _PropertyBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
-
public override String Name {
get { return m_name; }
}
private MethodInfo m_setMethod;
private TypeBuilder m_containingType;
}
-
}
#endregion
-#if !FEATURE_CORECLR
- void _SignatureHelper.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _SignatureHelper.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _SignatureHelper.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- void _SignatureHelper.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
-
}
}
if ((m_iPackingSize != 0) ||(m_iTypeSize != 0))
SetClassLayout(GetModuleBuilder().GetNativeHandle(), m_tdType.Token, m_iPackingSize, m_iTypeSize);
-#if !FEATURE_CORECLR
- // If the type is public and it is contained in a assemblyBuilder,
- // update the public COMType list.
- if (IsPublicComType(this))
- {
- if (containingAssem.IsPersistable() && m_module.IsTransient() == false)
- {
- // This will throw InvalidOperationException if the assembly has been saved
- // Ideally we should reject all emit operations if the assembly has been saved,
- // but that would be a breaking change for some. Currently you cannot define
- // modules and public types, but you can still define private types and global methods.
- containingAssem.m_assemblyData.AddPublicComType(this);
- }
-
- // Now add the type to the ExportedType table
- if (!m_module.Equals(containingAssem.ManifestModule))
- containingAssem.DefineExportedTypeInMemory(this, m_module.m_moduleData.FileToken, m_tdType.Token);
- }
-#endif
m_module.AddType(FullName, this);
}
public override bool IsSecurityCritical
{
-#if FEATURE_CORECLR
get { return true; }
-#else
- get
- {
- if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
- Contract.EndContractBlock();
-
- return m_bakedRuntimeType.IsSecurityCritical;
- }
-#endif
}
public override bool IsSecuritySafeCritical
{
-#if FEATURE_CORECLR
get { return false; }
-#else
- get
- {
- if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
- Contract.EndContractBlock();
-
- return m_bakedRuntimeType.IsSecuritySafeCritical;
- }
-#endif
}
public override bool IsSecurityTransparent
{
-#if FEATURE_CORECLR
get { return false; }
-#else
- get
- {
- if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
- Contract.EndContractBlock();
-
- return m_bakedRuntimeType.IsSecurityTransparent;
- }
-#endif
}
[System.Runtime.InteropServices.ComVisible(true)]
#endregion
#endregion
-
-#if !FEATURE_CORECLR
- void _TypeBuilder.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _TypeBuilder.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _TypeBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- void _TypeBuilder.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
}
}
}
}
#endregion
-
-#if !FEATURE_CORECLR
- Type _EventInfo.GetType()
- {
- return base.GetType();
- }
-
- void _EventInfo.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _EventInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _EventInfo.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- // If you implement this method, make sure to include _EventInfo.Invoke in VM\DangerousAPIs.h and
- // include _EventInfo in SystemDomain::IsReflectionInvocationMethod in AppDomain.cpp.
- void _EventInfo.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
}
[Serializable]
}
#endregion
-
-#if !FEATURE_CORECLR
- Type _FieldInfo.GetType()
- {
- return base.GetType();
- }
-
- void _FieldInfo.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _FieldInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _FieldInfo.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- // If you implement this method, make sure to include _FieldInfo.Invoke in VM\DangerousAPIs.h and
- // include _FieldInfo in SystemDomain::IsReflectionInvocationMethod in AppDomain.cpp.
- void _FieldInfo.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
}
[Serializable]
{
return base.GetHashCode();
}
-
-#if !FEATURE_CORECLR
- // this method is required so Object.GetType is not made final virtual by the compiler
- Type _MemberInfo.GetType()
- {
- return base.GetType();
- }
-
- void _MemberInfo.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _MemberInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _MemberInfo.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- void _MemberInfo.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
}
}
return copyOfParameters;
}
#endregion
-
- #region _MethodBase Implementation
-#if !FEATURE_CORECLR
- Type _MethodBase.GetType() { return base.GetType(); }
- bool _MethodBase.IsPublic { get { return IsPublic; } }
- bool _MethodBase.IsPrivate { get { return IsPrivate; } }
- bool _MethodBase.IsFamily { get { return IsFamily; } }
- bool _MethodBase.IsAssembly { get { return IsAssembly; } }
- bool _MethodBase.IsFamilyAndAssembly { get { return IsFamilyAndAssembly; } }
- bool _MethodBase.IsFamilyOrAssembly { get { return IsFamilyOrAssembly; } }
- bool _MethodBase.IsStatic { get { return IsStatic; } }
- bool _MethodBase.IsFinal { get { return IsFinal; } }
- bool _MethodBase.IsVirtual { get { return IsVirtual; } }
- bool _MethodBase.IsHideBySig { get { return IsHideBySig; } }
- bool _MethodBase.IsAbstract { get { return IsAbstract; } }
- bool _MethodBase.IsSpecialName { get { return IsSpecialName; } }
- bool _MethodBase.IsConstructor { get { return IsConstructor; } }
-
- void _MethodBase.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _MethodBase.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _MethodBase.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- // If you implement this method, make sure to include _MethodBase.Invoke in VM\DangerousAPIs.h and
- // include _MethodBase in SystemDomain::IsReflectionInvocationMethod in AppDomain.cpp.
- void _MethodBase.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
- #endregion
}
-
}
public virtual Delegate CreateDelegate(Type delegateType) { throw new NotSupportedException(Environment.GetResourceString("NotSupported_SubclassOverride")); }
public virtual Delegate CreateDelegate(Type delegateType, Object target) { throw new NotSupportedException(Environment.GetResourceString("NotSupported_SubclassOverride")); }
#endregion
-
-#if !FEATURE_CORECLR
- Type _MethodInfo.GetType()
- {
- return base.GetType();
- }
-
- void _MethodInfo.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _MethodInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _MethodInfo.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- // If you implement this method, make sure to include _MethodInfo.Invoke in VM\DangerousAPIs.h and
- // include _MethodInfo in SystemDomain::IsReflectionInvocationMethod in AppDomain.cpp.
- void _MethodInfo.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
}
[Serializable]
public override bool IsSecurityCritical
{
-#if FEATURE_CORECLR
get { return true; }
-#else
- get { return RuntimeMethodHandle.IsSecurityCritical(this); }
-#endif
}
public override bool IsSecuritySafeCritical
{
-#if FEATURE_CORECLR
get { return false; }
-#else
- get { return RuntimeMethodHandle.IsSecuritySafeCritical(this); }
-#endif
}
public override bool IsSecurityTransparent
{
-#if FEATURE_CORECLR
get { return false; }
-#else
- get { return RuntimeMethodHandle.IsSecurityTransparent(this); }
-#endif
}
#endregion
}
}
-#if !FEATURE_CORECLR
-#pragma warning disable 618
- [ReflectionPermissionAttribute(SecurityAction.Demand, Flags = ReflectionPermissionFlag.MemberAccess)]
-#pragma warning restore 618
-#endif
public override MethodBody GetMethodBody()
{
MethodBody mb = RuntimeMethodHandle.GetMethodBody(this, ReflectedTypeInternal);
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_APIInvalidForCurrentContext", FullName));
}
#endif
-
-#if !FEATURE_CORECLR
- if ((invocationFlags & (INVOCATION_FLAGS.INVOCATION_FLAGS_RISKY_METHOD | INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY)) != 0)
- {
- if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_RISKY_METHOD) != 0)
- CodeAccessPermission.Demand(PermissionType.ReflectionMemberAccess);
-
- if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY) != 0)
- RuntimeMethodHandle.PerformSecurityCheck(obj, this, m_declaringType, (uint)m_invocationFlags);
- }
-#endif // !FEATURE_CORECLR
#endregion
return UnsafeInvokeInternal(obj, parameters, arguments);
#region _ParameterInfo implementation
-#if !FEATURE_CORECLR
- void _ParameterInfo.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _ParameterInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _ParameterInfo.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- void _ParameterInfo.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
-
#endregion
#region IObjectReference
public bool IsSpecialName { get { return(Attributes & PropertyAttributes.SpecialName) != 0; } }
#endregion
-
-#if !FEATURE_CORECLR
- Type _PropertyInfo.GetType()
- {
- return base.GetType();
- }
-
- void _PropertyInfo.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _PropertyInfo.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _PropertyInfo.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- // If you implement this method, make sure to include _PropertyInfo.Invoke in VM\DangerousAPIs.h and
- // include _PropertyInfo in SystemDomain::IsReflectionInvocationMethod in AppDomain.cpp.
- void _PropertyInfo.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
}
[Serializable]
using System.Runtime.Versioning;
using Microsoft.Win32;
using System.Diagnostics.Contracts;
-#if !FEATURE_CORECLR
- using Microsoft.Runtime.Hosting;
-#endif
[Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
_publicKey = (byte[]) info.GetValue("_publicKey", typeof(byte[]));
}
-#if! FEATURE_CORECLR
- // Reference key pair in named key container.
- public StrongNameKeyPair(String keyPairContainer)
- {
- if (keyPairContainer == null)
- throw new ArgumentNullException(nameof(keyPairContainer));
- Contract.EndContractBlock();
-
- _keyPairContainer = keyPairContainer;
-
- _keyPairExported = false;
- }
-
- // Get the public portion of the key pair.
- public byte[] PublicKey
- {
- get
- {
- if (_publicKey == null)
- {
- _publicKey = ComputePublicKey();
- }
-
- byte[] publicKey = new byte[_publicKey.Length];
- Array.Copy(_publicKey, publicKey, _publicKey.Length);
-
- return publicKey;
- }
- }
-
- private unsafe byte[] ComputePublicKey()
- {
- byte[] publicKey = null;
-
- // Make sure pbPublicKey is not leaked with async exceptions
- RuntimeHelpers.PrepareConstrainedRegions();
- try {
- }
- finally
- {
- IntPtr pbPublicKey = IntPtr.Zero;
- int cbPublicKey = 0;
-
- try
- {
- bool result;
- if (_keyPairExported)
- {
- result = StrongNameHelpers.StrongNameGetPublicKey(null, _keyPairArray, _keyPairArray.Length,
- out pbPublicKey, out cbPublicKey);
- }
- else
- {
- result = StrongNameHelpers.StrongNameGetPublicKey(_keyPairContainer, null, 0,
- out pbPublicKey, out cbPublicKey);
- }
- if (!result)
- throw new ArgumentException(Environment.GetResourceString("Argument_StrongNameGetPublicKey"));
-
- publicKey = new byte[cbPublicKey];
- Buffer.Memcpy(publicKey, 0, (byte*)(pbPublicKey.ToPointer()), 0, cbPublicKey);
- }
- finally
- {
- if (pbPublicKey != IntPtr.Zero)
- StrongNameHelpers.StrongNameFreeBuffer(pbPublicKey);
- }
- }
- return publicKey;
- }
- // Internal routine used to retrieve key pair info from unmanaged code.
- private bool GetKeyPair(out Object arrayOrContainer)
- {
- arrayOrContainer = _keyPairExported ? (Object)_keyPairArray : (Object)_keyPairContainer;
- return _keyPairExported;
- }
-#else
public StrongNameKeyPair(String keyPairContainer)
{
throw new PlatformNotSupportedException();
}
}
-#endif// FEATURE_CORECLR
-
/// <internalonly/>
void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context) {
info.AddValue("_keyPairExported", _keyPairExported);
/// <internalonly/>
void IDeserializationCallback.OnDeserialization (Object sender) {}
-
}
}
}
}
-#if !FEATURE_CORECLR // PAL doesn't support eventing, and we don't compile event providers for coreclr
- public bool HasNeutralResources(CultureInfo culture, String defaultResName)
- {
- // Detect missing neutral locale resources.
- String defaultResPath = FindResourceFile(culture, defaultResName);
- if (defaultResPath == null || !File.Exists(defaultResPath))
- {
- String dir = _mediator.ModuleDir;
- if (defaultResPath != null)
- {
- dir = Path.GetDirectoryName(defaultResPath);
- }
- return false;
- }
- return true;
- }
-#endif
-
// Given a CultureInfo, it generates the path &; file name for
// the .resources file for that CultureInfo. This method will grovel
// the disk looking for the correct file name & path. Uses CultureInfo's
{
ResourceSet GrovelForResourceSet(CultureInfo culture, Dictionary<String, ResourceSet> localResourceSets, bool tryParents,
bool createIfNotExists, ref StackCrawlMark stackMark);
-
-#if !FEATURE_CORECLR // PAL doesn't support eventing, and we don't compile event providers for coreclr
-
- bool HasNeutralResources(CultureInfo culture, String defaultResName);
-#endif
}
}
using System.Diagnostics.Contracts;
using Microsoft.Win32;
-#if !FEATURE_CORECLR
- using System.Diagnostics.Tracing;
-#endif
-
//
// Note: this type is integral to the construction of exception objects,
// and sometimes this has to be done in low memory situtations (OOM) or
// want to add it twice.
lock (localResourceSets)
{
- if (localResourceSets.TryGetValue(culture.Name, out rs))
- {
-#if !FEATURE_CORECLR
- if (FrameworkEventSource.IsInitialized)
- {
- FrameworkEventSource.Log.ResourceManagerFoundResourceSetInCacheUnexpected(_mediator.BaseName, _mediator.MainAssembly, culture.Name);
- }
-#endif
- }
+ localResourceSets.TryGetValue(culture.Name, out rs);
}
stream = GetManifestResourceStream(satellite, fileName, ref stackMark);
}
-#if !FEATURE_CORECLR
- if (FrameworkEventSource.IsInitialized)
- {
- if (stream != null)
- {
- FrameworkEventSource.Log.ResourceManagerStreamFound(_mediator.BaseName, _mediator.MainAssembly, culture.Name, satellite, fileName);
- }
- else
- {
- FrameworkEventSource.Log.ResourceManagerStreamNotFound(_mediator.BaseName, _mediator.MainAssembly, culture.Name, satellite, fileName);
- }
- }
-#endif
-
// 4a. Found a stream; create a ResourceSet if possible
if (createIfNotExists && stream != null && rs == null)
{
-#if !FEATURE_CORECLR
- if (FrameworkEventSource.IsInitialized)
- {
- FrameworkEventSource.Log.ResourceManagerCreatingResourceSet(_mediator.BaseName, _mediator.MainAssembly, culture.Name, fileName);
- }
-#endif
rs = CreateResourceSet(stream, satellite);
}
else if (stream == null && tryParents)
}
}
-#if !FEATURE_CORECLR
- if (!createIfNotExists && stream != null && rs == null)
- {
- if (FrameworkEventSource.IsInitialized)
- {
- FrameworkEventSource.Log.ResourceManagerNotCreatingResourceSet(_mediator.BaseName, _mediator.MainAssembly, culture.Name);
- }
- }
-#endif
-
return rs;
}
-#if !FEATURE_CORECLR
- // Returns whether or not the main assembly contains a particular resource
- // file in it's assembly manifest. Used to verify that the neutral
- // Culture's .resources file is present in the main assembly
- public bool HasNeutralResources(CultureInfo culture, String defaultResName)
- {
- String resName = defaultResName;
- if (_mediator.LocationInfo != null && _mediator.LocationInfo.Namespace != null)
- resName = _mediator.LocationInfo.Namespace + Type.Delimiter + defaultResName;
- String[] resourceFiles = _mediator.MainAssembly.GetManifestResourceNames();
- foreach(String s in resourceFiles)
- if (s.Equals(resName))
- return true;
- return false;
- }
-#endif
-
private CultureInfo UltimateFallbackFixup(CultureInfo lookForCulture)
{
if (lookForCulture.Name == _mediator.NeutralResourcesCulture.Name &&
_mediator.FallbackLoc == UltimateResourceFallbackLocation.MainAssembly)
{
-#if !FEATURE_CORECLR
- if (FrameworkEventSource.IsInitialized)
- {
- FrameworkEventSource.Log.ResourceManagerNeutralResourcesSufficient(_mediator.BaseName, _mediator.MainAssembly, lookForCulture.Name);
- }
-#endif
-
returnCulture = CultureInfo.InvariantCulture;
}
else if (lookForCulture.HasInvariantCultureName && _mediator.FallbackLoc == UltimateResourceFallbackLocation.Satellite)
}
return returnCulture;
-
}
internal static CultureInfo GetNeutralResourcesLanguage(Assembly a, ref UltimateResourceFallbackLocation fallbackLocation)
fallbackLocation = (UltimateResourceFallbackLocation)fallback;
}
else {
-#if !FEATURE_CORECLR
- if (FrameworkEventSource.IsInitialized) {
- FrameworkEventSource.Log.ResourceManagerNeutralResourceAttributeMissing(a);
- }
-#endif
fallbackLocation = UltimateResourceFallbackLocation.MainAssembly;
return CultureInfo.InvariantCulture;
}
}
}
-#if !FEATURE_CORECLR
- if (FrameworkEventSource.IsInitialized)
- {
- if (canonicalName != null)
- {
- FrameworkEventSource.Log.ResourceManagerCaseInsensitiveResourceStreamLookupSucceeded(_mediator.BaseName, _mediator.MainAssembly, satellite.GetSimpleName(), givenName);
- }
- else
- {
- FrameworkEventSource.Log.ResourceManagerCaseInsensitiveResourceStreamLookupFailed(_mediator.BaseName, _mediator.MainAssembly, satellite.GetSimpleName(), givenName);
- }
- }
-#endif
-
if (canonicalName == null)
{
return null;
}
+
// If we're looking in the main assembly AND if the main
// assembly was the person who created the ResourceManager,
// skip a security check for private manifest resources.
bool canSkipSecurityCheck = _mediator.MainAssembly == satellite && _mediator.CallingAssembly == _mediator.MainAssembly;
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- Stream s = satellite.GetManifestResourceStream(canonicalName, ref stackMark, canSkipSecurityCheck);
- // GetManifestResourceStream will return null if we don't have
- // permission to read this stream from the assembly. For example,
- // if the stream is private and we're trying to access it from another
- // assembly (ie, ResMgr in mscorlib accessing anything else), we
- // require Reflection TypeInformation permission to be able to read
- // this.
-#if !FEATURE_CORECLR
- if (s!=null) {
- if (FrameworkEventSource.IsInitialized)
- {
- FrameworkEventSource.Log.ResourceManagerManifestResourceAccessDenied(_mediator.BaseName, _mediator.MainAssembly, satellite.GetSimpleName(), canonicalName);
- }
- }
-#endif
- return s;
+ return satellite.GetManifestResourceStream(canonicalName, ref stackMark, canSkipSecurityCheck);
}
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable
Contract.Assert(false, "[This assert catches satellite assembly build/deployment problems - report this message to your build lab & loc engineer]" + Environment.NewLine + "GetSatelliteAssembly failed for culture " + lookForCulture.Name + " and version " + (_mediator.SatelliteContractVersion == null ? _mediator.MainAssembly.GetVersion().ToString() : _mediator.SatelliteContractVersion.ToString()) + " of assembly " + _mediator.MainAssembly.GetSimpleName() + Environment.NewLine + "Exception: " + bife);
}
-#if !FEATURE_CORECLR
- if (FrameworkEventSource.IsInitialized)
- {
- if (satellite != null)
- {
- FrameworkEventSource.Log.ResourceManagerGetSatelliteAssemblySucceeded(_mediator.BaseName, _mediator.MainAssembly, lookForCulture.Name, satAssemblyName);
- }
- else
- {
- FrameworkEventSource.Log.ResourceManagerGetSatelliteAssemblyFailed(_mediator.BaseName, _mediator.MainAssembly, lookForCulture.Name, satAssemblyName);
- }
- }
-#endif
-
return satellite;
}
using System;
using System.Collections;
using System.Collections.Generic;
-#if FEATURE_CORECLR
-using System.Diagnostics.Contracts;
-#endif
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
private CultureInfo m_neutralResourcesCulture;
private bool m_useParents;
-// Added but disabled from desktop in .NET 4.0, stayed disabled in .NET 4.5
-#if FEATURE_CORECLR
// This is a cache of the thread, process, user, and OS-preferred fallback cultures.
// However, each thread may have a different value, and these may change during the
// lifetime of the process. So this cache must be verified each time we use it.
// as well to avoid differences across threads.
[ThreadStatic]
private static CultureInfo[] cachedOsFallbackArray;
-#endif // FEATURE_CORECLR
internal ResourceFallbackManager(CultureInfo startingCulture, CultureInfo neutralResourcesCulture, bool useParents)
{
yield break;
}
-// Added but disabled from desktop in .NET 4.0, stayed disabled in .NET 4.5
-#if FEATURE_CORECLR
// 2. user preferred cultures, omitting starting culture if tried already
// Compat note: For console apps, this API will return cultures like Arabic
// or Hebrew that are displayed right-to-left. These don't work with today's
}
}
}
-#endif // FEATURE_CORECLR
// 3. invariant
// Don't return invariant twice though.
yield return CultureInfo.InvariantCulture;
}
-// Added but disabled from desktop in .NET 4.0, stayed disabled in .NET 4.5
-#if FEATURE_CORECLR
private static CultureInfo[] LoadPreferredCultures()
{
// The list of preferred cultures includes thread, process, user, and OS
return CultureInfo.nativeGetResourceFallbackArray();
#endif
}
-
-#endif // FEATURE_CORECLR
}
}
using System.Collections.Generic;
using System.Runtime.Versioning;
using System.Diagnostics.Contracts;
-#if !FEATURE_CORECLR
- using System.Diagnostics.Tracing;
-#endif
#if FEATURE_APPX
//
protected ResourceManager()
{
-#if !FEATURE_CORECLR
- // This constructor is not designed to be used under AppX and is not in the Win8 profile.
- // However designers may use them even if they are running under AppX since they are
- // not subject to the restrictions of the Win8 profile.
- Contract.Assert(!AppDomain.IsAppXModel() || AppDomain.IsAppXDesignMode());
-#endif
-
Init();
_lastUsedResourceCache = new CultureNameResourceSetPair();
throw new ArgumentNullException(nameof(resourceDir));
Contract.EndContractBlock();
-#if !FEATURE_CORECLR
- // This constructor is not designed to be used under AppX and is not in the Win8 profile.
- // However designers may use them even if they are running under AppX since they are
- // not subject to the restrictions of the Win8 profile.
- Contract.Assert(!AppDomain.IsAppXModel() || AppDomain.IsAppXDesignMode());
-#endif
-
BaseNameField = baseName;
moduleDir = resourceDir;
ResourceManagerMediator mediator = new ResourceManagerMediator(this);
resourceGroveler = new FileBasedResourceGroveler(mediator);
-
-#if !FEATURE_CORECLR // PAL doesn't support eventing, and we don't compile event providers for coreclr
- if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled()) {
- CultureInfo culture = CultureInfo.InvariantCulture;
- String defaultResName = GetResourceFileName(culture);
-
- if (resourceGroveler.HasNeutralResources(culture, defaultResName)) {
- FrameworkEventSource.Log.ResourceManagerNeutralResourcesFound(BaseNameField, MainAssembly, defaultResName);
- }
- else {
- FrameworkEventSource.Log.ResourceManagerNeutralResourcesNotFound(BaseNameField, MainAssembly, defaultResName);
- }
- }
-#endif
}
-
+
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var have to be marked non-inlineable
public ResourceManager(String baseName, Assembly assembly)
{
throw new ArgumentNullException(nameof(assembly));
Contract.EndContractBlock();
-#if !FEATURE_CORECLR
- // This constructor is not designed to be used under AppX and is not in the Win8 profile.
- // However designers may use them even if they are running under AppX since they are
- // not subject to the restrictions of the Win8 profile.
- Contract.Assert(!AppDomain.IsAppXModel() || AppDomain.IsAppXDesignMode());
-#endif
-
if (!(assembly is RuntimeAssembly))
throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeAssembly"));
}
_neutralResourcesCulture = ManifestBasedResourceGroveler.GetNeutralResourcesLanguage(MainAssembly, ref _fallbackLoc);
-
-#if !FEATURE_CORECLR // PAL doesn't support eventing, and we don't compile event providers for coreclr
- if (_bUsingModernResourceManagement == false)
- {
- if (FrameworkEventSource.IsInitialized && FrameworkEventSource.Log.IsEnabled()) {
- CultureInfo culture = CultureInfo.InvariantCulture;
- String defaultResName = GetResourceFileName(culture);
-
- if (resourceGroveler.HasNeutralResources(culture, defaultResName)) {
- FrameworkEventSource.Log.ResourceManagerNeutralResourcesFound(BaseNameField, MainAssembly, defaultResName);
- }
- else {
- String outputResName = defaultResName;
- if (_locationInfo != null && _locationInfo.Namespace != null)
- outputResName = _locationInfo.Namespace + Type.Delimiter + defaultResName;
- FrameworkEventSource.Log.ResourceManagerNeutralResourcesNotFound(BaseNameField, MainAssembly, outputResName);
- }
- }
-
-#pragma warning disable 618
- ResourceSets = new Hashtable(); // for backward compatibility
-#pragma warning restore 618
- }
-#endif
}
// Gets the base name for the ResourceManager.
// creating a new ResourceManager isn't quite the correct behavior.
public virtual void ReleaseAllResources()
{
-#if !FEATURE_CORECLR
- if (FrameworkEventSource.IsInitialized)
- {
- FrameworkEventSource.Log.ResourceManagerReleasingResources(BaseNameField, MainAssembly);
- }
-#endif
Dictionary<String, ResourceSet> localResourceSets = _resourceSets;
// If any calls to Close throw, at least leave ourselves in a
lock(localResourceSets) {
IDictionaryEnumerator setEnum = localResourceSets.GetEnumerator();
-#if !FEATURE_CORECLR
- IDictionaryEnumerator setEnum2 = null;
-#pragma warning disable 618
- if (ResourceSets != null) {
- setEnum2 = ResourceSets.GetEnumerator();
- }
- ResourceSets = new Hashtable(); // for backwards compat
-#pragma warning restore 618
-#endif
-
while (setEnum.MoveNext()) {
((ResourceSet)setEnum.Value).Close();
}
-
-#if !FEATURE_CORECLR
- if (setEnum2 != null) {
- while (setEnum2.MoveNext()) {
- ((ResourceSet)setEnum2.Value).Close();
- }
- }
-#endif
}
}
CultureInfo foundCulture = null;
lock (localResourceSets) {
if (localResourceSets.TryGetValue(requestedCulture.Name, out rs)) {
-#if !FEATURE_CORECLR
- if (FrameworkEventSource.IsInitialized) {
- FrameworkEventSource.Log.ResourceManagerFoundResourceSetInCache(BaseNameField, MainAssembly, requestedCulture.Name);
- }
-#endif
return rs;
}
}
foreach (CultureInfo currentCultureInfo in mgr)
{
-#if !FEATURE_CORECLR
- if (FrameworkEventSource.IsInitialized)
- {
- FrameworkEventSource.Log.ResourceManagerLookingForResourceSet(BaseNameField, MainAssembly, currentCultureInfo.Name);
- }
-#endif
lock(localResourceSets) {
if (localResourceSets.TryGetValue(currentCultureInfo.Name, out rs)) {
-#if !FEATURE_CORECLR
- if (FrameworkEventSource.IsInitialized)
- {
- FrameworkEventSource.Log.ResourceManagerFoundResourceSetInCache(BaseNameField, MainAssembly, currentCultureInfo.Name);
- }
-#endif
// we need to update the cache if we fellback
if(requestedCulture != currentCultureInfo) foundCulture = currentCultureInfo;
break;
private bool ShouldUseSatelliteAssemblyResourceLookupUnderAppX(RuntimeAssembly resourcesAssembly)
{
bool fUseSatelliteAssemblyResourceLookupUnderAppX = resourcesAssembly.IsFrameworkAssembly();
-
-#if FEATURE_CORECLR
+
if (!fUseSatelliteAssemblyResourceLookupUnderAppX)
{
// Check to see if the assembly is under PLATFORM_RESOURCE_ROOTS. If it is, then we should use satellite assembly lookup for it.
}
}
}
-#endif // FEATURE_CORECLR
+
return fUseSatelliteAssemblyResourceLookupUnderAppX;
-
}
-
+
#endif // FEATURE_APPX
// Only call SetAppXConfiguration from ResourceManager constructors, and nowhere else.
// Throws MissingManifestResourceException and WinRT HResults
// This line behaves the same way as CultureInfo.CurrentUICulture would have in .NET 4
culture = Thread.CurrentThread.GetCurrentUICultureNoAppX();
}
-
-#if !FEATURE_CORECLR
- if (FrameworkEventSource.IsInitialized)
- {
- FrameworkEventSource.Log.ResourceManagerLookupStarted(BaseNameField, MainAssembly, culture.Name);
- }
-#endif
+
ResourceSet last = GetFirstResourceSet(culture);
if (last != null)
last = rs;
}
}
-
-#if !FEATURE_CORECLR
- if (FrameworkEventSource.IsInitialized)
- {
- FrameworkEventSource.Log.ResourceManagerLookupFailed(BaseNameField, MainAssembly, culture.Name);
- }
-#endif
}
return null;
culture = Thread.CurrentThread.GetCurrentUICultureNoAppX();
}
-#if !FEATURE_CORECLR
- if (FrameworkEventSource.IsInitialized)
- {
- FrameworkEventSource.Log.ResourceManagerLookupStarted(BaseNameField, MainAssembly, culture.Name);
- }
-#endif
ResourceSet last = GetFirstResourceSet(culture);
if (last != null)
{
// stores them in a hash table. Custom IResourceReaders can be used.
//
[Serializable]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public class ResourceSet : IDisposable, IEnumerable
{
[NonSerialized] protected IResourceReader Reader;
-#if FEATURE_CORECLR
internal Hashtable Table;
-#else
- protected Hashtable Table;
-#endif
private Hashtable _caseInsensitiveTable; // For case-insensitive lookups.
// GetDefaultReader and GetDefaultWriter.
public virtual Type GetDefaultWriter()
{
-#if FEATURE_CORECLR
return Type.GetType("System.Resources.ResourceWriter, System.Resources.Writer, Version=4.0.1.0, Culture=neutral, PublicKeyToken=" + AssemblyRef.MicrosoftPublicKeyToken, throwOnError: true);
-#else
- return typeof(ResourceWriter);
-#endif
}
[ComVisible(false)]
private MemberInfoCache<RuntimeEventInfo> m_eventInfoCache;
private static CerHashtable<RuntimeMethodInfo, RuntimeMethodInfo> s_methodInstantiations;
private static Object s_methodInstantiationsLock;
-#if !FEATURE_CORECLR
- private RuntimeConstructorInfo m_serializationCtor;
-#endif
private string m_defaultMemberName;
private Object m_genericCache; // Generic cache for rare scenario specific data. It is used to cache Enum names and values.
#endregion
m_nestedClassesCache = null;
}
-#if !FEATURE_CORECLR
- internal RuntimeConstructorInfo GetSerializationCtor()
- {
- if (m_serializationCtor == null)
- {
- if (s_SICtorParamTypes == null)
- s_SICtorParamTypes = new Type[] { typeof(SerializationInfo), typeof(StreamingContext) };
-
- m_serializationCtor = m_runtimeType.GetConstructor(
- BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
- null,
- CallingConventions.Any,
- s_SICtorParamTypes,
- null) as RuntimeConstructorInfo;
- }
-
- return m_serializationCtor;
- }
-#endif //!FEATURE_CORECLR
-
internal string GetDefaultMemberName()
{
if (m_defaultMemberName == null)
{
return Cache.GetDefaultMemberName();
}
-
-#if !FEATURE_CORECLR
- internal RuntimeConstructorInfo GetSerializationCtor()
- {
- return Cache.GetSerializationCtor();
- }
-#endif
#endregion
#region Type Overrides
return false;
}
-#if !FEATURE_CORECLR
- // Reflexive, symmetric, transitive.
- public override bool IsEquivalentTo(Type other)
- {
- RuntimeType otherRtType = other as RuntimeType;
- if ((object)otherRtType == null)
- return false;
-
- if (otherRtType == this)
- return true;
-
- // It's not worth trying to perform further checks in managed
- // as they would lead to FCalls anyway.
- return RuntimeTypeHandle.IsEquivalentTo(this, otherRtType);
- }
-#endif // FEATURE_CORECLR
-
public override Type BaseType
{
get
return IsSubclassOf(typeof(ValueType));
}
-#if !FEATURE_CORECLR
- public override bool IsEnum
- {
- get
- {
- return GetBaseType() == RuntimeType.EnumType;
- }
- }
-#endif
-
protected override bool HasElementTypeImpl()
{
return RuntimeTypeHandle.HasElementType(this);
return RuntimeHelpers.GetHashCode(this);
}
-#if !FEATURE_CORECLR
- public static bool operator ==(RuntimeType left, RuntimeType right)
- {
- return object.ReferenceEquals(left, right);
- }
-
- public static bool operator !=(RuntimeType left, RuntimeType right)
- {
- return !object.ReferenceEquals(left, right);
- }
-#endif // !FEATURE_CORECLR
-
public override String ToString()
{
return GetCachedName(TypeNameKind.ToString);
bCanBeCached = false;
}
#endif
-#if FEATURE_CORECLR
bSecurityCheckOff = true; // CoreCLR does not use security at all.
-#endif
Object instance = RuntimeTypeHandle.CreateInstance(this, publicOnly, bSecurityCheckOff, ref bCanBeCached, ref runtime_ctor, ref bNeedSecurityCheck);
if (ace.m_ctor != null)
{
-#if !FEATURE_CORECLR
- // Perform security checks if needed
- if (ace.m_bNeedSecurityCheck)
- RuntimeMethodHandle.PerformSecurityCheck(instance, ace.m_hCtorMethodHandle, this, (uint)INVOCATION_FLAGS.INVOCATION_FLAGS_CONSTRUCTOR_INVOKE);
-#endif
-
// Call ctor (value types wont have any)
try
{
public static class RuntimeHelpers
{
-#if FEATURE_CORECLR
// Exposed here as a more appropriate place than on FormatterServices itself,
// which is a high level reflection heavy type.
public static Object GetUninitializedObject(Type type)
{
return FormatterServices.GetUninitializedObject(type);
}
-#endif // FEATURE_CORECLR
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public static extern void InitializeArray(Array array,RuntimeFieldHandle fldHandle);
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity]
internal static extern void _CompileMethod(IRuntimeMethodInfo method);
-
- #if FEATURE_CORECLR
public static void PrepareMethod(RuntimeMethodHandle method){}
public static void PrepareMethod(RuntimeMethodHandle method, RuntimeTypeHandle[] instantiation){}
public static void PrepareContractedDelegate(Delegate d){}
}
}
- #else
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static unsafe extern void _PrepareMethod(IRuntimeMethodInfo method, IntPtr* pInstantiation, int cInstantiation);
-
- // Simple (instantiation not required) method.
- public static void PrepareMethod(RuntimeMethodHandle method)
- {
- unsafe
- {
- _PrepareMethod(method.GetMethodInfo(), null, 0);
- }
- }
-
- // Generic method or method with generic class with specific instantiation.
- public static void PrepareMethod(RuntimeMethodHandle method, RuntimeTypeHandle[] instantiation)
- {
- unsafe
- {
- int length;
- IntPtr[] instantiationHandles = RuntimeTypeHandle.CopyRuntimeTypeHandles(instantiation, out length);
- fixed (IntPtr* pInstantiation = instantiationHandles)
- {
- _PrepareMethod(method.GetMethodInfo(), pInstantiation, length);
- GC.KeepAlive(instantiation);
- }
- }
- }
- // This method triggers a given delegate to be prepared. This involves preparing the
- // delegate's Invoke method and preparing the target of that Invoke. In the case of
- // a multi-cast delegate, we rely on the fact that each individual component was prepared
- // prior to the Combine. In other words, this service does not navigate through the
- // entire multicasting list.
- // If our own reliable event sinks perform the Combine (for example AppDomain.DomainUnload),
- // then the result is fully prepared. But if a client calls Combine himself and then
- // then adds that combination to e.g. AppDomain.DomainUnload, then the client is responsible
- // for his own preparation.
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public static extern void PrepareDelegate(Delegate d);
-
- // See comment above for PrepareDelegate
- //
- // PrepareContractedDelegate weakens this a bit by only assuring that we prepare
- // delegates which also have a ReliabilityContract. This is useful for services that
- // want to provide opt-in reliability, generally some random event sink providing
- // always reliable semantics to random event handlers that are likely to have not
- // been written with relability in mind is a lost cause anyway.
- //
- // NOTE: that for the NGen case you can sidestep the required ReliabilityContract
- // by using the [PrePrepareMethod] attribute.
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public static extern void PrepareContractedDelegate(Delegate d);
- #endif
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public static extern int GetHashCode(Object o);
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static extern bool TryEnsureSufficientExecutionStack();
- #if FEATURE_CORECLR
public static void ProbeForSufficientStack()
{
}
- #else
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
- public static extern void ProbeForSufficientStack();
- #endif
// This method is a marker placed immediately before a try clause to mark the corresponding catch and finally blocks as
// constrained. There's no code here other than the probe because most of the work is done at JIT time when we spot a call to this routine.
// we'll do this to ensure we've cut off all attack vectors. Similarly, all
// methods have a link demand to ensure untrusted code cannot directly edit
// or alter a handle.
-#if !FEATURE_CORECLR
-#endif
public abstract class CriticalHandle : CriticalFinalizerObject, IDisposable
{
// ! Do not add or rearrange fields as the EE depends on this layout.
#endif
}
-#if FEATURE_CORECLR
// Adding an empty default constructor for annotation purposes
private CriticalHandle(){}
-#endif
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
~CriticalHandle()
[GuidAttribute("b36b5c63-42ef-38bc-a07e-0b34c98f164a")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsDual)]
[CLSCompliant(false)]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public interface _Exception
{
-#if !FEATURE_CORECLR
- // This contains all of our V1 Exception class's members.
-
- // From Object
- String ToString();
- bool Equals (Object obj);
- int GetHashCode ();
- Type GetType ();
-
- // From V1's Exception class
- String Message {
- get;
- }
-
- Exception GetBaseException();
-
- String StackTrace {
- get;
- }
-
- String HelpLink {
- get;
- set;
- }
-
- String Source {
- get;
- set;
- }
- void GetObjectData(SerializationInfo info, StreamingContext context);
-#endif
-
//
// This method is intentionally included in CoreCLR to make Exception.get_InnerException "newslot virtual final".
// Some phone apps include MEF from desktop Silverlight. MEF's ComposablePartException depends on implicit interface
Exception InnerException {
get;
}
-
-#if !FEATURE_CORECLR
- MethodBase TargetSite {
- get;
- }
-#endif
}
-
}
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
private static extern uint AlignedSizeOfType(Type type);
-#if !FEATURE_CORECLR // Marshal is critical in CoreCLR, so SafeCritical members trigger Annotator violations
-#endif // !FEATURE_CORECLR
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern int SizeOfHelper(Type t, bool throwIfNotMarshalable);
//====================================================================
// Read from memory
//====================================================================
-#if !FEATURE_CORECLR
- [DllImport(Win32Native.SHIM, EntryPoint="ND_RU1")]
- [SuppressUnmanagedCodeSecurity]
- public static extern byte ReadByte([MarshalAs(UnmanagedType.AsAny), In] Object ptr, int ofs);
-#else
public static byte ReadByte([MarshalAs(UnmanagedType.AsAny), In] Object ptr, int ofs)
{
throw new PlatformNotSupportedException();
- }
-#endif // !FEATURE_CORECLR
+ }
public static unsafe byte ReadByte(IntPtr ptr, int ofs)
{
{
return ReadByte(ptr,0);
}
-
-#if !FEATURE_CORECLR
- [DllImport(Win32Native.SHIM, EntryPoint="ND_RI2")]
- [SuppressUnmanagedCodeSecurity]
- public static extern short ReadInt16([MarshalAs(UnmanagedType.AsAny),In] Object ptr, int ofs);
-#else
+
public static short ReadInt16([MarshalAs(UnmanagedType.AsAny),In] Object ptr, int ofs)
{
throw new PlatformNotSupportedException();
- }
-#endif // !FEATURE_CORECLR
+ }
public static unsafe short ReadInt16(IntPtr ptr, int ofs)
{
{
return ReadInt16(ptr, 0);
}
-
-#if !FEATURE_CORECLR
- [DllImport(Win32Native.SHIM, EntryPoint="ND_RI4"), ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
- [SuppressUnmanagedCodeSecurity]
- public static extern int ReadInt32([MarshalAs(UnmanagedType.AsAny),In] Object ptr, int ofs);
-#else
+
public static int ReadInt32([MarshalAs(UnmanagedType.AsAny),In] Object ptr, int ofs)
{
throw new PlatformNotSupportedException();
}
-#endif // !FEATURE_CORECLR
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static unsafe int ReadInt32(IntPtr ptr, int ofs)
#endif
}
-#if !FEATURE_CORECLR
- [DllImport(Win32Native.SHIM, EntryPoint="ND_RI8"), ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
- [SuppressUnmanagedCodeSecurity]
- public static extern long ReadInt64([MarshalAs(UnmanagedType.AsAny),In] Object ptr, int ofs);
-#else
public static long ReadInt64([MarshalAs(UnmanagedType.AsAny),In] Object ptr, int ofs)
{
throw new PlatformNotSupportedException();
}
-#endif // !FEATURE_CORECLR
public static unsafe long ReadInt64(IntPtr ptr, int ofs)
{
}
}
-#if !FEATURE_CORECLR
- [DllImport(Win32Native.SHIM, EntryPoint="ND_WU1")]
- [SuppressUnmanagedCodeSecurity]
- public static extern void WriteByte([MarshalAs(UnmanagedType.AsAny),In,Out] Object ptr, int ofs, byte val);
-#else
public static void WriteByte([MarshalAs(UnmanagedType.AsAny),In,Out] Object ptr, int ofs, byte val)
{
throw new PlatformNotSupportedException();
}
-#endif // !FEATURE_CORECLR
public static void WriteByte(IntPtr ptr, byte val)
{
throw new AccessViolationException();
}
}
-
-#if !FEATURE_CORECLR
- [DllImport(Win32Native.SHIM, EntryPoint="ND_WI2")]
- [SuppressUnmanagedCodeSecurity]
- public static extern void WriteInt16([MarshalAs(UnmanagedType.AsAny),In,Out] Object ptr, int ofs, short val);
-#else
+
public static void WriteInt16([MarshalAs(UnmanagedType.AsAny),In,Out] Object ptr, int ofs, short val)
{
throw new PlatformNotSupportedException();
}
-#endif // !FEATURE_CORECLR
-
+
public static void WriteInt16(IntPtr ptr, short val)
{
WriteInt16(ptr, 0, val);
throw new AccessViolationException();
}
}
-
-#if !FEATURE_CORECLR
- [DllImport(Win32Native.SHIM, EntryPoint="ND_WI4")]
- [SuppressUnmanagedCodeSecurity]
- public static extern void WriteInt32([MarshalAs(UnmanagedType.AsAny),In,Out] Object ptr, int ofs, int val);
-#else
+
public static void WriteInt32([MarshalAs(UnmanagedType.AsAny),In,Out] Object ptr, int ofs, int val)
{
throw new PlatformNotSupportedException();
}
-#endif // !FEATURE_CORECLR
public static void WriteInt32(IntPtr ptr, int val)
{
throw new AccessViolationException();
}
}
-
-#if !FEATURE_CORECLR
- [DllImport(Win32Native.SHIM, EntryPoint="ND_WI8")]
- [SuppressUnmanagedCodeSecurity]
- public static extern void WriteInt64([MarshalAs(UnmanagedType.AsAny),In,Out] Object ptr, int ofs, long val);
-#else
+
public static void WriteInt64([MarshalAs(UnmanagedType.AsAny),In,Out] Object ptr, int ofs, long val)
{
throw new PlatformNotSupportedException();
}
-#endif // !FEATURE_CORECLR
public static void WriteInt64(IntPtr ptr, long val)
{
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern Type GetLoadedTypeForGUID(ref Guid guid);
-#if !FEATURE_CORECLR // current implementation requires reflection only load
- //====================================================================
- // map ITypeInfo* to Type
- //====================================================================
- public static Type GetTypeForITypeInfo(IntPtr /* ITypeInfo* */ piTypeInfo)
- {
- ITypeInfo pTI = null;
- ITypeLib pTLB = null;
- Type TypeObj = null;
- Assembly AsmBldr = null;
- TypeLibConverter TlbConverter = null;
- int Index = 0;
- Guid clsid;
-
- // If the input ITypeInfo is NULL then return NULL.
- if (piTypeInfo == IntPtr.Zero)
- return null;
-
- // Wrap the ITypeInfo in a CLR object.
- pTI = (ITypeInfo)GetObjectForIUnknown(piTypeInfo);
-
- // Check to see if a class exists with the specified GUID.
-
- clsid = GetTypeInfoGuid(pTI);
- TypeObj = GetLoadedTypeForGUID(ref clsid);
-
- // If we managed to find the type based on the GUID then return it.
- if (TypeObj != null)
- return TypeObj;
-
- // There is no type with the specified GUID in the app domain so lets
- // try and convert the containing typelib.
- try
- {
- pTI.GetContainingTypeLib(out pTLB, out Index);
- }
- catch(COMException)
- {
- pTLB = null;
- }
-
- // Check to see if we managed to get a containing typelib.
- if (pTLB != null)
- {
- // Get the assembly name from the typelib.
- AssemblyName AsmName = TypeLibConverter.GetAssemblyNameFromTypelib(pTLB, null, null, null, null, AssemblyNameFlags.None);
- String AsmNameString = AsmName.FullName;
-
- // Check to see if the assembly that will contain the type already exists.
- Assembly[] aAssemblies = Thread.GetDomain().GetAssemblies();
- int NumAssemblies = aAssemblies.Length;
- for (int i = 0; i < NumAssemblies; i++)
- {
- if (String.Compare(aAssemblies[i].FullName,
- AsmNameString,StringComparison.Ordinal) == 0)
- AsmBldr = aAssemblies[i];
- }
-
- // If we haven't imported the assembly yet then import it.
- if (AsmBldr == null)
- {
- TlbConverter = new TypeLibConverter();
- AsmBldr = TlbConverter.ConvertTypeLibToAssembly(pTLB,
- GetTypeLibName(pTLB) + ".dll", 0, new ImporterCallback(), null, null, null, null);
- }
-
- // Load the type object from the imported typelib.
- // Call GetManagedTypeInfoNameInternal to align with TlbImp behavior
- TypeObj = AsmBldr.GetType(GetManagedTypeInfoNameInternal(pTLB, pTI), true, false);
- if (TypeObj != null && !TypeObj.IsVisible)
- TypeObj = null;
- }
- else
- {
- // If the ITypeInfo does not have a containing typelib then simply
- // return Object as the type.
- TypeObj = typeof(Object);
- }
-
- return TypeObj;
- }
-#endif // #if !FEATURE_CORECLR
-
// This method is identical to Type.GetTypeFromCLSID. Since it's interop specific, we expose it
// on Marshal for more consistent API surface.
-#if !FEATURE_CORECLR
-#endif //!FEATURE_CORECLR
public static Type GetTypeFromCLSID(Guid clsid)
{
return RuntimeType.GetTypeFromCLSIDImpl(clsid, null, false);
//====================================================================
public static IntPtr /* IDispatch */ GetIDispatchForObject(Object o)
{
-#if FEATURE_CORECLR
throw new PlatformNotSupportedException();
-#else
- return GetIDispatchForObjectNative(o, false);
-#endif // FEATURE_CORECLR
}
#if FEATURE_COMINTEROP
//====================================================================
// check if the object is classic COM component
//====================================================================
-#if !FEATURE_CORECLR // with FEATURE_CORECLR, the whole type is SecurityCritical
-#endif
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public static extern bool IsComObject(Object o);
//====================================================================
public static Object GetComObjectData(Object obj, Object key)
{
-#if FEATURE_CORECLR
throw new PlatformNotSupportedException();
-#else
- // Validate that the arguments aren't null.
- if (obj == null)
- throw new ArgumentNullException(nameof(obj));
- if (key == null)
- throw new ArgumentNullException(nameof(key));
- Contract.EndContractBlock();
-
- __ComObject comObj = null;
-
- // Make sure the obj is an __ComObject.
- try
- {
- comObj = (__ComObject)obj;
- }
- catch (InvalidCastException)
- {
- throw new ArgumentException(Environment.GetResourceString("Argument_ObjNotComObject"), nameof(obj));
- }
-
- if (obj.GetType().IsWindowsRuntimeObject)
- {
- throw new ArgumentException(Environment.GetResourceString("Argument_ObjIsWinRTObject"), nameof(obj));
- }
-
- // Retrieve the data from the __ComObject.
- return comObj.GetData(key);
-#endif // FEATURE_CORECLR
}
//====================================================================
//====================================================================
public static bool SetComObjectData(Object obj, Object key, Object data)
{
-#if FEATURE_CORECLR
throw new PlatformNotSupportedException();
-#else
- // Validate that the arguments aren't null. The data can validly be null.
- if (obj == null)
- throw new ArgumentNullException(nameof(obj));
- if (key == null)
- throw new ArgumentNullException(nameof(key));
- Contract.EndContractBlock();
-
- __ComObject comObj = null;
-
- // Make sure the obj is an __ComObject.
- try
- {
- comObj = (__ComObject)obj;
- }
- catch (InvalidCastException)
- {
- throw new ArgumentException(Environment.GetResourceString("Argument_ObjNotComObject"), nameof(obj));
- }
-
- if (obj.GetType().IsWindowsRuntimeObject)
- {
- throw new ArgumentException(Environment.GetResourceString("Argument_ObjIsWinRTObject"), nameof(obj));
- }
-
- // Retrieve the data from the __ComObject.
- return comObj.SetData(key, data);
-#endif // FEATURE_CORECLR
}
#if FEATURE_COMINTEROP
//====================================================================
public static Guid GenerateGuidForType(Type type)
{
-#if FEATURE_CORECLR
return type.GUID;
}
-#else
- Guid result = new Guid ();
- FCallGenerateGuidForType (ref result, type);
- return result;
- }
-
- // The full assembly name is used to compute the GUID, so this should be SxS-safe
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static extern void FCallGenerateGuidForType(ref Guid result, Type type);
-#endif // FEATURE_CORECLR
//====================================================================
// This method generates a PROGID for the specified type. If the type
throw new ArgumentException(Environment.GetResourceString("Argument_NeedNonGenericType"), nameof(type));
Contract.EndContractBlock();
-#if !FEATURE_CORECLR
- if (!RegistrationServices.TypeRequiresRegistrationHelper(type))
- throw new ArgumentException(Environment.GetResourceString("Argument_TypeMustBeComCreatable"), nameof(type));
-#endif // FEATURE_CORECLR
-
IList<CustomAttributeData> cas = CustomAttributeData.GetCustomAttributes(type);
for (int i = 0; i < cas.Count; i ++)
{
FreeHGlobal(s);
}
}
-
-#if FEATURE_COMINTEROP && !FEATURE_CORECLR // current implementation requires reflection only load
- //========================================================================
- // Typelib importer callback implementation.
- //========================================================================
- internal class ImporterCallback : ITypeLibImporterNotifySink
- {
- public void ReportEvent(ImporterEventKind EventKind, int EventCode, String EventMsg)
- {
- }
-
- public Assembly ResolveRef(Object TypeLib)
- {
- try
- {
- // Create the TypeLibConverter.
- ITypeLibConverter TLBConv = new TypeLibConverter();
-
- // Convert the typelib.
- return TLBConv.ConvertTypeLibToAssembly(TypeLib,
- Marshal.GetTypeLibName((ITypeLib)TypeLib) + ".dll",
- 0,
- new ImporterCallback(),
- null,
- null,
- null,
- null);
- }
- catch(Exception)
-// catch
- {
- return null;
- }
- }
- }
-#endif // FEATURE_COMINTEROP && !FEATURE_CORECLR
}
using System.Runtime.Versioning;
using StackCrawlMark = System.Threading.StackCrawlMark;
-namespace System.Runtime.InteropServices {
-[System.Runtime.InteropServices.ComVisible(true)]
-#if FEATURE_CORECLR
- static
-#endif
- public class RuntimeEnvironment {
-
-#if !FEATURE_CORECLR
- // This should have been a static class, but wasn't as of v3.5. Clearly, this is
- // broken. We'll keep this in V4 for binary compat, but marked obsolete as error
- // so migrated source code gets fixed. On Silverlight, this type exists but is
- // not public.
- [Obsolete("Do not create instances of the RuntimeEnvironment class. Call the static methods directly on this type instead", true)]
- public RuntimeEnvironment()
- {
- // Should not have been instantiable - here for binary compatibility in V4.
- }
-#endif
+namespace System.Runtime.InteropServices
+{
+ [System.Runtime.InteropServices.ComVisible(true)]
+ static public class RuntimeEnvironment {
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern String GetModuleFileName();
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern String GetHostBindingFile();
-#if !FEATURE_CORECLR
- [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
- [SuppressUnmanagedCodeSecurity]
- internal static extern void _GetSystemVersion(StringHandleOnStack retVer);
-#endif //!FEATURE_CORECLR
-
public static bool FromGlobalAccessCache(Assembly a)
{
return a.GlobalAssemblyCache;
}
-
-#if !FEATURE_CORECLR
-#endif
+
[MethodImpl (MethodImplOptions.NoInlining)]
public static String GetSystemVersion()
{
-#if FEATURE_CORECLR
-
return Assembly.GetExecutingAssembly().ImageRuntimeVersion;
-
-#else // FEATURE_CORECLR
-
- String ver = null;
- _GetSystemVersion(JitHelpers.GetStringHandleOnStack(ref ver));
- return ver;
-
-#endif // FEATURE_CORECLR
-
}
-
+
public static String GetRuntimeDirectory()
{
String dir = GetRuntimeDirectoryImpl();
}
}
}
-
#endif // FEATURE_COMINTEROP
}
}
// we'll do this to ensure we've cut off all attack vectors. Similarly, all
// methods have a link demand to ensure untrusted code cannot directly edit
// or alter a handle.
-#if !FEATURE_CORECLR
-#endif
public abstract class SafeHandle : CriticalFinalizerObject, IDisposable
{
// ! Do not add or rearrange fields as the EE depends on this layout.
_fullyInitialized = true;
}
-#if FEATURE_CORECLR
// Migrating InheritanceDemands requires this default ctor, so we can mark it critical
protected SafeHandle()
{
BCLDebug.Assert(false, "SafeHandle's protected default ctor should never be used!");
throw new NotImplementedException();
}
-#endif
~SafeHandle()
{
+++ /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: Component that implements the ITypeLibConverter interface and
-** does the actual work of converting a typelib to metadata and
-** vice versa.
-**
-**
-=============================================================================*/
-#if !FEATURE_CORECLR // current implementation requires reflection only load
-namespace System.Runtime.InteropServices {
-
- using System;
- using System.Diagnostics.Contracts;
- using System.Collections;
- using System.Collections.Generic;
- using System.Threading;
- using System.Runtime.InteropServices.TCEAdapterGen;
- using System.IO;
- using System.Reflection;
- using System.Reflection.Emit;
- using System.Configuration.Assemblies;
- using Microsoft.Win32;
- using System.Runtime.CompilerServices;
- using System.Globalization;
- using System.Security;
- using System.Security.Permissions;
- using System.Runtime.InteropServices.ComTypes;
- using System.Runtime.Versioning;
- using WORD = System.UInt16;
- using DWORD = System.UInt32;
- using _TYPELIBATTR = System.Runtime.InteropServices.ComTypes.TYPELIBATTR;
-
- [Guid("F1C3BF79-C3E4-11d3-88E7-00902754C43A")]
- [ClassInterface(ClassInterfaceType.None)]
-[System.Runtime.InteropServices.ComVisible(true)]
- public sealed class TypeLibConverter : ITypeLibConverter
- {
- private const String s_strTypeLibAssemblyTitlePrefix = "TypeLib ";
- private const String s_strTypeLibAssemblyDescPrefix = "Assembly generated from typelib ";
- private const int MAX_NAMESPACE_LENGTH = 1024;
-
-
- //
- // ITypeLibConverter interface.
- //
-
- [System.Security.SecuritySafeCritical] // auto-generated
- [SecurityPermissionAttribute(SecurityAction.Demand, Flags=SecurityPermissionFlag.UnmanagedCode)]
- public AssemblyBuilder ConvertTypeLibToAssembly([MarshalAs(UnmanagedType.Interface)] Object typeLib,
- String asmFileName,
- int flags,
- ITypeLibImporterNotifySink notifySink,
- byte[] publicKey,
- StrongNameKeyPair keyPair,
- bool unsafeInterfaces)
- {
- return ConvertTypeLibToAssembly(typeLib,
- asmFileName,
- (unsafeInterfaces
- ? TypeLibImporterFlags.UnsafeInterfaces
- : 0),
- notifySink,
- publicKey,
- keyPair,
- null,
- null);
- }
-
-
-
-
- [System.Security.SecuritySafeCritical] // auto-generated
- [SecurityPermissionAttribute(SecurityAction.Demand, Flags=SecurityPermissionFlag.UnmanagedCode)]
- public AssemblyBuilder ConvertTypeLibToAssembly([MarshalAs(UnmanagedType.Interface)] Object typeLib,
- String asmFileName,
- TypeLibImporterFlags flags,
- ITypeLibImporterNotifySink notifySink,
- byte[] publicKey,
- StrongNameKeyPair keyPair,
- String asmNamespace,
- Version asmVersion)
- {
- // Validate the arguments.
- if (typeLib == null)
- throw new ArgumentNullException(nameof(typeLib));
- if (asmFileName == null)
- throw new ArgumentNullException(nameof(asmFileName));
- if (notifySink == null)
- throw new ArgumentNullException(nameof(notifySink));
- if (String.Empty.Equals(asmFileName))
- throw new ArgumentException(Environment.GetResourceString("Arg_InvalidFileName"), nameof(asmFileName));
- if (asmFileName.Length > Path.MaxPath)
- throw new ArgumentException(Environment.GetResourceString("IO.PathTooLong"), asmFileName);
- if ((flags & TypeLibImporterFlags.PrimaryInteropAssembly) != 0 && publicKey == null && keyPair == null)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_PIAMustBeStrongNamed"));
- Contract.EndContractBlock();
-
- ArrayList eventItfInfoList = null;
-
- // Determine the AssemblyNameFlags
- AssemblyNameFlags asmNameFlags = AssemblyNameFlags.None;
-
- // Retrieve the assembly name from the typelib.
- AssemblyName asmName = GetAssemblyNameFromTypelib(typeLib, asmFileName, publicKey, keyPair, asmVersion, asmNameFlags);
-
- // Create the dynamic assembly that will contain the converted typelib types.
- AssemblyBuilder asmBldr = CreateAssemblyForTypeLib(typeLib, asmFileName, asmName,
- (flags & TypeLibImporterFlags.PrimaryInteropAssembly) != 0,
- (flags & TypeLibImporterFlags.ReflectionOnlyLoading) != 0,
- (flags & TypeLibImporterFlags.NoDefineVersionResource) != 0);
-
- // Define a dynamic module that will contain the contain the imported types.
- String strNonQualifiedAsmFileName = Path.GetFileName(asmFileName);
- ModuleBuilder modBldr = asmBldr.DefineDynamicModule(strNonQualifiedAsmFileName, strNonQualifiedAsmFileName);
-
- // If the namespace hasn't been specified, then use the assembly name.
- if (asmNamespace == null)
- asmNamespace = asmName.Name;
-
- // Create a type resolve handler that will also intercept resolve ref messages
- // on the sink interface to build up a list of referenced assemblies.
- TypeResolveHandler typeResolveHandler = new TypeResolveHandler(modBldr, notifySink);
-
- // Add a listener for the type resolve events.
- AppDomain currentDomain = Thread.GetDomain();
- ResolveEventHandler resolveHandler = new ResolveEventHandler(typeResolveHandler.ResolveEvent);
- ResolveEventHandler asmResolveHandler = new ResolveEventHandler(typeResolveHandler.ResolveAsmEvent);
- ResolveEventHandler ROAsmResolveHandler = new ResolveEventHandler(typeResolveHandler.ResolveROAsmEvent);
- currentDomain.TypeResolve += resolveHandler;
- currentDomain.AssemblyResolve += asmResolveHandler;
- currentDomain.ReflectionOnlyAssemblyResolve += ROAsmResolveHandler;
-
- // Convert the types contained in the typelib into metadata and add them to the assembly.
- nConvertTypeLibToMetadata(typeLib, asmBldr.InternalAssembly, modBldr.InternalModule, asmNamespace, flags, typeResolveHandler, out eventItfInfoList);
-
- // Update the COM types in the assembly.
- UpdateComTypesInAssembly(asmBldr, modBldr);
-
- // If there are any event sources then generate the TCE adapters.
- if (eventItfInfoList.Count > 0)
- new TCEAdapterGenerator().Process(modBldr, eventItfInfoList);
-
- // Remove the listener for the type resolve events.
- currentDomain.TypeResolve -= resolveHandler;
- currentDomain.AssemblyResolve -= asmResolveHandler;
- currentDomain.ReflectionOnlyAssemblyResolve -= ROAsmResolveHandler;
-
- // We have finished converting the typelib and now have a fully formed assembly.
- return asmBldr;
- }
-
- [System.Security.SecuritySafeCritical] // auto-generated
- [SecurityPermissionAttribute(SecurityAction.Demand, Flags=SecurityPermissionFlag.UnmanagedCode)]
- [return : MarshalAs(UnmanagedType.Interface)]
- public Object ConvertAssemblyToTypeLib(Assembly assembly, String strTypeLibName, TypeLibExporterFlags flags, ITypeLibExporterNotifySink notifySink)
- {
- RuntimeAssembly rtAssembly;
- AssemblyBuilder ab = assembly as AssemblyBuilder;
- if (ab != null)
- rtAssembly = ab.InternalAssembly;
- else
- rtAssembly = assembly as RuntimeAssembly;
-
- return nConvertAssemblyToTypeLib(rtAssembly, strTypeLibName, flags, notifySink);
- }
-
- public bool GetPrimaryInteropAssembly(Guid g, Int32 major, Int32 minor, Int32 lcid, out String asmName, out String asmCodeBase)
- {
- String strTlbId = "{" + g.ToString().ToUpper(CultureInfo.InvariantCulture) + "}";
- String strVersion = major.ToString("x", CultureInfo.InvariantCulture) + "." + minor.ToString("x", CultureInfo.InvariantCulture);
-
- // Set the two out values to null before we start.
- asmName = null;
- asmCodeBase = null;
-
- // Try to open the HKEY_CLASS_ROOT\TypeLib key.
- using (RegistryKey TypeLibKey = Registry.ClassesRoot.OpenSubKey("TypeLib", false))
- {
- if (TypeLibKey != null)
- {
- // Try to open the HKEY_CLASS_ROOT\TypeLib\<TLBID> key.
- using (RegistryKey TypeLibSubKey = TypeLibKey.OpenSubKey(strTlbId))
- {
- if (TypeLibSubKey != null)
- {
- // Try to open the HKEY_CLASS_ROOT\TypeLib\<TLBID>\<Major.Minor> key.
- using (RegistryKey VersionKey = TypeLibSubKey.OpenSubKey(strVersion, false))
- {
- if (VersionKey != null)
- {
- // Attempt to retrieve the assembly name and codebase under the version key.
- asmName = (String)VersionKey.GetValue("PrimaryInteropAssemblyName");
- asmCodeBase = (String)VersionKey.GetValue("PrimaryInteropAssemblyCodeBase");
- }
- }
- }
- }
- }
- }
-
- // If the assembly name isn't null, then we found an PIA.
- return asmName != null;
- }
-
-
- //
- // Non native helper methods.
- //
-
- [System.Security.SecurityCritical] // auto-generated
- [MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
- private static AssemblyBuilder CreateAssemblyForTypeLib(Object typeLib, String asmFileName, AssemblyName asmName, bool bPrimaryInteropAssembly, bool bReflectionOnly, bool bNoDefineVersionResource)
- {
- // Retrieve the current app domain.
- AppDomain currentDomain = Thread.GetDomain();
-
- // Retrieve the directory from the assembly file name.
- String dir = null;
- if (asmFileName != null)
- {
- dir = Path.GetDirectoryName(asmFileName);
- if (String.IsNullOrEmpty(dir))
- dir = null;
- }
-
- AssemblyBuilderAccess aba;
- if (bReflectionOnly)
- {
- aba = AssemblyBuilderAccess.ReflectionOnly;
- }
- else
- {
- aba = AssemblyBuilderAccess.RunAndSave;
- }
-
- // Create the dynamic assembly itself.
- AssemblyBuilder asmBldr;
-
- List<CustomAttributeBuilder> assemblyAttributes = new List<CustomAttributeBuilder>();
-#if !FEATURE_CORECLR
- // mscorlib.dll must specify the security rules that assemblies it emits are to use, since by
- // default all assemblies will follow security rule set level 2, and we want to make that an
- // explicit decision.
- ConstructorInfo securityRulesCtor = typeof(SecurityRulesAttribute).GetConstructor(new Type[] { typeof(SecurityRuleSet) });
- CustomAttributeBuilder securityRulesAttribute =
- new CustomAttributeBuilder(securityRulesCtor, new object[] { SecurityRuleSet.Level2 });
- assemblyAttributes.Add(securityRulesAttribute);
-#endif // !FEATURE_CORECLR
-
- asmBldr = currentDomain.DefineDynamicAssembly(asmName, aba, dir, false, assemblyAttributes);
-
- // Set the Guid custom attribute on the assembly.
- SetGuidAttributeOnAssembly(asmBldr, typeLib);
-
- // Set the imported from COM attribute on the assembly and return it.
- SetImportedFromTypeLibAttrOnAssembly(asmBldr, typeLib);
-
- // Set the version information on the typelib.
- if (bNoDefineVersionResource)
- {
- SetTypeLibVersionAttribute(asmBldr, typeLib);
- }
- else
- {
- SetVersionInformation(asmBldr, typeLib, asmName);
- }
-
- // If we are generating a PIA, then set the PIA custom attribute.
- if (bPrimaryInteropAssembly)
- SetPIAAttributeOnAssembly(asmBldr, typeLib);
-
- return asmBldr;
- }
-
- [System.Security.SecurityCritical] // auto-generated
- internal static AssemblyName GetAssemblyNameFromTypelib(Object typeLib, String asmFileName, byte[] publicKey, StrongNameKeyPair keyPair, Version asmVersion, AssemblyNameFlags asmNameFlags)
- {
- // Extract the name of the typelib.
- String strTypeLibName = null;
- String strDocString = null;
- int dwHelpContext = 0;
- String strHelpFile = null;
- ITypeLib pTLB = (ITypeLib)typeLib;
- pTLB.GetDocumentation(-1, out strTypeLibName, out strDocString, out dwHelpContext, out strHelpFile);
-
- // Retrieve the name to use for the assembly.
- if (asmFileName == null)
- {
- asmFileName = strTypeLibName;
- }
- else
- {
- Contract.Assert((asmFileName != null) && (asmFileName.Length > 0), "The assembly file name cannot be an empty string!");
-
- String strFileNameNoPath = Path.GetFileName(asmFileName);
- String strExtension = Path.GetExtension(asmFileName);
-
- // Validate that the extension is valid.
- bool bExtensionValid = ".dll".Equals(strExtension, StringComparison.OrdinalIgnoreCase);
-
- // If the extension is not valid then tell the user and quit.
- if (!bExtensionValid)
- throw new ArgumentException(Environment.GetResourceString("Arg_InvalidFileExtension"));
-
- // The assembly cannot contain the path nor the extension.
- asmFileName = strFileNameNoPath.Substring(0, strFileNameNoPath.Length - ".dll".Length);
- }
-
- // If the version information was not specified, then retrieve it from the typelib.
- if (asmVersion == null)
- {
- int major;
- int minor;
- Marshal.GetTypeLibVersion(pTLB, out major, out minor);
- asmVersion = new Version(major, minor, 0, 0);
- }
-
- // Create the assembly name for the imported typelib's assembly.
- AssemblyName AsmName = new AssemblyName();
- AsmName.Init(
- asmFileName,
- publicKey,
- null,
- asmVersion,
- null,
- AssemblyHashAlgorithm.None,
- AssemblyVersionCompatibility.SameMachine,
- null,
- asmNameFlags,
- keyPair);
-
- return AsmName;
- }
-
- private static void UpdateComTypesInAssembly(AssemblyBuilder asmBldr, ModuleBuilder modBldr)
- {
- // Retrieve the AssemblyBuilderData associated with the assembly builder.
- AssemblyBuilderData AsmBldrData = asmBldr.m_assemblyData;
-
- // Go through the types in the module and add them as public COM types.
- Type[] aTypes = modBldr.GetTypes();
- int NumTypes = aTypes.Length;
- for (int cTypes = 0; cTypes < NumTypes; cTypes++)
- AsmBldrData.AddPublicComType(aTypes[cTypes]);
- }
-
-
- [System.Security.SecurityCritical] // auto-generated
- private static void SetGuidAttributeOnAssembly(AssemblyBuilder asmBldr, Object typeLib)
- {
- // Retrieve the GuidAttribute constructor.
- Type []aConsParams = new Type[1] {typeof(String)};
- ConstructorInfo GuidAttrCons = typeof(GuidAttribute).GetConstructor(aConsParams);
-
- // Create an instance of the custom attribute builder.
- Object[] aArgs = new Object[1] {Marshal.GetTypeLibGuid((ITypeLib)typeLib).ToString()};
- CustomAttributeBuilder GuidCABuilder = new CustomAttributeBuilder(GuidAttrCons, aArgs);
-
- // Set the GuidAttribute on the assembly builder.
- asmBldr.SetCustomAttribute(GuidCABuilder);
- }
-
- [System.Security.SecurityCritical] // auto-generated
- private static void SetImportedFromTypeLibAttrOnAssembly(AssemblyBuilder asmBldr, Object typeLib)
- {
- // Retrieve the ImportedFromTypeLibAttribute constructor.
- Type []aConsParams = new Type[1] {typeof(String)};
- ConstructorInfo ImpFromComAttrCons = typeof(ImportedFromTypeLibAttribute).GetConstructor(aConsParams);
-
- // Retrieve the name of the typelib.
- String strTypeLibName = Marshal.GetTypeLibName((ITypeLib)typeLib);
-
- // Create an instance of the custom attribute builder.
- Object[] aArgs = new Object[1] {strTypeLibName};
- CustomAttributeBuilder ImpFromComCABuilder = new CustomAttributeBuilder(ImpFromComAttrCons, aArgs);
-
- // Set the ImportedFromTypeLibAttribute on the assembly builder.
- asmBldr.SetCustomAttribute(ImpFromComCABuilder);
- }
-
- [System.Security.SecurityCritical] // auto-generated
- private static void SetTypeLibVersionAttribute(AssemblyBuilder asmBldr, Object typeLib)
- {
- Type []aConsParams = new Type[2] {typeof(int), typeof(int)};
- ConstructorInfo TypeLibVerCons = typeof(TypeLibVersionAttribute).GetConstructor(aConsParams);
-
- // Get the typelib version
- int major;
- int minor;
- Marshal.GetTypeLibVersion((ITypeLib)typeLib, out major, out minor);
-
- // Create an instance of the custom attribute builder.
- Object[] aArgs = new Object[2] {major, minor};
- CustomAttributeBuilder TypeLibVerBuilder = new CustomAttributeBuilder(TypeLibVerCons, aArgs);
-
- // Set the attribute on the assembly builder.
- asmBldr.SetCustomAttribute(TypeLibVerBuilder);
- }
-
- [System.Security.SecurityCritical] // auto-generated
- private static void SetVersionInformation(AssemblyBuilder asmBldr, Object typeLib, AssemblyName asmName)
- {
- // Extract the name of the typelib.
- String strTypeLibName = null;
- String strDocString = null;
- int dwHelpContext = 0;
- String strHelpFile = null;
- ITypeLib pTLB = (ITypeLib)typeLib;
- pTLB.GetDocumentation(-1, out strTypeLibName, out strDocString, out dwHelpContext, out strHelpFile);
-
- // Generate the product name string from the named of the typelib.
- String strProductName = String.Format(CultureInfo.InvariantCulture, Environment.GetResourceString("TypeLibConverter_ImportedTypeLibProductName"), strTypeLibName);
-
- // Set the OS version information.
- asmBldr.DefineVersionInfoResource(strProductName, asmName.Version.ToString(), null, null, null);
-
- // Set the TypeLibVersion attribute
- SetTypeLibVersionAttribute(asmBldr, typeLib);
- }
-
- [System.Security.SecurityCritical] // auto-generated
- private static void SetPIAAttributeOnAssembly(AssemblyBuilder asmBldr, Object typeLib)
- {
- IntPtr pAttr = IntPtr.Zero;
- _TYPELIBATTR Attr;
- ITypeLib pTLB = (ITypeLib)typeLib;
- int Major = 0;
- int Minor = 0;
-
- // Retrieve the PrimaryInteropAssemblyAttribute constructor.
- Type []aConsParams = new Type[2] {typeof(int), typeof(int)};
- ConstructorInfo PIAAttrCons = typeof(PrimaryInteropAssemblyAttribute).GetConstructor(aConsParams);
-
- // Retrieve the major and minor version from the typelib.
- try
- {
- pTLB.GetLibAttr(out pAttr);
- Attr = (_TYPELIBATTR)Marshal.PtrToStructure(pAttr, typeof(_TYPELIBATTR));
- Major = Attr.wMajorVerNum;
- Minor = Attr.wMinorVerNum;
- }
- finally
- {
- // Release the typelib attributes.
- if (pAttr != IntPtr.Zero)
- pTLB.ReleaseTLibAttr(pAttr);
- }
-
- // Create an instance of the custom attribute builder.
- Object[] aArgs = new Object[2] {Major, Minor};
- CustomAttributeBuilder PIACABuilder = new CustomAttributeBuilder(PIAAttrCons, aArgs);
-
- // Set the PrimaryInteropAssemblyAttribute on the assembly builder.
- asmBldr.SetCustomAttribute(PIACABuilder);
- }
-
-
- //
- // Native helper methods.
- //
-
- [System.Security.SecurityCritical] // auto-generated
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static extern void nConvertTypeLibToMetadata(Object typeLib, RuntimeAssembly asmBldr, RuntimeModule modBldr, String nameSpace, TypeLibImporterFlags flags, ITypeLibImporterNotifySink notifySink, out ArrayList eventItfInfoList);
-
- // Must use assembly versioning or GuidAttribute to avoid collisions in typelib export or registration.
- [System.Security.SecurityCritical] // auto-generated
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static extern Object nConvertAssemblyToTypeLib(RuntimeAssembly assembly, String strTypeLibName, TypeLibExporterFlags flags, ITypeLibExporterNotifySink notifySink);
-
- [System.Security.SecurityCritical] // auto-generated
- [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity]
- internal extern static void LoadInMemoryTypeByName(RuntimeModule module, String className);
-
- //
- // Helper class called when a resolve type event is fired.
- //
-
- private class TypeResolveHandler : ITypeLibImporterNotifySink
- {
- public TypeResolveHandler(ModuleBuilder mod, ITypeLibImporterNotifySink userSink)
- {
- m_Module = mod;
- m_UserSink = userSink;
- }
-
- public void ReportEvent(ImporterEventKind eventKind, int eventCode, String eventMsg)
- {
- m_UserSink.ReportEvent(eventKind, eventCode, eventMsg);
- }
-
- public Assembly ResolveRef(Object typeLib)
- {
- Contract.Ensures(Contract.Result<Assembly>() != null && Contract.Result<Assembly>() is RuntimeAssembly);
- Contract.EndContractBlock();
-
- // Call the user sink to resolve the reference.
- Assembly asm = m_UserSink.ResolveRef(typeLib);
-
- if (asm == null)
- throw new ArgumentNullException();
-
- // Return the resolved assembly. We extract the internal assembly because we are called
- // by the VM which accesses fields of the object directly and does not go via those
- // delegating properties (the fields are empty if asm is an (external) AssemblyBuilder).
-
- RuntimeAssembly rtAssembly = asm as RuntimeAssembly;
- if (rtAssembly == null)
- {
- AssemblyBuilder ab = asm as AssemblyBuilder;
- if (ab != null)
- rtAssembly = ab.InternalAssembly;
- }
-
- if (rtAssembly == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeAssembly"));
-
- // Add the assembly to the list of assemblies.
- m_AsmList.Add(rtAssembly);
-
- return rtAssembly;
- }
-
- [System.Security.SecurityCritical] // auto-generated
- public Assembly ResolveEvent(Object sender, ResolveEventArgs args)
- {
- // We need to load the type in the resolve event so that we will deal with
- // cases where we are trying to load the CoClass before the interface has
- // been loaded.
- try
- {
- LoadInMemoryTypeByName(m_Module.GetNativeHandle(), args.Name);
- return m_Module.Assembly;
- }
- catch (TypeLoadException e)
- {
- if (e.ResourceId != System.__HResults.COR_E_TYPELOAD) // type not found
- throw;
- }
-
- foreach (RuntimeAssembly asm in m_AsmList)
- {
- try
- {
- asm.GetType(args.Name, true, false);
- return asm;
- }
- catch (TypeLoadException e)
- {
- if (e._HResult != System.__HResults.COR_E_TYPELOAD) // type not found
- throw;
- }
- }
-
- return null;
- }
-
- public Assembly ResolveAsmEvent(Object sender, ResolveEventArgs args)
- {
- foreach (RuntimeAssembly asm in m_AsmList)
- {
- if (String.Compare(asm.FullName, args.Name, StringComparison.OrdinalIgnoreCase) == 0)
- return asm;
- }
-
- return null;
- }
-
- public Assembly ResolveROAsmEvent(Object sender, ResolveEventArgs args)
- {
- foreach (RuntimeAssembly asm in m_AsmList)
- {
- if (String.Compare(asm.FullName, args.Name, StringComparison.OrdinalIgnoreCase) == 0)
- return asm;
- }
-
- // We failed to find the referenced assembly in our pre-loaded assemblies, so try to load it based on policy.
- string asmName = AppDomain.CurrentDomain.ApplyPolicy(args.Name);
- return Assembly.ReflectionOnlyLoad(asmName);
- }
-
- private ModuleBuilder m_Module;
- private ITypeLibImporterNotifySink m_UserSink;
- private List<RuntimeAssembly> m_AsmList = new List<RuntimeAssembly>();
- }
- }
-}
-#endif // !FEATURE_CORECLR // current implementation requires reflection only load
-
namespace System.Runtime.InteropServices.WindowsRuntime
{
-#if FEATURE_CORECLR
[System.Runtime.CompilerServices.FriendAccessAllowed]
-#endif
[ComImport]
[Guid("82BA7092-4C88-427D-A7BC-16DD93FEB67E")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
namespace System.Runtime.ConstrainedExecution
{
-#if !FEATURE_CORECLR
-#endif
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class CriticalFinalizerObject
{
internal static void DemandForUnsafeAssemblyNameAssignments(string originalAssemblyName, string newAssemblyName)
{
-#if !FEATURE_CORECLR
- if (!IsAssemblyNameAssignmentSafe(originalAssemblyName, newAssemblyName))
- {
- CodeAccessPermission.Demand(PermissionType.SecuritySerialization);
- }
-#endif
}
internal static bool IsAssemblyNameAssignmentSafe(string originalAssemblyName, string newAssemblyName)
**Exceptions: None. All error checking is done with asserts. Although public in coreclr,
** it's not exposed in a contract and is only meant to be used by corefx.
==============================================================================*/
-#if FEATURE_CORECLR
// This should not be used by clients: exposing out this functionality would allow children
// to overwrite their parent's values. It is public in order to give corefx access to it for
// its ObjectManager implementation, but it should not be exposed out of a contract.
- public
-#else
- internal
-#endif
- void UpdateValue(String name, Object value, Type type)
+ public void UpdateValue(String name, Object value, Type type)
{
Contract.Assert(null != name, "[SerializationInfo.UpdateValue]name!=null");
Contract.Assert(null != value, "[SerializationInfo.UpdateValue]value!=null");
info.AddValue("TypeObj", m_type, typeof(RuntimeType));
}
-
-#if !FEATURE_CORECLR
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal static extern bool IsEquivalentTo(RuntimeType rtType1, RuntimeType rtType2);
-
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal static extern bool IsEquivalentType(RuntimeType type);
-#endif // FEATURE_CORECLR
}
// This type is used to remove the expense of having a managed reference object that is dynamically
[MethodImplAttribute(MethodImplOptions.InternalCall)]
static extern internal uint GetSpecialSecurityFlags(IRuntimeMethodInfo method);
-#if !FEATURE_CORECLR
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- static extern internal void PerformSecurityCheck(Object obj, RuntimeMethodHandleInternal method, RuntimeType parent, uint invocationFlags);
-
- static internal void PerformSecurityCheck(Object obj, IRuntimeMethodInfo method, RuntimeType parent, uint invocationFlags)
- {
- RuntimeMethodHandle.PerformSecurityCheck(obj, method.Value, parent, invocationFlags);
- GC.KeepAlive(method);
- return;
- }
-#endif //!FEATURE_CORECLR
#endregion
[DebuggerStepThroughAttribute]
using IUnrestrictedPermission = System.Security.Permissions.IUnrestrictedPermission;
[Serializable]
-#if !FEATURE_CORECLR
-#endif
[System.Runtime.InteropServices.ComVisible(true)]
abstract public class CodeAccessPermission
: IPermission, ISecurityEncodable, IStackWalk
[System.Diagnostics.Conditional( "_DEBUG" )]
private static void DEBUG_OUT( String str )
{
-#if _DEBUG
+#if _DEBUG
if (debug)
- {
-#if !FEATURE_CORECLR
- if (to_file)
- {
- System.Text.StringBuilder sb = new System.Text.StringBuilder();
- sb.Append( str );
- sb.Append ((char)13) ;
- sb.Append ((char)10) ;
- PolicyManager.DebugOut( file, sb.ToString() );
- }
- else
-#endif
- Console.WriteLine( str );
- }
-#endif
+ Console.WriteLine( str );
+#endif
}
-
-#if _DEBUG
+
+#if _DEBUG
private static bool debug = false;
-#if !FEATURE_CORECLR
- private static readonly bool to_file = false;
-#endif
private const String file = "d:\\foo\\debug.txt";
-#endif
+#endif
// static default constructor. This will be called before any of the static members are accessed.
static CodeAccessSecurityEngine()
}
[Serializable]
-#if !FEATURE_CORECLR
-#endif
[System.Runtime.InteropServices.ComVisible(true)]
public class HostSecurityManager {
public HostSecurityManager () {}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false )]
[System.Runtime.InteropServices.ComVisible(true)]
[Serializable]
-#if FEATURE_CORECLR
// This needs to be in the asmmeta to enable SecAnnotate to successfully resolve and run the security rules. It gets marked
// as internal by BCLRewriter so we are simply marking it as FriendAccessAllowed so it stays in the asmmeta.
[System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
-#endif // FEATURE_CORECLR
#pragma warning disable 618
sealed public class HostProtectionAttribute : CodeAccessSecurityAttribute
#pragma warning restore 618
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-//
-
namespace System.Security.Principal
{
-#if !FEATURE_CORECLR
- [Serializable]
- [System.Runtime.InteropServices.ComVisible(true)]
-#endif
- public enum TokenImpersonationLevel {
+ public enum TokenImpersonationLevel
+ {
None = 0,
Anonymous = 1,
Identification = 2,
return sb.ToString();
}
-#if !FEATURE_CORECLR
- private static void ToStringHelperStreamWriter(Object obj, String str)
- {
- ((StreamWriter)obj).Write(str);
- }
-
- internal void ToWriter( StreamWriter writer )
- {
- ToString( "", writer, new ToStringHelperFunc( ToStringHelperStreamWriter ) );
- }
-#endif
-
private void ToString( String indent, Object obj, ToStringHelperFunc func )
{
// First add the indent
- // func( obj, indent );
+ // func( obj, indent );
// Add in the opening bracket and the tag.
public bool IsStateAvailable()
{
AppDomainManager domainManager = AppDomainManager.CurrentAppDomainManager;
-#if FEATURE_CORECLR
+
// CheckSecuritySettings only when appdomainManager is present. So if there is no
// appDomain Manager return true as by default coreclr runs in fulltrust.
return domainManager != null ? domainManager.CheckSecuritySettings(this) : true;
-#else
- return domainManager != null ? domainManager.CheckSecuritySettings(this) : false;
-#endif
}
// override this function and throw the appropriate
public abstract void EnsureState();
bool omitEmptyEntries = (options == StringSplitOptions.RemoveEmptyEntries);
if ((count == 0) || (omitEmptyEntries && this.Length == 0))
- {
-#if FEATURE_CORECLR
+ {
return EmptyArray<String>.Value;
-#else
- // Keep the old behavior of returning a new empty array
- // to mitigate any potential compat risk.
- return new String[0];
-#endif
}
if (count == 1)
return new String[] { this };
}
- int[] sepList = new int[Length];
+ int[] sepList = new int[Length];
int numReplaces = MakeSeparatorList(separators, separatorsLength, sepList);
// Handle the special case of no replaces.
if (0 == numReplaces) {
return new String[] { this };
- }
+ }
if(omitEmptyEntries)
{
else
{
return SplitKeepEmptyEntries(sepList, null, 1, numReplaces, count);
- }
+ }
}
[ComVisible(false)]
}
if ((count == 0) || (omitEmptyEntries && this.Length ==0)) {
-#if FEATURE_CORECLR
return EmptyArray<String>.Value;
-#else
- // Keep the old behavior of returning a new empty array
- // to mitigate any potential compat risk.
- return new String[0];
-#endif
}
if (count == 1 || (singleSeparator && separator.Length == 0)) {
}
return chars;
}
-
-#if FEATURE_CORECLR
+
return Array.Empty<char>();
-#else
- return new char[0];
-#endif
}
// Returns a substring of this string as an array of characters.
}
return chars;
}
-
-#if FEATURE_CORECLR
+
return Array.Empty<char>();
-#else
- return new char[0];
-#endif
}
[Pure]
#endif
} // struct NativeVariant
-#if !BIT64 && !FEATURE_CORECLR
- // Structure filled by IL stubs if copy constructor(s) and destructor(s) need to be called
- // on value types pushed on the stack. The structure is stored in s_copyCtorStubDesc by
- // SetCopyCtorCookieChain and fetched by CopyCtorCallStubWorker. Must be stack-allocated.
- [StructLayout(LayoutKind.Sequential)]
- unsafe internal struct CopyCtorStubCookie
- {
- public void SetData(IntPtr srcInstancePtr, uint dstStackOffset, IntPtr ctorPtr, IntPtr dtorPtr)
- {
- m_srcInstancePtr = srcInstancePtr;
- m_dstStackOffset = dstStackOffset;
- m_ctorPtr = ctorPtr;
- m_dtorPtr = dtorPtr;
- }
-
- public void SetNext(IntPtr pNext)
- {
- m_pNext = pNext;
- }
-
- public IntPtr m_srcInstancePtr; // pointer to the source instance
- public uint m_dstStackOffset; // offset from the start of stack arguments of the pushed 'this' instance
-
- public IntPtr m_ctorPtr; // fnptr to the managed copy constructor, result of ldftn
- public IntPtr m_dtorPtr; // fnptr to the managed destructor, result of ldftn
-
- public IntPtr m_pNext; // pointer to next cookie in the chain or IntPtr.Zero
- } // struct CopyCtorStubCookie
-
- // Aggregates pointer to CopyCtorStubCookie and the target of the interop call.
- [StructLayout(LayoutKind.Sequential)]
- unsafe internal struct CopyCtorStubDesc
- {
- public IntPtr m_pCookie;
- public IntPtr m_pTarget;
- } // struct CopyCtorStubDes
-#endif // !BIT64 && !FEATURE_CORECLR
-
// Aggregates SafeHandle and the "owned" bit which indicates whether the SafeHandle
// has been successfully AddRef'ed. This allows us to do realiable cleanup (Release)
// if and only if it is needed.
[MethodImplAttribute(MethodImplOptions.InternalCall)]
static internal extern IntPtr GetDelegateTarget(Delegate pThis, ref IntPtr pStubArg);
-#if !BIT64 && !FEATURE_CORECLR
- // Written to by a managed stub helper, read by CopyCtorCallStubWorker in VM.
- [ThreadStatic]
- static CopyCtorStubDesc s_copyCtorStubDesc;
-
- static internal void SetCopyCtorCookieChain(IntPtr pStubArg, IntPtr pUnmngThis, int dwStubFlags, IntPtr pCookie)
- {
- // we store both the cookie chain head and the target of the copy ctor stub to a thread
- // static field to be accessed by the copy ctor (see code:CopyCtorCallStubWorker)
- s_copyCtorStubDesc.m_pCookie = pCookie;
- s_copyCtorStubDesc.m_pTarget = GetFinalStubTarget(pStubArg, pUnmngThis, dwStubFlags);
- }
-
- // Returns the final unmanaged stub target, ignores interceptors.
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- static internal extern IntPtr GetFinalStubTarget(IntPtr pStubArg, IntPtr pUnmngThis, int dwStubFlags);
-#endif // !FEATURE_CORECLR && !BIT64
-
-#if !FEATURE_CORECLR
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- static internal extern void DemandPermission(IntPtr pNMD);
-#endif // !FEATURE_CORECLR
-
-#if FEATURE_CORECLR
[MethodImplAttribute(MethodImplOptions.InternalCall)]
static internal extern void ClearLastError();
-#endif
[MethodImplAttribute(MethodImplOptions.InternalCall)]
static internal extern void SetLastError();
[Serializable]
[System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
-#if !FEATURE_CORECLR
- [TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
-#endif
public class LockRecursionException : System.Exception
{
public LockRecursionException() { }
MutexCleanupInfo cleanupInfo = (MutexCleanupInfo) userData;
// If hasThreadAffinity isn't true, we've thrown an exception in the above try, and we must free the mutex
- // on this OS thread before ending our thread affninity.
+ // on this OS thread before ending our thread affninity.
if(!hasThreadAffinity) {
if (cleanupInfo.mutexHandle != null && !cleanupInfo.mutexHandle.IsInvalid) {
if( cleanupInfo.inCriticalRegion) {
- Win32Native.ReleaseMutex(cleanupInfo.mutexHandle);
+ Win32Native.ReleaseMutex(cleanupInfo.mutexHandle);
}
- cleanupInfo.mutexHandle.Dispose();
-
+ cleanupInfo.mutexHandle.Dispose();
}
-
- if( cleanupInfo.inCriticalRegion) {
-#if !FEATURE_CORECLR
- Thread.EndCriticalRegion();
- Thread.EndThreadAffinity();
-#endif
- }
}
}
#pragma warning restore 169
internal NativeOverlapped m_nativeOverlapped;
-#if FEATURE_CORECLR
// Adding an empty default ctor for annotation purposes
internal OverlappedData(){}
-#endif // FEATURE_CORECLR
-
internal void ReInitialize()
{
[Serializable]
[ComVisibleAttribute(false)]
-#if !FEATURE_CORECLR
- [System.Runtime.CompilerServices.TypeForwardedFrom("System, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
-#endif
public class SemaphoreFullException : SystemException {
public SemaphoreFullException() : base(Environment.GetResourceString("Threading_SemaphoreFullException")){
// The waiters count is calculated by m_owner & WAITERS_MASK 01111....110
private static int MAXIMUM_WAITERS = WAITERS_MASK;
-
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Threading.SpinLock"/>
/// structure with the option to track thread IDs to improve debugging.
}
}
-
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Threading.SpinLock"/>
/// structure with the option to track thread IDs to improve debugging.
/// </exception>
public void Enter(ref bool lockTaken)
{
-#if !FEATURE_CORECLR
- Thread.BeginCriticalRegion();
-#endif
//Try to keep the code and branching in this method as small as possible in order to inline the method
int observedOwner = m_owner;
if (lockTaken || //invalid parameter
/// a negative number other than -1, which represents an infinite time-out.</exception>
public void TryEnter(int millisecondsTimeout, ref bool lockTaken)
{
-#if !FEATURE_CORECLR
- Thread.BeginCriticalRegion();
-#endif
-
int observedOwner = m_owner;
if (millisecondsTimeout < -1 || //invalid parameter
lockTaken || //invalid parameter
/// <param name="lockTaken">The lockTaken param</param>
private void ContinueTryEnter(int millisecondsTimeout, ref bool lockTaken)
{
- //Leave the critical region which is entered by the fast path
-#if !FEATURE_CORECLR
- Thread.EndCriticalRegion();
-#endif
// The fast path doesn't throw any exception, so we have to validate the parameters here
if (lockTaken)
{
nameof(millisecondsTimeout), millisecondsTimeout, Environment.GetResourceString("SpinLock_TryEnter_ArgumentOutOfRange"));
}
-
uint startTime = 0;
if (millisecondsTimeout != Timeout.Infinite && millisecondsTimeout != 0)
{
startTime = TimeoutHelper.GetTime();
}
-#if !FEATURE_CORECLR
- if (CdsSyncEtwBCLProvider.Log.IsEnabled())
- {
- CdsSyncEtwBCLProvider.Log.SpinLock_FastPathFailed(m_owner);
- }
-#endif
-
if (IsThreadOwnerTrackingEnabled)
{
// Slow path for enabled thread tracking mode
observedOwner = m_owner;
if ((observedOwner & LOCK_ANONYMOUS_OWNED) == LOCK_UNOWNED)
{
-#if !FEATURE_CORECLR
- Thread.BeginCriticalRegion();
-#endif
-
if (Interlocked.CompareExchange(ref m_owner, observedOwner | 1, observedOwner, ref lockTaken) == observedOwner)
{
// Aquired lock
return;
}
-#if !FEATURE_CORECLR
- Thread.EndCriticalRegion();
-#endif
if (millisecondsTimeout == 0)
{
// Did not aquire lock in CompareExchange and timeout is 0 so fail fast
observedOwner = m_owner;
if ((observedOwner & LOCK_ANONYMOUS_OWNED) == LOCK_UNOWNED)
{
-#if !FEATURE_CORECLR
- Thread.BeginCriticalRegion();
-#endif
-
int newOwner = (observedOwner & WAITERS_MASK) == 0 ? // Gets the number of waiters, if zero
observedOwner | 1 // don't decrement it. just set the lock bit, it is zzero because a previous call of Exit(false) ehich corrupted the waiters
: (observedOwner - 2) | 1; // otherwise decrement the waiters and set the lock bit
{
return;
}
-
-#if !FEATURE_CORECLR
- Thread.EndCriticalRegion();
-#endif
}
}
}
}
-
//*** Step 3, Yielding
//Sleep(1) every 50 yields
int yieldsoFar = 0;
observedOwner = m_owner;
if ((observedOwner & LOCK_ANONYMOUS_OWNED) == LOCK_UNOWNED)
{
-#if !FEATURE_CORECLR
- Thread.BeginCriticalRegion();
-#endif
int newOwner = (observedOwner & WAITERS_MASK) == 0 ? // Gets the number of waiters, if zero
observedOwner | 1 // don't decrement it. just set the lock bit, it is zzero because a previous call of Exit(false) ehich corrupted the waiters
: (observedOwner - 2) | 1; // otherwise decrement the waiters and set the lock bit
{
return;
}
-
-#if !FEATURE_CORECLR
- Thread.EndCriticalRegion();
-#endif
}
if (yieldsoFar % SLEEP_ONE_FREQUENCY == 0)
if (m_owner == lockUnowned)
{
-#if !FEATURE_CORECLR
- Thread.BeginCriticalRegion();
-#endif
if (Interlocked.CompareExchange(ref m_owner, m_newOwner, lockUnowned, ref lockTaken) == lockUnowned)
{
return;
}
-#if !FEATURE_CORECLR
- // The thread failed to get the lock, so we don't need to remain in a critical region.
- Thread.EndCriticalRegion();
-#endif
}
// Check the timeout. We only RDTSC if the next spin will yield, to amortize the cost.
if (millisecondsTimeout == 0 ||
ExitSlowPath(true);
else
Interlocked.Decrement(ref m_owner);
-
-#if !FEATURE_CORECLR
- Thread.EndCriticalRegion();
-#endif
-
}
/// <summary>
}
else
ExitSlowPath(useMemoryBarrier);
-
-#if !FEATURE_CORECLR
- Thread.EndCriticalRegion();
-#endif
}
/// <summary>
// remove the thread from the scheduler's queue for 10+ms, if the system is
// configured to use the (default) coarse-grained system timer.
//
-
-#if !FEATURE_CORECLR
- CdsSyncEtwBCLProvider.Log.SpinWait_NextSpinWillYield();
-#endif
int yieldsSoFar = (m_count >= YIELD_THRESHOLD ? m_count - YIELD_THRESHOLD : m_count);
if ((yieldsSoFar % SLEEP_1_EVERY_HOW_MANY_TIMES) == (SLEEP_1_EVERY_HOW_MANY_TIMES - 1))
}
#endif //FEATURE_COMINTEROP
-#if !FEATURE_CORECLR
-#endif
public class SynchronizationContext
{
#if FEATURE_SYNCHRONIZATIONCONTEXT_WAIT
private static extern int WaitHelperNative(IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout);
#endif
-#if FEATURE_CORECLR
-
public static void SetSynchronizationContext(SynchronizationContext syncContext)
{
Thread.CurrentThread.SynchronizationContext = syncContext;
}
}
-#else //FEATURE_CORECLR
-
- // set SynchronizationContext on the current thread
- public static void SetSynchronizationContext(SynchronizationContext syncContext)
- {
- ExecutionContext ec = Thread.CurrentThread.GetMutableExecutionContext();
- ec.SynchronizationContext = syncContext;
- ec.SynchronizationContextNoFlow = syncContext;
- }
-
- // Get the current SynchronizationContext on the current thread
- public static SynchronizationContext Current
- {
- get
- {
- return Thread.CurrentThread.GetExecutionContextReader().SynchronizationContext ?? GetThreadLocalContext();
- }
- }
-
- // Get the last SynchronizationContext that was set explicitly (not flowed via ExecutionContext.Capture/Run)
- internal static SynchronizationContext CurrentNoFlow
- {
- [FriendAccessAllowed]
- get
- {
- return Thread.CurrentThread.GetExecutionContextReader().SynchronizationContextNoFlow ?? GetThreadLocalContext();
- }
- }
-
- private static SynchronizationContext GetThreadLocalContext()
- {
- SynchronizationContext context = null;
-
-#if FEATURE_APPX
- if (context == null && AppDomain.IsAppXModel())
- context = GetWinRTContext();
-#endif
-
- return context;
- }
-
-#endif //FEATURE_CORECLR
-
#if FEATURE_APPX
private static SynchronizationContext GetWinRTContext()
{
// that can SO in 20 inlines on a typical 1MB stack size probably needs to be revisited anyway.
private const int MAX_UNCHECKED_INLINING_DEPTH = 20;
-#if !FEATURE_CORECLR
-
- private UInt64 m_lastKnownWatermark;
- private static int s_pageSize;
-
- // We are conservative here. We assume that the platform needs a whole 64KB to
- // respond to stack overflow. This means that for very small stacks (e.g. 128KB)
- // we'll fail a lot of stack checks incorrectly.
- private const long STACK_RESERVED_SPACE = 4096 * 16;
-
-#endif // !FEATURE_CORECLR
-
/// <summary>
/// This method needs to be called before attempting inline execution on the current thread.
/// If false is returned, it means we are too close to the end of the stack and should give up inlining.
private unsafe bool CheckForSufficientStack()
{
-#if FEATURE_CORECLR
return RuntimeHelpers.TryEnsureSufficientExecutionStack();
-#else
- // see if we already have the system page size info recorded
- int pageSize = s_pageSize;
- if (pageSize == 0)
- {
- // If not we need to query it from GetSystemInfo()
- // Note that this happens only once for the process lifetime
- Win32Native.SYSTEM_INFO sysInfo = new Win32Native.SYSTEM_INFO();
- Win32Native.GetSystemInfo(ref sysInfo);
-
- s_pageSize = pageSize = sysInfo.dwPageSize;
- }
-
- Win32Native.MEMORY_BASIC_INFORMATION stackInfo = new Win32Native.MEMORY_BASIC_INFORMATION();
-
- // We subtract one page for our request. VirtualQuery rounds UP to the next page.
- // Unfortunately, the stack grows down. If we're on the first page (last page in the
- // VirtualAlloc), we'll be moved to the next page, which is off the stack!
-
- UIntPtr currentAddr = new UIntPtr(&stackInfo - pageSize);
- UInt64 current64 = currentAddr.ToUInt64();
-
- // Check whether we previously recorded a deeper stack than where we currently are,
- // If so we don't need to do the P/Invoke to VirtualQuery
- if (m_lastKnownWatermark != 0 && current64 > m_lastKnownWatermark)
- return true;
-
- // Actual stack probe. P/Invoke to query for the current stack allocation information.
- Win32Native.VirtualQuery(currentAddr.ToPointer(), ref stackInfo, (UIntPtr)(sizeof(Win32Native.MEMORY_BASIC_INFORMATION)));
-
- // If the current address minus the base (remember: the stack grows downward in the
- // address space) is greater than the number of bytes requested plus the reserved
- // space at the end, the request has succeeded.
-
- if ((current64 - ((UIntPtr)stackInfo.AllocationBase).ToUInt64()) > STACK_RESERVED_SPACE)
- {
- m_lastKnownWatermark = current64;
- return true;
- }
-
- return false;
-#endif
}
}
private static bool ShouldFailFastOnUnobservedException()
{
- bool shouldFailFast = false;
- #if !FEATURE_CORECLR
- shouldFailFast = System.CLRConfig.CheckThrowUnobservedTaskExceptions();
- #endif
- return shouldFailFast;
+ return false;
}
private static void EnsureADUnloadCallbackRegistered()
#endif // FEATURE_LEAK_CULTURE_INFO
}
-#if FEATURE_CORECLR
// Adding an empty default ctor for annotation purposes
internal Thread(){}
-#endif // FEATURE_CORECLR
/*=========================================================================
** Creates a new Thread object which will begin execution at
StartInternal(principal, ref stackMark);
}
-#if FEATURE_CORECLR
internal ExecutionContext ExecutionContext
{
get { return m_ExecutionContext; }
{
get { return m_SynchronizationContext; }
set { m_SynchronizationContext = value; }
- }
-#else // !FEATURE_CORECLR
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
- internal ExecutionContext.Reader GetExecutionContextReader()
- {
- return new ExecutionContext.Reader(m_ExecutionContext);
- }
-
- internal bool ExecutionContextBelongsToCurrentScope
- {
- get { return !m_ExecutionContextBelongsToOuterScope; }
- set { m_ExecutionContextBelongsToOuterScope = !value; }
- }
-
-#if DEBUG
- internal bool ForbidExecutionContextMutation
- {
- set { m_ForbidExecutionContextMutation = value; }
- }
-#endif
-
- // note: please don't access this directly from mscorlib. Use GetMutableExecutionContext or GetExecutionContextReader instead.
- public ExecutionContext ExecutionContext
- {
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
- get
- {
- ExecutionContext result;
- if (this == Thread.CurrentThread)
- result = GetMutableExecutionContext();
- else
- result = m_ExecutionContext;
-
- return result;
- }
- }
-
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
- internal ExecutionContext GetMutableExecutionContext()
- {
- Contract.Assert(Thread.CurrentThread == this);
-#if DEBUG
- Contract.Assert(!m_ForbidExecutionContextMutation);
-#endif
- if (m_ExecutionContext == null)
- {
- m_ExecutionContext = new ExecutionContext();
- }
- else if (!ExecutionContextBelongsToCurrentScope)
- {
- ExecutionContext copy = m_ExecutionContext.CreateMutableCopy();
- m_ExecutionContext = copy;
- }
-
- ExecutionContextBelongsToCurrentScope = true;
- return m_ExecutionContext;
- }
-
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
- internal void SetExecutionContext(ExecutionContext value, bool belongsToCurrentScope)
- {
- m_ExecutionContext = value;
- ExecutionContextBelongsToCurrentScope = belongsToCurrentScope;
- }
-
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
- internal void SetExecutionContext(ExecutionContext.Reader value, bool belongsToCurrentScope)
- {
- m_ExecutionContext = value.DangerousGetRawExecutionContext();
- ExecutionContextBelongsToCurrentScope = belongsToCurrentScope;
}
-#endif //!FEATURE_CORECLR
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern void StartInternal(IPrincipal principal, ref StackCrawlMark stackMark);
** If Abort is called twice on the same thread, a DuplicateThreadAbort
** exception is thrown.
=========================================================================*/
-
-#if !FEATURE_CORECLR
- public void Abort(Object stateInfo)
- {
- // If two aborts come at the same time, it is possible that the state info
- // gets set by one, and the actual abort gets delivered by another. But this
- // is not distinguishable by an application.
- // The accessor helper will only set the value if it isn't already set,
- // and that particular bit of native code can test much faster than this
- // code could, because testing might cause a cross-appdomain marshalling.
- AbortReason = stateInfo;
-
- // Note: we demand ControlThread permission, then call AbortInternal directly
- // rather than delegating to the Abort() function below. We do this to ensure
- // that only callers with ControlThread are allowed to change the AbortReason
- // of the thread. We call AbortInternal directly to avoid demanding the same
- // permission twice.
- AbortInternal();
- }
-#endif
-
+#pragma warning disable 618
+ [SecurityPermissionAttribute(SecurityAction.Demand, ControlThread = true)]
+#pragma warning restore 618
public void Abort()
{
AbortInternal();
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern void AbortInternal();
-#if !FEATURE_CORECLR
- /*=========================================================================
- ** Resets a thread abort.
- ** Should be called by trusted code only
- =========================================================================*/
- public static void ResetAbort()
- {
- Thread thread = Thread.CurrentThread;
- if ((thread.ThreadState & ThreadState.AbortRequested) == 0)
- throw new ThreadStateException(Environment.GetResourceString("ThreadState_NoAbortRequested"));
- thread.ResetAbortNative();
- thread.ClearAbortReason();
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern void ResetAbortNative();
-
- /*=========================================================================
- ** Suspends the thread. If the thread is already suspended, this call has
- ** no effect.
- **
- ** Exceptions: ThreadStateException if the thread has not been started or
- ** it is dead.
- =========================================================================*/
- public void Suspend() { SuspendInternal(); }
-
- // Internal helper (since we can't place security demands on
- // ecalls/fcalls).
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern void SuspendInternal();
-
- /*=========================================================================
- ** Resumes a thread that has been suspended.
- **
- ** Exceptions: ThreadStateException if the thread has not been started or
- ** it is dead or it isn't in the suspended state.
- =========================================================================*/
- [Obsolete("Thread.Resume has been deprecated. Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources. http://go.microsoft.com/fwlink/?linkid=14202", false)]
- public void Resume() { ResumeInternal(); }
-
- // Internal helper (since we can't place security demands on
- // ecalls/fcalls).
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern void ResumeInternal();
-
- /*=========================================================================
- ** Interrupts a thread that is inside a Wait(), Sleep() or Join(). If that
- ** thread is not currently blocked in that manner, it will be interrupted
- ** when it next begins to block.
- =========================================================================*/
- public new void Interrupt() => base.Interrupt();
-
- /*=========================================================================
- ** Returns the priority of the thread.
- **
- ** Exceptions: ThreadStateException if the thread is dead.
- =========================================================================*/
-
- public new ThreadPriority Priority
- {
- get
- {
- return base.Priority;
- }
- [HostProtection(SelfAffectingThreading = true)]
- set
- {
- base.Priority = value;
- }
- }
-
- /*=========================================================================
- ** Returns true if the thread has been started and is not dead.
- =========================================================================*/
- public new bool IsAlive
- {
- get
- {
- return base.IsAlive;
- }
- }
-
- /*=========================================================================
- ** Returns true if the thread is a threadpool thread.
- =========================================================================*/
- public new bool IsThreadPoolThread
- {
- get
- {
- return base.IsThreadPoolThread;
- }
- }
-
- /*=========================================================================
- ** Waits for the thread to die or for timeout milliseconds to elapse.
- ** Returns true if the thread died, or false if the wait timed out. If
- ** Timeout.Infinite is given as the parameter, no timeout will occur.
- **
- ** Exceptions: ArgumentException if timeout < 0.
- ** ThreadInterruptedException if the thread is interrupted while waiting.
- ** ThreadStateException if the thread has not been started yet.
- =========================================================================*/
- [HostProtection(Synchronization = true, ExternalThreading = true)]
- public new void Join() => base.Join();
-
- [HostProtection(Synchronization = true, ExternalThreading = true)]
- public new bool Join(int millisecondsTimeout) => base.Join(millisecondsTimeout);
-#endif // !FEATURE_CORECLR
-
[HostProtection(Synchronization=true, ExternalThreading=true)]
public bool Join(TimeSpan timeout)
{
private void SetStartHelper(Delegate start, int maxStackSize)
{
-#if FEATURE_CORECLR
// We only support default stacks in CoreCLR
Contract.Assert(maxStackSize == 0);
-#else
- // Only fully-trusted code is allowed to create "large" stacks. Partial-trust falls back to
- // the default stack size.
- ulong defaultStackSize = GetProcessDefaultStackSize();
- if ((ulong)(uint)maxStackSize > defaultStackSize)
- {
- try
- {
- SecurityPermission.Demand(PermissionType.FullTrust);
- }
- catch (SecurityException)
- {
- maxStackSize = (int)Math.Min(defaultStackSize, (ulong)(uint)int.MaxValue);
- }
- }
-#endif
ThreadHelper threadStartCallBack = new ThreadHelper(start);
if(start is ThreadStart)
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern void InternalFinalize();
-#if !FEATURE_CORECLR
-#if FEATURE_COMINTEROP
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
- public new void DisableComObjectEagerCleanup()
- {
- base.DisableComObjectEagerCleanup();
- }
-#endif // FEATURE_COMINTEROP
-
- /*=========================================================================
- ** Return whether or not this thread is a background thread. Background
- ** threads do not affect when the Execution Engine shuts down.
- **
- ** Exceptions: ThreadStateException if the thread is dead.
- =========================================================================*/
- public new bool IsBackground
- {
- get
- {
- return base.IsBackground;
- }
- [HostProtection(SelfAffectingThreading = true)]
- set
- {
- base.IsBackground = value;
- }
- }
-
- /*=========================================================================
- ** Return the thread state as a consistent set of bits. This is more
- ** general then IsAlive or IsBackground.
- =========================================================================*/
- public new ThreadState ThreadState
- {
- get
- {
- return base.ThreadState;
- }
- }
-#endif // !FEATURE_CORECLR
-
#if FEATURE_COMINTEROP_APARTMENT_SUPPORT
/*=========================================================================
** An unstarted thread can be marked to indicate that it will host a
}
}
-#if !FEATURE_CORECLR
- public new ApartmentState GetApartmentState() => base.GetApartmentState();
-
- [HostProtection(Synchronization=true, SelfAffectingThreading=true)]
- public new bool TrySetApartmentState(ApartmentState state) => base.TrySetApartmentState(state);
-#endif // !FEATURE_CORECLR
-
[HostProtection(Synchronization=true, SelfAffectingThreading=true)]
public void SetApartmentState(ApartmentState state)
{
set { SetAbortReason(value); }
}
-#if !FEATURE_CORECLR
- /*
- * This marks the beginning of a critical code region.
- */
- [HostProtection(Synchronization=true, ExternalThreading=true)]
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
- public static extern void BeginCriticalRegion();
-
- /*
- * This marks the end of a critical code region.
- */
- [HostProtection(Synchronization=true, ExternalThreading=true)]
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
- public static extern void EndCriticalRegion();
-
- /*
- * This marks the beginning of a code region that requires thread affinity.
- */
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
- public static extern void BeginThreadAffinity();
-
- /*
- * This marks the end of a code region that requires thread affinity.
- */
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
- public static extern void EndThreadAffinity();
-#endif // !FEATURE_CORECLR
-
/*=========================================================================
** Volatile Read & Write and MemoryBarrier methods.
** Provides the ability to read and write values ensuring that the values
}
}
-#if !FEATURE_CORECLR
- void _Thread.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _Thread.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _Thread.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- void _Thread.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
-
// Helper function to set the AbortReason for a thread abort.
// Checks that they're not alredy set, and then atomically updates
// the reason info (object + ADID).
using System.Diagnostics.CodeAnalysis;
using Win32Native = Microsoft.Win32.Win32Native;
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public abstract class WaitHandle : MarshalByRefObject, IDisposable {
public const int WaitTimeout = 0x102;
public virtual IntPtr Handle
{
get { return safeWaitHandle == null ? InvalidHandle : safeWaitHandle.DangerousGetHandle();}
-
-#if !FEATURE_CORECLR
-#endif
set
{
if (value == InvalidHandle)
}
}
-
public SafeWaitHandle SafeWaitHandle
{
-#if !FEATURE_CORECLR
-#endif
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
get
{
}
return safeWaitHandle;
}
-
-#if !FEATURE_CORECLR
-#endif
+
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
set
{
// in CoreCLR, and ArgumentNullException in the desktop CLR. This is ugly, but so is breaking
// user code.
//
-#if FEATURE_CORECLR
throw new ArgumentException(Environment.GetResourceString("Argument_EmptyWaithandleArray"));
-#else
- throw new ArgumentNullException(nameof(waitHandles), Environment.GetResourceString("Argument_EmptyWaithandleArray"));
-#endif
}
if (waitHandles.Length > MAX_WAITHANDLES)
{
int ret = SignalAndWaitOne(toSignal.safeWaitHandle,toWaitOn.safeWaitHandle,millisecondsTimeout,
toWaitOn.hasThreadAffinity,exitContext);
-#if !FEATURE_CORECLR
- if(WAIT_FAILED != ret && toSignal.hasThreadAffinity)
- {
- Thread.EndCriticalRegion();
- Thread.EndThreadAffinity();
- }
-#endif
-
if(WAIT_ABANDONED == ret)
{
ThrowAbandonedMutexException();
throw GetWrongValueTypeArgumentException(value, targetType);
}
-
-#if FEATURE_CORECLR
private static ArgumentException GetAddingDuplicateWithKeyArgumentException(object key) {
return new ArgumentException(Environment.GetResourceString("Argument_AddingDuplicateWithKey", key));
}
internal static void ThrowAddingDuplicateWithKeyArgumentException(object key) {
throw GetAddingDuplicateWithKeyArgumentException(key);
}
-#endif
internal static void ThrowKeyNotFoundException() {
throw new System.Collections.Generic.KeyNotFoundException();
// details of this type should change, or new fields added, we need to remember to add
// an appropriate custom ILMarshaler to keep WInRT interop scenarios enabled.
//
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
[Serializable] public struct TimeSpan : IComparable
, IComparable<TimeSpan>, IEquatable<TimeSpan>, IFormattable
{
// [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework]
// "TimeSpan_LegacyFormatMode"=dword:00000001
//
-#if !FEATURE_CORECLR
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static extern bool LegacyFormatMode();
-#endif // !FEATURE_CORECLR
- //
- // In Silverlight v4, specifying the APP_EARLIER_THAN_SL4.0 quirks mode allows applications to
- // run in v2 - v3 legacy behavior.
- //
-#if !FEATURE_CORECLR
-#endif
private static bool GetLegacyFormatMode() {
-#if !FEATURE_CORECLR
- if (LegacyFormatMode()) // FCALL to check COMPlus_TimeSpan_LegacyFormatMode
- return true;
- return CompatibilitySwitches.IsNetFx40TimeSpanLegacyFormatMode;
-#else
return false;
-#endif // !FEATURE_CORECLR
}
private static volatile bool _legacyConfigChecked;
using System.Globalization;
[Serializable]
-[System.Runtime.InteropServices.ComVisible(true)]
-#if FEATURE_CORECLR
+ [System.Runtime.InteropServices.ComVisible(true)]
[Obsolete("System.TimeZone has been deprecated. Please investigate the use of System.TimeZoneInfo instead.")]
-#endif
public abstract class TimeZone {
private static volatile TimeZone currentTimeZone = null;
NoThrowOnInvalidTime = 2
};
-
[Serializable]
[System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
-#if !FEATURE_CORECLR
- [TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
-#endif
sealed public class TimeZoneInfo : IEquatable<TimeZoneInfo>, ISerializable, IDeserializationCallback
{
// ---- SECTION: members supporting exposed properties -------------*
// <CallsSuppressUnmanagedCode Name="UnsafeNativeMethods.GetFileMUIPath(System.Int32,System.String,System.Text.StringBuilder,System.Int32&,System.Text.StringBuilder,System.Int32&,System.Int64&):System.Boolean" />
// <ReferencesCritical Name="Method: TryGetLocalizedNameByNativeResource(String, Int32):String" Ring="1" />
// </SecurityKernel>
-#if !FEATURE_CORECLR
- [FileIOPermissionAttribute(SecurityAction.Assert, AllLocalFiles = FileIOPermissionAccess.PathDiscovery)]
-#endif
static private string TryGetLocalizedNameByMuiNativeResource(string resource) {
if (String.IsNullOrEmpty(resource)) {
return String.Empty;
============================================================*/
[Serializable]
[System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
-#if !FEATURE_CORECLR
- [TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
-#endif
sealed public class AdjustmentRule : IEquatable<AdjustmentRule>, ISerializable, IDeserializationCallback
{
============================================================*/
[Serializable]
[System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
-#if !FEATURE_CORECLR
- [TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
-#endif
public struct TransitionTime : IEquatable<TransitionTime>, ISerializable, IDeserializationCallback
{
// ---- SECTION: members supporting exposed properties -------------*
using System.Runtime.CompilerServices;
[Serializable]
-#if !FEATURE_CORECLR
- [TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
-#endif
[System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
public class TimeZoneNotFoundException : Exception {
public TimeZoneNotFoundException(String message)
{
return GetProperties(Type.DefaultLookup);
}
-#if !FEATURE_CORECLR
-#endif
+
// GetNestedTypes()
// This set of method will return any nested types that are found inside
// of the type.
abstract public Type[] GetNestedTypes(BindingFlags bindingAttr);
-#if !FEATURE_CORECLR
- // GetNestedType()
-#endif
public Type GetNestedType(String name)
{
return GetNestedType(name,Type.DefaultLookup);
return base.GetType();
}
-#if !FEATURE_CORECLR
- void _Type.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _Type.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _Type.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- // If you implement this method, make sure to include _Type.Invoke in VM\DangerousAPIs.h and
- // include _Type in SystemDomain::IsReflectionInvocationMethod in AppDomain.cpp.
- void _Type.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
-
// private convenience data
private const BindingFlags DefaultLookup = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public;
internal const BindingFlags DeclaredOnlyLookup = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
}
public unsafe override int GetHashCode() {
-#if FEATURE_CORECLR
#if BIT64
ulong l = (ulong)m_value;
return (unchecked((int)l) ^ (int)(l >> 32));
#else // 32
return unchecked((int)m_value);
#endif
-#else
- return unchecked((int)((long)m_value)) & 0x7fffffff;
-#endif
}
[System.Runtime.Versioning.NonVersionable]
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Diagnostics.Contracts;
+
[System.Runtime.InteropServices.ComVisible(true)]
-#if !FEATURE_CORECLR
-#endif
[Serializable]
public class WeakReference : ISerializable
{
// This field is not a regular GC handle. It can have a special values that are used to prevent a race condition between setting the target and finalization.
internal IntPtr m_handle;
-
-#if FEATURE_CORECLR
+
// Migrating InheritanceDemands requires this default ctor, so we can mark it SafeCritical
protected WeakReference() {
Contract.Assert(false, "WeakReference's protected default ctor should never be used!");
throw new NotImplementedException();
}
-#endif
// Creates a new WeakReference that keeps track of target.
// Assumes a Short Weak Reference (ie TrackResurrection is false.)
// See the LICENSE file in the project root for more information.
using System.Runtime.CompilerServices;
-#if FEATURE_CORECLR
// We need this to be able to typeforward to internal types
[assembly: InternalsVisibleTo("mscorlib, PublicKey=00240000048000009400000006020000002400005253413100040000010001008d56c76f9e8649383049f383c44be0ec204181822a6c31cf5eb7ef486944d032188ea1d3920763712ccb12d75fb77e9811149e6148e5d32fbaab37611c1878ddc19e20ef135d0cb2cff2bfec3d115810c3d9069638fe4be215dbf795861920e5ab6f7db2e2ceef136ac23d5dd2bf031700aec232f6c6b1c785b4305c123b37ab", AllInternalsVisible=false)]
-#endif
// For now we are only moving to using this file over AssemblyAttributes.cspp in CoreSys, ideally we would move away from the centralized
// AssemblyAttributes.cspp model for the other build types at a future point in time.