summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Linux.Microsoft.NETCore.Runtime.CoreCLR.props2
-rw-r--r--src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.OSX.Microsoft.NETCore.Runtime.CoreCLR.props2
-rw-r--r--src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Windows_NT.Microsoft.NETCore.Runtime.CoreCLR.props3
-rw-r--r--src/.nuget/Microsoft.TargetingPack.Private.CoreCLR/Microsoft.TargetingPack.Private.CoreCLR.pkgproj3
-rw-r--r--src/.nuget/dir.props36
-rw-r--r--src/.nuget/dir.targets4
-rw-r--r--src/ToolBox/SOS/NETCore/SOS.NETCore.csproj4
-rw-r--r--src/ToolBox/SOS/NETCore/SymbolReader.cs34
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/icorjitcompilerimpl.h4
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h39
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/lwmlist.h2
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp40
-rw-r--r--src/ToolBox/superpmi/superpmi-shared/methodcontext.h19
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp13
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp11
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp11
-rw-r--r--src/ToolBox/superpmi/superpmi/icorjitinfo.cpp11
-rw-r--r--src/binder/clrprivbindercoreclr.cpp4
-rw-r--r--src/build.proj7
-rw-r--r--src/classlibnative/bcltype/arraynative.cpp10
-rw-r--r--src/classlibnative/bcltype/system.cpp91
-rw-r--r--src/classlibnative/bcltype/system.h3
-rw-r--r--src/classlibnative/float/floatdouble.cpp27
-rw-r--r--src/classlibnative/float/floatsingle.cpp31
-rw-r--r--src/coreclr/hosts/unixcoreconsole/CMakeLists.txt4
-rw-r--r--src/coreclr/hosts/unixcorerun/CMakeLists.txt4
-rw-r--r--src/corefx/System.Globalization.Native/CMakeLists.txt28
-rw-r--r--src/corefx/System.Globalization.Native/icushim.cpp69
-rw-r--r--src/corefx/System.Globalization.Native/icushim.h9
-rw-r--r--src/debug/daccess/CMakeLists.txt2
-rw-r--r--src/debug/daccess/daccess.cpp2
-rw-r--r--src/debug/daccess/dacdbiimpl.cpp15
-rw-r--r--src/debug/daccess/enummem.cpp9
-rw-r--r--src/debug/daccess/request.cpp29
-rw-r--r--src/debug/daccess/request_svr.cpp3
-rw-r--r--src/debug/di/process.cpp8
-rw-r--r--src/debug/di/rsmain.cpp2
-rw-r--r--src/debug/ee/dactable.cpp8
-rw-r--r--src/dlls/CMakeLists.txt8
-rw-r--r--src/dlls/mscoree/coreclr/CMakeLists.txt7
-rw-r--r--src/dlls/mscoree/coreclr/README.md7
-rw-r--r--src/dlls/mscoree/coreclr/dump_helper_resource.binbin0 -> 17 bytes
-rw-r--r--src/gc/CMakeLists.txt1
-rw-r--r--src/gc/env/gcenv.base.h2
-rw-r--r--src/gc/env/gcenv.ee.h3
-rw-r--r--src/gc/gc.cpp466
-rw-r--r--src/gc/gc.h40
-rw-r--r--src/gc/gccommon.cpp46
-rw-r--r--src/gc/gcee.cpp17
-rw-r--r--src/gc/gceesvr.cpp2
-rw-r--r--src/gc/gceewks.cpp1
-rw-r--r--src/gc/gcenv.ee.standalone.inl12
-rw-r--r--src/gc/gchandletable.cpp34
-rw-r--r--src/gc/gchandletableimpl.h22
-rw-r--r--src/gc/gcimpl.h54
-rw-r--r--src/gc/gcinterface.dac.h6
-rw-r--r--src/gc/gcinterface.dacvars.def1
-rw-r--r--src/gc/gcinterface.ee.h9
-rw-r--r--src/gc/gcinterface.h129
-rw-r--r--src/gc/gcpriv.h32
-rw-r--r--src/gc/gcscan.cpp17
-rw-r--r--src/gc/gcscan.h11
-rw-r--r--src/gc/handletable.h5
-rw-r--r--src/gc/objecthandle.cpp4
-rw-r--r--src/gc/objecthandle.h5
-rw-r--r--src/gc/sample/CMakeLists.txt1
-rw-r--r--src/gc/sample/GCSample.cpp25
-rw-r--r--src/gc/sample/gcenv.ee.cpp16
-rw-r--r--src/gc/unix/CMakeLists.txt3
-rw-r--r--src/gc/unix/cgroup.cpp342
-rw-r--r--src/gc/unix/gcenv.unix.cpp25
-rw-r--r--src/gc/windows/gcenv.windows.cpp3
-rw-r--r--src/ilasm/grammar_after.cpp1
-rw-r--r--src/ildasm/dasm.cpp2
-rw-r--r--src/inc/clrconfigvalues.h15
-rw-r--r--src/inc/corbbtprof.h27
-rw-r--r--src/inc/coregen.h1
-rw-r--r--src/inc/corhdr.h1
-rw-r--r--src/inc/corinfo.h150
-rw-r--r--src/inc/corjit.h93
-rw-r--r--src/inc/crosscomp.h4
-rw-r--r--src/inc/dacvars.h8
-rw-r--r--src/inc/eventtracebase.h10
-rw-r--r--src/inc/formattype.cpp2
-rw-r--r--src/inc/jithelpers.h15
-rw-r--r--src/inc/legacyactivationshim.h1382
-rw-r--r--src/inc/legacyactivationshimdelayload.h13
-rw-r--r--src/inc/loglf.h66
-rw-r--r--src/inc/profilepriv.h4
-rw-r--r--src/inc/regdisp.h2
-rw-r--r--src/inc/volatile.h2
-rw-r--r--src/inc/winwrap.h3
-rw-r--r--src/jit/CMakeLists.txt15
-rw-r--r--src/jit/DIRS.proj4
-rw-r--r--src/jit/ICorJitInfo_API_wrapper.hpp48
-rwxr-xr-xsrc/jit/_typeinfo.h14
-rw-r--r--src/jit/assertionprop.cpp219
-rw-r--r--src/jit/bitset.cpp4
-rw-r--r--src/jit/bitsetasshortlong.h137
-rw-r--r--src/jit/block.h39
-rw-r--r--src/jit/codegenarm.cpp537
-rw-r--r--src/jit/codegenarm64.cpp59
-rw-r--r--src/jit/codegencommon.cpp97
-rw-r--r--src/jit/codegenlegacy.cpp2
-rw-r--r--src/jit/codegenlinear.h38
-rw-r--r--src/jit/codegenxarch.cpp175
-rw-r--r--src/jit/compiler.cpp11
-rw-r--r--src/jit/compiler.h143
-rw-r--r--src/jit/compiler.hpp20
-rw-r--r--src/jit/compilerbitsettraits.h8
-rw-r--r--src/jit/compilerbitsettraits.hpp16
-rw-r--r--src/jit/ee_il_dll.cpp162
-rw-r--r--src/jit/ee_il_dll.hpp4
-rw-r--r--src/jit/emit.cpp2
-rw-r--r--src/jit/emitarm.cpp16
-rw-r--r--src/jit/emitarm.h1
-rw-r--r--src/jit/emitarm64.cpp8
-rw-r--r--src/jit/flowgraph.cpp606
-rw-r--r--src/jit/gentree.cpp858
-rw-r--r--src/jit/gentree.h275
-rw-r--r--src/jit/importer.cpp340
-rw-r--r--src/jit/inline.h39
-rw-r--r--src/jit/jit.h17
-rw-r--r--src/jit/jitee.h72
-rw-r--r--src/jit/jitpch.h4
-rw-r--r--src/jit/lclvars.cpp305
-rw-r--r--src/jit/legacynonjit/.gitmirror1
-rw-r--r--src/jit/legacynonjit/CMakeLists.txt67
-rw-r--r--src/jit/legacynonjit/legacynonjit.def7
-rw-r--r--src/jit/liveness.cpp18
-rw-r--r--src/jit/lower.cpp51
-rw-r--r--src/jit/lsraarm.cpp115
-rw-r--r--src/jit/morph.cpp229
-rw-r--r--src/jit/optcse.cpp42
-rw-r--r--src/jit/optimizer.cpp12
-rw-r--r--src/jit/protononjit/CMakeLists.txt11
-rw-r--r--src/jit/rangecheck.cpp6
-rw-r--r--src/jit/utils.cpp26
-rw-r--r--src/jit/valuenum.cpp10
-rw-r--r--src/md/compiler/mdperf.h1
-rw-r--r--src/md/compiler/mdvalidator.cpp2
-rw-r--r--src/md/compiler/newmerger.cpp6303
-rw-r--r--src/md/compiler/newmerger.h256
-rw-r--r--src/md/compiler/regmeta.cpp15
-rw-r--r--src/md/compiler/regmeta.h8
-rw-r--r--src/md/compiler/regmeta_compilersupport.cpp274
-rw-r--r--src/md/compiler/regmeta_emit.cpp75
-rw-r--r--src/md/compiler/wks/CMakeLists.txt4
-rw-r--r--src/md/enc/rwutil.cpp143
-rw-r--r--src/md/enc/wks/CMakeLists.txt2
-rw-r--r--src/md/hotdata/hotdataformat.h2
-rw-r--r--src/md/inc/liteweightstgdb.h2
-rw-r--r--src/md/inc/rwutil.h24
-rw-r--r--src/md/md_wks.cmake2
-rw-r--r--src/md/runtime/wks/CMakeLists.txt2
-rw-r--r--src/md/winmd/wks/CMakeLists.txt4
-rw-r--r--src/mscorlib/Common/System/SR.cs197
-rw-r--r--src/mscorlib/Resources/Strings.resx3569
-rw-r--r--src/mscorlib/System.Private.CoreLib.csproj209
-rw-r--r--src/mscorlib/facade/mscorlib.csproj115
-rw-r--r--src/mscorlib/facade/project.json16
-rw-r--r--src/mscorlib/ref/mscorlib.cs13783
-rw-r--r--src/mscorlib/ref/mscorlib.csproj93
-rw-r--r--src/mscorlib/ref/mscorlib.manual.cs785
-rw-r--r--src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.Calendar.cs (renamed from src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Calendar.cs)0
-rw-r--r--src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.Casing.cs (renamed from src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Casing.cs)0
-rw-r--r--src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.Idna.cs (renamed from src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Idna.cs)0
-rw-r--r--src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.Locale.cs (renamed from src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Locale.cs)0
-rw-r--r--src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.Normalization.cs (renamed from src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Normalization.cs)0
-rw-r--r--src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.ResultCode.cs (renamed from src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.ResultCode.cs)0
-rw-r--r--src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.TimeZoneInfo.cs (renamed from src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.TimeZoneInfo.cs)0
-rw-r--r--src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.Utils.cs (renamed from src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Utils.cs)0
-rw-r--r--src/mscorlib/shared/Interop/Windows/Crypt32/Interop.CryptProtectMemory.cs (renamed from src/mscorlib/src/Interop/Windows/Crypt32/Interop.CryptProtectMemory.cs)0
-rw-r--r--src/mscorlib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs31
-rw-r--r--src/mscorlib/shared/Interop/Windows/Kernel32/Interop.WideCharToMultiByte.cs (renamed from src/mscorlib/src/Interop/Windows/kernel32/Interop.WideCharToMultiByte.cs)0
-rw-r--r--src/mscorlib/shared/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs3
-rw-r--r--src/mscorlib/shared/README.md19
-rw-r--r--src/mscorlib/shared/System.Private.CoreLib.Shared.projitems223
-rw-r--r--src/mscorlib/shared/System/AssemblyLoadEventArgs.cs18
-rw-r--r--src/mscorlib/shared/System/AssemblyLoadEventHandler.cs8
-rw-r--r--src/mscorlib/shared/System/AttributeUsageAttribute.cs26
-rw-r--r--src/mscorlib/shared/System/Char.cs (renamed from src/mscorlib/src/System/Char.cs)67
-rw-r--r--src/mscorlib/shared/System/CharEnumerator.cs1
-rw-r--r--src/mscorlib/shared/System/Convert.cs (renamed from src/mscorlib/src/System/Convert.cs)300
-rw-r--r--src/mscorlib/shared/System/CurrentSystemTimeZone.cs (renamed from src/mscorlib/src/System/CurrentTimeZone.cs)63
-rw-r--r--src/mscorlib/shared/System/DBNull.cs119
-rw-r--r--src/mscorlib/shared/System/DateTime.cs (renamed from src/mscorlib/src/System/DateTime.cs)221
-rw-r--r--src/mscorlib/shared/System/DateTimeOffset.cs (renamed from src/mscorlib/src/System/DateTimeOffset.cs)111
-rw-r--r--src/mscorlib/shared/System/DefaultBinder.cs (renamed from src/mscorlib/src/System/DefaultBinder.cs)246
-rw-r--r--src/mscorlib/shared/System/Globalization/CalendarAlgorithmType.cs (renamed from src/mscorlib/src/System/Globalization/CalendarAlgorithmType.cs)2
-rw-r--r--src/mscorlib/shared/System/Globalization/CalendarWeekRule.cs (renamed from src/mscorlib/src/System/Globalization/CalendarWeekRule.cs)2
-rw-r--r--src/mscorlib/shared/System/Globalization/CalendricalCalculationsHelper.cs (renamed from src/mscorlib/src/System/Globalization/CalendricalCalculationsHelper.cs)0
-rw-r--r--src/mscorlib/shared/System/Globalization/ChineseLunisolarCalendar.cs (renamed from src/mscorlib/src/System/Globalization/ChineseLunisolarCalendar.cs)6
-rw-r--r--src/mscorlib/shared/System/Globalization/CultureNotFoundException.cs (renamed from src/mscorlib/src/System/Globalization/CultureNotFoundException.cs)4
-rw-r--r--src/mscorlib/shared/System/Globalization/CultureTypes.cs27
-rw-r--r--src/mscorlib/shared/System/Globalization/DateTimeFormat.cs (renamed from src/mscorlib/src/System/Globalization/DateTimeFormat.cs)43
-rw-r--r--src/mscorlib/shared/System/Globalization/DateTimeFormatInfo.cs (renamed from src/mscorlib/src/System/Globalization/DateTimeFormatInfo.cs)57
-rw-r--r--src/mscorlib/shared/System/Globalization/DateTimeFormatInfoScanner.cs (renamed from src/mscorlib/src/System/Globalization/DateTimeFormatInfoScanner.cs)3
-rw-r--r--src/mscorlib/shared/System/Globalization/DateTimeParse.cs (renamed from src/mscorlib/src/System/Globalization/DateTimeParse.cs)44
-rw-r--r--src/mscorlib/shared/System/Globalization/DateTimeStyles.cs (renamed from src/mscorlib/src/System/Globalization/DateTimeStyles.cs)1
-rw-r--r--src/mscorlib/shared/System/Globalization/DaylightTime.cs (renamed from src/mscorlib/src/System/Globalization/DaylightTime.cs)2
-rw-r--r--src/mscorlib/shared/System/Globalization/DigitShapes.cs (renamed from src/mscorlib/src/System/Globalization/DigitShapes.cs)7
-rw-r--r--src/mscorlib/shared/System/Globalization/EastAsianLunisolarCalendar.cs (renamed from src/mscorlib/src/System/Globalization/EastAsianLunisolarCalendar.cs)7
-rw-r--r--src/mscorlib/shared/System/Globalization/GregorianCalendarTypes.cs (renamed from src/mscorlib/src/System/Globalization/GregorianCalendarTypes.cs)2
-rw-r--r--src/mscorlib/shared/System/Globalization/HebrewCalendar.cs (renamed from src/mscorlib/src/System/Globalization/HebrewCalendar.cs)0
-rw-r--r--src/mscorlib/shared/System/Globalization/HebrewNumber.cs (renamed from src/mscorlib/src/System/Globalization/HebrewNumber.cs)0
-rw-r--r--src/mscorlib/shared/System/Globalization/HijriCalendar.cs (renamed from src/mscorlib/src/System/Globalization/HijriCalendar.cs)2
-rw-r--r--src/mscorlib/shared/System/Globalization/InternalGlobalizationHelper.cs (renamed from src/mscorlib/src/System/Globalization/InternalGlobalizationHelper.cs)4
-rw-r--r--src/mscorlib/shared/System/Globalization/JapaneseCalendar.cs (renamed from src/mscorlib/src/System/Globalization/JapaneseCalendar.cs)2
-rw-r--r--src/mscorlib/shared/System/Globalization/JapaneseLunisolarCalendar.cs (renamed from src/mscorlib/src/System/Globalization/JapaneseLunisolarCalendar.cs)6
-rw-r--r--src/mscorlib/shared/System/Globalization/JulianCalendar.cs (renamed from src/mscorlib/src/System/Globalization/JulianCalendar.cs)1
-rw-r--r--src/mscorlib/shared/System/Globalization/KoreanCalendar.cs (renamed from src/mscorlib/src/System/Globalization/KoreanCalendar.cs)1
-rw-r--r--src/mscorlib/shared/System/Globalization/KoreanLunisolarCalendar.cs (renamed from src/mscorlib/src/System/Globalization/KoreanLunisolarCalendar.cs)6
-rw-r--r--src/mscorlib/shared/System/Globalization/LocaleData.Unix.cs (renamed from src/mscorlib/src/System/Globalization/LocaleData.Unix.cs)0
-rw-r--r--src/mscorlib/shared/System/Globalization/NumberStyles.cs (renamed from src/mscorlib/src/System/Globalization/NumberStyles.cs)3
-rw-r--r--src/mscorlib/shared/System/Globalization/PersianCalendar.cs (renamed from src/mscorlib/src/System/Globalization/PersianCalendar.cs)5
-rw-r--r--src/mscorlib/shared/System/Globalization/SortVersion.cs (renamed from src/mscorlib/src/System/Globalization/SortVersion.cs)5
-rw-r--r--src/mscorlib/shared/System/Globalization/TaiwanCalendar.cs (renamed from src/mscorlib/src/System/Globalization/TaiwanCalendar.cs)0
-rw-r--r--src/mscorlib/shared/System/Globalization/TaiwanLunisolarCalendar.cs (renamed from src/mscorlib/src/System/Globalization/TaiwanLunisolarCalendar.cs)13
-rw-r--r--src/mscorlib/shared/System/Globalization/ThaiBuddhistCalendar.cs (renamed from src/mscorlib/src/System/Globalization/ThaiBuddhistCalendar.cs)0
-rw-r--r--src/mscorlib/shared/System/Globalization/TimeSpanStyles.cs (renamed from src/mscorlib/src/System/Globalization/TimeSpanStyles.cs)0
-rw-r--r--src/mscorlib/shared/System/Globalization/UmAlQuraCalendar.cs (renamed from src/mscorlib/src/System/Globalization/UmAlQuraCalendar.cs)5
-rw-r--r--src/mscorlib/shared/System/Globalization/UnicodeCategory.cs (renamed from src/mscorlib/src/System/Globalization/UnicodeCategory.cs)30
-rw-r--r--src/mscorlib/shared/System/IO/Error.cs2
-rw-r--r--src/mscorlib/shared/System/IO/FileStream.Unix.cs21
-rw-r--r--src/mscorlib/shared/System/IO/FileStream.Win32.cs1700
-rw-r--r--src/mscorlib/shared/System/IO/FileStream.WinRT.cs78
-rw-r--r--src/mscorlib/shared/System/IO/FileStream.Windows.cs1717
-rw-r--r--src/mscorlib/shared/System/IO/FileStream.cs3
-rw-r--r--src/mscorlib/shared/System/IO/Path.Windows.cs4
-rw-r--r--src/mscorlib/shared/System/IO/Path.cs3
-rw-r--r--src/mscorlib/shared/System/IO/StreamHelpers.CopyValidation.cs (renamed from src/mscorlib/src/System/IO/StreamHelpers.CopyValidation.cs)10
-rw-r--r--src/mscorlib/shared/System/Lazy.cs2
-rw-r--r--src/mscorlib/shared/System/MarshalByRefObject.cs4
-rw-r--r--src/mscorlib/shared/System/Reflection/AmbiguousMatchException.cs35
-rw-r--r--src/mscorlib/shared/System/Reflection/Assembly.cs200
-rw-r--r--src/mscorlib/shared/System/Reflection/AssemblyAlgorithmIdAttribute.cs27
-rw-r--r--src/mscorlib/shared/System/Reflection/AssemblyCompanyAttribute.cs18
-rw-r--r--src/mscorlib/shared/System/Reflection/AssemblyConfigurationAttribute.cs18
-rw-r--r--src/mscorlib/shared/System/Reflection/AssemblyContentType.cs13
-rw-r--r--src/mscorlib/shared/System/Reflection/AssemblyCopyrightAttribute.cs18
-rw-r--r--src/mscorlib/shared/System/Reflection/AssemblyCultureAttribute.cs18
-rw-r--r--src/mscorlib/shared/System/Reflection/AssemblyDefaultAliasAttribute.cs18
-rw-r--r--src/mscorlib/shared/System/Reflection/AssemblyDelaySignAttribute.cs18
-rw-r--r--src/mscorlib/shared/System/Reflection/AssemblyDescriptionAttribute.cs18
-rw-r--r--src/mscorlib/shared/System/Reflection/AssemblyFileVersionAttribute.cs20
-rw-r--r--src/mscorlib/shared/System/Reflection/AssemblyFlagsAttribute.cs43
-rw-r--r--src/mscorlib/shared/System/Reflection/AssemblyInformationalVersionAttribute.cs18
-rw-r--r--src/mscorlib/shared/System/Reflection/AssemblyKeyFileAttribute.cs18
-rw-r--r--src/mscorlib/shared/System/Reflection/AssemblyKeyNameAttribute.cs18
-rw-r--r--src/mscorlib/shared/System/Reflection/AssemblyMetadataAttribute.cs21
-rw-r--r--src/mscorlib/shared/System/Reflection/AssemblyNameFlags.cs (renamed from src/mscorlib/src/System/Reflection/AssemblyNameFlags.cs)36
-rw-r--r--src/mscorlib/shared/System/Reflection/AssemblyProductAttribute.cs18
-rw-r--r--src/mscorlib/shared/System/Reflection/AssemblySignatureKeyAttribute.cs21
-rw-r--r--src/mscorlib/shared/System/Reflection/AssemblyTitleAttribute.cs18
-rw-r--r--src/mscorlib/shared/System/Reflection/AssemblyTrademarkAttribute.cs18
-rw-r--r--src/mscorlib/shared/System/Reflection/AssemblyVersionAttribute.cs18
-rw-r--r--src/mscorlib/shared/System/Reflection/Binder.cs19
-rw-r--r--src/mscorlib/shared/System/Reflection/BindingFlags.cs (renamed from src/mscorlib/src/System/Reflection/BindingFlags.cs)30
-rw-r--r--src/mscorlib/shared/System/Reflection/CallingConventions.cs (renamed from src/mscorlib/src/System/Reflection/CallingConventions.cs)13
-rw-r--r--src/mscorlib/shared/System/Reflection/ConstructorInfo.cs40
-rw-r--r--src/mscorlib/shared/System/Reflection/CustomAttributeFormatException.cs33
-rw-r--r--src/mscorlib/shared/System/Reflection/DefaultMemberAttribute.cs (renamed from src/mscorlib/src/System/Reflection/DefaultMemberAttribute.cs)26
-rw-r--r--src/mscorlib/shared/System/Reflection/EventAttributes.cs (renamed from src/mscorlib/src/System/Reflection/EventAttributes.cs)18
-rw-r--r--src/mscorlib/shared/System/Reflection/EventInfo.cs115
-rw-r--r--src/mscorlib/shared/System/Reflection/ExceptionHandlingClauseOptions.cs16
-rw-r--r--src/mscorlib/shared/System/Reflection/FieldAttributes.cs (renamed from src/mscorlib/src/System/Reflection/FieldAttributes.cs)9
-rw-r--r--src/mscorlib/shared/System/Reflection/FieldInfo.cs72
-rw-r--r--src/mscorlib/shared/System/Reflection/GenericParameterAttributes.cs (renamed from src/mscorlib/src/System/Reflection/GenericParameterAttributes.cs)4
-rw-r--r--src/mscorlib/shared/System/Reflection/ICustomAttributeProvider.cs13
-rw-r--r--src/mscorlib/shared/System/Reflection/IReflect.cs (renamed from src/mscorlib/src/System/Reflection/IReflect.cs)67
-rw-r--r--src/mscorlib/shared/System/Reflection/IReflectableType.cs (renamed from src/mscorlib/src/System/Reflection/IReflectableType.cs)12
-rw-r--r--src/mscorlib/shared/System/Reflection/ImageFileMachine.cs15
-rw-r--r--src/mscorlib/shared/System/Reflection/InterfaceMapping.cs14
-rw-r--r--src/mscorlib/shared/System/Reflection/IntrospectionExtensions.cs (renamed from src/mscorlib/src/System/Reflection/IntrospectionExtensions.cs)15
-rw-r--r--src/mscorlib/shared/System/Reflection/InvalidFilterCriteriaException.cs33
-rw-r--r--src/mscorlib/shared/System/Reflection/ManifestResourceInfo.cs23
-rw-r--r--src/mscorlib/shared/System/Reflection/MemberFilter.cs8
-rw-r--r--src/mscorlib/shared/System/Reflection/MemberInfoSerializationHolder.cs (renamed from src/mscorlib/src/System/Reflection/MemberInfoSerializationHolder.cs)173
-rw-r--r--src/mscorlib/shared/System/Reflection/MemberTypes.cs (renamed from src/mscorlib/src/System/Reflection/MemberTypes.cs)19
-rw-r--r--src/mscorlib/shared/System/Reflection/MethodAttributes.cs (renamed from src/mscorlib/src/System/Reflection/MethodAttributes.cs)10
-rw-r--r--src/mscorlib/shared/System/Reflection/MethodBase.cs86
-rw-r--r--src/mscorlib/shared/System/Reflection/MethodImplAttributes.cs (renamed from src/mscorlib/src/System/Reflection/MethodImplAttributes.cs)9
-rw-r--r--src/mscorlib/shared/System/Reflection/MethodInfo.cs43
-rw-r--r--src/mscorlib/shared/System/Reflection/Missing.cs (renamed from src/mscorlib/src/System/Reflection/Missing.cs)11
-rw-r--r--src/mscorlib/shared/System/Reflection/Module.cs182
-rw-r--r--src/mscorlib/shared/System/Reflection/ModuleResolveEventHandler.cs9
-rw-r--r--src/mscorlib/shared/System/Reflection/ParameterAttributes.cs (renamed from src/mscorlib/src/System/Reflection/ParameterAttributes.cs)22
-rw-r--r--src/mscorlib/shared/System/Reflection/ParameterInfo.cs110
-rw-r--r--src/mscorlib/shared/System/Reflection/ParameterModifier.cs (renamed from src/mscorlib/src/System/Reflection/ParameterModifier.cs)22
-rw-r--r--src/mscorlib/shared/System/Reflection/Pointer.cs61
-rw-r--r--src/mscorlib/shared/System/Reflection/PortableExecutableKinds.cs18
-rw-r--r--src/mscorlib/shared/System/Reflection/ProcessorArchitecture.cs16
-rw-r--r--src/mscorlib/shared/System/Reflection/PropertyAttributes.cs (renamed from src/mscorlib/src/System/Reflection/PropertyAttributes.cs)21
-rw-r--r--src/mscorlib/shared/System/Reflection/PropertyInfo.cs74
-rw-r--r--src/mscorlib/shared/System/Reflection/ReflectionContext.cs (renamed from src/mscorlib/src/System/Reflection/ReflectionContext.cs)14
-rw-r--r--src/mscorlib/shared/System/Reflection/ReflectionTypeLoadException.cs46
-rw-r--r--src/mscorlib/shared/System/Reflection/ResourceAttributes.cs14
-rw-r--r--src/mscorlib/shared/System/Reflection/ResourceLocation.cs15
-rw-r--r--src/mscorlib/shared/System/Reflection/StrongNameKeyPair.cs (renamed from src/mscorlib/src/System/Reflection/StrongNameKeyPair.cs)34
-rw-r--r--src/mscorlib/shared/System/Reflection/TargetException.cs33
-rw-r--r--src/mscorlib/shared/System/Reflection/TargetInvocationException.cs29
-rw-r--r--src/mscorlib/shared/System/Reflection/TargetParameterCountException.cs35
-rw-r--r--src/mscorlib/shared/System/Reflection/TypeAttributes.cs (renamed from src/mscorlib/src/System/Reflection/TypeAttributes.cs)7
-rw-r--r--src/mscorlib/shared/System/Reflection/TypeFilter.cs (renamed from src/vm/gcscan.h)5
-rw-r--r--src/mscorlib/shared/System/Reflection/TypeInfo.cs84
-rw-r--r--src/mscorlib/shared/System/ResolveEventArgs.cs25
-rw-r--r--src/mscorlib/shared/System/ResolveEventHandler.cs10
-rw-r--r--src/mscorlib/shared/System/Runtime/CompilerServices/CompilationRelaxations.cs16
-rw-r--r--src/mscorlib/shared/System/Runtime/CompilerServices/CompilerGlobalScopeAttribute.cs (renamed from src/mscorlib/src/System/Runtime/CompilerServices/CompilerGlobalScopeAttribute.cs)14
-rw-r--r--src/mscorlib/shared/System/Runtime/CompilerServices/DefaultDependencyAttribute.cs18
-rw-r--r--src/mscorlib/shared/System/Runtime/CompilerServices/DependencyAttribute.cs20
-rw-r--r--src/mscorlib/shared/System/Runtime/CompilerServices/DiscardableAttribute.cs (renamed from src/mscorlib/src/System/Runtime/CompilerServices/DiscardableAttribute.cs)12
-rw-r--r--src/mscorlib/shared/System/Runtime/CompilerServices/FixedAddressValueTypeAttribute.cs (renamed from src/mscorlib/src/System/Runtime/CompilerServices/FixedAddressValueTypeAttribute.cs)7
-rw-r--r--src/mscorlib/shared/System/Runtime/CompilerServices/LoadHint.cs14
-rw-r--r--src/mscorlib/shared/System/Runtime/CompilerServices/MethodCodeType.cs17
-rw-r--r--src/mscorlib/shared/System/Runtime/CompilerServices/MethodImplOptions.cs21
-rw-r--r--src/mscorlib/shared/System/Runtime/CompilerServices/StringFreezingAttribute.cs (renamed from src/mscorlib/src/System/StringFreezingAttribute.cs)15
-rw-r--r--src/mscorlib/shared/System/Runtime/CompilerServices/SuppressIldasmAttribute.cs (renamed from src/mscorlib/src/System/Runtime/CompilerServices/SuppressIldasmAttribute.cs)9
-rw-r--r--src/mscorlib/shared/System/Runtime/CompilerServices/TupleElementNamesAttribute.cs2
-rw-r--r--src/mscorlib/shared/System/Runtime/Serialization/ISafeSerializationData.cs26
-rw-r--r--src/mscorlib/shared/System/Security/SecureString.Unix.cs (renamed from src/mscorlib/src/System/Security/SecureString.Unix.cs)0
-rw-r--r--src/mscorlib/shared/System/Security/SecureString.cs (renamed from src/mscorlib/src/System/Security/SecureString.cs)0
-rw-r--r--src/mscorlib/shared/System/Security/SecurityException.cs66
-rw-r--r--src/mscorlib/shared/System/StringComparer.cs (renamed from src/mscorlib/src/System/StringComparer.cs)42
-rw-r--r--src/mscorlib/shared/System/StringComparison.cs (renamed from src/mscorlib/src/System/StringComparison.cs)12
-rw-r--r--src/mscorlib/shared/System/StringSplitOptions.cs2
-rw-r--r--src/mscorlib/shared/System/Text/StringBuilder.cs (renamed from src/mscorlib/src/System/Text/StringBuilder.cs)240
-rw-r--r--src/mscorlib/shared/System/Threading/Tasks/TaskCanceledException.cs (renamed from src/mscorlib/src/System/Threading/Tasks/TaskCanceledException.cs)4
-rw-r--r--src/mscorlib/shared/System/Threading/Tasks/TaskExtensions.cs (renamed from src/mscorlib/src/System/Threading/Tasks/TaskExtensions.cs)0
-rw-r--r--src/mscorlib/shared/System/Threading/Tasks/TaskSchedulerException.cs (renamed from src/mscorlib/src/System/Threading/Tasks/TaskSchedulerException.cs)4
-rw-r--r--src/mscorlib/shared/System/TimeZone.cs (renamed from src/mscorlib/src/System/TimeZone.cs)0
-rw-r--r--src/mscorlib/shared/System/TupleExtensions.cs4
-rw-r--r--src/mscorlib/shared/System/Type.Enum.cs186
-rw-r--r--src/mscorlib/shared/System/Type.Helpers.cs527
-rw-r--r--src/mscorlib/shared/System/Type.cs357
-rw-r--r--src/mscorlib/shared/System/TypeUnloadedException.cs (renamed from src/mscorlib/src/System/TypeUnloadedException.cs)19
-rw-r--r--src/mscorlib/shared/System/UnitySerializationHolder.cs (renamed from src/mscorlib/src/System/UnitySerializationHolder.cs)219
-rw-r--r--src/mscorlib/src/Debug.cs29
-rw-r--r--src/mscorlib/src/Internal/Console.cs (renamed from src/mscorlib/src/System/LowLevelConsole.cs)27
-rw-r--r--src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Collation.cs3
-rw-r--r--src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.ICU.cs16
-rw-r--r--src/mscorlib/src/Interop/Unix/System.Native/Interop.SysLog.cs58
-rw-r--r--src/mscorlib/src/Interop/Windows/kernel32/Interop.Globalization.cs2
-rw-r--r--src/mscorlib/src/Interop/Windows/kernel32/Interop.OutputDebugString.cs14
-rw-r--r--src/mscorlib/src/Microsoft/Win32/Registry.cs2
-rw-r--r--src/mscorlib/src/Microsoft/Win32/RegistryKey.cs20
-rw-r--r--src/mscorlib/src/Microsoft/Win32/Win32Native.cs17
-rw-r--r--src/mscorlib/src/SR.cs879
-rw-r--r--src/mscorlib/src/System.Private.CoreLib.txt1969
-rw-r--r--src/mscorlib/src/System/Activator.cs12
-rw-r--r--src/mscorlib/src/System/AggregateException.cs16
-rw-r--r--src/mscorlib/src/System/AppContext/AppContext.cs4
-rw-r--r--src/mscorlib/src/System/AppDomain.cs93
-rw-r--r--src/mscorlib/src/System/AppDomainManager.cs5
-rw-r--r--src/mscorlib/src/System/AppDomainSetup.cs6
-rw-r--r--src/mscorlib/src/System/AppDomainUnloadedException.cs2
-rw-r--r--src/mscorlib/src/System/ArgIterator.cs20
-rw-r--r--src/mscorlib/src/System/ArgumentOutOfRangeException.cs4
-rw-r--r--src/mscorlib/src/System/ArraySegment.cs1
-rw-r--r--src/mscorlib/src/System/Attribute.cs32
-rw-r--r--src/mscorlib/src/System/BadImageFormatException.cs6
-rw-r--r--src/mscorlib/src/System/Boolean.cs23
-rw-r--r--src/mscorlib/src/System/Buffer.cs6
-rw-r--r--src/mscorlib/src/System/Byte.cs23
-rw-r--r--src/mscorlib/src/System/CLRConfig.cs15
-rw-r--r--src/mscorlib/src/System/Collections/ArrayList.cs40
-rw-r--r--src/mscorlib/src/System/Collections/CollectionBase.cs239
-rw-r--r--src/mscorlib/src/System/Collections/Comparer.cs2
-rw-r--r--src/mscorlib/src/System/Collections/CompatibleComparer.cs2
-rw-r--r--src/mscorlib/src/System/Collections/Concurrent/ConcurrentQueue.cs4
-rw-r--r--src/mscorlib/src/System/Collections/Concurrent/ConcurrentStack.cs2
-rw-r--r--src/mscorlib/src/System/Collections/EmptyReadOnlyDictionaryInternal.cs36
-rw-r--r--src/mscorlib/src/System/Collections/Generic/ArraySortHelper.cs16
-rw-r--r--src/mscorlib/src/System/Collections/Generic/DebugView.cs26
-rw-r--r--src/mscorlib/src/System/Collections/Generic/EqualityComparer.cs6
-rw-r--r--src/mscorlib/src/System/Collections/Generic/List.cs1
-rw-r--r--src/mscorlib/src/System/Collections/Hashtable.cs68
-rw-r--r--src/mscorlib/src/System/Collections/ListDictionaryInternal.cs40
-rw-r--r--src/mscorlib/src/System/Collections/ObjectModel/KeyedCollection.cs299
-rw-r--r--src/mscorlib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs2
-rw-r--r--src/mscorlib/src/System/Collections/StructuralComparisons.cs105
-rw-r--r--src/mscorlib/src/System/CurrentSystemTimeZone.Cache.cs35
-rw-r--r--src/mscorlib/src/System/DBNull.cs142
-rw-r--r--src/mscorlib/src/System/DateTime.CoreCLR.cs29
-rw-r--r--src/mscorlib/src/System/Decimal.cs61
-rw-r--r--src/mscorlib/src/System/DefaultBinder.CanConvert.cs30
-rw-r--r--src/mscorlib/src/System/Delegate.cs54
-rw-r--r--src/mscorlib/src/System/DelegateSerializationHolder.cs8
-rw-r--r--src/mscorlib/src/System/Diagnostics/Assert.cs2
-rw-r--r--src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs4
-rw-r--r--src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs12
-rw-r--r--src/mscorlib/src/System/Diagnostics/Debug.Unix.cs95
-rw-r--r--src/mscorlib/src/System/Diagnostics/Debug.Windows.cs63
-rw-r--r--src/mscorlib/src/System/Diagnostics/Debug.cs323
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/EventCounter.cs2
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs3
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/EventSource_CoreCLR.cs4
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/StubEnvironment.cs2
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventSourceActivity.cs2
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/PropertyValue.cs2
-rw-r--r--src/mscorlib/src/System/Diagnostics/LogSwitch.cs2
-rw-r--r--src/mscorlib/src/System/Diagnostics/Stacktrace.cs25
-rw-r--r--src/mscorlib/src/System/Diagnostics/log.cs3
-rw-r--r--src/mscorlib/src/System/DllNotFoundException.cs2
-rw-r--r--src/mscorlib/src/System/Double.cs21
-rw-r--r--src/mscorlib/src/System/Enum.cs104
-rw-r--r--src/mscorlib/src/System/Environment.cs376
-rw-r--r--src/mscorlib/src/System/Exception.cs12
-rw-r--r--src/mscorlib/src/System/GC.cs26
-rw-r--r--src/mscorlib/src/System/Globalization/Calendar.cs2
-rw-r--r--src/mscorlib/src/System/Globalization/CalendarData.Unix.cs4
-rw-r--r--src/mscorlib/src/System/Globalization/CalendarData.Windows.cs14
-rw-r--r--src/mscorlib/src/System/Globalization/CalendarData.cs2
-rw-r--r--src/mscorlib/src/System/Globalization/CompareInfo.Invariant.cs238
-rw-r--r--src/mscorlib/src/System/Globalization/CompareInfo.Unix.cs64
-rw-r--r--src/mscorlib/src/System/Globalization/CompareInfo.Windows.cs54
-rw-r--r--src/mscorlib/src/System/Globalization/CompareInfo.cs201
-rw-r--r--src/mscorlib/src/System/Globalization/CultureData.Unix.cs14
-rw-r--r--src/mscorlib/src/System/Globalization/CultureData.Windows.cs10
-rw-r--r--src/mscorlib/src/System/Globalization/CultureData.cs297
-rw-r--r--src/mscorlib/src/System/Globalization/CultureInfo.Unix.cs4
-rw-r--r--src/mscorlib/src/System/Globalization/CultureInfo.Windows.cs8
-rw-r--r--src/mscorlib/src/System/Globalization/CultureTypes.cs28
-rw-r--r--src/mscorlib/src/System/Globalization/EncodingDataItem.Unix.cs2
-rw-r--r--src/mscorlib/src/System/Globalization/EncodingTable.Unix.cs4
-rw-r--r--src/mscorlib/src/System/Globalization/EncodingTable.cs4
-rw-r--r--src/mscorlib/src/System/Globalization/GlobalizationMode.Unix.cs24
-rw-r--r--src/mscorlib/src/System/Globalization/GlobalizationMode.Windows.cs14
-rw-r--r--src/mscorlib/src/System/Globalization/GlobalizationMode.cs12
-rw-r--r--src/mscorlib/src/System/Globalization/GregorianCalendarHelper.cs2
-rw-r--r--src/mscorlib/src/System/Globalization/IdnMapping.Unix.cs8
-rw-r--r--src/mscorlib/src/System/Globalization/IdnMapping.Windows.cs8
-rw-r--r--src/mscorlib/src/System/Globalization/IdnMapping.cs746
-rw-r--r--src/mscorlib/src/System/Globalization/JapaneseCalendar.Unix.cs8
-rw-r--r--src/mscorlib/src/System/Globalization/TextInfo.Unix.cs21
-rw-r--r--src/mscorlib/src/System/Globalization/TextInfo.Windows.cs88
-rw-r--r--src/mscorlib/src/System/Globalization/TextInfo.cs148
-rw-r--r--src/mscorlib/src/System/Globalization/TimeSpanFormat.cs20
-rw-r--r--src/mscorlib/src/System/Globalization/TimeSpanParse.cs12
-rw-r--r--src/mscorlib/src/System/Guid.cs103
-rw-r--r--src/mscorlib/src/System/IO/BinaryReader.cs30
-rw-r--r--src/mscorlib/src/System/IO/BinaryWriter.cs4
-rw-r--r--src/mscorlib/src/System/IO/Directory.cs6
-rw-r--r--src/mscorlib/src/System/IO/DirectoryNotFoundException.cs2
-rw-r--r--src/mscorlib/src/System/IO/DriveNotFoundException.cs2
-rw-r--r--src/mscorlib/src/System/IO/EndOfStreamException.cs2
-rw-r--r--src/mscorlib/src/System/IO/File.cs4
-rw-r--r--src/mscorlib/src/System/IO/FileLoadException.cs4
-rw-r--r--src/mscorlib/src/System/IO/FileNotFoundException.cs6
-rw-r--r--src/mscorlib/src/System/IO/IOException.cs2
-rw-r--r--src/mscorlib/src/System/IO/MemoryStream.cs72
-rw-r--r--src/mscorlib/src/System/IO/PathTooLongException.cs2
-rw-r--r--src/mscorlib/src/System/IO/SearchOption.cs2
-rw-r--r--src/mscorlib/src/System/IO/Stream.cs20
-rw-r--r--src/mscorlib/src/System/IO/StreamReader.cs249
-rw-r--r--src/mscorlib/src/System/IO/TextReader.cs32
-rw-r--r--src/mscorlib/src/System/IO/UnmanagedMemoryAccessor.cs80
-rw-r--r--src/mscorlib/src/System/IO/UnmanagedMemoryStream.cs94
-rw-r--r--src/mscorlib/src/System/IO/UnmanagedMemoryStreamWrapper.cs16
-rw-r--r--src/mscorlib/src/System/IO/__Error.cs46
-rw-r--r--src/mscorlib/src/System/IServiceObjectProvider.cs16
-rw-r--r--src/mscorlib/src/System/Int16.cs25
-rw-r--r--src/mscorlib/src/System/Int32.cs19
-rw-r--r--src/mscorlib/src/System/Int64.cs19
-rw-r--r--src/mscorlib/src/System/IntPtr.cs2
-rw-r--r--src/mscorlib/src/System/Internal.cs4
-rw-r--r--src/mscorlib/src/System/Math.cs20
-rw-r--r--src/mscorlib/src/System/MathF.cs8
-rw-r--r--src/mscorlib/src/System/MissingFieldException.cs6
-rw-r--r--src/mscorlib/src/System/MissingMemberException.cs6
-rw-r--r--src/mscorlib/src/System/MissingMethodException.cs6
-rw-r--r--src/mscorlib/src/System/MulticastDelegate.cs10
-rw-r--r--src/mscorlib/src/System/Number.cs30
-rw-r--r--src/mscorlib/src/System/Object.cs2
-rw-r--r--src/mscorlib/src/System/OleAutBinder.cs2
-rw-r--r--src/mscorlib/src/System/OperatingSystem.cs4
-rw-r--r--src/mscorlib/src/System/OperationCanceledException.cs2
-rw-r--r--src/mscorlib/src/System/Random.cs4
-rw-r--r--src/mscorlib/src/System/ReadOnlySpan.cs29
-rw-r--r--src/mscorlib/src/System/Reflection/AmbiguousMatchException.cs45
-rw-r--r--src/mscorlib/src/System/Reflection/Assembly.CoreCLR.cs211
-rw-r--r--src/mscorlib/src/System/Reflection/AssemblyAttributes.cs389
-rw-r--r--src/mscorlib/src/System/Reflection/AssemblyName.cs6
-rw-r--r--src/mscorlib/src/System/Reflection/Binder.cs51
-rw-r--r--src/mscorlib/src/System/Reflection/ConstructorInfo.CoreCLR.cs11
-rw-r--r--src/mscorlib/src/System/Reflection/CustomAttribute.cs24
-rw-r--r--src/mscorlib/src/System/Reflection/CustomAttributeFormatException.cs42
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/AssemblyBuilder.cs34
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs2
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/ConstructorBuilder.cs8
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/CustomAttributeBuilder.cs33
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/DynamicILGenerator.cs42
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs38
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/EnumBuilder.cs4
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/FieldBuilder.cs18
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs2
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs60
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/LocalBuilder.cs4
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/MethodBuilder.cs40
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/MethodBuilderInstantiation.cs4
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/ModuleBuilder.cs38
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/ModuleBuilderData.cs2
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/PropertyBuilder.cs22
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/SignatureHelper.cs26
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/SymbolMethod.cs16
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/SymbolType.cs58
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs148
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs2
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/XXXOnTypeBuilderInstantiation.cs2
-rw-r--r--src/mscorlib/src/System/Reflection/ExceptionHandlingClause.cs93
-rw-r--r--src/mscorlib/src/System/Reflection/FieldInfo.CoreCLR.cs35
-rw-r--r--src/mscorlib/src/System/Reflection/FieldInfo.cs815
-rw-r--r--src/mscorlib/src/System/Reflection/ICustomAttributeProvider.cs32
-rw-r--r--src/mscorlib/src/System/Reflection/INVOCATION_FLAGS.cs38
-rw-r--r--src/mscorlib/src/System/Reflection/InterfaceMapping.cs25
-rw-r--r--src/mscorlib/src/System/Reflection/InvalidFilterCriteriaException.cs44
-rw-r--r--src/mscorlib/src/System/Reflection/LocalVariableInfo.cs40
-rw-r--r--src/mscorlib/src/System/Reflection/ManifestResourceInfo.cs70
-rw-r--r--src/mscorlib/src/System/Reflection/MdConstant.cs6
-rw-r--r--src/mscorlib/src/System/Reflection/MdFieldInfo.cs141
-rw-r--r--src/mscorlib/src/System/Reflection/MemberFilter.cs19
-rw-r--r--src/mscorlib/src/System/Reflection/MemberSerializationStringGenerator.cs39
-rw-r--r--src/mscorlib/src/System/Reflection/MethodBase.CoreCLR.cs157
-rw-r--r--src/mscorlib/src/System/Reflection/MethodBase.cs333
-rw-r--r--src/mscorlib/src/System/Reflection/MethodBody.cs129
-rw-r--r--src/mscorlib/src/System/Reflection/Module.cs1123
-rw-r--r--src/mscorlib/src/System/Reflection/Pointer.cs82
-rw-r--r--src/mscorlib/src/System/Reflection/ReflectionTypeLoadException.cs80
-rw-r--r--src/mscorlib/src/System/Reflection/ResourceAttributes.cs25
-rw-r--r--src/mscorlib/src/System/Reflection/RtFieldInfo.cs390
-rw-r--r--src/mscorlib/src/System/Reflection/RuntimeAssembly.cs (renamed from src/mscorlib/src/System/Reflection/Assembly.cs)779
-rw-r--r--src/mscorlib/src/System/Reflection/RuntimeConstructorInfo.cs (renamed from src/mscorlib/src/System/Reflection/ConstructorInfo.cs)126
-rw-r--r--src/mscorlib/src/System/Reflection/RuntimeEventInfo.cs (renamed from src/mscorlib/src/System/Reflection/EventInfo.cs)198
-rw-r--r--src/mscorlib/src/System/Reflection/RuntimeFieldInfo.cs136
-rw-r--r--src/mscorlib/src/System/Reflection/RuntimeMethodInfo.cs (renamed from src/mscorlib/src/System/Reflection/MethodInfo.cs)124
-rw-r--r--src/mscorlib/src/System/Reflection/RuntimeModule.cs602
-rw-r--r--src/mscorlib/src/System/Reflection/RuntimeParameterInfo.cs (renamed from src/mscorlib/src/System/Reflection/ParameterInfo.cs)253
-rw-r--r--src/mscorlib/src/System/Reflection/RuntimePropertyInfo.cs (renamed from src/mscorlib/src/System/Reflection/PropertyInfo.cs)169
-rw-r--r--src/mscorlib/src/System/Reflection/RuntimeReflectionExtensions.cs90
-rw-r--r--src/mscorlib/src/System/Reflection/TargetException.cs44
-rw-r--r--src/mscorlib/src/System/Reflection/TargetInvocationException.cs54
-rw-r--r--src/mscorlib/src/System/Reflection/TargetParameterCountException.cs46
-rw-r--r--src/mscorlib/src/System/Reflection/TypeFilter.cs19
-rw-r--r--src/mscorlib/src/System/Reflection/TypeInfo.cs201
-rw-r--r--src/mscorlib/src/System/Reflection/__Filters.cs71
-rw-r--r--src/mscorlib/src/System/Resources/FileBasedResourceGroveler.cs4
-rw-r--r--src/mscorlib/src/System/Resources/LooselyLinkedResourceReference.cs6
-rw-r--r--src/mscorlib/src/System/Resources/ManifestBasedResourceGroveler.cs14
-rw-r--r--src/mscorlib/src/System/Resources/MissingManifestResourceException.cs2
-rw-r--r--src/mscorlib/src/System/Resources/MissingSatelliteAssemblyException.cs2
-rw-r--r--src/mscorlib/src/System/Resources/NeutralResourcesLanguageAttribute.cs2
-rw-r--r--src/mscorlib/src/System/Resources/ResourceManager.cs16
-rw-r--r--src/mscorlib/src/System/Resources/ResourceReader.cs118
-rw-r--r--src/mscorlib/src/System/Resources/ResourceSet.cs13
-rw-r--r--src/mscorlib/src/System/Resources/RuntimeResourceSet.cs6
-rw-r--r--src/mscorlib/src/System/RtType.cs159
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/AssemblySettingAttributes.cs94
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/CompilationRelaxations.cs10
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/CompilerMarshalOverride.cs23
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs3
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/MethodImplAttribute.cs25
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/SpecialNameAttribute.cs27
-rw-r--r--src/mscorlib/src/System/Runtime/ExceptionServices/ExceptionNotification.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/ExceptionServices/ExceptionServicesCommon.cs6
-rw-r--r--src/mscorlib/src/System/Runtime/GcSettings.cs4
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/COMException.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/CurrencyWrapper.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ErrorWrapper.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ExternalException.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/GCHandleCookieTable.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/GcHandle.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/InvalidComObjectException.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/InvalidOleVariantTypeException.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs62
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/MarshalDirectiveException.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/NonPortable.cs64
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/SafeArrayRankMismatchException.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/SafeArrayTypeMismatchException.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/SafeBuffer.cs34
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToCollectionAdapter.cs8
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToListAdapter.cs6
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIPropertyValueImpl.cs48
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ConstantSplittableMap.cs6
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CustomPropertyImpl.cs6
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryKeyCollection.cs10
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryToMapAdapter.cs4
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryValueCollection.cs10
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/EventRegistrationTokenTable.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IMapViewToIReadOnlyDictionaryAdapter.cs10
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyDictionaryToIMapViewAdapter.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyListToIVectorViewAdapter.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorAdapter.cs4
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorViewAdapter.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToVectorAdapter.cs4
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ManagedActivationFactory.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToCollectionAdapter.cs10
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToDictionaryAdapter.cs4
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapViewToReadOnlyCollectionAdapter.cs4
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToCollectionAdapter.cs8
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToListAdapter.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorViewToReadOnlyCollectionAdapter.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshal.cs10
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMetadata.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/Loader/AssemblyLoadContext.cs29
-rw-r--r--src/mscorlib/src/System/Runtime/MemoryFailPoint.cs10
-rw-r--r--src/mscorlib/src/System/Runtime/RuntimeImports.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/FormatterServices.cs28
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/SerializationAttributes.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/SerializationException.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs6
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/SerializationInfoEnumerator.cs11
-rw-r--r--src/mscorlib/src/System/RuntimeHandles.cs34
-rw-r--r--src/mscorlib/src/System/SByte.cs25
-rw-r--r--src/mscorlib/src/System/Security/SafeBSTRHandle.cs2
-rw-r--r--src/mscorlib/src/System/Security/SecurityException.cs110
-rw-r--r--src/mscorlib/src/System/Security/SecurityState.cs25
-rw-r--r--src/mscorlib/src/System/Security/Util/URLString.cs2
-rw-r--r--src/mscorlib/src/System/Security/VerificationException.cs2
-rw-r--r--src/mscorlib/src/System/Single.cs21
-rw-r--r--src/mscorlib/src/System/Span.cs77
-rw-r--r--src/mscorlib/src/System/String.Comparison.cs38
-rw-r--r--src/mscorlib/src/System/String.Manipulation.cs38
-rw-r--r--src/mscorlib/src/System/String.Searching.cs26
-rw-r--r--src/mscorlib/src/System/String.cs60
-rw-r--r--src/mscorlib/src/System/StubHelpers.cs26
-rw-r--r--src/mscorlib/src/System/Text/ASCIIEncoding.cs14
-rw-r--r--src/mscorlib/src/System/Text/Decoder.cs28
-rw-r--r--src/mscorlib/src/System/Text/DecoderExceptionFallback.cs5
-rw-r--r--src/mscorlib/src/System/Text/DecoderFallback.cs15
-rw-r--r--src/mscorlib/src/System/Text/DecoderNLS.cs38
-rw-r--r--src/mscorlib/src/System/Text/DecoderReplacementFallback.cs2
-rw-r--r--src/mscorlib/src/System/Text/Encoder.cs28
-rw-r--r--src/mscorlib/src/System/Text/EncoderBestFitFallback.cs8
-rw-r--r--src/mscorlib/src/System/Text/EncoderExceptionFallback.cs20
-rw-r--r--src/mscorlib/src/System/Text/EncoderFallback.cs3
-rw-r--r--src/mscorlib/src/System/Text/EncoderNLS.cs38
-rw-r--r--src/mscorlib/src/System/Text/EncoderReplacementFallback.cs8
-rw-r--r--src/mscorlib/src/System/Text/Encoding.cs81
-rw-r--r--src/mscorlib/src/System/Text/EncodingForwarder.cs58
-rw-r--r--src/mscorlib/src/System/Text/Latin1Encoding.cs8
-rw-r--r--src/mscorlib/src/System/Text/Normalization.Unix.cs25
-rw-r--r--src/mscorlib/src/System/Text/Normalization.Windows.cs20
-rw-r--r--src/mscorlib/src/System/Text/StringBuilder.CoreCLR.cs48
-rw-r--r--src/mscorlib/src/System/Text/UTF32Encoding.cs21
-rw-r--r--src/mscorlib/src/System/Text/UTF7Encoding.cs16
-rw-r--r--src/mscorlib/src/System/Text/UTF8Encoding.cs20
-rw-r--r--src/mscorlib/src/System/Text/UnicodeEncoding.cs24
-rw-r--r--src/mscorlib/src/System/Threading/AbandonedMutexException.cs4
-rw-r--r--src/mscorlib/src/System/Threading/CancellationToken.cs4
-rw-r--r--src/mscorlib/src/System/Threading/CancellationTokenSource.cs6
-rw-r--r--src/mscorlib/src/System/Threading/CountdownEvent.cs588
-rw-r--r--src/mscorlib/src/System/Threading/EventWaitHandle.cs26
-rw-r--r--src/mscorlib/src/System/Threading/ExecutionContext.cs14
-rw-r--r--src/mscorlib/src/System/Threading/Interlocked.cs12
-rw-r--r--src/mscorlib/src/System/Threading/LazyInitializer.cs6
-rw-r--r--src/mscorlib/src/System/Threading/ManualResetEventSlim.cs6
-rw-r--r--src/mscorlib/src/System/Threading/Monitor.cs4
-rw-r--r--src/mscorlib/src/System/Threading/Mutex.cs18
-rw-r--r--src/mscorlib/src/System/Threading/Overlapped.cs5
-rw-r--r--src/mscorlib/src/System/Threading/Semaphore.cs32
-rw-r--r--src/mscorlib/src/System/Threading/SemaphoreFullException.cs2
-rw-r--r--src/mscorlib/src/System/Threading/SemaphoreSlim.cs22
-rw-r--r--src/mscorlib/src/System/Threading/SpinWait.cs8
-rw-r--r--src/mscorlib/src/System/Threading/SynchronizationLockException.cs2
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/TPLETWProvider.cs2
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/Task.cs4
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/TaskExceptionHolder.cs4
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/TaskFactory.cs32
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/TaskScheduler.cs10
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/future.cs2
-rw-r--r--src/mscorlib/src/System/Threading/Thread.cs16
-rw-r--r--src/mscorlib/src/System/Threading/ThreadAbortException.cs2
-rw-r--r--src/mscorlib/src/System/Threading/ThreadLocal.cs16
-rw-r--r--src/mscorlib/src/System/Threading/ThreadPool.cs20
-rw-r--r--src/mscorlib/src/System/Threading/ThreadStartException.cs4
-rw-r--r--src/mscorlib/src/System/Threading/ThreadStateException.cs2
-rw-r--r--src/mscorlib/src/System/Threading/Timer.cs34
-rw-r--r--src/mscorlib/src/System/Threading/Volatile.cs52
-rw-r--r--src/mscorlib/src/System/Threading/WaitHandle.cs44
-rw-r--r--src/mscorlib/src/System/Threading/WaitHandleCannotBeOpenedException.cs2
-rw-r--r--src/mscorlib/src/System/ThrowHelper.cs25
-rw-r--r--src/mscorlib/src/System/TimeSpan.cs36
-rw-r--r--src/mscorlib/src/System/TimeZoneInfo.AdjustmentRule.cs18
-rw-r--r--src/mscorlib/src/System/TimeZoneInfo.StringSerializer.cs62
-rw-r--r--src/mscorlib/src/System/TimeZoneInfo.TransitionTime.cs14
-rw-r--r--src/mscorlib/src/System/TimeZoneInfo.Unix.cs56
-rw-r--r--src/mscorlib/src/System/TimeZoneInfo.Win32.cs9
-rw-r--r--src/mscorlib/src/System/TimeZoneInfo.cs67
-rw-r--r--src/mscorlib/src/System/Tuple.cs18
-rw-r--r--src/mscorlib/src/System/Type.CoreCLR.cs206
-rw-r--r--src/mscorlib/src/System/Type.cs1867
-rw-r--r--src/mscorlib/src/System/TypeLoadException.cs8
-rw-r--r--src/mscorlib/src/System/TypeNameParser.cs12
-rw-r--r--src/mscorlib/src/System/TypedReference.cs14
-rw-r--r--src/mscorlib/src/System/UInt16.cs23
-rw-r--r--src/mscorlib/src/System/UInt32.cs19
-rw-r--r--src/mscorlib/src/System/UInt64.cs19
-rw-r--r--src/mscorlib/src/System/UIntPtr.cs2
-rw-r--r--src/mscorlib/src/System/ValueTuple.cs4
-rw-r--r--src/mscorlib/src/System/Variant.cs8
-rw-r--r--src/mscorlib/src/System/Version.cs34
-rw-r--r--src/mscorlib/src/System/__Filters.cs163
-rw-r--r--src/mscorlib/src/mscorlib.Friends.cs3
-rw-r--r--src/pal/inc/pal.h23
-rw-r--r--src/pal/inc/palprivate.h6
-rw-r--r--src/pal/src/CMakeLists.txt2
-rw-r--r--src/pal/src/configure.cmake6
-rw-r--r--src/pal/src/cruntime/math.cpp34
-rw-r--r--src/pal/src/cruntime/misctls.cpp308
-rw-r--r--src/pal/src/file/filetime.cpp4
-rw-r--r--src/pal/src/init/pal.cpp302
-rw-r--r--src/pal/src/misc/cgroup.cpp335
-rw-r--r--src/pal/src/misc/environ.cpp8
-rw-r--r--src/pal/src/misc/utils.cpp7
-rw-r--r--src/pal/src/misc/version.cpp119
-rw-r--r--src/pal/tests/palsuite/c_runtime/pow/test1/test1.cpp12
-rw-r--r--src/pal/tests/palsuite/c_runtime/powf/test1/test1.c14
-rw-r--r--src/pal/tests/palsuite/miscellaneous/CGroup/CMakeLists.txt (renamed from src/pal/tests/palsuite/miscellaneous/GetVersionExA/CMakeLists.txt)0
-rw-r--r--src/pal/tests/palsuite/miscellaneous/CGroup/test1/CMakeLists.txt17
-rw-r--r--src/pal/tests/palsuite/miscellaneous/CGroup/test1/test.cpp53
-rw-r--r--src/pal/tests/palsuite/miscellaneous/CGroup/test1/testinfo.dat (renamed from src/pal/tests/palsuite/miscellaneous/GetVersionExW/test1/testinfo.dat)10
-rw-r--r--src/pal/tests/palsuite/miscellaneous/CMakeLists.txt1
-rw-r--r--src/pal/tests/palsuite/miscellaneous/GetVersionExA/test1/CMakeLists.txt17
-rw-r--r--src/pal/tests/palsuite/miscellaneous/GetVersionExA/test1/test.cpp83
-rw-r--r--src/pal/tests/palsuite/miscellaneous/GetVersionExA/test1/testinfo.dat16
-rw-r--r--src/pal/tests/palsuite/miscellaneous/GetVersionExW/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/miscellaneous/GetVersionExW/test1/CMakeLists.txt17
-rw-r--r--src/pal/tests/palsuite/miscellaneous/GetVersionExW/test1/test.cpp88
-rw-r--r--src/pal/tests/palsuite/paltestlist.txt4
-rw-r--r--src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt6
-rwxr-xr-xsrc/pal/tools/gen-buildsys-clang.sh13
-rw-r--r--src/pal/tools/probe-win.ps18
-rw-r--r--src/tools/crossgen/crossgen.cpp5
-rw-r--r--src/tools/metainfo/mdinfo.cpp2
-rw-r--r--src/unwinder/i386/unwinder_i386.cpp2
-rw-r--r--src/utilcode/CMakeLists.txt4
-rw-r--r--src/utilcode/pedecoder.cpp4
-rw-r--r--src/utilcode/prettyprintsig.cpp4
-rw-r--r--src/utilcode/safewrap.cpp5
-rw-r--r--src/utilcode/util.cpp29
-rw-r--r--src/vm/CMakeLists.txt5
-rw-r--r--src/vm/amd64/JitHelpers_Slow.asm68
-rw-r--r--src/vm/amd64/asmconstants.h6
-rw-r--r--src/vm/appdomain.cpp103
-rw-r--r--src/vm/appdomain.hpp28
-rw-r--r--src/vm/arm/stubs.cpp2
-rw-r--r--src/vm/arm64/calldescrworkerarm64.S5
-rw-r--r--src/vm/assemblynative.cpp7
-rw-r--r--src/vm/baseassemblyspec.cpp4
-rw-r--r--src/vm/binder.cpp4
-rw-r--r--src/vm/callcounter.cpp98
-rw-r--r--src/vm/callcounter.h87
-rw-r--r--src/vm/callingconvention.h11
-rw-r--r--src/vm/ceeload.cpp7
-rw-r--r--src/vm/ceemain.cpp103
-rw-r--r--src/vm/clrconfignative.cpp21
-rw-r--r--src/vm/clrconfignative.h14
-rw-r--r--src/vm/comdelegate.cpp148
-rw-r--r--src/vm/comdelegate.h4
-rw-r--r--src/vm/commemoryfailpoint.cpp4
-rw-r--r--src/vm/comsynchronizable.cpp24
-rw-r--r--src/vm/comsynchronizable.h1
-rw-r--r--src/vm/comutilnative.cpp22
-rw-r--r--src/vm/comutilnative.h3
-rw-r--r--src/vm/crossgencompile.cpp4
-rw-r--r--src/vm/debugdebugger.cpp58
-rw-r--r--src/vm/debughelp.cpp2
-rw-r--r--src/vm/dllimport.cpp9
-rw-r--r--src/vm/dllimportcallback.cpp126
-rw-r--r--src/vm/dllimportcallback.h14
-rw-r--r--src/vm/domainfile.cpp13
-rw-r--r--src/vm/dwreport.cpp2
-rw-r--r--src/vm/ecalllist.h14
-rw-r--r--src/vm/eeconfig.cpp8
-rw-r--r--src/vm/eeconfig.h9
-rw-r--r--src/vm/eedbginterfaceimpl.cpp11
-rw-r--r--src/vm/eetwain.cpp25
-rw-r--r--src/vm/eventreporter.cpp2
-rw-r--r--src/vm/eventtrace.cpp27
-rw-r--r--src/vm/exceptionhandling.cpp2
-rw-r--r--src/vm/exinfo.h2
-rw-r--r--src/vm/fcall.h137
-rw-r--r--src/vm/fieldmarshaler.h5
-rw-r--r--src/vm/finalizerthread.cpp8
-rw-r--r--src/vm/gccover.cpp5
-rw-r--r--src/vm/gcenv.ee.cpp59
-rw-r--r--src/vm/gcenv.ee.h4
-rw-r--r--src/vm/gcenv.os.cpp42
-rw-r--r--src/vm/gcheaputilities.cpp42
-rw-r--r--src/vm/gcheaputilities.h76
-rw-r--r--src/vm/gchelpers.cpp126
-rw-r--r--src/vm/gcstress.h7
-rw-r--r--src/vm/gdbjit.cpp778
-rw-r--r--src/vm/gdbjit.h156
-rw-r--r--src/vm/gdbjithelpers.h12
-rw-r--r--src/vm/i386/asmconstants.h6
-rw-r--r--src/vm/i386/asmhelpers.S4
-rw-r--r--src/vm/i386/cgencpu.h5
-rw-r--r--src/vm/i386/cgenx86.cpp12
-rw-r--r--src/vm/i386/jithelp.S6
-rw-r--r--src/vm/i386/jitinterfacex86.cpp41
-rw-r--r--src/vm/i386/stublinkerx86.cpp40
-rw-r--r--src/vm/i386/umthunkstub.S75
-rw-r--r--src/vm/ilmarshalers.h3
-rw-r--r--src/vm/jithelpers.cpp8
-rw-r--r--src/vm/jitinterface.cpp134
-rw-r--r--src/vm/jitinterface.h11
-rw-r--r--src/vm/jitinterfacegen.cpp2
-rw-r--r--src/vm/method.cpp2
-rw-r--r--src/vm/method.hpp52
-rw-r--r--src/vm/methodtablebuilder.cpp14
-rw-r--r--src/vm/mscorlib.cpp1
-rw-r--r--src/vm/object.cpp8
-rw-r--r--src/vm/peimage.cpp2
-rw-r--r--src/vm/precode.cpp4
-rw-r--r--src/vm/precode.h2
-rw-r--r--src/vm/prestub.cpp68
-rw-r--r--src/vm/proftoeeinterfaceimpl.cpp12
-rw-r--r--src/vm/rcwwalker.cpp2
-rw-r--r--src/vm/readytoruninfo.cpp2
-rw-r--r--src/vm/rexcep.h3
-rw-r--r--src/vm/stubhelpers.cpp5
-rw-r--r--src/vm/syncblk.cpp3
-rw-r--r--src/vm/threads.cpp274
-rw-r--r--src/vm/threads.h61
-rw-r--r--src/vm/threadsuspend.cpp79
-rw-r--r--src/vm/tieredcompilation.cpp377
-rw-r--r--src/vm/tieredcompilation.h51
-rw-r--r--src/zap/zapimage.cpp279
-rw-r--r--src/zap/zapimage.h61
-rw-r--r--src/zap/zapinfo.cpp24
-rw-r--r--src/zap/zapinfo.h5
-rw-r--r--src/zap/zapper.cpp2
835 files changed, 24852 insertions, 47606 deletions
diff --git a/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Linux.Microsoft.NETCore.Runtime.CoreCLR.props b/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Linux.Microsoft.NETCore.Runtime.CoreCLR.props
index 2ba18808aa..85e9f5e793 100644
--- a/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Linux.Microsoft.NETCore.Runtime.CoreCLR.props
+++ b/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Linux.Microsoft.NETCore.Runtime.CoreCLR.props
@@ -14,9 +14,7 @@
<NativeBinary Include="$(BinDir)libsosplugin.so" />
<NativeBinary Include="$(BinDir)System.Globalization.Native.so" />
<NativeBinary Include="$(BinDir)sosdocsunix.txt" />
- <NativeBinary Condition="'$(_PlatformDoesNotSupportNiFiles)' != 'true'" Include="$(BinDir)mscorlib.ni.dll" />
<NativeBinary Condition="'$(_PlatformDoesNotSupportNiFiles)' != 'true'" Include="$(BinDir)System.Private.CoreLib.ni.dll" />
- <ArchitectureSpecificLibFile Include="$(BinDir)mscorlib.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)System.Private.CoreLib.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)SOS.NETCore.dll" />
<ArchitectureSpecificToolFile Include="$(BinDir)crossgen" />
diff --git a/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.OSX.Microsoft.NETCore.Runtime.CoreCLR.props b/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.OSX.Microsoft.NETCore.Runtime.CoreCLR.props
index 66f55bc6b3..b988a40745 100644
--- a/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.OSX.Microsoft.NETCore.Runtime.CoreCLR.props
+++ b/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.OSX.Microsoft.NETCore.Runtime.CoreCLR.props
@@ -8,9 +8,7 @@
<NativeBinary Include="$(BinDir)libsos.dylib" />
<NativeBinary Include="$(BinDir)System.Globalization.Native.dylib" />
<NativeBinary Include="$(BinDir)sosdocsunix.txt" />
- <NativeBinary Include="$(BinDir)mscorlib.ni.dll" />
<NativeBinary Include="$(BinDir)System.Private.CoreLib.ni.dll" />
- <ArchitectureSpecificLibFile Include="$(BinDir)mscorlib.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)System.Private.CoreLib.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)SOS.NETCore.dll" />
<ArchitectureSpecificToolFile Include="$(BinDir)crossgen" />
diff --git a/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Windows_NT.Microsoft.NETCore.Runtime.CoreCLR.props b/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Windows_NT.Microsoft.NETCore.Runtime.CoreCLR.props
index 3919178b2a..436901ebd2 100644
--- a/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Windows_NT.Microsoft.NETCore.Runtime.CoreCLR.props
+++ b/src/.nuget/Microsoft.NETCore.Runtime.CoreCLR/runtime.Windows_NT.Microsoft.NETCore.Runtime.CoreCLR.props
@@ -19,10 +19,9 @@
<NativeBinary Include="$(BinDir)mscorrc.debug.dll" />
<NativeBinary Include="$(BinDir)mscorrc.dll" />
<NativeBinary Include="$(BinDir)sos.dll" />
- <NativeBinary Include="$(BinDir)mscorlib.ni.dll" />
<NativeBinary Include="$(BinDir)System.Private.CoreLib.ni.dll" />
+ <NativeBinary Include="$(UniversalCRTSDKDir)Redist\ucrt\DLLs\$(BuildArch)\*.dll" Condition="'$(BuildType)'=='Release' AND '$(BuildArch)' != 'arm64'" />
<ArchitectureSpecificLibFile Include="$(BinDir)System.Private.CoreLib.dll" />
- <ArchitectureSpecificLibFile Include="$(BinDir)mscorlib.dll" />
<ArchitectureSpecificLibFile Include="$(BinDir)SOS.NETCore.dll" />
<ArchitectureSpecificToolFile Include="$(BinDir)crossgen.exe" />
<CrossArchitectureSpecificToolFile Include="$(BinDir)$(CrossTargetComponentFolder)\crossgen.exe" />
diff --git a/src/.nuget/Microsoft.TargetingPack.Private.CoreCLR/Microsoft.TargetingPack.Private.CoreCLR.pkgproj b/src/.nuget/Microsoft.TargetingPack.Private.CoreCLR/Microsoft.TargetingPack.Private.CoreCLR.pkgproj
index 27a4f21534..ecc1e491a0 100644
--- a/src/.nuget/Microsoft.TargetingPack.Private.CoreCLR/Microsoft.TargetingPack.Private.CoreCLR.pkgproj
+++ b/src/.nuget/Microsoft.TargetingPack.Private.CoreCLR/Microsoft.TargetingPack.Private.CoreCLR.pkgproj
@@ -7,9 +7,6 @@
<OutputPath>$(PackagesOutputPath)</OutputPath>
</PropertyGroup>
<ItemGroup>
- <File Include="$(BinDir)/ref/mscorlib.dll">
- <TargetPath>lib/netstandard1.0</TargetPath>
- </File>
<File Include="$(BinDir)/System.Private.CoreLib.dll">
<TargetPath>lib/netstandard1.0</TargetPath>
</File>
diff --git a/src/.nuget/dir.props b/src/.nuget/dir.props
index de85ad675f..59b94f75b2 100644
--- a/src/.nuget/dir.props
+++ b/src/.nuget/dir.props
@@ -11,7 +11,7 @@
<!-- Distro rid is passed as runtimeos-arch-->
<_parseDistroRid>$(__DistroRid)</_parseDistroRid>
- <_parseDistroRid Condition="'$(_parseDistroRid)' == '' and '$(__BuildOS)' == 'OSX'">osx.10.10-x64</_parseDistroRid>
+ <_parseDistroRid Condition="'$(_parseDistroRid)' == '' and '$(__BuildOS)' == 'OSX'">osx.10.12-x64</_parseDistroRid>
<_distroRidIndex>$(_parseDistroRid.IndexOfAny("-"))</_distroRidIndex>
<_archRidIndex>$([MSBuild]::Add($(_distroRidIndex), 1))</_archRidIndex>
<OSRid Condition="'$(OSRid)' == '' and '$(_distroRidIndex)' != '-1'">$(_parseDistroRid.SubString(0, $(_distroRidIndex)))</OSRid>
@@ -61,24 +61,34 @@
<When Condition="'$(PackageRID)' != ''" />
<When Condition="'$(_runtimeOSFamily)' == 'win'">
<PropertyGroup>
- <PackageRID Condition="'$(ArchGroup)' == 'x86' OR '$(ArchGroup)' == 'x64'">win7-$(ArchGroup)</PackageRID>
- <PackageRID Condition="'$(ArchGroup)' == 'arm'">win8-$(ArchGroup)</PackageRID>
- <PackageRID Condition="'$(ArchGroup)' == 'arm64'">win10-$(ArchGroup)</PackageRID>
+ <RIDPlatform>win7</RIDPlatform>
+ <RIDPlatform Condition="'$(ArchGroup)' == 'arm'">win8</RIDPlatform>
+ <RIDPlatform Condition="'$(ArchGroup)' == 'arm64'">win10</RIDPlatform>
+
+ <!-- Set the platform part of the RID if we are doing a portable build -->
+ <RIDPlatform Condition="'$(PortableBuild)' == '1'">win</RIDPlatform>
+ <PackageRID>$(RIDPlatform)-$(ArchGroup)</PackageRID>
</PropertyGroup>
</When>
<When Condition="'$(_runtimeOSFamily)' == 'osx'">
<PropertyGroup>
- <PackageRID>osx.10.10-$(ArchGroup)</PackageRID>
+ <PackageRID>osx.10.12-$(ArchGroup)</PackageRID>
+ <!-- Set the platform part of the RID if we are doing a portable build -->
+ <PackageRID Condition="'$(PortableBuild)' == '1'">osx-$(ArchGroup)</PackageRID>
</PropertyGroup>
</When>
<When Condition="'$(_runtimeOSFamily)' == 'rhel'">
<PropertyGroup>
<PackageRID>rhel.7-$(ArchGroup)</PackageRID>
+ <!-- Set the platform part of the RID if we are doing a portable build -->
+ <PackageRID Condition="'$(PortableBuild)' == '1'">linux-$(ArchGroup)</PackageRID>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<PackageRID>$(RuntimeOS)-$(ArchGroup)</PackageRID>
+ <!-- Set the platform part of the RID if we are doing a portable build -->
+ <PackageRID Condition="'$(PortableBuild)' == '1'">linux-$(ArchGroup)</PackageRID>
</PropertyGroup>
</Otherwise>
</Choose>
@@ -109,6 +119,9 @@
<OfficialBuildRID Include="fedora.23-x64" />
<OfficialBuildRID Include="fedora.24-x64" />
<OfficialBuildRID Include="linux-x64" />
+ <OfficialBuildRID Include="linux-arm">
+ <Platform>arm</Platform>
+ </OfficialBuildRID>
<OfficialBuildRID Include="opensuse.42.1-x64" />
<OfficialBuildRID Include="rhel.7-x64" />
<OfficialBuildRID Include="tizen.4.0.0-armel">
@@ -125,19 +138,30 @@
<OfficialBuildRID Include="ubuntu.16.10-x64" />
</ItemGroup>
<ItemGroup Condition="$(SupportedPackageOSGroups.Contains(';OSX;'))">
- <OfficialBuildRID Include="osx.10.10-x64" />
+ <OfficialBuildRID Include="osx.10.12-x64" />
+ <OfficialBuildRID Include="osx-x64" />
</ItemGroup>
<ItemGroup Condition="$(SupportedPackageOSGroups.Contains(';Windows_NT;'))">
<OfficialBuildRID Include="win7-x86">
<Platform>x86</Platform>
</OfficialBuildRID>
+ <OfficialBuildRID Include="win-x86">
+ <Platform>x86</Platform>
+ </OfficialBuildRID>
<OfficialBuildRID Include="win7-x64" />
+ <OfficialBuildRID Include="win-x64" />
<OfficialBuildRID Include="win8-arm">
<Platform>arm</Platform>
</OfficialBuildRID>
<OfficialBuildRID Include="win10-arm64">
<Platform>arm64</Platform>
</OfficialBuildRID>
+ <OfficialBuildRID Include="win-arm">
+ <Platform>arm</Platform>
+ </OfficialBuildRID>
+ <OfficialBuildRID Include="win-arm64">
+ <Platform>arm64</Platform>
+ </OfficialBuildRID>
</ItemGroup>
<ItemGroup>
<!-- Ensure we have a RID-specific package for the current build, even if it isn't in our official set, but
diff --git a/src/.nuget/dir.targets b/src/.nuget/dir.targets
index 6f7bae6b10..49e550a4b7 100644
--- a/src/.nuget/dir.targets
+++ b/src/.nuget/dir.targets
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+
+ <Target Name="VerifyVCRedist" BeforeTargets="GetSymbolPackageFiles" Condition="'$(_runtimeOSFamily)' == 'win'">
+ <Error Condition="'$(UniversalCRTSDKDir)' == ''" Text="Unable to find VC Redist binaries - check that UniversalCRTSDKDir environment variable is set" />
+ </Target>
<!--
Finds symbol files and injects them into the package build.
-->
diff --git a/src/ToolBox/SOS/NETCore/SOS.NETCore.csproj b/src/ToolBox/SOS/NETCore/SOS.NETCore.csproj
index 12c63d27fe..440cff5d82 100644
--- a/src/ToolBox/SOS/NETCore/SOS.NETCore.csproj
+++ b/src/ToolBox/SOS/NETCore/SOS.NETCore.csproj
@@ -32,8 +32,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(OsEnvironment)' == 'Unix'">
- <DebugSymbols>false</DebugSymbols>
- <DebugType>none</DebugType>
+ <DebugType>portable</DebugType>
</PropertyGroup>
<ItemGroup>
@@ -54,7 +53,6 @@
</Copy>
<Copy
- Condition="'$(OsEnvironment)' != 'Unix'"
SourceFiles="$(OutputPath)$(AssemblyName).pdb"
DestinationFolder="$(BinDir)\PDB"
SkipUnchangedFiles="false"
diff --git a/src/ToolBox/SOS/NETCore/SymbolReader.cs b/src/ToolBox/SOS/NETCore/SymbolReader.cs
index 50a8ded000..e0fcdb517d 100644
--- a/src/ToolBox/SOS/NETCore/SymbolReader.cs
+++ b/src/ToolBox/SOS/NETCore/SymbolReader.cs
@@ -23,6 +23,14 @@ namespace SOS
public string fileName;
}
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+ internal struct LocalVarInfo
+ {
+ public int startOffset;
+ public int endOffset;
+ public string name;
+ }
+
[StructLayout(LayoutKind.Sequential)]
internal struct MethodDebugInfo
{
@@ -397,7 +405,7 @@ namespace SOS
}
return false;
}
- internal static bool GetLocalsInfoForMethod(string assemblyPath, int methodToken, out List<string> locals)
+ internal static bool GetLocalsInfoForMethod(string assemblyPath, int methodToken, out List<LocalVarInfo> locals)
{
locals = null;
@@ -413,7 +421,7 @@ namespace SOS
if (handle.Kind != HandleKind.MethodDefinition)
return false;
- locals = new List<string>();
+ locals = new List<LocalVarInfo>();
MethodDebugInformationHandle methodDebugHandle =
((MethodDefinitionHandle)handle).ToDebugInformationHandle();
@@ -427,7 +435,11 @@ namespace SOS
LocalVariable localVar = openedReader.Reader.GetLocalVariable(varHandle);
if (localVar.Attributes == LocalVariableAttributes.DebuggerHidden)
continue;
- locals.Add(openedReader.Reader.GetString(localVar.Name));
+ LocalVarInfo info = new LocalVarInfo();
+ info.startOffset = scope.StartOffset;
+ info.endOffset = scope.EndOffset;
+ info.name = openedReader.Reader.GetString(localVar.Name);
+ locals.Add(info);
}
}
}
@@ -452,7 +464,7 @@ namespace SOS
try
{
List<DebugInfo> points = null;
- List<string> locals = null;
+ List<LocalVarInfo> locals = null;
if (!GetDebugInfoForMethod(assemblyPath, methodToken, out points))
{
@@ -473,14 +485,18 @@ namespace SOS
Marshal.StructureToPtr(info, ptr, false);
ptr = (IntPtr)(ptr.ToInt64() + structSize);
}
+
+ structSize = Marshal.SizeOf<LocalVarInfo>();
+
debugInfo.localsSize = locals.Count;
- debugInfo.locals = Marshal.AllocHGlobal(debugInfo.localsSize * Marshal.SizeOf<IntPtr>());
- IntPtr ptrLocals = debugInfo.locals;
- foreach (string s in locals)
+ ptr = debugInfo.locals;
+
+ foreach (var info in locals)
{
- Marshal.WriteIntPtr(ptrLocals, Marshal.StringToHGlobalUni(s));
- ptrLocals += Marshal.SizeOf<IntPtr>();
+ Marshal.StructureToPtr(info, ptr, false);
+ ptr = (IntPtr)(ptr.ToInt64() + structSize);
}
+
return true;
}
catch
diff --git a/src/ToolBox/superpmi/superpmi-shared/icorjitcompilerimpl.h b/src/ToolBox/superpmi/superpmi-shared/icorjitcompilerimpl.h
index e1190d7ab6..0e36562076 100644
--- a/src/ToolBox/superpmi/superpmi-shared/icorjitcompilerimpl.h
+++ b/src/ToolBox/superpmi/superpmi-shared/icorjitcompilerimpl.h
@@ -57,11 +57,7 @@ public:
// When the EE loads the System.Numerics.Vectors assembly, it asks the JIT what length (in bytes) of
// SIMD vector it supports as an intrinsic type. Zero means that the JIT does not support SIMD
// intrinsics, so the EE should use the default size (i.e. the size of the IL implementation).
-#if COR_JIT_EE_VERSION > 460
unsigned getMaxIntrinsicSIMDVectorLength(CORJIT_FLAGS cpuCompileFlags); /* { return 0; } */
-#else
- unsigned getMaxIntrinsicSIMDVectorLength(DWORD cpuCompileFlags); /* { return 0; } */
-#endif
// IL obfuscators sometimes interpose on the EE-JIT interface. This function allows the VM to
// tell the JIT to use a particular ICorJitCompiler to implement the methods of this interface,
diff --git a/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h b/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h
index 4c1aa3d72d..0c5b269899 100644
--- a/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h
+++ b/src/ToolBox/superpmi/superpmi-shared/icorjitinfoimpl.h
@@ -129,22 +129,17 @@ public:
// Return null if devirtualization is not possible.
CORINFO_METHOD_HANDLE resolveVirtualMethod(
CORINFO_METHOD_HANDLE virtualMethod,
- CORINFO_CLASS_HANDLE implementingClass
+ CORINFO_CLASS_HANDLE implementingClass,
+ CORINFO_CONTEXT_HANDLE ownerType
);
// If a method's attributes have (getMethodAttribs) CORINFO_FLG_INTRINSIC set,
// getIntrinsicID() returns the intrinsic ID.
// *pMustExpand tells whether or not JIT must expand the intrinsic.
-#if COR_JIT_EE_VERSION > 460
CorInfoIntrinsics getIntrinsicID(
CORINFO_METHOD_HANDLE method,
bool* pMustExpand = NULL /* OUT */
);
-#else
- CorInfoIntrinsics getIntrinsicID(
- CORINFO_METHOD_HANDLE method
- );
-#endif
// Is the given module the System.Numerics.Vectors module?
// This defaults to false.
@@ -236,13 +231,11 @@ public:
// failures during token resolution.
void resolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken);
-#if COR_JIT_EE_VERSION > 460
// Attempt to resolve a metadata token into a runtime method handle. Returns true
// if resolution succeeded and false otherwise (e.g. if it encounters invalid metadata
// during token reoslution). This method should be used instead of `resolveToken` in
// situations that need to be resilient to invalid metadata.
bool tryResolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken);
-#endif
// Signature information about the call sig
void findSig (
@@ -389,7 +382,7 @@ public:
// in representing of 'cls' from a GC perspective. The class is
// assumed to be an array of machine words
// (of length // getClassSize(cls) / sizeof(void*)),
- // 'gcPtrs' is a poitner to an array of BYTEs of this length.
+ // 'gcPtrs' is a pointer to an array of BYTEs of this length.
// getClassGClayout fills in this array so that gcPtrs[i] is set
// to one of the CorInfoGCType values which is the GC type of
// the i-th machine word of an object of type 'cls'
@@ -461,7 +454,7 @@ public:
// value into a particular location and thus has the signature
// void unboxHelper(void* dest, CORINFO_CLASS_HANDLE cls, Object* obj)
// Otherwise (it is null or points at a FALSE value) it is requesting
- // a helper that returns a poitner to the unboxed data
+ // a helper that returns a pointer to the unboxed data
// void* unboxHelper(CORINFO_CLASS_HANDLE cls, Object* obj)
// The EE has the option of NOT returning the copy style helper
// (But must be able to always honor the non-copy style helper)
@@ -472,7 +465,6 @@ public:
CORINFO_CLASS_HANDLE cls
);
-#if COR_JIT_EE_VERSION > 460
bool getReadyToRunHelper(
CORINFO_RESOLVED_TOKEN * pResolvedToken,
CORINFO_LOOKUP_KIND * pGenericLookupKind,
@@ -483,16 +475,8 @@ public:
void getReadyToRunDelegateCtorHelper(
CORINFO_RESOLVED_TOKEN * pTargetMethod,
CORINFO_CLASS_HANDLE delegateType,
- CORINFO_CONST_LOOKUP * pLookup
- );
-#else
- void getReadyToRunHelper(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- CorInfoHelpFunc id,
- CORINFO_CONST_LOOKUP * pLookup
+ CORINFO_LOOKUP * pLookup
);
-#endif
-
const char* getHelperName(
CorInfoHelpFunc
@@ -809,7 +793,6 @@ public:
void ThrowExceptionForHelper(
const CORINFO_HELPER_DESC * throwHelper);
-#if COR_JIT_EE_VERSION > 460
// Runs the given function under an error trap. This allows the JIT to make calls
// to interface functions that may throw exceptions without needing to be aware of
// the EH ABI, exception types, etc. Returns true if the given function completed
@@ -818,7 +801,6 @@ public:
void (*function)(void*), // The function to run
void* parameter // The context parameter that will be passed to the function and the handler
);
-#endif
/*****************************************************************************
* ICorStaticInfo contains EE interface methods which return values that are
@@ -870,16 +852,12 @@ public:
size_t FQNameCapacity /* IN */
);
-#if COR_JIT_EE_VERSION > 460
-
// returns whether the struct is enregisterable. Only valid on a System V VM. Returns true on success, false on failure.
bool getSystemVAmd64PassStructInRegisterDescriptor(
/* IN */ CORINFO_CLASS_HANDLE structHnd,
/* OUT */ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr
);
-#endif // COR_JIT_EE_VERSION
-
/*****************************************************************************
* ICorDynamicInfo contains EE interface methods which return values that may
* change from invocation to invocation. They cannot be embedded in persisted
@@ -999,8 +977,7 @@ public:
);
// NOTE: the two methods below--getPInvokeUnmanagedTarget and getAddressOfPInvokeFixup--are
- // deprecated. New code (i.e. anything that can depend on COR_JIT_EE_VERSION being
- // greater than 460) should instead use getAddressOfPInvokeTarget, which subsumes the
+ // deprecated. New code should instead use getAddressOfPInvokeTarget, which subsumes the
// functionality of these methods.
// return the unmanaged target *if method has already been prelinked.*
@@ -1015,14 +992,12 @@ public:
void **ppIndirection = NULL
);
-#if COR_JIT_EE_VERSION > 460
// return the address of the PInvoke target. May be a fixup area in the
// case of late-bound PInvoke calls.
void getAddressOfPInvokeTarget(
CORINFO_METHOD_HANDLE method,
CORINFO_CONST_LOOKUP *pLookup
);
-#endif
// Generate a cookie based on the signature that would needs to be passed
// to CORINFO_HELP_PINVOKE_CALLI
@@ -1310,7 +1285,6 @@ public:
//
DWORD getExpectedTargetArchitecture();
-#if COR_JIT_EE_VERSION > 460
// Fetches extended flags for a particular compilation instance. Returns
// the number of bytes written to the provided buffer.
DWORD getJitFlags(
@@ -1318,6 +1292,5 @@ public:
DWORD sizeInBytes /* IN: The size of the buffer. Note that this is effectively a
version number for the CORJIT_FLAGS value. */
);
-#endif
#endif // _ICorJitInfoImpl
diff --git a/src/ToolBox/superpmi/superpmi-shared/lwmlist.h b/src/ToolBox/superpmi/superpmi-shared/lwmlist.h
index 8e19656f18..6e5f0168fd 100644
--- a/src/ToolBox/superpmi/superpmi-shared/lwmlist.h
+++ b/src/ToolBox/superpmi/superpmi-shared/lwmlist.h
@@ -141,7 +141,7 @@ LWM(IsWriteBarrierHelperRequired, DWORDLONG, DWORD)
LWM(MergeClasses, DLDL, DWORDLONG)
LWM(PInvokeMarshalingRequired, Agnostic_PInvokeMarshalingRequired, DWORD)
LWM(ResolveToken, Agnostic_CORINFO_RESOLVED_TOKENin, Agnostic_CORINFO_RESOLVED_TOKENout)
-LWM(ResolveVirtualMethod, DLDL, DWORDLONG)
+LWM(ResolveVirtualMethod, Agnostic_ResolveVirtualMethod, DWORDLONG)
LWM(TryResolveToken, Agnostic_CORINFO_RESOLVED_TOKENin, Agnostic_CORINFO_RESOLVED_TOKENout)
LWM(SatisfiesClassConstraints, DWORDLONG, DWORD)
LWM(SatisfiesMethodConstraints, DLDL, DWORD)
diff --git a/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp b/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp
index c60b593ae0..8638e0d825 100644
--- a/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp
+++ b/src/ToolBox/superpmi/superpmi-shared/methodcontext.cpp
@@ -2283,7 +2283,7 @@ bool MethodContext::repGetReadyToRunHelper(
void MethodContext::recGetReadyToRunDelegateCtorHelper(
CORINFO_RESOLVED_TOKEN * pTargetMethod,
CORINFO_CLASS_HANDLE delegateType,
- CORINFO_CONST_LOOKUP * pLookup
+ CORINFO_LOOKUP * pLookup
)
{
LogError("GetReadyToRunDelegateCtorHelper NYI");
@@ -2302,7 +2302,7 @@ void MethodContext::dmpGetReadyToRunDelegateCtorHelper(DWORDLONG key, DWORD valu
void MethodContext::repGetReadyToRunDelegateCtorHelper(
CORINFO_RESOLVED_TOKEN * pTargetMethod,
CORINFO_CLASS_HANDLE delegateType,
- CORINFO_CONST_LOOKUP * pLookup
+ CORINFO_LOOKUP * pLookup
)
{
LogError("getReadyToRunDelegateCtorHelper NYI");
@@ -3296,33 +3296,40 @@ void MethodContext::repGetMethodVTableOffset(CORINFO_METHOD_HANDLE method, unsig
DEBUG_REP(dmpGetMethodVTableOffset((DWORDLONG)method, value));
}
-void MethodContext::recResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, CORINFO_CLASS_HANDLE implClass, CORINFO_METHOD_HANDLE result)
+void MethodContext::recResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, CORINFO_CLASS_HANDLE implClass,
+ CORINFO_CONTEXT_HANDLE ownerType, CORINFO_METHOD_HANDLE result)
{
if (ResolveVirtualMethod == nullptr)
{
- ResolveVirtualMethod = new LightWeightMap<DLDL, DWORDLONG>();
+ ResolveVirtualMethod = new LightWeightMap<Agnostic_ResolveVirtualMethod, DWORDLONG>();
}
- DLDL key;
- key.A = (DWORDLONG)virtMethod;
- key.B = (DWORDLONG)implClass;
+ Agnostic_ResolveVirtualMethod key;
+ key.virtualMethod = (DWORDLONG)virtMethod;
+ key.implementingClass = (DWORDLONG)implClass;
+ key.ownerType = (DWORDLONG)ownerType;
ResolveVirtualMethod->Add(key, (DWORDLONG) result);
DEBUG_REC(dmpResolveVirtualMethod(key, result));
}
-void MethodContext::dmpResolveVirtualMethod(DLDL key, DWORDLONG value)
+void MethodContext::dmpResolveVirtualMethod(const Agnostic_ResolveVirtualMethod& key, DWORDLONG value)
{
- printf("ResolveVirtualMethod virtMethod-%016llX, implClass-%016llX, result-%016llX", key.A, key.B, value);
+ printf("ResolveVirtualMethod virtMethod-%016llX, implClass-%016llX, ownerType--%01611X, result-%016llX",
+ key.virtualMethod, key.implementingClass, key.ownerType, value);
}
-CORINFO_METHOD_HANDLE MethodContext::repResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, CORINFO_CLASS_HANDLE implClass)
+CORINFO_METHOD_HANDLE MethodContext::repResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, CORINFO_CLASS_HANDLE implClass,
+ CORINFO_CONTEXT_HANDLE ownerType)
{
- DLDL key;
- key.A = (DWORDLONG)virtMethod;
- key.B = (DWORDLONG)implClass;
+ Agnostic_ResolveVirtualMethod key;
+ key.virtualMethod = (DWORDLONG)virtMethod;
+ key.implementingClass = (DWORDLONG)implClass;
+ key.ownerType = (DWORDLONG)ownerType;
- AssertCodeMsg(ResolveVirtualMethod != nullptr, EXCEPTIONCODE_MC, "No ResolveVirtualMap map for %016llX-%016llX", key.A, key.B);
- AssertCodeMsg(ResolveVirtualMethod->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX-%016llx", key.A, key.B);
+ AssertCodeMsg(ResolveVirtualMethod != nullptr, EXCEPTIONCODE_MC, "No ResolveVirtualMap map for %016llX-%016llX-%016llX",
+ key.virtualMethod, key.implementingClass, key.ownerType);
+ AssertCodeMsg(ResolveVirtualMethod->GetIndex(key) != -1, EXCEPTIONCODE_MC, "Didn't find %016llX-%016llx-%016llX",
+ key.virtualMethod, key.implementingClass, key.ownerType);
DWORDLONG result = ResolveVirtualMethod->Get(key);
DEBUG_REP(dmpResolveVirtualMethod(key, result));
@@ -4225,9 +4232,6 @@ void MethodContext::repGetEEInfo(CORINFO_EE_INFO *pEEInfoOut)
pEEInfoOut->osMajor = (unsigned)0;
pEEInfoOut->osMinor = (unsigned)0;
pEEInfoOut->osBuild = (unsigned)0;
-#ifdef DEBUG_REP
- printf("repGetEEInfo - fell to default params\n");
-#endif
}
}
diff --git a/src/ToolBox/superpmi/superpmi-shared/methodcontext.h b/src/ToolBox/superpmi/superpmi-shared/methodcontext.h
index ee2d4ac7c8..b2224d91ae 100644
--- a/src/ToolBox/superpmi/superpmi-shared/methodcontext.h
+++ b/src/ToolBox/superpmi/superpmi-shared/methodcontext.h
@@ -436,6 +436,13 @@ public:
DWORD result;
};
+ struct Agnostic_ResolveVirtualMethod
+ {
+ DWORDLONG virtualMethod;
+ DWORDLONG implementingClass;
+ DWORDLONG ownerType;
+ };
+
#pragma pack(pop)
MethodContext();
@@ -632,9 +639,9 @@ public:
void dmpGetReadyToRunHelper(DWORDLONG key, DWORD value);
bool repGetReadyToRunHelper(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORINFO_LOOKUP_KIND* pGenericLookupKind, CorInfoHelpFunc id, CORINFO_CONST_LOOKUP* pLookup);
- void recGetReadyToRunDelegateCtorHelper(CORINFO_RESOLVED_TOKEN* pTargetMethod, CORINFO_CLASS_HANDLE delegateType, CORINFO_CONST_LOOKUP* pLookup);
+ void recGetReadyToRunDelegateCtorHelper(CORINFO_RESOLVED_TOKEN* pTargetMethod, CORINFO_CLASS_HANDLE delegateType, CORINFO_LOOKUP* pLookup);
void dmpGetReadyToRunDelegateCtorHelper(DWORDLONG key, DWORD value);
- void repGetReadyToRunDelegateCtorHelper(CORINFO_RESOLVED_TOKEN* pTargetMethod, CORINFO_CLASS_HANDLE delegateType, CORINFO_CONST_LOOKUP* pLookup);
+ void repGetReadyToRunDelegateCtorHelper(CORINFO_RESOLVED_TOKEN* pTargetMethod, CORINFO_CLASS_HANDLE delegateType, CORINFO_LOOKUP* pLookup);
void recGetHelperFtn(CorInfoHelpFunc ftnNum, void **ppIndirection, void *result);
void dmpGetHelperFtn(DWORD key, DLDL value);
@@ -698,9 +705,11 @@ public:
void dmpGetMethodVTableOffset(DWORDLONG key, DD value);
void repGetMethodVTableOffset(CORINFO_METHOD_HANDLE method, unsigned *offsetOfIndirection, unsigned* offsetAfterIndirection);
- void recResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, CORINFO_CLASS_HANDLE implClass, CORINFO_METHOD_HANDLE result);
- void dmpResolveVirtualMethod(DLDL key, DWORDLONG value);
- CORINFO_METHOD_HANDLE repResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, CORINFO_CLASS_HANDLE implClass);
+ void recResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, CORINFO_CLASS_HANDLE implClass,
+ CORINFO_CONTEXT_HANDLE ownerType, CORINFO_METHOD_HANDLE result);
+ void dmpResolveVirtualMethod(const Agnostic_ResolveVirtualMethod& key, DWORDLONG value);
+ CORINFO_METHOD_HANDLE repResolveVirtualMethod(CORINFO_METHOD_HANDLE virtMethod, CORINFO_CLASS_HANDLE implClass,
+ CORINFO_CONTEXT_HANDLE ownerType);
void recGetTokenTypeAsHandle(CORINFO_RESOLVED_TOKEN * pResolvedToken, CORINFO_CLASS_HANDLE result);
void dmpGetTokenTypeAsHandle(const Agnostic_CORINFO_RESOLVED_TOKEN& key, DWORDLONG value);
diff --git a/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp b/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp
index bb19cab455..6d64442a21 100644
--- a/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-collector/icorjitinfo.cpp
@@ -240,12 +240,13 @@ void interceptor_ICJI::getMethodVTableOffset (
// Return null if devirtualization is not possible.
CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(
CORINFO_METHOD_HANDLE virtualMethod,
- CORINFO_CLASS_HANDLE implementingClass
+ CORINFO_CLASS_HANDLE implementingClass,
+ CORINFO_CONTEXT_HANDLE ownerType
)
{
mc->cr->AddCall("resolveVirtualMethod");
- CORINFO_METHOD_HANDLE result = original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass);
- mc->recResolveVirtualMethod(virtualMethod, implementingClass, result);
+ CORINFO_METHOD_HANDLE result = original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, ownerType);
+ mc->recResolveVirtualMethod(virtualMethod, implementingClass, ownerType, result);
return result;
}
@@ -712,7 +713,7 @@ unsigned interceptor_ICJI::getClassAlignmentRequirement (
// in representing of 'cls' from a GC perspective. The class is
// assumed to be an array of machine words
// (of length // getClassSize(cls) / sizeof(void*)),
-// 'gcPtrs' is a poitner to an array of BYTEs of this length.
+// 'gcPtrs' is a pointer to an array of BYTEs of this length.
// getClassGClayout fills in this array so that gcPtrs[i] is set
// to one of the CorInfoGCType values which is the GC type of
// the i-th machine word of an object of type 'cls'
@@ -851,7 +852,7 @@ CorInfoHelpFunc interceptor_ICJI::getBoxHelper(
// value into a particular location and thus has the signature
// void unboxHelper(void* dest, CORINFO_CLASS_HANDLE cls, Object* obj)
// Otherwise (it is null or points at a FALSE value) it is requesting
-// a helper that returns a poitner to the unboxed data
+// a helper that returns a pointer to the unboxed data
// void* unboxHelper(CORINFO_CLASS_HANDLE cls, Object* obj)
// The EE has the option of NOT returning the copy style helper
// (But must be able to always honor the non-copy style helper)
@@ -883,7 +884,7 @@ bool interceptor_ICJI::getReadyToRunHelper(
void interceptor_ICJI::getReadyToRunDelegateCtorHelper(
CORINFO_RESOLVED_TOKEN * pTargetMethod,
CORINFO_CLASS_HANDLE delegateType,
- CORINFO_CONST_LOOKUP * pLookup
+ CORINFO_LOOKUP * pLookup
)
{
mc->cr->AddCall("getReadyToRunDelegateCtorHelper");
diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp
index beff1f4e4b..492d08908d 100644
--- a/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-counter/icorjitinfo.cpp
@@ -169,11 +169,12 @@ void interceptor_ICJI::getMethodVTableOffset (
// Return null if devirtualization is not possible.
CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(
CORINFO_METHOD_HANDLE virtualMethod,
- CORINFO_CLASS_HANDLE implementingClass
+ CORINFO_CLASS_HANDLE implementingClass,
+ CORINFO_CONTEXT_HANDLE ownerType
)
{
mcs->AddCall("resolveVirtualMethod");
- return original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass);
+ return original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, ownerType);
}
// If a method's attributes have (getMethodAttribs) CORINFO_FLG_INTRINSIC set,
@@ -566,7 +567,7 @@ unsigned interceptor_ICJI::getClassAlignmentRequirement (
// in representing of 'cls' from a GC perspective. The class is
// assumed to be an array of machine words
// (of length // getClassSize(cls) / sizeof(void*)),
-// 'gcPtrs' is a poitner to an array of BYTEs of this length.
+// 'gcPtrs' is a pointer to an array of BYTEs of this length.
// getClassGClayout fills in this array so that gcPtrs[i] is set
// to one of the CorInfoGCType values which is the GC type of
// the i-th machine word of an object of type 'cls'
@@ -682,7 +683,7 @@ CorInfoHelpFunc interceptor_ICJI::getBoxHelper(
// value into a particular location and thus has the signature
// void unboxHelper(void* dest, CORINFO_CLASS_HANDLE cls, Object* obj)
// Otherwise (it is null or points at a FALSE value) it is requesting
-// a helper that returns a poitner to the unboxed data
+// a helper that returns a pointer to the unboxed data
// void* unboxHelper(CORINFO_CLASS_HANDLE cls, Object* obj)
// The EE has the option of NOT returning the copy style helper
// (But must be able to always honor the non-copy style helper)
@@ -711,7 +712,7 @@ bool interceptor_ICJI::getReadyToRunHelper(
void interceptor_ICJI::getReadyToRunDelegateCtorHelper(
CORINFO_RESOLVED_TOKEN * pTargetMethod,
CORINFO_CLASS_HANDLE delegateType,
- CORINFO_CONST_LOOKUP * pLookup
+ CORINFO_LOOKUP * pLookup
)
{
mcs->AddCall("getReadyToRunDelegateCtorHelper");
diff --git a/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp b/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp
index 9e229eeeaf..8941685fe3 100644
--- a/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp
+++ b/src/ToolBox/superpmi/superpmi-shim-simple/icorjitinfo.cpp
@@ -157,10 +157,11 @@ void interceptor_ICJI::getMethodVTableOffset (
// Return null if devirtualization is not possible.
CORINFO_METHOD_HANDLE interceptor_ICJI::resolveVirtualMethod(
CORINFO_METHOD_HANDLE virtualMethod,
- CORINFO_CLASS_HANDLE implementingClass
+ CORINFO_CLASS_HANDLE implementingClass,
+ CORINFO_CONTEXT_HANDLE ownerType
)
{
- return original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass);
+ return original_ICorJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, ownerType);
}
// If a method's attributes have (getMethodAttribs) CORINFO_FLG_INTRINSIC set,
@@ -514,7 +515,7 @@ unsigned interceptor_ICJI::getClassAlignmentRequirement (
// in representing of 'cls' from a GC perspective. The class is
// assumed to be an array of machine words
// (of length // getClassSize(cls) / sizeof(void*)),
-// 'gcPtrs' is a poitner to an array of BYTEs of this length.
+// 'gcPtrs' is a pointer to an array of BYTEs of this length.
// getClassGClayout fills in this array so that gcPtrs[i] is set
// to one of the CorInfoGCType values which is the GC type of
// the i-th machine word of an object of type 'cls'
@@ -619,7 +620,7 @@ CorInfoHelpFunc interceptor_ICJI::getBoxHelper(
// value into a particular location and thus has the signature
// void unboxHelper(void* dest, CORINFO_CLASS_HANDLE cls, Object* obj)
// Otherwise (it is null or points at a FALSE value) it is requesting
-// a helper that returns a poitner to the unboxed data
+// a helper that returns a pointer to the unboxed data
// void* unboxHelper(CORINFO_CLASS_HANDLE cls, Object* obj)
// The EE has the option of NOT returning the copy style helper
// (But must be able to always honor the non-copy style helper)
@@ -646,7 +647,7 @@ bool interceptor_ICJI::getReadyToRunHelper(
void interceptor_ICJI::getReadyToRunDelegateCtorHelper(
CORINFO_RESOLVED_TOKEN * pTargetMethod,
CORINFO_CLASS_HANDLE delegateType,
- CORINFO_CONST_LOOKUP * pLookup
+ CORINFO_LOOKUP * pLookup
)
{
original_ICorJitInfo->getReadyToRunDelegateCtorHelper(pTargetMethod, delegateType, pLookup);
diff --git a/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp b/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp
index ae4ba9917c..6478b3c684 100644
--- a/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp
+++ b/src/ToolBox/superpmi/superpmi/icorjitinfo.cpp
@@ -189,11 +189,12 @@ void MyICJI::getMethodVTableOffset (
// Return null if devirtualization is not possible.
CORINFO_METHOD_HANDLE MyICJI::resolveVirtualMethod(
CORINFO_METHOD_HANDLE virtualMethod,
- CORINFO_CLASS_HANDLE implementingClass
+ CORINFO_CLASS_HANDLE implementingClass,
+ CORINFO_CONTEXT_HANDLE ownerType
)
{
jitInstance->mc->cr->AddCall("resolveVirtualMethod");
- CORINFO_METHOD_HANDLE result = jitInstance->mc->repResolveVirtualMethod(virtualMethod, implementingClass);
+ CORINFO_METHOD_HANDLE result = jitInstance->mc->repResolveVirtualMethod(virtualMethod, implementingClass, ownerType);
return result;
}
@@ -621,7 +622,7 @@ unsigned MyICJI::getClassAlignmentRequirement (
// in representing of 'cls' from a GC perspective. The class is
// assumed to be an array of machine words
// (of length // getClassSize(cls) / sizeof(void*)),
-// 'gcPtrs' is a poitner to an array of BYTEs of this length.
+// 'gcPtrs' is a pointer to an array of BYTEs of this length.
// getClassGClayout fills in this array so that gcPtrs[i] is set
// to one of the CorInfoGCType values which is the GC type of
// the i-th machine word of an object of type 'cls'
@@ -738,7 +739,7 @@ CorInfoHelpFunc MyICJI::getBoxHelper(
// value into a particular location and thus has the signature
// void unboxHelper(void* dest, CORINFO_CLASS_HANDLE cls, Object* obj)
// Otherwise (it is null or points at a FALSE value) it is requesting
-// a helper that returns a poitner to the unboxed data
+// a helper that returns a pointer to the unboxed data
// void* unboxHelper(CORINFO_CLASS_HANDLE cls, Object* obj)
// The EE has the option of NOT returning the copy style helper
// (But must be able to always honor the non-copy style helper)
@@ -768,7 +769,7 @@ bool MyICJI::getReadyToRunHelper(
void MyICJI::getReadyToRunDelegateCtorHelper(
CORINFO_RESOLVED_TOKEN * pTargetMethod,
CORINFO_CLASS_HANDLE delegateType,
- CORINFO_CONST_LOOKUP * pLookup
+ CORINFO_LOOKUP * pLookup
)
{
jitInstance->mc->cr->AddCall("getReadyToRunDelegateCtorHelper");
diff --git a/src/binder/clrprivbindercoreclr.cpp b/src/binder/clrprivbindercoreclr.cpp
index b7a6807520..d756454edb 100644
--- a/src/binder/clrprivbindercoreclr.cpp
+++ b/src/binder/clrprivbindercoreclr.cpp
@@ -159,8 +159,8 @@ HRESULT CLRPrivBinderCoreCLR::BindUsingPEImage( /* in */ PEImage *pPEImage,
{
if (pCoreCLRFoundAssembly->GetIsInGAC())
{
- // If we were able to bind to a TPA assembly, then fail the load
- IF_FAIL_GO(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND));
+ *ppAssembly = pCoreCLRFoundAssembly.Extract();
+ goto Exit;
}
}
}
diff --git a/src/build.proj b/src/build.proj
index 8b9e3922b8..5da94e44c1 100644
--- a/src/build.proj
+++ b/src/build.proj
@@ -5,25 +5,18 @@
<ItemGroup>
<Project Include="ToolBox\SOS\NETCore\SOS.NETCore.csproj" />
<Project Include="mscorlib\System.Private.CoreLib.csproj" />
- <Project Include="mscorlib\facade\mscorlib.csproj" />
- <Project Include="mscorlib\ref\mscorlib.csproj" />
</ItemGroup>
<Import Project="..\dir.targets" />
<Import Project="..\dir.traversal.targets" />
- <ItemGroup>
- <BinariesToMove Include="$(BinDir)\facade\mscorlib.dll"/>
- </ItemGroup>
-
<Target Name="MovePostBuildBinaries" AfterTargets="Build">
<Move SourceFiles="@(BinariesToMove)"
DestinationFolder="$(BinDir)" />
</Target>
<ItemGroup>
- <PDBSToMove Include="$(BinDir)\facade\mscorlib.pdb"/>
<PDBSToMove Include="$(BinDir)System.Private.CoreLib.pdb"/>
</ItemGroup>
diff --git a/src/classlibnative/bcltype/arraynative.cpp b/src/classlibnative/bcltype/arraynative.cpp
index d12867ef1e..c54d2f3c31 100644
--- a/src/classlibnative/bcltype/arraynative.cpp
+++ b/src/classlibnative/bcltype/arraynative.cpp
@@ -175,7 +175,7 @@ void ArrayInitializeWorker(ARRAYBASEREF * arrayRef,
PCODE ctorFtn = pCanonMT->GetSlot(slot);
-#ifdef _X86_
+#if defined(_TARGET_X86_) && !defined(FEATURE_PAL)
BEGIN_CALL_TO_MANAGED();
@@ -206,7 +206,7 @@ void ArrayInitializeWorker(ARRAYBASEREF * arrayRef,
}
END_CALL_TO_MANAGED();
-#else // _X86_
+#else // _TARGET_X86_ && !FEATURE_PAL
//
// This is quite a bit slower, but it is portable.
//
@@ -230,7 +230,7 @@ void ArrayInitializeWorker(ARRAYBASEREF * arrayRef,
offset += size;
}
-#endif // _X86_
+#endif // !_TARGET_X86_ || FEATURE_PAL
}
@@ -1143,7 +1143,7 @@ void ArrayNative::CheckElementType(TypeHandle elementType)
// Check for byref-like types.
if (pMT->IsByRefLike())
- COMPlusThrow(kNotSupportedException, W("NotSupported_ByRefLike[]"));
+ COMPlusThrow(kNotSupportedException, W("NotSupported_ByRefLikeArray"));
// Check for open generic types.
if (pMT->IsGenericTypeDefinition() || pMT->ContainsGenericVariables())
@@ -1151,7 +1151,7 @@ void ArrayNative::CheckElementType(TypeHandle elementType)
// Check for Void.
if (elementType.GetSignatureCorElementType() == ELEMENT_TYPE_VOID)
- COMPlusThrow(kNotSupportedException, W("NotSupported_Void[]"));
+ COMPlusThrow(kNotSupportedException, W("NotSupported_VoidArray"));
// That's all the dangerous simple types we know, it must be OK.
return;
diff --git a/src/classlibnative/bcltype/system.cpp b/src/classlibnative/bcltype/system.cpp
index 2767d1e749..c36d2e1066 100644
--- a/src/classlibnative/bcltype/system.cpp
+++ b/src/classlibnative/bcltype/system.cpp
@@ -609,8 +609,6 @@ FCIMPL2(VOID, SystemNative::FailFastWithException, StringObject* refMessageUNSAF
}
FCIMPLEND
-
-
FCIMPL0(FC_BOOL_RET, SystemNative::IsServerGC)
{
FCALL_CONTRACT;
@@ -636,95 +634,6 @@ BOOL QCALLTYPE SystemNative::WinRTSupported()
#endif // FEATURE_COMINTEROP
-// Helper method to retrieve OS Version based on the environment.
-BOOL GetOSVersionForEnvironment(LPOSVERSIONINFO lpVersionInformation)
-{
-#ifdef FEATURE_WINDOWSPHONE
- // Return phone version information if it is available
- if (!g_fGetPhoneVersionInitialized)
- {
- HMODULE hPhoneInfo = WszLoadLibrary(W("phoneinfo.dll"));
- if(hPhoneInfo != NULL)
- g_pfnGetPhoneVersion = (pfnGetPhoneVersion)GetProcAddress(hPhoneInfo, "GetPhoneVersion");
-
- g_fGetPhoneVersionInitialized = true;
- }
-
- if (g_pfnGetPhoneVersion!= NULL)
- return g_pfnGetPhoneVersion(lpVersionInformation);
-#endif // FEATURE_WINDOWSPHONE
-
- return ::GetOSVersion(lpVersionInformation);
-}
-
-
-/*
- * SystemNative::GetOSVersion - Fcall corresponding to System.Environment.GetVersion
- * It calls clr!GetOSVersion to get the real OS version even when running in
- * app compat. Calling kernel32!GetVersionEx() directly will be shimmed and will return the
- * fake OS version. In order to avoid this the call to getVersionEx is made via mscoree.dll.
- * Mscoree.dll resides in system32 dir and is never lied about OS version.
- */
-
-FCIMPL1(FC_BOOL_RET, SystemNative::GetOSVersion, OSVERSIONINFOObject *osVer)
-{
- FCALL_CONTRACT;
-
- OSVERSIONINFO ver;
- ver.dwOSVersionInfoSize = osVer->dwOSVersionInfoSize;
-
- BOOL ret = GetOSVersionForEnvironment(&ver);
-
- if(ret)
- {
- osVer->dwMajorVersion = ver.dwMajorVersion;
- osVer->dwMinorVersion = ver.dwMinorVersion;
- osVer->dwBuildNumber = ver.dwBuildNumber;
- osVer->dwPlatformId = ver.dwPlatformId;
-
- HELPER_METHOD_FRAME_BEGIN_RET_1(osVer);
- SetObjectReference((OBJECTREF*)&(osVer->szCSDVersion), StringObject::NewString(ver.szCSDVersion), GetAppDomain());
- HELPER_METHOD_FRAME_END();
- }
-
- FC_RETURN_BOOL(ret);
-}
-FCIMPLEND
-
-/*
- * SystemNative::GetOSVersionEx - Fcall implementation for System.Environment.GetVersionEx
- * Similar as above except this takes OSVERSIONINFOEX structure as input
- */
-
-FCIMPL1(FC_BOOL_RET, SystemNative::GetOSVersionEx, OSVERSIONINFOEXObject *osVer)
-{
- FCALL_CONTRACT;
-
- OSVERSIONINFOEX ver;
- ver.dwOSVersionInfoSize = osVer->dwOSVersionInfoSize;
-
- BOOL ret = GetOSVersionForEnvironment((OSVERSIONINFO *)&ver);
-
- if(ret)
- {
- osVer->dwMajorVersion = ver.dwMajorVersion;
- osVer->dwMinorVersion = ver.dwMinorVersion;
- osVer->dwBuildNumber = ver.dwBuildNumber;
- osVer->dwPlatformId = ver.dwPlatformId;
- osVer->wServicePackMajor = ver.wServicePackMajor;
- osVer->wServicePackMinor = ver.wServicePackMinor;
- osVer->wSuiteMask = ver.wSuiteMask;
- osVer->wProductType = ver.wProductType;
- osVer->wReserved = ver.wReserved;
-
- HELPER_METHOD_FRAME_BEGIN_RET_1(osVer);
- SetObjectReference((OBJECTREF*)&(osVer->szCSDVersion), StringObject::NewString(ver.szCSDVersion), GetAppDomain());
- HELPER_METHOD_FRAME_END();
- }
-
- FC_RETURN_BOOL(ret);
-}
-FCIMPLEND
diff --git a/src/classlibnative/bcltype/system.h b/src/classlibnative/bcltype/system.h
index 1da105841f..986c55b31e 100644
--- a/src/classlibnative/bcltype/system.h
+++ b/src/classlibnative/bcltype/system.h
@@ -74,9 +74,6 @@ public:
static FCDECL0(INT64, __GetSystemTimeAsFileTime);
static FCDECL0(UINT32, GetCurrentProcessorNumber);
static FCDECL0(UINT32, GetTickCount);
- static FCDECL1(FC_BOOL_RET, GetOSVersion, OSVERSIONINFOObject *osVer);
- static FCDECL1(FC_BOOL_RET, GetOSVersionEx, OSVERSIONINFOEXObject *osVer);
-
static
void QCALLTYPE Exit(INT32 exitcode);
diff --git a/src/classlibnative/float/floatdouble.cpp b/src/classlibnative/float/floatdouble.cpp
index d9603c0636..6f593e503c 100644
--- a/src/classlibnative/float/floatdouble.cpp
+++ b/src/classlibnative/float/floatdouble.cpp
@@ -9,8 +9,6 @@
#include "floatdouble.h"
-#define IS_DBL_INFINITY(x) (((*((INT64*)((void*)&x))) & I64(0x7FFFFFFFFFFFFFFF)) == I64(0x7FF0000000000000))
-
// The default compilation mode is /fp:precise, which disables floating-point intrinsics. This
// default compilation mode has previously caused performance regressions in floating-point code.
// We enable /fp:fast semantics for the majority of the math functions, as it will speed up performance
@@ -86,13 +84,6 @@ FCIMPLEND
FCIMPL2_VV(double, COMDouble::Atan2, double y, double x)
FCALL_CONTRACT;
- // atan2(+/-INFINITY, +/-INFINITY) produces +/-0.78539816339744828 (x is +INFINITY) and
- // +/-2.3561944901923448 (x is -INFINITY) instead of the expected value of NaN. We handle
- // that case here ourselves.
- if (IS_DBL_INFINITY(y) && IS_DBL_INFINITY(x)) {
- return (double)(y / x);
- }
-
return (double)atan2(y, x);
FCIMPLEND
@@ -174,24 +165,6 @@ FCIMPLEND
FCIMPL2_VV(double, COMDouble::Pow, double x, double y)
FCALL_CONTRACT;
- // The CRT version of pow preserves the NaN payload of x over the NaN payload of y.
-
- if(_isnan(y)) {
- return y; // IEEE 754-2008: NaN payload must be preserved
- }
-
- if(_isnan(x)) {
- return x; // IEEE 754-2008: NaN payload must be preserved
- }
-
- // The CRT version of pow does not return NaN for pow(-1.0, +/-INFINITY) and
- // instead returns +1.0.
-
- if(IS_DBL_INFINITY(y) && (x == -1.0)) {
- INT64 result = CLR_NAN_64;
- return (*((double*)((INT64*)&result)));
- }
-
return (double)pow(x, y);
FCIMPLEND
diff --git a/src/classlibnative/float/floatsingle.cpp b/src/classlibnative/float/floatsingle.cpp
index c84c0bfb93..c7b7d4126b 100644
--- a/src/classlibnative/float/floatsingle.cpp
+++ b/src/classlibnative/float/floatsingle.cpp
@@ -9,18 +9,12 @@
#include "floatsingle.h"
-#define IS_FLT_INFINITY(x) (((*((INT32*)((void*)&x))) & 0x7FFFFFFF) == 0x7F800000)
-
// Windows x86 and Windows ARM/ARM64 may not define _isnanf() or _copysignf() but they do
// define _isnan() and _copysign(). We will redirect the macros to these other functions if
// the macro is not defined for the platform. This has the side effect of a possible implicit
// upcasting for arguments passed in and an explicit downcasting for the _copysign() call.
#if (defined(_TARGET_X86_) || defined(_TARGET_ARM_) || defined(_TARGET_ARM64_)) && !defined(FEATURE_PAL)
-#if !defined(_isnanf)
-#define _isnanf _isnan
-#endif
-
#if !defined(_copysignf)
#define _copysignf (float)_copysign
#endif
@@ -88,13 +82,6 @@ FCIMPLEND
FCIMPL2_VV(float, COMSingle::Atan2, float y, float x)
FCALL_CONTRACT;
- // atan2f(+/-INFINITY, +/-INFINITY) produces +/-0.785398163f (x is +INFINITY) and
- // +/-2.35619449f (x is -INFINITY) instead of the expected value of NaN. We handle
- // that case here ourselves.
- if (IS_FLT_INFINITY(y) && IS_FLT_INFINITY(x)) {
- return (float)(y / x);
- }
-
return (float)atan2f(y, x);
FCIMPLEND
@@ -176,24 +163,6 @@ FCIMPLEND
FCIMPL2_VV(float, COMSingle::Pow, float x, float y)
FCALL_CONTRACT;
- // The CRT version of pow preserves the NaN payload of x over the NaN payload of y.
-
- if(_isnanf(y)) {
- return y; // IEEE 754-2008: NaN payload must be preserved
- }
-
- if(_isnanf(x)) {
- return x; // IEEE 754-2008: NaN payload must be preserved
- }
-
- // The CRT version of powf does not return NaN for powf(-1.0f, +/-INFINITY) and
- // instead returns +1.0f.
-
- if(IS_FLT_INFINITY(y) && (x == -1.0f)) {
- INT32 result = CLR_NAN_32;
- return (*((float*)((INT32*)&result)));
- }
-
return (float)powf(x, y);
FCIMPLEND
diff --git a/src/coreclr/hosts/unixcoreconsole/CMakeLists.txt b/src/coreclr/hosts/unixcoreconsole/CMakeLists.txt
index 94587b5374..2daeaabfa3 100644
--- a/src/coreclr/hosts/unixcoreconsole/CMakeLists.txt
+++ b/src/coreclr/hosts/unixcoreconsole/CMakeLists.txt
@@ -31,8 +31,4 @@ if(NOT CLR_CMAKE_PLATFORM_ANDROID)
)
endif()
-add_dependencies(coreconsole
- coreclr
-)
-
install_clr(coreconsole)
diff --git a/src/coreclr/hosts/unixcorerun/CMakeLists.txt b/src/coreclr/hosts/unixcorerun/CMakeLists.txt
index b5dc730aaf..07beaae1df 100644
--- a/src/coreclr/hosts/unixcorerun/CMakeLists.txt
+++ b/src/coreclr/hosts/unixcorerun/CMakeLists.txt
@@ -32,8 +32,4 @@ if(NOT CLR_CMAKE_PLATFORM_ANDROID)
)
endif()
-add_dependencies(corerun
- coreclr
-)
-
install_clr(corerun)
diff --git a/src/corefx/System.Globalization.Native/CMakeLists.txt b/src/corefx/System.Globalization.Native/CMakeLists.txt
index 60ef5e8535..55c6854497 100644
--- a/src/corefx/System.Globalization.Native/CMakeLists.txt
+++ b/src/corefx/System.Globalization.Native/CMakeLists.txt
@@ -32,8 +32,8 @@ else()
message(FATAL_ERROR "Cannot find libicucore, skipping build for System.Globalization.Native. .NET globalization is not expected to function.")
return()
endif()
- # On Darwin, we always use the OS provided ICU
- SET(FEATURE_FIXED_ICU_VERSION 1)
+
+ add_definitions(-DOSX_ICU_LIBRARY_PATH=\"${ICUCORE}\")
endif()
include(configure.cmake)
@@ -50,14 +50,9 @@ set(NATIVEGLOBALIZATION_SOURCES
localeStringData.cpp
normalization.cpp
timeZoneInfo.cpp
+ icushim.cpp
)
-if (NOT FEATURE_FIXED_ICU_VERSION)
- list(APPEND NATIVEGLOBALIZATION_SOURCES
- icushim.cpp
- )
-endif()
-
include_directories(${UTYPES_H})
_add_library(System.Globalization.Native
@@ -76,21 +71,8 @@ set_target_properties(System.Globalization.Native_Static PROPERTIES OUTPUT_NAME
# Disable the "lib" prefix.
set_target_properties(System.Globalization.Native PROPERTIES PREFIX "")
-if (FEATURE_FIXED_ICU_VERSION)
- add_definitions(-DFEATURE_FIXED_ICU_VERSION)
-endif()
-
if(NOT CLR_CMAKE_PLATFORM_DARWIN)
- if (FEATURE_FIXED_ICU_VERSION)
- target_link_libraries(System.Globalization.Native
- ${ICUUC}
- ${ICUI18N}
- )
- target_link_libraries(System.Globalization.Native_Static
- ${ICUUC}
- ${ICUI18N}
- )
- elseif(NOT CMAKE_SYSTEM_NAME STREQUAL FreeBSD AND NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD)
+ if (NOT CMAKE_SYSTEM_NAME STREQUAL FreeBSD AND NOT CMAKE_SYSTEM_NAME STREQUAL NetBSD)
target_link_libraries(System.Globalization.Native
dl
)
@@ -100,7 +82,7 @@ if(NOT CLR_CMAKE_PLATFORM_DARWIN)
endif()
else()
target_link_libraries(System.Globalization.Native
- ${ICUCORE}
+ dl
)
add_definitions(-DU_DISABLE_RENAMING=1)
diff --git a/src/corefx/System.Globalization.Native/icushim.cpp b/src/corefx/System.Globalization.Native/icushim.cpp
index 1c2187b488..6e7817e85f 100644
--- a/src/corefx/System.Globalization.Native/icushim.cpp
+++ b/src/corefx/System.Globalization.Native/icushim.cpp
@@ -19,6 +19,33 @@ FOR_ALL_ICU_FUNCTIONS
static void* libicuuc = nullptr;
static void* libicui18n = nullptr;
+// .x.x.x, considering the max number of decimal digits for each component
+static const int MaxICUVersionStringLength = 33;
+
+#ifdef __APPLE__
+
+bool FindICULibs(char* symbolName, char* symbolVersion)
+{
+#ifndef OSX_ICU_LIBRARY_PATH
+ static_assert(false, "The ICU Library path is not defined");
+#endif // OSX_ICU_LIBRARY_PATH
+
+ // Usually OSX_ICU_LIBRARY_PATH is "/usr/lib/libicucore.dylib"
+ libicuuc = dlopen(OSX_ICU_LIBRARY_PATH, RTLD_LAZY);
+
+ if (libicuuc == nullptr)
+ {
+ return false;
+ }
+
+ // in OSX all ICU APIs exist in the same library libicucore.A.dylib
+ libicui18n = libicuuc;
+
+ return true;
+}
+
+#else // __APPLE__
+
// Version ranges to search for each of the three version components
// The rationale for major version range is that we support versions higher or
// equal to the version we are built against and less or equal to that version
@@ -31,9 +58,6 @@ static const int MaxMinorICUVersion = 5;
static const int MinSubICUVersion = 1;
static const int MaxSubICUVersion = 5;
-// .x.x.x, considering the max number of decimal digits for each component
-static const int MaxICUVersionStringLength = 33;
-
// Get filename of an ICU library with the requested version in the name
// There are three possible cases of the version components values:
// 1. Only majorVer is not equal to -1 => result is baseFileName.majorver
@@ -170,9 +194,7 @@ bool FindLibWithMajorMinorSubVersion(int* majorVer, int* minorVer, int* subVer)
return false;
}
-// This function is ran at the end of dlopen for the current shared library
-__attribute__((constructor))
-void InitializeICUShim()
+bool FindICULibs(char* symbolName, char* symbolVersion)
{
int majorVer = -1;
int minorVer = -1;
@@ -185,13 +207,8 @@ void InitializeICUShim()
!FindLibWithMajorVersion(&majorVer))
{
// No usable ICU version found
- fprintf(stderr, "No usable version of the ICU libraries was found\n");
- abort();
+ return false;
}
-
- char symbolName[128];
- char symbolVersion[MaxICUVersionStringLength + 1] = "";
-
// Find out the format of the version string added to each symbol
// First try just the unversioned symbol
if (dlsym(libicuuc, "u_strlen") == nullptr)
@@ -211,13 +228,30 @@ void InitializeICUShim()
sprintf(symbolName, "u_strlen%s", symbolVersion);
if (dlsym(libicuuc, symbolName) == nullptr)
{
- fprintf(stderr, "ICU libraries use unknown symbol versioning\n");
- abort();
+ return false;
}
}
}
}
+ return true;
+
+}
+
+#endif // __APPLE__
+
+// GlobalizationNative_LoadICU
+// This method get called from the managed side during the globalization initialization.
+// This method shouldn't get called at all if we are running in globalization invariant mode
+// return 0 if failed to load ICU and 1 otherwise
+extern "C" int32_t GlobalizationNative_LoadICU()
+{
+ char symbolName[128];
+ char symbolVersion[MaxICUVersionStringLength + 1] = "";
+
+ if (!FindICULibs(symbolName, symbolVersion))
+ return 0;
+
// Get pointers to all the ICU functions that are needed
#define PER_FUNCTION_BLOCK(fn, lib) \
static_assert((sizeof(#fn) + MaxICUVersionStringLength + 1) <= sizeof(symbolName), "The symbolName is too small for symbol " #fn); \
@@ -227,6 +261,13 @@ void InitializeICUShim()
FOR_ALL_ICU_FUNCTIONS
#undef PER_FUNCTION_BLOCK
+
+#ifdef __APPLE__
+ // libicui18n initialized with libicuuc so we null it to avoid double closing same handle
+ libicui18n = nullptr;
+#endif // __APPLE__
+
+ return 1;
}
__attribute__((destructor))
diff --git a/src/corefx/System.Globalization.Native/icushim.h b/src/corefx/System.Globalization.Native/icushim.h
index 8ec13d5737..408ec15edd 100644
--- a/src/corefx/System.Globalization.Native/icushim.h
+++ b/src/corefx/System.Globalization.Native/icushim.h
@@ -4,17 +4,14 @@
//
// Enable calling ICU functions through shims to enable support for
-// multiple versions of ICU if the FEATURE_FIXED_ICU_VERSION is
-// not defined.
+// multiple versions of ICU.
#ifndef __ICUSHIM_H__
#define __ICUSHIM_H__
#include "config.h"
-#ifndef FEATURE_FIXED_ICU_VERSION
#define U_DISABLE_RENAMING 1
-#endif
// All ICU headers need to be included here so that all function prototypes are
// available before the function pointers are declared below.
@@ -36,8 +33,6 @@
#include <unicode/utf16.h>
#include <unicode/utypes.h>
-#ifndef FEATURE_FIXED_ICU_VERSION
-
// List of all functions from the ICU libraries that are used in the System.Globalization.Native.so
#define FOR_ALL_UNCONDITIONAL_ICU_FUNCTIONS \
PER_FUNCTION_BLOCK(u_charsToUChars, libicuuc) \
@@ -238,6 +233,4 @@ FOR_ALL_ICU_FUNCTIONS
#define usearch_last(...) usearch_last_ptr(__VA_ARGS__)
#define usearch_openFromCollator(...) usearch_openFromCollator_ptr(__VA_ARGS__)
-#endif // !FEATURE_ICU_VERSION_RESILIENT
-
#endif // __ICUSHIM_H__
diff --git a/src/debug/daccess/CMakeLists.txt b/src/debug/daccess/CMakeLists.txt
index c06e94662d..aab3f81ac6 100644
--- a/src/debug/daccess/CMakeLists.txt
+++ b/src/debug/daccess/CMakeLists.txt
@@ -62,5 +62,5 @@ if(CLR_CMAKE_PLATFORM_UNIX)
DEPENDS ${GENERATED_INCLUDE_DIR}/dactablerva.h
)
- add_dependencies(daccess coreclr dactablerva_header)
+ add_dependencies(daccess dactablerva_header)
endif(CLR_CMAKE_PLATFORM_UNIX)
diff --git a/src/debug/daccess/daccess.cpp b/src/debug/daccess/daccess.cpp
index 841d31c889..dcf6314549 100644
--- a/src/debug/daccess/daccess.cpp
+++ b/src/debug/daccess/daccess.cpp
@@ -5235,7 +5235,7 @@ ClrDataAccess::FollowStubStep(
// this and redirect to the actual code.
methodDesc = trace.GetMethodDesc();
if (methodDesc->IsPreImplemented() &&
- !methodDesc->IsPointingToNativeCode() &&
+ !methodDesc->IsPointingToStableNativeCode() &&
!methodDesc->IsGenericMethodDefinition() &&
methodDesc->HasNativeCode())
{
diff --git a/src/debug/daccess/dacdbiimpl.cpp b/src/debug/daccess/dacdbiimpl.cpp
index c7595c46c1..605d5c7cee 100644
--- a/src/debug/daccess/dacdbiimpl.cpp
+++ b/src/debug/daccess/dacdbiimpl.cpp
@@ -5452,15 +5452,8 @@ CorDebugUserState DacDbiInterfaceImpl::GetPartialUserState(VMPTR_Thread vmThread
result |= USER_WAIT_SLEEP_JOIN;
}
- // Don't report a SuspendRequested if the thread has actually Suspended.
- if ((ts & Thread::TS_UserSuspendPending) && (ts & Thread::TS_SyncSuspended))
- {
- result |= USER_SUSPENDED;
- }
- else if (ts & Thread::TS_UserSuspendPending)
- {
- result |= USER_SUSPEND_REQUESTED;
- }
+ // CoreCLR does not support user-requested thread suspension
+ _ASSERTE(!(ts & Thread::TS_UserSuspendPending));
if (pThread->IsThreadPoolThread())
{
@@ -5725,9 +5718,9 @@ BOOL DacDbiInterfaceImpl::IsVmObjectHandleValid(VMPTR_OBJECTHANDLE vmHandle)
// SEH exceptions will be caught
EX_TRY
{
- OBJECTREF objRef = ObjectFromHandle((OBJECTHANDLE)vmHandle.GetDacPtr());
+ OBJECTREF objRef = HndFetchHandle((OBJECTHANDLE)vmHandle.GetDacPtr());
- // NULL is certinally valid...
+ // NULL is certainly valid...
if (objRef != NULL)
{
if (objRef->ValidateObjectWithPossibleAV())
diff --git a/src/debug/daccess/enummem.cpp b/src/debug/daccess/enummem.cpp
index 4a217d022f..027fe59543 100644
--- a/src/debug/daccess/enummem.cpp
+++ b/src/debug/daccess/enummem.cpp
@@ -21,7 +21,6 @@
#include "ipcmanagerinterface.h"
#include "binder.h"
#include "win32threadpool.h"
-#include "gcscan.h"
#ifdef FEATURE_APPX
#include "appxutil.h"
@@ -318,12 +317,10 @@ HRESULT ClrDataAccess::EnumMemCLRStatic(IN CLRDataEnumMemoryFlags flags)
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pFinalizerThread.EnumMem(); )
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED( g_pSuspensionThread.EnumMem(); )
-#ifdef FEATURE_SVR_GC
CATCH_ALL_EXCEPT_RETHROW_COR_E_OPERATIONCANCELLED
(
- IGCHeap::gcHeapType.EnumMem();
+ g_heap_type.EnumMem();
);
-#endif // FEATURE_SVR_GC
m_dumpStats.m_cbClrStatics = m_cbMemoryReported - cbMemoryReported;
@@ -407,7 +404,7 @@ HRESULT ClrDataAccess::DumpManagedObject(CLRDataEnumMemoryFlags flags, OBJECTREF
return status;
}
- if (!GCScan::GetGcRuntimeStructuresValid ())
+ if (*g_gcDacGlobals->gc_structures_invalid_cnt != 0)
{
// GC is in progress, don't dump this object
return S_OK;
@@ -465,7 +462,7 @@ HRESULT ClrDataAccess::DumpManagedExcepObject(CLRDataEnumMemoryFlags flags, OBJE
return S_OK;
}
- if (!GCScan::GetGcRuntimeStructuresValid ())
+ if (*g_gcDacGlobals->gc_structures_invalid_cnt != 0)
{
// GC is in progress, don't dump this object
return S_OK;
diff --git a/src/debug/daccess/request.cpp b/src/debug/daccess/request.cpp
index 88efe22c16..78ac831cd9 100644
--- a/src/debug/daccess/request.cpp
+++ b/src/debug/daccess/request.cpp
@@ -2929,31 +2929,33 @@ ClrDataAccess::GetGCHeapData(struct DacpGcHeapData *gcheapData)
SOSDacEnter();
- // for server GC-capable builds only, we need to check and see if IGCHeap::gcHeapType
+ // we need to check and see if g_heap_type
// is GC_HEAP_INVALID, in which case we fail.
- // IGCHeap::gcHeapType doesn't exist on non-server-GC capable builds.
-#ifdef FEATURE_SVR_GC
- ULONG32 gcHeapValue = *g_gcDacGlobals->gc_heap_type;
+ ULONG32 gcHeapValue = g_heap_type;
// GC_HEAP_TYPE has three possible values:
// GC_HEAP_INVALID = 0,
// GC_HEAP_WKS = 1,
// GC_HEAP_SVR = 2
// If we get something other than that, we probably read the wrong location.
- _ASSERTE(gcHeapValue >= IGCHeap::GC_HEAP_INVALID && gcHeapValue <= IGCHeap::GC_HEAP_SVR);
+ _ASSERTE(gcHeapValue >= GC_HEAP_INVALID && gcHeapValue <= GC_HEAP_SVR);
- // we have GC_HEAP_INVALID if gcHeapValue == 0, so we're done
- if (gcHeapValue == IGCHeap::GC_HEAP_INVALID)
+ // we have GC_HEAP_INVALID if gcHeapValue == 0, so we're done - we haven't
+ // initialized the heap yet.
+ if (gcHeapValue == GC_HEAP_INVALID)
{
hr = E_FAIL;
goto cleanup;
}
-#endif
// Now we can get other important information about the heap
+ // We can use GCHeapUtilities::IsServerHeap here because we have already validated
+ // that the heap is in a valid state. We couldn't use it above, because IsServerHeap
+ // asserts if the heap type is GC_HEAP_INVALID.
gcheapData->g_max_generation = *g_gcDacGlobals->max_gen;
- gcheapData->bServerMode = gcHeapValue == IGCHeap::GC_HEAP_SVR;
+ gcheapData->bServerMode = GCHeapUtilities::IsServerHeap();
gcheapData->bGcStructuresValid = *g_gcDacGlobals->gc_structures_invalid_cnt == 0;
+
if (GCHeapUtilities::IsServerHeap())
{
#if !defined (FEATURE_SVR_GC)
@@ -2968,10 +2970,8 @@ ClrDataAccess::GetGCHeapData(struct DacpGcHeapData *gcheapData)
gcheapData->HeapCount = 1;
}
-#ifdef FEATURE_SVR_GC
cleanup:
;
-#endif
SOSDacLeave();
return hr;
@@ -3069,7 +3069,7 @@ ClrDataAccess::GetGCInterestingInfoStaticData(struct DacpGCInterestingInfoData *
SOSDacEnter();
memset(data, 0, sizeof(DacpGCInterestingInfoData));
- if (*g_gcDacGlobals->gc_heap_type != IGCHeap::GC_HEAP_SVR)
+ if (g_heap_type != GC_HEAP_SVR)
{
for (int i = 0; i < NUM_GC_DATA_POINTS; i++)
data->interestingDataPoints[i] = g_gcDacGlobals->interesting_data_per_heap[i];
@@ -3827,6 +3827,7 @@ ClrDataAccess::EnumWksGlobalMemoryRegions(CLRDataEnumMemoryFlags flags)
Dereference(g_gcDacGlobals->ephemeral_heap_segment).EnumMem();
g_gcDacGlobals->alloc_allocated.EnumMem();
+ g_gcDacGlobals->gc_structures_invalid_cnt.EnumMem();
Dereference(g_gcDacGlobals->finalize_queue).EnumMem();
// Enumerate the entire generation table, which has variable size
@@ -3889,7 +3890,7 @@ HRESULT ClrDataAccess::GetClrWatsonBucketsWorker(Thread * pThread, GenericModeBl
if (ohThrowable != NULL)
{
// Get the object from handle and check if the throwable is preallocated or not
- OBJECTREF oThrowable = ObjectFromHandle(ohThrowable);
+ OBJECTREF oThrowable = ::HndFetchHandle(ohThrowable);
if (oThrowable != NULL)
{
// Does the throwable have buckets?
@@ -4183,7 +4184,7 @@ HRESULT ClrDataAccess::GetCCWData(CLRDATA_ADDRESS ccw, struct DacpCCWData *ccwDa
ccwData->isAggregated = pCCW->GetSimpleWrapper()->IsAggregated();
if (pCCW->GetObjectHandle() != NULL)
- ccwData->managedObject = PTR_CDADDR(ObjectFromHandle(pCCW->GetObjectHandle()));
+ ccwData->managedObject = PTR_CDADDR(::HndFetchHandle(pCCW->GetObjectHandle()));
// count the number of COM vtables
ccwData->interfaceCount = 0;
diff --git a/src/debug/daccess/request_svr.cpp b/src/debug/daccess/request_svr.cpp
index 4a90ec1b8e..6a1de35ff9 100644
--- a/src/debug/daccess/request_svr.cpp
+++ b/src/debug/daccess/request_svr.cpp
@@ -210,6 +210,7 @@ ClrDataAccess::EnumSvrGlobalMemoryRegions(CLRDataEnumMemoryFlags flags)
DacEnumMemoryRegion(g_gcDacGlobals->g_heaps.GetAddr(),
sizeof(TADDR) * *g_gcDacGlobals->n_heaps);
+ g_gcDacGlobals->gc_structures_invalid_cnt.EnumMem();
g_gcDacGlobals->g_heaps.EnumMem();
for (int i=0; i < *g_gcDacGlobals->n_heaps; i++)
@@ -239,7 +240,7 @@ ClrDataAccess::EnumSvrGlobalMemoryRegions(CLRDataEnumMemoryFlags flags)
DWORD DacGetNumHeaps()
{
- if (g_gcDacGlobals->gc_heap_type == IGCHeap::GC_HEAP_SVR)
+ if (g_heap_type == GC_HEAP_SVR)
return (DWORD)*g_gcDacGlobals->n_heaps;
// workstation gc
diff --git a/src/debug/di/process.cpp b/src/debug/di/process.cpp
index 4c32641290..b6d49c218d 100644
--- a/src/debug/di/process.cpp
+++ b/src/debug/di/process.cpp
@@ -4525,10 +4525,6 @@ void CordbProcess::QueueFakeConnectionEvents()
// from the runtime controller. This represents the last amount of processing
// the DI gets to do on an event before giving it to the user.
//
-#ifdef _PREFAST_
-#pragma warning(push)
-#pragma warning(disable:21000) // Suppress PREFast warning about overly large function
-#endif
void CordbProcess::DispatchRCEvent()
{
INTERNAL_API_ENTRY(this);
@@ -4729,6 +4725,10 @@ void CordbProcess::DbgAssertAppDomainDeleted(VMPTR_AppDomain vmAppDomainDeleted)
// A V2 shim can provide a proxy calllack that takes these events and queues them and
// does the real dispatch to the user to emulate V2 semantics.
//
+#ifdef _PREFAST_
+#pragma warning(push)
+#pragma warning(disable:21000) // Suppress PREFast warning about overly large function
+#endif
void CordbProcess::RawDispatchEvent(
DebuggerIPCEvent * pEvent,
RSLockHolder * pLockHolder,
diff --git a/src/debug/di/rsmain.cpp b/src/debug/di/rsmain.cpp
index 2a93619b2a..cdad21bf58 100644
--- a/src/debug/di/rsmain.cpp
+++ b/src/debug/di/rsmain.cpp
@@ -60,7 +60,7 @@ const char * GetDebugCodeName(DWORD dwCode)
"(5) EXIT_PROCESS_DEBUG_EVENT",
"(6) LOAD_DLL_DEBUG_EVENT",
"(7) UNLOAD_DLL_DEBUG_EVENT",
- "(8) OUTPUT_DEBUG_STRING_EVENT"
+ "(8) OUTPUT_DEBUG_STRING_EVENT",
"(9) RIP_EVENT",// <-- only on Win9X
};
diff --git a/src/debug/ee/dactable.cpp b/src/debug/ee/dactable.cpp
index a54fa7515c..af7de1710d 100644
--- a/src/debug/ee/dactable.cpp
+++ b/src/debug/ee/dactable.cpp
@@ -21,14 +21,6 @@
#include "../../vm/gcenv.h"
#include "../../vm/ecall.h"
#include "../../vm/rcwwalker.h"
-#include "../../gc/gc.h"
-#include "../../gc/gcscan.h"
-
-#undef SERVER_GC
-namespace WKS {
-#include "../../gc/gcimpl.h"
-#include "../../gc/gcpriv.h"
-}
#ifdef DEBUGGING_SUPPORTED
diff --git a/src/dlls/CMakeLists.txt b/src/dlls/CMakeLists.txt
index 6d036aff66..932e65e350 100644
--- a/src/dlls/CMakeLists.txt
+++ b/src/dlls/CMakeLists.txt
@@ -4,8 +4,6 @@ endif(WIN32)
add_subdirectory(dbgshim)
add_subdirectory(mscordbi)
add_subdirectory(mscordac)
-if (NOT CLR_CROSS_COMPONENTS_BUILD)
- add_subdirectory(mscoree)
- add_subdirectory(mscorpe)
- add_subdirectory(mscorrc)
-endif()
+add_subdirectory(mscoree)
+add_subdirectory(mscorpe)
+add_subdirectory(mscorrc)
diff --git a/src/dlls/mscoree/coreclr/CMakeLists.txt b/src/dlls/mscoree/coreclr/CMakeLists.txt
index ed15500f0e..3144b5139f 100644
--- a/src/dlls/mscoree/coreclr/CMakeLists.txt
+++ b/src/dlls/mscoree/coreclr/CMakeLists.txt
@@ -166,11 +166,14 @@ if(WIN32)
COMMAND ${BuildToolsDir}/InjectResource.exe /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin /dll:$<TARGET_FILE:coreclr>
COMMAND ${BuildToolsDir}/GenClrDebugResource.exe /dac:$<TARGET_FILE:mscordaccore> /dbi:$<TARGET_FILE:mscordbi> /sku:onecoreclr /out:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin
COMMAND ${BuildToolsDir}/InjectResource.exe /bin:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin /dll:$<TARGET_FILE:coreclr> /name:CLRDEBUGINFO
+ COMMAND ${BuildToolsDir}/InjectResource.exe /bin:${CMAKE_CURRENT_SOURCE_DIR}/dump_helper_resource.bin /dll:$<TARGET_FILE:coreclr> /name:MINIDUMP_AUXILIARY_PROVIDER
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources.timestamp
- COMMENT Add dactable & debug resources to coreclr
+ COMMENT Add dactable, debug resources, and dump helper resources to coreclr
)
- add_custom_target(inject_debug_resources ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources.timestamp)
+ if(NOT DEFINED CLR_CROSS_COMPONENTS_BUILD)
+ add_custom_target(inject_debug_resources ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources.timestamp)
+ endif()
endif(WIN32)
diff --git a/src/dlls/mscoree/coreclr/README.md b/src/dlls/mscoree/coreclr/README.md
new file mode 100644
index 0000000000..b33473bca4
--- /dev/null
+++ b/src/dlls/mscoree/coreclr/README.md
@@ -0,0 +1,7 @@
+dump\_helper\_resource.bin in this folder is a text file with a single 0 byte appended on the end using a hex-editor. It is unlikely it will need to be modified frequently if at all,
+but if that changes we can always create a little nicer tooling for it.
+
+dump\_helper\_resource.bin is used to populate the DUMP\_HELPER resource inside coreclr.dll on Windows. When an application crashes, Windows MinidumpWriteDump is planning to scan
+modules looking for this resource. The content of the resource is expected to be the name of a dll in the same folder, encoded in UTF8, null terminated, that implements the
+CLRDataCreateInterface function. For OS security purposes MinidumpWriteDump will do an authenticode signing check before loading the indicated binary, however if your build isn't
+signed you can get around this limitation by registering it at HKLM\Software\Microsoft\WindowsNT\CurrentVersion\MiniDumpAuxilliaryDlls. \ No newline at end of file
diff --git a/src/dlls/mscoree/coreclr/dump_helper_resource.bin b/src/dlls/mscoree/coreclr/dump_helper_resource.bin
new file mode 100644
index 0000000000..aa2d9eae1f
--- /dev/null
+++ b/src/dlls/mscoree/coreclr/dump_helper_resource.bin
Binary files differ
diff --git a/src/gc/CMakeLists.txt b/src/gc/CMakeLists.txt
index cba1aa9778..59c18ffd87 100644
--- a/src/gc/CMakeLists.txt
+++ b/src/gc/CMakeLists.txt
@@ -31,6 +31,7 @@ set( GC_SOURCES_DAC_AND_WKS_COMMON
set( GC_SOURCES_WKS
${GC_SOURCES_DAC_AND_WKS_COMMON}
+ gchandletable.cpp
gceesvr.cpp
gceewks.cpp
handletablecache.cpp)
diff --git a/src/gc/env/gcenv.base.h b/src/gc/env/gcenv.base.h
index 9fe583f9a6..f5e730d887 100644
--- a/src/gc/env/gcenv.base.h
+++ b/src/gc/env/gcenv.base.h
@@ -37,7 +37,7 @@
// Aliases for Win32 types
//
-typedef uint32_t BOOL;
+typedef int BOOL;
typedef uint32_t DWORD;
// -----------------------------------------------------------------------------------------------------------
diff --git a/src/gc/env/gcenv.ee.h b/src/gc/env/gcenv.ee.h
index 9f7f266a89..8c4dfccce9 100644
--- a/src/gc/env/gcenv.ee.h
+++ b/src/gc/env/gcenv.ee.h
@@ -68,6 +68,9 @@ public:
static void StompWriteBarrier(WriteBarrierParameters* args);
static void EnableFinalization(bool foundFinalizers);
+
+ static void HandleFatalError(unsigned int exitCode);
+ static bool ShouldFinalizeObjectForUnload(AppDomain* pDomain, Object* obj);
};
#endif // __GCENV_EE_H__
diff --git a/src/gc/gc.cpp b/src/gc/gc.cpp
index 8e2f0bfa7f..ab8e56bc8a 100644
--- a/src/gc/gc.cpp
+++ b/src/gc/gc.cpp
@@ -53,9 +53,13 @@ BOOL bgc_heap_walk_for_etw_p = FALSE;
#define LOH_PIN_QUEUE_LENGTH 100
#define LOH_PIN_DECAY 10
-// Right now we support maximum 256 procs - meaning that we will create at most
-// 256 GC threads and 256 GC heaps.
-#define MAX_SUPPORTED_CPUS 256
+#ifdef BIT64
+// Right now we support maximum 1024 procs - meaning that we will create at most
+// that many GC threads and GC heaps.
+#define MAX_SUPPORTED_CPUS 1024
+#else
+#define MAX_SUPPORTED_CPUS 64
+#endif // BIT64
#ifdef GC_CONFIG_DRIVEN
int compact_ratio = 0;
@@ -68,6 +72,24 @@ int compact_ratio = 0;
// See comments in reset_memory.
BOOL reset_mm_p = TRUE;
+bool g_fFinalizerRunOnShutDown = false;
+
+#ifdef FEATURE_SVR_GC
+bool g_built_with_svr_gc = true;
+#else
+bool g_built_with_svr_gc = false;
+#endif // FEATURE_SVR_GC
+
+#if defined(BUILDENV_DEBUG)
+uint8_t g_build_variant = 0;
+#elif defined(BUILDENV_CHECKED)
+uint8_t g_build_variant = 1;
+#else
+uint8_t g_build_variant = 2;
+#endif // defined(BUILDENV_DEBUG)
+
+VOLATILE(int32_t) g_no_gc_lock = -1;
+
#if defined (TRACE_GC) && !defined (DACCESS_COMPILE)
const char * const allocation_state_str[] = {
"start",
@@ -93,7 +115,6 @@ const char * const allocation_state_str[] = {
};
#endif //TRACE_GC && !DACCESS_COMPILE
-
// Keep this in sync with the definition of gc_reason
#if (defined(DT_LOG) || defined(TRACE_GC)) && !defined (DACCESS_COMPILE)
static const char* const str_gc_reasons[] =
@@ -150,6 +171,7 @@ size_t GetHighPrecisionTimeStamp()
}
#endif
+
#ifdef GC_STATS
// There is a current and a prior copy of the statistics. This allows us to display deltas per reporting
// interval, as well as running totals. The 'min' and 'max' values require special treatment. They are
@@ -190,8 +212,10 @@ void GCStatistics::AddGCStats(const gc_mechanisms& settings, size_t timeInMSec)
if (is_induced (settings.reason))
cntReasons[(int)reason_induced]++;
+#ifdef STRESS_HEAP
else if (settings.stress_induced)
cntReasons[(int)reason_gcstress]++;
+#endif // STRESS_HEAP
else
cntReasons[(int)settings.reason]++;
@@ -2685,10 +2709,6 @@ BOOL gc_heap::heap_analyze_enabled = FALSE;
#ifndef MULTIPLE_HEAPS
-extern "C" {
- generation generation_table[NUMBERGENERATIONS + 1];
-}
-
alloc_list gc_heap::loh_alloc_list [NUM_LOH_ALIST-1];
alloc_list gc_heap::gen2_alloc_list[NUM_GEN2_ALIST-1];
@@ -2731,9 +2751,7 @@ int gc_heap::gen0_must_clear_bricks = 0;
CFinalize* gc_heap::finalize_queue = 0;
#endif // FEATURE_PREMORTEM_FINALIZATION
-#ifdef MULTIPLE_HEAPS
generation gc_heap::generation_table [NUMBERGENERATIONS + 1];
-#endif // MULTIPLE_HEAPS
size_t gc_heap::interesting_data_per_heap[max_idp_count];
@@ -4897,12 +4915,12 @@ class heap_select
static unsigned n_sniff_buffers;
static unsigned cur_sniff_index;
- static uint8_t proc_no_to_heap_no[MAX_SUPPORTED_CPUS];
- static uint8_t heap_no_to_proc_no[MAX_SUPPORTED_CPUS];
- static uint8_t heap_no_to_numa_node[MAX_SUPPORTED_CPUS];
- static uint8_t heap_no_to_cpu_group[MAX_SUPPORTED_CPUS];
- static uint8_t heap_no_to_group_proc[MAX_SUPPORTED_CPUS];
- static uint8_t numa_node_to_heap_map[MAX_SUPPORTED_CPUS+4];
+ static uint16_t proc_no_to_heap_no[MAX_SUPPORTED_CPUS];
+ static uint16_t heap_no_to_proc_no[MAX_SUPPORTED_CPUS];
+ static uint16_t heap_no_to_numa_node[MAX_SUPPORTED_CPUS];
+ static uint16_t heap_no_to_cpu_group[MAX_SUPPORTED_CPUS];
+ static uint16_t heap_no_to_group_proc[MAX_SUPPORTED_CPUS];
+ static uint16_t numa_node_to_heap_map[MAX_SUPPORTED_CPUS+4];
static int access_time(uint8_t *sniff_buffer, int heap_number, unsigned sniff_index, unsigned n_sniff_buffers)
{
@@ -4944,7 +4962,7 @@ public:
//can not enable gc numa aware, force all heaps to be in
//one numa node by filling the array with all 0s
if (!NumaNodeInfo::CanEnableGCNumaAware())
- memset(heap_no_to_numa_node, 0, MAX_SUPPORTED_CPUS);
+ memset(heap_no_to_numa_node, 0, sizeof (heap_no_to_numa_node));
return TRUE;
}
@@ -4954,10 +4972,10 @@ public:
if (GCToOSInterface::CanGetCurrentProcessorNumber())
{
uint32_t proc_no = GCToOSInterface::GetCurrentProcessorNumber() % gc_heap::n_heaps;
- // We can safely cast heap_number to a BYTE 'cause GetCurrentProcessCpuCount
+ // We can safely cast heap_number to a uint16_t 'cause GetCurrentProcessCpuCount
// only returns up to MAX_SUPPORTED_CPUS procs right now. We only ever create at most
// MAX_SUPPORTED_CPUS GC threads.
- proc_no_to_heap_no[proc_no] = (uint8_t)heap_number;
+ proc_no_to_heap_no[proc_no] = (uint16_t)heap_number;
}
}
@@ -5020,42 +5038,42 @@ public:
return GCToOSInterface::CanGetCurrentProcessorNumber();
}
- static uint8_t find_proc_no_from_heap_no(int heap_number)
+ static uint16_t find_proc_no_from_heap_no(int heap_number)
{
return heap_no_to_proc_no[heap_number];
}
- static void set_proc_no_for_heap(int heap_number, uint8_t proc_no)
+ static void set_proc_no_for_heap(int heap_number, uint16_t proc_no)
{
heap_no_to_proc_no[heap_number] = proc_no;
}
- static uint8_t find_numa_node_from_heap_no(int heap_number)
+ static uint16_t find_numa_node_from_heap_no(int heap_number)
{
return heap_no_to_numa_node[heap_number];
}
- static void set_numa_node_for_heap(int heap_number, uint8_t numa_node)
+ static void set_numa_node_for_heap(int heap_number, uint16_t numa_node)
{
heap_no_to_numa_node[heap_number] = numa_node;
}
- static uint8_t find_cpu_group_from_heap_no(int heap_number)
+ static uint16_t find_cpu_group_from_heap_no(int heap_number)
{
return heap_no_to_cpu_group[heap_number];
}
- static void set_cpu_group_for_heap(int heap_number, uint8_t group_number)
+ static void set_cpu_group_for_heap(int heap_number, uint16_t group_number)
{
heap_no_to_cpu_group[heap_number] = group_number;
}
- static uint8_t find_group_proc_from_heap_no(int heap_number)
+ static uint16_t find_group_proc_from_heap_no(int heap_number)
{
return heap_no_to_group_proc[heap_number];
}
- static void set_group_proc_for_heap(int heap_number, uint8_t group_proc)
+ static void set_group_proc_for_heap(int heap_number, uint16_t group_proc)
{
heap_no_to_group_proc[heap_number] = group_proc;
}
@@ -5070,15 +5088,15 @@ public:
for (int i=1; i < nheaps; i++)
{
if (heap_no_to_numa_node[i] != heap_no_to_numa_node[i-1])
- numa_node_to_heap_map[node_index++] = (uint8_t)i;
+ numa_node_to_heap_map[node_index++] = (uint16_t)i;
}
- numa_node_to_heap_map[node_index] = (uint8_t)nheaps; //mark the end with nheaps
+ numa_node_to_heap_map[node_index] = (uint16_t)nheaps; //mark the end with nheaps
}
static void get_heap_range_for_heap(int hn, int* start, int* end)
{ // 1-tier/no numa case: heap_no_to_numa_node[] all zeros,
// and treated as in one node. thus: start=0, end=n_heaps
- uint8_t numa_node = heap_no_to_numa_node[hn];
+ uint16_t numa_node = heap_no_to_numa_node[hn];
*start = (int)numa_node_to_heap_map[numa_node];
*end = (int)(numa_node_to_heap_map[numa_node+1]);
}
@@ -5086,12 +5104,12 @@ public:
uint8_t* heap_select::sniff_buffer;
unsigned heap_select::n_sniff_buffers;
unsigned heap_select::cur_sniff_index;
-uint8_t heap_select::proc_no_to_heap_no[MAX_SUPPORTED_CPUS];
-uint8_t heap_select::heap_no_to_proc_no[MAX_SUPPORTED_CPUS];
-uint8_t heap_select::heap_no_to_numa_node[MAX_SUPPORTED_CPUS];
-uint8_t heap_select::heap_no_to_cpu_group[MAX_SUPPORTED_CPUS];
-uint8_t heap_select::heap_no_to_group_proc[MAX_SUPPORTED_CPUS];
-uint8_t heap_select::numa_node_to_heap_map[MAX_SUPPORTED_CPUS+4];
+uint16_t heap_select::proc_no_to_heap_no[MAX_SUPPORTED_CPUS];
+uint16_t heap_select::heap_no_to_proc_no[MAX_SUPPORTED_CPUS];
+uint16_t heap_select::heap_no_to_numa_node[MAX_SUPPORTED_CPUS];
+uint16_t heap_select::heap_no_to_cpu_group[MAX_SUPPORTED_CPUS];
+uint16_t heap_select::heap_no_to_group_proc[MAX_SUPPORTED_CPUS];
+uint16_t heap_select::numa_node_to_heap_map[MAX_SUPPORTED_CPUS+4];
BOOL gc_heap::create_thread_support (unsigned number_of_heaps)
{
@@ -5150,8 +5168,8 @@ void set_thread_group_affinity_for_heap(int heap_number, GCThreadAffinity* affin
dprintf(3, ("using processor group %d, mask %Ix for heap %d\n", gn, mask, heap_number));
affinity->Processor = gpn;
affinity->Group = gn;
- heap_select::set_cpu_group_for_heap(heap_number, (uint8_t)gn);
- heap_select::set_group_proc_for_heap(heap_number, (uint8_t)gpn);
+ heap_select::set_cpu_group_for_heap(heap_number, gn);
+ heap_select::set_group_proc_for_heap(heap_number, gpn);
if (NumaNodeInfo::CanEnableGCNumaAware())
{
PROCESSOR_NUMBER proc_no;
@@ -5161,11 +5179,11 @@ void set_thread_group_affinity_for_heap(int heap_number, GCThreadAffinity* affin
uint16_t node_no = 0;
if (NumaNodeInfo::GetNumaProcessorNodeEx(&proc_no, &node_no))
- heap_select::set_numa_node_for_heap(heap_number, (uint8_t)node_no);
+ heap_select::set_numa_node_for_heap(heap_number, node_no);
}
else
{ // no numa setting, each cpu group is treated as a node
- heap_select::set_numa_node_for_heap(heap_number, (uint8_t)gn);
+ heap_select::set_numa_node_for_heap(heap_number, gn);
}
return;
}
@@ -5202,7 +5220,7 @@ void set_thread_affinity_mask_for_heap(int heap_number, GCThreadAffinity* affini
proc_no.Reserved = 0;
if (NumaNodeInfo::GetNumaProcessorNodeEx(&proc_no, &node_no))
{
- heap_select::set_numa_node_for_heap(heap_number, (uint8_t)node_no);
+ heap_select::set_numa_node_for_heap(heap_number, node_no);
}
}
return;
@@ -5571,7 +5589,7 @@ public:
// We should think about whether it's really necessary to have to copy back the pre plug
// info since it was already copied during compacting plugs. But if a plug doesn't move
- // by < 3 ptr size, it means we'd have to recover pre plug info.
+ // by >= 3 ptr size (the size of gap_reloc_pair), it means we'd have to recover pre plug info.
void recover_plug_info()
{
if (saved_pre_p)
@@ -5716,18 +5734,13 @@ void gc_mechanisms::record (gc_history_global* history)
//as opposed to concurrent heap verification
void gc_heap::fix_youngest_allocation_area (BOOL for_gc_p)
{
- assert (alloc_allocated);
- alloc_context* acontext = generation_alloc_context (youngest_generation);
- dprintf (3, ("generation 0 alloc context: ptr: %Ix, limit %Ix",
- (size_t)acontext->alloc_ptr, (size_t)acontext->alloc_limit));
- fix_allocation_context (acontext, for_gc_p, get_alignment_constant (TRUE));
- if (for_gc_p)
- {
- acontext->alloc_ptr = alloc_allocated;
- acontext->alloc_limit = acontext->alloc_ptr;
- }
- heap_segment_allocated (ephemeral_heap_segment) =
- alloc_allocated;
+ UNREFERENCED_PARAMETER(for_gc_p);
+
+ // The gen 0 alloc context is never used for allocation in the allocator path. It's
+ // still used in the allocation path during GCs.
+ assert (generation_allocation_pointer (youngest_generation) == nullptr);
+ assert (generation_allocation_limit (youngest_generation) == nullptr);
+ heap_segment_allocated (ephemeral_heap_segment) = alloc_allocated;
}
void gc_heap::fix_large_allocation_area (BOOL for_gc_p)
@@ -5793,9 +5806,10 @@ void gc_heap::fix_allocation_context (alloc_context* acontext, BOOL for_gc_p,
alloc_contexts_used ++;
}
-
if (for_gc_p)
{
+ // We need to update the alloc_bytes to reflect the portion that we have not used
+ acontext->alloc_bytes -= (acontext->alloc_limit - acontext->alloc_ptr);
acontext->alloc_ptr = 0;
acontext->alloc_limit = acontext->alloc_ptr;
}
@@ -5832,12 +5846,6 @@ void void_allocation (gc_alloc_context* acontext, void*)
void gc_heap::repair_allocation_contexts (BOOL repair_p)
{
GCToEEInterface::GcEnumAllocContexts (repair_p ? repair_allocation : void_allocation, NULL);
-
- alloc_context* acontext = generation_alloc_context (youngest_generation);
- if (repair_p)
- repair_allocation (acontext, NULL);
- else
- void_allocation (acontext, NULL);
}
struct fix_alloc_context_args
@@ -5849,7 +5857,7 @@ struct fix_alloc_context_args
void fix_alloc_context(gc_alloc_context* acontext, void* param)
{
fix_alloc_context_args* args = (fix_alloc_context_args*)param;
- g_theGCHeap->FixAllocContext(acontext, FALSE, (void*)(size_t)(args->for_gc_p), args->heap);
+ g_theGCHeap->FixAllocContext(acontext, false, (void*)(size_t)(args->for_gc_p), args->heap);
}
void gc_heap::fix_allocation_contexts(BOOL for_gc_p)
@@ -5857,8 +5865,8 @@ void gc_heap::fix_allocation_contexts(BOOL for_gc_p)
fix_alloc_context_args args;
args.for_gc_p = for_gc_p;
args.heap = __this;
- GCToEEInterface::GcEnumAllocContexts(fix_alloc_context, &args);
+ GCToEEInterface::GcEnumAllocContexts(fix_alloc_context, &args);
fix_youngest_allocation_area(for_gc_p);
fix_large_allocation_area(for_gc_p);
}
@@ -11374,6 +11382,13 @@ void gc_heap::adjust_limit_clr (uint8_t* start, size_t limit_size,
}
acontext->alloc_ptr = start;
}
+ else
+ {
+ // If the next alloc context is right up against the current one it means we are absorbing the min
+ // object, so need to account for that.
+ acontext->alloc_bytes += (start - acontext->alloc_limit);
+ }
+
acontext->alloc_limit = (start + limit_size - aligned_min_obj_size);
acontext->alloc_bytes += limit_size - ((gen_number < max_generation + 1) ? aligned_min_obj_size : 0);
@@ -13333,11 +13348,11 @@ try_again:
if (CPUGroupInfo::CanEnableGCCPUGroups())
{ //only set ideal processor when max_hp and org_hp are in the same cpu
//group. DO NOT MOVE THREADS ACROSS CPU GROUPS
- uint8_t org_gn = heap_select::find_cpu_group_from_heap_no(org_hp->heap_number);
- uint8_t max_gn = heap_select::find_cpu_group_from_heap_no(max_hp->heap_number);
+ uint16_t org_gn = heap_select::find_cpu_group_from_heap_no(org_hp->heap_number);
+ uint16_t max_gn = heap_select::find_cpu_group_from_heap_no(max_hp->heap_number);
if (org_gn == max_gn) //only set within CPU group, so SetThreadIdealProcessor is enough
{
- uint8_t group_proc_no = heap_select::find_group_proc_from_heap_no(max_hp->heap_number);
+ uint16_t group_proc_no = heap_select::find_group_proc_from_heap_no(max_hp->heap_number);
GCThreadAffinity affinity;
affinity.Processor = group_proc_no;
@@ -13351,7 +13366,7 @@ try_again:
}
else
{
- uint8_t proc_no = heap_select::find_proc_no_from_heap_no(max_hp->heap_number);
+ uint16_t proc_no = heap_select::find_proc_no_from_heap_no(max_hp->heap_number);
GCThreadAffinity affinity;
affinity.Processor = proc_no;
@@ -14182,7 +14197,8 @@ uint8_t* gc_heap::allocate_in_condemned_generations (generation* gen,
to_gen_number = from_gen_number + (settings.promotion ? 1 : 0);
}
- dprintf (3, ("aic gen%d: s: %Id", gen->gen_num, size));
+ dprintf (3, ("aic gen%d: s: %Id, %d->%d, %Ix->%Ix", gen->gen_num, size, from_gen_number,
+ to_gen_number, generation_allocation_pointer(gen), generation_allocation_limit(gen)));
int pad_in_front = (old_loc != 0) ? USE_PADDING_FRONT : 0;
@@ -17480,7 +17496,7 @@ void gc_heap::enque_pinned_plug (uint8_t* plug,
// risks. This happens very rarely and fixing it in the
// way so that we can continue is a bit involved and will
// not be done in Dev10.
- EEPOLICY_HANDLE_FATAL_ERROR(CORINFO_EXCEPTION_GC);
+ GCToEEInterface::HandleFatalError(CORINFO_EXCEPTION_GC);
}
}
@@ -21316,7 +21332,7 @@ void gc_heap::relocate_in_loh_compact()
generation_free_obj_space (gen)));
}
-void gc_heap::walk_relocation_for_loh (size_t profiling_context, record_surv_fn fn)
+void gc_heap::walk_relocation_for_loh (void* profiling_context, record_surv_fn fn)
{
generation* gen = large_object_generation;
heap_segment* seg = heap_segment_rw (generation_start_segment (gen));
@@ -21346,7 +21362,7 @@ void gc_heap::walk_relocation_for_loh (size_t profiling_context, record_surv_fn
STRESS_LOG_PLUG_MOVE(o, (o + size), -reloc);
- fn (o, (o + size), reloc, profiling_context, settings.compaction, FALSE);
+ fn (o, (o + size), reloc, profiling_context, !!settings.compaction, false);
o = o + size;
if (o < heap_segment_allocated (seg))
@@ -24161,7 +24177,7 @@ void gc_heap::walk_plug (uint8_t* plug, size_t size, BOOL check_last_object_p, w
STRESS_LOG_PLUG_MOVE(plug, (plug + size), -last_plug_relocation);
ptrdiff_t reloc = settings.compaction ? last_plug_relocation : 0;
- (args->fn) (plug, (plug + size), reloc, args->profiling_context, settings.compaction, FALSE);
+ (args->fn) (plug, (plug + size), reloc, args->profiling_context, !!settings.compaction, false);
if (check_last_object_p)
{
@@ -24229,7 +24245,7 @@ void gc_heap::walk_relocation_in_brick (uint8_t* tree, walk_relocate_args* args)
}
}
-void gc_heap::walk_relocation (size_t profiling_context, record_surv_fn fn)
+void gc_heap::walk_relocation (void* profiling_context, record_surv_fn fn)
{
generation* condemned_gen = generation_of (settings.condemned_generation);
uint8_t* start_address = generation_allocation_start (condemned_gen);
@@ -24285,7 +24301,7 @@ void gc_heap::walk_relocation (size_t profiling_context, record_surv_fn fn)
}
}
-void gc_heap::walk_survivors (record_surv_fn fn, size_t context, walk_surv_type type)
+void gc_heap::walk_survivors (record_surv_fn fn, void* context, walk_surv_type type)
{
if (type == walk_for_gc)
walk_survivors_relocation (context, fn);
@@ -24300,7 +24316,7 @@ void gc_heap::walk_survivors (record_surv_fn fn, size_t context, walk_surv_type
}
#if defined(BACKGROUND_GC) && defined(FEATURE_EVENT_TRACE)
-void gc_heap::walk_survivors_for_bgc (size_t profiling_context, record_surv_fn fn)
+void gc_heap::walk_survivors_for_bgc (void* profiling_context, record_surv_fn fn)
{
// This should only be called for BGCs
assert(settings.concurrent);
@@ -24361,8 +24377,8 @@ void gc_heap::walk_survivors_for_bgc (size_t profiling_context, record_surv_fn f
plug_end,
0, // Reloc distance == 0 as this is non-compacting
profiling_context,
- FALSE, // Non-compacting
- TRUE); // BGC
+ false, // Non-compacting
+ true); // BGC
}
seg = heap_segment_next (seg);
@@ -24986,7 +25002,7 @@ void gc_heap::gc_thread_stub (void* arg)
#else
STRESS_LOG0(LF_GC, LL_ALWAYS, "Thread::CommitThreadStack failed.");
_ASSERTE(!"Thread::CommitThreadStack failed.");
- EEPOLICY_HANDLE_FATAL_ERROR(COR_E_STACKOVERFLOW);
+ GCToEEInterface::HandleFatalError(COR_E_STACKOVERFLOW);
#endif //BACKGROUND_GC
}
#endif // FEATURE_REDHAWK
@@ -30756,6 +30772,7 @@ CObjectHeader* gc_heap::allocate_large_object (size_t jsize, int64_t& alloc_byte
uint8_t* result = acontext.alloc_ptr;
assert ((size_t)(acontext.alloc_limit - acontext.alloc_ptr) == size);
+ alloc_bytes += size;
CObjectHeader* obj = (CObjectHeader*)result;
@@ -30792,7 +30809,6 @@ CObjectHeader* gc_heap::allocate_large_object (size_t jsize, int64_t& alloc_byte
assert (obj != 0);
assert ((size_t)obj == Align ((size_t)obj, align_const));
- alloc_bytes += acontext.alloc_bytes;
return obj;
}
@@ -30847,7 +30863,7 @@ BOOL gc_heap::large_object_marked (uint8_t* o, BOOL clearp)
return m;
}
-void gc_heap::walk_survivors_relocation (size_t profiling_context, record_surv_fn fn)
+void gc_heap::walk_survivors_relocation (void* profiling_context, record_surv_fn fn)
{
// Now walk the portion of memory that is actually being relocated.
walk_relocation (profiling_context, fn);
@@ -30860,7 +30876,7 @@ void gc_heap::walk_survivors_relocation (size_t profiling_context, record_surv_f
#endif //FEATURE_LOH_COMPACTION
}
-void gc_heap::walk_survivors_for_loh (size_t profiling_context, record_surv_fn fn)
+void gc_heap::walk_survivors_for_loh (void* profiling_context, record_surv_fn fn)
{
generation* gen = large_object_generation;
heap_segment* seg = heap_segment_rw (generation_start_segment (gen));;
@@ -30898,7 +30914,7 @@ void gc_heap::walk_survivors_for_loh (size_t profiling_context, record_surv_fn f
plug_end = o;
- fn (plug_start, plug_end, 0, profiling_context, FALSE, FALSE);
+ fn (plug_start, plug_end, 0, profiling_context, false, false);
}
else
{
@@ -32431,36 +32447,18 @@ int GCHeap::m_CurStressObj = 0;
#endif // FEATURE_REDHAWK
#endif //FEATURE_PREMORTEM_FINALIZATION
-inline
-static void spin_lock ()
-{
- enter_spin_lock_noinstru (&m_GCLock);
-}
-inline
-void EnterAllocLock()
-{
- spin_lock();
-}
-
-inline
-void LeaveAllocLock()
-{
- // Trick this out
- leave_spin_lock_noinstru (&m_GCLock);
-}
-
-class AllocLockHolder
+class NoGCRegionLockHolder
{
public:
- AllocLockHolder()
+ NoGCRegionLockHolder()
{
- EnterAllocLock();
+ enter_spin_lock_noinstru(&g_no_gc_lock);
}
- ~AllocLockHolder()
+ ~NoGCRegionLockHolder()
{
- LeaveAllocLock();
+ leave_spin_lock_noinstru(&g_no_gc_lock);
}
};
@@ -33503,6 +33501,7 @@ void GCHeap::ValidateObjectMember (Object* obj)
{
dprintf (3, ("VOM: m: %Ix obj %Ix", (size_t)child_o, o));
MethodTable *pMT = method_table (child_o);
+ assert(pMT);
if (!pMT->SanityCheck()) {
dprintf (3, ("Bad member of %Ix %Ix",
(size_t)oo, (size_t)child_o));
@@ -33612,14 +33611,6 @@ HRESULT GCHeap::Init(size_t hn)
{
HRESULT hres = S_OK;
- //Initialize all of the instance members.
-
-#ifdef MULTIPLE_HEAPS
- m_GCLock = -1;
-#endif //MULTIPLE_HEAPS
-
- // Rest of the initialization
-
#ifdef MULTIPLE_HEAPS
if ((pGenGCHeap = gc_heap::make_gc_heap(this, (int)hn)) == 0)
hres = E_OUTOFMEMORY;
@@ -33667,6 +33658,8 @@ HRESULT GCHeap::Initialize ()
uint32_t nhp = ((nhp_from_config == 0) ? nhp_from_process :
(min (nhp_from_config, nhp_from_process)));
+ nhp = min (nhp, MAX_SUPPORTED_CPUS);
+
hr = gc_heap::initialize_gc (seg_size, large_seg_size /*LHEAP_ALLOC*/, nhp);
#else
hr = gc_heap::initialize_gc (seg_size, large_seg_size /*LHEAP_ALLOC*/);
@@ -33758,7 +33751,7 @@ HRESULT GCHeap::Initialize ()
////
// GC callback functions
-BOOL GCHeap::IsPromoted(Object* object)
+bool GCHeap::IsPromoted(Object* object)
{
#ifdef _DEBUG
((CObjectHeader*)object)->Validate();
@@ -33777,7 +33770,7 @@ BOOL GCHeap::IsPromoted(Object* object)
#ifdef BACKGROUND_GC
if (gc_heap::settings.concurrent)
{
- BOOL is_marked = (!((o < hp->background_saved_highest_address) && (o >= hp->background_saved_lowest_address))||
+ bool is_marked = (!((o < hp->background_saved_highest_address) && (o >= hp->background_saved_lowest_address))||
hp->background_marked (o));
return is_marked;
}
@@ -33818,11 +33811,11 @@ unsigned int GCHeap::WhichGeneration (Object* object)
return g;
}
-BOOL GCHeap::IsEphemeral (Object* object)
+bool GCHeap::IsEphemeral (Object* object)
{
uint8_t* o = (uint8_t*)object;
gc_heap* hp = gc_heap::heap_of (o);
- return hp->ephemeral_pointer_p (o);
+ return !!hp->ephemeral_pointer_p (o);
}
// Return NULL if can't find next object. When EE is not suspended,
@@ -33896,7 +33889,7 @@ BOOL GCHeap::IsInFrozenSegment (Object * object)
#endif //VERIFY_HEAP
// returns TRUE if the pointer is in one of the GC heaps.
-BOOL GCHeap::IsHeapPointer (void* vpObject, BOOL small_heap_only)
+bool GCHeap::IsHeapPointer (void* vpObject, bool small_heap_only)
{
STATIC_CONTRACT_SO_TOLERANT;
@@ -34067,7 +34060,7 @@ void GCHeap::Relocate (Object** ppObject, ScanContext* sc,
STRESS_LOG_ROOT_RELOCATE(ppObject, object, pheader, ((!(flags & GC_CALL_INTERIOR)) ? ((Object*)object)->GetGCSafeMethodTable() : 0));
}
-/*static*/ BOOL GCHeap::IsObjectInFixedHeap(Object *pObj)
+/*static*/ bool GCHeap::IsObjectInFixedHeap(Object *pObj)
{
// For now we simply look at the size of the object to determine if it in the
// fixed heap or not. If the bit indicating this gets set at some point
@@ -34113,10 +34106,11 @@ int StressRNG(int iMaxValue)
// free up object so that things will move and then do a GC
//return TRUE if GC actually happens, otherwise FALSE
-BOOL GCHeap::StressHeap(gc_alloc_context * context)
+bool GCHeap::StressHeap(gc_alloc_context * context)
{
#if defined(STRESS_HEAP) && !defined(FEATURE_REDHAWK)
alloc_context* acontext = static_cast<alloc_context*>(context);
+ assert(context != nullptr);
// if GC stress was dynamically disabled during this run we return FALSE
if (!GCStressPolicy::IsEnabled())
@@ -34198,9 +34192,6 @@ BOOL GCHeap::StressHeap(gc_alloc_context * context)
#ifndef MULTIPLE_HEAPS
static int32_t OneAtATime = -1;
- if (acontext == 0)
- acontext = generation_alloc_context (pGenGCHeap->generation_of(0));
-
// Only bother with this if the stress level is big enough and if nobody else is
// doing it right now. Note that some callers are inside the AllocLock and are
// guaranteed synchronized. But others are using AllocationContexts and have no
@@ -34216,11 +34207,11 @@ BOOL GCHeap::StressHeap(gc_alloc_context * context)
StringObject* str;
// If the current string is used up
- if (ObjectFromHandle(m_StressObjs[m_CurStressObj]) == 0)
+ if (HndFetchHandle(m_StressObjs[m_CurStressObj]) == 0)
{
// Populate handles with strings
int i = m_CurStressObj;
- while(ObjectFromHandle(m_StressObjs[i]) == 0)
+ while(HndFetchHandle(m_StressObjs[i]) == 0)
{
_ASSERTE(m_StressObjs[i] != 0);
unsigned strLen = (LARGE_OBJECT_SIZE - 32) / sizeof(WCHAR);
@@ -34252,7 +34243,7 @@ BOOL GCHeap::StressHeap(gc_alloc_context * context)
}
// Get the current string
- str = (StringObject*) OBJECTREFToObject(ObjectFromHandle(m_StressObjs[m_CurStressObj]));
+ str = (StringObject*) OBJECTREFToObject(HndFetchHandle(m_StressObjs[m_CurStressObj]));
if (str)
{
// Chop off the end of the string and form a new object out of it.
@@ -34323,122 +34314,7 @@ BOOL GCHeap::StressHeap(gc_alloc_context * context)
// Small Object Allocator
//
//
-Object *
-GCHeap::Alloc( size_t size, uint32_t flags REQD_ALIGN_DCL)
-{
- CONTRACTL {
- NOTHROW;
- GC_TRIGGERS;
- } CONTRACTL_END;
-
- TRIGGERSGC();
-
- Object* newAlloc = NULL;
-
-#ifdef TRACE_GC
-#ifdef COUNT_CYCLES
- AllocStart = GetCycleCount32();
- unsigned finish;
-#elif defined(ENABLE_INSTRUMENTATION)
- unsigned AllocStart = GetInstLogTime();
- unsigned finish;
-#endif //COUNT_CYCLES
-#endif //TRACE_GC
-
-#ifdef MULTIPLE_HEAPS
- //take the first heap....
- gc_heap* hp = gc_heap::g_heaps[0];
-#else
- gc_heap* hp = pGenGCHeap;
-#ifdef _PREFAST_
- // prefix complains about us dereferencing hp in wks build even though we only access static members
- // this way. not sure how to shut it up except for this ugly workaround:
- PREFIX_ASSUME(hp != NULL);
-#endif //_PREFAST_
-#endif //MULTIPLE_HEAPS
-
- {
- AllocLockHolder lh;
-
-#ifndef FEATURE_REDHAWK
- GCStress<gc_on_alloc>::MaybeTrigger(generation_alloc_context(hp->generation_of(0)));
-#endif // FEATURE_REDHAWK
-
- alloc_context* acontext = 0;
-
- if (size < LARGE_OBJECT_SIZE)
- {
- acontext = generation_alloc_context (hp->generation_of (0));
-
-#ifdef TRACE_GC
- AllocSmallCount++;
-#endif //TRACE_GC
- newAlloc = (Object*) hp->allocate (size + ComputeMaxStructAlignPad(requiredAlignment), acontext);
-#ifdef FEATURE_STRUCTALIGN
- newAlloc = (Object*) hp->pad_for_alignment ((uint8_t*) newAlloc, requiredAlignment, size, acontext);
-#endif // FEATURE_STRUCTALIGN
- // ASSERT (newAlloc);
- }
- else
- {
- acontext = generation_alloc_context (hp->generation_of (max_generation+1));
-
- newAlloc = (Object*) hp->allocate_large_object (size + ComputeMaxStructAlignPadLarge(requiredAlignment), acontext->alloc_bytes_loh);
-#ifdef FEATURE_STRUCTALIGN
- newAlloc = (Object*) hp->pad_for_alignment_large ((uint8_t*) newAlloc, requiredAlignment, size);
-#endif // FEATURE_STRUCTALIGN
- }
- }
-
- CHECK_ALLOC_AND_POSSIBLY_REGISTER_FOR_FINALIZATION(newAlloc, size, flags & GC_ALLOC_FINALIZE);
-
-#ifdef TRACE_GC
-#ifdef COUNT_CYCLES
- finish = GetCycleCount32();
-#elif defined(ENABLE_INSTRUMENTATION)
- finish = GetInstLogTime();
-#endif //COUNT_CYCLES
- AllocDuration += finish - AllocStart;
- AllocCount++;
-#endif //TRACE_GC
- return newAlloc;
-}
-
-// Allocate small object with an alignment requirement of 8-bytes. Non allocation context version.
-Object *
-GCHeap::AllocAlign8( size_t size, uint32_t flags)
-{
-#ifdef FEATURE_64BIT_ALIGNMENT
- CONTRACTL {
- NOTHROW;
- GC_TRIGGERS;
- } CONTRACTL_END;
-
- Object* newAlloc = NULL;
-
- {
- AllocLockHolder lh;
-
-#ifdef MULTIPLE_HEAPS
- //take the first heap....
- gc_heap* hp = gc_heap::g_heaps[0];
-#else
- gc_heap* hp = pGenGCHeap;
-#endif //MULTIPLE_HEAPS
-
- newAlloc = AllocAlign8Common(hp, generation_alloc_context (hp->generation_of (0)), size, flags);
- }
-
- return newAlloc;
-#else
- UNREFERENCED_PARAMETER(size);
- UNREFERENCED_PARAMETER(flags);
- assert(!"should not call GCHeap::AllocAlign8 without FEATURE_64BIT_ALIGNMENT defined!");
- return nullptr;
-#endif //FEATURE_64BIT_ALIGNMENT
-}
-
-// Allocate small object with an alignment requirement of 8-bytes. Allocation context version.
+// Allocate small object with an alignment requirement of 8-bytes.
Object*
GCHeap::AllocAlign8(gc_alloc_context* ctx, size_t size, uint32_t flags )
{
@@ -34627,10 +34503,6 @@ GCHeap::AllocLHeap( size_t size, uint32_t flags REQD_ALIGN_DCL)
#endif //_PREFAST_
#endif //MULTIPLE_HEAPS
-#ifndef FEATURE_REDHAWK
- GCStress<gc_on_alloc>::MaybeTrigger(generation_alloc_context(hp->generation_of(0)));
-#endif // FEATURE_REDHAWK
-
alloc_context* acontext = generation_alloc_context (hp->generation_of (max_generation+1));
newAlloc = (Object*) hp->allocate_large_object (size + ComputeMaxStructAlignPadLarge(requiredAlignment), acontext->alloc_bytes_loh);
@@ -34732,7 +34604,7 @@ GCHeap::Alloc(gc_alloc_context* context, size_t size, uint32_t flags REQD_ALIGN_
}
void
-GCHeap::FixAllocContext (gc_alloc_context* context, BOOL lockp, void* arg, void *heap)
+GCHeap::FixAllocContext (gc_alloc_context* context, bool lockp, void* arg, void *heap)
{
alloc_context* acontext = static_cast<alloc_context*>(context);
#ifdef MULTIPLE_HEAPS
@@ -34768,14 +34640,18 @@ GCHeap::FixAllocContext (gc_alloc_context* context, BOOL lockp, void* arg, void
}
Object*
-GCHeap::GetContainingObject (void *pInteriorPtr)
+GCHeap::GetContainingObject (void *pInteriorPtr, bool fCollectedGenOnly)
{
uint8_t *o = (uint8_t*)pInteriorPtr;
gc_heap* hp = gc_heap::heap_of (o);
- if (o >= hp->lowest_address && o < hp->highest_address)
+
+ uint8_t* lowest = (fCollectedGenOnly ? hp->gc_low : hp->lowest_address);
+ uint8_t* highest = (fCollectedGenOnly ? hp->gc_high : hp->highest_address);
+
+ if (o >= lowest && o < highest)
{
- o = hp->find_object (o, hp->gc_low);
+ o = hp->find_object (o, lowest);
}
else
{
@@ -34806,7 +34682,7 @@ BOOL should_collect_optimized (dynamic_data* dd, BOOL low_memory_p)
// API to ensure that a complete new garbage collection takes place
//
HRESULT
-GCHeap::GarbageCollect (int generation, BOOL low_memory_p, int mode)
+GCHeap::GarbageCollect (int generation, bool low_memory_p, int mode)
{
#if defined(BIT64)
if (low_memory_p)
@@ -35637,7 +35513,7 @@ void GCHeap::SetLOHCompactionMode (int newLOHCompactionyMode)
#endif //FEATURE_LOH_COMPACTION
}
-BOOL GCHeap::RegisterForFullGCNotification(uint32_t gen2Percentage,
+bool GCHeap::RegisterForFullGCNotification(uint32_t gen2Percentage,
uint32_t lohPercentage)
{
#ifdef MULTIPLE_HEAPS
@@ -35660,7 +35536,7 @@ BOOL GCHeap::RegisterForFullGCNotification(uint32_t gen2Percentage,
return TRUE;
}
-BOOL GCHeap::CancelFullGCNotification()
+bool GCHeap::CancelFullGCNotification()
{
pGenGCHeap->fgn_maxgen_percent = 0;
pGenGCHeap->fgn_loh_percent = 0;
@@ -35687,9 +35563,9 @@ int GCHeap::WaitForFullGCComplete(int millisecondsTimeout)
return result;
}
-int GCHeap::StartNoGCRegion(uint64_t totalSize, BOOL lohSizeKnown, uint64_t lohSize, BOOL disallowFullBlockingGC)
+int GCHeap::StartNoGCRegion(uint64_t totalSize, bool lohSizeKnown, uint64_t lohSize, bool disallowFullBlockingGC)
{
- AllocLockHolder lh;
+ NoGCRegionLockHolder lh;
dprintf (1, ("begin no gc called"));
start_no_gc_region_status status = gc_heap::prepare_for_no_gc_region (totalSize, lohSizeKnown, lohSize, disallowFullBlockingGC);
@@ -35707,7 +35583,7 @@ int GCHeap::StartNoGCRegion(uint64_t totalSize, BOOL lohSizeKnown, uint64_t lohS
int GCHeap::EndNoGCRegion()
{
- AllocLockHolder lh;
+ NoGCRegionLockHolder lh;
return (int)gc_heap::end_no_gc_region();
}
@@ -35765,7 +35641,7 @@ HRESULT GCHeap::GetGcCounters(int gen, gc_counters* counters)
}
// Get the segment size to use, making sure it conforms.
-size_t GCHeap::GetValidSegmentSize(BOOL large_seg)
+size_t GCHeap::GetValidSegmentSize(bool large_seg)
{
return get_valid_segment_size (large_seg);
}
@@ -35889,15 +35765,15 @@ size_t GCHeap::GetFinalizablePromotedCount()
#endif //MULTIPLE_HEAPS
}
-BOOL GCHeap::FinalizeAppDomain(AppDomain *pDomain, BOOL fRunFinalizers)
+bool GCHeap::FinalizeAppDomain(AppDomain *pDomain, bool fRunFinalizers)
{
#ifdef MULTIPLE_HEAPS
- BOOL foundp = FALSE;
+ bool foundp = false;
for (int hn = 0; hn < gc_heap::n_heaps; hn++)
{
gc_heap* hp = gc_heap::g_heaps [hn];
if (hp->finalize_queue->FinalizeAppDomain (pDomain, fRunFinalizers))
- foundp = TRUE;
+ foundp = true;
}
return foundp;
@@ -35906,13 +35782,13 @@ BOOL GCHeap::FinalizeAppDomain(AppDomain *pDomain, BOOL fRunFinalizers)
#endif //MULTIPLE_HEAPS
}
-BOOL GCHeap::ShouldRestartFinalizerWatchDog()
+bool GCHeap::ShouldRestartFinalizerWatchDog()
{
// This condition was historically used as part of the condition to detect finalizer thread timeouts
return gc_heap::gc_lock.lock != -1;
}
-void GCHeap::SetFinalizeQueueForShutdown(BOOL fHasLock)
+void GCHeap::SetFinalizeQueueForShutdown(bool fHasLock)
{
#ifdef MULTIPLE_HEAPS
for (int hn = 0; hn < gc_heap::n_heaps; hn++)
@@ -36226,43 +36102,15 @@ CFinalize::FinalizeSegForAppDomain (AppDomain *pDomain,
// if it has the index we are looking for. If the methodtable is null, it can't be from the
// unloading domain, so skip it.
if (method_table(obj) == NULL)
+ {
continue;
+ }
- // eagerly finalize all objects except those that may be agile.
- if (obj->GetAppDomainIndex() != pDomain->GetIndex())
+ // does the EE actually want us to finalize this object?
+ if (!GCToEEInterface::ShouldFinalizeObjectForUnload(pDomain, obj))
+ {
continue;
-
-#ifndef FEATURE_REDHAWK
- if (method_table(obj)->IsAgileAndFinalizable())
- {
- // If an object is both agile & finalizable, we leave it in the
- // finalization queue during unload. This is OK, since it's agile.
- // Right now only threads can be this way, so if that ever changes, change
- // the assert to just continue if not a thread.
- _ASSERTE(method_table(obj) == g_pThreadClass);
-
- if (method_table(obj) == g_pThreadClass)
- {
- // However, an unstarted thread should be finalized. It could be holding a delegate
- // in the domain we want to unload. Once the thread has been started, its
- // delegate is cleared so only unstarted threads are a problem.
- Thread *pThread = ((THREADBASEREF)ObjectToOBJECTREF(obj))->GetInternal();
- if (! pThread || ! pThread->IsUnstarted())
- {
- // This appdomain is going to be gone soon so let us assign
- // it the appdomain that's guaranteed to exist
- // The object is agile and the delegate should be null so we can do it
- obj->GetHeader()->ResetAppDomainIndexNoFailure(SystemDomain::System()->DefaultDomain()->GetIndex());
- continue;
- }
- }
- else
- {
- obj->GetHeader()->ResetAppDomainIndexNoFailure(SystemDomain::System()->DefaultDomain()->GetIndex());
- continue;
- }
}
-#endif //!FEATURE_REDHAWK
if (!fRunFinalizers || (obj->GetHeader()->GetBits()) & BIT_SBLK_FINALIZER_RUN)
{
@@ -36298,10 +36146,10 @@ CFinalize::FinalizeSegForAppDomain (AppDomain *pDomain,
return finalizedFound;
}
-BOOL
-CFinalize::FinalizeAppDomain (AppDomain *pDomain, BOOL fRunFinalizers)
+bool
+CFinalize::FinalizeAppDomain (AppDomain *pDomain, bool fRunFinalizers)
{
- BOOL finalizedFound = FALSE;
+ bool finalizedFound = false;
unsigned int startSeg = gen_segment (max_generation);
@@ -36311,7 +36159,7 @@ CFinalize::FinalizeAppDomain (AppDomain *pDomain, BOOL fRunFinalizers)
{
if (FinalizeSegForAppDomain (pDomain, fRunFinalizers, Seg))
{
- finalizedFound = TRUE;
+ finalizedFound = true;
}
}
@@ -36719,13 +36567,13 @@ void GCHeap::DiagWalkObject (Object* obj, walk_fn fn, void* context)
}
}
-void GCHeap::DiagWalkSurvivorsWithType (void* gc_context, record_surv_fn fn, size_t diag_context, walk_surv_type type)
+void GCHeap::DiagWalkSurvivorsWithType (void* gc_context, record_surv_fn fn, void* diag_context, walk_surv_type type)
{
gc_heap* hp = (gc_heap*)gc_context;
hp->walk_survivors (fn, diag_context, type);
}
-void GCHeap::DiagWalkHeap (walk_fn fn, void* context, int gen_number, BOOL walk_large_object_heap_p)
+void GCHeap::DiagWalkHeap (walk_fn fn, void* context, int gen_number, bool walk_large_object_heap_p)
{
gc_heap::walk_heap (fn, context, gen_number, walk_large_object_heap_p);
}
@@ -36869,7 +36717,7 @@ inline void testGCShadow(Object** ptr)
if (*ptr != 0 && (uint8_t*) shadow < g_GCShadowEnd && *ptr != *shadow)
{
- // If you get this assertion, someone updated a GC poitner in the heap without
+ // If you get this assertion, someone updated a GC pointer in the heap without
// using the write barrier. To find out who, check the value of
// dd_collection_count (dynamic_data_of (0)). Also
// note the value of 'ptr'. Rerun the App that the previous GC just occurred.
@@ -37045,7 +36893,7 @@ void GCHeap::TemporaryDisableConcurrentGC()
#endif //BACKGROUND_GC
}
-BOOL GCHeap::IsConcurrentGCEnabled()
+bool GCHeap::IsConcurrentGCEnabled()
{
#ifdef BACKGROUND_GC
return (gc_heap::gc_can_use_concurrent && !(gc_heap::temp_disable_concurrent_p));
@@ -37054,6 +36902,11 @@ BOOL GCHeap::IsConcurrentGCEnabled()
#endif //BACKGROUND_GC
}
+void GCHeap::SetFinalizeRunOnShutdown(bool value)
+{
+ g_fFinalizerRunOnShutDown = value;
+}
+
void PopulateDacVars(GcDacVars *gcDacVars)
{
#ifndef DACCESS_COMPILE
@@ -37065,10 +36918,7 @@ void PopulateDacVars(GcDacVars *gcDacVars)
gcDacVars->build_variant = &g_build_variant;
gcDacVars->gc_structures_invalid_cnt = const_cast<int32_t*>(&GCScan::m_GcStructuresInvalidCnt);
gcDacVars->generation_size = sizeof(generation);
-#ifdef FEATURE_SVR_GC
- gcDacVars->gc_heap_type = &IGCHeap::gcHeapType;
-#endif // FEATURE_SVR_GC
- gcDacVars->max_gen = &IGCHeap::maxGeneration;
+ gcDacVars->max_gen = &g_max_generation;
#ifndef MULTIPLE_HEAPS
gcDacVars->mark_array = &gc_heap::mark_array;
gcDacVars->ephemeral_heap_segment = reinterpret_cast<dac_heap_segment**>(&gc_heap::ephemeral_heap_segment);
@@ -37081,7 +36931,7 @@ void PopulateDacVars(GcDacVars *gcDacVars)
gcDacVars->next_sweep_obj = &gc_heap::next_sweep_obj;
gcDacVars->oom_info = &gc_heap::oom_info;
gcDacVars->finalize_queue = reinterpret_cast<dac_finalize_queue**>(&gc_heap::finalize_queue);
- gcDacVars->generation_table = reinterpret_cast<dac_generation**>(&generation_table);
+ gcDacVars->generation_table = reinterpret_cast<dac_generation**>(&gc_heap::generation_table);
#ifdef GC_CONFIG_DRIVEN
gcDacVars->gc_global_mechanisms = reinterpret_cast<size_t**>(&gc_global_mechanisms);
gcDacVars->interesting_data_per_heap = reinterpret_cast<size_t**>(&gc_heap::interesting_data_per_heap);
diff --git a/src/gc/gc.h b/src/gc/gc.h
index 046956600e..821b21ddb8 100644
--- a/src/gc/gc.h
+++ b/src/gc/gc.h
@@ -31,6 +31,11 @@ Module Name:
#ifdef FEATURE_STANDALONE_GC
#include "gcenv.ee.standalone.inl"
+
+// GCStress does not currently work with Standalone GC
+#ifdef STRESS_HEAP
+ #undef STRESS_HEAP
+#endif // STRESS_HEAP
#endif // FEATURE_STANDALONE_GC
/*
@@ -82,6 +87,7 @@ class IGCHeapInternal;
/* misc defines */
#define LARGE_OBJECT_SIZE ((size_t)(85000))
+#define max_generation 2
#ifdef GC_CONFIG_DRIVEN
#define MAX_GLOBAL_GC_MECHANISMS_COUNT 6
@@ -105,9 +111,10 @@ extern "C" uint32_t* g_gc_card_bundle_table;
extern "C" uint32_t* g_gc_card_table;
extern "C" uint8_t* g_gc_lowest_address;
extern "C" uint8_t* g_gc_highest_address;
-extern "C" bool g_fFinalizerRunOnShutDown;
-extern "C" bool g_built_with_svr_gc;
-extern "C" uint8_t g_build_variant;
+extern "C" GCHeapType g_gc_heap_type;
+extern "C" uint32_t g_max_generation;
+
+::IGCHandleTable* CreateGCHandleTable();
namespace WKS {
::IGCHeapInternal* CreateGCHeap();
@@ -215,32 +222,25 @@ public:
unsigned GetMaxGeneration()
{
- return IGCHeap::maxGeneration;
+ return max_generation;
}
- BOOL IsValidSegmentSize(size_t cbSize)
+ bool IsValidSegmentSize(size_t cbSize)
{
//Must be aligned on a Mb and greater than 4Mb
return (((cbSize & (1024*1024-1)) ==0) && (cbSize >> 22));
}
- BOOL IsValidGen0MaxSize(size_t cbSize)
+ bool IsValidGen0MaxSize(size_t cbSize)
{
return (cbSize >= 64*1024);
}
BOOL IsLargeObject(MethodTable *mt)
{
- WRAPPER_NO_CONTRACT;
-
return mt->GetBaseSize() >= LARGE_OBJECT_SIZE;
}
- void SetFinalizeRunOnShutdown(bool value)
- {
- g_fFinalizerRunOnShutDown = value;
- }
-
protected:
public:
#if defined(FEATURE_BASICFREEZE) && defined(VERIFY_HEAP)
@@ -265,21 +265,21 @@ extern void FinalizeWeakReference(Object * obj);
// The single GC heap instance, shared with the VM.
extern IGCHeapInternal* g_theGCHeap;
+// The single GC handle table instance, shared with the VM.
+extern IGCHandleTable* g_theGCHandleTable;
+
#ifndef DACCESS_COMPILE
-inline BOOL IsGCInProgress(bool bConsiderGCStart = FALSE)
+inline bool IsGCInProgress(bool bConsiderGCStart = false)
{
- WRAPPER_NO_CONTRACT;
-
return g_theGCHeap != nullptr ? g_theGCHeap->IsGCInProgressHelper(bConsiderGCStart) : false;
}
#endif // DACCESS_COMPILE
-inline BOOL IsServerHeap()
+inline bool IsServerHeap()
{
- LIMITED_METHOD_CONTRACT;
#ifdef FEATURE_SVR_GC
- _ASSERTE(IGCHeap::gcHeapType != IGCHeap::GC_HEAP_INVALID);
- return (IGCHeap::gcHeapType == IGCHeap::GC_HEAP_SVR);
+ assert(g_gc_heap_type != GC_HEAP_INVALID);
+ return g_gc_heap_type == GC_HEAP_SVR;
#else // FEATURE_SVR_GC
return false;
#endif // FEATURE_SVR_GC
diff --git a/src/gc/gccommon.cpp b/src/gc/gccommon.cpp
index 29c4b8d52a..1cd3c824ac 100644
--- a/src/gc/gccommon.cpp
+++ b/src/gc/gccommon.cpp
@@ -14,13 +14,8 @@
#include "gcenv.h"
#include "gc.h"
-#ifdef FEATURE_SVR_GC
-SVAL_IMPL_INIT(uint32_t,IGCHeap,gcHeapType,IGCHeap::GC_HEAP_INVALID);
-#endif // FEATURE_SVR_GC
-
-SVAL_IMPL_INIT(uint32_t,IGCHeap,maxGeneration,2);
-
IGCHeapInternal* g_theGCHeap;
+IGCHandleTable* g_theGCHandleTable;
#ifdef FEATURE_STANDALONE_GC
IGCToCLR* g_theGCToCLR;
@@ -46,23 +41,8 @@ uint32_t* g_gc_card_bundle_table;
uint8_t* g_gc_lowest_address = 0;
uint8_t* g_gc_highest_address = 0;
-bool g_fFinalizerRunOnShutDown = false;
-
-#ifdef FEATURE_SVR_GC
-bool g_built_with_svr_gc = true;
-#else
-bool g_built_with_svr_gc = false;
-#endif // FEATURE_SVR_GC
-
-#if defined(BUILDENV_DEBUG)
-uint8_t g_build_variant = 0;
-#elif defined(BUILDENV_CHECKED)
-uint8_t g_build_variant = 1;
-#else
-uint8_t g_build_variant = 2;
-#endif // defined(BUILDENV_DEBUG)
-
-VOLATILE(int32_t) m_GCLock = -1;
+GCHeapType g_gc_heap_type = GC_HEAP_INVALID;
+uint32_t g_max_generation = max_generation;
#ifdef GC_CONFIG_DRIVEN
void record_global_mechanism (int mech_index)
@@ -138,9 +118,9 @@ void InitializeHeapType(bool bServerHeap)
{
LIMITED_METHOD_CONTRACT;
#ifdef FEATURE_SVR_GC
- IGCHeap::gcHeapType = bServerHeap ? IGCHeap::GC_HEAP_SVR : IGCHeap::GC_HEAP_WKS;
+ g_gc_heap_type = bServerHeap ? GC_HEAP_SVR : GC_HEAP_WKS;
#ifdef WRITE_BARRIER_CHECK
- if (IGCHeap::gcHeapType == IGCHeap::GC_HEAP_SVR)
+ if (g_gc_heap_type == GC_HEAP_SVR)
{
g_GCShadow = 0;
g_GCShadowEnd = 0;
@@ -162,7 +142,7 @@ namespace SVR
extern void PopulateDacVars(GcDacVars* dacVars);
}
-bool InitializeGarbageCollector(IGCToCLR* clrToGC, IGCHeap** gcHeap, GcDacVars* gcDacVars)
+bool InitializeGarbageCollector(IGCToCLR* clrToGC, IGCHeap** gcHeap, IGCHandleTable** gcHandleTable, GcDacVars* gcDacVars)
{
LIMITED_METHOD_CONTRACT;
@@ -170,10 +150,18 @@ bool InitializeGarbageCollector(IGCToCLR* clrToGC, IGCHeap** gcHeap, GcDacVars*
assert(gcDacVars != nullptr);
assert(gcHeap != nullptr);
+ assert(gcHandleTable != nullptr);
+
+ IGCHandleTable* handleTable = CreateGCHandleTable();
+ if (handleTable == nullptr)
+ {
+ return false;
+ }
+
#ifdef FEATURE_SVR_GC
- assert(IGCHeap::gcHeapType != IGCHeap::GC_HEAP_INVALID);
+ assert(g_gc_heap_type != GC_HEAP_INVALID);
- if (IGCHeap::gcHeapType == IGCHeap::GC_HEAP_SVR)
+ if (g_gc_heap_type == GC_HEAP_SVR)
{
heap = SVR::CreateGCHeap();
SVR::PopulateDacVars(gcDacVars);
@@ -186,7 +174,6 @@ bool InitializeGarbageCollector(IGCToCLR* clrToGC, IGCHeap** gcHeap, GcDacVars*
#else
heap = WKS::CreateGCHeap();
WKS::PopulateDacVars(gcDacVars);
-
#endif
if (heap == nullptr)
@@ -204,6 +191,7 @@ bool InitializeGarbageCollector(IGCToCLR* clrToGC, IGCHeap** gcHeap, GcDacVars*
assert(clrToGC == nullptr);
#endif
+ *gcHandleTable = handleTable;
*gcHeap = heap;
return true;
}
diff --git a/src/gc/gcee.cpp b/src/gc/gcee.cpp
index c93cc91b57..a736a596e7 100644
--- a/src/gc/gcee.cpp
+++ b/src/gc/gcee.cpp
@@ -381,12 +381,12 @@ size_t GCHeap::GetNow()
return GetHighPrecisionTimeStamp();
}
-BOOL GCHeap::IsGCInProgressHelper (BOOL bConsiderGCStart)
+bool GCHeap::IsGCInProgressHelper (bool bConsiderGCStart)
{
return GcInProgress || (bConsiderGCStart? VolatileLoad(&gc_heap::gc_started) : FALSE);
}
-uint32_t GCHeap::WaitUntilGCComplete(BOOL bConsiderGCStart)
+uint32_t GCHeap::WaitUntilGCComplete(bool bConsiderGCStart)
{
if (bConsiderGCStart)
{
@@ -427,7 +427,7 @@ BlockAgain:
return dwWaitResult;
}
-void GCHeap::SetGCInProgress(BOOL fInProgress)
+void GCHeap::SetGCInProgress(bool fInProgress)
{
GcInProgress = fInProgress;
}
@@ -445,12 +445,12 @@ void GCHeap::WaitUntilConcurrentGCComplete()
#endif //BACKGROUND_GC
}
-BOOL GCHeap::IsConcurrentGCInProgress()
+bool GCHeap::IsConcurrentGCInProgress()
{
#ifdef BACKGROUND_GC
- return pGenGCHeap->settings.concurrent;
+ return !!pGenGCHeap->settings.concurrent;
#else
- return FALSE;
+ return false;
#endif //BACKGROUND_GC
}
@@ -681,6 +681,11 @@ void GCHeap::UnregisterFrozenSegment(segment_handle seg)
#endif // FEATURE_BASICFREEZE
}
+bool GCHeap::RuntimeStructuresValid()
+{
+ return GCScan::GetGcRuntimeStructuresValid();
+}
+
#endif // !DACCESS_COMPILE
diff --git a/src/gc/gceesvr.cpp b/src/gc/gceesvr.cpp
index aacae486f5..2e6dbe2d08 100644
--- a/src/gc/gceesvr.cpp
+++ b/src/gc/gceesvr.cpp
@@ -12,9 +12,11 @@
#include "gc.h"
#include "gcscan.h"
+#include "gchandletableimpl.h"
#define SERVER_GC 1
+
namespace SVR {
#include "gcimpl.h"
#include "gcee.cpp"
diff --git a/src/gc/gceewks.cpp b/src/gc/gceewks.cpp
index 72a7d3bdb9..f23038f012 100644
--- a/src/gc/gceewks.cpp
+++ b/src/gc/gceewks.cpp
@@ -10,6 +10,7 @@
#include "gc.h"
#include "gcscan.h"
+#include "gchandletableimpl.h"
#ifdef SERVER_GC
#undef SERVER_GC
diff --git a/src/gc/gcenv.ee.standalone.inl b/src/gc/gcenv.ee.standalone.inl
index 31f3d1d8da..328acef056 100644
--- a/src/gc/gcenv.ee.standalone.inl
+++ b/src/gc/gcenv.ee.standalone.inl
@@ -207,6 +207,18 @@ ALWAYS_INLINE void GCToEEInterface::EnableFinalization(bool foundFinalizers)
g_theGCToCLR->EnableFinalization(foundFinalizers);
}
+ALWAYS_INLINE void GCToEEInterface::HandleFatalError(unsigned int exitCode)
+{
+ assert(g_theGCToCLR != nullptr);
+ g_theGCToCLR->HandleFatalError(exitCode);
+}
+
+ALWAYS_INLINE bool GCToEEInterface::ShouldFinalizeObjectForUnload(AppDomain* pDomain, Object* obj)
+{
+ assert(g_theGCToCLR != nullptr);
+ return g_theGCToCLR->ShouldFinalizeObjectForUnload(pDomain, obj);
+}
+
#undef ALWAYS_INLINE
#endif // __GCTOENV_EE_STANDALONE_INL__
diff --git a/src/gc/gchandletable.cpp b/src/gc/gchandletable.cpp
new file mode 100644
index 0000000000..f468bd300f
--- /dev/null
+++ b/src/gc/gchandletable.cpp
@@ -0,0 +1,34 @@
+// 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.
+//
+
+#include "common.h"
+#include "gcenv.h"
+#include "gchandletableimpl.h"
+#include "objecthandle.h"
+
+IGCHandleTable* CreateGCHandleTable()
+{
+ return new(nothrow) GCHandleTable();
+}
+
+bool GCHandleTable::Initialize()
+{
+ return Ref_Initialize();
+}
+
+void GCHandleTable::Shutdown()
+{
+ Ref_Shutdown();
+}
+
+void* GCHandleTable::GetHandleTableContext(void* handleTable)
+{
+ return (void*)((uintptr_t)::HndGetHandleTableADIndex((HHANDLETABLE)handleTable).m_dwIndex);
+}
+
+void* GCHandleTable::GetHandleTableForHandle(OBJECTHANDLE handle)
+{
+ return (void*)::HndGetHandleTable(handle);
+}
diff --git a/src/gc/gchandletableimpl.h b/src/gc/gchandletableimpl.h
new file mode 100644
index 0000000000..11fa163df7
--- /dev/null
+++ b/src/gc/gchandletableimpl.h
@@ -0,0 +1,22 @@
+// 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.
+
+#ifndef GCHANDLETABLE_H_
+#define GCHANDLETABLE_H_
+
+#include "gcinterface.h"
+
+class GCHandleTable : public IGCHandleTable
+{
+public:
+ virtual bool Initialize();
+
+ virtual void Shutdown();
+
+ virtual void* GetHandleTableContext(void* handleTable);
+
+ virtual void* GetHandleTableForHandle(OBJECTHANDLE handle);
+};
+
+#endif // GCHANDLETABLE_H_
diff --git a/src/gc/gcimpl.h b/src/gc/gcimpl.h
index cb91c4dc3e..2a51d477b0 100644
--- a/src/gc/gcimpl.h
+++ b/src/gc/gcimpl.h
@@ -39,6 +39,11 @@ void GCProfileWalkHeap();
class gc_heap;
class CFinalize;
+extern bool g_fFinalizerRunOnShutDown;
+extern bool g_built_with_svr_gc;
+extern uint8_t g_build_variant;
+extern VOLATILE(int32_t) g_no_gc_lock;
+
class GCHeap : public IGCHeapInternal
{
protected:
@@ -80,19 +85,19 @@ public:
void DiagTraceGCSegments ();
void PublishObject(uint8_t* obj);
- BOOL IsGCInProgressHelper (BOOL bConsiderGCStart = FALSE);
+ bool IsGCInProgressHelper (bool bConsiderGCStart = false);
+
+ uint32_t WaitUntilGCComplete (bool bConsiderGCStart = false);
- uint32_t WaitUntilGCComplete (BOOL bConsiderGCStart = FALSE);
+ void SetGCInProgress(bool fInProgress);
- void SetGCInProgress(BOOL fInProgress);
+ bool RuntimeStructuresValid();
CLREvent * GetWaitForGCEvent();
HRESULT Initialize ();
//flags can be GC_ALLOC_CONTAINS_REF GC_ALLOC_FINALIZE
- Object* Alloc (size_t size, uint32_t flags);
- Object* AllocAlign8 (size_t size, uint32_t flags);
Object* AllocAlign8 (gc_alloc_context* acontext, size_t size, uint32_t flags);
private:
Object* AllocAlign8Common (void* hp, alloc_context* acontext, size_t size, uint32_t flags);
@@ -101,9 +106,9 @@ public:
Object* Alloc (gc_alloc_context* acontext, size_t size, uint32_t flags);
void FixAllocContext (gc_alloc_context* acontext,
- BOOL lockp, void* arg, void *heap);
+ bool lockp, void* arg, void *heap);
- Object* GetContainingObject(void *pInteriorPtr);
+ Object* GetContainingObject(void *pInteriorPtr, bool fCollectedGenOnly);
#ifdef MULTIPLE_HEAPS
static void AssignHeap (alloc_context* acontext);
@@ -116,15 +121,15 @@ public:
void HideAllocContext(alloc_context*);
void RevealAllocContext(alloc_context*);
- BOOL IsObjectInFixedHeap(Object *pObj);
+ bool IsObjectInFixedHeap(Object *pObj);
- HRESULT GarbageCollect (int generation = -1, BOOL low_memory_p=FALSE, int mode=collection_blocking);
+ HRESULT GarbageCollect (int generation = -1, bool low_memory_p=false, int mode=collection_blocking);
////
// GC callback functions
// Check if an argument is promoted (ONLY CALL DURING
// THE PROMOTIONSGRANTED CALLBACK.)
- BOOL IsPromoted (Object *object);
+ bool IsPromoted (Object *object);
size_t GetPromotedBytes (int heap_index);
@@ -152,8 +157,8 @@ public:
//returns the generation number of an object (not valid during relocation)
unsigned WhichGeneration (Object* object);
// returns TRUE is the object is ephemeral
- BOOL IsEphemeral (Object* object);
- BOOL IsHeapPointer (void* object, BOOL small_heap_only = FALSE);
+ bool IsEphemeral (Object* object);
+ bool IsHeapPointer (void* object, bool small_heap_only = false);
void ValidateObjectMember (Object *obj);
@@ -168,13 +173,13 @@ public:
int GetLOHCompactionMode();
void SetLOHCompactionMode(int newLOHCompactionyMode);
- BOOL RegisterForFullGCNotification(uint32_t gen2Percentage,
+ bool RegisterForFullGCNotification(uint32_t gen2Percentage,
uint32_t lohPercentage);
- BOOL CancelFullGCNotification();
+ bool CancelFullGCNotification();
int WaitForFullGCApproach(int millisecondsTimeout);
int WaitForFullGCComplete(int millisecondsTimeout);
- int StartNoGCRegion(uint64_t totalSize, BOOL lohSizeKnown, uint64_t lohSize, BOOL disallowFullBlockingGC);
+ int StartNoGCRegion(uint64_t totalSize, bool lohSizeKnown, uint64_t lohSize, bool disallowFullBlockingGC);
int EndNoGCRegion();
unsigned GetGcCount();
@@ -184,7 +189,7 @@ public:
PER_HEAP_ISOLATED HRESULT GetGcCounters(int gen, gc_counters* counters);
- size_t GetValidSegmentSize(BOOL large_seg = FALSE);
+ size_t GetValidSegmentSize(bool large_seg = false);
static size_t GetValidGen0MaxSize(size_t seg_size);
@@ -194,11 +199,12 @@ public:
PER_HEAP_ISOLATED size_t GetNumberFinalizableObjects();
PER_HEAP_ISOLATED size_t GetFinalizablePromotedCount();
- void SetFinalizeQueueForShutdown(BOOL fHasLock);
- BOOL FinalizeAppDomain(AppDomain *pDomain, BOOL fRunFinalizers);
- BOOL ShouldRestartFinalizerWatchDog();
+ void SetFinalizeQueueForShutdown(bool fHasLock);
+ bool FinalizeAppDomain(AppDomain *pDomain, bool fRunFinalizers);
+ bool ShouldRestartFinalizerWatchDog();
void DiagWalkObject (Object* obj, walk_fn fn, void* context);
+ void SetFinalizeRunOnShutdown(bool value);
public: // FIX
@@ -229,12 +235,12 @@ public: // FIX
#ifndef DACCESS_COMPILE
HRESULT WaitUntilConcurrentGCCompleteAsync(int millisecondsTimeout); // Use in native threads. TRUE if succeed. FALSE if failed or timeout
#endif
- BOOL IsConcurrentGCInProgress();
+ bool IsConcurrentGCInProgress();
// Enable/disable concurrent GC
void TemporaryEnableConcurrentGC();
void TemporaryDisableConcurrentGC();
- BOOL IsConcurrentGCEnabled();
+ bool IsConcurrentGCEnabled();
PER_HEAP_ISOLATED CLREvent *WaitForGCEvent; // used for syncing w/GC
@@ -253,7 +259,7 @@ private:
}
public:
//return TRUE if GC actually happens, otherwise FALSE
- BOOL StressHeap(gc_alloc_context * acontext = 0);
+ bool StressHeap(gc_alloc_context * acontext);
#ifndef FEATURE_REDHAWK // Redhawk forces relocation a different way
#ifdef STRESS_HEAP
@@ -273,7 +279,7 @@ protected:
virtual void DiagDescrGenerations (gen_walk_fn fn, void *context);
- virtual void DiagWalkSurvivorsWithType (void* gc_context, record_surv_fn fn, size_t diag_context, walk_surv_type type);
+ virtual void DiagWalkSurvivorsWithType (void* gc_context, record_surv_fn fn, void* diag_context, walk_surv_type type);
virtual void DiagWalkFinalizeQueue (void* gc_context, fq_walk_fn fn);
@@ -283,7 +289,7 @@ protected:
virtual void DiagScanDependentHandles (handle_scan_fn fn, int gen_number, ScanContext* context);
- virtual void DiagWalkHeap(walk_fn fn, void* context, int gen_number, BOOL walk_large_object_heap_p);
+ virtual void DiagWalkHeap(walk_fn fn, void* context, int gen_number, bool walk_large_object_heap_p);
public:
Object * NextObj (Object * object);
diff --git a/src/gc/gcinterface.dac.h b/src/gc/gcinterface.dac.h
index 84c8ffb36a..647101fa1f 100644
--- a/src/gc/gcinterface.dac.h
+++ b/src/gc/gcinterface.dac.h
@@ -18,12 +18,6 @@
#define MAX_GLOBAL_GC_MECHANISMS_COUNT 6
#define NUMBERGENERATIONS 4
-// TODO(segilles) - Implement this scheme for Server GC
-namespace SVR {
- class heap_segment;
- class gc_heap;
-}
-
// Analogue for the GC heap_segment class, containing information regarding a single
// heap segment.
class dac_heap_segment {
diff --git a/src/gc/gcinterface.dacvars.def b/src/gc/gcinterface.dacvars.def
index f9c2078ee3..b788079dcb 100644
--- a/src/gc/gcinterface.dacvars.def
+++ b/src/gc/gcinterface.dacvars.def
@@ -38,7 +38,6 @@ GC_DAC_VAR (uint8_t, build_variant)
GC_DAC_VAR (bool, built_with_svr)
GC_DAC_ARRAY_VAR (size_t, gc_global_mechanisms)
GC_DAC_ARRAY_VAR (dac_generation, generation_table)
-GC_DAC_VAR (uint32_t, gc_heap_type)
GC_DAC_VAR (uint32_t, max_gen)
GC_DAC_PTR_VAR (uint32_t, mark_array)
GC_DAC_VAR (c_gc_state, current_c_gc_state)
diff --git a/src/gc/gcinterface.ee.h b/src/gc/gcinterface.ee.h
index 7c0eea2d95..5c595b417f 100644
--- a/src/gc/gcinterface.ee.h
+++ b/src/gc/gcinterface.ee.h
@@ -133,6 +133,15 @@ public:
// be finalized.
virtual
void EnableFinalization(bool foundFinalizers) = 0;
+
+ // Signals to the EE that the GC encountered a fatal error and can't recover.
+ virtual
+ void HandleFatalError(unsigned int exitCode) = 0;
+
+ // Asks the EE if it wants a particular object to be finalized when unloading
+ // an app domain.
+ virtual
+ bool ShouldFinalizeObjectForUnload(AppDomain* pDomain, Object* obj) = 0;
};
#endif // _GCINTERFACE_EE_H_
diff --git a/src/gc/gcinterface.h b/src/gc/gcinterface.h
index 9f88d7bddd..66d8b31a53 100644
--- a/src/gc/gcinterface.h
+++ b/src/gc/gcinterface.h
@@ -149,7 +149,7 @@ struct segment_info
void * pvMem; // base of the allocation, not the first object (must add ibFirstObject)
size_t ibFirstObject; // offset to the base of the first object in the segment
size_t ibAllocated; // limit of allocated memory in the segment (>= firstobject)
- size_t ibCommit; // limit of committed memory in the segment (>= alllocated)
+ size_t ibCommit; // limit of committed memory in the segment (>= allocated)
size_t ibReserved; // limit of reserved memory in the segment (>= commit)
};
@@ -163,19 +163,18 @@ struct segment_info
// one for the object header, and one for the first field in the object.
#define min_obj_size ((sizeof(uint8_t*) + sizeof(uintptr_t) + sizeof(size_t)))
-#define max_generation 2
-
// The bit shift used to convert a memory address into an index into the
// Software Write Watch table.
#define SOFTWARE_WRITE_WATCH_AddressToTableByteIndexShift 0xc
class Object;
class IGCHeap;
+class IGCHandleTable;
// Initializes the garbage collector. Should only be called
// once, during EE startup. Returns true if the initialization
// was successful, false otherwise.
-bool InitializeGarbageCollector(IGCToCLR* clrToGC, IGCHeap **gcHeap, GcDacVars* gcDacVars);
+bool InitializeGarbageCollector(IGCToCLR* clrToGC, IGCHeap** gcHeap, IGCHandleTable** gcHandleTable, GcDacVars* gcDacVars);
// The runtime needs to know whether we're using workstation or server GC
// long before the GCHeap is created. This function sets the type of
@@ -194,8 +193,6 @@ extern uint8_t* g_shadow_lowest_address;
// For low memory notification from host
extern int32_t g_bLowMemoryFromHost;
-extern VOLATILE(int32_t) m_GCLock;
-
// !!!!!!!!!!!!!!!!!!!!!!!
// make sure you change the def in bcl\system\gc.cs
// if you change this!
@@ -380,12 +377,30 @@ typedef enum
HNDTYPE_WEAK_WINRT = 9
} HandleType;
-typedef BOOL (* walk_fn)(Object*, void*);
+typedef enum
+{
+ GC_HEAP_INVALID = 0,
+ GC_HEAP_WKS = 1,
+ GC_HEAP_SVR = 2
+} GCHeapType;
+
+typedef bool (* walk_fn)(Object*, void*);
typedef void (* gen_walk_fn)(void* context, int generation, uint8_t* range_start, uint8_t* range_end, uint8_t* range_reserved);
-typedef void (* record_surv_fn)(uint8_t* begin, uint8_t* end, ptrdiff_t reloc, size_t context, BOOL compacting_p, BOOL bgc_p);
-typedef void (* fq_walk_fn)(BOOL, void*);
+typedef void (* record_surv_fn)(uint8_t* begin, uint8_t* end, ptrdiff_t reloc, void* context, bool compacting_p, bool bgc_p);
+typedef void (* fq_walk_fn)(bool, void*);
typedef void (* fq_scan_fn)(Object** ppObject, ScanContext *pSC, uint32_t dwFlags);
-typedef void (* handle_scan_fn)(Object** pRef, Object* pSec, uint32_t flags, ScanContext* context, BOOL isDependent);
+typedef void (* handle_scan_fn)(Object** pRef, Object* pSec, uint32_t flags, ScanContext* context, bool isDependent);
+class IGCHandleTable {
+public:
+
+ virtual bool Initialize() = 0;
+
+ virtual void Shutdown() = 0;
+
+ virtual void* GetHandleTableContext(void* handleTable) = 0;
+
+ virtual void* GetHandleTableForHandle(OBJECTHANDLE handle) = 0;
+};
// IGCHeap is the interface that the VM will use when interacting with the GC.
class IGCHeap {
@@ -400,13 +415,13 @@ public:
*/
// Returns whether or not the given size is a valid segment size.
- virtual BOOL IsValidSegmentSize(size_t size) = 0;
+ virtual bool IsValidSegmentSize(size_t size) = 0;
// Returns whether or not the given size is a valid gen 0 max size.
- virtual BOOL IsValidGen0MaxSize(size_t size) = 0;
+ virtual bool IsValidGen0MaxSize(size_t size) = 0;
// Gets a valid segment size.
- virtual size_t GetValidSegmentSize(BOOL large_seg = FALSE) = 0;
+ virtual size_t GetValidSegmentSize(bool large_seg = false) = 0;
// Sets the limit for reserved virtual memory.
virtual void SetReservedVMLimit(size_t vmlimit) = 0;
@@ -426,7 +441,7 @@ public:
virtual void WaitUntilConcurrentGCComplete() = 0;
// Returns true if a concurrent GC is in progress, false otherwise.
- virtual BOOL IsConcurrentGCInProgress() = 0;
+ virtual bool IsConcurrentGCInProgress() = 0;
// Temporarily enables concurrent GC, used during profiling.
virtual void TemporaryEnableConcurrentGC() = 0;
@@ -435,7 +450,7 @@ public:
virtual void TemporaryDisableConcurrentGC() = 0;
// Returns whether or not Concurrent GC is enabled.
- virtual BOOL IsConcurrentGCEnabled() = 0;
+ virtual bool IsConcurrentGCEnabled() = 0;
// Wait for a concurrent GC to complete if one is in progress, with the given timeout.
virtual HRESULT WaitUntilConcurrentGCCompleteAsync(int millisecondsTimeout) = 0; // Use in native threads. TRUE if succeed. FALSE if failed or timeout
@@ -449,17 +464,17 @@ public:
*/
// Finalizes an app domain by finalizing objects within that app domain.
- virtual BOOL FinalizeAppDomain(AppDomain* pDomain, BOOL fRunFinalizers) = 0;
+ virtual bool FinalizeAppDomain(AppDomain* pDomain, bool fRunFinalizers) = 0;
// Finalizes all registered objects for shutdown, even if they are still reachable.
- virtual void SetFinalizeQueueForShutdown(BOOL fHasLock) = 0;
+ virtual void SetFinalizeQueueForShutdown(bool fHasLock) = 0;
// Gets the number of finalizable objects.
virtual size_t GetNumberOfFinalizable() = 0;
// Traditionally used by the finalizer thread on shutdown to determine
// whether or not to time out. Returns true if the GC lock has not been taken.
- virtual BOOL ShouldRestartFinalizerWatchDog() = 0;
+ virtual bool ShouldRestartFinalizerWatchDog() = 0;
// Gets the next finalizable object.
virtual Object* GetNextFinalizable() = 0;
@@ -492,10 +507,10 @@ public:
// Registers for a full GC notification, raising a notification if the gen 2 or
// LOH object heap thresholds are exceeded.
- virtual BOOL RegisterForFullGCNotification(uint32_t gen2Percentage, uint32_t lohPercentage) = 0;
+ virtual bool RegisterForFullGCNotification(uint32_t gen2Percentage, uint32_t lohPercentage) = 0;
// Cancels a full GC notification that was requested by `RegisterForFullGCNotification`.
- virtual BOOL CancelFullGCNotification() = 0;
+ virtual bool CancelFullGCNotification() = 0;
// Returns the status of a registered notification for determining whether a blocking
// Gen 2 collection is about to be initiated, with the given timeout.
@@ -516,7 +531,7 @@ public:
// Begins a no-GC region, returning a code indicating whether entering the no-GC
// region was successful.
- virtual int StartNoGCRegion(uint64_t totalSize, BOOL lohSizeKnown, uint64_t lohSize, BOOL disallowFullBlockingGC) = 0;
+ virtual int StartNoGCRegion(uint64_t totalSize, bool lohSizeKnown, uint64_t lohSize, bool disallowFullBlockingGC) = 0;
// Exits a no-GC region.
virtual int EndNoGCRegion() = 0;
@@ -526,7 +541,7 @@ public:
// Forces a garbage collection of the given generation. Also used extensively
// throughout the VM.
- virtual HRESULT GarbageCollect(int generation = -1, BOOL low_memory_p = FALSE, int mode = collection_blocking) = 0;
+ virtual HRESULT GarbageCollect(int generation = -1, bool low_memory_p = false, int mode = collection_blocking) = 0;
// Gets the largest GC generation. Also used extensively throughout the VM.
virtual unsigned GetMaxGeneration() = 0;
@@ -548,16 +563,16 @@ public:
virtual HRESULT Initialize() = 0;
// Returns whether nor this GC was promoted by the last GC.
- virtual BOOL IsPromoted(Object* object) = 0;
+ virtual bool IsPromoted(Object* object) = 0;
// Returns true if this pointer points into a GC heap, false otherwise.
- virtual BOOL IsHeapPointer(void* object, BOOL small_heap_only = FALSE) = 0;
+ virtual bool IsHeapPointer(void* object, bool small_heap_only = false) = 0;
// Return the generation that has been condemned by the current GC.
virtual unsigned GetCondemnedGeneration() = 0;
// Returns whether or not a GC is in progress.
- virtual BOOL IsGCInProgressHelper(BOOL bConsiderGCStart = FALSE) = 0;
+ virtual bool IsGCInProgressHelper(bool bConsiderGCStart = false) = 0;
// Returns the number of GCs that have occured. Mainly used for
// sanity checks asserting that a GC has not occured.
@@ -568,20 +583,23 @@ public:
virtual bool IsThreadUsingAllocationContextHeap(gc_alloc_context* acontext, int thread_number) = 0;
// Returns whether or not this object resides in an ephemeral generation.
- virtual BOOL IsEphemeral(Object* object) = 0;
+ virtual bool IsEphemeral(Object* object) = 0;
// Blocks until a GC is complete, returning a code indicating the wait was successful.
- virtual uint32_t WaitUntilGCComplete(BOOL bConsiderGCStart = FALSE) = 0;
+ virtual uint32_t WaitUntilGCComplete(bool bConsiderGCStart = false) = 0;
// "Fixes" an allocation context by binding its allocation pointer to a
// location on the heap.
- virtual void FixAllocContext(gc_alloc_context* acontext, BOOL lockp, void* arg, void* heap) = 0;
+ virtual void FixAllocContext(gc_alloc_context* acontext, bool lockp, void* arg, void* heap) = 0;
// Gets the total survived size plus the total allocated bytes on the heap.
virtual size_t GetCurrentObjSize() = 0;
// Sets whether or not a GC is in progress.
- virtual void SetGCInProgress(BOOL fInProgress) = 0;
+ virtual void SetGCInProgress(bool fInProgress) = 0;
+
+ // Gets whether or not the GC runtime structures are in a valid state for heap traversal.
+ virtual bool RuntimeStructuresValid() = 0;
/*
============================================================================
@@ -610,21 +628,22 @@ public:
*/
// Allocates an object on the given allocation context with the given size and flags.
+ // It is the responsibility of the caller to ensure that the passed-in alloc context is
+ // owned by the thread that is calling this function. If using per-thread alloc contexts,
+ // no lock is needed; callers not using per-thread alloc contexts will need to acquire
+ // a lock to ensure that the calling thread has unique ownership over this alloc context;
virtual Object* Alloc(gc_alloc_context* acontext, size_t size, uint32_t flags) = 0;
- // Allocates an object on the default allocation context with the given size and flags.
- virtual Object* Alloc(size_t size, uint32_t flags) = 0;
-
// Allocates an object on the large object heap with the given size and flags.
virtual Object* AllocLHeap(size_t size, uint32_t flags) = 0;
- // Allocates an object on the default allocation context, aligned to 64 bits,
- // with the given size and flags.
- virtual Object* AllocAlign8 (size_t size, uint32_t flags) = 0;
-
// Allocates an object on the given allocation context, aligned to 64 bits,
// with the given size and flags.
- virtual Object* AllocAlign8 (gc_alloc_context* acontext, size_t size, uint32_t flags) = 0;
+ // It is the responsibility of the caller to ensure that the passed-in alloc context is
+ // owned by the thread that is calling this function. If using per-thread alloc contexts,
+ // no lock is needed; callers not using per-thread alloc contexts will need to acquire
+ // a lock to ensure that the calling thread has unique ownership over this alloc context.
+ virtual Object* AllocAlign8(gc_alloc_context* acontext, size_t size, uint32_t flags) = 0;
// This is for the allocator to indicate it's done allocating a large object during a
// background GC as the BGC threads also need to walk LOH.
@@ -640,7 +659,7 @@ public:
===========================================================================
*/
// Returns whether or not this object is in the fixed heap.
- virtual BOOL IsObjectInFixedHeap(Object* pObj) = 0;
+ virtual bool IsObjectInFixedHeap(Object* pObj) = 0;
// Walks an object and validates its members.
virtual void ValidateObjectMember(Object* obj) = 0;
@@ -652,7 +671,9 @@ public:
// Given an interior pointer, return a pointer to the object
// containing that pointer. This is safe to call only when the EE is suspended.
- virtual Object* GetContainingObject(void* pInteriorPtr) = 0;
+ // When fCollectedGenOnly is true, it only returns the object if it's found in
+ // the generation(s) that are being collected.
+ virtual Object* GetContainingObject(void* pInteriorPtr, bool fCollectedGenOnly) = 0;
/*
===========================================================================
@@ -665,10 +686,10 @@ public:
virtual void DiagWalkObject(Object* obj, walk_fn fn, void* context) = 0;
// Walk the heap object by object.
- virtual void DiagWalkHeap(walk_fn fn, void* context, int gen_number, BOOL walk_large_object_heap_p) = 0;
+ virtual void DiagWalkHeap(walk_fn fn, void* context, int gen_number, bool walk_large_object_heap_p) = 0;
// Walks the survivors and get the relocation information if objects have moved.
- virtual void DiagWalkSurvivorsWithType(void* gc_context, record_surv_fn fn, size_t diag_context, walk_surv_type type) = 0;
+ virtual void DiagWalkSurvivorsWithType(void* gc_context, record_surv_fn fn, void* diag_context, walk_surv_type type) = 0;
// Walks the finalization queue.
virtual void DiagWalkFinalizeQueue(void* gc_context, fq_walk_fn fn) = 0;
@@ -694,8 +715,9 @@ public:
===========================================================================
*/
- // Returns TRUE if GC actually happens, otherwise FALSE
- virtual BOOL StressHeap(gc_alloc_context* acontext = 0) = 0;
+ // Returns TRUE if GC actually happens, otherwise FALSE. The passed alloc context
+ // must not be null.
+ virtual bool StressHeap(gc_alloc_context* acontext) = 0;
/*
===========================================================================
@@ -712,19 +734,6 @@ public:
IGCHeap() {}
virtual ~IGCHeap() {}
-
- typedef enum
- {
- GC_HEAP_INVALID = 0,
- GC_HEAP_WKS = 1,
- GC_HEAP_SVR = 2
- } GC_HEAP_TYPE;
-
-#ifdef FEATURE_SVR_GC
- SVAL_DECL(uint32_t, gcHeapType);
-#endif
-
- SVAL_DECL(uint32_t, maxGeneration);
};
#ifdef WRITE_BARRIER_CHECK
@@ -748,8 +757,8 @@ struct ScanContext
Thread* thread_under_crawl;
int thread_number;
uintptr_t stack_limit; // Lowest point on the thread stack that the scanning logic is permitted to read
- BOOL promotion; //TRUE: Promotion, FALSE: Relocation.
- BOOL concurrent; //TRUE: concurrent scanning
+ bool promotion; //TRUE: Promotion, FALSE: Relocation.
+ bool concurrent; //TRUE: concurrent scanning
#if CHECK_APP_DOMAIN_LEAKS || defined (FEATURE_APPDOMAIN_RESOURCE_MONITORING) || defined (DACCESS_COMPILE)
AppDomain *pCurrentDomain;
#endif //CHECK_APP_DOMAIN_LEAKS || FEATURE_APPDOMAIN_RESOURCE_MONITORING || DACCESS_COMPILE
@@ -770,8 +779,8 @@ struct ScanContext
thread_under_crawl = 0;
thread_number = -1;
stack_limit = 0;
- promotion = FALSE;
- concurrent = FALSE;
+ promotion = false;
+ concurrent = false;
#ifdef GC_PROFILING
pMD = NULL;
#endif //GC_PROFILING
diff --git a/src/gc/gcpriv.h b/src/gc/gcpriv.h
index d06902ca51..7bd6883271 100644
--- a/src/gc/gcpriv.h
+++ b/src/gc/gcpriv.h
@@ -1298,19 +1298,19 @@ protected:
uint8_t* last_plug;
BOOL is_shortened;
mark* pinned_plug_entry;
- size_t profiling_context;
+ void* profiling_context;
record_surv_fn fn;
};
PER_HEAP
- void walk_survivors (record_surv_fn fn, size_t context, walk_surv_type type);
+ void walk_survivors (record_surv_fn fn, void* context, walk_surv_type type);
PER_HEAP
void walk_plug (uint8_t* plug, size_t size, BOOL check_last_object_p,
walk_relocate_args* args);
PER_HEAP
- void walk_relocation (size_t profiling_context, record_surv_fn fn);
+ void walk_relocation (void* profiling_context, record_surv_fn fn);
PER_HEAP
void walk_relocation_in_brick (uint8_t* tree, walk_relocate_args* args);
@@ -1320,14 +1320,14 @@ protected:
#if defined(BACKGROUND_GC) && defined(FEATURE_EVENT_TRACE)
PER_HEAP
- void walk_survivors_for_bgc (size_t profiling_context, record_surv_fn fn);
+ void walk_survivors_for_bgc (void* profiling_context, record_surv_fn fn);
#endif // defined(BACKGROUND_GC) && defined(FEATURE_EVENT_TRACE)
// used in blocking GCs after plan phase so this walks the plugs.
PER_HEAP
- void walk_survivors_relocation (size_t profiling_context, record_surv_fn fn);
+ void walk_survivors_relocation (void* profiling_context, record_surv_fn fn);
PER_HEAP
- void walk_survivors_for_loh (size_t profiling_context, record_surv_fn fn);
+ void walk_survivors_for_loh (void* profiling_context, record_surv_fn fn);
PER_HEAP
int generation_to_condemn (int n,
@@ -2168,7 +2168,7 @@ protected:
void relocate_in_loh_compact();
PER_HEAP
- void walk_relocation_for_loh (size_t profiling_context, record_surv_fn fn);
+ void walk_relocation_for_loh (void* profiling_context, record_surv_fn fn);
PER_HEAP
BOOL loh_enque_pinned_plug (uint8_t* plug, size_t len);
@@ -2810,11 +2810,9 @@ public:
PER_HEAP
BOOL heap_analyze_success;
-#ifdef MULTIPLE_HEAPS
// The generation table. Must always be last.
PER_HEAP
generation generation_table [NUMBERGENERATIONS + 1];
-#endif // MULTIPLE_HEAPS
// End DAC zone
@@ -3769,7 +3767,7 @@ public:
void DiscardNonCriticalObjects();
//Methods used by the app domain unloading call to finalize objects in an app domain
- BOOL FinalizeAppDomain (AppDomain *pDomain, BOOL fRunFinalizers);
+ bool FinalizeAppDomain (AppDomain *pDomain, bool fRunFinalizers);
void CheckFinalizerObjects();
@@ -4173,12 +4171,11 @@ public:
size_t flags;
PTR_heap_segment next;
uint8_t* background_allocated;
- uint8_t* plan_allocated;
- uint8_t* saved_bg_allocated;
-
#ifdef MULTIPLE_HEAPS
gc_heap* heap;
#endif //MULTIPLE_HEAPS
+ uint8_t* plan_allocated;
+ uint8_t* saved_bg_allocated;
#ifdef _MSC_VER
// Disable this warning - we intentionally want __declspec(align()) to insert padding for us
@@ -4198,6 +4195,9 @@ static_assert(offsetof(dac_heap_segment, mem) == offsetof(heap_segment, mem), "D
static_assert(offsetof(dac_heap_segment, flags) == offsetof(heap_segment, flags), "DAC heap segment layout mismatch");
static_assert(offsetof(dac_heap_segment, next) == offsetof(heap_segment, next), "DAC heap segment layout mismatch");
static_assert(offsetof(dac_heap_segment, background_allocated) == offsetof(heap_segment, background_allocated), "DAC heap segment layout mismatch");
+#ifdef MULTIPLE_HEAPS
+static_assert(offsetof(dac_heap_segment, heap) == offsetof(heap_segment, heap), "DAC heap segment layout mismatch");
+#endif // MULTIPLE_HEAPS
inline
uint8_t*& heap_segment_reserved (heap_segment* inst)
@@ -4291,12 +4291,6 @@ gc_heap*& heap_segment_heap (heap_segment* inst)
}
#endif //MULTIPLE_HEAPS
-#ifndef MULTIPLE_HEAPS
-extern "C" {
- extern generation generation_table[NUMBERGENERATIONS + 1];
-}
-#endif // MULTIPLE_HEAPS
-
inline
generation* gc_heap::generation_of (int n)
{
diff --git a/src/gc/gcscan.cpp b/src/gc/gcscan.cpp
index b4e6352dd6..edcb533cd4 100644
--- a/src/gc/gcscan.cpp
+++ b/src/gc/gcscan.cpp
@@ -19,11 +19,7 @@
#include "gc.h"
#include "objecthandle.h"
-#ifdef DACCESS_COMPILE
-SVAL_IMPL_INIT(int32_t, GCScan, m_GcStructuresInvalidCnt, 1);
-#else //DACCESS_COMPILE
VOLATILE(int32_t) GCScan::m_GcStructuresInvalidCnt = 1;
-#endif //DACCESS_COMPILE
bool GCScan::GetGcRuntimeStructuresValid ()
{
@@ -33,18 +29,7 @@ bool GCScan::GetGcRuntimeStructuresValid ()
return (int32_t)m_GcStructuresInvalidCnt == 0;
}
-#ifdef DACCESS_COMPILE
-
-#ifndef FEATURE_REDHAWK
-void
-GCScan::EnumMemoryRegions(CLRDataEnumMemoryFlags flags)
-{
- UNREFERENCED_PARAMETER(flags);
- m_GcStructuresInvalidCnt.EnumMem();
-}
-#endif
-
-#else
+#ifndef DACCESS_COMPILE
//
// Dependent handle promotion scan support
diff --git a/src/gc/gcscan.h b/src/gc/gcscan.h
index c17f0ce006..c7060f3f51 100644
--- a/src/gc/gcscan.h
+++ b/src/gc/gcscan.h
@@ -89,18 +89,7 @@ class GCScan
static void VerifyHandleTable(int condemned, int max_gen, ScanContext* sc);
-#ifdef DACCESS_COMPILE
- SVAL_DECL(int32_t, m_GcStructuresInvalidCnt);
-#else
static VOLATILE(int32_t) m_GcStructuresInvalidCnt;
-#endif //DACCESS_COMPILE
};
-// These two functions are utilized to scan the heap if requested by ETW
-// or a profiler. The implementations of these two functions are in profheapwalkhelper.cpp.
-#if defined(FEATURE_EVENT_TRACE) | defined(GC_PROFILING)
-void ScanRootsHelper(Object* pObj, Object** ppRoot, ScanContext * pSC, DWORD dwFlags);
-BOOL HeapWalkHelper(Object * pBO, void * pvContext);
-#endif
-
#endif // _GCSCAN_H_
diff --git a/src/gc/handletable.h b/src/gc/handletable.h
index 2e847659f3..5b0299fe02 100644
--- a/src/gc/handletable.h
+++ b/src/gc/handletable.h
@@ -177,8 +177,11 @@ BOOL HndFirstAssignHandle(OBJECTHANDLE handle, OBJECTREF objref);
/*
* inline handle dereferencing
+ *
+ * NOTE: Changes to this implementation should be kept in sync with ObjectFromHandle
+ * on the VM side.
+ *
*/
-
FORCEINLINE OBJECTREF HndFetchHandle(OBJECTHANDLE handle)
{
WRAPPER_NO_CONTRACT;
diff --git a/src/gc/objecthandle.cpp b/src/gc/objecthandle.cpp
index e8eed93006..5f5ecbf556 100644
--- a/src/gc/objecthandle.cpp
+++ b/src/gc/objecthandle.cpp
@@ -441,13 +441,13 @@ void CALLBACK ScanPointerForProfilerAndETW(_UNCHECKED_OBJECTREF *pObjRef, uintpt
ScanContext *pSC = (ScanContext *)lp1;
uint32_t rootFlags = 0;
- BOOL isDependent = FALSE;
+ bool isDependent = false;
OBJECTHANDLE handle = (OBJECTHANDLE)(pRef);
switch (HandleFetchType(handle))
{
case HNDTYPE_DEPENDENT:
- isDependent = TRUE;
+ isDependent = true;
break;
case HNDTYPE_WEAK_SHORT:
case HNDTYPE_WEAK_LONG:
diff --git a/src/gc/objecthandle.h b/src/gc/objecthandle.h
index 9c885bbfc6..386c5d4512 100644
--- a/src/gc/objecthandle.h
+++ b/src/gc/objecthandle.h
@@ -27,7 +27,6 @@
* non-NULL. In other words, if this handle is being initialized for the first
* time.
*/
-#define ObjectFromHandle(handle) HndFetchHandle(handle)
#define StoreObjectInHandle(handle, object) HndAssignHandle(handle, object)
#define InterlockedCompareExchangeObjectInHandle(handle, object, oldObj) HndInterlockedCompareExchangeHandle(handle, object, oldObj)
#define StoreFirstObjectInHandle(handle, object) HndFirstAssignHandle(handle, object)
@@ -119,7 +118,7 @@ inline OBJECTHANDLE CreateDuplicateHandle(OBJECTHANDLE handle) {
WRAPPER_NO_CONTRACT;
// Create a new STRONG handle in the same table as an existing handle.
- return HndCreateHandle(HndGetHandleTable(handle), HNDTYPE_DEFAULT, ObjectFromHandle(handle));
+ return HndCreateHandle(HndGetHandleTable(handle), HNDTYPE_DEFAULT, HndFetchHandle(handle));
}
@@ -511,8 +510,6 @@ void Ref_ScanSizedRefHandles(uint32_t condemned, uint32_t maxgen, ScanContext* s
void Ref_ScanPointers(uint32_t condemned, uint32_t maxgen, ScanContext* sc, Ref_promote_func* fn);
#endif
-typedef void (* handle_scan_fn)(Object** pRef, Object* pSec, uint32_t flags, ScanContext* context, BOOL isDependent);
-
void Ref_CheckReachable (uint32_t uCondemnedGeneration, uint32_t uMaxGeneration, uintptr_t lp1);
void Ref_CheckAlive (uint32_t uCondemnedGeneration, uint32_t uMaxGeneration, uintptr_t lp1);
void Ref_ScanHandlesForProfilerAndETW(uint32_t uMaxGeneration, uintptr_t lp1, handle_scan_fn fn);
diff --git a/src/gc/sample/CMakeLists.txt b/src/gc/sample/CMakeLists.txt
index 29fd32f2ff..5fe7887963 100644
--- a/src/gc/sample/CMakeLists.txt
+++ b/src/gc/sample/CMakeLists.txt
@@ -10,6 +10,7 @@ set(SOURCES
gcenv.ee.cpp
../gccommon.cpp
../gceewks.cpp
+ ../gchandletable.cpp
../gcscan.cpp
../gcwks.cpp
../handletable.cpp
diff --git a/src/gc/sample/GCSample.cpp b/src/gc/sample/GCSample.cpp
index 2c32048bbb..45915c0d04 100644
--- a/src/gc/sample/GCSample.cpp
+++ b/src/gc/sample/GCSample.cpp
@@ -126,17 +126,12 @@ int __cdecl main(int argc, char* argv[])
g_pFreeObjectMethodTable = &freeObjectMT;
//
- // Initialize handle table
- //
- if (!Ref_Initialize())
- return -1;
-
- //
// Initialize GC heap
//
GcDacVars dacVars;
IGCHeap *pGCHeap;
- if (!InitializeGarbageCollector(nullptr, &pGCHeap, &dacVars))
+ IGCHandleTable *pGCHandleTable;
+ if (!InitializeGarbageCollector(nullptr, &pGCHeap, &pGCHandleTable, &dacVars))
{
return -1;
}
@@ -145,6 +140,12 @@ int __cdecl main(int argc, char* argv[])
return -1;
//
+ // Initialize handle table
+ //
+ if (!pGCHandleTable->Initialize())
+ return -1;
+
+ //
// Initialize current thread
//
ThreadStore::AttachCurrentThread();
@@ -206,24 +207,24 @@ int __cdecl main(int argc, char* argv[])
for (int i = 0; i < 1000000; i++)
{
- Object * pBefore = ((My *)ObjectFromHandle(oh))->m_pOther1;
+ Object * pBefore = ((My *)HndFetchHandle(oh))->m_pOther1;
// Allocate more instances of the same object
Object * p = AllocateObject(pMyMethodTable);
if (p == NULL)
return -1;
- Object * pAfter = ((My *)ObjectFromHandle(oh))->m_pOther1;
+ Object * pAfter = ((My *)HndFetchHandle(oh))->m_pOther1;
// Uncomment this assert to see how GC triggered inside AllocateObject moved objects around
// assert(pBefore == pAfter);
// Store the newly allocated object into a field using WriteBarrier
- WriteBarrier(&(((My *)ObjectFromHandle(oh))->m_pOther1), p);
+ WriteBarrier(&(((My *)HndFetchHandle(oh))->m_pOther1), p);
}
// Create weak handle that points to our object
- OBJECTHANDLE ohWeak = CreateGlobalWeakHandle(ObjectFromHandle(oh));
+ OBJECTHANDLE ohWeak = CreateGlobalWeakHandle(HndFetchHandle(oh));
if (ohWeak == NULL)
return -1;
@@ -234,7 +235,7 @@ int __cdecl main(int argc, char* argv[])
pGCHeap->GarbageCollect();
// Verify that the weak handle got cleared by the GC
- assert(ObjectFromHandle(ohWeak) == NULL);
+ assert(HndFetchHandle(ohWeak) == NULL);
printf("Done\n");
diff --git a/src/gc/sample/gcenv.ee.cpp b/src/gc/sample/gcenv.ee.cpp
index e95a78dc48..aaca51e8b8 100644
--- a/src/gc/sample/gcenv.ee.cpp
+++ b/src/gc/sample/gcenv.ee.cpp
@@ -15,6 +15,8 @@ int32_t g_TrapReturningThreads;
EEConfig * g_pConfig;
+gc_alloc_context g_global_alloc_context;
+
bool CLREventStatic::CreateManualEventNoThrow(bool bInitialState)
{
m_hEvent = CreateEventW(NULL, TRUE, bInitialState, NULL);
@@ -135,7 +137,7 @@ void ThreadStore::AttachCurrentThread()
void GCToEEInterface::SuspendEE(SUSPEND_REASON reason)
{
- g_theGCHeap->SetGCInProgress(TRUE);
+ g_theGCHeap->SetGCInProgress(true);
// TODO: Implement
}
@@ -144,7 +146,7 @@ void GCToEEInterface::RestartEE(bool bFinishedGC)
{
// TODO: Implement
- g_theGCHeap->SetGCInProgress(FALSE);
+ g_theGCHeap->SetGCInProgress(false);
}
void GCToEEInterface::GcScanRoots(promote_func* fn, int condemned, int max_gen, ScanContext* sc)
@@ -263,6 +265,16 @@ void GCToEEInterface::EnableFinalization(bool foundFinalizers)
// TODO: Implement for finalization
}
+void GCToEEInterface::HandleFatalError(unsigned int exitCode)
+{
+ abort();
+}
+
+bool GCToEEInterface::ShouldFinalizeObjectForUnload(AppDomain* pDomain, Object* obj)
+{
+ return true;
+}
+
bool IsGCSpecialThread()
{
// TODO: Implement for background GC
diff --git a/src/gc/unix/CMakeLists.txt b/src/gc/unix/CMakeLists.txt
index ef66abf32a..3e1aa5ad19 100644
--- a/src/gc/unix/CMakeLists.txt
+++ b/src/gc/unix/CMakeLists.txt
@@ -5,6 +5,7 @@ include_directories("../env")
include(configure.cmake)
set(GC_PAL_SOURCES
- gcenv.unix.cpp)
+ gcenv.unix.cpp
+ cgroup.cpp)
add_library(gc_unix STATIC ${GC_PAL_SOURCES} ${VERSION_FILE_PATH})
diff --git a/src/gc/unix/cgroup.cpp b/src/gc/unix/cgroup.cpp
new file mode 100644
index 0000000000..1775ef7ff0
--- /dev/null
+++ b/src/gc/unix/cgroup.cpp
@@ -0,0 +1,342 @@
+// 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.
+
+/*++
+
+Module Name:
+
+ cgroup.cpp
+
+Abstract:
+ Read memory limits for the current process
+--*/
+#include <cstdint>
+#include <cstddef>
+#include <cassert>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/resource.h>
+#include <errno.h>
+
+#define SIZE_T_MAX (~(size_t)0)
+#define PROC_MOUNTINFO_FILENAME "/proc/self/mountinfo"
+#define PROC_CGROUP_FILENAME "/proc/self/cgroup"
+#define PROC_STATM_FILENAME "/proc/self/statm"
+#define MEM_LIMIT_FILENAME "/memory.limit_in_bytes"
+
+class CGroup
+{
+ char* m_memory_cgroup_path;
+public:
+ CGroup()
+ {
+ m_memory_cgroup_path = nullptr;
+ char* memoryHierarchyMount = nullptr;
+ char *cgroup_path_relative_to_mount = nullptr;
+ size_t len;
+ memoryHierarchyMount = FindMemoryHierarchyMount();
+ if (memoryHierarchyMount == nullptr)
+ goto done;
+
+ cgroup_path_relative_to_mount = FindCGroupPathForMemorySubsystem();
+ if (cgroup_path_relative_to_mount == nullptr)
+ goto done;
+
+ len = strlen(memoryHierarchyMount);
+ len += strlen(cgroup_path_relative_to_mount);
+ m_memory_cgroup_path = (char*)malloc(len+1);
+ if (m_memory_cgroup_path == nullptr)
+ goto done;
+
+ strcpy(m_memory_cgroup_path, memoryHierarchyMount);
+ strcat(m_memory_cgroup_path, cgroup_path_relative_to_mount);
+
+ done:
+ free(memoryHierarchyMount);
+ free(cgroup_path_relative_to_mount);
+ }
+
+ ~CGroup()
+ {
+ free(m_memory_cgroup_path);
+ }
+
+ bool GetPhysicalMemoryLimit(size_t *val)
+ {
+ char *mem_limit_filename = nullptr;
+ bool result = false;
+
+ if (m_memory_cgroup_path == nullptr)
+ return result;
+
+ size_t len = strlen(m_memory_cgroup_path);
+ len += strlen(MEM_LIMIT_FILENAME);
+ mem_limit_filename = (char*)malloc(len+1);
+ if (mem_limit_filename == nullptr)
+ return result;
+
+ strcpy(mem_limit_filename, m_memory_cgroup_path);
+ strcat(mem_limit_filename, MEM_LIMIT_FILENAME);
+ result = ReadMemoryValueFromFile(mem_limit_filename, val);
+ free(mem_limit_filename);
+ return result;
+ }
+
+private:
+ char* FindMemoryHierarchyMount()
+ {
+ char *line = nullptr;
+ size_t lineLen = 0, maxLineLen = 0;
+ char *filesystemType = nullptr;
+ char *options = nullptr;
+ char* mountpath = nullptr;
+
+ FILE *mountinfofile = fopen(PROC_MOUNTINFO_FILENAME, "r");
+ if (mountinfofile == nullptr)
+ goto done;
+
+ while (getline(&line, &lineLen, mountinfofile) != -1)
+ {
+ if (filesystemType == nullptr || lineLen > maxLineLen)
+ {
+ free(filesystemType);
+ free(options);
+ filesystemType = (char*)malloc(lineLen+1);
+ if (filesystemType == nullptr)
+ goto done;
+ options = (char*)malloc(lineLen+1);
+ if (options == nullptr)
+ goto done;
+ maxLineLen = lineLen;
+ }
+
+ char* separatorChar = strchr(line, '-');
+
+ // See man page of proc to get format for /proc/self/mountinfo file
+ int sscanfRet = sscanf(separatorChar,
+ "- %s %*s %s",
+ filesystemType,
+ options);
+ if (sscanfRet != 2)
+ {
+ assert(!"Failed to parse mount info file contents with sscanf.");
+ goto done;
+ }
+
+ if (strncmp(filesystemType, "cgroup", 6) == 0)
+ {
+ char* context = nullptr;
+ char* strTok = strtok_r(options, ",", &context);
+ while (strTok != nullptr)
+ {
+ if (strncmp("memory", strTok, 6) == 0)
+ {
+ mountpath = (char*)malloc(lineLen+1);
+ if (mountpath == nullptr)
+ goto done;
+
+ sscanfRet = sscanf(line,
+ "%*s %*s %*s %*s %s ",
+ mountpath);
+ if (sscanfRet != 1)
+ {
+ free(mountpath);
+ mountpath = nullptr;
+ assert(!"Failed to parse mount info file contents with sscanf.");
+ }
+ goto done;
+ }
+ strTok = strtok_r(nullptr, ",", &context);
+ }
+ }
+ }
+ done:
+ free(filesystemType);
+ free(options);
+ free(line);
+ if (mountinfofile)
+ fclose(mountinfofile);
+ return mountpath;
+ }
+
+ char* FindCGroupPathForMemorySubsystem()
+ {
+ char *line = nullptr;
+ size_t lineLen = 0;
+ size_t maxLineLen = 0;
+ char *subsystem_list = nullptr;
+ char *cgroup_path = nullptr;
+ bool result = false;
+
+ FILE *cgroupfile = fopen(PROC_CGROUP_FILENAME, "r");
+ if (cgroupfile == nullptr)
+ goto done;
+
+ while (!result && getline(&line, &lineLen, cgroupfile) != -1)
+ {
+ if (subsystem_list == nullptr || lineLen > maxLineLen)
+ {
+ free(subsystem_list);
+ free(cgroup_path);
+ subsystem_list = (char*)malloc(lineLen+1);
+ if (subsystem_list == nullptr)
+ goto done;
+ cgroup_path = (char*)malloc(lineLen+1);
+ if (cgroup_path == nullptr)
+ goto done;
+ maxLineLen = lineLen;
+ }
+
+ // See man page of proc to get format for /proc/self/cgroup file
+ int sscanfRet = sscanf(line,
+ "%*[^:]:%[^:]:%s",
+ subsystem_list,
+ cgroup_path);
+ if (sscanfRet != 2)
+ {
+ assert(!"Failed to parse cgroup info file contents with sscanf.");
+ goto done;
+ }
+
+ char* context = nullptr;
+ char* strTok = strtok_r(subsystem_list, ",", &context);
+ while (strTok != nullptr)
+ {
+ if (strncmp("memory", strTok, 6) == 0)
+ {
+ result = true;
+ break;
+ }
+ strTok = strtok_r(nullptr, ",", &context);
+ }
+ }
+ done:
+ free(subsystem_list);
+ if (!result)
+ {
+ free(cgroup_path);
+ cgroup_path = nullptr;
+ }
+ free(line);
+ if (cgroupfile)
+ fclose(cgroupfile);
+ return cgroup_path;
+ }
+
+ bool ReadMemoryValueFromFile(const char* filename, size_t* val)
+ {
+ bool result = false;
+ char *line = nullptr;
+ size_t lineLen = 0;
+ char* endptr = nullptr;
+ size_t num = 0, l, multiplier;
+ FILE* file = nullptr;
+
+ if (val == nullptr)
+ goto done;
+
+ file = fopen(filename, "r");
+ if (file == nullptr)
+ goto done;
+
+ if (getline(&line, &lineLen, file) == -1)
+ goto done;
+
+ errno = 0;
+ num = strtoull(line, &endptr, 0);
+ if (errno != 0)
+ goto done;
+
+ multiplier = 1;
+ switch(*endptr)
+ {
+ case 'g':
+ case 'G': multiplier = 1024;
+ case 'm':
+ case 'M': multiplier = multiplier*1024;
+ case 'k':
+ case 'K': multiplier = multiplier*1024;
+ }
+
+ *val = num * multiplier;
+ result = true;
+ if (*val/multiplier != num)
+ result = false;
+ done:
+ if (file)
+ fclose(file);
+ free(line);
+ return result;
+ }
+};
+
+size_t GetRestrictedPhysicalMemoryLimit()
+{
+ CGroup cgroup;
+ size_t physical_memory_limit;
+
+ if (!cgroup.GetPhysicalMemoryLimit(&physical_memory_limit))
+ physical_memory_limit = SIZE_T_MAX;
+
+ struct rlimit curr_rlimit;
+ size_t rlimit_soft_limit = RLIM_INFINITY;
+ if (getrlimit(RLIMIT_AS, &curr_rlimit) == 0)
+ {
+ rlimit_soft_limit = curr_rlimit.rlim_cur;
+ }
+ physical_memory_limit = (physical_memory_limit < rlimit_soft_limit) ?
+ physical_memory_limit : rlimit_soft_limit;
+
+ // Ensure that limit is not greater than real memory size
+ long pages = sysconf(_SC_PHYS_PAGES);
+ if (pages != -1)
+ {
+ long pageSize = sysconf(_SC_PAGE_SIZE);
+ if (pageSize != -1)
+ {
+ physical_memory_limit = (physical_memory_limit < (size_t)pages * pageSize)?
+ physical_memory_limit : (size_t)pages * pageSize;
+ }
+ }
+
+ return physical_memory_limit;
+}
+
+bool GetWorkingSetSize(size_t* val)
+{
+ bool result = false;
+ size_t linelen;
+ char* line = nullptr;
+
+ if (val == nullptr)
+ return false;
+
+ FILE* file = fopen(PROC_STATM_FILENAME, "r");
+ if (file != nullptr && getline(&line, &linelen, file) != -1)
+ {
+
+ char* context = nullptr;
+ char* strTok = strtok_r(line, " ", &context);
+ strTok = strtok_r(nullptr, " ", &context);
+
+ errno = 0;
+ *val = strtoull(strTok, nullptr, 0);
+ if (errno == 0)
+ {
+ long pageSize = sysconf(_SC_PAGE_SIZE);
+ if (pageSize != -1)
+ {
+ *val = *val * pageSize;
+ result = true;
+ }
+ }
+ }
+
+ if (file)
+ fclose(file);
+ free(line);
+ return result;
+}
diff --git a/src/gc/unix/gcenv.unix.cpp b/src/gc/unix/gcenv.unix.cpp
index 34a45b3cc1..45489c69a7 100644
--- a/src/gc/unix/gcenv.unix.cpp
+++ b/src/gc/unix/gcenv.unix.cpp
@@ -78,6 +78,11 @@ static uint8_t g_helperPage[OS_PAGE_SIZE] __attribute__((aligned(OS_PAGE_SIZE)))
// Mutex to make the FlushProcessWriteBuffersMutex thread safe
static pthread_mutex_t g_flushProcessWriteBuffersMutex;
+size_t GetRestrictedPhysicalMemoryLimit();
+bool GetWorkingSetSize(size_t* val);
+
+static size_t g_RestrictedPhysicalMemoryLimit = 0;
+
// Initialize the interface implementation
// Return:
// true if it has succeeded, false if it has failed
@@ -442,6 +447,18 @@ size_t GCToOSInterface::GetVirtualMemoryLimit()
// specified, it returns amount of actual physical memory.
uint64_t GCToOSInterface::GetPhysicalMemoryLimit()
{
+ size_t restricted_limit;
+ // The limit was not cached
+ if (g_RestrictedPhysicalMemoryLimit == 0)
+ {
+ restricted_limit = GetRestrictedPhysicalMemoryLimit();
+ VolatileStore(&g_RestrictedPhysicalMemoryLimit, restricted_limit);
+ }
+ restricted_limit = g_RestrictedPhysicalMemoryLimit;
+
+ if (restricted_limit != 0 && restricted_limit != SIZE_T_MAX)
+ return restricted_limit;
+
long pages = sysconf(_SC_PHYS_PAGES);
if (pages == -1)
{
@@ -471,14 +488,14 @@ void GCToOSInterface::GetMemoryStatus(uint32_t* memory_load, uint64_t* available
uint64_t available = 0;
uint32_t load = 0;
+ size_t used;
// Get the physical memory in use - from it, we can get the physical memory available.
// We do this only when we have the total physical memory available.
- if (total > 0)
+ if (total > 0 && GetWorkingSetSize(&used))
{
- available = sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGE_SIZE);
- uint64_t used = total - available;
- load = (uint32_t)((used * 100) / total);
+ available = total > used ? total-used : 0;
+ load = (uint32_t)(((float)used * 100) / (float)total);
}
if (memory_load != nullptr)
diff --git a/src/gc/windows/gcenv.windows.cpp b/src/gc/windows/gcenv.windows.cpp
index a636478245..30232bfb09 100644
--- a/src/gc/windows/gcenv.windows.cpp
+++ b/src/gc/windows/gcenv.windows.cpp
@@ -597,6 +597,9 @@ bool GCToOSInterface::CreateThread(GCThreadFunction function, void* param, GCThr
::SetThreadAffinityMask(gc_thread, (DWORD_PTR)1 << affinity->Processor);
}
+ ResumeThread(gc_thread);
+ CloseHandle(gc_thread);
+
return true;
}
diff --git a/src/ilasm/grammar_after.cpp b/src/ilasm/grammar_after.cpp
index 344e504f05..53d141db54 100644
--- a/src/ilasm/grammar_after.cpp
+++ b/src/ilasm/grammar_after.cpp
@@ -854,7 +854,6 @@ Its_An_Id:
TRUE, wzFullName,&pwz);
if(dw != 0)
{
- wzFullName.CloseBuffer((COUNT_T)(dw));
delete [] wzFile;
wzFile = wzFullName.GetCopyOfUnicodeString();
diff --git a/src/ildasm/dasm.cpp b/src/ildasm/dasm.cpp
index 0cb5cc8932..68cfa2abee 100644
--- a/src/ildasm/dasm.cpp
+++ b/src/ildasm/dasm.cpp
@@ -483,7 +483,7 @@ void Uninit()
{
SDELETE(g_szBuf_UnquotedProperName);
}
- if (g_szBuf_UnquotedProperName != NULL)
+ if (g_szBuf_ProperName != NULL)
{
SDELETE(g_szBuf_ProperName);
}
diff --git a/src/inc/clrconfigvalues.h b/src/inc/clrconfigvalues.h
index 6160f2061a..0a285a173e 100644
--- a/src/inc/clrconfigvalues.h
+++ b/src/inc/clrconfigvalues.h
@@ -936,6 +936,12 @@ CONFIG_DWORD_INFO(INTERNAL_SuspendDeadlockTimeout, W("SuspendDeadlockTimeout"),
CONFIG_DWORD_INFO(INTERNAL_SuspendThreadDeadlockTimeoutMs, W("SuspendThreadDeadlockTimeoutMs"), 2000, "")
RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadSuspendInjection, W("INTERNAL_ThreadSuspendInjection"), 1, "Specifies whether to inject activations for thread suspension on Unix")
+//
+// Thread (miscellaneous)
+//
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_Thread_DeadThreadCountThresholdForGCTrigger, W("Thread_DeadThreadCountThresholdForGCTrigger"), 75, "In the heuristics to clean up dead threads, this threshold must be reached before triggering a GC will be considered. Set to 0 to disable triggering a GC based on dead threads.")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_Thread_DeadThreadGCTriggerPeriodMilliseconds, W("Thread_DeadThreadGCTriggerPeriodMilliseconds"), 1000 * 60 * 30, "In the heuristics to clean up dead threads, this much time must have elapsed since the previous max-generation GC before triggering another GC will be considered")
+
//
// Threadpool
//
@@ -963,6 +969,15 @@ RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_SampleIntervalLow,
RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_SampleIntervalHigh, W("HillClimbing_SampleIntervalHigh"), 200, "");
RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_GainExponent, W("HillClimbing_GainExponent"), 200, "The exponent to apply to the gain, times 100. 100 means to use linear gain, higher values will enhance large moves and damp small ones.");
+
+//
+// Tiered Compilation
+//
+#ifdef FEATURE_TIERED_COMPILATION
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_TieredCompilation, W("EXPERIMENTAL_TieredCompilation"), 0, "Enables tiered compilation")
+#endif
+
+
//
// TypeLoader
//
diff --git a/src/inc/corbbtprof.h b/src/inc/corbbtprof.h
index 2f69dcccc8..5aa7782544 100644
--- a/src/inc/corbbtprof.h
+++ b/src/inc/corbbtprof.h
@@ -140,7 +140,7 @@ enum TypeProfilingDataFlags
ReadMethodTable = 0, // 0x00001
ReadEEClass = 1, // 0x00002
WriteEEClass = 2, // 0x00004
-// ReadStoredEnumData = 3, // 0x00008
+// ReadStoredEnumData = 3, // 0x00008 // obsolete
ReadFieldDescs = 4, // 0x00010
ReadCCtorInfo = 5, // 0x00020
ReadClassHashTable = 6, // 0x00040
@@ -148,34 +148,37 @@ enum TypeProfilingDataFlags
ReadDispatchTable = 8, // 0x00100
ReadMethodTableWriteableData = 9, // 0x00200
ReadFieldMarshalers = 10, // 0x00400
-// Unused = 11, // 0x00800 ... Was WriteDispatchTable in the past
-// WriteMethodTable = 12, // 0x01000
+// WriteDispatchTable = 11, // 0x00800 // obsolete
+// WriteMethodTable = 12, // 0x01000 // obsolete
WriteMethodTableWriteableData = 13, // 0x02000
ReadTypeDesc = 14, // 0x04000
WriteTypeDesc = 15, // 0x08000
ReadTypeHashTable = 16, // 0x10000
-// WriteTypeHashTable = 17, // 0x20000
-// ReadDictionary = 18, // 0x40000
-// WriteDictionary = 19, // 0x80000
+// WriteTypeHashTable = 17, // 0x20000 // obsolete
+// ReadDictionary = 18, // 0x40000 // obsolete
+// WriteDictionary = 19, // 0x80000 // obsolete
ReadNonVirtualSlots = 20, // 0x100000
};
enum MethodProfilingDataFlags
{
// Important: update toolbox\ibcmerge\ibcmerge.cs if you change these
- ReadMethodCode = 0, // 0x00001
+ ReadMethodCode = 0, // 0x00001 // Also means the method was executed
ReadMethodDesc = 1, // 0x00002
- RunOnceMethod = 2, // 0x00004 // was CommonMethod
- RunNeverMethod = 3, // 0x00008 // was MethodMetadataAccess
-// MethodStoredDataAccess = 4, // 0x00010
+ RunOnceMethod = 2, // 0x00004
+ RunNeverMethod = 3, // 0x00008
+// MethodStoredDataAccess = 4, // 0x00010 // obsolete
WriteMethodDesc = 5, // 0x00020
-// ReadFCallHash = 6, // 0x00040
+// ReadFCallHash = 6, // 0x00040 // obsolete
ReadGCInfo = 7, // 0x00080
CommonReadGCInfo = 8, // 0x00100
-// ReadMethodDefRidMap = 9, // 0x00200
+// ReadMethodDefRidMap = 9, // 0x00200 // obsolete
ReadCerMethodList = 10, // 0x00400
ReadMethodPrecode = 11, // 0x00800
WriteMethodPrecode = 12, // 0x01000
+ ExcludeHotMethodCode = 13, // 0x02000 // Hot method should be excluded from the ReadyToRun image
+ ExcludeColdMethodCode = 14, // 0x04000 // Cold method should be excluded from the ReadyToRun image
+ DisableInlining = 15, // 0x08000 // Disable inlining of this method in optimized AOT native code
};
enum GeneralProfilingDataFlags
diff --git a/src/inc/coregen.h b/src/inc/coregen.h
index 5ca7334e92..5864bbbaef 100644
--- a/src/inc/coregen.h
+++ b/src/inc/coregen.h
@@ -18,5 +18,6 @@
#define NGENWORKER_FLAGS_WINMD_RESILIENT 0x1000
#define NGENWORKER_FLAGS_READYTORUN 0x2000
#define NGENWORKER_FLAGS_NO_METADATA 0x4000
+#define NGENWORKER_FLAGS_SILENT 0x8000
#endif // _NGENCOMMON_H_
diff --git a/src/inc/corhdr.h b/src/inc/corhdr.h
index c194def07f..4b757421cb 100644
--- a/src/inc/corhdr.h
+++ b/src/inc/corhdr.h
@@ -751,6 +751,7 @@ typedef enum CorAssemblyFlags
afEnableJITcompileTracking = 0x8000, // From "DebuggableAttribute".
afDisableJITcompileOptimizer = 0x4000, // From "DebuggableAttribute".
+ afDebuggableAttributeMask = 0xc000,
afRetargetable = 0x0100, // The assembly can be retargeted (at runtime) to an
// assembly from a different publisher.
diff --git a/src/inc/corinfo.h b/src/inc/corinfo.h
index c094c94c7a..f1ff1b680c 100644
--- a/src/inc/corinfo.h
+++ b/src/inc/corinfo.h
@@ -149,7 +149,7 @@ The first 4 options are mutially exclusive
This last field can modify any of the cases above except CORINFO_FLG_HELPER
CORINFO_FLG_STATIC_IN_HEAP This is currently only used for static fields of value classes. If the field has
-this set then after computing what would normally be the field, what you actually get is a object poitner
+this set then after computing what would normally be the field, what you actually get is a object pointer
(that must be reported to the GC) to a boxed version of the value. Thus the actual field address is computed
by addr = (*addr+sizeof(OBJECTREF))
@@ -213,52 +213,20 @@ TODO: Talk about initializing strutures before use
#define SELECTANY extern __declspec(selectany)
#endif
-// COR_JIT_EE_VERSION is a #define that specifies a JIT-EE version, but on a less granular basis than the GUID.
-// The #define is intended to be used on a per-product basis. That is, for each release that we support a JIT
-// CTP build, we'll update the COR_JIT_EE_VERSION. The GUID must change any time any part of the interface changes.
-//
-// COR_JIT_EE_VERSION is set, by convention, to a number related to the the product number. So, 460 is .NET 4.60.
-// 461 would indicate .NET 4.6.1. Etc.
-//
-// Note that the EE should always build with the most current (highest numbered) version. Only the JIT will
-// potentially build with a lower version number. In that case, the COR_JIT_EE_VERSION will be specified in the
-// CTP JIT build project, such as ctpjit.nativeproj.
-
-#if !defined(COR_JIT_EE_VERSION)
-#define COR_JIT_EE_VERSION 999999999 // This means we'll take everything in the interface
-#endif
-
-#if COR_JIT_EE_VERSION > 460
-
// Update this one
-SELECTANY const GUID JITEEVersionIdentifier = { /* cda334f7-0020-4622-a4a5-8b8ac71ee5cf */
- 0xcda334f7,
- 0x0020,
- 0x4622,
- {0xa4, 0xa5, 0x8b, 0x8a, 0xc7, 0x1e, 0xe5, 0xcf}
- };
-
-#else
-
-// ************ Leave this one alone ***************
-// We need it to build a .NET 4.6 compatible JIT for the RyuJIT CTP releases
-SELECTANY const GUID JITEEVersionIdentifier = { /* 9110edd8-8fc3-4e3d-8ac9-12555ff9be9c */
- 0x9110edd8,
- 0x8fc3,
- 0x4e3d,
- { 0x8a, 0xc9, 0x12, 0x55, 0x5f, 0xf9, 0xbe, 0x9c }
+SELECTANY const GUID JITEEVersionIdentifier = { /* f00b3f49-ddd2-49be-ba43-6e49ffa66959 */
+ 0xf00b3f49,
+ 0xddd2,
+ 0x49be,
+ { 0xba, 0x43, 0x6e, 0x49, 0xff, 0xa6, 0x69, 0x59 }
};
-#endif
-
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// END JITEEVersionIdentifier
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////
-#if COR_JIT_EE_VERSION > 460
-
// For System V on the CLR type system number of registers to pass in and return a struct is the same.
// The CLR type system allows only up to 2 eightbytes to be passed in registers. There is no SSEUP classification types.
#define CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS 2
@@ -381,8 +349,6 @@ private:
}
};
-#endif // COR_JIT_EE_VERSION
-
// CorInfoHelpFunc defines the set of helpers (accessed via the ICorDynamicInfo::getHelperFtn())
// These helpers can be called by native code which executes in the runtime.
// Compilers can emit calls to these helpers.
@@ -433,9 +399,7 @@ enum CorInfoHelpFunc
CORINFO_HELP_NEWSFAST, // allocator for small, non-finalizer, non-array object
CORINFO_HELP_NEWSFAST_ALIGN8, // allocator for small, non-finalizer, non-array object, 8 byte aligned
CORINFO_HELP_NEW_MDARR, // multi-dim array helper (with or without lower bounds - dimensions passed in as vararg)
-#if COR_JIT_EE_VERSION > 460
CORINFO_HELP_NEW_MDARR_NONVARARG,// multi-dim array helper (with or without lower bounds - dimensions passed in as unmanaged array)
-#endif
CORINFO_HELP_NEWARR_1_DIRECT, // helper for any one dimensional array creation
CORINFO_HELP_NEWARR_1_OBJ, // optimized 1-D object arrays
CORINFO_HELP_NEWARR_1_VC, // optimized 1-D value class arrays
@@ -481,9 +445,7 @@ enum CorInfoHelpFunc
CORINFO_HELP_RNGCHKFAIL, // array bounds check failed
CORINFO_HELP_OVERFLOW, // throw an overflow exception
CORINFO_HELP_THROWDIVZERO, // throw a divide by zero exception
-#if COR_JIT_EE_VERSION > 460
CORINFO_HELP_THROWNULLREF, // throw a null reference exception
-#endif // COR_JIT_EE_VERSION
CORINFO_HELP_INTERNALTHROW, // Support for really fast jit
CORINFO_HELP_VERIFICATION, // Throw a VerificationException
@@ -639,13 +601,9 @@ enum CorInfoHelpFunc
CORINFO_HELP_READYTORUN_CHKCAST,
CORINFO_HELP_READYTORUN_STATIC_BASE,
CORINFO_HELP_READYTORUN_VIRTUAL_FUNC_PTR,
-#if COR_JIT_EE_VERSION > 460
CORINFO_HELP_READYTORUN_GENERIC_HANDLE,
CORINFO_HELP_READYTORUN_DELEGATE_CTOR,
CORINFO_HELP_READYTORUN_GENERIC_STATIC_BASE,
-#else
- #define CORINFO_HELP_READYTORUN_DELEGATE_CTOR CORINFO_HELP_EE_PRESTUB
-#endif // COR_JIT_EE_VERSION
CORINFO_HELP_EE_PRESTUB, // Not real JIT helper. Used in native images.
@@ -682,7 +640,6 @@ enum CorInfoHelpFunc
CORINFO_HELP_LOOP_CLONE_CHOICE_ADDR, // Return the reference to a counter to decide to take cloned path in debug stress.
CORINFO_HELP_DEBUG_LOG_LOOP_CLONING, // Print a message that a loop cloning optimization has occurred in debug mode.
-#if COR_JIT_EE_VERSION > 460
CORINFO_HELP_THROW_ARGUMENTEXCEPTION, // throw ArgumentException
CORINFO_HELP_THROW_ARGUMENTOUTOFRANGEEXCEPTION, // throw ArgumentOutOfRangeException
@@ -693,7 +650,6 @@ enum CorInfoHelpFunc
CORINFO_HELP_JIT_REVERSE_PINVOKE_EXIT, // Transition to preemptive mode in reverse P/Invoke epilog, frame is the first argument
CORINFO_HELP_GVMLOOKUP_FOR_SLOT, // Resolve a generic virtual method target from this pointer and runtime method handle
-#endif
CORINFO_HELP_COUNT,
};
@@ -791,6 +747,17 @@ enum CorInfoCallConv
CORINFO_CALLCONV_PARAMTYPE = 0x80, // Passed last. Same as CORINFO_GENERICS_CTXT_FROM_PARAMTYPEARG
};
+#ifdef UNIX_X86_ABI
+inline bool IsCallerPop(CorInfoCallConv callConv)
+{
+ unsigned int umask = CORINFO_CALLCONV_STDCALL
+ | CORINFO_CALLCONV_THISCALL
+ | CORINFO_CALLCONV_FASTCALL;
+
+ return !(callConv & umask);
+}
+#endif // UNIX_X86_ABI
+
enum CorInfoUnmanagedCallConv
{
// These correspond to CorUnmanagedCallingConvention
@@ -1311,8 +1278,6 @@ enum CORINFO_RUNTIME_LOOKUP_KIND
CORINFO_LOOKUP_CLASSPARAM,
};
-#if COR_JIT_EE_VERSION > 460
-
struct CORINFO_LOOKUP_KIND
{
bool needsRuntimeLookup;
@@ -1324,16 +1289,6 @@ struct CORINFO_LOOKUP_KIND
void * runtimeLookupArgs;
} ;
-#else
-
-struct CORINFO_LOOKUP_KIND
-{
- bool needsRuntimeLookup;
- CORINFO_RUNTIME_LOOKUP_KIND runtimeLookupKind;
-} ;
-
-#endif
-
// CORINFO_RUNTIME_LOOKUP indicates the details of the runtime lookup
// operation to be performed.
@@ -1611,10 +1566,8 @@ enum CorInfoTokenKind
// token comes from CEE_CONSTRAINED
CORINFO_TOKENKIND_Constrained = 0x100 | CORINFO_TOKENKIND_Class,
-#if COR_JIT_EE_VERSION > 460
// token comes from CEE_NEWOBJ
CORINFO_TOKENKIND_NewObj = 0x200 | CORINFO_TOKENKIND_Method,
-#endif
};
struct CORINFO_RESOLVED_TOKEN
@@ -1713,15 +1666,11 @@ enum CORINFO_FIELD_ACCESSOR
CORINFO_FIELD_STATIC_GENERICS_STATIC_HELPER, // static field access using the "generic static" helper (argument is MethodTable *)
CORINFO_FIELD_STATIC_ADDR_HELPER, // static field accessed using address-of helper (argument is FieldDesc *)
CORINFO_FIELD_STATIC_TLS, // unmanaged TLS access
-#if COR_JIT_EE_VERSION > 460
CORINFO_FIELD_STATIC_READYTORUN_HELPER, // static field access using a runtime lookup helper
-#endif
CORINFO_FIELD_INTRINSIC_ZERO, // intrinsic zero (IntPtr.Zero, UIntPtr.Zero)
CORINFO_FIELD_INTRINSIC_EMPTY_STRING, // intrinsic emptry string (String.Empty)
-#if COR_JIT_EE_VERSION > 460
CORINFO_FIELD_INTRINSIC_ISLITTLEENDIAN, // intrinsic BitConverter.IsLittleEndian
-#endif
};
// Set of flags returned in CORINFO_FIELD_INFO::fieldFlags
@@ -1833,7 +1782,6 @@ struct CORINFO_EE_INFO
// Array offsets
unsigned offsetOfObjArrayData;
-#if COR_JIT_EE_VERSION > 460
// Reverse PInvoke offsets
unsigned sizeOfReversePInvokeFrame;
@@ -1846,7 +1794,6 @@ struct CORINFO_EE_INFO
// Target ABI. Combined with target architecture and OS to determine
// GC, EH, and unwind styles.
CORINFO_RUNTIME_ABI targetAbi;
-#endif
CORINFO_OS osType;
unsigned osMajor;
@@ -1863,18 +1810,6 @@ enum { LCL_FINALLY_MARK = 0xFC }; // FC = "Finally Call"
* when it generates code
**********************************************************************************/
-#if COR_JIT_EE_VERSION <= 460
-
-#define CORINFO_PAGE_SIZE 0x1000 // the page size on the machine
-
-#ifndef FEATURE_PAL
-#define MAX_UNCHECKED_OFFSET_FOR_NULL_OBJECT ((32*1024)-1) // when generating JIT code
-#else // !FEATURE_PAL
-#define MAX_UNCHECKED_OFFSET_FOR_NULL_OBJECT ((OS_PAGE_SIZE / 2) - 1)
-#endif // !FEATURE_PAL
-
-#endif // COR_JIT_EE_VERISION <= 460
-
#include <pshpack4.h>
typedef void* CORINFO_MethodPtr; // a generic method pointer
@@ -2116,28 +2051,25 @@ public:
unsigned* offsetAfterIndirection /* OUT */
) = 0;
-#if COR_JIT_EE_VERSION > 460
- // Find the virtual method in implementingClass that overrides virtualMethod.
- // Return null if devirtualization is not possible.
+ // Find the virtual method in implementingClass that overrides virtualMethod,
+ // or the method in implementingClass that implements the interface method
+ // represented by virtualMethod.
+ //
+ // Return null if devirtualization is not possible. Owner type is optional
+ // and provides additional context for shared interface devirtualization.
virtual CORINFO_METHOD_HANDLE resolveVirtualMethod(
- CORINFO_METHOD_HANDLE virtualMethod, /* IN */
- CORINFO_CLASS_HANDLE implementingClass /* IN */
- ) = 0;
-#endif
+ CORINFO_METHOD_HANDLE virtualMethod, /* IN */
+ CORINFO_CLASS_HANDLE implementingClass, /* IN */
+ CORINFO_CONTEXT_HANDLE ownerType = NULL /* IN */
+ ) = 0;
// If a method's attributes have (getMethodAttribs) CORINFO_FLG_INTRINSIC set,
// getIntrinsicID() returns the intrinsic ID.
// *pMustExpand tells whether or not JIT must expand the intrinsic.
-#if COR_JIT_EE_VERSION > 460
virtual CorInfoIntrinsics getIntrinsicID(
CORINFO_METHOD_HANDLE method,
bool* pMustExpand = NULL /* OUT */
) = 0;
-#else
- virtual CorInfoIntrinsics getIntrinsicID(
- CORINFO_METHOD_HANDLE method
- ) = 0;
-#endif
// Is the given module the System.Numerics.Vectors module?
// This defaults to false.
@@ -2229,13 +2161,11 @@ public:
// failures during token resolution.
virtual void resolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken) = 0;
-#if COR_JIT_EE_VERSION > 460
// Attempt to resolve a metadata token into a runtime method handle. Returns true
// if resolution succeeded and false otherwise (e.g. if it encounters invalid metadata
// during token reoslution). This method should be used instead of `resolveToken` in
// situations that need to be resilient to invalid metadata.
virtual bool tryResolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken) = 0;
-#endif
// Signature information about the call sig
virtual void findSig (
@@ -2382,7 +2312,7 @@ public:
// in representing of 'cls' from a GC perspective. The class is
// assumed to be an array of machine words
// (of length // getClassSize(cls) / sizeof(void*)),
- // 'gcPtrs' is a poitner to an array of BYTEs of this length.
+ // 'gcPtrs' is a pointer to an array of BYTEs of this length.
// getClassGClayout fills in this array so that gcPtrs[i] is set
// to one of the CorInfoGCType values which is the GC type of
// the i-th machine word of an object of type 'cls'
@@ -2454,7 +2384,7 @@ public:
// value into a particular location and thus has the signature
// void unboxHelper(void* dest, CORINFO_CLASS_HANDLE cls, Object* obj)
// Otherwise (it is null or points at a FALSE value) it is requesting
- // a helper that returns a poitner to the unboxed data
+ // a helper that returns a pointer to the unboxed data
// void* unboxHelper(CORINFO_CLASS_HANDLE cls, Object* obj)
// The EE has the option of NOT returning the copy style helper
// (But must be able to always honor the non-copy style helper)
@@ -2465,7 +2395,6 @@ public:
CORINFO_CLASS_HANDLE cls
) = 0;
-#if COR_JIT_EE_VERSION > 460
virtual bool getReadyToRunHelper(
CORINFO_RESOLVED_TOKEN * pResolvedToken,
CORINFO_LOOKUP_KIND * pGenericLookupKind,
@@ -2476,16 +2405,8 @@ public:
virtual void getReadyToRunDelegateCtorHelper(
CORINFO_RESOLVED_TOKEN * pTargetMethod,
CORINFO_CLASS_HANDLE delegateType,
- CORINFO_CONST_LOOKUP * pLookup
- ) = 0;
-#else
- virtual void getReadyToRunHelper(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- CorInfoHelpFunc id,
- CORINFO_CONST_LOOKUP * pLookup
+ CORINFO_LOOKUP * pLookup
) = 0;
-#endif
-
virtual const char* getHelperName(
CorInfoHelpFunc
@@ -2802,7 +2723,6 @@ public:
virtual void ThrowExceptionForHelper(
const CORINFO_HELPER_DESC * throwHelper) = 0;
-#if COR_JIT_EE_VERSION > 460
// Runs the given function under an error trap. This allows the JIT to make calls
// to interface functions that may throw exceptions without needing to be aware of
// the EH ABI, exception types, etc. Returns true if the given function completed
@@ -2811,7 +2731,6 @@ public:
void (*function)(void*), // The function to run
void* parameter // The context parameter that will be passed to the function and the handler
) = 0;
-#endif
/*****************************************************************************
* ICorStaticInfo contains EE interface methods which return values that are
@@ -2863,16 +2782,12 @@ public:
size_t FQNameCapacity /* IN */
) = 0;
-#if COR_JIT_EE_VERSION > 460
-
// returns whether the struct is enregisterable. Only valid on a System V VM. Returns true on success, false on failure.
virtual bool getSystemVAmd64PassStructInRegisterDescriptor(
/* IN */ CORINFO_CLASS_HANDLE structHnd,
/* OUT */ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr
) = 0;
-#endif // COR_JIT_EE_VERSION
-
};
/*****************************************************************************
@@ -2998,8 +2913,7 @@ public:
) = 0;
// NOTE: the two methods below--getPInvokeUnmanagedTarget and getAddressOfPInvokeFixup--are
- // deprecated. New code (i.e. anything that can depend on COR_JIT_EE_VERSION being
- // greater than 460) should instead use getAddressOfPInvokeTarget, which subsumes the
+ // deprecated. New code should instead use getAddressOfPInvokeTarget, which subsumes the
// functionality of these methods.
// return the unmanaged target *if method has already been prelinked.*
@@ -3014,14 +2928,12 @@ public:
void **ppIndirection = NULL
) = 0;
-#if COR_JIT_EE_VERSION > 460
// return the address of the PInvoke target. May be a fixup area in the
// case of late-bound PInvoke calls.
virtual void getAddressOfPInvokeTarget(
CORINFO_METHOD_HANDLE method,
CORINFO_CONST_LOOKUP *pLookup
) = 0;
-#endif
// Generate a cookie based on the signature that would needs to be passed
// to CORINFO_HELP_PINVOKE_CALLI
diff --git a/src/inc/corjit.h b/src/inc/corjit.h
index 6d01b9f9d9..e6d067c0fe 100644
--- a/src/inc/corjit.h
+++ b/src/inc/corjit.h
@@ -72,86 +72,6 @@ enum CorJitResult
CORJIT_RECOVERABLEERROR = MAKE_HRESULT(SEVERITY_ERROR,FACILITY_NULL, 5),
};
-
-#if COR_JIT_EE_VERSION <= 460
-
-/* values for flags in compileMethod */
-
-enum CorJitFlag
-{
- CORJIT_FLG_SPEED_OPT = 0x00000001,
- CORJIT_FLG_SIZE_OPT = 0x00000002,
- CORJIT_FLG_DEBUG_CODE = 0x00000004, // generate "debuggable" code (no code-mangling optimizations)
- CORJIT_FLG_DEBUG_EnC = 0x00000008, // We are in Edit-n-Continue mode
- CORJIT_FLG_DEBUG_INFO = 0x00000010, // generate line and local-var info
- CORJIT_FLG_MIN_OPT = 0x00000020, // disable all jit optimizations (not necesarily debuggable code)
- CORJIT_FLG_GCPOLL_CALLS = 0x00000040, // Emit calls to JIT_POLLGC for thread suspension.
- CORJIT_FLG_MCJIT_BACKGROUND = 0x00000080, // Calling from multicore JIT background thread, do not call JitComplete
-
- CORJIT_FLG_UNUSED1 = 0x00000100,
-
-#if defined(_TARGET_X86_)
-
- CORJIT_FLG_PINVOKE_RESTORE_ESP = 0x00000200, // Restore ESP after returning from inlined PInvoke
- CORJIT_FLG_TARGET_P4 = 0x00000400,
- CORJIT_FLG_USE_FCOMI = 0x00000800, // Generated code may use fcomi(p) instruction
- CORJIT_FLG_USE_CMOV = 0x00001000, // Generated code may use cmov instruction
- CORJIT_FLG_USE_SSE2 = 0x00002000, // Generated code may use SSE-2 instructions
-
-#elif defined(_TARGET_AMD64_)
-
- CORJIT_FLG_USE_SSE3_4 = 0x00000200,
- CORJIT_FLG_USE_AVX = 0x00000400,
- CORJIT_FLG_USE_AVX2 = 0x00000800,
- CORJIT_FLG_USE_AVX_512 = 0x00001000,
- CORJIT_FLG_FEATURE_SIMD = 0x00002000,
-
-#else // !defined(_TARGET_X86_) && !defined(_TARGET_AMD64_)
-
- CORJIT_FLG_UNUSED2 = 0x00000200,
- CORJIT_FLG_UNUSED3 = 0x00000400,
- CORJIT_FLG_UNUSED4 = 0x00000800,
- CORJIT_FLG_UNUSED5 = 0x00001000,
- CORJIT_FLG_UNUSED6 = 0x00002000,
-
-#endif // !defined(_TARGET_X86_) && !defined(_TARGET_AMD64_)
-
- CORJIT_FLG_MAKEFINALCODE = 0x00008000, // Use the final code generator, i.e., not the interpreter.
- CORJIT_FLG_READYTORUN = 0x00010000, // Use version-resilient code generation
-
- CORJIT_FLG_PROF_ENTERLEAVE = 0x00020000, // Instrument prologues/epilogues
- CORJIT_FLG_PROF_REJIT_NOPS = 0x00040000, // Insert NOPs to ensure code is re-jitable
- CORJIT_FLG_PROF_NO_PINVOKE_INLINE
- = 0x00080000, // Disables PInvoke inlining
- CORJIT_FLG_SKIP_VERIFICATION = 0x00100000, // (lazy) skip verification - determined without doing a full resolve. See comment below
- CORJIT_FLG_PREJIT = 0x00200000, // jit or prejit is the execution engine.
- CORJIT_FLG_RELOC = 0x00400000, // Generate relocatable code
- CORJIT_FLG_IMPORT_ONLY = 0x00800000, // Only import the function
- CORJIT_FLG_IL_STUB = 0x01000000, // method is an IL stub
- CORJIT_FLG_PROCSPLIT = 0x02000000, // JIT should separate code into hot and cold sections
- CORJIT_FLG_BBINSTR = 0x04000000, // Collect basic block profile information
- CORJIT_FLG_BBOPT = 0x08000000, // Optimize method based on profile information
- CORJIT_FLG_FRAMED = 0x10000000, // All methods have an EBP frame
- CORJIT_FLG_ALIGN_LOOPS = 0x20000000, // add NOPs before loops to align them at 16 byte boundaries
- CORJIT_FLG_PUBLISH_SECRET_PARAM= 0x40000000, // JIT must place stub secret param into local 0. (used by IL stubs)
- CORJIT_FLG_GCPOLL_INLINE = 0x80000000, // JIT must inline calls to GCPoll when possible
-};
-
-enum CorJitFlag2
-{
- CORJIT_FLG2_SAMPLING_JIT_BACKGROUND = 0x00000001, // JIT is being invoked as a result of stack sampling for hot methods in the background
-};
-
-struct CORJIT_FLAGS
-{
- unsigned corJitFlags; // Values are from CorJitFlag
- unsigned corJitFlags2; // Values are from CorJitFlag2
-};
-
-#endif // COR_JIT_EE_VERSION <= 460
-
-#if COR_JIT_EE_VERSION > 460
-
class CORJIT_FLAGS
{
public:
@@ -226,6 +146,8 @@ public:
CORJIT_FLAG_USE_PINVOKE_HELPERS = 36, // The JIT should use the PINVOKE_{BEGIN,END} helpers instead of emitting inline transitions
CORJIT_FLAG_REVERSE_PINVOKE = 37, // The JIT should insert REVERSE_PINVOKE_{ENTER,EXIT} helpers into method prolog/epilog
CORJIT_FLAG_DESKTOP_QUIRKS = 38, // The JIT should generate desktop-quirk-compatible code
+ CORJIT_FLAG_TIER0 = 39, // This is the initial tier for tiered compilation which should generate code as quickly as possible
+ CORJIT_FLAG_TIER1 = 40, // This is the final tier (for now) for tiered compilation which should generate high quality code
};
CORJIT_FLAGS()
@@ -292,7 +214,6 @@ private:
unsigned __int64 corJitFlags;
};
-#endif // COR_JIT_EE_VERSION > 460
/*****************************************************************************
Here is how CORJIT_FLAG_SKIP_VERIFICATION should be interepreted.
@@ -450,14 +371,10 @@ enum CheckedWriteBarrierKinds {
CWBKind_AddrOfLocal, // Store through the address of a local (arguably a bug that this happens at all).
};
-#if COR_JIT_EE_VERSION > 460
-
#include "corjithost.h"
extern "C" void __stdcall jitStartup(ICorJitHost* host);
-#endif
-
class ICorJitCompiler;
class ICorJitInfo;
struct IEEMemoryManager;
@@ -515,11 +432,7 @@ public:
// When the EE loads the System.Numerics.Vectors assembly, it asks the JIT what length (in bytes) of
// SIMD vector it supports as an intrinsic type. Zero means that the JIT does not support SIMD
// intrinsics, so the EE should use the default size (i.e. the size of the IL implementation).
-#if COR_JIT_EE_VERSION > 460
virtual unsigned getMaxIntrinsicSIMDVectorLength(CORJIT_FLAGS cpuCompileFlags) { return 0; }
-#else
- virtual unsigned getMaxIntrinsicSIMDVectorLength(DWORD cpuCompileFlags) { return 0; }
-#endif
// IL obfuscators sometimes interpose on the EE-JIT interface. This function allows the VM to
// tell the JIT to use a particular ICorJitCompiler to implement the methods of this interface,
@@ -702,7 +615,6 @@ public:
//
virtual DWORD getExpectedTargetArchitecture() = 0;
-#if COR_JIT_EE_VERSION > 460
// Fetches extended flags for a particular compilation instance. Returns
// the number of bytes written to the provided buffer.
virtual DWORD getJitFlags(
@@ -710,7 +622,6 @@ public:
DWORD sizeInBytes /* IN: The size of the buffer. Note that this is effectively a
version number for the CORJIT_FLAGS value. */
) = 0;
-#endif
};
/**********************************************************************************/
diff --git a/src/inc/crosscomp.h b/src/inc/crosscomp.h
index 494ca7c007..200c343a45 100644
--- a/src/inc/crosscomp.h
+++ b/src/inc/crosscomp.h
@@ -195,7 +195,7 @@ typedef union _NEON128 {
struct {
ULONGLONG Low;
LONGLONG High;
- } DUMMYSTRUCTNAME;
+ };
double D[2];
float S[4];
WORD H[8];
@@ -288,7 +288,7 @@ typedef struct _T_RUNTIME_FUNCTION {
DWORD CR : 2;
DWORD FrameSize : 9;
} PackedUnwindData;
- } DUMMYUNIONNAME;
+ };
} T_RUNTIME_FUNCTION, *PT_RUNTIME_FUNCTION;
diff --git a/src/inc/dacvars.h b/src/inc/dacvars.h
index 6180210fd6..4b7b7b1783 100644
--- a/src/inc/dacvars.h
+++ b/src/inc/dacvars.h
@@ -121,12 +121,8 @@ DEFINE_DACVAR(ULONG, int, dac__HillClimbingLogSize, ::HillClimbingLogSize)
DEFINE_DACVAR(ULONG, PTR_Thread, dac__g_pFinalizerThread, ::g_pFinalizerThread)
DEFINE_DACVAR(ULONG, PTR_Thread, dac__g_pSuspensionThread, ::g_pSuspensionThread)
-#ifdef FEATURE_SVR_GC
-DEFINE_DACVAR(ULONG, DWORD, IGCHeap__gcHeapType, IGCHeap::gcHeapType)
-#endif // FEATURE_SVR_GC
-
+DEFINE_DACVAR(ULONG, DWORD, dac__g_heap_type, g_heap_type)
DEFINE_DACVAR(ULONG, PTR_GcDacVars, dac__g_gcDacGlobals, g_gcDacGlobals)
-DEFINE_DACVAR(ULONG, DWORD, IGCHeap__maxGeneration, IGCHeap::maxGeneration)
DEFINE_DACVAR(ULONG, PTR_SystemDomain, SystemDomain__m_pSystemDomain, SystemDomain::m_pSystemDomain)
DEFINE_DACVAR(ULONG, ArrayListStatic, SystemDomain__m_appDomainIndexList, SystemDomain::m_appDomainIndexList)
@@ -138,8 +134,6 @@ DEFINE_DACVAR(ULONG, PTR_SharedDomain, SharedDomain__m_pSharedDomain, SharedDoma
DEFINE_DACVAR(ULONG, DWORD, CExecutionEngine__TlsIndex, CExecutionEngine::TlsIndex)
-DEFINE_DACVAR(ULONG, LONG, GCScan__m_GcStructuresInvalidCnt, GCScan::m_GcStructuresInvalidCnt)
-
#if defined(FEATURE_WINDOWSPHONE)
DEFINE_DACVAR(ULONG, int, CCLRErrorReportingManager__g_ECustomDumpFlavor, CCLRErrorReportingManager::g_ECustomDumpFlavor)
#endif
diff --git a/src/inc/eventtracebase.h b/src/inc/eventtracebase.h
index f773a7c375..bd5ad1a2d0 100644
--- a/src/inc/eventtracebase.h
+++ b/src/inc/eventtracebase.h
@@ -154,11 +154,6 @@ public:
class Object;
#if !defined(FEATURE_PAL)
-/******************************/
-/* CLR ETW supported versions */
-/******************************/
-#define ETW_SUPPORTED_MAJORVER 5 // ETW is supported on win2k and above
-#define ETW_ENABLED_MAJORVER 6 // OS versions >= to this we enable ETW registration by default, since on XP and Windows 2003, registration is too slow.
/***************************************/
/* Tracing levels supported by CLR ETW */
@@ -201,11 +196,6 @@ struct ProfilingScanContext;
#include <wmistr.h>
#include <evntrace.h>
#include <evntprov.h>
-#if !defined(DONOT_DEFINE_ETW_CALLBACK) && !defined(DACCESS_COMPILE)
-#define GetVersionEx(Version) (GetOSVersion((LPOSVERSIONINFOW)Version))
-#else
-#define GetVersionEx(Version) (WszGetVersionEx((LPOSVERSIONINFOW)Version))
-#endif // !DONOT_DEFINE_ETW_CALLBACK && !DACCESS_COMPILE
#endif //!FEATURE_REDHAWK
#endif //!defined(FEATURE_PAL)
diff --git a/src/inc/formattype.cpp b/src/inc/formattype.cpp
index 76aa506bf1..8a7965cb4f 100644
--- a/src/inc/formattype.cpp
+++ b/src/inc/formattype.cpp
@@ -412,7 +412,7 @@ const PCCOR_SIGNATURE PrettyPrintSignature(
/******************************************************************************/
-// pretty prints 'type' or its 'typedef' to the buffer 'out' returns a poitner to the next type,
+// pretty prints 'type' or its 'typedef' to the buffer 'out' returns a pointer to the next type,
// or 0 on a format failure; outside ILDASM -- simple wrapper for PrettyPrintType
PCCOR_SIGNATURE PrettyPrintTypeOrDef(
diff --git a/src/inc/jithelpers.h b/src/inc/jithelpers.h
index 5f01a1b464..4e56250b04 100644
--- a/src/inc/jithelpers.h
+++ b/src/inc/jithelpers.h
@@ -75,9 +75,7 @@
DYNAMICJITHELPER(CORINFO_HELP_NEWSFAST, JIT_New, CORINFO_HELP_SIG_REG_ONLY)
DYNAMICJITHELPER(CORINFO_HELP_NEWSFAST_ALIGN8, JIT_New, CORINFO_HELP_SIG_REG_ONLY)
JITHELPER(CORINFO_HELP_NEW_MDARR, JIT_NewMDArr,CORINFO_HELP_SIG_8_VA)
-#if COR_JIT_EE_VERSION > 460
JITHELPER(CORINFO_HELP_NEW_MDARR_NONVARARG, JIT_NewMDArrNonVarArg,CORINFO_HELP_SIG_4_STACK)
-#endif
JITHELPER(CORINFO_HELP_NEWARR_1_DIRECT, JIT_NewArr1,CORINFO_HELP_SIG_REG_ONLY)
DYNAMICJITHELPER(CORINFO_HELP_NEWARR_1_OBJ, JIT_NewArr1,CORINFO_HELP_SIG_REG_ONLY)
DYNAMICJITHELPER(CORINFO_HELP_NEWARR_1_VC, JIT_NewArr1,CORINFO_HELP_SIG_REG_ONLY)
@@ -120,9 +118,7 @@
JITHELPER(CORINFO_HELP_RNGCHKFAIL, JIT_RngChkFail, CORINFO_HELP_SIG_REG_ONLY)
JITHELPER(CORINFO_HELP_OVERFLOW, JIT_Overflow, CORINFO_HELP_SIG_REG_ONLY)
JITHELPER(CORINFO_HELP_THROWDIVZERO, JIT_ThrowDivZero, CORINFO_HELP_SIG_REG_ONLY)
-#if COR_JIT_EE_VERSION > 460
JITHELPER(CORINFO_HELP_THROWNULLREF, JIT_ThrowNullRef, CORINFO_HELP_SIG_REG_ONLY)
-#endif // COR_JIT_EE_VERSION
JITHELPER(CORINFO_HELP_INTERNALTHROW, JIT_InternalThrow, CORINFO_HELP_SIG_REG_ONLY)
JITHELPER(CORINFO_HELP_VERIFICATION, IL_VerificationError,CORINFO_HELP_SIG_REG_ONLY)
JITHELPER(CORINFO_HELP_SEC_UNMGDCODE_EXCPT, JIT_SecurityUnmanagedCodeException, CORINFO_HELP_SIG_REG_ONLY)
@@ -206,12 +202,7 @@
JITHELPER(CORINFO_HELP_GETFIELDADDR, JIT_GetFieldAddr,CORINFO_HELP_SIG_REG_ONLY)
JITHELPER(CORINFO_HELP_GETSTATICFIELDADDR_CONTEXT, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
-
-#if COR_JIT_EE_VERSION > 460
JITHELPER(CORINFO_HELP_GETSTATICFIELDADDR_TLS, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
-#else // COR_JIT_EE_VERSION
- JITHELPER(CORINFO_HELP_GETSTATICFIELDADDR_TLS, JIT_GetStaticFieldAddr_Tls,CORINFO_HELP_SIG_REG_ONLY)
-#endif // COR_JIT_EE_VERSION
JITHELPER(CORINFO_HELP_GETGENERICS_GCSTATIC_BASE, JIT_GetGenericsGCStaticBase,CORINFO_HELP_SIG_REG_ONLY)
JITHELPER(CORINFO_HELP_GETGENERICS_NONGCSTATIC_BASE, JIT_GetGenericsNonGCStaticBase,CORINFO_HELP_SIG_REG_ONLY)
@@ -295,11 +286,9 @@
JITHELPER(CORINFO_HELP_READYTORUN_CHKCAST, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
JITHELPER(CORINFO_HELP_READYTORUN_STATIC_BASE, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
JITHELPER(CORINFO_HELP_READYTORUN_VIRTUAL_FUNC_PTR, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
-#if COR_JIT_EE_VERSION > 460
JITHELPER(CORINFO_HELP_READYTORUN_GENERIC_HANDLE, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
JITHELPER(CORINFO_HELP_READYTORUN_DELEGATE_CTOR, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
JITHELPER(CORINFO_HELP_READYTORUN_GENERIC_STATIC_BASE, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
-#endif // COR_JIT_EE_VERSION
JITHELPER(CORINFO_HELP_EE_PRESTUB, ThePreStub, CORINFO_HELP_SIG_NO_ALIGN_STUB)
@@ -361,8 +350,6 @@
JITHELPER(CORINFO_HELP_LOOP_CLONE_CHOICE_ADDR, JIT_LoopCloneChoiceAddr, CORINFO_HELP_SIG_REG_ONLY)
JITHELPER(CORINFO_HELP_DEBUG_LOG_LOOP_CLONING, JIT_DebugLogLoopCloning, CORINFO_HELP_SIG_REG_ONLY)
-#if COR_JIT_EE_VERSION > 460
-
JITHELPER(CORINFO_HELP_THROW_ARGUMENTEXCEPTION, JIT_ThrowArgumentException, CORINFO_HELP_SIG_REG_ONLY)
JITHELPER(CORINFO_HELP_THROW_ARGUMENTOUTOFRANGEEXCEPTION, JIT_ThrowArgumentOutOfRangeException, CORINFO_HELP_SIG_REG_ONLY)
@@ -374,8 +361,6 @@
JITHELPER(CORINFO_HELP_GVMLOOKUP_FOR_SLOT, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
-#endif // COR_JIT_EE_VERSION
-
#undef JITHELPER
#undef DYNAMICJITHELPER
#undef JITHELPER
diff --git a/src/inc/legacyactivationshim.h b/src/inc/legacyactivationshim.h
deleted file mode 100644
index 4d8eaa5dd9..0000000000
--- a/src/inc/legacyactivationshim.h
+++ /dev/null
@@ -1,1382 +0,0 @@
-// 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.
-//
-// LegacyActivationShim.h
-//
-// This file allows simple migration from .NET Runtime v2 Host Activation APIs
-// to the .NET Runtime v4 Host Activation APIs through simple shim functions.
-
-#ifndef __LEGACYACTIVATIONSHIM_H__
-#define __LEGACYACTIVATIONSHIM_H__
-
-#pragma warning(push)
-#pragma warning(disable:4127) // warning C4127: conditional expression is constant
- // caused by IfHrFailRet's while(0) code.
-#pragma warning(disable:4917) // a GUID can only be associated with a class, interface or namespace
-#pragma warning(disable:4191) // 'reinterpret_cast' : unsafe conversion from 'FARPROC' to 'XXX'
-
-#ifdef _MANAGED
-// We are compiling Managed C++, switch to native code then (and store current managed/native status on the stack)
-#pragma managed(push, off)
-#endif //_MANAGED
-
-#include "mscoree.h"
-#include "metahost.h"
-
-#include "wchar.h"
-
-#include "corerror.h"
-
-// To minimize how much we perturb sources that we are included in, we make sure that
-// all macros we define/redefine are restored at the end of the header.
-#pragma push_macro("IfHrFailRet")
-#pragma push_macro("IfHrFailRetFALSE")
-#pragma push_macro("IfHrFailRetVOID")
-
-// ---IfHrFailRet------------------------------------------------------------------------------------
-#undef IfHrFailRet
-#undef IfHrFailRetFALSE
-#undef IfHrFailRetVOID
-#define IfHrFailRet(EXPR) do { hr = (EXPR); if(FAILED(hr)) { return (hr); } } while (0)
-#define IfHrFailRetFALSE(EXPR) do { HRESULT _hr_ = (EXPR); if(FAILED(_hr_)) { return false; } } while (0)
-#define IfHrFailRetVOID(EXPR) do { HRESULT _hr_ = (EXPR); if(FAILED(_hr_)) { return; } } while (0)
-
-#include "legacyactivationshimutil.h"
-
-// Use of deprecated APIs within LegacyActivationShim namespace will result in C4996 that we will
-// disable for our own use.
-#pragma warning(push)
-#pragma warning(disable:4996)
-// ---LEGACYACTIVATONSHIM NAMESPACE----------------------------------------------------------------
-namespace LegacyActivationShim
-{
- // ---HELPERS----------------------------------------------------------------------------------
-#define GET_CLRMETAHOST(x) \
- ICLRMetaHost *x = NULL; \
- IfHrFailRet(Util::GetCLRMetaHost(&x))
-
-#define GET_CLRMETAHOSTPOLICY(x) \
- ICLRMetaHostPolicy*x = NULL; \
- IfHrFailRet(Util::GetCLRMetaHostPolicy(&x))
-
-#define GET_CLRINFO(x) \
- ICLRRuntimeInfo *x = NULL; \
- IfHrFailRet(Util::GetCLRRuntimeInfo(&x))
-
-#define LEGACY_API_PASS_THROUGH_STATIC(_name, _ret_type, _ret_value, _sig, _args) \
- { \
- hr = S_OK; \
- _ret_value = ::_name _args; \
- }
-
-#define LEGACY_API_PASS_THROUGH_STATIC_VOIDRET(_name, _sig, _args) \
- { \
- ::_name _args; \
- }
-
-#define LEGACY_API_PASS_THROUGH_DELAYLOAD(_name, _ret_type, _ret_value, _sig, _args) \
- { \
- typedef _ret_type __stdcall t_FN _sig; \
- Util::MscoreeFunctor<t_FN> FN; \
- if (SUCCEEDED(hr = FN.Init(#_name))) { \
- _ret_value = FN()_args; \
- } \
- }
-
-#define LEGACY_API_PASS_THROUGH_DELAYLOAD_VOIDRET(_name, _sig, _args) \
- { \
- typedef void __stdcall t_FN _sig; \
- Util::MscoreeFunctor<t_FN> FN; \
- if (SUCCEEDED(FN.Init(#_name))) { \
- FN()_args; \
- } \
- }
-
-#ifndef LEGACY_ACTIVATION_SHIM_DELAY_LOAD
-#define CALL_LEGACY_API(_name, _sig, _args) \
- LEGACY_API_PASS_THROUGH_STATIC(_name, HRESULT, hr, _sig, _args)
-#define CALL_LEGACY_API_VOIDRET(_name, _sig, _args) \
- LEGACY_API_PASS_THROUGH_STATIC_VOIDRET(_name, _sig, _args)
-#else
-#define CALL_LEGACY_API(_name, _sig, _args) \
- LEGACY_API_PASS_THROUGH_DELAYLOAD(_name, HRESULT, hr, _sig, _args)
-#define CALL_LEGACY_API_VOIDRET(_name, _sig, _args) \
- LEGACY_API_PASS_THROUGH_DELAYLOAD_VOIDRET(_name, _sig, _args)
-#endif
-
- // ---LEGACY SHIM FUNCTIONS--------------------------------------------------------------------
-
- // --------------------------------------------------------------------------------------------
- inline
- HRESULT GetCORSystemDirectory(
- __out_ecount(cchBuffer) LPWSTR pBuffer,
- __in DWORD cchBuffer,
- __out DWORD *pdwLength)
- {
- HRESULT hr = S_OK;
-
- if (Util::HasNewActivationAPIs())
- {
- DWORD dwLengthDummy = cchBuffer;
- if (pdwLength == NULL)
- pdwLength = &dwLengthDummy;
- else
- *pdwLength = cchBuffer;
-
- GET_CLRINFO(pInfo);
- IfHrFailRet(pInfo->GetRuntimeDirectory(pBuffer, pdwLength));
- }
- else
- {
- CALL_LEGACY_API(GetCORSystemDirectory,
- (LPWSTR pBuffer,
- DWORD cchBuffer,
- DWORD *pdwLength),
- (pBuffer,
- cchBuffer,
- pdwLength));
- }
-
- return hr;
- }
-
- // --------------------------------------------------------------------------------------------
- inline
- HRESULT GetCORVersion(
- __out_ecount(cchBuffer) LPWSTR pbBuffer,
- __in DWORD cchBuffer,
- __out DWORD *pdwLength)
- {
- HRESULT hr = S_OK;
-
- if (Util::HasNewActivationAPIs())
- {
- DWORD dwLengthDummy = cchBuffer;
- if (pdwLength == NULL)
- pdwLength = &dwLengthDummy;
- else
- *pdwLength = cchBuffer;
-
- GET_CLRINFO(pInfo);
- IfHrFailRet(pInfo->GetVersionString(pbBuffer, pdwLength));
- }
- else
- {
- CALL_LEGACY_API(GetCORVersion,
- (LPWSTR pbBuffer,
- DWORD cchBuffer,
- DWORD *pdwLength),
- (pbBuffer,
- cchBuffer,
- pdwLength));
-
- }
-
- return hr;
- }
-
- // --------------------------------------------------------------------------------------------
- inline
- HRESULT GetFileVersion(
- __in LPCWSTR szFileName,
- __out_ecount(cchBuffer) LPWSTR szBuffer,
- __in DWORD cchBuffer,
- __out DWORD *pdwLength)
- {
- HRESULT hr = S_OK;
-
- if (Util::HasNewActivationAPIs())
- {
- DWORD dwLengthDummy = cchBuffer;
- if (pdwLength == NULL)
- pdwLength = &dwLengthDummy;
- else
- *pdwLength = cchBuffer;
-
- GET_CLRMETAHOST(pMH);
- IfHrFailRet(pMH->GetVersionFromFile(szFileName, szBuffer, pdwLength));
- }
- else
- {
- CALL_LEGACY_API(GetFileVersion,
- (LPCWSTR szFileName,
- LPWSTR szBuffer,
- DWORD cchBuffer,
- DWORD *pdwLength),
- (szFileName,
- szBuffer,
- cchBuffer,
- pdwLength));
- }
-
- return hr;
- }
-
- // --------------------------------------------------------------------------------------------
- inline
- HRESULT GetCORRequiredVersion(
- __out_ecount(cchBuffer) LPWSTR pBuffer,
- __in DWORD cchBuffer,
- __out DWORD *pdwLength)
- {
- HRESULT hr = S_OK;
-
- if (Util::HasNewActivationAPIs())
- {
- DWORD dwLengthDummy = cchBuffer;
- if (pdwLength == NULL)
- pdwLength = &dwLengthDummy;
- else
- *pdwLength = cchBuffer;
-
- IfHrFailRet(Util::GetConfigImageVersion(pBuffer, pdwLength));
- }
- else
- {
- CALL_LEGACY_API(GetCORRequiredVersion,
- (LPWSTR pBuffer,
- DWORD cchBuffer,
- DWORD *pdwLength),
- (pBuffer,
- cchBuffer,
- pdwLength));
- }
-
- return hr;
- }
-
- // --------------------------------------------------------------------------------------------
- // This API is the one exception that we don't have fully equivalent functionality for
- // in the new APIs. Specifically, we do not have the runtimeInfoFlags equivalent that
- // allows platform differentiation. As such, we just send the call to the legacy API,
- // which does not bind (thankfully) and so we do not cap this specific API to Whidbey.
- inline
- HRESULT GetRequestedRuntimeInfo(
- __in_opt LPCWSTR pExe,
- __in_opt LPCWSTR pwszVersion,
- __in_opt LPCWSTR pConfigurationFile,
- __in DWORD startupFlags,
- __in DWORD runtimeInfoFlags,
- __out_ecount(dwDirectory) LPWSTR pDirectory,
- __in DWORD dwDirectory,
- __out DWORD *pdwDirectoryLength,
- __out_ecount(cchBuffer) LPWSTR pVersion,
- __in DWORD cchBuffer,
- __out DWORD *pdwLength)
- {
- HRESULT hr = S_OK;
-
- CALL_LEGACY_API(GetRequestedRuntimeInfo,
- (LPCWSTR pExe,
- LPCWSTR pwszVersion,
- LPCWSTR pConfigurationFile,
- DWORD startupFlags,
- DWORD runtimeInfoFlags,
- LPWSTR pDirectory,
- DWORD dwDirectory,
- DWORD *pdwDirectoryLength,
- LPWSTR pVersion,
- DWORD cchBuffer,
- DWORD *pdwLength),
- (pExe,
- pwszVersion,
- pConfigurationFile,
- startupFlags,
- runtimeInfoFlags,
- pDirectory,
- dwDirectory,
- pdwDirectoryLength,
- pVersion,
- cchBuffer,
- pdwLength));
-
- return hr;
- }
-
- // --------------------------------------------------------------------------------------------
- inline
- HRESULT GetRequestedRuntimeVersion(
- __in LPWSTR pExe,
- __out_ecount(cchBuffer) LPWSTR pVersion,
- __in DWORD cchBuffer,
- __out DWORD *pdwLength)
- {
- HRESULT hr = S_OK;
-
- if (Util::HasNewActivationAPIs())
- {
- DWORD dwLengthDummy = cchBuffer;
- if (pdwLength == NULL)
- pdwLength = &dwLengthDummy;
- else
- *pdwLength = cchBuffer;
-
- GET_CLRMETAHOSTPOLICY(pMHP);
- ICLRRuntimeInfo *pInfo = NULL;
- IfHrFailRet(pMHP->GetRequestedRuntime(
- METAHOST_POLICY_USE_PROCESS_IMAGE_PATH,
- pExe,
- NULL, // config stream
- pVersion,
- pdwLength,
- NULL, // image version str
- NULL, // image version len
- NULL,
- IID_ICLRRuntimeInfo,
- reinterpret_cast<LPVOID*>(&pInfo)));// ppRuntime
- Util::ReleaseHolder<ICLRRuntimeInfo*> hInfo(pInfo);
- }
- else
- {
- CALL_LEGACY_API(GetRequestedRuntimeVersion,
- (LPWSTR pExe,
- LPWSTR pVersion,
- DWORD cchBuffer,
- DWORD *pdwLength),
- (pExe,
- pVersion,
- cchBuffer,
- pdwLength));
- }
-
- return hr;
- }
-
- // --------------------------------------------------------------------------------------------
- inline
- HRESULT CorBindToRuntimeHost(
- LPCWSTR pwszVersion,
- LPCWSTR pwszBuildFlavor,
- LPCWSTR pwszHostConfigFile,
- VOID* pReserved,
- DWORD startupFlags,
- REFCLSID rclsid,
- REFIID riid,
- LPVOID FAR *ppv)
- {
- HRESULT hr = S_OK;
-
- if (Util::HasNewActivationAPIs())
- {
- IStream *pConfigStream = NULL;
- Util::ReleaseHolder<IStream*> hConfigStream;
- if (pwszHostConfigFile != NULL)
- {
- IfHrFailRet(Util::CreateIStreamFromFile(pwszHostConfigFile, &pConfigStream));
- hConfigStream.Assign(pConfigStream);
- }
-
- WCHAR wszVersionLocal[512];
- DWORD cchVersionLocal = 512;
- if (pwszVersion != NULL)
- wcsncpy_s(&wszVersionLocal[0], cchVersionLocal, pwszVersion, _TRUNCATE);
-
- ICLRRuntimeInfo *pInfo = NULL;
- IfHrFailRet(Util::GetCLRRuntimeInfo(
- &pInfo,
- NULL,
- pConfigStream,
- pwszVersion == NULL ? NULL : &wszVersionLocal[0],
- pwszVersion == NULL ? NULL : &cchVersionLocal));
-
- // We're intentionally ignoring the HRESULT return value, since CorBindToRuntimeEx
- // always ignored these flags when a runtime had already been bound, and we need
- // to emulate that behavior for when multiple calls to CorBindToRuntimeEx are made
- // but with different startup flags (ICLRRuntimeInfo::SetDefaultStartupFlags will
- // return E_INVALIDARG in the case that the runtime has already been started with
- // different flags).
- Util::AddStartupFlags(pInfo, pwszBuildFlavor, startupFlags, pwszHostConfigFile);
-
- IfHrFailRet(pInfo->GetInterface(rclsid, riid, ppv));
- }
- else
- {
- CALL_LEGACY_API(CorBindToRuntimeHost,
- (LPCWSTR pwszVersion,
- LPCWSTR pwszBuildFlavor,
- LPCWSTR pwszHostConfigFile,
- VOID* pReserved,
- DWORD startupFlags,
- REFCLSID rclsid,
- REFIID riid,
- LPVOID FAR *ppv),
- (pwszVersion,
- pwszBuildFlavor,
- pwszHostConfigFile,
- pReserved,
- startupFlags,
- rclsid,
- riid,
- ppv));
- }
-
- return hr;
- }
-
- // --------------------------------------------------------------------------------------------
- inline
- HRESULT CorBindToRuntimeEx(
- LPCWSTR pwszVersion,
- LPCWSTR pwszBuildFlavor,
- DWORD startupFlags,
- REFCLSID rclsid,
- REFIID riid,
- LPVOID* ppv)
- {
- HRESULT hr = S_OK;
-
- if (Util::HasNewActivationAPIs())
- {
- WCHAR wszVersionLocal[512];
- DWORD cchVersionLocal = 512;
- if (pwszVersion != NULL)
- wcsncpy_s(&wszVersionLocal[0], cchVersionLocal, pwszVersion, _TRUNCATE);
-
- ICLRRuntimeInfo *pInfo = NULL;
- IfHrFailRet(Util::GetCLRRuntimeInfo(
- &pInfo,
- NULL, // exe path
- NULL, // config stream
- pwszVersion == NULL ? NULL : &wszVersionLocal[0],
- pwszVersion == NULL ? NULL : &cchVersionLocal));
-
- // We're intentionally ignoring the HRESULT return value, since CorBindToRuntimeEx
- // always ignored these flags when a runtime had already been bound, and we need
- // to emulate that behavior for when multiple calls to CorBindToRuntimeEx are made
- // but with different startup flags (ICLRRuntimeInfo::SetDefaultStartupFlags will
- // return E_INVALIDARG in the case that the runtime has already been started with
- // different flags).
- Util::AddStartupFlags(pInfo, pwszBuildFlavor, startupFlags, NULL);
-
- IfHrFailRet(pInfo->GetInterface(rclsid, riid, ppv));
- }
- else
- {
- CALL_LEGACY_API(CorBindToRuntimeEx,
- (LPCWSTR pwszVersion,
- LPCWSTR pwszBuildFlavor,
- DWORD startupFlags,
- REFCLSID rclsid,
- REFIID riid,
- LPVOID* ppv),
- (pwszVersion,
- pwszBuildFlavor,
- startupFlags,
- rclsid,
- riid,
- ppv));
- }
-
- return hr;
- }
-
- // --------------------------------------------------------------------------------------------
- inline
- HRESULT CorBindToRuntimeByCfg(
- IStream* pCfgStream,
- DWORD reserved,
- DWORD startupFlags,
- REFCLSID rclsid,
- REFIID riid,
- LPVOID* ppv)
- {
- HRESULT hr = S_OK;
-
- if (Util::HasNewActivationAPIs())
- {
- // The legacy CorBindToRuntimeByCfg picks up startup flags from both the config stream and
- // application config file if it is present. For simplicity, we ignore the app config here.
- ICLRRuntimeInfo *pInfo = NULL;
- IfHrFailRet(Util::GetCLRRuntimeInfo(
- &pInfo,
- NULL, // exe path
- pCfgStream));
-
- // We're intentionally ignoring the HRESULT return value, since CorBindToRuntimeEx
- // always ignored these flags when a runtime had already been bound, and we need
- // to emulate that behavior for when multiple calls to CorBindToRuntimeEx are made
- // but with different startup flags (ICLRRuntimeInfo::SetDefaultStartupFlags will
- // return E_INVALIDARG in the case that the runtime has already been started with
- // different flags).
- Util::AddStartupFlags(pInfo, NULL, startupFlags, NULL);
-
- IfHrFailRet(pInfo->GetInterface(rclsid, riid, ppv));
- }
- else
- {
- CALL_LEGACY_API(CorBindToRuntimeByCfg,
- (IStream* pCfgStream,
- DWORD reserved,
- DWORD startupFlags,
- REFCLSID rclsid,
- REFIID riid,
- LPVOID* ppv),
- (pCfgStream,
- reserved,
- startupFlags,
- rclsid,
- riid,
- ppv));
- }
-
- return hr;
- }
-
- // --------------------------------------------------------------------------------------------
- inline
- HRESULT CorBindToRuntime(
- LPCWSTR pwszVersion,
- LPCWSTR pwszBuildFlavor,
- REFCLSID rclsid,
- REFIID riid,
- LPVOID* ppv)
- {
- HRESULT hr = S_OK;
-
- if (Util::HasNewActivationAPIs())
- {
- WCHAR wszVersionLocal[512];
- DWORD cchVersionLocal = 512;
- if (pwszVersion != NULL)
- wcsncpy_s(&wszVersionLocal[0], cchVersionLocal, pwszVersion, _TRUNCATE);
-
- ICLRRuntimeInfo *pInfo = NULL;
- IfHrFailRet(Util::GetCLRRuntimeInfo(
- &pInfo,
- NULL, // exe path
- NULL, // config stream
- pwszVersion == NULL ? NULL : &wszVersionLocal[0],
- pwszVersion == NULL ? NULL : &cchVersionLocal));
-
- // CorBindToRuntime has its special default flags
- //
- // We're intentionally ignoring the HRESULT return value, since CorBindToRuntimeEx
- // always ignored these flags when a runtime had already been bound, and we need
- // to emulate that behavior for when multiple calls to CorBindToRuntimeEx are made
- // but with different startup flags (ICLRRuntimeInfo::SetDefaultStartupFlags will
- // return E_INVALIDARG in the case that the runtime has already been started with
- // different flags).
- Util::AddStartupFlags(pInfo, NULL, STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN_HOST, NULL);
-
- IfHrFailRet(pInfo->GetInterface(rclsid, riid, ppv));
- }
- else
- {
- CALL_LEGACY_API(CorBindToRuntime,
- (LPCWSTR pwszVersion,
- LPCWSTR pwszBuildFlavor,
- REFCLSID rclsid,
- REFIID riid,
- LPVOID* ppv),
- (pwszVersion,
- pwszBuildFlavor,
- rclsid,
- riid,
- ppv));
- }
-
- return hr;
- }
-
- // --------------------------------------------------------------------------------------------
- inline
- HRESULT CorBindToCurrentRuntime(
- LPCWSTR pwszFileName,
- REFCLSID rclsid,
- REFIID riid,
- LPVOID FAR *ppv)
- {
- HRESULT hr = S_OK;
-
- if (Util::HasNewActivationAPIs())
- {
- ICLRRuntimeInfo *pInfo = NULL;
- IfHrFailRet(Util::GetCLRRuntimeInfo(
- &pInfo,
- pwszFileName));
-
- IfHrFailRet(pInfo->GetInterface(rclsid, riid, ppv));
- }
- else
- {
- CALL_LEGACY_API(CorBindToCurrentRuntime,
- (LPCWSTR pwszFileName,
- REFCLSID rclsid,
- REFIID riid,
- LPVOID FAR *ppv),
- (pwszFileName,
- rclsid,
- riid,
- ppv));
- }
-
- return hr;
- }
-
- // --------------------------------------------------------------------------------------------
- inline
- HRESULT ClrCreateManagedInstance(
- LPCWSTR pTypeName,
- REFIID riid,
- void **ppObject)
- {
- HRESULT hr = S_OK;
-
- if (Util::HasNewActivationAPIs())
- {
- GET_CLRINFO(pInfo);
- HRESULT (STDMETHODCALLTYPE *pfnClrCreateManagedInstance)(LPCWSTR typeName, REFIID riid, void ** ppv) = NULL;
- IfHrFailRet(pInfo->GetProcAddress("ClrCreateManagedInstance", (LPVOID *)&pfnClrCreateManagedInstance));
- IfHrFailRet(pfnClrCreateManagedInstance(pTypeName, riid, ppObject));
- }
- else
- {
- CALL_LEGACY_API(ClrCreateManagedInstance,
- (LPCWSTR pTypeName,
- REFIID riid,
- void **ppObject),
- (pTypeName,
- riid,
- ppObject));
- }
-
- return hr;
- }
-
- // --------------------------------------------------------------------------------------------
- inline
- HRESULT LoadLibraryShim(
- LPCWSTR szDllName,
- LPCWSTR szVersion,
- LPVOID pvReserved,
- HMODULE *phModDll)
- {
- HRESULT hr = S_OK;
-
- if (Util::HasNewActivationAPIs())
- {
- Util::ReleaseHolder<ICLRRuntimeInfo*> hInfo;
- ICLRRuntimeInfo *pInfo = NULL;
-
- // Semantics of LoadLibraryShim is that a non-null version must match exactly.
- if (szVersion != NULL)
- {
- GET_CLRMETAHOST(pMH);
- IfHrFailRet(pMH->GetRuntime(szVersion, IID_ICLRRuntimeInfo, reinterpret_cast<LPVOID*>(&pInfo)));
- hInfo.Assign(pInfo);
- }
- else
- {
- IfHrFailRet(Util::GetCLRRuntimeInfo(&pInfo));
- }
- IfHrFailRet(pInfo->LoadLibrary(szDllName, phModDll));
- }
- else
- {
- CALL_LEGACY_API(LoadLibraryShim,
- (LPCWSTR szDllName,
- LPCWSTR szVersion,
- LPVOID pvReserved,
- HMODULE *phModDll),
- (szDllName,
- szVersion,
- pvReserved,
- phModDll));
- }
-
- return hr;
- }
-
- // --------------------------------------------------------------------------------------------
- inline
- HRESULT CallFunctionShim(
- LPCWSTR szDllName,
- LPCSTR szFunctionName,
- LPVOID lpvArgument1,
- LPVOID lpvArgument2,
- LPCWSTR szVersion,
- LPVOID pvReserved)
- {
- HRESULT hr = S_OK;
-
- if (Util::HasNewActivationAPIs())
- {
- HMODULE hMod = NULL;
- HRESULT (__stdcall * pfn)(LPVOID,LPVOID) = NULL;
-
- // Load library
- IfHrFailRet(LegacyActivationShim::LoadLibraryShim(szDllName, szVersion, pvReserved, &hMod));
-
- // NOTE: Legacy CallFunctionShim does not release HMODULE, leak to maintain compat
- // Util::HMODULEHolder hModHolder(hMod);
-
- // Find function.
- pfn = (HRESULT (__stdcall *)(LPVOID,LPVOID))GetProcAddress(hMod, szFunctionName);
- if (pfn == NULL)
- return HRESULT_FROM_WIN32(GetLastError());
-
- // Call it.
- return pfn(lpvArgument1, lpvArgument2);
- }
- else
- {
- CALL_LEGACY_API(CallFunctionShim,
- (LPCWSTR szDllName,
- LPCSTR szFunctionName,
- LPVOID lpvArgument1,
- LPVOID lpvArgument2,
- LPCWSTR szVersion,
- LPVOID pvReserved),
- (szDllName,
- szFunctionName,
- lpvArgument1,
- lpvArgument2,
- szVersion,
- pvReserved));
- }
-
- return hr;
- }
-
- // --------------------------------------------------------------------------------------------
- inline
- HRESULT GetRealProcAddress(
- LPCSTR pwszProcName,
- VOID **ppv)
- {
- HRESULT hr = S_OK;
-
- if (Util::HasNewActivationAPIs())
- {
- GET_CLRINFO(pInfo);
- IfHrFailRet(pInfo->GetProcAddress(pwszProcName, ppv));
- }
- else
- {
- CALL_LEGACY_API(GetRealProcAddress,
- (LPCSTR pwszProcName,
- VOID **ppv),
- (pwszProcName,
- ppv));
- }
-
- return hr;
- }
-
- // --------------------------------------------------------------------------------------------
- inline
- void CorExitProcess(
- int exitCode)
- {
-#ifndef LEGACY_ACTIVATION_SHIM_DELAY_LOAD
- ::CorExitProcess(exitCode);
-#else
- typedef void __stdcall t_CorExitProcess(
- int exitCode);
-
- Util::MscoreeFunctor<t_CorExitProcess> FN;
- if (FAILED(FN.Init("CorExitProcess")))
- return;
-
- FN()(exitCode);
-#endif
- }
-
-// Define this method only if it is not yet defined as macro (see ndp\clr\src\inc\UtilCode.h).
-#ifndef LoadStringRC
- // --------------------------------------------------------------------------------------------
- inline
- HRESULT LoadStringRC(
- UINT nResourceID,
- __out_ecount(nMax) LPWSTR szBuffer,
- int nMax,
- int fQuiet)
- {
- HRESULT hr = S_OK;
-
- if (Util::HasNewActivationAPIs())
- {
- GET_CLRINFO(pInfo);
- DWORD cchMax = static_cast<DWORD>(nMax);
- IfHrFailRet(pInfo->LoadErrorString(nResourceID, szBuffer, &cchMax, -1));
- }
- else
- {
- CALL_LEGACY_API(LoadStringRC,
- (UINT nResourceID,
- LPWSTR szBuffer,
- int nMax,
- int fQuiet),
- (nResourceID,
- szBuffer,
- nMax,
- fQuiet));
- }
-
- return hr;
- }
-#endif //LoadStringRC
-
-// Define this method only if it is not yet defined as macro (see ndp\clr\src\inc\UtilCode.h).
-#if !defined(LoadStringRCEx) && !defined(FEATURE_CORESYSTEM)
- // --------------------------------------------------------------------------------------------
- inline
- HRESULT LoadStringRCEx(
- LCID lcid,
- UINT nResourceID,
- __out_ecount(nMax) LPWSTR szBuffer,
- int nMax,
- int fQuiet,
- int *pcwchUsed)
- {
- HRESULT hr = S_OK;
-
- if (Util::HasNewActivationAPIs())
- {
- GET_CLRINFO(pInfo);
- DWORD cchUsed = static_cast<DWORD>(nMax);
- IfHrFailRet(pInfo->LoadErrorString(nResourceID, szBuffer, &cchUsed, lcid));
- *pcwchUsed = cchUsed;
- }
- else
- {
- CALL_LEGACY_API(LoadStringRCEx,
- (LCID lcid,
- UINT nResourceID,
- LPWSTR szBuffer,
- int nMax,
- int fQuiet,
- int *pcwchUsed),
- (lcid,
- nResourceID,
- szBuffer,
- nMax,
- fQuiet,
- pcwchUsed));
- }
-
- return hr;
- }
-#endif //LoadStringRCEx
-
- // --------------------------------------------------------------------------------------------
- inline
- HRESULT LockClrVersion(
- FLockClrVersionCallback hostCallback,
- FLockClrVersionCallback *pBeginHostSetup,
- FLockClrVersionCallback *pEndHostSetup)
- {
- HRESULT hr = S_OK;
-
- CALL_LEGACY_API(LockClrVersion,
- (FLockClrVersionCallback hostCallback,
- FLockClrVersionCallback *pBeginHostSetup,
- FLockClrVersionCallback *pEndHostSetup),
- (hostCallback,
- pBeginHostSetup,
- pEndHostSetup));
-
- return hr;
- }
-
- // --------------------------------------------------------------------------------------------
- inline
- HRESULT CreateDebuggingInterfaceFromVersion(
- int nDebuggerVersion,
- LPCWSTR szDebuggeeVersion,
- IUnknown ** ppCordb)
- {
- HRESULT hr = S_OK;
-
- CALL_LEGACY_API(CreateDebuggingInterfaceFromVersion,
- (int nDebuggerVersion,
- LPCWSTR szDebuggeeVersion,
- IUnknown ** ppCordb),
- (nDebuggerVersion,
- szDebuggeeVersion,
- ppCordb));
-
- return hr;
- }
-
- // --------------------------------------------------------------------------------------------
- inline
- HRESULT GetVersionFromProcess(
- __in HANDLE hProcess,
- __out_ecount(cchBuffer) LPWSTR pVersion,
- __in DWORD cchBuffer,
- __out DWORD *pdwLength)
- {
- HRESULT hr = S_OK;
-
- CALL_LEGACY_API(GetVersionFromProcess,
- (HANDLE hProcess,
- LPWSTR pVersion,
- DWORD cchBuffer,
- DWORD *pdwLength),
- (hProcess,
- pVersion,
- cchBuffer,
- pdwLength));
-
- return hr;
- }
-
- // --------------------------------------------------------------------------------------------
-// CoInitializeEE is declared in cor.h, define it only if explicitly requested
-#ifdef LEGACY_ACTIVATION_SHIM_DEFINE_CoInitializeEE
- inline
- HRESULT CoInitializeEE(DWORD flags)
- {
- HRESULT hr = S_OK;
-
- if (Util::HasNewActivationAPIs())
- {
- GET_CLRINFO(pInfo);
- HRESULT (* pfnCoInitializeEE)(DWORD);
- IfHrFailRet(pInfo->GetProcAddress("CoInitializeEE", (LPVOID *)&pfnCoInitializeEE));
- return (*pfnCoInitializeEE)(flags);
- }
- else
- {
- CALL_LEGACY_API(CoInitializeEE,
- (DWORD flags),
- (flags));
- }
-
- return hr;
- }
-
- inline
- VOID CoUninitializeEE(BOOL flags)
- {
- if (Util::HasNewActivationAPIs())
- {
- ICLRRuntimeInfo *pInfo = NULL;
- if (FAILED(Util::GetCLRRuntimeInfo(&pInfo)))
- return;
-
- VOID (* pfnCoUninitializeEE)(BOOL);
- if (FAILED(pInfo->GetProcAddress("CoUninitializeEE", (LPVOID *)&pfnCoUninitializeEE)))
- return;
-
- (*pfnCoUninitializeEE)(flags);
- }
- else
- {
- CALL_LEGACY_API_VOIDRET(CoUninitializeEE,
- (BOOL flags),
- (flags));
- }
- }
-
- inline
- HRESULT CoInitializeCor(DWORD flags)
- {
- HRESULT hr = S_OK;
-
- if (Util::HasNewActivationAPIs())
- {
- GET_CLRINFO(pInfo);
- HRESULT (* pfnCoInitializeCor)(DWORD);
- IfHrFailRet(pInfo->GetProcAddress("CoInitializeCor", (LPVOID *)&pfnCoInitializeCor));
- return (*pfnCoInitializeCor)(flags);
- }
- else
- {
- CALL_LEGACY_API(CoInitializeCor,
- (DWORD flags),
- (flags));
- }
-
- return hr;
- }
-
- inline
- VOID CoUninitializeCor()
- {
- if (Util::HasNewActivationAPIs())
- {
- ICLRRuntimeInfo *pInfo = NULL;
- if (FAILED(Util::GetCLRRuntimeInfo(&pInfo)))
- return;
-
- VOID (* pfnCoUninitializeCor)();
- if (FAILED(pInfo->GetProcAddress("CoUninitializeCor", (LPVOID *)&pfnCoUninitializeCor)))
- return;
-
- (*pfnCoUninitializeCor)();
- }
- else
- {
- CALL_LEGACY_API_VOIDRET(CoUninitializeCor,
- (VOID),
- ());
- }
- }
-
-#endif //LEGACY_ACTIVATION_SHIM_DEFINE_CoInitializeEE
-
- // --------------------------------------------------------------------------------------------
-// CoEEShutDownCOM is declared in cor.h, define it only if explicitly requested
-#ifdef LEGACY_ACTIVATION_SHIM_DEFINE_CoEEShutDownCOM
- inline
- void CoEEShutDownCOM()
- {
- if (Util::HasNewActivationAPIs())
- {
- ICLRRuntimeInfo *pInfo = NULL;
- IfHrFailRetVOID(Util::GetCLRRuntimeInfo(&pInfo));
- void (* pfnCoEEShutDownCOM)();
- IfHrFailRetVOID(pInfo->GetProcAddress("CoEEShutDownCOM", (LPVOID *)&pfnCoEEShutDownCOM));
- (*pfnCoEEShutDownCOM)();
- }
- else
- {
- CALL_LEGACY_API_VOIDRET(CoEEShutDownCOM,
- (),
- ());
- }
-
- return;
- }
-#endif //LEGACY_ACTIVATION_SHIM_DEFINE_CoEEShutDownCOM
-
- // ---StrongName Function Helpers--------------------------------------------------------------
-#if !defined(LEGACY_ACTIVATION_SHIM_DELAY_LOAD) && defined(__STRONG_NAME_H)
-#define LEGACY_STRONGNAME_API_PASS_THROUGH(_name, _ret_type, _ret_value, _sig, _args) \
- LEGACY_API_PASS_THROUGH_STATIC(_name, _ret_type, _ret_value, _sig, _args)
-#define LEGACY_STRONGNAME_API_PASS_THROUGH_VOIDRET(_name, _sig, _args) \
- LEGACY_API_PASS_THROUGH_STATIC_VOIDRET(_name, _sig, _args)
-#else //defined(LEGACY_ACTIVATION_SHIM_DELAY_LOAD) || !defined(__STRONG_NAME_H)
-#define LEGACY_STRONGNAME_API_PASS_THROUGH(_name, _ret_type, _ret_value, _sig, _args) \
- LEGACY_API_PASS_THROUGH_DELAYLOAD(_name, _ret_type, _ret_value, _sig, _args)
-#define LEGACY_STRONGNAME_API_PASS_THROUGH_VOIDRET(_name, _sig, _args) \
- LEGACY_API_PASS_THROUGH_DELAYLOAD_VOIDRET(_name, _sig, _args)
-#endif //defined(LEGACY_ACTIVATION_SHIM_DELAY_LOAD) || !defined(__STRONG_NAME_H)
-
-// Defines a method that just delegates a call to the right runtime, this one is for SN APIs that
-// return HRESULT.
-#define PASS_THROUGH_IMPL_HRESULT(_name, _signature, _args) \
- inline \
- HRESULT _name##_signature \
- { \
- HRESULT hr = S_OK; \
- if (Util::HasNewActivationAPIs()) \
- { \
- ICLRStrongName *pSN = NULL; \
- IfHrFailRet(Util::GetCLRStrongName(&pSN)); \
- IfHrFailRet(pSN->_name _args); \
- } \
- else \
- { \
- LEGACY_STRONGNAME_API_PASS_THROUGH( \
- _name, HRESULT, hr, _signature, _args); \
- IfHrFailRet(hr); \
- } \
- return hr; \
- }
-
-// Defines a method that just delegates a call to the right runtime, this one is for SN APIs that
-// return BOOL.
-#define PASS_THROUGH_IMPL_BOOLEAN(_name, _signature, _args) \
- inline \
- BOOL _name##_signature \
- { \
- HRESULT hr = S_OK; \
- if (Util::HasNewActivationAPIs()) \
- { \
- ICLRStrongName *pSN = NULL; \
- IfHrFailRetFALSE(Util::GetCLRStrongName(&pSN)); \
- IfHrFailRetFALSE(pSN->_name _args); \
- return TRUE; \
- } \
- else \
- { \
- BOOL fResult = TRUE; \
- LEGACY_STRONGNAME_API_PASS_THROUGH( \
- _name, BOOL, fResult, _signature, _args); \
- IfHrFailRetFALSE(hr); \
- return fResult; \
- } \
- }
-
-// Defines a method that just delegates a call to the right runtime, this one is for SN APIs that
-// return VOID.
-#define PASS_THROUGH_IMPL_VOID(_name, _signature, _args) \
- inline \
- VOID _name##_signature \
- { \
- HRESULT hr = S_OK; \
- if (Util::HasNewActivationAPIs()) \
- { \
- ICLRStrongName *pSN = NULL; \
- IfHrFailRetVOID(Util::GetCLRStrongName(&pSN)); \
- IfHrFailRetVOID(pSN->_name _args); \
- return; \
- } \
- else \
- { \
- LEGACY_STRONGNAME_API_PASS_THROUGH_VOIDRET( \
- _name, _signature, _args); \
- IfHrFailRetVOID(hr); \
- return; \
- } \
- }
-
- // ---StrongName functions---------------------------------------------------------------------
-
-PASS_THROUGH_IMPL_HRESULT(GetHashFromAssemblyFile,
- (LPCSTR pszFilePath, unsigned int *piHashAlg, BYTE *pbHash, DWORD cchHash, DWORD *pchHash),
- (pszFilePath, piHashAlg, pbHash, cchHash, pchHash));
-
-PASS_THROUGH_IMPL_HRESULT(GetHashFromAssemblyFileW,
- (LPCWSTR pwzFilePath, unsigned int *piHashAlg, BYTE *pbHash, DWORD cchHash, DWORD *pchHash),
- (pwzFilePath, piHashAlg, pbHash, cchHash, pchHash));
-
-PASS_THROUGH_IMPL_HRESULT(GetHashFromBlob,
- (BYTE *pbBlob, DWORD cchBlob, unsigned int *piHashAlg, BYTE *pbHash, DWORD cchHash, DWORD *pchHash),
- (pbBlob, cchBlob, piHashAlg, pbHash, cchHash, pchHash));
-
-PASS_THROUGH_IMPL_HRESULT(GetHashFromFile,
- (LPCSTR pszFilePath, unsigned int *piHashAlg, BYTE *pbHash, DWORD cchHash, DWORD *pchHash),
- (pszFilePath, piHashAlg, pbHash, cchHash, pchHash));
-
-PASS_THROUGH_IMPL_HRESULT(GetHashFromFileW,
- (LPCWSTR pwzFilePath, unsigned int *piHashAlg, BYTE *pbHash, DWORD cchHash, DWORD *pchHash),
- (pwzFilePath, piHashAlg, pbHash, cchHash, pchHash));
-
-PASS_THROUGH_IMPL_HRESULT(GetHashFromHandle,
- (HANDLE hFile, unsigned int *piHashAlg, BYTE *pbHash, DWORD cchHash, DWORD *pchHash),
- (hFile, piHashAlg, pbHash, cchHash, pchHash));
-
-PASS_THROUGH_IMPL_BOOLEAN(StrongNameCompareAssemblies,
- (LPCWSTR pwzAssembly1, LPCWSTR pwzAssembly2, DWORD *pdwResult),
- (pwzAssembly1, pwzAssembly2, pdwResult));
-
-PASS_THROUGH_IMPL_VOID(StrongNameFreeBuffer,
- (BYTE *pbMemory),
- (pbMemory));
-
-PASS_THROUGH_IMPL_BOOLEAN(StrongNameGetBlob,
- (LPCWSTR pwzFilePath, BYTE *pbBlob, DWORD *pcbBlob),
- (pwzFilePath, pbBlob, pcbBlob));
-
-PASS_THROUGH_IMPL_BOOLEAN(StrongNameGetBlobFromImage,
- (BYTE *pbBase, DWORD dwLength, BYTE *pbBlob, DWORD *pcbBlob),
- (pbBase, dwLength, pbBlob, pcbBlob));
-
-PASS_THROUGH_IMPL_BOOLEAN(StrongNameGetPublicKey,
- (LPCWSTR pwzKeyContainer, BYTE *pbKeyBlob, ULONG cbKeyBlob, BYTE **ppbPublicKeyBlob, ULONG *pcbPublicKeyBlob),
- (pwzKeyContainer, pbKeyBlob, cbKeyBlob, ppbPublicKeyBlob, pcbPublicKeyBlob));
-
-PASS_THROUGH_IMPL_BOOLEAN(StrongNameHashSize,
- (ULONG ulHashAlg, DWORD *pcbSize),
- (ulHashAlg, pcbSize));
-
-PASS_THROUGH_IMPL_BOOLEAN(StrongNameKeyDelete,
- (LPCWSTR pwzKeyContainer),
- (pwzKeyContainer));
-
-PASS_THROUGH_IMPL_BOOLEAN(StrongNameKeyGen,
- (LPCWSTR pwzKeyContainer, DWORD dwFlags, BYTE **ppbKeyBlob, ULONG *pcbKeyBlob),
- (pwzKeyContainer, dwFlags, ppbKeyBlob, pcbKeyBlob));
-
-PASS_THROUGH_IMPL_BOOLEAN(StrongNameKeyGenEx,
- (LPCWSTR pwzKeyContainer, DWORD dwFlags, DWORD dwKeySize, BYTE **ppbKeyBlob, ULONG *pcbKeyBlob),
- (pwzKeyContainer, dwFlags, dwKeySize, ppbKeyBlob, pcbKeyBlob));
-
-PASS_THROUGH_IMPL_BOOLEAN(StrongNameKeyInstall,
- (LPCWSTR pwzKeyContainer, BYTE *pbKeyBlob, ULONG cbKeyBlob),
- (pwzKeyContainer, pbKeyBlob, cbKeyBlob));
-
-PASS_THROUGH_IMPL_BOOLEAN(StrongNameSignatureGeneration,
- (LPCWSTR pwzFilePath, LPCWSTR pwzKeyContainer, BYTE *pbKeyBlob, ULONG cbKeyBlob, BYTE **ppbSignatureBlob, ULONG *pcbSignatureBlob),
- (pwzFilePath, pwzKeyContainer, pbKeyBlob, cbKeyBlob, ppbSignatureBlob, pcbSignatureBlob));
-
-PASS_THROUGH_IMPL_BOOLEAN(StrongNameSignatureGenerationEx,
- (LPCWSTR wszFilePath, LPCWSTR wszKeyContainer, BYTE *pbKeyBlob, ULONG cbKeyBlob, BYTE **ppbSignatureBlob, ULONG *pcbSignatureBlob, DWORD dwFlags),
- (wszFilePath, wszKeyContainer, pbKeyBlob, cbKeyBlob, ppbSignatureBlob, pcbSignatureBlob, dwFlags));
-
-PASS_THROUGH_IMPL_BOOLEAN(StrongNameSignatureSize,
- (BYTE *pbPublicKeyBlob, ULONG cbPublicKeyBlob, DWORD *pcbSize),
- (pbPublicKeyBlob, cbPublicKeyBlob, pcbSize));
-
-PASS_THROUGH_IMPL_BOOLEAN(StrongNameSignatureVerification,
- (LPCWSTR pwzFilePath, DWORD dwInFlags, DWORD *pdwOutFlags),
- (pwzFilePath, dwInFlags, pdwOutFlags));
-
-PASS_THROUGH_IMPL_BOOLEAN(StrongNameSignatureVerificationEx,
- (LPCWSTR pwzFilePath, BOOLEAN fForceVerification, BOOLEAN *pfWasVerified),
- (pwzFilePath, fForceVerification, pfWasVerified));
-
-PASS_THROUGH_IMPL_BOOLEAN(StrongNameSignatureVerificationFromImage,
- (BYTE *pbBase, DWORD dwLength, DWORD dwInFlags, DWORD *pdwOutFlags),
- (pbBase, dwLength, dwInFlags, pdwOutFlags));
-
-PASS_THROUGH_IMPL_BOOLEAN(StrongNameTokenFromAssembly,
- (LPCWSTR pwzFilePath, BYTE **ppbStrongNameToken, ULONG *pcbStrongNameToken),
- (pwzFilePath, ppbStrongNameToken, pcbStrongNameToken));
-
-PASS_THROUGH_IMPL_BOOLEAN(StrongNameTokenFromAssemblyEx,
- (LPCWSTR pwzFilePath, BYTE **ppbStrongNameToken, ULONG *pcbStrongNameToken, BYTE **ppbPublicKeyBlob, ULONG *pcbPublicKeyBlob),
- (pwzFilePath, ppbStrongNameToken, pcbStrongNameToken, ppbPublicKeyBlob, pcbPublicKeyBlob));
-
-PASS_THROUGH_IMPL_BOOLEAN(StrongNameTokenFromPublicKey,
- (BYTE *pbPublicKeyBlob, ULONG cbPublicKeyBlob, BYTE **ppbStrongNameToken, ULONG *pcbStrongNameToken),
- (pbPublicKeyBlob, cbPublicKeyBlob, ppbStrongNameToken, pcbStrongNameToken));
-
-#undef PASS_THROUGH_IMPL_HRESULT
-#undef PASS_THROUGH_IMPL_BOOLEAN
-#undef PASS_THROUGH_IMPL_VOID
-
-// Defines a method that just delegates a call to the right runtime, this one is for SN APIs that
-// return BOOLEAN.
-#define WRAP_HRESULT_IMPL_BOOLEAN(_WrapperName, _name, _signature, _args) \
- inline \
- HRESULT _WrapperName##_signature \
- { \
- HRESULT hr = S_OK; \
- if (Util::HasNewActivationAPIs()) \
- { \
- ICLRStrongName *pSN = NULL; \
- IfHrFailRet(Util::GetCLRStrongName(&pSN)); \
- return pSN->_name _args; \
- } \
- else \
- { \
- typedef BOOL __stdcall t_FN _signature; \
- Util::MscoreeFunctor<t_FN> FN; \
- IfHrFailRet(FN.Init(#_name)); \
- if ((FN() _args)) \
- { \
- return S_OK; \
- } \
- else \
- { /*@TODO: Static bind version, if necessary*/ \
- typedef DWORD __stdcall t_FNStrongNameErrorInfo(void); \
- Util::MscoreeFunctor<t_FNStrongNameErrorInfo> FNStrongNameErrorInfo; \
- IfHrFailRet(FNStrongNameErrorInfo.Init("StrongNameErrorInfo")); \
- HRESULT hrResult = (HRESULT)FNStrongNameErrorInfo() (); \
- if (SUCCEEDED(hrResult)) \
- { \
- hrResult = E_FAIL; \
- } \
- return hrResult; \
- } \
- } \
- }
-
-WRAP_HRESULT_IMPL_BOOLEAN(StrongNameHashSize_HRESULT,
- StrongNameHashSize,
- (ULONG ulHashAlg, DWORD *pcbSize),
- (ulHashAlg, pcbSize));
-
-WRAP_HRESULT_IMPL_BOOLEAN(StrongNameTokenFromPublicKey_HRESULT,
- StrongNameTokenFromPublicKey,
- (BYTE *pbPublicKeyBlob, ULONG cbPublicKeyBlob, BYTE **ppbStrongNameToken, ULONG *pcbStrongNameToken),
- (pbPublicKeyBlob, cbPublicKeyBlob, ppbStrongNameToken, pcbStrongNameToken));
-
-WRAP_HRESULT_IMPL_BOOLEAN(StrongNameSignatureSize_HRESULT,
- StrongNameSignatureSize,
- (BYTE *pbPublicKeyBlob, ULONG cbPublicKeyBlob, DWORD *pcbSize),
- (pbPublicKeyBlob, cbPublicKeyBlob, pcbSize));
-
-WRAP_HRESULT_IMPL_BOOLEAN(StrongNameGetPublicKey_HRESULT,
- StrongNameGetPublicKey,
- (LPCWSTR pwzKeyContainer, BYTE *pbKeyBlob, ULONG cbKeyBlob, BYTE **ppbPublicKeyBlob, ULONG *pcbPublicKeyBlob),
- (pwzKeyContainer, pbKeyBlob, cbKeyBlob, ppbPublicKeyBlob, pcbPublicKeyBlob));
-
-WRAP_HRESULT_IMPL_BOOLEAN(StrongNameKeyInstall_HRESULT,
- StrongNameKeyInstall,
- (LPCWSTR pwzKeyContainer, BYTE *pbKeyBlob, ULONG cbKeyBlob),
- (pwzKeyContainer, pbKeyBlob, cbKeyBlob));
-
-WRAP_HRESULT_IMPL_BOOLEAN(StrongNameSignatureGeneration_HRESULT,
- StrongNameSignatureGeneration,
- (LPCWSTR pwzFilePath, LPCWSTR pwzKeyContainer, BYTE *pbKeyBlob, ULONG cbKeyBlob, BYTE **ppbSignatureBlob, ULONG *pcbSignatureBlob),
- (pwzFilePath, pwzKeyContainer, pbKeyBlob, cbKeyBlob, ppbSignatureBlob, pcbSignatureBlob));
-
-WRAP_HRESULT_IMPL_BOOLEAN(StrongNameKeyGen_HRESULT,
- StrongNameKeyGen,
- (LPCWSTR pwzKeyContainer, DWORD dwFlags, BYTE **ppbKeyBlob, ULONG *pcbKeyBlob),
- (pwzKeyContainer, dwFlags, ppbKeyBlob, pcbKeyBlob));
-
-#undef WRAP_HRESULT_IMPL_BOOLEAN
-
-// Defines a method that just delegates a call to the right runtime, this one is for ICLRStrongName2
-// APIs that return BOOLEAN.
-#define WRAP_HRESULT_IMPL_BOOLEAN(_WrapperName, _name, _signature, _args) \
- inline \
- HRESULT _WrapperName##_signature \
- { \
- HRESULT hr = S_OK; \
- if (Util::HasNewActivationAPIs()) \
- { \
- ICLRStrongName2 *pSN = NULL; \
- IfHrFailRet(Util::GetCLRStrongName2(&pSN)); \
- return pSN->_name _args; \
- } \
- else \
- { \
- return E_FAIL; \
- } \
- }
-
-
-WRAP_HRESULT_IMPL_BOOLEAN(StrongNameGetPublicKeyEx_HRESULT,
- StrongNameGetPublicKeyEx,
- (LPCWSTR pwzKeyContainer, BYTE *pbKeyBlob, ULONG cbKeyBlob, BYTE **ppbPublicKeyBlob, ULONG *pcbPublicKeyBlob, ULONG uHashAlgId, ULONG uReserved),
- (pwzKeyContainer, pbKeyBlob, cbKeyBlob, ppbPublicKeyBlob, pcbPublicKeyBlob, uHashAlgId, uReserved));
-
-#undef WRAP_HRESULT_IMPL_BOOLEAN
-
- inline
- HRESULT ClrCoCreateInstance(
- REFCLSID rclsid,
- LPUNKNOWN pUnkOuter,
- DWORD dwClsContext,
- REFIID riid,
- LPVOID * ppv)
- {
- HRESULT hr = S_OK;
-
- if (Util::HasNewActivationAPIs() /*&& Util::IsCLSIDHostedByClr(rclsid)*/)
- {
- GET_CLRINFO(pInfo);
- IfHrFailRet(pInfo->GetInterface(rclsid, riid, ppv));
- }
- else
- {
- IfHrFailRet(::CoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv));
- }
-
- return hr;
- }
-}; // namespace LegacyActivationShim
-#pragma warning(pop) // Revert C4996 status
-
-#undef LEGACY_API_PASS_THROUGH_STATIC
-#undef LEGACY_API_PASS_THROUGH_STATIC_VOIDRET
-#undef LEGACY_API_PASS_THROUGH_DELAYLOAD
-#undef LEGACY_API_PASS_THROUGH_DELAYLOAD_VOIDRET
-#undef CALL_LEGACY_API
-#undef LEGACY_STRONGNAME_API_PASS_THROUGH
-#undef LEGACY_STRONGNAME_API_PASS_THROUGH_VOIDRET
-
-#undef LEGACY_ACTIVATION_SHIM_DEFAULT_PRODUCT_VER_HELPER_L
-#undef LEGACY_ACTIVATION_SHIM_DEFAULT_PRODUCT_VER_STR_L
-
-#pragma pop_macro("IfHrFailRetVOID")
-#pragma pop_macro("IfHrFailRetFALSE")
-#pragma pop_macro("IfHrFailRet")
-
-#ifdef _MANAGED
-// We are compiling Managed C++, restore previous managed/native status from the stack
-#pragma managed(pop)
-#endif //_MANAGED
-
-#pragma warning(pop)
-
-#endif // __LEGACYACTIVATIONSHIM_H__
diff --git a/src/inc/legacyactivationshimdelayload.h b/src/inc/legacyactivationshimdelayload.h
deleted file mode 100644
index 8e77ff2ce3..0000000000
--- a/src/inc/legacyactivationshimdelayload.h
+++ /dev/null
@@ -1,13 +0,0 @@
-// 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.
-//
-
-#ifndef __LEGACYACTIVATIONSHIMDELAYLOAD_H__
-#define __LEGACYACTIVATIONSHIMDELAYLOAD_H__
-
-#define LEGACY_ACTIVATION_SHIM_DELAY_LOAD
-#include <legacyactivationshim.h>
-#undef LEGACY_ACTIVATION_SHIM_DELAY_LOAD
-
-#endif //__LEGACYACTIVATIONSHIMDELAYLOAD_H__
diff --git a/src/inc/loglf.h b/src/inc/loglf.h
index ea121cda7c..e7fbd519d9 100644
--- a/src/inc/loglf.h
+++ b/src/inc/loglf.h
@@ -4,39 +4,39 @@
// The code in sos.DumpLog depends on the first 32 facility codes
// being bit flags sorted in incresing order.
-DEFINE_LOG_FACILITY(LF_GC ,0x00000001)
-DEFINE_LOG_FACILITY(LF_GCINFO ,0x00000002)
-DEFINE_LOG_FACILITY(LF_STUBS ,0x00000004)
-DEFINE_LOG_FACILITY(LF_JIT ,0x00000008)
-DEFINE_LOG_FACILITY(LF_LOADER ,0x00000010)
-DEFINE_LOG_FACILITY(LF_METADATA ,0x00000020)
-DEFINE_LOG_FACILITY(LF_SYNC ,0x00000040)
-DEFINE_LOG_FACILITY(LF_EEMEM ,0x00000080)
-DEFINE_LOG_FACILITY(LF_GCALLOC ,0x00000100)
-DEFINE_LOG_FACILITY(LF_CORDB ,0x00000200)
-DEFINE_LOG_FACILITY(LF_CLASSLOADER ,0x00000400)
-DEFINE_LOG_FACILITY(LF_CORPROF ,0x00000800)
-DEFINE_LOG_FACILITY(LF_REMOTING ,0x00001000)
-DEFINE_LOG_FACILITY(LF_DBGALLOC ,0x00002000)
-DEFINE_LOG_FACILITY(LF_EH ,0x00004000)
-DEFINE_LOG_FACILITY(LF_ENC ,0x00008000)
-DEFINE_LOG_FACILITY(LF_ASSERT ,0x00010000)
-DEFINE_LOG_FACILITY(LF_VERIFIER ,0x00020000)
-DEFINE_LOG_FACILITY(LF_THREADPOOL ,0x00040000)
-DEFINE_LOG_FACILITY(LF_GCROOTS ,0x00080000)
-DEFINE_LOG_FACILITY(LF_INTEROP ,0x00100000)
-DEFINE_LOG_FACILITY(LF_MARSHALER ,0x00200000)
-DEFINE_LOG_FACILITY(LF_IJW ,0x00400000)
-DEFINE_LOG_FACILITY(LF_ZAP ,0x00800000)
-DEFINE_LOG_FACILITY(LF_STARTUP ,0x01000000) // Log startupa and shutdown failures
-DEFINE_LOG_FACILITY(LF_APPDOMAIN ,0x02000000)
-DEFINE_LOG_FACILITY(LF_CODESHARING ,0x04000000)
-DEFINE_LOG_FACILITY(LF_STORE ,0x08000000)
-DEFINE_LOG_FACILITY(LF_SECURITY ,0x10000000)
-DEFINE_LOG_FACILITY(LF_LOCKS ,0x20000000)
-DEFINE_LOG_FACILITY(LF_BCL ,0x40000000)
-// LF_ALWAYS 0x80000000 // make certain you don't try to use this bit for a real facility
-// LF_ALL 0xFFFFFFFF
+DEFINE_LOG_FACILITY(LF_GC ,0x00000001)
+DEFINE_LOG_FACILITY(LF_GCINFO ,0x00000002)
+DEFINE_LOG_FACILITY(LF_STUBS ,0x00000004)
+DEFINE_LOG_FACILITY(LF_JIT ,0x00000008)
+DEFINE_LOG_FACILITY(LF_LOADER ,0x00000010)
+DEFINE_LOG_FACILITY(LF_METADATA ,0x00000020)
+DEFINE_LOG_FACILITY(LF_SYNC ,0x00000040)
+DEFINE_LOG_FACILITY(LF_EEMEM ,0x00000080)
+DEFINE_LOG_FACILITY(LF_GCALLOC ,0x00000100)
+DEFINE_LOG_FACILITY(LF_CORDB ,0x00000200)
+DEFINE_LOG_FACILITY(LF_CLASSLOADER ,0x00000400)
+DEFINE_LOG_FACILITY(LF_CORPROF ,0x00000800)
+DEFINE_LOG_FACILITY(LF_REMOTING ,0x00001000)
+DEFINE_LOG_FACILITY(LF_DBGALLOC ,0x00002000)
+DEFINE_LOG_FACILITY(LF_EH ,0x00004000)
+DEFINE_LOG_FACILITY(LF_ENC ,0x00008000)
+DEFINE_LOG_FACILITY(LF_ASSERT ,0x00010000)
+DEFINE_LOG_FACILITY(LF_VERIFIER ,0x00020000)
+DEFINE_LOG_FACILITY(LF_THREADPOOL ,0x00040000)
+DEFINE_LOG_FACILITY(LF_GCROOTS ,0x00080000)
+DEFINE_LOG_FACILITY(LF_INTEROP ,0x00100000)
+DEFINE_LOG_FACILITY(LF_MARSHALER ,0x00200000)
+DEFINE_LOG_FACILITY(LF_TIEREDCOMPILATION ,0x00400000) // This used to be IJW, but now repurposed for tiered compilation
+DEFINE_LOG_FACILITY(LF_ZAP ,0x00800000)
+DEFINE_LOG_FACILITY(LF_STARTUP ,0x01000000) // Log startupa and shutdown failures
+DEFINE_LOG_FACILITY(LF_APPDOMAIN ,0x02000000)
+DEFINE_LOG_FACILITY(LF_CODESHARING ,0x04000000)
+DEFINE_LOG_FACILITY(LF_STORE ,0x08000000)
+DEFINE_LOG_FACILITY(LF_SECURITY ,0x10000000)
+DEFINE_LOG_FACILITY(LF_LOCKS ,0x20000000)
+DEFINE_LOG_FACILITY(LF_BCL ,0x40000000)
+// LF_ALWAYS 0x80000000 // make certain you don't try to use this bit for a real facility
+// LF_ALL 0xFFFFFFFF
//
#undef DEFINE_LOG_FACILITY
diff --git a/src/inc/profilepriv.h b/src/inc/profilepriv.h
index f74818c731..ae7b225f8c 100644
--- a/src/inc/profilepriv.h
+++ b/src/inc/profilepriv.h
@@ -148,9 +148,9 @@ GVAL_DECL(ProfControlBlock, g_profControlBlock);
#endif // defined(PROFILING_SUPPORTED_DATA) || defined(PROFILING_SUPPORTED)
// This is the helper callback that the gc uses when walking the heap.
-BOOL HeapWalkHelper(Object* pBO, void* pv);
+bool HeapWalkHelper(Object* pBO, void* pv);
void ScanRootsHelper(Object* pObj, Object** ppRoot, ScanContext *pSC, uint32_t dwUnused);
-BOOL AllocByClassHelper(Object* pBO, void* pv);
+bool AllocByClassHelper(Object* pBO, void* pv);
#endif // _ProfilePriv_h_
diff --git a/src/inc/regdisp.h b/src/inc/regdisp.h
index 90669dc9bc..a361dca719 100644
--- a/src/inc/regdisp.h
+++ b/src/inc/regdisp.h
@@ -396,7 +396,7 @@ inline void FillRegDisplay(const PREGDISPLAY pRD, PT_CONTEXT pctx, PT_CONTEXT pC
#elif defined(_TARGET_X86_) // _TARGET_ARM_
for (int i = 0; i < 7; i++)
{
- *(&pRD->ctxPtrsOne.Esi + i) = (&pctx->Esi + i);
+ *(&pRD->ctxPtrsOne.Edi + i) = (&pctx->Edi + i);
}
#else // _TARGET_X86_
PORTABILITY_ASSERT("FillRegDisplay");
diff --git a/src/inc/volatile.h b/src/inc/volatile.h
index c295f98696..9531d98085 100644
--- a/src/inc/volatile.h
+++ b/src/inc/volatile.h
@@ -479,7 +479,7 @@ public:
#else
// Disable use of Volatile<T> for GC/HandleTable code except on platforms where it's absolutely necessary.
-#if defined(_MSC_VER) && !defined(_ARM_)
+#if defined(_MSC_VER) && !defined(_ARM_) && !defined(_ARM64_)
#define VOLATILE(T) T RAW_KEYWORD(volatile)
#else
#define VOLATILE(T) Volatile<T>
diff --git a/src/inc/winwrap.h b/src/inc/winwrap.h
index be098156a2..820d64bdff 100644
--- a/src/inc/winwrap.h
+++ b/src/inc/winwrap.h
@@ -484,7 +484,6 @@
#define WszLogonUser LogonUserW
#define WszCreateProcessAsUser CreateProcessAsUserW
#define WszGetCurrentHwProfile GetCurrentHwProfileW
-#define WszGetVersionEx GetVersionExW
#define WszCreateJobObject CreateJobObjectW
#define WszOpenJobObject OpenJobObjectW
@@ -925,8 +924,6 @@ __forceinline LONGLONG __InterlockedExchangeAdd64(LONGLONG volatile * Addend, LO
#define CLR_VER_SUITENAME 0x0000040
#define CLR_VER_PRODUCT_TYPE 0x0000080
-BOOL GetOSVersion(LPOSVERSIONINFOW osVer);
-
// Output printf-style formatted text to the debugger if it's present or stdout otherwise.
inline void DbgWPrintf(const LPCWSTR wszFormat, ...)
{
diff --git a/src/jit/CMakeLists.txt b/src/jit/CMakeLists.txt
index 8f2170dafa..816272f8b1 100644
--- a/src/jit/CMakeLists.txt
+++ b/src/jit/CMakeLists.txt
@@ -218,17 +218,26 @@ if (CLR_CMAKE_PLATFORM_ARCH_ARM)
add_subdirectory(protojit)
endif (CLR_CMAKE_PLATFORM_ARCH_ARM)
-if ((CLR_CMAKE_PLATFORM_ARCH_I386 OR CLR_CMAKE_PLATFORM_ARCH_AMD64) AND WIN32)
+if (CLR_CMAKE_PLATFORM_ARCH_I386 OR CLR_CMAKE_PLATFORM_ARCH_AMD64)
# On x86, build RyuJIT/ARM32 cross-compiling altjit.
# On amd64, build RyuJIT/ARM64 cross-compiling altjit.
add_subdirectory(protononjit)
+endif ()
- # Build Linux/x86-running-on-Windows altjit or
- # Linux/AMD64-running-on-Windows altjit..
+if ((CLR_CMAKE_PLATFORM_ARCH_I386 OR CLR_CMAKE_PLATFORM_ARCH_AMD64) AND WIN32)
+ # On Windows, build altjit that targets the Linux ABI:
+ # On x86, build Linux/x86 altjit. This enables UNIX_X86_ABI.
+ # On amd64, build Linux/AMD64 altjit. This enables UNIX_AMD64_ABI and FEATURE_UNIX_AMD64_STRUCT_PASSING.
add_subdirectory(linuxnonjit)
endif ()
if (CLR_CMAKE_PLATFORM_ARCH_I386 AND WIN32)
+ # On Windows x86, build altjit generating Windows/ARM32 code using LEGACY_BACKEND.
+ # (Note: we could also create linuxlegacynonjit for generating Linux/ARM32 code using LEGACY_BACKEND, if needed.)
+ add_subdirectory(legacynonjit)
+endif (CLR_CMAKE_PLATFORM_ARCH_I386 AND WIN32)
+
+if (CLR_CMAKE_PLATFORM_ARCH_I386 AND WIN32)
if (NOT CLR_BUILD_JIT32)
add_subdirectory(compatjit)
endif ()
diff --git a/src/jit/DIRS.proj b/src/jit/DIRS.proj
index eb00cc1d64..12ea52fb20 100644
--- a/src/jit/DIRS.proj
+++ b/src/jit/DIRS.proj
@@ -36,13 +36,9 @@
<ProjectFile Condition="'$(BuildArchitecture)' == 'arm'" Include="protojit\protojit.nativeproj" />
<ProjectFile Condition="'$(BuildArchitecture)' == 'amd64'" Include="protojit\protojit.nativeproj" />
- <ProjectFile Condition="'$(BuildArchitecture)' == 'amd64'" Include="ctp\ctpjit.nativeproj" />
<ProjectFile Condition="'$(BuildArchitecture)' == 'amd64'" Include="arm64altjit\arm64altjit.nativeproj" />
<ProjectFile Condition="'$(BuildArchitecture)' == 'i386'" Include="protojit\protojit.nativeproj" />
<ProjectFile Condition="'$(BuildArchitecture)' == 'i386'" Include="protononjit\protononjit.nativeproj" />
-
- <!-- We could build skipjit for all architectures, but we only need it for x86 currently -->
- <ProjectFile Condition="'$(BuildArchitecture)' == 'i386'" Include="skipjit\skipjit.nativeproj" />
</ItemGroup>
<!--Import the targets-->
diff --git a/src/jit/ICorJitInfo_API_wrapper.hpp b/src/jit/ICorJitInfo_API_wrapper.hpp
index 4272b2755c..a3ad21165b 100644
--- a/src/jit/ICorJitInfo_API_wrapper.hpp
+++ b/src/jit/ICorJitInfo_API_wrapper.hpp
@@ -129,8 +129,6 @@ void WrapICorJitInfo::getMethodVTableOffset(
API_LEAVE(getMethodVTableOffset);
}
-#if COR_JIT_EE_VERSION > 460
-
CorInfoIntrinsics WrapICorJitInfo::getIntrinsicID(
CORINFO_METHOD_HANDLE method,
bool* pMustExpand /* OUT */)
@@ -141,18 +139,6 @@ CorInfoIntrinsics WrapICorJitInfo::getIntrinsicID(
return temp;
}
-#else
-
-CorInfoIntrinsics WrapICorJitInfo::getIntrinsicID(CORINFO_METHOD_HANDLE method)
-{
- API_ENTER(getIntrinsicID);
- CorInfoIntrinsics temp = wrapHnd->getIntrinsicID(method);
- API_LEAVE(getIntrinsicID);
- return temp;
-}
-
-#endif
-
bool WrapICorJitInfo::isInSIMDModule(CORINFO_CLASS_HANDLE classHnd)
{
API_ENTER(isInSIMDModule);
@@ -281,8 +267,6 @@ void WrapICorJitInfo::resolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResol
API_LEAVE(resolveToken);
}
-#if COR_JIT_EE_VERSION > 460
-
bool WrapICorJitInfo::tryResolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken)
{
API_ENTER(tryResolveToken);
@@ -291,8 +275,6 @@ bool WrapICorJitInfo::tryResolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pRe
return success;
}
-#endif
-
void WrapICorJitInfo::findSig(
CORINFO_MODULE_HANDLE module,
unsigned sigTOK,
@@ -617,8 +599,6 @@ CorInfoHelpFunc WrapICorJitInfo::getUnBoxHelper(
return temp;
}
-#if COR_JIT_EE_VERSION > 460
-
bool WrapICorJitInfo::getReadyToRunHelper(
CORINFO_RESOLVED_TOKEN * pResolvedToken,
CORINFO_LOOKUP_KIND * pGenericLookupKind,
@@ -634,27 +614,13 @@ bool WrapICorJitInfo::getReadyToRunHelper(
void WrapICorJitInfo::getReadyToRunDelegateCtorHelper(
CORINFO_RESOLVED_TOKEN * pTargetMethod,
CORINFO_CLASS_HANDLE delegateType,
- CORINFO_CONST_LOOKUP * pLookup)
+ CORINFO_LOOKUP * pLookup)
{
API_ENTER(getReadyToRunDelegateCtorHelper);
wrapHnd->getReadyToRunDelegateCtorHelper(pTargetMethod, delegateType, pLookup);
API_LEAVE(getReadyToRunDelegateCtorHelper);
}
-#else
-
-void WrapICorJitInfo::getReadyToRunHelper(
- CORINFO_RESOLVED_TOKEN * pResolvedToken,
- CorInfoHelpFunc id,
- CORINFO_CONST_LOOKUP * pLookup)
-{
- API_ENTER(getReadyToRunHelper);
- wrapHnd->getReadyToRunHelper(pResolvedToken, id, pLookup);
- API_LEAVE(getReadyToRunHelper);
-}
-
-#endif
-
const char* WrapICorJitInfo::getHelperName(
CorInfoHelpFunc funcNum)
{
@@ -1094,8 +1060,6 @@ size_t WrapICorJitInfo::findNameOfToken(
return result;
}
-#if COR_JIT_EE_VERSION > 460
-
bool WrapICorJitInfo::getSystemVAmd64PassStructInRegisterDescriptor(
/* IN */ CORINFO_CLASS_HANDLE structHnd,
/* OUT */ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr)
@@ -1106,8 +1070,6 @@ bool WrapICorJitInfo::getSystemVAmd64PassStructInRegisterDescriptor(
return result;
}
-#endif
-
DWORD WrapICorJitInfo::getThreadTLSIndex(
void **ppIndirection)
{
@@ -1271,8 +1233,6 @@ void* WrapICorJitInfo::getAddressOfPInvokeFixup(
return temp;
}
-#if COR_JIT_EE_VERSION > 460
-
void WrapICorJitInfo::getAddressOfPInvokeTarget(
CORINFO_METHOD_HANDLE method,
CORINFO_CONST_LOOKUP *pLookup)
@@ -1282,8 +1242,6 @@ void WrapICorJitInfo::getAddressOfPInvokeTarget(
API_LEAVE(getAddressOfPInvokeTarget);
}
-#endif
-
LPVOID WrapICorJitInfo::GetCookieForPInvokeCalliSig(
CORINFO_SIG_INFO* szMetaSig,
void ** ppIndirection)
@@ -1474,8 +1432,6 @@ void* WrapICorJitInfo::getTailCallCopyArgsThunk(
//
/*********************************************************************************/
-#if COR_JIT_EE_VERSION > 460
-
DWORD WrapICorJitInfo::getJitFlags(CORJIT_FLAGS *jitFlags, DWORD sizeInBytes)
{
API_ENTER(getJitFlags);
@@ -1489,8 +1445,6 @@ bool WrapICorJitInfo::runWithErrorTrap(void(*function)(void*), void *param)
return wrapHnd->runWithErrorTrap(function, param);
}
-#endif
-
IEEMemoryManager* WrapICorJitInfo::getMemoryManager()
{
API_ENTER(getMemoryManager);
diff --git a/src/jit/_typeinfo.h b/src/jit/_typeinfo.h
index 08273adc8d..795691ddc1 100755
--- a/src/jit/_typeinfo.h
+++ b/src/jit/_typeinfo.h
@@ -27,8 +27,7 @@ enum ti_types
#define DEF_TI(ti, nm) ti,
#include "titypes.h"
#undef DEF_TI
- TI_ONLY_ENUM = TI_METHOD, // Enum values above this are completely described by the enumeration
- TI_COUNT
+ TI_ONLY_ENUM = TI_METHOD, // Enum values with greater value are completely described by the enumeration.
};
#if defined(_TARGET_64BIT_)
@@ -190,8 +189,6 @@ inline ti_types JITtype2tiType(CorInfoType type)
*
*/
-// TI_COUNT is less than or equal to TI_FLAG_DATA_MASK
-
#define TI_FLAG_DATA_BITS 6
#define TI_FLAG_DATA_MASK ((1 << TI_FLAG_DATA_BITS) - 1)
@@ -287,7 +284,7 @@ private:
union {
struct
{
- ti_types type : 6;
+ ti_types type : TI_FLAG_DATA_BITS;
unsigned uninitobj : 1; // used
unsigned byref : 1; // used
unsigned byref_readonly : 1; // used
@@ -559,13 +556,6 @@ public:
return m_method;
}
- // If FEATURE_CORECLR is enabled, GetMethod can be called
- // before the pointer type is known to be a method pointer type.
- CORINFO_METHOD_HANDLE GetMethod2() const
- {
- return m_method;
- }
-
// Get this item's type
// If primitive, returns the primitive type (TI_*)
// If not primitive, returns:
diff --git a/src/jit/assertionprop.cpp b/src/jit/assertionprop.cpp
index 599cdf3055..4c18a284cf 100644
--- a/src/jit/assertionprop.cpp
+++ b/src/jit/assertionprop.cpp
@@ -511,7 +511,7 @@ ASSERT_TP& Compiler::GetAssertionDep(unsigned lclNum)
ExpandArray<ASSERT_TP>& dep = *optAssertionDep;
if (dep[lclNum] == nullptr)
{
- dep[lclNum] = optNewEmptyAssertSet();
+ dep[lclNum] = BitVecOps::MakeEmpty(apTraits);
}
return dep[lclNum];
}
@@ -524,10 +524,7 @@ ASSERT_TP& Compiler::GetAssertionDep(unsigned lclNum)
void Compiler::optAssertionTraitsInit(AssertionIndex assertionCount)
{
apTraits = new (getAllocator()) BitVecTraits(assertionCount, this);
- apFull = BitVecOps::UninitVal();
- apEmpty = BitVecOps::UninitVal();
- BitVecOps::AssignNoCopy(apTraits, apFull, BitVecOps::MakeFull(apTraits));
- BitVecOps::AssignNoCopy(apTraits, apEmpty, BitVecOps::MakeEmpty(apTraits));
+ apFull = BitVecOps::MakeFull(apTraits);
}
/*****************************************************************************
@@ -792,12 +789,7 @@ void Compiler::optPrintAssertion(AssertionDsc* curAssertion, AssertionIndex asse
if (assertionIndex > 0)
{
printf(" index=#%02u, mask=", assertionIndex);
-
- // This is an hack to reuse a known empty set in order to display
- // a single bit mask.
- BitVecOps::AddElemD(apTraits, apEmpty, assertionIndex - 1);
- printf("%s", BitVecOps::ToString(apTraits, apEmpty));
- BitVecOps::RemoveElemD(apTraits, apEmpty, assertionIndex - 1);
+ printf("%s", BitVecOps::ToString(apTraits, BitVecOps::MakeSingleton(apTraits, assertionIndex - 1)));
}
printf("\n");
}
@@ -828,7 +820,7 @@ Compiler::AssertionDsc* Compiler::optGetAssertion(AssertionIndex assertIndex)
* if they don't care about it. Refer overloaded method optCreateAssertion.
*
*/
-Compiler::AssertionIndex Compiler::optCreateAssertion(GenTreePtr op1, GenTreePtr op2, optAssertionKind assertionKind)
+AssertionIndex Compiler::optCreateAssertion(GenTreePtr op1, GenTreePtr op2, optAssertionKind assertionKind)
{
AssertionDsc assertionDsc;
return optCreateAssertion(op1, op2, assertionKind, &assertionDsc);
@@ -850,10 +842,10 @@ Compiler::AssertionIndex Compiler::optCreateAssertion(GenTreePtr op1, GenTreePtr
* NO_ASSERTION_INDEX and we could not create the assertion.
*
*/
-Compiler::AssertionIndex Compiler::optCreateAssertion(GenTreePtr op1,
- GenTreePtr op2,
- optAssertionKind assertionKind,
- AssertionDsc* assertion)
+AssertionIndex Compiler::optCreateAssertion(GenTreePtr op1,
+ GenTreePtr op2,
+ optAssertionKind assertionKind,
+ AssertionDsc* assertion)
{
memset(assertion, 0, sizeof(AssertionDsc));
//
@@ -955,12 +947,14 @@ Compiler::AssertionIndex Compiler::optCreateAssertion(GenTreePtr op1,
while (vnStore->GetVNFunc(vn, &funcAttr) && (funcAttr.m_func == (VNFunc)GT_ADD) &&
(vnStore->TypeOfVN(vn) == TYP_BYREF))
{
- if (vnStore->IsVNConstant(funcAttr.m_args[1]))
+ if (vnStore->IsVNConstant(funcAttr.m_args[1]) &&
+ varTypeIsIntegral(vnStore->TypeOfVN(funcAttr.m_args[1])))
{
offset += vnStore->CoercedConstantValue<ssize_t>(funcAttr.m_args[1]);
vn = funcAttr.m_args[0];
}
- else if (vnStore->IsVNConstant(funcAttr.m_args[0]))
+ else if (vnStore->IsVNConstant(funcAttr.m_args[0]) &&
+ varTypeIsIntegral(vnStore->TypeOfVN(funcAttr.m_args[0])))
{
offset += vnStore->CoercedConstantValue<ssize_t>(funcAttr.m_args[0]);
vn = funcAttr.m_args[1];
@@ -1491,13 +1485,15 @@ void Compiler::optPrintVnAssertionMapping()
*/
void Compiler::optAddVnAssertionMapping(ValueNum vn, AssertionIndex index)
{
- ASSERT_TP cur;
- if (!optValueNumToAsserts->Lookup(vn, &cur))
+ ASSERT_TP* cur = optValueNumToAsserts->LookupPointer(vn);
+ if (cur == nullptr)
+ {
+ optValueNumToAsserts->Set(vn, BitVecOps::MakeSingleton(apTraits, index - 1));
+ }
+ else
{
- cur = optNewEmptyAssertSet();
- optValueNumToAsserts->Set(vn, cur);
+ BitVecOps::AddElemD(apTraits, *cur, index - 1);
}
- BitVecOps::AddElemD(apTraits, cur, index - 1);
}
/*****************************************************************************
@@ -1538,7 +1534,7 @@ bool Compiler::optAssertionVnInvolvesNan(AssertionDsc* assertion)
* we use to refer to this element.
* If we need to add to the table and the table is full return the value zero
*/
-Compiler::AssertionIndex Compiler::optAddAssertion(AssertionDsc* newAssertion)
+AssertionIndex Compiler::optAddAssertion(AssertionDsc* newAssertion)
{
noway_assert(newAssertion->assertionKind != OAK_INVALID);
@@ -1745,9 +1741,9 @@ void Compiler::optCreateComplementaryAssertion(AssertionIndex assertionIndex, Ge
* for the operands.
*/
-Compiler::AssertionIndex Compiler::optCreateJtrueAssertions(GenTreePtr op1,
- GenTreePtr op2,
- Compiler::optAssertionKind assertionKind)
+AssertionIndex Compiler::optCreateJtrueAssertions(GenTreePtr op1,
+ GenTreePtr op2,
+ Compiler::optAssertionKind assertionKind)
{
AssertionDsc candidateAssertion;
AssertionIndex assertionIndex = optCreateAssertion(op1, op2, assertionKind, &candidateAssertion);
@@ -1760,7 +1756,7 @@ Compiler::AssertionIndex Compiler::optCreateJtrueAssertions(GenTreePtr
return assertionIndex;
}
-Compiler::AssertionIndex Compiler::optCreateJTrueBoundsAssertion(GenTreePtr tree)
+AssertionInfo Compiler::optCreateJTrueBoundsAssertion(GenTreePtr tree)
{
GenTreePtr relop = tree->gtGetOp1();
if ((relop->OperKind() & GTK_RELOP) == 0)
@@ -1846,11 +1842,11 @@ Compiler::AssertionIndex Compiler::optCreateJTrueBoundsAssertion(GenTreePtr tree
dsc.op2.vn = ValueNumStore::NoVN;
AssertionIndex index = optAddAssertion(&dsc);
- if ((arrLenUnsignedBnd.cmpOper == VNF_GE_UN) && (index != NO_ASSERTION_INDEX))
+ if (arrLenUnsignedBnd.cmpOper == VNF_GE_UN)
{
// By default JTRUE generated assertions hold on the "jump" edge. We have i >= a.len but we're really
// after i < a.len so we need to change the assertion edge to "next".
- index |= OAE_NEXT_EDGE;
+ return AssertionInfo::ForNextEdge(index);
}
return index;
}
@@ -1898,7 +1894,7 @@ Compiler::AssertionIndex Compiler::optCreateJTrueBoundsAssertion(GenTreePtr tree
*
* Compute assertions for the JTrue node.
*/
-Compiler::AssertionIndex Compiler::optAssertionGenJtrue(GenTreePtr tree)
+AssertionInfo Compiler::optAssertionGenJtrue(GenTreePtr tree)
{
// Only create assertions for JTRUE when we are in the global phase
if (optLocalAssertionProp)
@@ -1917,10 +1913,10 @@ Compiler::AssertionIndex Compiler::optAssertionGenJtrue(GenTreePtr tree)
GenTreePtr op1 = relop->gtOp.gtOp1;
GenTreePtr op2 = relop->gtOp.gtOp2;
- AssertionIndex index = optCreateJTrueBoundsAssertion(tree);
- if (index != NO_ASSERTION_INDEX)
+ AssertionInfo info = optCreateJTrueBoundsAssertion(tree);
+ if (info.HasAssertion())
{
- return index;
+ return info;
}
// Find assertion kind.
@@ -2002,7 +1998,7 @@ Compiler::AssertionIndex Compiler::optAssertionGenJtrue(GenTreePtr tree)
* from all of the constituent phi operands.
*
*/
-Compiler::AssertionIndex Compiler::optAssertionGenPhiDefn(GenTreePtr tree)
+AssertionIndex Compiler::optAssertionGenPhiDefn(GenTreePtr tree)
{
if (!tree->IsPhiDefn())
{
@@ -2051,19 +2047,19 @@ void Compiler::optAssertionGen(GenTreePtr tree)
// For most of the assertions that we create below
// the assertion is true after the tree is processed
- bool assertionProven = true;
- AssertionIndex assertionIndex = NO_ASSERTION_INDEX;
+ bool assertionProven = true;
+ AssertionInfo assertionInfo;
switch (tree->gtOper)
{
case GT_ASG:
// VN takes care of non local assertions for assignments and data flow.
if (optLocalAssertionProp)
{
- assertionIndex = optCreateAssertion(tree->gtOp.gtOp1, tree->gtOp.gtOp2, OAK_EQUAL);
+ assertionInfo = optCreateAssertion(tree->gtOp.gtOp1, tree->gtOp.gtOp2, OAK_EQUAL);
}
else
{
- assertionIndex = optAssertionGenPhiDefn(tree);
+ assertionInfo = optAssertionGenPhiDefn(tree);
}
break;
@@ -2073,24 +2069,24 @@ void Compiler::optAssertionGen(GenTreePtr tree)
case GT_IND:
case GT_NULLCHECK:
// All indirections create non-null assertions
- assertionIndex = optCreateAssertion(tree->AsIndir()->Addr(), nullptr, OAK_NOT_EQUAL);
+ assertionInfo = optCreateAssertion(tree->AsIndir()->Addr(), nullptr, OAK_NOT_EQUAL);
break;
case GT_ARR_LENGTH:
// An array length is an indirection (but doesn't derive from GenTreeIndir).
- assertionIndex = optCreateAssertion(tree->AsArrLen()->ArrRef(), nullptr, OAK_NOT_EQUAL);
+ assertionInfo = optCreateAssertion(tree->AsArrLen()->ArrRef(), nullptr, OAK_NOT_EQUAL);
break;
case GT_ARR_BOUNDS_CHECK:
if (!optLocalAssertionProp)
{
- assertionIndex = optCreateAssertion(tree, nullptr, OAK_NO_THROW);
+ assertionInfo = optCreateAssertion(tree, nullptr, OAK_NO_THROW);
}
break;
case GT_ARR_ELEM:
// An array element reference can create a non-null assertion
- assertionIndex = optCreateAssertion(tree->gtArrElem.gtArrObj, nullptr, OAK_NOT_EQUAL);
+ assertionInfo = optCreateAssertion(tree->gtArrElem.gtArrObj, nullptr, OAK_NOT_EQUAL);
break;
case GT_CALL:
@@ -2110,7 +2106,7 @@ void Compiler::optAssertionGen(GenTreePtr tree)
}
#endif // _TARGET_X86_ || _TARGET_AMD64_ || _TARGET_ARM_
noway_assert(thisArg != nullptr);
- assertionIndex = optCreateAssertion(thisArg, nullptr, OAK_NOT_EQUAL);
+ assertionInfo = optCreateAssertion(thisArg, nullptr, OAK_NOT_EQUAL);
}
break;
@@ -2121,13 +2117,13 @@ void Compiler::optAssertionGen(GenTreePtr tree)
// This represets an assertion that we would like to prove to be true. It is not actually a true
// assertion.
// If we can prove this assertion true then we can eliminate this cast.
- assertionIndex = optCreateAssertion(tree->gtOp.gtOp1, tree, OAK_SUBRANGE);
+ assertionInfo = optCreateAssertion(tree->gtOp.gtOp1, tree, OAK_SUBRANGE);
assertionProven = false;
}
break;
case GT_JTRUE:
- assertionIndex = optAssertionGenJtrue(tree);
+ assertionInfo = optAssertionGenJtrue(tree);
break;
default:
@@ -2136,9 +2132,9 @@ void Compiler::optAssertionGen(GenTreePtr tree)
}
// For global assertion prop we must store the assertion number in the tree node
- if ((assertionIndex != NO_ASSERTION_INDEX) && assertionProven && !optLocalAssertionProp)
+ if (assertionInfo.HasAssertion() && assertionProven && !optLocalAssertionProp)
{
- tree->SetAssertion(assertionIndex);
+ tree->SetAssertionInfo(assertionInfo);
}
}
@@ -2162,7 +2158,7 @@ void Compiler::optMapComplementary(AssertionIndex assertionIndex, AssertionIndex
* Given an assertion index, return the assertion index of the complementary
* assertion or 0 if one does not exist.
*/
-Compiler::AssertionIndex Compiler::optFindComplementary(AssertionIndex assertIndex)
+AssertionIndex Compiler::optFindComplementary(AssertionIndex assertIndex)
{
if (assertIndex == NO_ASSERTION_INDEX)
{
@@ -2205,9 +2201,7 @@ Compiler::AssertionIndex Compiler::optFindComplementary(AssertionIndex assertInd
* if one such assertion could not be found in "assertions."
*/
-Compiler::AssertionIndex Compiler::optAssertionIsSubrange(GenTreePtr tree,
- var_types toType,
- ASSERT_VALARG_TP assertions)
+AssertionIndex Compiler::optAssertionIsSubrange(GenTreePtr tree, var_types toType, ASSERT_VALARG_TP assertions)
{
if (!optLocalAssertionProp && BitVecOps::IsEmpty(apTraits, assertions))
{
@@ -2273,9 +2267,7 @@ Compiler::AssertionIndex Compiler::optAssertionIsSubrange(GenTreePtr tree,
* could not be found, then it returns NO_ASSERTION_INDEX.
*
*/
-Compiler::AssertionIndex Compiler::optAssertionIsSubtype(GenTreePtr tree,
- GenTreePtr methodTableArg,
- ASSERT_VALARG_TP assertions)
+AssertionIndex Compiler::optAssertionIsSubtype(GenTreePtr tree, GenTreePtr methodTableArg, ASSERT_VALARG_TP assertions)
{
if (!optLocalAssertionProp && BitVecOps::IsEmpty(apTraits, assertions))
{
@@ -2933,7 +2925,7 @@ GenTreePtr Compiler::optAssertionProp_LclVar(ASSERT_VALARG_TP assertions, const
* op1Kind and lclNum, op2Kind and the constant value and is either equal or
* not equal assertion.
*/
-Compiler::AssertionIndex Compiler::optLocalAssertionIsEqualOrNotEqual(
+AssertionIndex Compiler::optLocalAssertionIsEqualOrNotEqual(
optOp1Kind op1Kind, unsigned lclNum, optOp2Kind op2Kind, ssize_t cnsVal, ASSERT_VALARG_TP assertions)
{
noway_assert((op1Kind == O1K_LCLVAR) || (op1Kind == O1K_EXACT_TYPE) || (op1Kind == O1K_SUBTYPE));
@@ -2975,9 +2967,9 @@ Compiler::AssertionIndex Compiler::optLocalAssertionIsEqualOrNotEqual(
* "op1" == "op2" or "op1" != "op2." Does a value number based comparison.
*
*/
-Compiler::AssertionIndex Compiler::optGlobalAssertionIsEqualOrNotEqual(ASSERT_VALARG_TP assertions,
- GenTreePtr op1,
- GenTreePtr op2)
+AssertionIndex Compiler::optGlobalAssertionIsEqualOrNotEqual(ASSERT_VALARG_TP assertions,
+ GenTreePtr op1,
+ GenTreePtr op2)
{
if (BitVecOps::IsEmpty(apTraits, assertions))
{
@@ -3531,7 +3523,7 @@ bool Compiler::optAssertionIsNonNull(GenTreePtr op,
* from the set of "assertions."
*
*/
-Compiler::AssertionIndex Compiler::optAssertionIsNonNullInternal(GenTreePtr op, ASSERT_VALARG_TP assertions)
+AssertionIndex Compiler::optAssertionIsNonNullInternal(GenTreePtr op, ASSERT_VALARG_TP assertions)
{
// If local assertion prop use lcl comparison, else use VN comparison.
if (!optLocalAssertionProp)
@@ -4401,15 +4393,8 @@ public:
JITDUMP("AssertionPropCallback::EndMerge : BB%02d in -> %s\n\n", block->bbNum,
BitVecOps::ToString(apTraits, block->bbAssertionIn));
- // PERF: eliminate this tmp by passing in a OperationTree (AST) to the bitset,
- // so the expr tree is operated on a single bit level. See "expression templates."
- ASSERT_TP tmp = BitVecOps::MakeCopy(apTraits, block->bbAssertionIn);
- BitVecOps::UnionD(apTraits, tmp, block->bbAssertionGen);
- BitVecOps::IntersectionD(apTraits, block->bbAssertionOut, tmp);
-
- BitVecOps::Assign(apTraits, tmp, block->bbAssertionIn);
- BitVecOps::UnionD(apTraits, tmp, mJumpDestGen[block->bbNum]);
- BitVecOps::IntersectionD(apTraits, mJumpDestOut[block->bbNum], tmp);
+ BitVecOps::DataFlowD(apTraits, block->bbAssertionOut, block->bbAssertionGen, block->bbAssertionIn);
+ BitVecOps::DataFlowD(apTraits, mJumpDestOut[block->bbNum], mJumpDestGen[block->bbNum], block->bbAssertionIn);
bool changed = (!BitVecOps::Equal(apTraits, preMergeOut, block->bbAssertionOut) ||
!BitVecOps::Equal(apTraits, preMergeJumpDestOut, mJumpDestOut[block->bbNum]));
@@ -4434,16 +4419,6 @@ public:
}
};
-ASSERT_VALRET_TP Compiler::optNewFullAssertSet()
-{
- return BitVecOps::MakeCopy(apTraits, apFull);
-}
-
-ASSERT_VALRET_TP Compiler::optNewEmptyAssertSet()
-{
- return BitVecOps::MakeCopy(apTraits, apEmpty);
-}
-
/*****************************************************************************
*
* Compute the assertions generated by each block.
@@ -4472,11 +4447,11 @@ ASSERT_TP* Compiler::optComputeAssertionGen()
break;
}
- AssertionIndex index = tree->GetAssertion();
- if (index != NO_ASSERTION_INDEX)
+ if (tree->GeneratesAssertion())
{
- optImpliedAssertions(index, valueGen);
- BitVecOps::AddElemD(apTraits, valueGen, index - 1);
+ AssertionInfo info = tree->GetAssertionInfo();
+ optImpliedAssertions(info.GetAssertionIndex(), valueGen);
+ BitVecOps::AddElemD(apTraits, valueGen, info.GetAssertionIndex() - 1);
}
}
}
@@ -4486,30 +4461,35 @@ ASSERT_TP* Compiler::optComputeAssertionGen()
// Copy whatever we have accumulated into jumpDest edge's valueGen.
ASSERT_TP jumpDestValueGen = BitVecOps::MakeCopy(apTraits, valueGen);
- AssertionIndex index = jtrue->GetAssertion();
- if ((index & OAE_INDEX_MASK) != NO_ASSERTION_INDEX)
+ if (jtrue->GeneratesAssertion())
{
- if ((index & OAE_NEXT_EDGE) != 0)
+ AssertionInfo info = jtrue->GetAssertionInfo();
+ AssertionIndex valueAssertionIndex;
+ AssertionIndex jumpDestAssertionIndex;
+
+ if (info.IsNextEdgeAssertion())
{
- index &= OAE_INDEX_MASK;
- // Currently OAE_NEXT_EDGE is only used with OAK_NO_THROW assertions
- assert(optGetAssertion(index)->assertionKind == OAK_NO_THROW);
- // Don't bother with implied assertions, there aren't any for OAK_NO_THROW
- BitVecOps::AddElemD(apTraits, valueGen, index - 1);
+ valueAssertionIndex = info.GetAssertionIndex();
+ jumpDestAssertionIndex = optFindComplementary(info.GetAssertionIndex());
}
- else
+ else // is jump edge assertion
{
- // If GT_JTRUE, and true path, update jumpDestValueGen.
- optImpliedAssertions(index, jumpDestValueGen);
- BitVecOps::AddElemD(apTraits, jumpDestValueGen, index - 1);
+ valueAssertionIndex = optFindComplementary(info.GetAssertionIndex());
+ jumpDestAssertionIndex = info.GetAssertionIndex();
+ }
- index = optFindComplementary(index);
- if (index != NO_ASSERTION_INDEX)
- {
- // If GT_JTRUE, and false path and we have a complementary assertion available update valueGen
- optImpliedAssertions(index, valueGen);
- BitVecOps::AddElemD(apTraits, valueGen, index - 1);
- }
+ if (valueAssertionIndex != NO_ASSERTION_INDEX)
+ {
+ // Update valueGen if we have an assertion for the bbNext edge
+ optImpliedAssertions(valueAssertionIndex, valueGen);
+ BitVecOps::AddElemD(apTraits, valueGen, valueAssertionIndex - 1);
+ }
+
+ if (jumpDestAssertionIndex != NO_ASSERTION_INDEX)
+ {
+ // Update jumpDestValueGen if we have an assertion for the bbJumpDest edge
+ optImpliedAssertions(jumpDestAssertionIndex, jumpDestValueGen);
+ BitVecOps::AddElemD(apTraits, jumpDestValueGen, jumpDestAssertionIndex - 1);
}
}
@@ -4552,7 +4532,7 @@ ASSERT_TP* Compiler::optInitAssertionDataflowFlags()
// apFull (i.e. all possible bits set), we need to set the bits only for valid
// assertions (note that at this point we are not creating any new assertions).
// Also note that assertion indices start from 1.
- ASSERT_TP apValidFull = optNewEmptyAssertSet();
+ ASSERT_TP apValidFull = BitVecOps::MakeEmpty(apTraits);
for (int i = 1; i <= optAssertionCount; i++)
{
BitVecOps::AddElemD(apTraits, apValidFull, i - 1);
@@ -4566,20 +4546,21 @@ ASSERT_TP* Compiler::optInitAssertionDataflowFlags()
// edges.
for (BasicBlock* block = fgFirstBB; block; block = block->bbNext)
{
- block->bbAssertionIn = optNewEmptyAssertSet();
- if (!bbIsHandlerBeg(block))
+ if (bbIsHandlerBeg(block))
+ {
+ block->bbAssertionIn = BitVecOps::MakeEmpty(apTraits);
+ }
+ else
{
- BitVecOps::Assign(apTraits, block->bbAssertionIn, apValidFull);
+ block->bbAssertionIn = BitVecOps::MakeCopy(apTraits, apValidFull);
}
- block->bbAssertionGen = optNewEmptyAssertSet();
- block->bbAssertionOut = optNewEmptyAssertSet();
- BitVecOps::Assign(apTraits, block->bbAssertionOut, apValidFull);
- jumpDestOut[block->bbNum] = optNewEmptyAssertSet();
- BitVecOps::Assign(apTraits, jumpDestOut[block->bbNum], apValidFull);
+ block->bbAssertionGen = BitVecOps::MakeEmpty(apTraits);
+ block->bbAssertionOut = BitVecOps::MakeCopy(apTraits, apValidFull);
+ jumpDestOut[block->bbNum] = BitVecOps::MakeCopy(apTraits, apValidFull);
}
// Compute the data flow values for all tracked expressions
// IN and OUT never change for the initial basic block B1
- BitVecOps::Assign(apTraits, fgFirstBB->bbAssertionIn, apEmpty);
+ BitVecOps::ClearD(apTraits, fgFirstBB->bbAssertionIn);
return jumpDestOut;
}
@@ -5075,10 +5056,12 @@ void Compiler::optAssertionPropMain()
}
#endif // DEBUG
+ ASSERT_TP assertions = BitVecOps::MakeEmpty(apTraits);
+
// Perform assertion propagation (and constant folding)
for (BasicBlock* block = fgFirstBB; block; block = block->bbNext)
{
- ASSERT_TP assertions = BitVecOps::MakeCopy(apTraits, block->bbAssertionIn);
+ BitVecOps::Assign(apTraits, assertions, block->bbAssertionIn);
// TODO-Review: EH successor/predecessor iteration seems broken.
// SELF_HOST_TESTS_ARM\jit\Directed\ExcepFilters\fault\fault.exe
@@ -5122,7 +5105,7 @@ void Compiler::optAssertionPropMain()
JITDUMP("Propagating %s assertions for BB%02d, stmt [%06d], tree [%06d], tree -> %d\n",
BitVecOps::ToString(apTraits, assertions), block->bbNum, dspTreeID(stmt), dspTreeID(tree),
- tree->GetAssertion());
+ tree->GetAssertionInfo().GetAssertionIndex());
GenTreePtr newTree = optAssertionProp(assertions, tree, stmt);
if (newTree)
@@ -5132,11 +5115,11 @@ void Compiler::optAssertionPropMain()
}
// If this tree makes an assertion - make it available.
- AssertionIndex index = tree->GetAssertion();
- if (index != NO_ASSERTION_INDEX)
+ if (tree->GeneratesAssertion())
{
- optImpliedAssertions(index, assertions);
- BitVecOps::AddElemD(apTraits, assertions, index - 1);
+ AssertionInfo info = tree->GetAssertionInfo();
+ optImpliedAssertions(info.GetAssertionIndex(), assertions);
+ BitVecOps::AddElemD(apTraits, assertions, info.GetAssertionIndex() - 1);
}
}
diff --git a/src/jit/bitset.cpp b/src/jit/bitset.cpp
index 90ef253199..785061f44c 100644
--- a/src/jit/bitset.cpp
+++ b/src/jit/bitset.cpp
@@ -98,9 +98,9 @@ void BitSetSupport::RunTests(Env env)
class TestBitSetTraits
{
public:
- static IAllocator* GetAllocator(IAllocator* alloc)
+ static void* Alloc(IAllocator* alloc, size_t byteSize)
{
- return alloc;
+ return alloc->Alloc(byteSize);
}
static unsigned GetSize(IAllocator* alloc)
{
diff --git a/src/jit/bitsetasshortlong.h b/src/jit/bitsetasshortlong.h
index ec437e189c..163cb366cb 100644
--- a/src/jit/bitsetasshortlong.h
+++ b/src/jit/bitsetasshortlong.h
@@ -38,6 +38,7 @@ private:
static BitSetShortLongRep MakeCopyLong(Env env, BitSetShortLongRep bs);
static bool IsEmptyLong(Env env, BitSetShortLongRep bs);
static unsigned CountLong(Env env, BitSetShortLongRep bs);
+ static bool IsEmptyUnionLong(Env env, BitSetShortLongRep bs1, BitSetShortLongRep bs2);
static void UnionDLong(Env env, BitSetShortLongRep& bs1, BitSetShortLongRep bs2);
static void DiffDLong(Env env, BitSetShortLongRep& bs1, BitSetShortLongRep bs2);
static void AddElemDLong(Env env, BitSetShortLongRep& bs, unsigned i);
@@ -51,6 +52,15 @@ private:
static bool IsSubsetLong(Env env, BitSetShortLongRep bs1, BitSetShortLongRep bs2);
static bool IsEmptyIntersectionLong(Env env, BitSetShortLongRep bs1, BitSetShortLongRep bs2);
static void IntersectionDLong(Env env, BitSetShortLongRep& bs1, BitSetShortLongRep bs2);
+ static void DataFlowDLong(Env env,
+ BitSetShortLongRep& out,
+ const BitSetShortLongRep gen,
+ const BitSetShortLongRep in);
+ static void LivenessDLong(Env env,
+ BitSetShortLongRep& in,
+ const BitSetShortLongRep def,
+ const BitSetShortLongRep use,
+ const BitSetShortLongRep out);
#ifdef DEBUG
static const char* ToStringLong(Env env, BitSetShortLongRep bs);
#endif
@@ -176,6 +186,18 @@ public:
}
}
+ static bool IsEmptyUnion(Env env, BitSetShortLongRep bs1, BitSetShortLongRep bs2)
+ {
+ if (IsShort(env))
+ {
+ return (((size_t)bs1) | ((size_t)bs2)) == 0;
+ }
+ else
+ {
+ return IsEmptyUnionLong(env, bs1, bs2);
+ }
+ }
+
static void UnionD(Env env, BitSetShortLongRep& bs1, BitSetShortLongRep bs2)
{
if (IsShort(env))
@@ -299,6 +321,34 @@ public:
}
}
+ static void DataFlowD(Env env, BitSetShortLongRep& out, const BitSetShortLongRep gen, const BitSetShortLongRep in)
+ {
+ if (IsShort(env))
+ {
+ (size_t&)out = (size_t)out & ((size_t)gen | (size_t)in);
+ }
+ else
+ {
+ DataFlowDLong(env, out, gen, in);
+ }
+ }
+
+ static void LivenessD(Env env,
+ BitSetShortLongRep& in,
+ const BitSetShortLongRep def,
+ const BitSetShortLongRep use,
+ const BitSetShortLongRep out)
+ {
+ if (IsShort(env))
+ {
+ (size_t&)in = (size_t)use | ((size_t)out & ~(size_t)def);
+ }
+ else
+ {
+ LivenessDLong(env, in, def, use, out);
+ }
+ }
+
static bool IsSubset(Env env, BitSetShortLongRep bs1, BitSetShortLongRep bs2)
{
if (IsShort(env))
@@ -332,14 +382,13 @@ public:
if (IsShort(env))
{
assert(sizeof(BitSetShortLongRep) == sizeof(size_t));
- IAllocator* alloc = BitSetTraits::GetDebugOnlyAllocator(env);
- const int CharsForSizeT = sizeof(size_t) * 2;
- char* res = nullptr;
- const int ShortAllocSize = CharsForSizeT + 4;
- res = (char*)alloc->Alloc(ShortAllocSize);
- size_t bits = (size_t)bs;
- unsigned remaining = ShortAllocSize;
- char* ptr = res;
+ const int CharsForSizeT = sizeof(size_t) * 2;
+ char* res = nullptr;
+ const int ShortAllocSize = CharsForSizeT + 4;
+ res = (char*)BitSetTraits::DebugAlloc(env, ShortAllocSize);
+ size_t bits = (size_t)bs;
+ unsigned remaining = ShortAllocSize;
+ char* ptr = res;
if (sizeof(size_t) == sizeof(int64_t))
{
sprintf_s(ptr, remaining, "%016llX", bits);
@@ -629,7 +678,7 @@ BitSetShortLongRep BitSetOps</*BitSetType*/ BitSetShortLongRep,
assert(!IsShort(env));
unsigned len = BitSetTraits::GetArrSize(env, sizeof(size_t));
assert(len > 1); // Or else would not require an array.
- return (BitSetShortLongRep)(BitSetTraits::GetAllocator(env)->Alloc(len * sizeof(size_t)));
+ return (BitSetShortLongRep)(BitSetTraits::Alloc(env, len * sizeof(size_t)));
}
template <typename Env, typename BitSetTraits>
@@ -641,7 +690,7 @@ BitSetShortLongRep BitSetOps</*BitSetType*/ BitSetShortLongRep,
assert(!IsShort(env));
unsigned len = BitSetTraits::GetArrSize(env, sizeof(size_t));
assert(len > 1); // Or else would not require an array.
- BitSetShortLongRep res = (BitSetShortLongRep)(BitSetTraits::GetAllocator(env)->Alloc(len * sizeof(size_t)));
+ BitSetShortLongRep res = (BitSetShortLongRep)(BitSetTraits::Alloc(env, len * sizeof(size_t)));
for (unsigned i = 0; i < len; i++)
{
res[i] = 0;
@@ -658,7 +707,7 @@ BitSetShortLongRep BitSetOps</*BitSetType*/ BitSetShortLongRep,
assert(!IsShort(env));
unsigned len = BitSetTraits::GetArrSize(env, sizeof(size_t));
assert(len > 1); // Or else would not require an array.
- BitSetShortLongRep res = (BitSetShortLongRep)(BitSetTraits::GetAllocator(env)->Alloc(len * sizeof(size_t)));
+ BitSetShortLongRep res = (BitSetShortLongRep)(BitSetTraits::Alloc(env, len * sizeof(size_t)));
for (unsigned i = 0; i < len - 1; i++)
{
res[i] = size_t(-1);
@@ -722,6 +771,59 @@ template <typename Env, typename BitSetTraits>
bool BitSetOps</*BitSetType*/ BitSetShortLongRep,
/*Brand*/ BSShortLong,
/*Env*/ Env,
+ /*BitSetTraits*/ BitSetTraits>::IsEmptyUnionLong(Env env, BitSetShortLongRep bs1, BitSetShortLongRep bs2)
+{
+ assert(!IsShort(env));
+ unsigned len = BitSetTraits::GetArrSize(env, sizeof(size_t));
+ for (unsigned i = 0; i < len; i++)
+ {
+ if ((bs1[i] | bs2[i]) != 0)
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+template <typename Env, typename BitSetTraits>
+void BitSetOps</*BitSetType*/ BitSetShortLongRep,
+ /*Brand*/ BSShortLong,
+ /*Env*/ Env,
+ /*BitSetTraits*/ BitSetTraits>::DataFlowDLong(Env env,
+ BitSetShortLongRep& out,
+ const BitSetShortLongRep gen,
+ const BitSetShortLongRep in)
+{
+ assert(!IsShort(env));
+ unsigned len = BitSetTraits::GetArrSize(env, sizeof(size_t));
+ for (unsigned i = 0; i < len; i++)
+ {
+ out[i] = out[i] & (gen[i] | in[i]);
+ }
+}
+
+template <typename Env, typename BitSetTraits>
+void BitSetOps</*BitSetType*/ BitSetShortLongRep,
+ /*Brand*/ BSShortLong,
+ /*Env*/ Env,
+ /*BitSetTraits*/ BitSetTraits>::LivenessDLong(Env env,
+ BitSetShortLongRep& in,
+ const BitSetShortLongRep def,
+ const BitSetShortLongRep use,
+ const BitSetShortLongRep out)
+{
+ assert(!IsShort(env));
+ unsigned len = BitSetTraits::GetArrSize(env, sizeof(size_t));
+ for (unsigned i = 0; i < len; i++)
+ {
+ in[i] = use[i] | (out[i] & ~def[i]);
+ }
+}
+
+template <typename Env, typename BitSetTraits>
+bool BitSetOps</*BitSetType*/ BitSetShortLongRep,
+ /*Brand*/ BSShortLong,
+ /*Env*/ Env,
/*BitSetTraits*/ BitSetTraits>::EqualLong(Env env, BitSetShortLongRep bs1, BitSetShortLongRep bs2)
{
assert(!IsShort(env));
@@ -762,13 +864,12 @@ const char* BitSetOps</*BitSetType*/ BitSetShortLongRep,
/*BitSetTraits*/ BitSetTraits>::ToStringLong(Env env, BitSetShortLongRep bs)
{
assert(!IsShort(env));
- unsigned len = BitSetTraits::GetArrSize(env, sizeof(size_t));
- const int CharsForSizeT = sizeof(size_t) * 2;
- unsigned allocSz = len * CharsForSizeT + 4;
- unsigned remaining = allocSz;
- IAllocator* alloc = BitSetTraits::GetDebugOnlyAllocator(env);
- char* res = (char*)alloc->Alloc(allocSz);
- char* temp = res;
+ unsigned len = BitSetTraits::GetArrSize(env, sizeof(size_t));
+ const int CharsForSizeT = sizeof(size_t) * 2;
+ unsigned allocSz = len * CharsForSizeT + 4;
+ unsigned remaining = allocSz;
+ char* res = (char*)BitSetTraits::DebugAlloc(env, allocSz);
+ char* temp = res;
for (unsigned i = len; 0 < i; i--)
{
size_t bits = bs[i - 1];
diff --git a/src/jit/block.h b/src/jit/block.h
index 2460979a32..16f1b006fc 100644
--- a/src/jit/block.h
+++ b/src/jit/block.h
@@ -518,22 +518,39 @@ struct BasicBlock : private LIR::Range
weight_t bbWeight; // The dynamic execution weight of this block
+ // getCalledCount -- get the value used to normalize weights for this method
+ weight_t getCalledCount(Compiler* comp);
+
// getBBWeight -- get the normalized weight of this block
- unsigned getBBWeight(Compiler* comp);
+ weight_t getBBWeight(Compiler* comp);
+
+ // hasProfileWeight -- Returns true if this block's weight came from profile data
+ bool hasProfileWeight() const
+ {
+ return ((this->bbFlags & BBF_PROF_WEIGHT) != 0);
+ }
- // setBBWeight -- if the block weight is not derived from a profile, then set the weight to the input
- // weight, but make sure to not overflow BB_MAX_WEIGHT
- void setBBWeight(unsigned weight)
+ // setBBWeight -- if the block weight is not derived from a profile,
+ // then set the weight to the input weight, making sure to not overflow BB_MAX_WEIGHT
+ // Note to set the weight from profile data, instead use setBBProfileWeight
+ void setBBWeight(weight_t weight)
{
- if (!(this->bbFlags & BBF_PROF_WEIGHT))
+ if (!hasProfileWeight())
{
this->bbWeight = min(weight, BB_MAX_WEIGHT);
}
}
+ // setBBProfileWeight -- Set the profile-derived weight for a basic block
+ void setBBProfileWeight(unsigned weight)
+ {
+ this->bbFlags |= BBF_PROF_WEIGHT;
+ this->bbWeight = weight;
+ }
+
// modifyBBWeight -- same as setBBWeight, but also make sure that if the block is rarely run, it stays that
// way, and if it's not rarely run then its weight never drops below 1.
- void modifyBBWeight(unsigned weight)
+ void modifyBBWeight(weight_t weight)
{
if (this->bbWeight != BB_ZERO_WEIGHT)
{
@@ -541,20 +558,12 @@ struct BasicBlock : private LIR::Range
}
}
- // setBBProfileWeight -- Set the profile-derived weight for a basic block
- void setBBProfileWeight(unsigned weight)
- {
- this->bbFlags |= BBF_PROF_WEIGHT;
- // Check if the multiplication by BB_UNITY_WEIGHT will overflow.
- this->bbWeight = (weight <= BB_MAX_WEIGHT / BB_UNITY_WEIGHT) ? weight * BB_UNITY_WEIGHT : BB_MAX_WEIGHT;
- }
-
// this block will inherit the same weight and relevant bbFlags as bSrc
void inheritWeight(BasicBlock* bSrc)
{
this->bbWeight = bSrc->bbWeight;
- if (bSrc->bbFlags & BBF_PROF_WEIGHT)
+ if (bSrc->hasProfileWeight())
{
this->bbFlags |= BBF_PROF_WEIGHT;
}
diff --git a/src/jit/codegenarm.cpp b/src/jit/codegenarm.cpp
index e276b711c5..2cbd0c6a92 100644
--- a/src/jit/codegenarm.cpp
+++ b/src/jit/codegenarm.cpp
@@ -40,14 +40,6 @@ void CodeGen::genSetRegToIcon(regNumber reg, ssize_t val, var_types type, insFla
}
//------------------------------------------------------------------------
-// genEmitGSCookieCheck: Generate code to check that the GS cookie wasn't thrashed by a buffer overrun.
-//
-void CodeGen::genEmitGSCookieCheck(bool pushReg)
-{
- NYI("ARM genEmitGSCookieCheck");
-}
-
-//------------------------------------------------------------------------
// genCallFinally: Generate a call to the finally block.
//
BasicBlock* CodeGen::genCallFinally(BasicBlock* block)
@@ -517,6 +509,10 @@ void CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
switch (treeNode->gtOper)
{
+ case GT_LCLHEAP:
+ genLclHeap(treeNode);
+ break;
+
case GT_CNS_INT:
case GT_CNS_DBL:
genSetRegToConst(targetReg, targetType, treeNode);
@@ -610,10 +606,6 @@ void CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
// Cast is never contained (?)
noway_assert(targetReg != REG_NA);
- // Overflow conversions from float/double --> int types go through helper calls.
- if (treeNode->gtOverflow() && !varTypeIsFloating(treeNode->gtOp.gtOp1))
- NYI("Unimplmented GT_CAST:int <--> int with overflow");
-
if (varTypeIsFloating(targetType) && varTypeIsFloating(treeNode->gtOp.gtOp1))
{
// Casts float/double <--> double/float
@@ -1082,24 +1074,7 @@ void CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
break;
case GT_COPY:
- {
- assert(treeNode->gtOp.gtOp1->IsLocal());
- GenTreeLclVarCommon* lcl = treeNode->gtOp.gtOp1->AsLclVarCommon();
- LclVarDsc* varDsc = &compiler->lvaTable[lcl->gtLclNum];
- inst_RV_RV(ins_Move_Extend(targetType, true), targetReg, genConsumeReg(treeNode->gtOp.gtOp1), targetType,
- emitTypeSize(targetType));
-
- // The old location is dying
- genUpdateRegLife(varDsc, /*isBorn*/ false, /*isDying*/ true DEBUGARG(treeNode->gtOp.gtOp1));
-
- gcInfo.gcMarkRegSetNpt(genRegMask(treeNode->gtOp.gtOp1->gtRegNum));
-
- genUpdateVarReg(varDsc, treeNode);
-
- // The new location is going live
- genUpdateRegLife(varDsc, /*isBorn*/ true, /*isDying*/ false DEBUGARG(treeNode));
- }
- genProduceReg(treeNode);
+ // This is handled at the time we call genConsumeReg() on the GT_COPY
break;
case GT_LIST:
@@ -1138,6 +1113,10 @@ void CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
genLockedInstructions(treeNode->AsOp());
break;
+ case GT_MEMORYBARRIER:
+ instGen_MemoryBarrier();
+ break;
+
case GT_CMPXCHG:
{
NYI("GT_CMPXCHG");
@@ -1332,6 +1311,328 @@ void CodeGen::genMultiRegCallStoreToLocal(GenTreePtr treeNode)
varDsc->lvRegNum = REG_STK;
}
+//--------------------------------------------------------------------------------------
+// genLclHeap: Generate code for localloc
+//
+// Description:
+// There are 2 ways depending from build version to generate code for localloc:
+// 1) For debug build where memory should be initialized we generate loop
+// which invoke push {tmpReg} N times.
+// 2) Fore /o build However, we tickle the pages to ensure that SP is always
+// valid and is in sync with the "stack guard page". Amount of iteration
+// is N/PAGE_SIZE.
+//
+// Comments:
+// There can be some optimization:
+// 1) It's not needed to generate loop for zero size allocation
+// 2) For small allocation (less than 4 store) we unroll loop
+// 3) For allocation less than PAGE_SIZE and when it's not needed to initialize
+// memory to zero, we can just increment SP.
+//
+// Notes: Size N should be aligned to STACK_ALIGN before any allocation
+//
+void CodeGen::genLclHeap(GenTreePtr tree)
+{
+ assert(tree->OperGet() == GT_LCLHEAP);
+
+ GenTreePtr size = tree->gtOp.gtOp1;
+ noway_assert((genActualType(size->gtType) == TYP_INT) || (genActualType(size->gtType) == TYP_I_IMPL));
+
+ // Result of localloc will be returned in regCnt.
+ // Also it used as temporary register in code generation
+ // for storing allocation size
+ regNumber regCnt = tree->gtRegNum;
+ regMaskTP tmpRegsMask = tree->gtRsvdRegs;
+ regNumber pspSymReg = REG_NA;
+ var_types type = genActualType(size->gtType);
+ emitAttr easz = emitTypeSize(type);
+ BasicBlock* endLabel = nullptr;
+ BasicBlock* loop = nullptr;
+ unsigned stackAdjustment = 0;
+
+#ifdef DEBUG
+ // Verify ESP
+ if (compiler->opts.compStackCheckOnRet)
+ {
+ noway_assert(compiler->lvaReturnEspCheck != 0xCCCCCCCC &&
+ compiler->lvaTable[compiler->lvaReturnEspCheck].lvDoNotEnregister &&
+ compiler->lvaTable[compiler->lvaReturnEspCheck].lvOnFrame);
+ getEmitter()->emitIns_S_R(INS_cmp, EA_PTRSIZE, REG_SPBASE, compiler->lvaReturnEspCheck, 0);
+
+ BasicBlock* esp_check = genCreateTempLabel();
+ emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+ inst_JMP(jmpEqual, esp_check);
+ getEmitter()->emitIns(INS_BREAKPOINT);
+ genDefineTempLabel(esp_check);
+ }
+#endif
+
+ noway_assert(isFramePointerUsed()); // localloc requires Frame Pointer to be established since SP changes
+ noway_assert(genStackLevel == 0); // Can't have anything on the stack
+
+ // Whether method has PSPSym.
+ bool hasPspSym;
+#if FEATURE_EH_FUNCLETS
+ hasPspSym = (compiler->lvaPSPSym != BAD_VAR_NUM);
+#else
+ hasPspSym = false;
+#endif
+
+ // Check to 0 size allocations
+ // size_t amount = 0;
+ if (size->IsCnsIntOrI())
+ {
+ // If size is a constant, then it must be contained.
+ assert(size->isContained());
+
+ // If amount is zero then return null in regCnt
+ size_t amount = size->gtIntCon.gtIconVal;
+ if (amount == 0)
+ {
+ instGen_Set_Reg_To_Zero(EA_PTRSIZE, regCnt);
+ goto BAILOUT;
+ }
+ }
+ else
+ {
+ // If 0 bail out by returning null in regCnt
+ genConsumeRegAndCopy(size, regCnt);
+ endLabel = genCreateTempLabel();
+ getEmitter()->emitIns_R_R(INS_TEST, easz, regCnt, regCnt);
+ emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+ inst_JMP(jmpEqual, endLabel);
+ }
+
+ stackAdjustment = 0;
+#if FEATURE_EH_FUNCLETS
+ // If we have PSPsym, then need to re-locate it after localloc.
+ if (hasPspSym)
+ {
+ stackAdjustment += STACK_ALIGN;
+
+ // Save a copy of PSPSym
+ assert(genCountBits(tmpRegsMask) >= 1);
+ regMaskTP pspSymRegMask = genFindLowestBit(tmpRegsMask);
+ tmpRegsMask &= ~pspSymRegMask;
+ pspSymReg = genRegNumFromMask(pspSymRegMask);
+ getEmitter()->emitIns_R_S(ins_Load(TYP_I_IMPL), EA_PTRSIZE, pspSymReg, compiler->lvaPSPSym, 0);
+ }
+#endif
+
+#if FEATURE_FIXED_OUT_ARGS
+ // If we have an outgoing arg area then we must adjust the SP by popping off the
+ // outgoing arg area. We will restore it right before we return from this method.
+ if (compiler->lvaOutgoingArgSpaceSize > 0)
+ {
+ assert((compiler->lvaOutgoingArgSpaceSize % STACK_ALIGN) == 0); // This must be true for the stack to remain
+ // aligned
+ inst_RV_IV(INS_add, REG_SPBASE, compiler->lvaOutgoingArgSpaceSize, EA_PTRSIZE);
+ stackAdjustment += compiler->lvaOutgoingArgSpaceSize;
+ }
+#endif
+
+ // Put aligned allocation size to regCnt
+ if (size->IsCnsIntOrI())
+ {
+ // 'amount' is the total number of bytes to localloc to properly STACK_ALIGN
+ size_t amount = size->gtIntCon.gtIconVal;
+ amount = AlignUp(amount, STACK_ALIGN);
+
+ // For small allocations we will generate up to four stp instructions
+ size_t cntStackAlignedWidthItems = (amount >> STACK_ALIGN_SHIFT);
+ if (cntStackAlignedWidthItems <= 4)
+ {
+ instGen_Set_Reg_To_Zero(EA_PTRSIZE, regCnt);
+
+ while (cntStackAlignedWidthItems != 0)
+ {
+ inst_IV(INS_push, (unsigned)genRegMask(regCnt));
+ cntStackAlignedWidthItems -= 1;
+ }
+
+ goto ALLOC_DONE;
+ }
+ else if (!compiler->info.compInitMem && (amount < compiler->eeGetPageSize())) // must be < not <=
+ {
+ // Since the size is a page or less, simply adjust the SP value
+ // The SP might already be in the guard page, must touch it BEFORE
+ // the alloc, not after.
+ getEmitter()->emitIns_R_R_I(INS_ldr, EA_4BYTE, regCnt, REG_SP, 0);
+ inst_RV_IV(INS_sub, REG_SP, amount, EA_PTRSIZE);
+ goto ALLOC_DONE;
+ }
+
+ // regCnt will be the total number of bytes to locAlloc
+ genSetRegToIcon(regCnt, amount, ((int)amount == amount) ? TYP_INT : TYP_LONG);
+ }
+ else
+ {
+ // Round up the number of bytes to allocate to a STACK_ALIGN boundary.
+ inst_RV_IV(INS_add, regCnt, (STACK_ALIGN - 1), emitActualTypeSize(type));
+ inst_RV_IV(INS_AND, regCnt, ~(STACK_ALIGN - 1), emitActualTypeSize(type));
+ }
+
+ // Allocation
+ if (compiler->info.compInitMem)
+ {
+ // At this point 'regCnt' is set to the total number of bytes to locAlloc.
+ // Since we have to zero out the allocated memory AND ensure that RSP is always valid
+ // by tickling the pages, we will just push 0's on the stack.
+
+ assert(tmpRegsMask != RBM_NONE);
+ assert(genCountBits(tmpRegsMask) >= 1);
+
+ regMaskTP regCntMask = genFindLowestBit(tmpRegsMask);
+ tmpRegsMask &= ~regCntMask;
+ regNumber regTmp = genRegNumFromMask(regCntMask);
+ instGen_Set_Reg_To_Zero(EA_PTRSIZE, regTmp);
+
+ // Loop:
+ BasicBlock* loop = genCreateTempLabel();
+ genDefineTempLabel(loop);
+
+ noway_assert(STACK_ALIGN == 8);
+ inst_IV(INS_push, (unsigned)genRegMask(regTmp));
+ inst_IV(INS_push, (unsigned)genRegMask(regTmp));
+
+ // If not done, loop
+ // Note that regCnt is the number of bytes to stack allocate.
+ assert(genIsValidIntReg(regCnt));
+ getEmitter()->emitIns_R_R_I(INS_sub, EA_PTRSIZE, regCnt, regCnt, STACK_ALIGN);
+ emitJumpKind jmpNotEqual = genJumpKindForOper(GT_NE, CK_SIGNED);
+ inst_JMP(jmpNotEqual, loop);
+ }
+ else
+ {
+ // At this point 'regCnt' is set to the total number of bytes to locAlloc.
+ //
+ // We don't need to zero out the allocated memory. However, we do have
+ // to tickle the pages to ensure that SP is always valid and is
+ // in sync with the "stack guard page". Note that in the worst
+ // case SP is on the last byte of the guard page. Thus you must
+ // touch SP+0 first not SP+0x1000.
+ //
+ // Another subtlety is that you don't want SP to be exactly on the
+ // boundary of the guard page because PUSH is predecrement, thus
+ // call setup would not touch the guard page but just beyond it
+ //
+ // Note that we go through a few hoops so that SP never points to
+ // illegal pages at any time during the ticking process
+ //
+ // subs regCnt, SP, regCnt // regCnt now holds ultimate SP
+ // jb Loop // result is smaller than orignial SP (no wrap around)
+ // mov regCnt, #0 // Overflow, pick lowest possible value
+ //
+ // Loop:
+ // ldr regTmp, [SP + 0] // tickle the page - read from the page
+ // sub regTmp, SP, PAGE_SIZE // decrement SP by PAGE_SIZE
+ // cmp regTmp, regCnt
+ // jb Done
+ // mov SP, regTmp
+ // j Loop
+ //
+ // Done:
+ // mov SP, regCnt
+ //
+
+ // Setup the regTmp
+ assert(tmpRegsMask != RBM_NONE);
+ assert(genCountBits(tmpRegsMask) == 1);
+ regNumber regTmp = genRegNumFromMask(tmpRegsMask);
+
+ BasicBlock* loop = genCreateTempLabel();
+ BasicBlock* done = genCreateTempLabel();
+
+ // subs regCnt, SP, regCnt // regCnt now holds ultimate SP
+ getEmitter()->emitIns_R_R_R(INS_sub, EA_PTRSIZE, regCnt, REG_SPBASE, regCnt);
+
+ inst_JMP(EJ_vc, loop); // branch if the V flag is not set
+
+ // Ups... Overflow, set regCnt to lowest possible value
+ instGen_Set_Reg_To_Zero(EA_PTRSIZE, regCnt);
+
+ genDefineTempLabel(loop);
+
+ // tickle the page - Read from the updated SP - this triggers a page fault when on the guard page
+ getEmitter()->emitIns_R_R_I(INS_ldr, EA_4BYTE, regTmp, REG_SPBASE, 0);
+
+ // decrement SP by PAGE_SIZE
+ getEmitter()->emitIns_R_R_I(INS_sub, EA_PTRSIZE, regTmp, REG_SPBASE, compiler->eeGetPageSize());
+
+ getEmitter()->emitIns_R_R(INS_cmp, EA_PTRSIZE, regTmp, regCnt);
+ emitJumpKind jmpLTU = genJumpKindForOper(GT_LT, CK_UNSIGNED);
+ inst_JMP(jmpLTU, done);
+
+ // Update SP to be at the next page of stack that we will tickle
+ getEmitter()->emitIns_R_R(INS_mov, EA_PTRSIZE, REG_SPBASE, regCnt);
+
+ // Jump to loop and tickle new stack address
+ inst_JMP(EJ_jmp, loop);
+
+ // Done with stack tickle loop
+ genDefineTempLabel(done);
+
+ // Now just move the final value to SP
+ getEmitter()->emitIns_R_R(INS_mov, EA_PTRSIZE, REG_SPBASE, regCnt);
+ }
+
+ALLOC_DONE:
+ // Re-adjust SP to allocate PSPSym and out-going arg area
+ if (stackAdjustment != 0)
+ {
+ assert((stackAdjustment % STACK_ALIGN) == 0); // This must be true for the stack to remain aligned
+ assert(stackAdjustment > 0);
+ getEmitter()->emitIns_R_R_I(INS_sub, EA_PTRSIZE, REG_SPBASE, REG_SPBASE, (int)stackAdjustment);
+
+#if FEATURE_EH_FUNCLETS
+ // Write PSPSym to its new location.
+ if (hasPspSym)
+ {
+ assert(genIsValidIntReg(pspSymReg));
+ getEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, pspSymReg, compiler->lvaPSPSym, 0);
+ }
+#endif
+ // Return the stackalloc'ed address in result register.
+ // regCnt = RSP + stackAdjustment.
+ getEmitter()->emitIns_R_R_I(INS_add, EA_PTRSIZE, regCnt, REG_SPBASE, (int)stackAdjustment);
+ }
+ else // stackAdjustment == 0
+ {
+ // Move the final value of SP to regCnt
+ inst_RV_RV(INS_mov, regCnt, REG_SPBASE);
+ }
+
+BAILOUT:
+ if (endLabel != nullptr)
+ genDefineTempLabel(endLabel);
+
+ // Write the lvaLocAllocSPvar stack frame slot
+ if (compiler->lvaLocAllocSPvar != BAD_VAR_NUM)
+ {
+ getEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, regCnt, compiler->lvaLocAllocSPvar, 0);
+ }
+
+#if STACK_PROBES
+ if (compiler->opts.compNeedStackProbes)
+ {
+ genGenerateStackProbe();
+ }
+#endif
+
+#ifdef DEBUG
+ // Update new ESP
+ if (compiler->opts.compStackCheckOnRet)
+ {
+ noway_assert(compiler->lvaReturnEspCheck != 0xCCCCCCCC &&
+ compiler->lvaTable[compiler->lvaReturnEspCheck].lvDoNotEnregister &&
+ compiler->lvaTable[compiler->lvaReturnEspCheck].lvOnFrame);
+ getEmitter()->emitIns_S_R(ins_Store(TYP_I_IMPL), EA_PTRSIZE, regCnt, compiler->lvaReturnEspCheck, 0);
+ }
+#endif
+
+ genProduceReg(tree);
+}
+
//------------------------------------------------------------------------
// genTableBasedSwitch: generate code for a switch statement based on a table of ip-relative offsets
//
@@ -1879,7 +2180,65 @@ void CodeGen::genCodeForShiftLong(GenTreePtr tree)
//
void CodeGen::genRegCopy(GenTree* treeNode)
{
- NYI("genRegCopy");
+ assert(treeNode->OperGet() == GT_COPY);
+
+ var_types targetType = treeNode->TypeGet();
+ regNumber targetReg = treeNode->gtRegNum;
+ assert(targetReg != REG_NA);
+
+ GenTree* op1 = treeNode->gtOp.gtOp1;
+
+ // Check whether this node and the node from which we're copying the value have the same
+ // register type.
+ // This can happen if (currently iff) we have a SIMD vector type that fits in an integer
+ // register, in which case it is passed as an argument, or returned from a call,
+ // in an integer register and must be copied if it's in an xmm register.
+
+ if (varTypeIsFloating(treeNode) != varTypeIsFloating(op1))
+ {
+ NYI("genRegCopy floating point");
+ }
+ else
+ {
+ inst_RV_RV(ins_Copy(targetType), targetReg, genConsumeReg(op1), targetType);
+ }
+
+ if (op1->IsLocal())
+ {
+ // The lclVar will never be a def.
+ // If it is a last use, the lclVar will be killed by genConsumeReg(), as usual, and genProduceReg will
+ // appropriately set the gcInfo for the copied value.
+ // If not, there are two cases we need to handle:
+ // - If this is a TEMPORARY copy (indicated by the GTF_VAR_DEATH flag) the variable
+ // will remain live in its original register.
+ // genProduceReg() will appropriately set the gcInfo for the copied value,
+ // and genConsumeReg will reset it.
+ // - Otherwise, we need to update register info for the lclVar.
+
+ GenTreeLclVarCommon* lcl = op1->AsLclVarCommon();
+ assert((lcl->gtFlags & GTF_VAR_DEF) == 0);
+
+ if ((lcl->gtFlags & GTF_VAR_DEATH) == 0 && (treeNode->gtFlags & GTF_VAR_DEATH) == 0)
+ {
+ LclVarDsc* varDsc = &compiler->lvaTable[lcl->gtLclNum];
+
+ // If we didn't just spill it (in genConsumeReg, above), then update the register info
+ if (varDsc->lvRegNum != REG_STK)
+ {
+ // The old location is dying
+ genUpdateRegLife(varDsc, /*isBorn*/ false, /*isDying*/ true DEBUGARG(op1));
+
+ gcInfo.gcMarkRegSetNpt(genRegMask(op1->gtRegNum));
+
+ genUpdateVarReg(varDsc, treeNode);
+
+ // The new location is going live
+ genUpdateRegLife(varDsc, /*isBorn*/ true, /*isDying*/ false DEBUGARG(treeNode));
+ }
+ }
+ }
+
+ genProduceReg(treeNode);
}
//------------------------------------------------------------------------
@@ -2421,7 +2780,50 @@ void CodeGen::genLongToIntCast(GenTree* cast)
if (cast->gtOverflow())
{
- NYI("genLongToIntCast: overflow check");
+ //
+ // Generate an overflow check for [u]long to [u]int casts:
+ //
+ // long -> int - check if the upper 33 bits are all 0 or all 1
+ //
+ // ulong -> int - check if the upper 33 bits are all 0
+ //
+ // long -> uint - check if the upper 32 bits are all 0
+ // ulong -> uint - check if the upper 32 bits are all 0
+ //
+
+ if ((srcType == TYP_LONG) && (dstType == TYP_INT))
+ {
+ BasicBlock* allOne = genCreateTempLabel();
+ BasicBlock* success = genCreateTempLabel();
+
+ inst_RV_RV(INS_tst, loSrcReg, loSrcReg, TYP_INT, EA_4BYTE);
+ emitJumpKind JmpNegative = genJumpKindForOper(GT_LT, CK_LOGICAL);
+ inst_JMP(JmpNegative, allOne);
+ inst_RV_RV(INS_tst, hiSrcReg, hiSrcReg, TYP_INT, EA_4BYTE);
+ emitJumpKind jmpNotEqualL = genJumpKindForOper(GT_NE, CK_LOGICAL);
+ genJumpToThrowHlpBlk(jmpNotEqualL, SCK_OVERFLOW);
+ inst_JMP(EJ_jmp, success);
+
+ genDefineTempLabel(allOne);
+ inst_RV_IV(INS_cmp, hiSrcReg, -1, EA_4BYTE);
+ emitJumpKind jmpNotEqualS = genJumpKindForOper(GT_NE, CK_SIGNED);
+ genJumpToThrowHlpBlk(jmpNotEqualS, SCK_OVERFLOW);
+
+ genDefineTempLabel(success);
+ }
+ else
+ {
+ if ((srcType == TYP_ULONG) && (dstType == TYP_INT))
+ {
+ inst_RV_RV(INS_tst, loSrcReg, loSrcReg, TYP_INT, EA_4BYTE);
+ emitJumpKind JmpNegative = genJumpKindForOper(GT_LT, CK_LOGICAL);
+ genJumpToThrowHlpBlk(JmpNegative, SCK_OVERFLOW);
+ }
+
+ inst_RV_RV(INS_tst, hiSrcReg, hiSrcReg, TYP_INT, EA_4BYTE);
+ emitJumpKind jmpNotEqual = genJumpKindForOper(GT_NE, CK_LOGICAL);
+ genJumpToThrowHlpBlk(jmpNotEqual, SCK_OVERFLOW);
+ }
}
if (dstReg != loSrcReg)
@@ -2483,7 +2885,76 @@ void CodeGen::genIntToIntCast(GenTreePtr treeNode)
if (castInfo.requiresOverflowCheck)
{
- NYI_ARM("CodeGen::genIntToIntCast for OverflowCheck");
+ emitAttr cmpSize = EA_ATTR(genTypeSize(srcType));
+
+ if (castInfo.signCheckOnly)
+ {
+ // We only need to check for a negative value in sourceReg
+ emit->emitIns_R_I(INS_cmp, cmpSize, sourceReg, 0);
+ emitJumpKind jmpLT = genJumpKindForOper(GT_LT, CK_SIGNED);
+ genJumpToThrowHlpBlk(jmpLT, SCK_OVERFLOW);
+ noway_assert(genTypeSize(srcType) == 4 || genTypeSize(srcType) == 8);
+ // This is only interesting case to ensure zero-upper bits.
+ if ((srcType == TYP_INT) && (dstType == TYP_ULONG))
+ {
+ // cast to TYP_ULONG:
+ // We use a mov with size=EA_4BYTE
+ // which will zero out the upper bits
+ movSize = EA_4BYTE;
+ movRequired = true;
+ }
+ }
+ else if (castInfo.unsignedSource || castInfo.unsignedDest)
+ {
+ // When we are converting from/to unsigned,
+ // we only have to check for any bits set in 'typeMask'
+
+ noway_assert(castInfo.typeMask != 0);
+ emit->emitIns_R_I(INS_tst, cmpSize, sourceReg, castInfo.typeMask);
+ emitJumpKind jmpNotEqual = genJumpKindForOper(GT_NE, CK_SIGNED);
+ genJumpToThrowHlpBlk(jmpNotEqual, SCK_OVERFLOW);
+ }
+ else
+ {
+ // For a narrowing signed cast
+ //
+ // We must check the value is in a signed range.
+
+ // Compare with the MAX
+
+ noway_assert((castInfo.typeMin != 0) && (castInfo.typeMax != 0));
+
+ if (emitter::emitIns_valid_imm_for_cmp(castInfo.typeMax, INS_FLAGS_DONT_CARE))
+ {
+ emit->emitIns_R_I(INS_cmp, cmpSize, sourceReg, castInfo.typeMax);
+ }
+ else
+ {
+ noway_assert(tmpReg != REG_NA);
+ instGen_Set_Reg_To_Imm(cmpSize, tmpReg, castInfo.typeMax);
+ emit->emitIns_R_R(INS_cmp, cmpSize, sourceReg, tmpReg);
+ }
+
+ emitJumpKind jmpGT = genJumpKindForOper(GT_GT, CK_SIGNED);
+ genJumpToThrowHlpBlk(jmpGT, SCK_OVERFLOW);
+
+ // Compare with the MIN
+
+ if (emitter::emitIns_valid_imm_for_cmp(castInfo.typeMin, INS_FLAGS_DONT_CARE))
+ {
+ emit->emitIns_R_I(INS_cmp, cmpSize, sourceReg, castInfo.typeMin);
+ }
+ else
+ {
+ noway_assert(tmpReg != REG_NA);
+ instGen_Set_Reg_To_Imm(cmpSize, tmpReg, castInfo.typeMin);
+ emit->emitIns_R_R(INS_cmp, cmpSize, sourceReg, tmpReg);
+ }
+
+ emitJumpKind jmpLT = genJumpKindForOper(GT_LT, CK_SIGNED);
+ genJumpToThrowHlpBlk(jmpLT, SCK_OVERFLOW);
+ }
+ ins = INS_mov;
}
else // Non-overflow checking cast.
{
diff --git a/src/jit/codegenarm64.cpp b/src/jit/codegenarm64.cpp
index 4ec4bcf037..c123136cc8 100644
--- a/src/jit/codegenarm64.cpp
+++ b/src/jit/codegenarm64.cpp
@@ -1283,49 +1283,6 @@ void CodeGen::genSetRegToIcon(regNumber reg, ssize_t val, var_types type, insFla
instGen_Set_Reg_To_Imm(emitActualTypeSize(type), reg, val, flags);
}
-/*****************************************************************************
- *
- * Generate code to check that the GS cookie wasn't thrashed by a buffer
- * overrun. On ARM64 we always use REG_TMP_0 and REG_TMP_1 as temp registers
- * and this works fine in the case of tail calls
- * Implementation Note: pushReg = true, in case of tail calls.
- */
-void CodeGen::genEmitGSCookieCheck(bool pushReg)
-{
- noway_assert(compiler->gsGlobalSecurityCookieAddr || compiler->gsGlobalSecurityCookieVal);
-
- // Make sure that the return register is reported as live GC-ref so that any GC that kicks in while
- // executing GS cookie check will not collect the object pointed to by REG_INTRET (R0).
- if (!pushReg && (compiler->info.compRetType == TYP_REF))
- gcInfo.gcRegGCrefSetCur |= RBM_INTRET;
-
- regNumber regGSConst = REG_TMP_0;
- regNumber regGSValue = REG_TMP_1;
-
- if (compiler->gsGlobalSecurityCookieAddr == nullptr)
- {
- // load the GS cookie constant into a reg
- //
- genSetRegToIcon(regGSConst, compiler->gsGlobalSecurityCookieVal, TYP_I_IMPL);
- }
- else
- {
- // Ngen case - GS cookie constant needs to be accessed through an indirection.
- instGen_Set_Reg_To_Imm(EA_HANDLE_CNS_RELOC, regGSConst, (ssize_t)compiler->gsGlobalSecurityCookieAddr);
- getEmitter()->emitIns_R_R_I(ins_Load(TYP_I_IMPL), EA_PTRSIZE, regGSConst, regGSConst, 0);
- }
- // Load this method's GS value from the stack frame
- getEmitter()->emitIns_R_S(ins_Load(TYP_I_IMPL), EA_PTRSIZE, regGSValue, compiler->lvaGSSecurityCookie, 0);
- // Compare with the GC cookie constant
- getEmitter()->emitIns_R_R(INS_cmp, EA_PTRSIZE, regGSConst, regGSValue);
-
- BasicBlock* gsCheckBlk = genCreateTempLabel();
- emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
- inst_JMP(jmpEqual, gsCheckBlk);
- genEmitHelperCall(CORINFO_HELP_FAIL_FAST, 0, EA_UNKNOWN);
- genDefineTempLabel(gsCheckBlk);
-}
-
BasicBlock* CodeGen::genCallFinally(BasicBlock* block)
{
// Generate a call to the finally, like this:
@@ -1883,8 +1840,8 @@ void CodeGen::genReturn(GenTreePtr treeNode)
if (movRequired)
{
- emitAttr movSize = EA_ATTR(genTypeSize(targetType));
- getEmitter()->emitIns_R_R(INS_mov, movSize, retReg, op1->gtRegNum);
+ emitAttr attr = emitTypeSize(targetType);
+ getEmitter()->emitIns_R_R(INS_mov, attr, retReg, op1->gtRegNum);
}
}
@@ -3634,11 +3591,6 @@ void CodeGen::genCodeForCpObj(GenTreeObj* cpObjNode)
// In the case of a GC-Pointer we'll call the ByRef write barrier helper
genEmitHelperCall(CORINFO_HELP_ASSIGN_BYREF, 0, EA_PTRSIZE);
- // genEmitHelperCall(CORINFO_HELP_ASSIGN_BYREF...) killed these registers.
- // However they are still live references to the structures we are copying.
- gcInfo.gcMarkRegPtrVal(REG_WRITE_BARRIER_SRC_BYREF, TYP_BYREF);
- gcInfo.gcMarkRegPtrVal(REG_WRITE_BARRIER_DST_BYREF, TYP_BYREF);
-
gcPtrCount--;
break;
}
@@ -5637,15 +5589,10 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* treeNode)
assert(argOffsetOut == (curArgTabEntry->slotNum * TARGET_POINTER_SIZE));
#endif // DEBUG
-#if FEATURE_FASTTAILCALL
- bool putInIncomingArgArea = treeNode->putInIncomingArgArea;
-#else
- const bool putInIncomingArgArea = false;
-#endif
// Whether to setup stk arg in incoming or out-going arg area?
// Fast tail calls implemented as epilog+jmp = stk arg is setup in incoming arg area.
// All other calls - stk arg is setup in out-going arg area.
- if (putInIncomingArgArea)
+ if (treeNode->putInIncomingArgArea())
{
varNumOut = getFirstArgWithStackSlot();
argOffsetMax = compiler->compArgSize;
diff --git a/src/jit/codegencommon.cpp b/src/jit/codegencommon.cpp
index 90a9149af9..3432444d80 100644
--- a/src/jit/codegencommon.cpp
+++ b/src/jit/codegencommon.cpp
@@ -107,6 +107,11 @@ CodeGen::CodeGen(Compiler* theCompiler) : CodeGenInterface(theCompiler)
m_stkArgVarNum = BAD_VAR_NUM;
#endif
+#if defined(UNIX_X86_ABI)
+ curNestedAlignment = 0;
+ maxNestedAlignment = 0;
+#endif
+
regTracker.rsTrackInit(compiler, &regSet);
gcInfo.regSet = &regSet;
m_cgEmitter = new (compiler->getAllocator()) emitter();
@@ -647,7 +652,7 @@ regMaskTP Compiler::compHelperCallKillSet(CorInfoHelpFunc helper)
#if defined(_TARGET_AMD64_)
return RBM_RSI | RBM_RDI | RBM_CALLEE_TRASH;
#elif defined(_TARGET_ARM64_)
- return RBM_CALLEE_TRASH_NOGC;
+ return RBM_WRITE_BARRIER_SRC_BYREF | RBM_WRITE_BARRIER_DST_BYREF | RBM_CALLEE_TRASH_NOGC;
#elif defined(_TARGET_X86_)
return RBM_ESI | RBM_EDI | RBM_ECX;
#else
@@ -717,6 +722,8 @@ regMaskTP Compiler::compNoGCHelperCallKillSet(CorInfoHelpFunc helper)
#elif defined(_TARGET_X86_)
// This helper only trashes ECX.
return RBM_ECX;
+#elif defined(_TARGET_ARM64_)
+ return RBM_CALLEE_TRASH_NOGC & ~(RBM_WRITE_BARRIER_SRC_BYREF | RBM_WRITE_BARRIER_DST_BYREF);
#else
return RBM_CALLEE_TRASH_NOGC;
#endif // defined(_TARGET_AMD64_)
@@ -1095,9 +1102,9 @@ void Compiler::compChangeLife(VARSET_VALARG_TP newLife DEBUGARG(GenTreePtr tree)
/* Can't simultaneously become live and dead at the same time */
// (deadSet UNION bornSet) != EMPTY
- noway_assert(!VarSetOps::IsEmpty(this, VarSetOps::Union(this, deadSet, bornSet)));
+ noway_assert(!VarSetOps::IsEmptyUnion(this, deadSet, bornSet));
// (deadSet INTERSECTION bornSet) == EMPTY
- noway_assert(VarSetOps::IsEmpty(this, VarSetOps::Intersection(this, deadSet, bornSet)));
+ noway_assert(VarSetOps::IsEmptyIntersection(this, deadSet, bornSet));
#ifdef LEGACY_BACKEND
// In the LEGACY_BACKEND case, we only consider variables that are fully enregisterd
@@ -1632,7 +1639,7 @@ void CodeGen::genDefineTempLabel(BasicBlock* label)
void CodeGen::genAdjustSP(ssize_t delta)
{
-#ifdef _TARGET_X86_
+#if defined(_TARGET_X86_) && !defined(UNIX_X86_ABI)
if (delta == sizeof(int))
inst_RV(INS_pop, REG_ECX, TYP_INT);
else
@@ -2603,6 +2610,51 @@ emitJumpKind CodeGen::genJumpKindForOper(genTreeOps cmp, CompareKind compareKind
return result;
}
+#ifndef LEGACY_BACKEND
+#ifdef _TARGET_ARMARCH_
+//------------------------------------------------------------------------
+// genEmitGSCookieCheck: Generate code to check that the GS cookie
+// wasn't thrashed by a buffer overrun. Coomon code for ARM32 and ARM64
+//
+void CodeGen::genEmitGSCookieCheck(bool pushReg)
+{
+ noway_assert(compiler->gsGlobalSecurityCookieAddr || compiler->gsGlobalSecurityCookieVal);
+
+ // Make sure that the return register is reported as live GC-ref so that any GC that kicks in while
+ // executing GS cookie check will not collect the object pointed to by REG_INTRET (R0).
+ if (!pushReg && (compiler->info.compRetType == TYP_REF))
+ gcInfo.gcRegGCrefSetCur |= RBM_INTRET;
+
+ regNumber regGSConst = REG_TMP_0;
+ regNumber regGSValue = REG_TMP_1;
+
+ if (compiler->gsGlobalSecurityCookieAddr == nullptr)
+ {
+ // load the GS cookie constant into a reg
+ //
+ genSetRegToIcon(regGSConst, compiler->gsGlobalSecurityCookieVal, TYP_I_IMPL);
+ }
+ else
+ {
+ // Ngen case - GS cookie constant needs to be accessed through an indirection.
+ instGen_Set_Reg_To_Imm(EA_HANDLE_CNS_RELOC, regGSConst, (ssize_t)compiler->gsGlobalSecurityCookieAddr);
+ getEmitter()->emitIns_R_R_I(ins_Load(TYP_I_IMPL), EA_PTRSIZE, regGSConst, regGSConst, 0);
+ }
+ // Load this method's GS value from the stack frame
+ getEmitter()->emitIns_R_S(ins_Load(TYP_I_IMPL), EA_PTRSIZE, regGSValue, compiler->lvaGSSecurityCookie, 0);
+ // Compare with the GC cookie constant
+ getEmitter()->emitIns_R_R(INS_cmp, EA_PTRSIZE, regGSConst, regGSValue);
+
+ BasicBlock* gsCheckBlk = genCreateTempLabel();
+ emitJumpKind jmpEqual = genJumpKindForOper(GT_EQ, CK_SIGNED);
+ inst_JMP(jmpEqual, gsCheckBlk);
+ // regGSConst and regGSValue aren't needed anymore, we can use them for helper call
+ genEmitHelperCall(CORINFO_HELP_FAIL_FAST, 0, EA_UNKNOWN, regGSConst);
+ genDefineTempLabel(gsCheckBlk);
+}
+#endif // _TARGET_ARMARCH_
+#endif // !LEGACY_BACKEND
+
/*****************************************************************************
*
* Generate an exit sequence for a return from a method (note: when compiling
@@ -2976,7 +3028,8 @@ void CodeGen::genGenerateCode(void** codePtr, ULONG* nativeSizeOfCode)
if (compiler->fgHaveProfileData())
{
- printf("; with IBC profile data\n");
+ printf("; with IBC profile data, edge weights are %s, and fgCalledCount is %u\n",
+ compiler->fgHaveValidEdgeWeights ? "valid" : "invalid", compiler->fgCalledCount);
}
if (compiler->fgProfileData_ILSizeMismatch)
@@ -3201,7 +3254,7 @@ void CodeGen::genGenerateCode(void** codePtr, ULONG* nativeSizeOfCode)
genTypeStSz(TYP_LONG) + // longs/doubles may be transferred via stack, etc
(compiler->compTailCallUsed ? 4 : 0); // CORINFO_HELP_TAILCALL args
#if defined(UNIX_X86_ABI)
- maxAllowedStackDepth += genTypeStSz(TYP_INT) * 3; // stack align for x86 - allow up to 3 INT's for padding
+ maxAllowedStackDepth += maxNestedAlignment;
#endif
noway_assert(getEmitter()->emitMaxStackDepth <= maxAllowedStackDepth);
}
@@ -8086,6 +8139,14 @@ void CodeGen::genFinalizeFrame()
}
#endif // defined(_TARGET_ARMARCH_)
+#if defined(_TARGET_ARM_)
+ // If there are any reserved registers, add them to the
+ if (regSet.rsMaskResvd != RBM_NONE)
+ {
+ regSet.rsSetRegsModified(regSet.rsMaskResvd);
+ }
+#endif // _TARGET_ARM_
+
#ifdef DEBUG
if (verbose)
{
@@ -9712,17 +9773,25 @@ void CodeGen::genFnEpilog(BasicBlock* block)
unsigned stkArgSize = 0; // Zero on all platforms except x86
#if defined(_TARGET_X86_)
-
- noway_assert(compiler->compArgSize >= intRegState.rsCalleeRegArgCount * sizeof(void*));
- stkArgSize = compiler->compArgSize - intRegState.rsCalleeRegArgCount * sizeof(void*);
-
- noway_assert(compiler->compArgSize < 0x10000); // "ret" only has 2 byte operand
+ bool fCalleePop = true;
// varargs has caller pop
if (compiler->info.compIsVarArgs)
- stkArgSize = 0;
+ fCalleePop = false;
+
+#ifdef UNIX_X86_ABI
+ if (IsCallerPop(compiler->info.compMethodInfo->args.callConv))
+ fCalleePop = false;
+#endif // UNIX_X86_ABI
+
+ if (fCalleePop)
+ {
+ noway_assert(compiler->compArgSize >= intRegState.rsCalleeRegArgCount * sizeof(void*));
+ stkArgSize = compiler->compArgSize - intRegState.rsCalleeRegArgCount * sizeof(void*);
-#endif // defined(_TARGET_X86_)
+ noway_assert(compiler->compArgSize < 0x10000); // "ret" only has 2 byte operand
+ }
+#endif // _TARGET_X86_
/* Return, popping our arguments (if any) */
instGen_Return(stkArgSize);
@@ -10368,6 +10437,8 @@ void CodeGen::genFuncletProlog(BasicBlock* block)
ScopedSetVariable<bool> _setGeneratingProlog(&compiler->compGeneratingProlog, true);
+ gcInfo.gcResetForBB();
+
compiler->unwindBegProlog();
// This is the end of the OS-reported prolog for purposes of unwinding
diff --git a/src/jit/codegenlegacy.cpp b/src/jit/codegenlegacy.cpp
index ff6c14bca6..d65351115f 100644
--- a/src/jit/codegenlegacy.cpp
+++ b/src/jit/codegenlegacy.cpp
@@ -21029,8 +21029,6 @@ regMaskTP CodeGen::genPInvokeMethodProlog(regMaskTP initRegs)
}
else
{
- noway_assert(pInfo->osMajor >= 5);
-
DWORD basePtr = WIN_NT5_TLS_HIGHOFFSET;
threadTlsIndex -= 64;
diff --git a/src/jit/codegenlinear.h b/src/jit/codegenlinear.h
index 154d4845a0..b03885858a 100644
--- a/src/jit/codegenlinear.h
+++ b/src/jit/codegenlinear.h
@@ -174,6 +174,44 @@ void genCodeForCpBlkRepMovs(GenTreeBlk* cpBlkNode);
void genCodeForCpBlkUnroll(GenTreeBlk* cpBlkNode);
+void genAlignStackBeforeCall(GenTreePutArgStk* putArgStk);
+void genAlignStackBeforeCall(GenTreeCall* call);
+void genRemoveAlignmentAfterCall(GenTreeCall* call, unsigned bias = 0);
+
+#if defined(UNIX_X86_ABI)
+
+unsigned curNestedAlignment; // Keep track of alignment adjustment required during codegen.
+unsigned maxNestedAlignment; // The maximum amount of alignment adjustment required.
+
+void SubtractNestedAlignment(unsigned adjustment)
+{
+ assert(curNestedAlignment >= adjustment);
+ unsigned newNestedAlignment = curNestedAlignment - adjustment;
+ if (curNestedAlignment != newNestedAlignment)
+ {
+ JITDUMP("Adjusting stack nested alignment from %d to %d\n", curNestedAlignment, newNestedAlignment);
+ }
+ curNestedAlignment = newNestedAlignment;
+}
+
+void AddNestedAlignment(unsigned adjustment)
+{
+ unsigned newNestedAlignment = curNestedAlignment + adjustment;
+ if (curNestedAlignment != newNestedAlignment)
+ {
+ JITDUMP("Adjusting stack nested alignment from %d to %d\n", curNestedAlignment, newNestedAlignment);
+ }
+ curNestedAlignment = newNestedAlignment;
+
+ if (curNestedAlignment > maxNestedAlignment)
+ {
+ JITDUMP("Max stack nested alignment changed from %d to %d\n", maxNestedAlignment, curNestedAlignment);
+ maxNestedAlignment = curNestedAlignment;
+ }
+}
+
+#endif
+
#ifdef FEATURE_PUT_STRUCT_ARG_STK
#ifdef _TARGET_X86_
bool genAdjustStackForPutArgStk(GenTreePutArgStk* putArgStk);
diff --git a/src/jit/codegenxarch.cpp b/src/jit/codegenxarch.cpp
index ca6c425daf..9833b09035 100644
--- a/src/jit/codegenxarch.cpp
+++ b/src/jit/codegenxarch.cpp
@@ -1314,7 +1314,7 @@ void CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
case GT_CNS_INT:
#ifdef _TARGET_X86_
- NYI_IF(treeNode->IsIconHandle(GTF_ICON_TLS_HDL), "TLS constants");
+ assert(!treeNode->IsIconHandle(GTF_ICON_TLS_HDL));
#endif // _TARGET_X86_
__fallthrough;
@@ -1625,6 +1625,7 @@ void CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
break;
case GT_IND:
+ {
#ifdef FEATURE_SIMD
// Handling of Vector3 type values loaded through indirection.
if (treeNode->TypeGet() == TYP_SIMD12)
@@ -1634,10 +1635,21 @@ void CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
}
#endif // FEATURE_SIMD
- genConsumeAddress(treeNode->AsIndir()->Addr());
- emit->emitInsMov(ins_Load(treeNode->TypeGet()), emitTypeSize(treeNode), treeNode);
+ GenTree* addr = treeNode->AsIndir()->Addr();
+ if (addr->IsCnsIntOrI() && addr->IsIconHandle(GTF_ICON_TLS_HDL))
+ {
+ noway_assert(EA_ATTR(genTypeSize(treeNode->gtType)) == EA_PTRSIZE);
+ emit->emitIns_R_C(ins_Load(TYP_I_IMPL), EA_PTRSIZE, treeNode->gtRegNum, FLD_GLOBAL_FS,
+ (int)addr->gtIntCon.gtIconVal);
+ }
+ else
+ {
+ genConsumeAddress(addr);
+ emit->emitInsMov(ins_Load(treeNode->TypeGet()), emitTypeSize(treeNode), treeNode);
+ }
genProduceReg(treeNode);
- break;
+ }
+ break;
case GT_MULHI:
#ifdef _TARGET_X86_
@@ -4752,6 +4764,8 @@ bool CodeGen::genEmitOptimizedGCWriteBarrier(GCInfo::WriteBarrierForm writeBarri
// Produce code for a GT_CALL node
void CodeGen::genCallInstruction(GenTreeCall* call)
{
+ genAlignStackBeforeCall(call);
+
gtCallTypes callType = (gtCallTypes)call->gtCallType;
IL_OFFSETX ilOffset = BAD_IL_OFFSET;
@@ -4991,16 +5005,30 @@ void CodeGen::genCallInstruction(GenTreeCall* call)
}
#if defined(_TARGET_X86_)
+ bool fCallerPop = (call->gtFlags & GTF_CALL_POP_ARGS) != 0;
+
+#ifdef UNIX_X86_ABI
+ {
+ CorInfoCallConv callConv = CORINFO_CALLCONV_DEFAULT;
+
+ if ((callType != CT_HELPER) && call->callSig)
+ {
+ callConv = call->callSig->callConv;
+ }
+
+ fCallerPop |= IsCallerPop(callConv);
+ }
+#endif // UNIX_X86_ABI
+
// If the callee pops the arguments, we pass a positive value as the argSize, and the emitter will
// adjust its stack level accordingly.
// If the caller needs to explicitly pop its arguments, we must pass a negative value, and then do the
// pop when we're done.
ssize_t argSizeForEmitter = stackArgBytes;
- if ((call->gtFlags & GTF_CALL_POP_ARGS) != 0)
+ if (fCallerPop)
{
argSizeForEmitter = -stackArgBytes;
}
-
#endif // defined(_TARGET_X86_)
#ifdef FEATURE_AVX_SUPPORT
@@ -5173,15 +5201,6 @@ void CodeGen::genCallInstruction(GenTreeCall* call)
// clang-format on
}
-#if defined(UNIX_X86_ABI)
- // Put back the stack pointer if there was any padding for stack alignment
- unsigned padStackAlign = call->fgArgInfo->GetPadStackAlign();
- if (padStackAlign != 0)
- {
- inst_RV_IV(INS_add, REG_SPBASE, padStackAlign * TARGET_POINTER_SIZE, EA_PTRSIZE);
- }
-#endif // UNIX_X86_ABI
-
// if it was a pinvoke we may have needed to get the address of a label
if (genPendingCallLabel)
{
@@ -5190,11 +5209,6 @@ void CodeGen::genCallInstruction(GenTreeCall* call)
genPendingCallLabel = nullptr;
}
-#if defined(_TARGET_X86_)
- // The call will pop its arguments.
- SubtractStackLevel(stackArgBytes);
-#endif // defined(_TARGET_X86_)
-
// Update GC info:
// All Callee arg registers are trashed and no longer contain any GC pointers.
// TODO-XArch-Bug?: As a matter of fact shouldn't we be killing all of callee trashed regs here?
@@ -5295,6 +5309,8 @@ void CodeGen::genCallInstruction(GenTreeCall* call)
gcInfo.gcMarkRegSetNpt(RBM_INTRET);
}
+ unsigned stackAdjustBias = 0;
+
#if defined(_TARGET_X86_)
//-------------------------------------------------------------------------
// Create a label for tracking of region protected by the monitor in synchronized methods.
@@ -5325,11 +5341,15 @@ void CodeGen::genCallInstruction(GenTreeCall* call)
}
// Is the caller supposed to pop the arguments?
- if (((call->gtFlags & GTF_CALL_POP_ARGS) != 0) && (stackArgBytes != 0))
+ if (fCallerPop && (stackArgBytes != 0))
{
- genAdjustSP(stackArgBytes);
+ stackAdjustBias = stackArgBytes;
}
+
+ SubtractStackLevel(stackArgBytes);
#endif // _TARGET_X86_
+
+ genRemoveAlignmentAfterCall(call, stackAdjustBias);
}
// Produce code for a GT_JMP node.
@@ -7462,16 +7482,10 @@ unsigned CodeGen::getBaseVarForPutArgStk(GenTreePtr treeNode)
unsigned baseVarNum;
-#if FEATURE_FASTTAILCALL
- bool putInIncomingArgArea = treeNode->AsPutArgStk()->putInIncomingArgArea;
-#else
- const bool putInIncomingArgArea = false;
-#endif
-
// Whether to setup stk arg in incoming or out-going arg area?
// Fast tail calls implemented as epilog+jmp = stk arg is setup in incoming arg area.
// All other calls - stk arg is setup in out-going arg area.
- if (putInIncomingArgArea)
+ if (treeNode->AsPutArgStk()->putInIncomingArgArea())
{
// See the note in the function header re: finding the first stack passed argument.
baseVarNum = getFirstArgWithStackSlot();
@@ -7508,7 +7522,96 @@ unsigned CodeGen::getBaseVarForPutArgStk(GenTreePtr treeNode)
return baseVarNum;
}
+//---------------------------------------------------------------------
+// genAlignStackBeforeCall: Align the stack if necessary before a call.
+//
+// Arguments:
+// putArgStk - the putArgStk node.
+//
+void CodeGen::genAlignStackBeforeCall(GenTreePutArgStk* putArgStk)
+{
+#if defined(UNIX_X86_ABI)
+
+ genAlignStackBeforeCall(putArgStk->gtCall);
+
+#endif // UNIX_X86_ABI
+}
+
+//---------------------------------------------------------------------
+// genAlignStackBeforeCall: Align the stack if necessary before a call.
+//
+// Arguments:
+// call - the call node.
+//
+void CodeGen::genAlignStackBeforeCall(GenTreeCall* call)
+{
+#if defined(UNIX_X86_ABI)
+
+ // Have we aligned the stack yet?
+ if (!call->fgArgInfo->IsStkAlignmentDone())
+ {
+ // We haven't done any stack alignment yet for this call. We might need to create
+ // an alignment adjustment, even if this function itself doesn't have any stack args.
+ // This can happen if this function call is part of a nested call sequence, and the outer
+ // call has already pushed some arguments.
+
+ unsigned stkLevel = genStackLevel + call->fgArgInfo->GetStkSizeBytes();
+ call->fgArgInfo->ComputeStackAlignment(stkLevel);
+
+ unsigned padStkAlign = call->fgArgInfo->GetStkAlign();
+ if (padStkAlign != 0)
+ {
+ // Now generate the alignment
+ inst_RV_IV(INS_sub, REG_SPBASE, padStkAlign, EA_PTRSIZE);
+ AddStackLevel(padStkAlign);
+ AddNestedAlignment(padStkAlign);
+ }
+
+ call->fgArgInfo->SetStkAlignmentDone();
+ }
+
+#endif // UNIX_X86_ABI
+}
+
+//---------------------------------------------------------------------
+// genRemoveAlignmentAfterCall: After a call, remove the alignment
+// added before the call, if any.
+//
+// Arguments:
+// call - the call node.
+// bias - additional stack adjustment
+//
+// Note:
+// When bias > 0, caller should adjust stack level appropriately as
+// bias is not considered when adjusting stack level.
+//
+void CodeGen::genRemoveAlignmentAfterCall(GenTreeCall* call, unsigned bias)
+{
+#if defined(_TARGET_X86_)
+#if defined(UNIX_X86_ABI)
+ // Put back the stack pointer if there was any padding for stack alignment
+ unsigned padStkAlign = call->fgArgInfo->GetStkAlign();
+ unsigned padStkAdjust = padStkAlign + bias;
+
+ if (padStkAdjust != 0)
+ {
+ inst_RV_IV(INS_add, REG_SPBASE, padStkAdjust, EA_PTRSIZE);
+ SubtractStackLevel(padStkAlign);
+ SubtractNestedAlignment(padStkAlign);
+ }
+#else // UNIX_X86_ABI
+ if (bias != 0)
+ {
+ genAdjustSP(bias);
+ }
+#endif // !UNIX_X86_ABI_
+#else // _TARGET_X86_
+ assert(bias == 0);
+#endif // !_TARGET_X86
+}
+
#ifdef _TARGET_X86_
+
//---------------------------------------------------------------------
// genAdjustStackForPutArgStk:
// adjust the stack pointer for a putArgStk node if necessary.
@@ -7760,14 +7863,14 @@ void CodeGen::genPutArgStkFieldList(GenTreePutArgStk* putArgStk)
}
else
{
-#if defined(_TARGET_X86_) && defined(FEATURE_SIMD)
+#if defined(FEATURE_SIMD)
if (fieldType == TYP_SIMD12)
{
assert(genIsValidFloatReg(simdTmpReg));
genStoreSIMD12ToStack(argReg, simdTmpReg);
}
else
-#endif // defined(_TARGET_X86_) && defined(FEATURE_SIMD)
+#endif // defined(FEATURE_SIMD)
{
genStoreRegToStackArg(fieldType, argReg, fieldOffset - currentOffset);
}
@@ -7805,15 +7908,7 @@ void CodeGen::genPutArgStk(GenTreePutArgStk* putArgStk)
#ifdef _TARGET_X86_
-#if defined(UNIX_X86_ABI)
- // For each call, first stack argument has the padding for alignment
- // if this value is not zero, use it to adjust the ESP
- unsigned argPadding = putArgStk->getArgPadding();
- if (argPadding != 0)
- {
- inst_RV_IV(INS_sub, REG_SPBASE, argPadding * TARGET_POINTER_SIZE, EA_PTRSIZE);
- }
-#endif
+ genAlignStackBeforeCall(putArgStk);
if (varTypeIsStruct(targetType))
{
diff --git a/src/jit/compiler.cpp b/src/jit/compiler.cpp
index b81ae24b71..df54c8f32a 100644
--- a/src/jit/compiler.cpp
+++ b/src/jit/compiler.cpp
@@ -2296,7 +2296,6 @@ void Compiler::compSetProcessor()
#ifdef FEATURE_AVX_SUPPORT
// COMPlus_EnableAVX can be used to disable using AVX if available on a target machine.
- // Note that FEATURE_AVX_SUPPORT is not enabled for ctpjit
opts.compCanUseAVX = false;
if (!jitFlags.IsSet(JitFlags::JIT_FLAG_PREJIT) && jitFlags.IsSet(JitFlags::JIT_FLAG_USE_AVX2))
{
@@ -2471,7 +2470,8 @@ void Compiler::compInitOptions(JitFlags* jitFlags)
opts.jitFlags = jitFlags;
opts.compFlags = CLFLG_MAXOPT; // Default value is for full optimization
- if (jitFlags->IsSet(JitFlags::JIT_FLAG_DEBUG_CODE) || jitFlags->IsSet(JitFlags::JIT_FLAG_MIN_OPT))
+ if (jitFlags->IsSet(JitFlags::JIT_FLAG_DEBUG_CODE) || jitFlags->IsSet(JitFlags::JIT_FLAG_MIN_OPT) ||
+ jitFlags->IsSet(JitFlags::JIT_FLAG_TIER0))
{
opts.compFlags = CLFLG_MINOPT;
}
@@ -2496,7 +2496,8 @@ void Compiler::compInitOptions(JitFlags* jitFlags)
//
// If the EE sets SPEED_OPT we will optimize for speed at the expense of code size
//
- else if (jitFlags->IsSet(JitFlags::JIT_FLAG_SPEED_OPT))
+ else if (jitFlags->IsSet(JitFlags::JIT_FLAG_SPEED_OPT) ||
+ (jitFlags->IsSet(JitFlags::JIT_FLAG_TIER1) && !jitFlags->IsSet(JitFlags::JIT_FLAG_MIN_OPT)))
{
opts.compCodeOpt = FAST_CODE;
assert(!jitFlags->IsSet(JitFlags::JIT_FLAG_SIZE_OPT));
@@ -4996,11 +4997,7 @@ int Compiler::compCompile(CORINFO_METHOD_HANDLE methodHnd,
info.compMatchedVM = false;
#endif
-#if COR_JIT_EE_VERSION > 460
compMaxUncheckedOffsetForNullObject = eeGetEEInfo()->maxUncheckedOffsetForNullObject;
-#else // COR_JIT_EE_VERSION <= 460
- compMaxUncheckedOffsetForNullObject = MAX_UNCHECKED_OFFSET_FOR_NULL_OBJECT;
-#endif // COR_JIT_EE_VERSION > 460
// Set the context for token lookup.
if (compIsForInlining())
diff --git a/src/jit/compiler.h b/src/jit/compiler.h
index 7baba5da23..5e876aaa2a 100644
--- a/src/jit/compiler.h
+++ b/src/jit/compiler.h
@@ -252,8 +252,10 @@ public:
unsigned char lvStackByref : 1; // This is a compiler temporary of TYP_BYREF that is known to point into our local
// stack frame.
- unsigned char lvArgWrite : 1; // variable is a parameter and STARG was used on it
- unsigned char lvIsTemp : 1; // Short-lifetime compiler temp
+ unsigned char lvHasILStoreOp : 1; // there is at least one STLOC or STARG on this local
+ unsigned char lvHasMultipleILStoreOp : 1; // there is more than one STLOC on this local
+
+ unsigned char lvIsTemp : 1; // Short-lifetime compiler temp
#if OPT_BOOL_OPS
unsigned char lvIsBoolean : 1; // set if variable is boolean
#endif
@@ -324,6 +326,10 @@ public:
unsigned char lvClassIsExact : 1; // lvClassHandle is the exact type
+#ifdef DEBUG
+ unsigned char lvClassInfoUpdated : 1; // true if this var has updated class handle or exactness
+#endif
+
union {
unsigned lvFieldLclStart; // The index of the local var representing the first field in the promoted struct
// local.
@@ -1194,11 +1200,6 @@ struct fgArgTabEntry
unsigned alignment; // 1 or 2 (slots/registers)
unsigned lateArgInx; // index into gtCallLateArgs list
unsigned tmpNum; // the LclVar number if we had to force evaluation of this arg
-#if defined(UNIX_X86_ABI)
- unsigned padStkAlign; // Count of number of padding slots for stack alignment. For each Call, only the first
- // argument may have a value to emit "sub esp, n" to adjust the stack before pushing
- // the argument.
-#endif
bool isSplit : 1; // True when this argument is split between the registers and OutArg area
bool needTmp : 1; // True when we force this argument's evaluation into a temp LclVar
@@ -1276,9 +1277,14 @@ class fgArgInfo
unsigned argCount; // Updatable arg count value
unsigned nextSlotNum; // Updatable slot count value
unsigned stkLevel; // Stack depth when we make this call (for x86)
+
#if defined(UNIX_X86_ABI)
- unsigned padStkAlign; // Count of number of padding slots for stack alignment. This value is used to turn back
- // stack pointer before it was adjusted after each Call
+ bool alignmentDone; // Updateable flag, set to 'true' after we've done any required alignment.
+ unsigned stkSizeBytes; // Size of stack used by this call, in bytes. Calculated during fgMorphArgs().
+ unsigned padStkAlign; // Stack alignment in bytes required before arguments are pushed for this call.
+ // Computed dynamically during codegen, based on stkSizeBytes and the current
+ // stack level (genStackLevel) when the first stack adjustment is made for
+ // this call.
#endif
#if FEATURE_FIXED_OUT_ARGS
@@ -1333,10 +1339,6 @@ public:
void ArgsComplete();
-#if defined(UNIX_X86_ABI)
- void ArgsAlignPadding();
-#endif
-
void SortArgs();
void EvalArgsToTemps();
@@ -1356,12 +1358,6 @@ public:
{
return nextSlotNum;
}
-#if defined(UNIX_X86_ABI)
- unsigned GetPadStackAlign()
- {
- return padStkAlign;
- }
-#endif
bool HasRegArgs()
{
return hasRegArgs;
@@ -1384,6 +1380,40 @@ public:
outArgSize = newVal;
}
#endif // FEATURE_FIXED_OUT_ARGS
+
+ void ComputeStackAlignment(unsigned curStackLevelInBytes)
+ {
+#if defined(UNIX_X86_ABI)
+ padStkAlign = AlignmentPad(curStackLevelInBytes, STACK_ALIGN);
+#endif // defined(UNIX_X86_ABI)
+ }
+
+ void SetStkSizeBytes(unsigned newStkSizeBytes)
+ {
+#if defined(UNIX_X86_ABI)
+ stkSizeBytes = newStkSizeBytes;
+#endif // defined(UNIX_X86_ABI)
+ }
+
+#if defined(UNIX_X86_ABI)
+ unsigned GetStkAlign()
+ {
+ return padStkAlign;
+ }
+ unsigned GetStkSizeBytes() const
+ {
+ return stkSizeBytes;
+ }
+ bool IsStkAlignmentDone() const
+ {
+ return alignmentDone;
+ }
+ void SetStkAlignmentDone()
+ {
+ alignmentDone = true;
+ }
+#endif // defined(UNIX_X86_ABI)
+
// Get the late arg for arg at position argIndex. Caller must ensure this position has a late arg.
GenTreePtr GetLateArg(unsigned argIndex);
};
@@ -2648,11 +2678,16 @@ public:
// Returns true if this local var is a multireg struct
bool lvaIsMultiregStruct(LclVarDsc* varDsc);
- // If the class is a TYP_STRUCT, get/set a class handle describing it
-
+ // If the local is a TYP_STRUCT, get/set a class handle describing it
CORINFO_CLASS_HANDLE lvaGetStruct(unsigned varNum);
void lvaSetStruct(unsigned varNum, CORINFO_CLASS_HANDLE typeHnd, bool unsafeValueClsCheck, bool setTypeInfo = true);
+ // If the local is TYP_REF, set or update the associated class information.
+ void lvaSetClass(unsigned varNum, CORINFO_CLASS_HANDLE clsHnd, bool isExact = false);
+ void lvaSetClass(unsigned varNum, GenTreePtr tree, CORINFO_CLASS_HANDLE stackHandle = nullptr);
+ void lvaUpdateClass(unsigned varNum, CORINFO_CLASS_HANDLE clsHnd, bool isExact = false);
+ void lvaUpdateClass(unsigned varNum, GenTreePtr tree, CORINFO_CLASS_HANDLE stackHandle = nullptr);
+
#define MAX_NumOfFieldsInPromotableStruct 4 // Maximum number of fields in promotable struct
// Info about struct fields
@@ -2868,10 +2903,6 @@ protected:
void impHandleAccessAllowed(CorInfoIsAccessAllowedResult result, CORINFO_HELPER_DESC* helperCall);
void impHandleAccessAllowedInternal(CorInfoIsAccessAllowedResult result, CORINFO_HELPER_DESC* helperCall);
- void impInsertCalloutForDelegate(CORINFO_METHOD_HANDLE callerMethodHnd,
- CORINFO_METHOD_HANDLE calleeMethodHnd,
- CORINFO_CLASS_HANDLE delegateTypeHnd);
-
var_types impImportCall(OPCODE opcode,
CORINFO_RESOLVED_TOKEN* pResolvedToken,
CORINFO_RESOLVED_TOKEN* pConstrainedResolvedToken, // Is this a "constrained." call on a
@@ -3552,7 +3583,7 @@ public:
bool fgSlopUsedInEdgeWeights; // true if their was some slop used when computing the edge weights
bool fgRangeUsedInEdgeWeights; // true if some of the edgeWeight are expressed in Min..Max form
bool fgNeedsUpdateFlowGraph; // true if we need to run fgUpdateFlowGraph
- BasicBlock::weight_t fgCalledWeight; // count of the number of times this method was called
+ BasicBlock::weight_t fgCalledCount; // count of the number of times this method was called
// This is derived from the profile data
// or is BB_UNITY_WEIGHT when we don't have profile data
@@ -4528,12 +4559,22 @@ protected:
bool fgHaveProfileData();
bool fgGetProfileWeightForBasicBlock(IL_OFFSET offset, unsigned* weight);
+ void fgInstrumentMethod();
+public:
+ // fgIsUsingProfileWeights - returns true if we have real profile data for this method
+ // or if we have some fake profile data for the stress mode
bool fgIsUsingProfileWeights()
{
return (fgHaveProfileData() || fgStressBBProf());
}
- void fgInstrumentMethod();
+
+ // fgProfileRunsCount - returns total number of scenario runs for the profile data
+ // or BB_UNITY_WEIGHT when we aren't using profile data.
+ unsigned fgProfileRunsCount()
+ {
+ return fgIsUsingProfileWeights() ? fgNumProfileRuns : BB_UNITY_WEIGHT;
+ }
//-------- Insert a statement at the start or end of a basic block --------
@@ -5384,7 +5425,6 @@ protected:
// Keeps tracked cse indices
BitVecTraits* cseTraits;
EXPSET_TP cseFull;
- EXPSET_TP cseEmpty;
/* Generic list of nodes - used by the CSE logic */
@@ -5657,7 +5697,6 @@ public:
// Data structures for assertion prop
BitVecTraits* apTraits;
ASSERT_TP apFull;
- ASSERT_TP apEmpty;
enum optAssertionKind
{
@@ -5906,21 +5945,6 @@ public:
}
};
- typedef unsigned short AssertionIndex;
-
- // By default the assertion generated by a GT_JTRUE node holds on the true (bbJumpDest) edge.
- // If the OAE_NEXT_EDGE bit of the assertion index is set then the assertion holds on the false (bbNext) edge
- // and the OAE_NEXT_EDGE bit needs to be masked to obtain the real assertion index.
- // Currently this is used by OAK_NO_THROW assertions but it may also be useful for other kinds of assertions
- // by removing the need to create unnecessary complementary assertions. However, this bit twiddling mechanism
- // is fragile and should be replaced with something cleaner (e.g. struct + bitfield).
- enum optAssertionEdge : AssertionIndex
- {
- // OAE_JUMP_EDGE = 0x0000, // assertion holds for bbJumpDest (default)
- OAE_NEXT_EDGE = 0x8000, // assertion holds for bbNext
- OAE_INDEX_MASK = 0x7fff
- };
-
protected:
static fgWalkPreFn optAddCopiesCallback;
static fgWalkPreFn optVNAssertionPropCurStmtVisitor;
@@ -5957,8 +5981,6 @@ public:
ValueNumToAssertsMap;
ValueNumToAssertsMap* optValueNumToAsserts;
- static const AssertionIndex NO_ASSERTION_INDEX = 0;
-
// Assertion prop helpers.
ASSERT_TP& GetAssertionDep(unsigned lclNum);
AssertionDsc* optGetAssertion(AssertionIndex assertIndex);
@@ -5979,8 +6001,8 @@ public:
// Assertion Gen functions.
void optAssertionGen(GenTreePtr tree);
AssertionIndex optAssertionGenPhiDefn(GenTreePtr tree);
- AssertionIndex optCreateJTrueBoundsAssertion(GenTreePtr tree);
- AssertionIndex optAssertionGenJtrue(GenTreePtr tree);
+ AssertionInfo optCreateJTrueBoundsAssertion(GenTreePtr tree);
+ AssertionInfo optAssertionGenJtrue(GenTreePtr tree);
AssertionIndex optCreateJtrueAssertions(GenTreePtr op1, GenTreePtr op2, Compiler::optAssertionKind assertionKind);
AssertionIndex optFindComplementary(AssertionIndex assertionIndex);
void optMapComplementary(AssertionIndex assertionIndex, AssertionIndex index);
@@ -6043,9 +6065,6 @@ public:
void optImpliedByCopyAssertion(AssertionDsc* copyAssertion, AssertionDsc* depAssertion, ASSERT_TP& result);
void optImpliedByConstAssertion(AssertionDsc* curAssertion, ASSERT_TP& result);
- ASSERT_VALRET_TP optNewFullAssertSet();
- ASSERT_VALRET_TP optNewEmptyAssertSet();
-
#ifdef DEBUG
void optPrintAssertion(AssertionDsc* newAssertion, AssertionIndex assertionIndex = 0);
void optDebugCheckAssertion(AssertionDsc* assertion);
@@ -6561,11 +6580,7 @@ public:
// Returns the page size for the target machine as reported by the EE.
inline size_t eeGetPageSize()
{
-#if COR_JIT_EE_VERSION > 460
return eeGetEEInfo()->osPageSize;
-#else // COR_JIT_EE_VERSION <= 460
- return CORINFO_PAGE_SIZE;
-#endif // COR_JIT_EE_VERSION > 460
}
// Returns the frame size at which we will generate a loop to probe the stack.
@@ -6583,11 +6598,7 @@ public:
inline bool IsTargetAbi(CORINFO_RUNTIME_ABI abi)
{
-#if COR_JIT_EE_VERSION > 460
return eeGetEEInfo()->targetAbi == abi;
-#else
- return CORINFO_DESKTOP_ABI == abi;
-#endif
}
inline bool generateCFIUnwindCodes()
@@ -7782,28 +7793,20 @@ public:
// PInvoke transitions inline (e.g. when targeting CoreRT).
inline bool ShouldUsePInvokeHelpers()
{
-#if COR_JIT_EE_VERSION > 460
return jitFlags->IsSet(JitFlags::JIT_FLAG_USE_PINVOKE_HELPERS);
-#else
- return false;
-#endif
}
// true if we should use insert the REVERSE_PINVOKE_{ENTER,EXIT} helpers in the method
// prolog/epilog
inline bool IsReversePInvoke()
{
-#if COR_JIT_EE_VERSION > 460
return jitFlags->IsSet(JitFlags::JIT_FLAG_REVERSE_PINVOKE);
-#else
- return false;
-#endif
}
// true if we must generate code compatible with JIT32 quirks
inline bool IsJit32Compat()
{
-#if defined(_TARGET_X86_) && COR_JIT_EE_VERSION > 460
+#if defined(_TARGET_X86_)
return jitFlags->IsSet(JitFlags::JIT_FLAG_DESKTOP_QUIRKS);
#else
return false;
@@ -7813,9 +7816,9 @@ public:
// true if we must generate code compatible with Jit64 quirks
inline bool IsJit64Compat()
{
-#if defined(_TARGET_AMD64_) && COR_JIT_EE_VERSION > 460
+#if defined(_TARGET_AMD64_)
return jitFlags->IsSet(JitFlags::JIT_FLAG_DESKTOP_QUIRKS);
-#elif defined(_TARGET_AMD64_) && !defined(FEATURE_CORECLR)
+#elif !defined(FEATURE_CORECLR)
return true;
#else
return false;
diff --git a/src/jit/compiler.hpp b/src/jit/compiler.hpp
index 3a6dd82f3a..002694776f 100644
--- a/src/jit/compiler.hpp
+++ b/src/jit/compiler.hpp
@@ -2530,10 +2530,10 @@ inline BOOL Compiler::lvaIsOriginalThisArg(unsigned varNum)
// copy to a new local, and mark the original as DoNotEnregister, to
// ensure that it is stack-allocated. It should not be the case that the original one can be modified -- it
// should not be written to, or address-exposed.
- assert(!varDsc->lvArgWrite &&
+ assert(!varDsc->lvHasILStoreOp &&
(!varDsc->lvAddrExposed || ((info.compMethodInfo->options & CORINFO_GENERICS_CTXT_FROM_THIS) != 0)));
#else
- assert(!varDsc->lvArgWrite && !varDsc->lvAddrExposed);
+ assert(!varDsc->lvHasILStoreOp && !varDsc->lvAddrExposed);
#endif
}
#endif
@@ -2891,9 +2891,7 @@ inline bool Compiler::fgIsThrowHlpBlk(BasicBlock* block)
if (!((call->gtCall.gtCallMethHnd == eeFindHelper(CORINFO_HELP_RNGCHKFAIL)) ||
(call->gtCall.gtCallMethHnd == eeFindHelper(CORINFO_HELP_THROWDIVZERO)) ||
-#if COR_JIT_EE_VERSION > 460
(call->gtCall.gtCallMethHnd == eeFindHelper(CORINFO_HELP_THROWNULLREF)) ||
-#endif // COR_JIT_EE_VERSION
(call->gtCall.gtCallMethHnd == eeFindHelper(CORINFO_HELP_OVERFLOW))))
{
return false;
@@ -2907,11 +2905,8 @@ inline bool Compiler::fgIsThrowHlpBlk(BasicBlock* block)
{
if (block == add->acdDstBlk)
{
- return add->acdKind == SCK_RNGCHK_FAIL || add->acdKind == SCK_DIV_BY_ZERO || add->acdKind == SCK_OVERFLOW
-#if COR_JIT_EE_VERSION > 460
- || add->acdKind == SCK_ARG_EXCPN || add->acdKind == SCK_ARG_RNG_EXCPN
-#endif // COR_JIT_EE_VERSION
- ;
+ return add->acdKind == SCK_RNGCHK_FAIL || add->acdKind == SCK_DIV_BY_ZERO || add->acdKind == SCK_OVERFLOW ||
+ add->acdKind == SCK_ARG_EXCPN || add->acdKind == SCK_ARG_RNG_EXCPN;
}
}
@@ -2933,11 +2928,8 @@ inline unsigned Compiler::fgThrowHlpBlkStkLevel(BasicBlock* block)
{
// Compute assert cond separately as assert macro cannot have conditional compilation directives.
bool cond =
- (add->acdKind == SCK_RNGCHK_FAIL || add->acdKind == SCK_DIV_BY_ZERO || add->acdKind == SCK_OVERFLOW
-#if COR_JIT_EE_VERSION > 460
- || add->acdKind == SCK_ARG_EXCPN || add->acdKind == SCK_ARG_RNG_EXCPN
-#endif // COR_JIT_EE_VERSION
- );
+ (add->acdKind == SCK_RNGCHK_FAIL || add->acdKind == SCK_DIV_BY_ZERO || add->acdKind == SCK_OVERFLOW ||
+ add->acdKind == SCK_ARG_EXCPN || add->acdKind == SCK_ARG_RNG_EXCPN);
assert(cond);
// TODO: bbTgtStkDepth is DEBUG-only.
diff --git a/src/jit/compilerbitsettraits.h b/src/jit/compilerbitsettraits.h
index 4365c518d7..d0436f4052 100644
--- a/src/jit/compilerbitsettraits.h
+++ b/src/jit/compilerbitsettraits.h
@@ -22,10 +22,10 @@
class CompAllocBitSetTraits
{
public:
- static inline IAllocator* GetAllocator(class Compiler* comp);
+ static inline void* Alloc(Compiler* comp, size_t byteSize);
#ifdef DEBUG
- static inline IAllocator* GetDebugOnlyAllocator(class Compiler* comp);
+ static inline void* DebugAlloc(Compiler* comp, size_t byteSize);
#endif // DEBUG
};
@@ -112,10 +112,10 @@ public:
{
}
- static inline IAllocator* GetAllocator(BitVecTraits* b);
+ static inline void* Alloc(BitVecTraits* b, size_t byteSize);
#ifdef DEBUG
- static inline IAllocator* GetDebugOnlyAllocator(BitVecTraits* b);
+ static inline void* DebugAlloc(BitVecTraits* b, size_t byteSize);
#endif // DEBUG
static inline unsigned GetSize(BitVecTraits* b);
diff --git a/src/jit/compilerbitsettraits.hpp b/src/jit/compilerbitsettraits.hpp
index e2ba2f8a7a..be30564701 100644
--- a/src/jit/compilerbitsettraits.hpp
+++ b/src/jit/compilerbitsettraits.hpp
@@ -15,16 +15,16 @@
///////////////////////////////////////////////////////////////////////////////
// static
-IAllocator* CompAllocBitSetTraits::GetAllocator(Compiler* comp)
+void* CompAllocBitSetTraits::Alloc(Compiler* comp, size_t byteSize)
{
- return comp->getAllocatorBitset();
+ return comp->compGetMem(byteSize, CMK_bitset);
}
#ifdef DEBUG
// static
-IAllocator* CompAllocBitSetTraits::GetDebugOnlyAllocator(Compiler* comp)
+void* CompAllocBitSetTraits::DebugAlloc(Compiler* comp, size_t byteSize)
{
- return comp->getAllocatorDebugOnly();
+ return comp->compGetMem(byteSize, CMK_DebugOnly);
}
#endif // DEBUG
@@ -139,16 +139,16 @@ BitSetSupport::BitSetOpCounter* BasicBlockBitSetTraits::GetOpCounter(Compiler* c
///////////////////////////////////////////////////////////////////////////////
// static
-IAllocator* BitVecTraits::GetAllocator(BitVecTraits* b)
+void* BitVecTraits::Alloc(BitVecTraits* b, size_t byteSize)
{
- return b->comp->getAllocatorBitset();
+ return b->comp->compGetMem(byteSize, CMK_bitset);
}
#ifdef DEBUG
// static
-IAllocator* BitVecTraits::GetDebugOnlyAllocator(BitVecTraits* b)
+void* BitVecTraits::DebugAlloc(BitVecTraits* b, size_t byteSize)
{
- return b->comp->getAllocatorDebugOnly();
+ return b->comp->compGetMem(byteSize, CMK_DebugOnly);
}
#endif // DEBUG
diff --git a/src/jit/ee_il_dll.cpp b/src/jit/ee_il_dll.cpp
index cfbc44cab6..c0384f3858 100644
--- a/src/jit/ee_il_dll.cpp
+++ b/src/jit/ee_il_dll.cpp
@@ -136,9 +136,6 @@ extern "C" BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID pvReserv
{
g_hInst = (HINSTANCE)hInstance;
DisableThreadLibraryCalls((HINSTANCE)hInstance);
-#if defined(SELF_NO_HOST) && COR_JIT_EE_VERSION <= 460
- jitStartup(JitHost::getJitHost());
-#endif
}
else if (dwReason == DLL_PROCESS_DETACH)
{
@@ -158,10 +155,6 @@ extern "C" void __stdcall sxsJitStartup(CoreClrCallbacks const& cccallbacks)
#ifndef SELF_NO_HOST
InitUtilcode(cccallbacks);
#endif
-
-#if COR_JIT_EE_VERSION <= 460
- jitStartup(JitHost::getJitHost());
-#endif
}
#endif // !FEATURE_MERGE_JIT_AND_ENGINE
@@ -286,15 +279,11 @@ CorJitResult CILJit::compileMethod(
JitFlags jitFlags;
-#if COR_JIT_EE_VERSION > 460
assert(flags == CORJIT_FLAGS::CORJIT_FLAG_CALL_GETJITFLAGS);
CORJIT_FLAGS corJitFlags;
DWORD jitFlagsSize = compHnd->getJitFlags(&corJitFlags, sizeof(corJitFlags));
assert(jitFlagsSize == sizeof(corJitFlags));
jitFlags.SetFromFlags(corJitFlags);
-#else // COR_JIT_EE_VERSION <= 460
- jitFlags.SetFromOldFlags(flags, 0);
-#endif // COR_JIT_EE_VERSION <= 460
int result;
void* methodCodePtr = nullptr;
@@ -382,11 +371,7 @@ void CILJit::getVersionIdentifier(GUID* versionIdentifier)
* Determine the maximum length of SIMD vector supported by this JIT.
*/
-#if COR_JIT_EE_VERSION > 460
unsigned CILJit::getMaxIntrinsicSIMDVectorLength(CORJIT_FLAGS cpuCompileFlags)
-#else
-unsigned CILJit::getMaxIntrinsicSIMDVectorLength(DWORD cpuCompileFlags)
-#endif
{
if (g_realJitCompiler != nullptr)
{
@@ -394,12 +379,7 @@ unsigned CILJit::getMaxIntrinsicSIMDVectorLength(DWORD cpuCompileFlags)
}
JitFlags jitFlags;
-
-#if COR_JIT_EE_VERSION > 460
jitFlags.SetFromFlags(cpuCompileFlags);
-#else // COR_JIT_EE_VERSION <= 460
- jitFlags.SetFromOldFlags(cpuCompileFlags, 0);
-#endif // COR_JIT_EE_VERSION <= 460
#ifdef FEATURE_SIMD
#ifdef _TARGET_XARCH_
@@ -1244,146 +1224,6 @@ void Compiler::eeGetSystemVAmd64PassStructInRegisterDescriptor(
#endif // FEATURE_UNIX_AMD64_STRUCT_PASSING
-#if COR_JIT_EE_VERSION <= 460
-
-// Validate the token to determine whether to turn the bad image format exception into
-// verification failure (for backward compatibility)
-static bool isValidTokenForTryResolveToken(ICorJitInfo* corInfo, CORINFO_RESOLVED_TOKEN* resolvedToken)
-{
- if (!corInfo->isValidToken(resolvedToken->tokenScope, resolvedToken->token))
- return false;
-
- CorInfoTokenKind tokenType = resolvedToken->tokenType;
- switch (TypeFromToken(resolvedToken->token))
- {
- case mdtModuleRef:
- case mdtTypeDef:
- case mdtTypeRef:
- case mdtTypeSpec:
- if ((tokenType & CORINFO_TOKENKIND_Class) == 0)
- return false;
- break;
-
- case mdtMethodDef:
- case mdtMethodSpec:
- if ((tokenType & CORINFO_TOKENKIND_Method) == 0)
- return false;
- break;
-
- case mdtFieldDef:
- if ((tokenType & CORINFO_TOKENKIND_Field) == 0)
- return false;
- break;
-
- case mdtMemberRef:
- if ((tokenType & (CORINFO_TOKENKIND_Method | CORINFO_TOKENKIND_Field)) == 0)
- return false;
- break;
-
- default:
- return false;
- }
-
- return true;
-}
-
-// This type encapsulates the information necessary for `TryResolveTokenFilter` and
-// `eeTryResolveToken` below.
-struct TryResolveTokenFilterParam
-{
- ICorJitInfo* m_corInfo;
- CORINFO_RESOLVED_TOKEN* m_resolvedToken;
- EXCEPTION_POINTERS m_exceptionPointers;
- bool m_success;
-};
-
-LONG TryResolveTokenFilter(struct _EXCEPTION_POINTERS* exceptionPointers, void* theParam)
-{
- assert(exceptionPointers->ExceptionRecord->ExceptionCode != SEH_VERIFICATION_EXCEPTION);
-
- // Backward compatibility: Convert bad image format exceptions thrown by the EE while resolving token to
- // verification exceptions if we are verifying. Verification exceptions will cause the JIT of the basic block to
- // fail, but the JITing of the whole method is still going to succeed. This is done for backward compatibility only.
- // Ideally, we would always treat bad tokens in the IL stream as fatal errors.
- if (exceptionPointers->ExceptionRecord->ExceptionCode == EXCEPTION_COMPLUS)
- {
- auto* param = reinterpret_cast<TryResolveTokenFilterParam*>(theParam);
- if (!isValidTokenForTryResolveToken(param->m_corInfo, param->m_resolvedToken))
- {
- param->m_exceptionPointers = *exceptionPointers;
- return param->m_corInfo->FilterException(exceptionPointers);
- }
- }
-
- return EXCEPTION_CONTINUE_SEARCH;
-}
-
-bool Compiler::eeTryResolveToken(CORINFO_RESOLVED_TOKEN* resolvedToken)
-{
- TryResolveTokenFilterParam param;
- param.m_corInfo = info.compCompHnd;
- param.m_resolvedToken = resolvedToken;
- param.m_success = true;
-
- PAL_TRY(TryResolveTokenFilterParam*, pParam, &param)
- {
- pParam->m_corInfo->resolveToken(pParam->m_resolvedToken);
- }
- PAL_EXCEPT_FILTER(TryResolveTokenFilter)
- {
- if (param.m_exceptionPointers.ExceptionRecord->ExceptionCode == EXCEPTION_COMPLUS)
- {
- param.m_corInfo->HandleException(&param.m_exceptionPointers);
- }
-
- param.m_success = false;
- }
- PAL_ENDTRY
-
- return param.m_success;
-}
-
-struct TrapParam
-{
- ICorJitInfo* m_corInfo;
- EXCEPTION_POINTERS m_exceptionPointers;
-
- void (*m_function)(void*);
- void* m_param;
- bool m_success;
-};
-
-static LONG __EEFilter(PEXCEPTION_POINTERS exceptionPointers, void* param)
-{
- auto* trapParam = reinterpret_cast<TrapParam*>(param);
- trapParam->m_exceptionPointers = *exceptionPointers;
- return trapParam->m_corInfo->FilterException(exceptionPointers);
-}
-
-bool Compiler::eeRunWithErrorTrapImp(void (*function)(void*), void* param)
-{
- TrapParam trapParam;
- trapParam.m_corInfo = info.compCompHnd;
- trapParam.m_function = function;
- trapParam.m_param = param;
- trapParam.m_success = true;
-
- PAL_TRY(TrapParam*, __trapParam, &trapParam)
- {
- __trapParam->m_function(__trapParam->m_param);
- }
- PAL_EXCEPT_FILTER(__EEFilter)
- {
- trapParam.m_corInfo->HandleException(&trapParam.m_exceptionPointers);
- trapParam.m_success = false;
- }
- PAL_ENDTRY
-
- return trapParam.m_success;
-}
-
-#else // CORJIT_EE_VER <= 460
-
bool Compiler::eeTryResolveToken(CORINFO_RESOLVED_TOKEN* resolvedToken)
{
return info.compCompHnd->tryResolveToken(resolvedToken);
@@ -1394,8 +1234,6 @@ bool Compiler::eeRunWithErrorTrapImp(void (*function)(void*), void* param)
return info.compCompHnd->runWithErrorTrap(function, param);
}
-#endif // CORJIT_EE_VER > 460
-
/*****************************************************************************
*
* Utility functions
diff --git a/src/jit/ee_il_dll.hpp b/src/jit/ee_il_dll.hpp
index 3899d92192..0565d6f561 100644
--- a/src/jit/ee_il_dll.hpp
+++ b/src/jit/ee_il_dll.hpp
@@ -21,11 +21,7 @@ class CILJit : public ICorJitCompiler
void getVersionIdentifier(GUID* versionIdentifier /* OUT */
);
-#if COR_JIT_EE_VERSION > 460
unsigned getMaxIntrinsicSIMDVectorLength(CORJIT_FLAGS cpuCompileFlags);
-#else
- unsigned getMaxIntrinsicSIMDVectorLength(DWORD cpuCompileFlags);
-#endif
void setRealJit(ICorJitCompiler* realJitCompiler);
};
diff --git a/src/jit/emit.cpp b/src/jit/emit.cpp
index 6d08b52d98..e9ba4e501e 100644
--- a/src/jit/emit.cpp
+++ b/src/jit/emit.cpp
@@ -4502,7 +4502,7 @@ unsigned emitter::emitEndCodeGen(Compiler* comp,
//
if (emitComp->fgHaveProfileData())
{
- if (emitComp->fgCalledWeight > (BB_VERY_HOT_WEIGHT * emitComp->fgNumProfileRuns))
+ if (emitComp->fgCalledCount > (BB_VERY_HOT_WEIGHT * emitComp->fgProfileRunsCount()))
{
allocMemFlag = CORJIT_ALLOCMEM_FLG_16BYTE_ALIGN;
}
diff --git a/src/jit/emitarm.cpp b/src/jit/emitarm.cpp
index f7943f2ffd..77ee3cfc18 100644
--- a/src/jit/emitarm.cpp
+++ b/src/jit/emitarm.cpp
@@ -1380,7 +1380,7 @@ DONE:
/*****************************************************************************
*
- * emitIns_valid_imm_for_add() returns true when the immediate 'imm'
+ * emitins_valid_imm_for_add() returns true when the immediate 'imm'
* can be encoded using a single add or sub instruction.
*/
/*static*/ bool emitter::emitIns_valid_imm_for_add(int imm, insFlags flags)
@@ -1396,6 +1396,20 @@ DONE:
/*****************************************************************************
*
+ * emitins_valid_imm_for_cmp() returns true if this 'imm'
+ * can be encoded as a input operand to an cmp instruction.
+ */
+/*static*/ bool emitter::emitIns_valid_imm_for_cmp(int imm, insFlags flags)
+{
+ if (isModImmConst(imm)) // funky arm immediate
+ return true;
+ if (isModImmConst(-imm)) // funky arm immediate via sub
+ return true;
+ return false;
+}
+
+/*****************************************************************************
+ *
* emitIns_valid_imm_for_add_sp() returns true when the immediate 'imm'
* can be encoded in "add Rd,SP,i10".
*/
diff --git a/src/jit/emitarm.h b/src/jit/emitarm.h
index 6c153a1a33..8ad1268310 100644
--- a/src/jit/emitarm.h
+++ b/src/jit/emitarm.h
@@ -243,6 +243,7 @@ static bool emitIns_valid_imm_for_alu(int imm);
static bool emitIns_valid_imm_for_mov(int imm);
static bool emitIns_valid_imm_for_small_mov(regNumber reg, int imm, insFlags flags);
static bool emitIns_valid_imm_for_add(int imm, insFlags flags);
+static bool emitIns_valid_imm_for_cmp(int imm, insFlags flags);
static bool emitIns_valid_imm_for_add_sp(int imm);
void emitIns(instruction ins);
diff --git a/src/jit/emitarm64.cpp b/src/jit/emitarm64.cpp
index dd4bac808a..f0eb641259 100644
--- a/src/jit/emitarm64.cpp
+++ b/src/jit/emitarm64.cpp
@@ -6697,12 +6697,8 @@ void emitter::emitIns_Call(EmitCallType callType,
{
assert(emitNoGChelper(Compiler::eeGetHelperNum(methHnd)));
- // This call will preserve the liveness of most registers
- //
- // - On the ARM64 the NOGC helpers will preserve all registers,
- // except for those listed in the RBM_CALLEE_TRASH_NOGC mask
-
- savedSet = RBM_ALLINT & ~RBM_CALLEE_TRASH_NOGC;
+ // Get the set of registers that this call kills and remove it from the saved set.
+ savedSet = RBM_ALLINT & ~emitComp->compNoGCHelperCallKillSet(Compiler::eeGetHelperNum(methHnd));
// In case of Leave profiler callback, we need to preserve liveness of REG_PROFILER_RET_SCRATCH
if (isProfLeaveCB)
diff --git a/src/jit/flowgraph.cpp b/src/jit/flowgraph.cpp
index 8bd267ccf8..534cb40471 100644
--- a/src/jit/flowgraph.cpp
+++ b/src/jit/flowgraph.cpp
@@ -44,7 +44,7 @@ void Compiler::fgInit()
fgSlopUsedInEdgeWeights = false;
fgRangeUsedInEdgeWeights = true;
fgNeedsUpdateFlowGraph = false;
- fgCalledWeight = BB_ZERO_WEIGHT;
+ fgCalledCount = BB_ZERO_WEIGHT;
/* We haven't yet computed the dominator sets */
fgDomsComputed = false;
@@ -420,6 +420,9 @@ BasicBlock* Compiler::fgNewBasicBlock(BBjumpKinds jumpKind)
void Compiler::fgEnsureFirstBBisScratch()
{
+ // This method does not update predecessor lists and so must only be called before they are computed.
+ assert(!fgComputePredsDone);
+
// Have we already allocated a scratch block?
if (fgFirstBBisScratch())
@@ -434,10 +437,11 @@ void Compiler::fgEnsureFirstBBisScratch()
if (fgFirstBB != nullptr)
{
// If we have profile data the new block will inherit fgFirstBlock's weight
- if (fgFirstBB->bbFlags & BBF_PROF_WEIGHT)
+ if (fgFirstBB->hasProfileWeight())
{
block->inheritWeight(fgFirstBB);
}
+
fgInsertBBbefore(fgFirstBB, block);
}
else
@@ -4271,7 +4275,7 @@ private:
// jumpTarget[N] is set to a JT_* value if IL offset N is a
// jump target in the method.
//
-// Also sets lvAddrExposed and lvArgWrite in lvaTable[].
+// Also sets lvAddrExposed and lvHasILStoreOp, ilHasMultipleILStoreOp in lvaTable[].
#ifdef _PREFAST_
#pragma warning(push)
@@ -4535,20 +4539,80 @@ void Compiler::fgFindJumpTargets(const BYTE* codeAddr, IL_OFFSET codeSize, BYTE*
}
varNum = (sz == sizeof(BYTE)) ? getU1LittleEndian(codeAddr) : getU2LittleEndian(codeAddr);
- varNum = compMapILargNum(varNum); // account for possible hidden param
- // This check is only intended to prevent an AV. Bad varNum values will later
- // be handled properly by the verifier.
- if (varNum < lvaTableCnt)
+ if (isInlining)
{
- if (isInlining)
+ if (varNum < impInlineInfo->argCnt)
{
impInlineInfo->inlArgInfo[varNum].argHasStargOp = true;
}
+ }
+ else
+ {
+ // account for possible hidden param
+ varNum = compMapILargNum(varNum);
+
+ // This check is only intended to prevent an AV. Bad varNum values will later
+ // be handled properly by the verifier.
+ if (varNum < lvaTableCnt)
+ {
+ // In non-inline cases, note written-to arguments.
+ lvaTable[varNum].lvHasILStoreOp = 1;
+ }
+ }
+ }
+ break;
+
+ case CEE_STLOC_0:
+ case CEE_STLOC_1:
+ case CEE_STLOC_2:
+ case CEE_STLOC_3:
+ varNum = (opcode - CEE_STLOC_0);
+ goto STLOC;
+
+ case CEE_STLOC:
+ case CEE_STLOC_S:
+ {
+ noway_assert(sz == sizeof(BYTE) || sz == sizeof(WORD));
+
+ if (codeAddr > codeEndp - sz)
+ {
+ goto TOO_FAR;
+ }
+
+ varNum = (sz == sizeof(BYTE)) ? getU1LittleEndian(codeAddr) : getU2LittleEndian(codeAddr);
+
+ STLOC:
+ if (isInlining)
+ {
+ InlLclVarInfo& lclInfo = impInlineInfo->lclVarInfo[varNum + impInlineInfo->argCnt];
+
+ if (lclInfo.lclHasStlocOp)
+ {
+ lclInfo.lclHasMultipleStlocOp = 1;
+ }
else
{
+ lclInfo.lclHasStlocOp = 1;
+ }
+ }
+ else
+ {
+ varNum += info.compArgsCount;
+
+ // This check is only intended to prevent an AV. Bad varNum values will later
+ // be handled properly by the verifier.
+ if (varNum < lvaTableCnt)
+ {
// In non-inline cases, note written-to locals.
- lvaTable[varNum].lvArgWrite = 1;
+ if (lvaTable[varNum].lvHasILStoreOp)
+ {
+ lvaTable[varNum].lvHasMultipleILStoreOp = 1;
+ }
+ else
+ {
+ lvaTable[varNum].lvHasILStoreOp = 1;
+ }
}
}
}
@@ -4870,11 +4934,11 @@ void Compiler::fgAdjustForAddressExposedOrWrittenThis()
// Optionally enable adjustment during stress.
if (!tiVerificationNeeded && compStressCompile(STRESS_GENERIC_VARN, 15))
{
- lvaTable[info.compThisArg].lvArgWrite = true;
+ lvaTable[info.compThisArg].lvHasILStoreOp = true;
}
// If this is exposed or written to, create a temp for the modifiable this
- if (lvaTable[info.compThisArg].lvAddrExposed || lvaTable[info.compThisArg].lvArgWrite)
+ if (lvaTable[info.compThisArg].lvAddrExposed || lvaTable[info.compThisArg].lvHasILStoreOp)
{
// If there is a "ldarga 0" or "starg 0", grab and use the temp.
lvaArg0Var = lvaGrabTemp(false DEBUGARG("Address-exposed, or written this pointer"));
@@ -4888,14 +4952,14 @@ void Compiler::fgAdjustForAddressExposedOrWrittenThis()
lvaTable[lvaArg0Var].lvLclFieldExpr = lvaTable[info.compThisArg].lvLclFieldExpr;
lvaTable[lvaArg0Var].lvLiveAcrossUCall = lvaTable[info.compThisArg].lvLiveAcrossUCall;
#endif
- lvaTable[lvaArg0Var].lvArgWrite = lvaTable[info.compThisArg].lvArgWrite;
- lvaTable[lvaArg0Var].lvVerTypeInfo = lvaTable[info.compThisArg].lvVerTypeInfo;
+ lvaTable[lvaArg0Var].lvHasILStoreOp = lvaTable[info.compThisArg].lvHasILStoreOp;
+ lvaTable[lvaArg0Var].lvVerTypeInfo = lvaTable[info.compThisArg].lvVerTypeInfo;
// Clear the TI_FLAG_THIS_PTR in the original 'this' pointer.
noway_assert(lvaTable[lvaArg0Var].lvVerTypeInfo.IsThisPtr());
lvaTable[info.compThisArg].lvVerTypeInfo.ClearThisPtr();
- lvaTable[info.compThisArg].lvAddrExposed = false;
- lvaTable[info.compThisArg].lvArgWrite = false;
+ lvaTable[info.compThisArg].lvAddrExposed = false;
+ lvaTable[info.compThisArg].lvHasILStoreOp = false;
}
}
@@ -6720,9 +6784,7 @@ bool Compiler::fgIsThrow(GenTreePtr tree)
(tree->gtCall.gtCallMethHnd == eeFindHelper(CORINFO_HELP_VERIFICATION)) ||
(tree->gtCall.gtCallMethHnd == eeFindHelper(CORINFO_HELP_RNGCHKFAIL)) ||
(tree->gtCall.gtCallMethHnd == eeFindHelper(CORINFO_HELP_THROWDIVZERO)) ||
-#if COR_JIT_EE_VERSION > 460
(tree->gtCall.gtCallMethHnd == eeFindHelper(CORINFO_HELP_THROWNULLREF)) ||
-#endif // COR_JIT_EE_VERSION
(tree->gtCall.gtCallMethHnd == eeFindHelper(CORINFO_HELP_THROW)) ||
(tree->gtCall.gtCallMethHnd == eeFindHelper(CORINFO_HELP_RETHROW)))
{
@@ -7062,129 +7124,120 @@ GenTreePtr Compiler::fgOptimizeDelegateConstructor(GenTreeCall* call, CORINFO_CO
CORINFO_METHOD_HANDLE methHnd = call->gtCallMethHnd;
CORINFO_CLASS_HANDLE clsHnd = info.compCompHnd->getMethodClass(methHnd);
- GenTreePtr targetMethod = call->gtCallArgs->gtOp.gtOp2->gtOp.gtOp1;
+ GenTreePtr targetMethod = call->gtCallArgs->Rest()->Current();
noway_assert(targetMethod->TypeGet() == TYP_I_IMPL);
- genTreeOps oper = targetMethod->OperGet();
- if (oper == GT_FTN_ADDR || oper == GT_CALL || oper == GT_QMARK)
+ genTreeOps oper = targetMethod->OperGet();
+ CORINFO_METHOD_HANDLE targetMethodHnd = nullptr;
+ GenTreePtr qmarkNode = nullptr;
+ if (oper == GT_FTN_ADDR)
{
- CORINFO_METHOD_HANDLE targetMethodHnd = nullptr;
- GenTreePtr qmarkNode = nullptr;
- if (oper == GT_FTN_ADDR)
- {
- targetMethodHnd = targetMethod->gtFptrVal.gtFptrMethod;
- }
- else if (oper == GT_CALL && targetMethod->gtCall.gtCallMethHnd == eeFindHelper(CORINFO_HELP_VIRTUAL_FUNC_PTR))
- {
- GenTreePtr handleNode = targetMethod->gtCall.gtCallArgs->gtOp.gtOp2->gtOp.gtOp2->gtOp.gtOp1;
+ targetMethodHnd = targetMethod->gtFptrVal.gtFptrMethod;
+ }
+ else if (oper == GT_CALL && targetMethod->gtCall.gtCallMethHnd == eeFindHelper(CORINFO_HELP_VIRTUAL_FUNC_PTR))
+ {
+ GenTreePtr handleNode = targetMethod->gtCall.gtCallArgs->Rest()->Rest()->Current();
- if (handleNode->OperGet() == GT_CNS_INT)
- {
- // it's a ldvirtftn case, fetch the methodhandle off the helper for ldvirtftn. It's the 3rd arg
- targetMethodHnd = CORINFO_METHOD_HANDLE(handleNode->gtIntCon.gtCompileTimeHandle);
- }
- // Sometimes the argument to this is the result of a generic dictionary lookup, which shows
- // up as a GT_QMARK.
- else if (handleNode->OperGet() == GT_QMARK)
- {
- qmarkNode = handleNode;
- }
- }
- // Sometimes we don't call CORINFO_HELP_VIRTUAL_FUNC_PTR but instead just call
- // CORINFO_HELP_RUNTIMEHANDLE_METHOD directly.
- else if (oper == GT_QMARK)
+ if (handleNode->OperGet() == GT_CNS_INT)
{
- qmarkNode = targetMethod;
+ // it's a ldvirtftn case, fetch the methodhandle off the helper for ldvirtftn. It's the 3rd arg
+ targetMethodHnd = CORINFO_METHOD_HANDLE(handleNode->gtIntCon.gtCompileTimeHandle);
}
- if (qmarkNode)
+ // Sometimes the argument to this is the result of a generic dictionary lookup, which shows
+ // up as a GT_QMARK.
+ else if (handleNode->OperGet() == GT_QMARK)
{
- noway_assert(qmarkNode->OperGet() == GT_QMARK);
- // The argument is actually a generic dictionary lookup. For delegate creation it looks
- // like:
- // GT_QMARK
- // GT_COLON
- // op1 -> call
- // Arg 1 -> token (has compile time handle)
- // op2 -> lclvar
- //
- //
- // In this case I can find the token (which is a method handle) and that is the compile time
- // handle.
- noway_assert(qmarkNode->gtOp.gtOp2->OperGet() == GT_COLON);
- noway_assert(qmarkNode->gtOp.gtOp2->gtOp.gtOp1->OperGet() == GT_CALL);
- GenTreeCall* runtimeLookupCall = qmarkNode->gtOp.gtOp2->gtOp.gtOp1->AsCall();
-
- // This could be any of CORINFO_HELP_RUNTIMEHANDLE_(METHOD|CLASS)(_LOG?)
- GenTreePtr tokenNode = runtimeLookupCall->gtCallArgs->gtOp.gtOp2->gtOp.gtOp1;
- noway_assert(tokenNode->OperGet() == GT_CNS_INT);
- targetMethodHnd = CORINFO_METHOD_HANDLE(tokenNode->gtIntCon.gtCompileTimeHandle);
+ qmarkNode = handleNode;
}
+ }
+ // Sometimes we don't call CORINFO_HELP_VIRTUAL_FUNC_PTR but instead just call
+ // CORINFO_HELP_RUNTIMEHANDLE_METHOD directly.
+ else if (oper == GT_QMARK)
+ {
+ qmarkNode = targetMethod;
+ }
+ if (qmarkNode)
+ {
+ noway_assert(qmarkNode->OperGet() == GT_QMARK);
+ // The argument is actually a generic dictionary lookup. For delegate creation it looks
+ // like:
+ // GT_QMARK
+ // GT_COLON
+ // op1 -> call
+ // Arg 1 -> token (has compile time handle)
+ // op2 -> lclvar
+ //
+ //
+ // In this case I can find the token (which is a method handle) and that is the compile time
+ // handle.
+ noway_assert(qmarkNode->gtOp.gtOp2->OperGet() == GT_COLON);
+ noway_assert(qmarkNode->gtOp.gtOp2->gtOp.gtOp1->OperGet() == GT_CALL);
+ GenTreeCall* runtimeLookupCall = qmarkNode->gtOp.gtOp2->gtOp.gtOp1->AsCall();
+
+ // This could be any of CORINFO_HELP_RUNTIMEHANDLE_(METHOD|CLASS)(_LOG?)
+ GenTreePtr tokenNode = runtimeLookupCall->gtCallArgs->gtOp.gtOp2->gtOp.gtOp1;
+ noway_assert(tokenNode->OperGet() == GT_CNS_INT);
+ targetMethodHnd = CORINFO_METHOD_HANDLE(tokenNode->gtIntCon.gtCompileTimeHandle);
+ }
#ifdef FEATURE_READYTORUN_COMPILER
- if (opts.IsReadyToRun())
+ if (opts.IsReadyToRun())
+ {
+ // ReadyToRun has this optimization for a non-virtual function pointers only for now.
+ if (oper == GT_FTN_ADDR)
{
- // ReadyToRun has this optimization for a non-virtual function pointers only for now.
- if (oper == GT_FTN_ADDR)
- {
- // The first argument of the helper is delegate this pointer
- GenTreeArgList* helperArgs = gtNewArgList(call->gtCallObjp);
- CORINFO_CONST_LOOKUP entryPoint;
+ GenTreePtr thisPointer = call->gtCallObjp;
+ GenTreePtr targetObjPointers = call->gtCallArgs->Current();
+ GenTreeArgList* helperArgs = gtNewArgList(thisPointer, targetObjPointers);
- // The second argument of the helper is the target object pointers
- helperArgs->gtOp.gtOp2 = gtNewArgList(call->gtCallArgs->gtOp.gtOp1);
+ call = gtNewHelperCallNode(CORINFO_HELP_READYTORUN_DELEGATE_CTOR, TYP_VOID, GTF_EXCEPT, helperArgs);
- call = gtNewHelperCallNode(CORINFO_HELP_READYTORUN_DELEGATE_CTOR, TYP_VOID, GTF_EXCEPT, helperArgs);
-#if COR_JIT_EE_VERSION > 460
- info.compCompHnd->getReadyToRunDelegateCtorHelper(targetMethod->gtFptrVal.gtLdftnResolvedToken, clsHnd,
- &entryPoint);
-#else
- info.compCompHnd->getReadyToRunHelper(targetMethod->gtFptrVal.gtLdftnResolvedToken,
- CORINFO_HELP_READYTORUN_DELEGATE_CTOR, &entryPoint);
-#endif
- call->setEntryPoint(entryPoint);
- }
+ CORINFO_RESOLVED_TOKEN* ldftnToken = targetMethod->gtFptrVal.gtLdftnResolvedToken;
+ CORINFO_LOOKUP entryPoint;
+ info.compCompHnd->getReadyToRunDelegateCtorHelper(ldftnToken, clsHnd, &entryPoint);
+ assert(!entryPoint.lookupKind.needsRuntimeLookup);
+ call->setEntryPoint(entryPoint.constLookup);
}
- else
+ }
+ else
#endif
- if (targetMethodHnd != nullptr)
- {
- CORINFO_METHOD_HANDLE alternateCtor = nullptr;
- DelegateCtorArgs ctorData;
- ctorData.pMethod = info.compMethodHnd;
- ctorData.pArg3 = nullptr;
- ctorData.pArg4 = nullptr;
- ctorData.pArg5 = nullptr;
-
- alternateCtor = info.compCompHnd->GetDelegateCtor(methHnd, clsHnd, targetMethodHnd, &ctorData);
- if (alternateCtor != methHnd)
- {
- // we erase any inline info that may have been set for generics has it is not needed here,
- // and in fact it will pass the wrong info to the inliner code
- *ExactContextHnd = nullptr;
-
- call->gtCallMethHnd = alternateCtor;
+ if (targetMethodHnd != nullptr)
+ {
+ CORINFO_METHOD_HANDLE alternateCtor = nullptr;
+ DelegateCtorArgs ctorData;
+ ctorData.pMethod = info.compMethodHnd;
+ ctorData.pArg3 = nullptr;
+ ctorData.pArg4 = nullptr;
+ ctorData.pArg5 = nullptr;
- noway_assert(call->gtCallArgs->gtOp.gtOp2->gtOp.gtOp2 == nullptr);
- if (ctorData.pArg3)
- {
- call->gtCallArgs->gtOp.gtOp2->gtOp.gtOp2 =
- gtNewArgList(gtNewIconHandleNode(size_t(ctorData.pArg3), GTF_ICON_FTN_ADDR));
+ alternateCtor = info.compCompHnd->GetDelegateCtor(methHnd, clsHnd, targetMethodHnd, &ctorData);
+ if (alternateCtor != methHnd)
+ {
+ // we erase any inline info that may have been set for generics has it is not needed here,
+ // and in fact it will pass the wrong info to the inliner code
+ *ExactContextHnd = nullptr;
- if (ctorData.pArg4)
- {
- call->gtCallArgs->gtOp.gtOp2->gtOp.gtOp2->gtOp.gtOp2 =
- gtNewArgList(gtNewIconHandleNode(size_t(ctorData.pArg4), GTF_ICON_FTN_ADDR));
+ call->gtCallMethHnd = alternateCtor;
- if (ctorData.pArg5)
- {
- call->gtCallArgs->gtOp.gtOp2->gtOp.gtOp2->gtOp.gtOp2->gtOp.gtOp2 =
- gtNewArgList(gtNewIconHandleNode(size_t(ctorData.pArg5), GTF_ICON_FTN_ADDR));
- }
- }
- }
+ noway_assert(call->gtCallArgs->Rest()->Rest() == nullptr);
+ GenTreeArgList* addArgs = nullptr;
+ if (ctorData.pArg5)
+ {
+ GenTreePtr arg5 = gtNewIconHandleNode(size_t(ctorData.pArg5), GTF_ICON_FTN_ADDR);
+ addArgs = gtNewListNode(arg5, addArgs);
}
+ if (ctorData.pArg4)
+ {
+ GenTreePtr arg4 = gtNewIconHandleNode(size_t(ctorData.pArg4), GTF_ICON_FTN_ADDR);
+ addArgs = gtNewListNode(arg4, addArgs);
+ }
+ if (ctorData.pArg3)
+ {
+ GenTreePtr arg3 = gtNewIconHandleNode(size_t(ctorData.pArg3), GTF_ICON_FTN_ADDR);
+ addArgs = gtNewListNode(arg3, addArgs);
+ }
+ call->gtCallArgs->Rest()->Rest() = addArgs;
}
}
-
return call;
}
@@ -7636,8 +7689,15 @@ void Compiler::fgAddSyncMethodEnterExit()
assert(fgFirstBB->bbFallsThrough());
BasicBlock* tryBegBB = fgNewBBafter(BBJ_NONE, fgFirstBB, false);
+ BasicBlock* tryNextBB = tryBegBB->bbNext;
BasicBlock* tryLastBB = fgLastBB;
+ // If we have profile data the new block will inherit the next block's weight
+ if (tryNextBB->hasProfileWeight())
+ {
+ tryBegBB->inheritWeight(tryNextBB);
+ }
+
// Create a block for the fault.
assert(!tryLastBB->bbFallsThrough());
@@ -7927,7 +7987,6 @@ void Compiler::fgAddReversePInvokeEnterExit()
{
assert(opts.IsReversePInvoke());
-#if COR_JIT_EE_VERSION > 460
lvaReversePInvokeFrameVar = lvaGrabTempWithImplicitUse(false DEBUGARG("Reverse Pinvoke FrameVar"));
LclVarDsc* varDsc = &lvaTable[lvaReversePInvokeFrameVar];
@@ -7974,8 +8033,6 @@ void Compiler::fgAddReversePInvokeEnterExit()
printf("\n");
}
#endif
-
-#endif // COR_JIT_EE_VERSION > 460
}
/*****************************************************************************
@@ -8011,6 +8068,16 @@ void Compiler::fgAddInternal()
{
noway_assert(!compIsForInlining());
+#ifndef LEGACY_BACKEND
+ // The RyuJIT backend requires a scratch BB into which it can safely insert a P/Invoke method prolog if one is
+ // required. Create it here.
+ if (info.compCallUnmanaged != 0)
+ {
+ fgEnsureFirstBBisScratch();
+ fgFirstBB->bbFlags |= BBF_DONT_REMOVE;
+ }
+#endif // !LEGACY_BACKEND
+
/*
<BUGNUM> VSW441487 </BUGNUM>
@@ -8039,8 +8106,8 @@ void Compiler::fgAddInternal()
lva0CopiedForGenericsCtxt = false;
#endif // JIT32_GCENCODER
noway_assert(lva0CopiedForGenericsCtxt || !lvaTable[info.compThisArg].lvAddrExposed);
- noway_assert(!lvaTable[info.compThisArg].lvArgWrite);
- noway_assert(lvaTable[lvaArg0Var].lvAddrExposed || lvaTable[lvaArg0Var].lvArgWrite ||
+ noway_assert(!lvaTable[info.compThisArg].lvHasILStoreOp);
+ noway_assert(lvaTable[lvaArg0Var].lvAddrExposed || lvaTable[lvaArg0Var].lvHasILStoreOp ||
lva0CopiedForGenericsCtxt);
var_types thisType = lvaTable[info.compThisArg].TypeGet();
@@ -8129,7 +8196,7 @@ void Compiler::fgAddInternal()
// If all BBJ_RETURN blocks have a valid profiled weights
// then allProfWeight will be true, else it is false
//
- if ((block->bbFlags & BBF_PROF_WEIGHT) == 0)
+ if (!block->hasProfileWeight())
{
allProfWeight = false;
}
@@ -9815,8 +9882,7 @@ void Compiler::fgCompactBlocks(BasicBlock* block, BasicBlock* bNext)
// or if both block and bNext have non-zero weights
// then we select the highest weight block.
- if ((block->bbFlags & BBF_PROF_WEIGHT) || (bNext->bbFlags & BBF_PROF_WEIGHT) ||
- (block->bbWeight && bNext->bbWeight))
+ if (block->hasProfileWeight() || bNext->hasProfileWeight() || (block->bbWeight && bNext->bbWeight))
{
// We are keeping block so update its fields
// when bNext has a greater weight
@@ -11121,7 +11187,7 @@ bool Compiler::fgExpandRarelyRunBlocks()
NEW_RARELY_RUN:
/* If the weight of the block was obtained from a profile run,
than it's more accurate than our static analysis */
- if (bPrev->bbFlags & BBF_PROF_WEIGHT)
+ if (bPrev->hasProfileWeight())
{
continue;
}
@@ -11307,10 +11373,10 @@ bool Compiler::fgExpandRarelyRunBlocks()
// if bPrev->bbWeight is not based upon profile data we can adjust
// the weights of bPrev and block
//
- else if (bPrev->isBBCallAlwaysPair() && // we must have a BBJ_CALLFINALLY and BBK_ALWAYS pair
- (bPrev->bbWeight != block->bbWeight) && // the weights are currently different
- ((bPrev->bbFlags & BBF_PROF_WEIGHT) == 0)) // and the BBJ_CALLFINALLY block is not using profiled
- // weights
+ else if (bPrev->isBBCallAlwaysPair() && // we must have a BBJ_CALLFINALLY and BBK_ALWAYS pair
+ (bPrev->bbWeight != block->bbWeight) && // the weights are currently different
+ !bPrev->hasProfileWeight()) // and the BBJ_CALLFINALLY block is not using profiled
+ // weights
{
if (block->isRunRarely())
{
@@ -12477,7 +12543,7 @@ void Compiler::fgPrintEdgeWeights()
if (edge->flEdgeWeightMin < BB_MAX_WEIGHT)
{
- printf("(%s", refCntWtd2str(edge->flEdgeWeightMin));
+ printf("(%u", edge->flEdgeWeightMin);
}
else
{
@@ -12487,7 +12553,7 @@ void Compiler::fgPrintEdgeWeights()
{
if (edge->flEdgeWeightMax < BB_MAX_WEIGHT)
{
- printf("..%s", refCntWtd2str(edge->flEdgeWeightMax));
+ printf("..%u", edge->flEdgeWeightMax);
}
else
{
@@ -12550,7 +12616,7 @@ void Compiler::fgComputeEdgeWeights()
}
#endif // DEBUG
fgHaveValidEdgeWeights = false;
- fgCalledWeight = BB_UNITY_WEIGHT;
+ fgCalledCount = BB_UNITY_WEIGHT;
}
#if DEBUG
@@ -12589,7 +12655,7 @@ void Compiler::fgComputeEdgeWeights()
for (bDst = fgFirstBB; bDst != nullptr; bDst = bDst->bbNext)
{
- if (((bDst->bbFlags & BBF_PROF_WEIGHT) == 0) && (bDst->bbPreds != nullptr))
+ if (!bDst->hasProfileWeight() && (bDst->bbPreds != nullptr))
{
BasicBlock* bOnlyNext;
@@ -12616,7 +12682,7 @@ void Compiler::fgComputeEdgeWeights()
bOnlyNext = nullptr;
}
- if ((bOnlyNext == bDst) && ((bSrc->bbFlags & BBF_PROF_WEIGHT) != 0))
+ if ((bOnlyNext == bDst) && bSrc->hasProfileWeight())
{
// We know the exact weight of bDst
newWeight = bSrc->bbWeight;
@@ -12668,8 +12734,7 @@ void Compiler::fgComputeEdgeWeights()
// Sum up the weights of all of the return blocks and throw blocks
// This is used when we have a back-edge into block 1
//
- if (((bDst->bbFlags & BBF_PROF_WEIGHT) != 0) &&
- ((bDst->bbJumpKind == BBJ_RETURN) || (bDst->bbJumpKind == BBJ_THROW)))
+ if (bDst->hasProfileWeight() && ((bDst->bbJumpKind == BBJ_RETURN) || (bDst->bbJumpKind == BBJ_THROW)))
{
returnWeight += bDst->bbWeight;
}
@@ -12689,25 +12754,57 @@ void Compiler::fgComputeEdgeWeights()
}
#endif
- // When we are not using profile data we have already setup fgCalledWeight
+ // When we are not using profile data we have already setup fgCalledCount
// only set it here if we are using profile data
//
if (fgIsUsingProfileWeights())
{
- // If the first block has one ref then it's weight is the fgCalledWeight
- // otherwise we have backedge's into the first block so instead
- // we use the sum of the return block weights.
- // If the profile data has a 0 for the returnWeoght
- // then just use the first block weight rather than the 0
+ BasicBlock* firstILBlock = fgFirstBB; // The first block for IL code (i.e. for the IL code at offset 0)
+
+ // Do we have an internal block as our first Block?
+ if (firstILBlock->bbFlags & BBF_INTERNAL)
+ {
+ // Skip past any/all BBF_INTERNAL blocks that may have been added before the first real IL block.
+ //
+ while (firstILBlock->bbFlags & BBF_INTERNAL)
+ {
+ firstILBlock = firstILBlock->bbNext;
+ }
+ // The 'firstILBlock' is now expected to have a profile-derived weight
+ assert(firstILBlock->hasProfileWeight());
+ }
+
+ // If the first block only has one ref then we use it's weight for fgCalledCount.
+ // Otherwise we have backedge's into the first block, so instead we use the sum
+ // of the return block weights for fgCalledCount.
+ //
+ // If the profile data has a 0 for the returnWeight
+ // (i.e. the function never returns because it always throws)
+ // then just use the first block weight rather than 0.
//
- if ((fgFirstBB->countOfInEdges() == 1) || (returnWeight == 0))
+ if ((firstILBlock->countOfInEdges() == 1) || (returnWeight == 0))
{
- fgCalledWeight = fgFirstBB->bbWeight;
+ assert(firstILBlock->hasProfileWeight()); // This should always be a profile-derived weight
+ fgCalledCount = firstILBlock->bbWeight;
}
else
{
- fgCalledWeight = returnWeight;
+ fgCalledCount = returnWeight;
+ }
+
+ // If we allocated a scratch block as the first BB then we need
+ // to set its profile-derived weight to be fgCalledCount
+ if (fgFirstBBisScratch())
+ {
+ fgFirstBB->setBBProfileWeight(fgCalledCount);
+ }
+
+#if DEBUG
+ if (verbose)
+ {
+ printf("We are using the Profile Weights and fgCalledCount is %d.\n", fgCalledCount);
}
+#endif
}
// Now we will compute the initial flEdgeWeightMin and flEdgeWeightMax values
@@ -12720,7 +12817,7 @@ void Compiler::fgComputeEdgeWeights()
//
if (bDst == fgFirstBB)
{
- bDstWeight -= fgCalledWeight;
+ bDstWeight -= fgCalledCount;
}
for (edge = bDst->bbPreds; edge != nullptr; edge = edge->flNext)
@@ -12737,7 +12834,7 @@ void Compiler::fgComputeEdgeWeights()
// then we must reset any values that they currently have
//
- if (((bSrc->bbFlags & BBF_PROF_WEIGHT) == 0) || ((bDst->bbFlags & BBF_PROF_WEIGHT) == 0))
+ if (!bSrc->hasProfileWeight() || !bDst->hasProfileWeight())
{
edge->flEdgeWeightMin = BB_ZERO_WEIGHT;
edge->flEdgeWeightMax = BB_MAX_WEIGHT;
@@ -12885,7 +12982,7 @@ void Compiler::fgComputeEdgeWeights()
//
if (bDst == fgFirstBB)
{
- bDstWeight -= fgCalledWeight;
+ bDstWeight -= fgCalledCount;
}
UINT64 minEdgeWeightSum = 0;
@@ -13121,7 +13218,7 @@ bool Compiler::fgOptimizeBranchToEmptyUnconditional(BasicBlock* block, BasicBloc
// When we optimize a branch to branch we need to update the profile weight
// of bDest by subtracting out the block/edge weight of the path that is being optimized.
//
- if (fgHaveValidEdgeWeights && ((bDest->bbFlags & BBF_PROF_WEIGHT) != 0))
+ if (fgHaveValidEdgeWeights && bDest->hasProfileWeight())
{
flowList* edge1 = fgGetPredForBlock(bDest, block);
noway_assert(edge1 != nullptr);
@@ -13454,7 +13551,7 @@ bool Compiler::fgOptimizeSwitchBranches(BasicBlock* block)
// When we optimize a branch to branch we need to update the profile weight
// of bDest by subtracting out the block/edge weight of the path that is being optimized.
//
- if (fgIsUsingProfileWeights() && ((bDest->bbFlags & BBF_PROF_WEIGHT) != 0))
+ if (fgIsUsingProfileWeights() && bDest->hasProfileWeight())
{
if (fgHaveValidEdgeWeights)
{
@@ -13839,10 +13936,9 @@ bool Compiler::fgOptimizeUncondBranchToSimpleCond(BasicBlock* block, BasicBlock*
// add an unconditional block after this block to jump to the target block's fallthrough block
BasicBlock* next = fgNewBBafter(BBJ_ALWAYS, block, true);
- next->bbFlags = block->bbFlags | BBF_INTERNAL;
- next->bbFlags &= ~(BBF_TRY_BEG | BBF_LOOP_HEAD | BBF_LOOP_CALL0 | BBF_LOOP_CALL1 | BBF_HAS_LABEL | BBF_JMP_TARGET |
- BBF_FUNCLET_BEG | BBF_LOOP_PREHEADER | BBF_KEEP_BBJ_ALWAYS);
+ // The new block 'next' will inherit its weight from 'block'
+ next->inheritWeight(block);
next->bbJumpDest = target->bbNext;
target->bbNext->bbFlags |= BBF_JMP_TARGET;
fgAddRefPred(next, block);
@@ -14531,8 +14627,7 @@ void Compiler::fgReorderBlocks()
BasicBlock::weight_t profHotWeight = -1;
- if ((bPrev->bbFlags & BBF_PROF_WEIGHT) && (block->bbFlags & BBF_PROF_WEIGHT) &&
- ((bDest == nullptr) || (bDest->bbFlags & BBF_PROF_WEIGHT)))
+ if (bPrev->hasProfileWeight() && block->hasProfileWeight() && ((bDest == nullptr) || bDest->hasProfileWeight()))
{
//
// All blocks have profile information
@@ -17528,12 +17623,10 @@ unsigned Compiler::acdHelper(SpecialCodeKind codeKind)
{
case SCK_RNGCHK_FAIL:
return CORINFO_HELP_RNGCHKFAIL;
-#if COR_JIT_EE_VERSION > 460
case SCK_ARG_EXCPN:
return CORINFO_HELP_THROW_ARGUMENTEXCEPTION;
case SCK_ARG_RNG_EXCPN:
return CORINFO_HELP_THROW_ARGUMENTOUTOFRANGEEXCEPTION;
-#endif // COR_JIT_EE_VERSION
case SCK_DIV_BY_ZERO:
return CORINFO_HELP_THROWDIVZERO;
case SCK_ARITH_EXCPN:
@@ -17593,10 +17686,28 @@ BasicBlock* Compiler::fgAddCodeRef(BasicBlock* srcBlk, unsigned refData, Special
// this restriction could be removed with more careful code
// generation for BBJ_THROW (i.e. range check failed).
//
+ // For Linux/x86, we possibly need to insert stack alignment adjustment
+ // before the first stack argument pushed for every call. But we
+ // don't know what the stack alignment adjustment will be when
+ // we morph a tree that calls fgAddCodeRef(), so the stack depth
+ // number will be incorrect. For now, simply force all functions with
+ // these helpers to have EBP frames. It might be possible to make
+ // this less conservative. E.g., for top-level (not nested) calls
+ // without stack args, the stack pointer hasn't changed and stack
+ // depth will be known to be zero. Or, figure out a way to update
+ // or generate all required helpers after all stack alignment
+ // has been added, and the stack level at each call to fgAddCodeRef()
+ // is known, or can be recalculated.
+ CLANG_FORMAT_COMMENT_ANCHOR;
+
+#if defined(UNIX_X86_ABI)
+ codeGen->setFrameRequired(true);
+#else // !defined(UNIX_X86_ABI)
if (add->acdStkLvl != stkDepth)
{
codeGen->setFrameRequired(true);
}
+#endif // !defined(UNIX_X86_ABI)
#endif // _TARGET_X86_
return add->acdDstBlk;
@@ -17660,14 +17771,12 @@ BasicBlock* Compiler::fgAddCodeRef(BasicBlock* srcBlk, unsigned refData, Special
case SCK_OVERFLOW:
msg = " for OVERFLOW";
break;
-#if COR_JIT_EE_VERSION > 460
case SCK_ARG_EXCPN:
msg = " for ARG_EXCPN";
break;
case SCK_ARG_RNG_EXCPN:
msg = " for ARG_RNG_EXCPN";
break;
-#endif // COR_JIT_EE_VERSION
default:
msg = " for ??";
break;
@@ -17714,7 +17823,6 @@ BasicBlock* Compiler::fgAddCodeRef(BasicBlock* srcBlk, unsigned refData, Special
noway_assert(SCK_OVERFLOW == SCK_ARITH_EXCPN);
break;
-#if COR_JIT_EE_VERSION > 460
case SCK_ARG_EXCPN:
helper = CORINFO_HELP_THROW_ARGUMENTEXCEPTION;
break;
@@ -17722,7 +17830,6 @@ BasicBlock* Compiler::fgAddCodeRef(BasicBlock* srcBlk, unsigned refData, Special
case SCK_ARG_RNG_EXCPN:
helper = CORINFO_HELP_THROW_ARGUMENTOUTOFRANGEEXCEPTION;
break;
-#endif // COR_JIT_EE_VERSION
// case SCK_PAUSE_EXEC:
// noway_assert(!"add code to pause exec");
@@ -18940,7 +19047,7 @@ FILE* Compiler::fgOpenFlowGraphFile(bool* wbDontClose, Phases phase, LPCWSTR typ
if (wcscmp(filename, W("profiled")) == 0)
{
- if ((fgFirstBB->bbFlags & BBF_PROF_WEIGHT) != 0)
+ if (fgFirstBB->hasProfileWeight())
{
createDuplicateFgxFiles = true;
goto ONE_FILE_PER_METHOD;
@@ -19130,7 +19237,7 @@ bool Compiler::fgDumpFlowGraph(Phases phase)
return false;
}
bool validWeights = fgHaveValidEdgeWeights;
- unsigned calledCount = max(fgCalledWeight, BB_UNITY_WEIGHT) / BB_UNITY_WEIGHT;
+ unsigned calledCount = max(fgCalledCount, BB_UNITY_WEIGHT) / BB_UNITY_WEIGHT;
double weightDivisor = (double)(calledCount * BB_UNITY_WEIGHT);
const char* escapedString;
const char* regionString = "NONE";
@@ -19245,7 +19352,7 @@ bool Compiler::fgDumpFlowGraph(Phases phase)
{
fprintf(fgxFile, "\n inHandler=\"%s\"", "true");
}
- if (((fgFirstBB->bbFlags & BBF_PROF_WEIGHT) != 0) && ((block->bbFlags & BBF_COLD) == 0))
+ if ((fgFirstBB->hasProfileWeight()) && ((block->bbFlags & BBF_COLD) == 0))
{
fprintf(fgxFile, "\n hot=\"true\"");
}
@@ -19518,8 +19625,28 @@ void Compiler::fgTableDispBasicBlock(BasicBlock* block, int ibcColWidth /* = 0 *
}
else
{
- printf("%6s", refCntWtd2str(block->getBBWeight(this)));
+ BasicBlock::weight_t weight = block->getBBWeight(this);
+
+ if (weight > 99999) // Is it going to be more than 6 characters?
+ {
+ if (weight <= 99999 * BB_UNITY_WEIGHT)
+ {
+ // print weight in this format ddddd.
+ printf("%5u.", (weight + (BB_UNITY_WEIGHT / 2)) / BB_UNITY_WEIGHT);
+ }
+ else // print weight in terms of k (i.e. 156k )
+ {
+ // print weight in this format dddddk
+ BasicBlock::weight_t weightK = weight / 1000;
+ printf("%5uk", (weightK + (BB_UNITY_WEIGHT / 2)) / BB_UNITY_WEIGHT);
+ }
+ }
+ else // print weight in this format ddd.dd
+ {
+ printf("%6s", refCntWtd2str(weight));
+ }
}
+ printf(" ");
//
// Display optional IBC weight column.
@@ -19528,7 +19655,7 @@ void Compiler::fgTableDispBasicBlock(BasicBlock* block, int ibcColWidth /* = 0 *
if (ibcColWidth > 0)
{
- if (block->bbFlags & BBF_PROF_WEIGHT)
+ if (block->hasProfileWeight())
{
printf("%*u", ibcColWidth, block->bbWeight);
}
@@ -19782,7 +19909,7 @@ void Compiler::fgDispBasicBlocks(BasicBlock* firstBlock, BasicBlock* lastBlock,
int ibcColWidth = 0;
for (block = firstBlock; block != nullptr; block = block->bbNext)
{
- if (block->bbFlags & BBF_PROF_WEIGHT)
+ if (block->hasProfileWeight())
{
int thisIbcWidth = CountDigits(block->bbWeight);
ibcColWidth = max(ibcColWidth, thisIbcWidth);
@@ -19807,11 +19934,11 @@ void Compiler::fgDispBasicBlocks(BasicBlock* firstBlock, BasicBlock* lastBlock,
// clang-format off
printf("\n");
- printf("------%*s------------------------------------%*s-----------------------%*s----------------------------------------\n",
+ printf("------%*s-------------------------------------%*s-----------------------%*s----------------------------------------\n",
padWidth, "------------",
ibcColWidth, "------------",
maxBlockNumWidth, "----");
- printf("BBnum %*sdescAddr ref try hnd %s weight %*s%s [IL range] [jump]%*s [EH region] [flags]\n",
+ printf("BBnum %*sdescAddr ref try hnd %s weight %*s%s [IL range] [jump]%*s [EH region] [flags]\n",
padWidth, "",
fgCheapPredsValid ? "cheap preds" :
(fgComputePredsDone ? "preds "
@@ -19821,7 +19948,7 @@ void Compiler::fgDispBasicBlocks(BasicBlock* firstBlock, BasicBlock* lastBlock,
: ""),
maxBlockNumWidth, ""
);
- printf("------%*s------------------------------------%*s-----------------------%*s----------------------------------------\n",
+ printf("------%*s-------------------------------------%*s-----------------------%*s----------------------------------------\n",
padWidth, "------------",
ibcColWidth, "------------",
maxBlockNumWidth, "----");
@@ -19845,16 +19972,16 @@ void Compiler::fgDispBasicBlocks(BasicBlock* firstBlock, BasicBlock* lastBlock,
if (block == fgFirstColdBlock)
{
- printf("~~~~~~%*s~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%*s~~~~~~~~~~~~~~~~~~~~~~~%*s~~~~~~~~~~~~~~~~~~~~~~~~~"
- "~~~~~~~~~~~~~~~\n",
+ printf("~~~~~~%*s~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%*s~~~~~~~~~~~~~~~~~~~~~~~%*s~~~~~~~~~~~~~~~~~~~~~~~~"
+ "~~~~~~~~~~~~~~~~\n",
padWidth, "~~~~~~~~~~~~", ibcColWidth, "~~~~~~~~~~~~", maxBlockNumWidth, "~~~~");
}
#if FEATURE_EH_FUNCLETS
if (block == fgFirstFuncletBB)
{
- printf("++++++%*s++++++++++++++++++++++++++++++++++++%*s+++++++++++++++++++++++%*s+++++++++++++++++++++++++"
- "+++++++++++++++ funclets follow\n",
+ printf("++++++%*s+++++++++++++++++++++++++++++++++++++%*s+++++++++++++++++++++++%*s++++++++++++++++++++++++"
+ "++++++++++++++++ funclets follow\n",
padWidth, "++++++++++++", ibcColWidth, "++++++++++++", maxBlockNumWidth, "++++");
}
#endif // FEATURE_EH_FUNCLETS
@@ -19867,8 +19994,8 @@ void Compiler::fgDispBasicBlocks(BasicBlock* firstBlock, BasicBlock* lastBlock,
}
}
- printf("------%*s------------------------------------%*s-----------------------%*s---------------------------------"
- "-------\n",
+ printf("------%*s-------------------------------------%*s-----------------------%*s--------------------------------"
+ "--------\n",
padWidth, "------------", ibcColWidth, "------------", maxBlockNumWidth, "----");
if (dumpTrees)
@@ -20404,10 +20531,11 @@ void Compiler::fgDebugCheckBBlist(bool checkBBNum /* = false */, bool checkBBRef
// Should never expose the address of arg 0 or write to arg 0.
// In addition, lvArg0Var should remain 0 if arg0 is not
// written to or address-exposed.
- noway_assert(compThisArgAddrExposedOK && !lvaTable[info.compThisArg].lvArgWrite &&
- (lvaArg0Var == info.compThisArg ||
- lvaArg0Var != info.compThisArg && (lvaTable[lvaArg0Var].lvAddrExposed ||
- lvaTable[lvaArg0Var].lvArgWrite || copiedForGenericsCtxt)));
+ noway_assert(
+ compThisArgAddrExposedOK && !lvaTable[info.compThisArg].lvHasILStoreOp &&
+ (lvaArg0Var == info.compThisArg ||
+ lvaArg0Var != info.compThisArg &&
+ (lvaTable[lvaArg0Var].lvAddrExposed || lvaTable[lvaArg0Var].lvHasILStoreOp || copiedForGenericsCtxt)));
}
}
@@ -22307,9 +22435,13 @@ GenTreePtr Compiler::fgInlinePrependStatements(InlineInfo* inlineInfo)
for (unsigned argNum = 0; argNum < inlineInfo->argCnt; argNum++)
{
- if (inlArgInfo[argNum].argHasTmp)
+ const InlArgInfo& argInfo = inlArgInfo[argNum];
+ const bool argIsSingleDef = !argInfo.argHasLdargaOp && !argInfo.argHasStargOp;
+ GenTree* const argNode = inlArgInfo[argNum].argNode;
+
+ if (argInfo.argHasTmp)
{
- noway_assert(inlArgInfo[argNum].argIsUsed);
+ noway_assert(argInfo.argIsUsed);
/* argBashTmpNode is non-NULL iff the argument's value was
referenced exactly once by the original IL. This offers an
@@ -22323,14 +22455,12 @@ GenTreePtr Compiler::fgInlinePrependStatements(InlineInfo* inlineInfo)
once) but the optimization cannot be applied.
*/
- GenTreePtr argSingleUseNode = inlArgInfo[argNum].argBashTmpNode;
+ GenTreePtr argSingleUseNode = argInfo.argBashTmpNode;
- if (argSingleUseNode && !(argSingleUseNode->gtFlags & GTF_VAR_CLONED) &&
- !inlArgInfo[argNum].argHasLdargaOp && !inlArgInfo[argNum].argHasStargOp)
+ if ((argSingleUseNode != nullptr) && !(argSingleUseNode->gtFlags & GTF_VAR_CLONED) && argIsSingleDef)
{
// Change the temp in-place to the actual argument.
// We currently do not support this for struct arguments, so it must not be a GT_OBJ.
- GenTree* argNode = inlArgInfo[argNum].argNode;
assert(argNode->gtOper != GT_OBJ);
argSingleUseNode->CopyFrom(argNode, this);
continue;
@@ -22339,44 +22469,15 @@ GenTreePtr Compiler::fgInlinePrependStatements(InlineInfo* inlineInfo)
{
// We're going to assign the argument value to the
// temp we use for it in the inline body.
- //
- // If we know the argument's value can't be
- // changed within the method body, try and improve
- // the type of the temp.
- if (!inlArgInfo[argNum].argHasLdargaOp && !inlArgInfo[argNum].argHasStargOp)
- {
- GenTree* argNode = inlArgInfo[argNum].argNode;
- bool isExact = false;
- bool isNonNull = false;
- CORINFO_CLASS_HANDLE refClassHandle = gtGetClassHandle(argNode, &isExact, &isNonNull);
-
- if (refClassHandle != nullptr)
- {
- const unsigned tmpNum = inlArgInfo[argNum].argTmpNum;
-
- // If we already had an exact type for
- // this temp, this new information had
- // better agree with what we knew before.
- if (lvaTable[tmpNum].lvClassIsExact)
- {
- assert(isExact);
- assert(refClassHandle == lvaTable[tmpNum].lvClassHnd);
- }
- else
- {
- lvaTable[tmpNum].lvClassHnd = refClassHandle;
- lvaTable[tmpNum].lvClassIsExact = isExact;
- }
- }
- }
-
- /* Create the temp assignment for this argument */
+ const unsigned tmpNum = argInfo.argTmpNum;
+ const var_types argType = lclVarInfo[argNum].lclTypeInfo;
+ // Create the temp assignment for this argument
CORINFO_CLASS_HANDLE structHnd = DUMMY_INIT(0);
- if (varTypeIsStruct(lclVarInfo[argNum].lclTypeInfo))
+ if (varTypeIsStruct(argType))
{
- structHnd = gtGetStructHandleIfPresent(inlArgInfo[argNum].argNode);
+ structHnd = gtGetStructHandleIfPresent(argNode);
noway_assert(structHnd != NO_CLASS_HANDLE);
}
@@ -22384,8 +22485,16 @@ GenTreePtr Compiler::fgInlinePrependStatements(InlineInfo* inlineInfo)
// argTmpNum here since in-linee compiler instance
// would have iterated over these and marked them
// accordingly.
- impAssignTempGen(inlArgInfo[argNum].argTmpNum, inlArgInfo[argNum].argNode, structHnd,
- (unsigned)CHECK_SPILL_NONE, &afterStmt, callILOffset, block);
+ impAssignTempGen(tmpNum, argNode, structHnd, (unsigned)CHECK_SPILL_NONE, &afterStmt, callILOffset,
+ block);
+
+ // If we know the argument's value can't be
+ // changed within the method body, try and improve
+ // the type of the temp.
+ if (argIsSingleDef && (argType == TYP_REF))
+ {
+ lvaUpdateClass(tmpNum, argNode);
+ }
#ifdef DEBUG
if (verbose)
@@ -22395,44 +22504,42 @@ GenTreePtr Compiler::fgInlinePrependStatements(InlineInfo* inlineInfo)
#endif // DEBUG
}
}
- else if (inlArgInfo[argNum].argIsByRefToStructLocal)
+ else if (argInfo.argIsByRefToStructLocal)
{
- // Do nothing.
+ // Do nothing. Arg was directly substituted as we read
+ // the inlinee.
}
else
{
/* The argument is either not used or a const or lcl var */
- noway_assert(!inlArgInfo[argNum].argIsUsed || inlArgInfo[argNum].argIsInvariant ||
- inlArgInfo[argNum].argIsLclVar);
+ noway_assert(!argInfo.argIsUsed || argInfo.argIsInvariant || argInfo.argIsLclVar);
/* Make sure we didnt change argNode's along the way, or else
subsequent uses of the arg would have worked with the bashed value */
- if (inlArgInfo[argNum].argIsInvariant)
+ if (argInfo.argIsInvariant)
{
- assert(inlArgInfo[argNum].argNode->OperIsConst() || inlArgInfo[argNum].argNode->gtOper == GT_ADDR);
+ assert(argNode->OperIsConst() || argNode->gtOper == GT_ADDR);
}
- noway_assert((inlArgInfo[argNum].argIsLclVar == 0) ==
- (inlArgInfo[argNum].argNode->gtOper != GT_LCL_VAR ||
- (inlArgInfo[argNum].argNode->gtFlags & GTF_GLOB_REF)));
+ noway_assert((argInfo.argIsLclVar == 0) ==
+ (argNode->gtOper != GT_LCL_VAR || (argNode->gtFlags & GTF_GLOB_REF)));
/* If the argument has side effects, append it */
- if (inlArgInfo[argNum].argHasSideEff)
+ if (argInfo.argHasSideEff)
{
- noway_assert(inlArgInfo[argNum].argIsUsed == false);
+ noway_assert(argInfo.argIsUsed == false);
- if (inlArgInfo[argNum].argNode->gtOper == GT_OBJ ||
- inlArgInfo[argNum].argNode->gtOper == GT_MKREFANY)
+ if (argNode->gtOper == GT_OBJ || argNode->gtOper == GT_MKREFANY)
{
// Don't put GT_OBJ node under a GT_COMMA.
// Codegen can't deal with it.
// Just hang the address here in case there are side-effect.
- newStmt = gtNewStmt(gtUnusedValNode(inlArgInfo[argNum].argNode->gtOp.gtOp1), callILOffset);
+ newStmt = gtNewStmt(gtUnusedValNode(argNode->gtOp.gtOp1), callILOffset);
}
else
{
- newStmt = gtNewStmt(gtUnusedValNode(inlArgInfo[argNum].argNode), callILOffset);
+ newStmt = gtNewStmt(gtUnusedValNode(argNode), callILOffset);
}
afterStmt = fgInsertStmtAfter(block, afterStmt, newStmt);
@@ -23268,6 +23375,7 @@ void Compiler::fgRemoveEmptyTry()
// Handler index of any nested blocks will update when we
// remove the EH table entry. Change handler exits to jump to
// the continuation. Clear catch type on handler entry.
+ // Decrement nesting level of enclosed GT_END_LFINs.
for (BasicBlock* block = firstHandlerBlock; block != endHandlerBlock; block = block->bbNext)
{
if (block == firstHandlerBlock)
@@ -23297,6 +23405,22 @@ void Compiler::fgRemoveEmptyTry()
fgAddRefPred(continuation, block);
}
}
+
+#if !FEATURE_EH_FUNCLETS
+ // If we're in a non-funclet model, decrement the nesting
+ // level of any GT_END_LFIN we find in the handler region,
+ // since we're removing the enclosing handler.
+ for (GenTreeStmt* stmt = block->firstStmt(); stmt != nullptr; stmt = stmt->gtNextStmt)
+ {
+ GenTreePtr expr = stmt->gtStmtExpr;
+ if (expr->gtOper == GT_END_LFIN)
+ {
+ const unsigned nestLevel = expr->gtVal.gtVal1;
+ assert(nestLevel > 0);
+ expr->gtVal.gtVal1 = nestLevel - 1;
+ }
+ }
+#endif // !FEATURE_EH_FUNCLETS
}
// (6) Remove the try-finally EH region. This will compact the
diff --git a/src/jit/gentree.cpp b/src/jit/gentree.cpp
index be8c250012..3628ff72be 100644
--- a/src/jit/gentree.cpp
+++ b/src/jit/gentree.cpp
@@ -8800,8 +8800,8 @@ void GenTree::CopyTo(class Compiler* comp, const GenTree& gt)
{
SetOperRaw(gt.OperGet());
- gtType = gt.gtType;
- gtAssertionNum = gt.gtAssertionNum;
+ gtType = gt.gtType;
+ gtAssertionInfo = gt.gtAssertionInfo;
gtRegNum = gt.gtRegNum; // one union member.
CopyCosts(&gt);
@@ -9172,529 +9172,553 @@ GenTreePtr GenTree::GetChild(unsigned childNum)
}
}
-GenTreeUseEdgeIterator::GenTreeUseEdgeIterator() : m_node(nullptr), m_edge(nullptr), m_argList(nullptr), m_state(-1)
+GenTreeUseEdgeIterator::GenTreeUseEdgeIterator()
+ : m_advance(nullptr), m_node(nullptr), m_edge(nullptr), m_argList(nullptr), m_state(-1)
{
}
GenTreeUseEdgeIterator::GenTreeUseEdgeIterator(GenTree* node)
- : m_node(node), m_edge(nullptr), m_argList(nullptr), m_state(0)
+ : m_advance(nullptr), m_node(node), m_edge(nullptr), m_argList(nullptr), m_state(0)
{
assert(m_node != nullptr);
- // Advance to the first operand.
- ++(*this);
-}
+ // NOTE: the switch statement below must be updated when introducing new nodes.
-//------------------------------------------------------------------------
-// GenTreeUseEdgeIterator::GetNextUseEdge:
-// Gets the next operand of a node with a fixed number of operands.
-// This covers all nodes besides GT_CALL, GT_PHI, and GT_SIMD. For the
-// node types handled by this method, the `m_state` field indicates the
-// index of the next operand to produce.
-//
-// Returns:
-// The node's next operand or nullptr if all operands have been
-// produced.
-//
-GenTree** GenTreeUseEdgeIterator::GetNextUseEdge() const
-{
switch (m_node->OperGet())
{
- case GT_CMPXCHG:
- switch (m_state)
- {
- case 0:
- return &m_node->AsCmpXchg()->gtOpLocation;
- case 1:
- return &m_node->AsCmpXchg()->gtOpValue;
- case 2:
- return &m_node->AsCmpXchg()->gtOpComparand;
- default:
- return nullptr;
+ // Leaf nodes
+ case GT_LCL_VAR:
+ case GT_LCL_FLD:
+ case GT_LCL_VAR_ADDR:
+ case GT_LCL_FLD_ADDR:
+ case GT_CATCH_ARG:
+ case GT_LABEL:
+ case GT_FTN_ADDR:
+ case GT_RET_EXPR:
+ case GT_CNS_INT:
+ case GT_CNS_LNG:
+ case GT_CNS_DBL:
+ case GT_CNS_STR:
+ case GT_MEMORYBARRIER:
+ case GT_JMP:
+ case GT_JCC:
+ case GT_NO_OP:
+ case GT_START_NONGC:
+ case GT_PROF_HOOK:
+#if !FEATURE_EH_FUNCLETS
+ case GT_END_LFIN:
+#endif // !FEATURE_EH_FUNCLETS
+ case GT_PHI_ARG:
+#ifndef LEGACY_BACKEND
+ case GT_JMPTABLE:
+#endif // LEGACY_BACKEND
+ case GT_REG_VAR:
+ case GT_CLS_VAR:
+ case GT_CLS_VAR_ADDR:
+ case GT_ARGPLACE:
+ case GT_PHYSREG:
+ case GT_EMITNOP:
+ case GT_PINVOKE_PROLOG:
+ case GT_PINVOKE_EPILOG:
+ case GT_IL_OFFSET:
+ m_state = -1;
+ return;
+
+ // Standard unary operators
+ case GT_STORE_LCL_VAR:
+ case GT_STORE_LCL_FLD:
+ case GT_NOT:
+ case GT_NEG:
+ case GT_COPY:
+ case GT_RELOAD:
+ case GT_ARR_LENGTH:
+ case GT_CAST:
+ case GT_CKFINITE:
+ case GT_LCLHEAP:
+ case GT_ADDR:
+ case GT_IND:
+ case GT_OBJ:
+ case GT_BLK:
+ case GT_BOX:
+ case GT_ALLOCOBJ:
+ case GT_INIT_VAL:
+ case GT_JTRUE:
+ case GT_SWITCH:
+ case GT_NULLCHECK:
+ case GT_PHYSREGDST:
+ case GT_PUTARG_REG:
+ case GT_PUTARG_STK:
+ case GT_RETURNTRAP:
+ m_edge = &m_node->AsUnOp()->gtOp1;
+ assert(*m_edge != nullptr);
+ m_advance = &GenTreeUseEdgeIterator::Terminate;
+ return;
+
+ // Unary operators with an optional operand
+ case GT_NOP:
+ case GT_RETURN:
+ case GT_RETFILT:
+ if (m_node->AsUnOp()->gtOp1 == nullptr)
+ {
+ assert(m_node->NullOp1Legal());
+ m_state = -1;
}
- case GT_ARR_BOUNDS_CHECK:
-#ifdef FEATURE_SIMD
- case GT_SIMD_CHK:
-#endif // FEATURE_SIMD
- switch (m_state)
+ else
{
- case 0:
- return &m_node->AsBoundsChk()->gtIndex;
- case 1:
- return &m_node->AsBoundsChk()->gtArrLen;
- default:
- return nullptr;
+ m_edge = &m_node->AsUnOp()->gtOp1;
+ m_advance = &GenTreeUseEdgeIterator::Terminate;
}
+ return;
- case GT_FIELD:
- if (m_state == 0)
+ // Variadic nodes
+ case GT_PHI:
+ SetEntryStateForList(m_node->AsUnOp()->gtOp1);
+ return;
+
+ case GT_FIELD_LIST:
+ SetEntryStateForList(m_node);
+ return;
+
+#ifdef FEATURE_SIMD
+ case GT_SIMD:
+ if (m_node->AsSIMD()->gtSIMDIntrinsicID == SIMDIntrinsicInitN)
{
- return &m_node->AsField()->gtFldObj;
+ SetEntryStateForList(m_node->AsSIMD()->gtOp1);
}
- return nullptr;
-
- case GT_STMT:
- if (m_state == 0)
+ else
{
- return &m_node->AsStmt()->gtStmtExpr;
+ SetEntryStateForBinOp();
}
- return nullptr;
+ return;
+#endif // FEATURE_SIMD
- case GT_ARR_ELEM:
- if (m_state == 0)
+ // LEA, which may have no first operand
+ case GT_LEA:
+ if (m_node->AsAddrMode()->gtOp1 == nullptr)
{
- return &m_node->AsArrElem()->gtArrObj;
+ m_edge = &m_node->AsAddrMode()->gtOp2;
+ m_advance = &GenTreeUseEdgeIterator::Terminate;
}
- else if (m_state <= m_node->AsArrElem()->gtArrRank)
+ else
{
- return &m_node->AsArrElem()->gtArrInds[m_state - 1];
+ SetEntryStateForBinOp();
}
- return nullptr;
+ return;
- case GT_ARR_OFFSET:
- switch (m_state)
- {
- case 0:
- return &m_node->AsArrOffs()->gtOffset;
- case 1:
- return &m_node->AsArrOffs()->gtIndex;
- case 2:
- return &m_node->AsArrOffs()->gtArrObj;
- default:
- return nullptr;
- }
+ // Special nodes
+ case GT_CMPXCHG:
+ m_edge = &m_node->AsCmpXchg()->gtOpLocation;
+ assert(*m_edge != nullptr);
+ m_advance = &GenTreeUseEdgeIterator::AdvanceCmpXchg;
+ return;
- // Call, phi, and SIMD nodes are handled by MoveNext{Call,Phi,SIMD}UseEdge, repsectively.
- case GT_CALL:
- case GT_PHI:
+ case GT_ARR_BOUNDS_CHECK:
#ifdef FEATURE_SIMD
- case GT_SIMD:
-#endif
- break;
+ case GT_SIMD_CHK:
+#endif // FEATURE_SIMD
+ m_edge = &m_node->AsBoundsChk()->gtIndex;
+ assert(*m_edge != nullptr);
+ m_advance = &GenTreeUseEdgeIterator::AdvanceBoundsChk;
+ return;
- case GT_ASG:
- {
- bool operandsReversed = (m_node->gtFlags & GTF_REVERSE_OPS) != 0;
- switch (m_state)
+ case GT_FIELD:
+ if (m_node->AsField()->gtFldObj == nullptr)
{
- case 0:
- return !operandsReversed ? &(m_node->AsOp()->gtOp1) : &(m_node->AsOp()->gtOp2);
- case 1:
- return !operandsReversed ? &(m_node->AsOp()->gtOp2) : &(m_node->AsOp()->gtOp1);
- default:
- return nullptr;
+ m_state = -1;
}
- }
+ else
+ {
+ m_edge = &m_node->AsField()->gtFldObj;
+ m_advance = &GenTreeUseEdgeIterator::Terminate;
+ }
+ return;
+
+ case GT_STMT:
+ if (m_node->AsStmt()->gtStmtExpr == nullptr)
+ {
+ m_state = -1;
+ }
+ else
+ {
+ m_edge = &m_node->AsStmt()->gtStmtExpr;
+ m_advance = &GenTreeUseEdgeIterator::Terminate;
+ }
+ return;
+
+ case GT_ARR_ELEM:
+ m_edge = &m_node->AsArrElem()->gtArrObj;
+ assert(*m_edge != nullptr);
+ m_advance = &GenTreeUseEdgeIterator::AdvanceArrElem;
+ return;
+
+ case GT_ARR_OFFSET:
+ m_edge = &m_node->AsArrOffs()->gtOffset;
+ assert(*m_edge != nullptr);
+ m_advance = &GenTreeUseEdgeIterator::AdvanceArrOffset;
+ return;
case GT_DYN_BLK:
{
GenTreeDynBlk* const dynBlock = m_node->AsDynBlk();
- switch (m_state)
- {
- case 0:
- return dynBlock->gtEvalSizeFirst ? &dynBlock->gtDynamicSize : &dynBlock->gtOp1;
- case 1:
- return dynBlock->gtEvalSizeFirst ? &dynBlock->gtOp1 : &dynBlock->gtDynamicSize;
- default:
- return nullptr;
- }
+ m_edge = dynBlock->gtEvalSizeFirst ? &dynBlock->gtDynamicSize : &dynBlock->gtOp1;
+ assert(*m_edge != nullptr);
+ m_advance = &GenTreeUseEdgeIterator::AdvanceDynBlk;
}
- break;
+ return;
case GT_STORE_DYN_BLK:
{
GenTreeDynBlk* const dynBlock = m_node->AsDynBlk();
if (dynBlock->gtEvalSizeFirst)
{
- switch (m_state)
- {
- case 0:
- return &dynBlock->gtDynamicSize;
- case 1:
- return dynBlock->IsReverseOp() ? &dynBlock->gtOp2 : &dynBlock->gtOp1;
- case 2:
- return dynBlock->IsReverseOp() ? &dynBlock->gtOp1 : &dynBlock->gtOp2;
- default:
- return nullptr;
- }
+ m_edge = &dynBlock->gtDynamicSize;
}
else
{
- switch (m_state)
- {
- case 0:
- return dynBlock->IsReverseOp() ? &dynBlock->gtOp2 : &dynBlock->gtOp1;
- case 1:
- return dynBlock->IsReverseOp() ? &dynBlock->gtOp1 : &dynBlock->gtOp2;
- case 2:
- return &dynBlock->gtDynamicSize;
- default:
- return nullptr;
- }
- }
- }
- break;
-
- case GT_LEA:
- {
- GenTreeAddrMode* lea = m_node->AsAddrMode();
-
- bool hasOp1 = lea->gtOp1 != nullptr;
- if (!hasOp1)
- {
- return m_state == 0 ? &lea->gtOp2 : nullptr;
+ m_edge = dynBlock->IsReverseOp() ? &dynBlock->gtOp2 : &dynBlock->gtOp1;
}
+ assert(*m_edge != nullptr);
- bool operandsReversed = (lea->gtFlags & GTF_REVERSE_OPS) != 0;
- switch (m_state)
- {
- case 0:
- return !operandsReversed ? &lea->gtOp1 : &lea->gtOp2;
- case 1:
- return !operandsReversed ? &lea->gtOp2 : &lea->gtOp1;
- default:
- return nullptr;
- }
+ m_advance = &GenTreeUseEdgeIterator::AdvanceStoreDynBlk;
}
- break;
+ return;
- case GT_FIELD_LIST:
- // Field List nodes are handled by MoveToNextFieldUseEdge.
- break;
+ case GT_CALL:
+ AdvanceCall<CALL_INSTANCE>();
+ return;
+ // Binary nodes
default:
- if (m_node->OperIsConst() || m_node->OperIsLeaf())
- {
- return nullptr;
- }
- else if (m_node->OperIsUnary())
- {
- return m_state == 0 ? &m_node->AsUnOp()->gtOp1 : nullptr;
- }
- else if (m_node->OperIsBinary())
- {
- bool operandsReversed = (m_node->gtFlags & GTF_REVERSE_OPS) != 0;
- switch (m_state)
- {
- case 0:
- return !operandsReversed ? &m_node->AsOp()->gtOp1 : &m_node->AsOp()->gtOp2;
- case 1:
- return !operandsReversed ? &m_node->AsOp()->gtOp2 : &m_node->AsOp()->gtOp1;
- default:
- return nullptr;
- }
- }
+ assert(m_node->OperIsBinary());
+ SetEntryStateForBinOp();
+ return;
}
-
- unreached();
}
//------------------------------------------------------------------------
-// GenTreeUseEdgeIterator::MoveToNextCallUseEdge:
-// Moves to the next operand of a call node. Unlike the simple nodes
-// handled by `GetNextUseEdge`, call nodes have a variable number of
-// operands stored in cons lists. This method expands the cons lists
-// into the operands stored within.
+// GenTreeUseEdgeIterator::AdvanceCmpXchg: produces the next operand of a CmpXchg node and advances the state.
//
-void GenTreeUseEdgeIterator::MoveToNextCallUseEdge()
+void GenTreeUseEdgeIterator::AdvanceCmpXchg()
{
- enum
- {
- CALL_INSTANCE = 0,
- CALL_ARGS = 1,
- CALL_LATE_ARGS = 2,
- CALL_CONTROL_EXPR = 3,
- CALL_COOKIE = 4,
- CALL_ADDRESS = 5,
- CALL_TERMINAL = 6,
- };
-
- GenTreeCall* call = m_node->AsCall();
-
- for (;;)
+ switch (m_state)
{
- switch (m_state)
- {
- case CALL_INSTANCE:
- m_state = CALL_ARGS;
- m_argList = call->gtCallArgs;
-
- if (call->gtCallObjp != nullptr)
- {
- m_edge = &call->gtCallObjp;
- return;
- }
- break;
-
- case CALL_ARGS:
- case CALL_LATE_ARGS:
- if (m_argList == nullptr)
- {
- m_state++;
-
- if (m_state == CALL_LATE_ARGS)
- {
- m_argList = call->gtCallLateArgs;
- }
- }
- else
- {
- GenTreeArgList* argNode = m_argList->AsArgList();
- m_edge = &argNode->gtOp1;
- m_argList = argNode->Rest();
- return;
- }
- break;
-
- case CALL_CONTROL_EXPR:
- m_state = call->gtCallType == CT_INDIRECT ? CALL_COOKIE : CALL_TERMINAL;
+ case 0:
+ m_edge = &m_node->AsCmpXchg()->gtOpValue;
+ m_state = 1;
+ break;
+ case 1:
+ m_edge = &m_node->AsCmpXchg()->gtOpComparand;
+ m_advance = &GenTreeUseEdgeIterator::Terminate;
+ break;
+ default:
+ unreached();
+ }
- if (call->gtControlExpr != nullptr)
- {
- m_edge = &call->gtControlExpr;
- return;
- }
- break;
+ assert(*m_edge != nullptr);
+}
- case 4:
- assert(call->gtCallType == CT_INDIRECT);
+//------------------------------------------------------------------------
+// GenTreeUseEdgeIterator::AdvanceBoundsChk: produces the next operand of a BoundsChk node and advances the state.
+//
+void GenTreeUseEdgeIterator::AdvanceBoundsChk()
+{
+ m_edge = &m_node->AsBoundsChk()->gtArrLen;
+ assert(*m_edge != nullptr);
+ m_advance = &GenTreeUseEdgeIterator::Terminate;
+}
- m_state = CALL_ADDRESS;
+//------------------------------------------------------------------------
+// GenTreeUseEdgeIterator::AdvanceArrElem: produces the next operand of a ArrElem node and advances the state.
+//
+// Because these nodes are variadic, this function uses `m_state` to index into the list of array indices.
+//
+void GenTreeUseEdgeIterator::AdvanceArrElem()
+{
+ if (m_state < m_node->AsArrElem()->gtArrRank)
+ {
+ m_edge = &m_node->AsArrElem()->gtArrInds[m_state];
+ assert(*m_edge != nullptr);
+ m_state++;
+ }
+ else
+ {
+ m_state = -1;
+ }
+}
- if (call->gtCallCookie != nullptr)
- {
- m_edge = &call->gtCallCookie;
- return;
- }
- break;
+//------------------------------------------------------------------------
+// GenTreeUseEdgeIterator::AdvanceArrOffset: produces the next operand of a ArrOffset node and advances the state.
+//
+void GenTreeUseEdgeIterator::AdvanceArrOffset()
+{
+ switch (m_state)
+ {
+ case 0:
+ m_edge = &m_node->AsArrOffs()->gtIndex;
+ m_state = 1;
+ break;
+ case 1:
+ m_edge = &m_node->AsArrOffs()->gtArrObj;
+ m_advance = &GenTreeUseEdgeIterator::Terminate;
+ break;
+ default:
+ unreached();
+ }
- case 5:
- assert(call->gtCallType == CT_INDIRECT);
+ assert(*m_edge != nullptr);
+}
- m_state = CALL_TERMINAL;
- if (call->gtCallAddr != nullptr)
- {
- m_edge = &call->gtCallAddr;
- return;
- }
- break;
+//------------------------------------------------------------------------
+// GenTreeUseEdgeIterator::AdvanceDynBlk: produces the next operand of a DynBlk node and advances the state.
+//
+void GenTreeUseEdgeIterator::AdvanceDynBlk()
+{
+ GenTreeDynBlk* const dynBlock = m_node->AsDynBlk();
- default:
- m_node = nullptr;
- m_edge = nullptr;
- m_argList = nullptr;
- m_state = -1;
- return;
- }
- }
+ m_edge = dynBlock->gtEvalSizeFirst ? &dynBlock->gtOp1 : &dynBlock->gtDynamicSize;
+ assert(*m_edge != nullptr);
+ m_advance = &GenTreeUseEdgeIterator::Terminate;
}
//------------------------------------------------------------------------
-// GenTreeUseEdgeIterator::MoveToNextPhiUseEdge:
-// Moves to the next operand of a phi node. Unlike the simple nodes
-// handled by `GetNextUseEdge`, phi nodes have a variable number of
-// operands stored in a cons list. This method expands the cons list
-// into the operands stored within.
+// GenTreeUseEdgeIterator::AdvanceStoreDynBlk: produces the next operand of a StoreDynBlk node and advances the state.
+//
+// These nodes are moderately complicated but rare enough that templating this function is probably not
+// worth the extra complexity.
//
-void GenTreeUseEdgeIterator::MoveToNextPhiUseEdge()
+void GenTreeUseEdgeIterator::AdvanceStoreDynBlk()
{
- GenTreeUnOp* phi = m_node->AsUnOp();
-
- for (;;)
+ GenTreeDynBlk* const dynBlock = m_node->AsDynBlk();
+ if (dynBlock->gtEvalSizeFirst)
{
switch (m_state)
{
case 0:
- m_state = 1;
- m_argList = phi->gtOp1;
+ m_edge = dynBlock->IsReverseOp() ? &dynBlock->gtOp2 : &dynBlock->gtOp1;
+ m_state = 1;
break;
-
case 1:
- if (m_argList == nullptr)
- {
- m_state = 2;
- }
- else
- {
- GenTreeArgList* argNode = m_argList->AsArgList();
- m_edge = &argNode->gtOp1;
- m_argList = argNode->Rest();
- return;
- }
+ m_edge = dynBlock->IsReverseOp() ? &dynBlock->gtOp1 : &dynBlock->gtOp2;
+ m_advance = &GenTreeUseEdgeIterator::Terminate;
break;
-
default:
- m_node = nullptr;
- m_edge = nullptr;
- m_argList = nullptr;
- m_state = -1;
- return;
+ unreached();
}
}
-}
-
-#ifdef FEATURE_SIMD
-//------------------------------------------------------------------------
-// GenTreeUseEdgeIterator::MoveToNextSIMDUseEdge:
-// Moves to the next operand of a SIMD node. Most SIMD nodes have a
-// fixed number of operands and are handled accordingly.
-// `SIMDIntrinsicInitN` nodes, however, have a variable number of
-// operands stored in a cons list. This method expands the cons list
-// into the operands stored within.
-//
-void GenTreeUseEdgeIterator::MoveToNextSIMDUseEdge()
-{
- GenTreeSIMD* simd = m_node->AsSIMD();
-
- if (simd->gtSIMDIntrinsicID != SIMDIntrinsicInitN)
+ else
{
- bool operandsReversed = (simd->gtFlags & GTF_REVERSE_OPS) != 0;
switch (m_state)
{
case 0:
- m_edge = !operandsReversed ? &simd->gtOp1 : &simd->gtOp2;
+ m_edge = dynBlock->IsReverseOp() ? &dynBlock->gtOp1 : &dynBlock->gtOp2;
+ m_state = 1;
break;
case 1:
- m_edge = !operandsReversed ? &simd->gtOp2 : &simd->gtOp1;
+ m_edge = &dynBlock->gtDynamicSize;
+ m_advance = &GenTreeUseEdgeIterator::Terminate;
break;
default:
- m_edge = nullptr;
- break;
+ unreached();
}
+ }
- if (m_edge != nullptr && *m_edge != nullptr)
- {
- m_state++;
- }
- else
- {
- m_node = nullptr;
- m_state = -1;
- }
+ assert(*m_edge != nullptr);
+}
- return;
- }
+//------------------------------------------------------------------------
+// GenTreeUseEdgeIterator::AdvanceBinOp: produces the next operand of a binary node and advances the state.
+//
+// This function must be instantiated s.t. `ReverseOperands` is `true` iff the node is marked with the
+// `GTF_REVERSE_OPS` flag.
+//
+template <bool ReverseOperands>
+void GenTreeUseEdgeIterator::AdvanceBinOp()
+{
+ assert(ReverseOperands == ((m_node->gtFlags & GTF_REVERSE_OPS) != 0));
- for (;;)
+ m_edge = !ReverseOperands ? &m_node->AsOp()->gtOp2 : &m_node->AsOp()->gtOp1;
+ assert(*m_edge != nullptr);
+ m_advance = &GenTreeUseEdgeIterator::Terminate;
+}
+
+//------------------------------------------------------------------------
+// GenTreeUseEdgeIterator::SetEntryStateForBinOp: produces the first operand of a binary node and chooses
+// the appropriate advance function.
+//
+void GenTreeUseEdgeIterator::SetEntryStateForBinOp()
+{
+ assert(m_node != nullptr);
+ assert(m_node->OperIsBinary());
+
+ GenTreeOp* const node = m_node->AsOp();
+
+ if (node->gtOp2 == nullptr)
{
- switch (m_state)
- {
- case 0:
- m_state = 1;
- m_argList = simd->gtOp1;
- break;
+ assert(node->gtOp1 != nullptr);
+ assert(node->NullOp2Legal());
+ m_edge = &node->gtOp1;
+ m_advance = &GenTreeUseEdgeIterator::Terminate;
+ }
+ else if ((node->gtFlags & GTF_REVERSE_OPS) != 0)
+ {
+ m_edge = &m_node->AsOp()->gtOp2;
+ m_advance = &GenTreeUseEdgeIterator::AdvanceBinOp<true>;
+ }
+ else
+ {
+ m_edge = &m_node->AsOp()->gtOp1;
+ m_advance = &GenTreeUseEdgeIterator::AdvanceBinOp<false>;
+ }
+}
- case 1:
- if (m_argList == nullptr)
- {
- m_state = 2;
- }
- else
- {
- GenTreeArgList* argNode = m_argList->AsArgList();
- m_edge = &argNode->gtOp1;
- m_argList = argNode->Rest();
- return;
- }
- break;
+//------------------------------------------------------------------------
+// GenTreeUseEdgeIterator::AdvanceList: produces the next operand of a variadic node and advances the state.
+//
+// This function does not use `m_state` for anything meaningful; it simply walks the `m_argList` until
+// there are no further entries.
+//
+void GenTreeUseEdgeIterator::AdvanceList()
+{
+ assert(m_state == 0);
- default:
- m_node = nullptr;
- m_edge = nullptr;
- m_argList = nullptr;
- m_state = -1;
- return;
- }
+ if (m_argList == nullptr)
+ {
+ m_state = -1;
+ }
+ else
+ {
+ GenTreeArgList* listNode = m_argList->AsArgList();
+ m_edge = &listNode->gtOp1;
+ m_argList = listNode->Rest();
}
}
-#endif // FEATURE_SIMD
-void GenTreeUseEdgeIterator::MoveToNextFieldUseEdge()
+//------------------------------------------------------------------------
+// GenTreeUseEdgeIterator::SetEntryStateForList: produces the first operand of a list node.
+//
+void GenTreeUseEdgeIterator::SetEntryStateForList(GenTree* list)
{
- assert(m_node->OperGet() == GT_FIELD_LIST);
+ m_argList = list;
+ m_advance = &GenTreeUseEdgeIterator::AdvanceList;
+ AdvanceList();
+}
- for (;;)
+//------------------------------------------------------------------------
+// GenTreeUseEdgeIterator::AdvanceCall: produces the next operand of a call node and advances the state.
+//
+// This function is a bit tricky: in order to avoid doing unnecessary work, it is instantiated with the
+// state number the iterator will be in when it is called. For example, `AdvanceCall<CALL_INSTANCE>`
+// is the instantiation used when the iterator is at the `CALL_INSTANCE` state (i.e. the entry state).
+// This sort of templating allows each state to avoid processing earlier states without unnecessary
+// duplication of code.
+//
+// Note that this method expands the argument lists (`gtCallArgs` and `gtCallLateArgs`) into their
+// component operands.
+//
+template <int state>
+void GenTreeUseEdgeIterator::AdvanceCall()
+{
+ GenTreeCall* const call = m_node->AsCall();
+
+ switch (state)
{
- switch (m_state)
- {
- case 0:
- m_state = 1;
- m_argList = m_node;
- break;
+ case CALL_INSTANCE:
+ m_argList = call->gtCallArgs;
+ m_advance = &GenTreeUseEdgeIterator::AdvanceCall<CALL_ARGS>;
+ if (call->gtCallObjp != nullptr)
+ {
+ m_edge = &call->gtCallObjp;
+ return;
+ }
+ __fallthrough;
- case 1:
- if (m_argList == nullptr)
+ case CALL_ARGS:
+ if (m_argList != nullptr)
+ {
+ GenTreeArgList* argNode = m_argList->AsArgList();
+ m_edge = &argNode->gtOp1;
+ m_argList = argNode->Rest();
+ return;
+ }
+ m_argList = call->gtCallLateArgs;
+ m_advance = &GenTreeUseEdgeIterator::AdvanceCall<CALL_LATE_ARGS>;
+ __fallthrough;
+
+ case CALL_LATE_ARGS:
+ if (m_argList != nullptr)
+ {
+ GenTreeArgList* argNode = m_argList->AsArgList();
+ m_edge = &argNode->gtOp1;
+ m_argList = argNode->Rest();
+ return;
+ }
+ m_advance = &GenTreeUseEdgeIterator::AdvanceCall<CALL_CONTROL_EXPR>;
+ __fallthrough;
+
+ case CALL_CONTROL_EXPR:
+ if (call->gtControlExpr != nullptr)
+ {
+ if (call->gtCallType == CT_INDIRECT)
{
- m_state = 2;
+ m_advance = &GenTreeUseEdgeIterator::AdvanceCall<CALL_COOKIE>;
}
else
{
- GenTreeArgList* listNode = m_argList->AsArgList();
- m_edge = &listNode->gtOp1;
- m_argList = listNode->Rest();
- return;
+ m_advance = &GenTreeUseEdgeIterator::Terminate;
}
- break;
+ m_edge = &call->gtControlExpr;
+ return;
+ }
+ else if (call->gtCallType != CT_INDIRECT)
+ {
+ m_state = -1;
+ return;
+ }
+ __fallthrough;
- default:
- m_node = nullptr;
- m_edge = nullptr;
- m_argList = nullptr;
- m_state = -1;
+ case CALL_COOKIE:
+ assert(call->gtCallType == CT_INDIRECT);
+
+ m_advance = &GenTreeUseEdgeIterator::AdvanceCall<CALL_ADDRESS>;
+ if (call->gtCallCookie != nullptr)
+ {
+ m_edge = &call->gtCallCookie;
return;
- }
+ }
+ __fallthrough;
+
+ case CALL_ADDRESS:
+ assert(call->gtCallType == CT_INDIRECT);
+
+ m_advance = &GenTreeUseEdgeIterator::Terminate;
+ if (call->gtCallAddr != nullptr)
+ {
+ m_edge = &call->gtCallAddr;
+ }
+ return;
+
+ default:
+ unreached();
}
}
//------------------------------------------------------------------------
-// GenTreeUseEdgeIterator::operator++:
-// Advances the iterator to the next operand.
+// GenTreeUseEdgeIterator::Terminate: advances the iterator to the terminal state.
+//
+void GenTreeUseEdgeIterator::Terminate()
+{
+ m_state = -1;
+}
+
+//------------------------------------------------------------------------
+// GenTreeUseEdgeIterator::operator++: advances the iterator to the next operand.
//
GenTreeUseEdgeIterator& GenTreeUseEdgeIterator::operator++()
{
- if (m_state == -1)
+ // If we've reached the terminal state, do nothing.
+ if (m_state != -1)
{
- // If we've reached the terminal state, do nothing.
- assert(m_node == nullptr);
- assert(m_edge == nullptr);
- assert(m_argList == nullptr);
- }
- else
- {
- // Otherwise, move to the next operand in the node.
- genTreeOps op = m_node->OperGet();
- if (op == GT_CALL)
- {
- MoveToNextCallUseEdge();
- }
- else if (op == GT_PHI)
- {
- MoveToNextPhiUseEdge();
- }
-#ifdef FEATURE_SIMD
- else if (op == GT_SIMD)
- {
- MoveToNextSIMDUseEdge();
- }
-#endif
- else if (op == GT_FIELD_LIST)
- {
- MoveToNextFieldUseEdge();
- }
- else
- {
- m_edge = GetNextUseEdge();
- if (m_edge != nullptr && *m_edge != nullptr)
- {
- m_state++;
- }
- else
- {
- m_edge = nullptr;
- m_node = nullptr;
- m_state = -1;
- }
- }
+ (this->*m_advance)();
}
return *this;
@@ -11999,7 +12023,7 @@ void Compiler::gtDispTreeRange(LIR::Range& containingRange, GenTree* tree)
void Compiler::gtDispLIRNode(GenTree* node, const char* prefixMsg /* = nullptr */)
{
auto displayOperand = [](GenTree* operand, const char* message, IndentInfo operandArc, IndentStack& indentStack,
- size_t prefixIndent = 0) {
+ size_t prefixIndent) {
assert(operand != nullptr);
assert(message != nullptr);
@@ -16052,9 +16076,7 @@ bool GenTreeIntConCommon::FitsInAddrBase(Compiler* comp)
#endif
#endif //! LEGACY_BACKEND
- // TODO-x86 - TLS field handles are excluded for now as they are accessed relative to FS segment.
- // Handling of TLS field handles is a NYI and this needs to be relooked after implementing it.
- return IsCnsIntOrI() && !IsIconHandle(GTF_ICON_TLS_HDL);
+ return IsCnsIntOrI();
}
// Returns true if this icon value is encoded as addr needs recording a relocation with VM
@@ -16357,6 +16379,14 @@ CORINFO_CLASS_HANDLE Compiler::gtGetClassHandle(GenTreePtr tree, bool* isExact,
*isExact = false;
CORINFO_CLASS_HANDLE objClass = nullptr;
+ // Bail out if we're just importing and not generating code, since
+ // the jit uses TYP_REF for CORINFO_TYPE_VAR locals and args, but
+ // these may not be ref types.
+ if (compIsForImportOnly())
+ {
+ return objClass;
+ }
+
// Bail out if the tree is not a ref type.
var_types treeType = tree->TypeGet();
if (treeType != TYP_REF)
diff --git a/src/jit/gentree.h b/src/jit/gentree.h
index f3f2dcc2f8..2261140ee4 100644
--- a/src/jit/gentree.h
+++ b/src/jit/gentree.h
@@ -149,6 +149,61 @@ struct BasicBlock;
struct InlineCandidateInfo;
+typedef unsigned short AssertionIndex;
+
+static const AssertionIndex NO_ASSERTION_INDEX = 0;
+
+class AssertionInfo
+{
+ // true if the assertion holds on the bbNext edge instead of the bbJumpDest edge (for GT_JTRUE nodes)
+ unsigned short m_isNextEdgeAssertion : 1;
+ // 1-based index of the assertion
+ unsigned short m_assertionIndex : 15;
+
+ AssertionInfo(bool isNextEdgeAssertion, AssertionIndex assertionIndex)
+ : m_isNextEdgeAssertion(isNextEdgeAssertion), m_assertionIndex(assertionIndex)
+ {
+ assert(m_assertionIndex == assertionIndex);
+ }
+
+public:
+ AssertionInfo() : AssertionInfo(false, 0)
+ {
+ }
+
+ AssertionInfo(AssertionIndex assertionIndex) : AssertionInfo(false, assertionIndex)
+ {
+ }
+
+ static AssertionInfo ForNextEdge(AssertionIndex assertionIndex)
+ {
+ // Ignore the edge information if there's no assertion
+ bool isNextEdge = (assertionIndex != NO_ASSERTION_INDEX);
+ return AssertionInfo(isNextEdge, assertionIndex);
+ }
+
+ void Clear()
+ {
+ m_isNextEdgeAssertion = 0;
+ m_assertionIndex = NO_ASSERTION_INDEX;
+ }
+
+ bool HasAssertion() const
+ {
+ return m_assertionIndex != NO_ASSERTION_INDEX;
+ }
+
+ AssertionIndex GetAssertionIndex() const
+ {
+ return m_assertionIndex;
+ }
+
+ bool IsNextEdgeAssertion() const
+ {
+ return m_isNextEdgeAssertion;
+ }
+};
+
/*****************************************************************************/
// GT_FIELD nodes will be lowered into more "code-gen-able" representations, like
@@ -396,29 +451,27 @@ struct GenTree
unsigned char gtLIRFlags; // Used for nodes that are in LIR. See LIR::Flags in lir.h for the various flags.
#if ASSERTION_PROP
- unsigned short gtAssertionNum; // 0 or Assertion table index
- // possibly ORed with optAssertionEdge::OAE_NEXT_EDGE
- // valid only for non-GT_STMT nodes
+ AssertionInfo gtAssertionInfo; // valid only for non-GT_STMT nodes
- bool HasAssertion() const
+ bool GeneratesAssertion() const
{
- return gtAssertionNum != 0;
+ return gtAssertionInfo.HasAssertion();
}
+
void ClearAssertion()
{
- gtAssertionNum = 0;
+ gtAssertionInfo.Clear();
}
- unsigned short GetAssertion() const
+ AssertionInfo GetAssertionInfo() const
{
- return gtAssertionNum;
+ return gtAssertionInfo;
}
- void SetAssertion(unsigned short value)
+
+ void SetAssertionInfo(AssertionInfo info)
{
- assert((unsigned short)value == value);
- gtAssertionNum = (unsigned short)value;
+ gtAssertionInfo = info;
}
-
#endif
#if FEATURE_STACK_FP_X87
@@ -2060,19 +2113,22 @@ public:
};
//------------------------------------------------------------------------
-// GenTreeUseEdgeIterator: an iterator that will produce each use edge of a
-// GenTree node in the order in which they are
-// used. Note that the use edges of a node may not
-// correspond exactly to the nodes on the other
-// ends of its use edges: in particular, GT_LIST
-// nodes are expanded into their component parts
-// (with the optional exception of multi-reg
-// arguments). This differs from the behavior of
-// GenTree::GetChildPointer(), which does not expand
-// lists.
+// GenTreeUseEdgeIterator: an iterator that will produce each use edge of a GenTree node in the order in which
+// they are used.
//
-// Note: valid values of this type may be obtained by calling
-// `GenTree::UseEdgesBegin` and `GenTree::UseEdgesEnd`.
+// The use edges of a node may not correspond exactly to the nodes on the other ends of its use edges: in
+// particular, GT_LIST nodes are expanded into their component parts. This differs from the behavior of
+// GenTree::GetChildPointer(), which does not expand lists.
+//
+// Operand iteration is common enough in the back end of the compiler that the implementation of this type has
+// traded some simplicity for speed:
+// - As much work as is reasonable is done in the constructor rather than during operand iteration
+// - Node-specific functionality is handled by a small class of "advance" functions called by operator++
+// rather than making operator++ itself handle all nodes
+// - Some specialization has been performed for specific node types/shapes (e.g. the advance function for
+// binary nodes is specialized based on whether or not the node has the GTF_REVERSE_OPS flag set)
+//
+// Valid values of this type may be obtained by calling `GenTree::UseEdgesBegin` and `GenTree::UseEdgesEnd`.
//
class GenTreeUseEdgeIterator final
{
@@ -2080,6 +2136,20 @@ class GenTreeUseEdgeIterator final
friend GenTreeUseEdgeIterator GenTree::UseEdgesBegin();
friend GenTreeUseEdgeIterator GenTree::UseEdgesEnd();
+ enum
+ {
+ CALL_INSTANCE = 0,
+ CALL_ARGS = 1,
+ CALL_LATE_ARGS = 2,
+ CALL_CONTROL_EXPR = 3,
+ CALL_COOKIE = 4,
+ CALL_ADDRESS = 5,
+ CALL_TERMINAL = 6,
+ };
+
+ typedef void (GenTreeUseEdgeIterator::*AdvanceFn)();
+
+ AdvanceFn m_advance;
GenTree* m_node;
GenTree** m_edge;
GenTree* m_argList;
@@ -2087,24 +2157,40 @@ class GenTreeUseEdgeIterator final
GenTreeUseEdgeIterator(GenTree* node);
- GenTree** GetNextUseEdge() const;
- void MoveToNextCallUseEdge();
- void MoveToNextPhiUseEdge();
-#ifdef FEATURE_SIMD
- void MoveToNextSIMDUseEdge();
-#endif
- void MoveToNextFieldUseEdge();
+ // Advance functions for special nodes
+ void AdvanceCmpXchg();
+ void AdvanceBoundsChk();
+ void AdvanceArrElem();
+ void AdvanceArrOffset();
+ void AdvanceDynBlk();
+ void AdvanceStoreDynBlk();
+
+ template <bool ReverseOperands>
+ void AdvanceBinOp();
+ void SetEntryStateForBinOp();
+
+ // An advance function for list-like nodes (Phi, SIMDIntrinsicInitN, FieldList)
+ void AdvanceList();
+ void SetEntryStateForList(GenTree* list);
+
+ // The advance function for call nodes
+ template <int state>
+ void AdvanceCall();
+
+ void Terminate();
public:
GenTreeUseEdgeIterator();
inline GenTree** operator*()
{
+ assert(m_state != -1);
return m_edge;
}
inline GenTree** operator->()
{
+ assert(m_state != -1);
return m_edge;
}
@@ -4580,7 +4666,7 @@ struct GenTreePhiArg : public GenTreeLclVarCommon
#endif
};
-/* gtPutArgStk -- Argument passed on stack */
+/* gtPutArgStk -- Argument passed on stack (GT_PUTARG_STK) */
struct GenTreePutArgStk : public GenTreeUnOp
{
@@ -4589,105 +4675,58 @@ struct GenTreePutArgStk : public GenTreeUnOp
unsigned gtPadAlign; // Number of padding slots for stack alignment
#endif
-#if FEATURE_FASTTAILCALL
- bool putInIncomingArgArea; // Whether this arg needs to be placed in incoming arg area.
- // By default this is false and will be placed in out-going arg area.
- // Fast tail calls set this to true.
- // In future if we need to add more such bool fields consider bit fields.
-
- GenTreePutArgStk(genTreeOps oper,
- var_types type,
- unsigned slotNum PUT_STRUCT_ARG_STK_ONLY_ARG(unsigned numSlots)
- PUT_STRUCT_ARG_STK_ONLY_ARG(bool isStruct),
- bool _putInIncomingArgArea = false DEBUGARG(GenTreeCall* callNode = nullptr)
- DEBUGARG(bool largeNode = false))
- : GenTreeUnOp(oper, type DEBUGARG(largeNode))
+ // Don't let clang-format mess with the GenTreePutArgStk constructor.
+ // clang-format off
+
+ GenTreePutArgStk(genTreeOps oper,
+ var_types type,
+ GenTreePtr op1,
+ unsigned slotNum
+ PUT_STRUCT_ARG_STK_ONLY_ARG(unsigned numSlots),
+ bool putInIncomingArgArea = false,
+ GenTreeCall* callNode = nullptr)
+ : GenTreeUnOp(oper, type, op1 DEBUGARG(/*largeNode*/ false))
, gtSlotNum(slotNum)
#if defined(UNIX_X86_ABI)
, gtPadAlign(0)
#endif
- , putInIncomingArgArea(_putInIncomingArgArea)
+#if FEATURE_FASTTAILCALL
+ , gtPutInIncomingArgArea(putInIncomingArgArea)
+#endif // FEATURE_FASTTAILCALL
#ifdef FEATURE_PUT_STRUCT_ARG_STK
, gtPutArgStkKind(Kind::Invalid)
, gtNumSlots(numSlots)
, gtNumberReferenceSlots(0)
, gtGcPtrs(nullptr)
#endif // FEATURE_PUT_STRUCT_ARG_STK
- {
-#ifdef DEBUG
- gtCall = callNode;
+#if defined(DEBUG) || defined(UNIX_X86_ABI)
+ , gtCall(callNode)
#endif
+ {
}
- GenTreePutArgStk(genTreeOps oper,
- var_types type,
- GenTreePtr op1,
- unsigned slotNum PUT_STRUCT_ARG_STK_ONLY_ARG(unsigned numSlots),
- bool _putInIncomingArgArea = false DEBUGARG(GenTreeCall* callNode = nullptr)
- DEBUGARG(bool largeNode = false))
- : GenTreeUnOp(oper, type, op1 DEBUGARG(largeNode))
- , gtSlotNum(slotNum)
-#if defined(UNIX_X86_ABI)
- , gtPadAlign(0)
-#endif
- , putInIncomingArgArea(_putInIncomingArgArea)
-#ifdef FEATURE_PUT_STRUCT_ARG_STK
- , gtPutArgStkKind(Kind::Invalid)
- , gtNumSlots(numSlots)
- , gtNumberReferenceSlots(0)
- , gtGcPtrs(nullptr)
-#endif // FEATURE_PUT_STRUCT_ARG_STK
+// clang-format on
+
+#if FEATURE_FASTTAILCALL
+
+ bool gtPutInIncomingArgArea; // Whether this arg needs to be placed in incoming arg area.
+ // By default this is false and will be placed in out-going arg area.
+ // Fast tail calls set this to true.
+ // In future if we need to add more such bool fields consider bit fields.
+
+ bool putInIncomingArgArea() const
{
-#ifdef DEBUG
- gtCall = callNode;
-#endif
+ return gtPutInIncomingArgArea;
}
#else // !FEATURE_FASTTAILCALL
- GenTreePutArgStk(genTreeOps oper,
- var_types type,
- unsigned slotNum PUT_STRUCT_ARG_STK_ONLY_ARG(unsigned numSlots)
- DEBUGARG(GenTreeCall* callNode = NULL) DEBUGARG(bool largeNode = false))
- : GenTreeUnOp(oper, type DEBUGARG(largeNode))
- , gtSlotNum(slotNum)
-#if defined(UNIX_X86_ABI)
- , gtPadAlign(0)
-#endif
-#ifdef FEATURE_PUT_STRUCT_ARG_STK
- , gtPutArgStkKind(Kind::Invalid)
- , gtNumSlots(numSlots)
- , gtNumberReferenceSlots(0)
- , gtGcPtrs(nullptr)
-#endif // FEATURE_PUT_STRUCT_ARG_STK
+ bool putInIncomingArgArea() const
{
-#ifdef DEBUG
- gtCall = callNode;
-#endif
+ return false;
}
- GenTreePutArgStk(genTreeOps oper,
- var_types type,
- GenTreePtr op1,
- unsigned slotNum PUT_STRUCT_ARG_STK_ONLY_ARG(unsigned numSlots)
- DEBUGARG(GenTreeCall* callNode = NULL) DEBUGARG(bool largeNode = false))
- : GenTreeUnOp(oper, type, op1 DEBUGARG(largeNode))
- , gtSlotNum(slotNum)
-#if defined(UNIX_X86_ABI)
- , gtPadAlign(0)
-#endif
-#ifdef FEATURE_PUT_STRUCT_ARG_STK
- , gtPutArgStkKind(Kind::Invalid)
- , gtNumSlots(numSlots)
- , gtNumberReferenceSlots(0)
- , gtGcPtrs(nullptr)
-#endif // FEATURE_PUT_STRUCT_ARG_STK
- {
-#ifdef DEBUG
- gtCall = callNode;
-#endif
- }
-#endif // FEATURE_FASTTAILCALL
+#endif // !FEATURE_FASTTAILCALL
unsigned getArgOffset()
{
@@ -4707,13 +4746,12 @@ struct GenTreePutArgStk : public GenTreeUnOp
#endif
#ifdef FEATURE_PUT_STRUCT_ARG_STK
+
unsigned getArgSize()
{
return gtNumSlots * TARGET_POINTER_SIZE;
}
-#endif // FEATURE_PUT_STRUCT_ARG_STK
-#ifdef FEATURE_PUT_STRUCT_ARG_STK
//------------------------------------------------------------------------
// setGcPointers: Sets the number of references and the layout of the struct object returned by the VM.
//
@@ -4735,13 +4773,7 @@ struct GenTreePutArgStk : public GenTreeUnOp
gtNumberReferenceSlots = numPointers;
gtGcPtrs = pointers;
}
-#endif // FEATURE_PUT_STRUCT_ARG_STK
-
-#ifdef DEBUG
- GenTreeCall* gtCall; // the call node to which this argument belongs
-#endif
-#ifdef FEATURE_PUT_STRUCT_ARG_STK
// Instruction selection: during codegen time, what code sequence we will be using
// to encode this operation.
// TODO-Throughput: The following information should be obtained from the child
@@ -4760,7 +4792,12 @@ struct GenTreePutArgStk : public GenTreeUnOp
unsigned gtNumSlots; // Number of slots for the argument to be passed on stack
unsigned gtNumberReferenceSlots; // Number of reference slots.
BYTE* gtGcPtrs; // gcPointers
-#endif // FEATURE_PUT_STRUCT_ARG_STK
+
+#endif // FEATURE_PUT_STRUCT_ARG_STK
+
+#if defined(DEBUG) || defined(UNIX_X86_ABI)
+ GenTreeCall* gtCall; // the call node to which this argument belongs
+#endif
#if DEBUGGABLE_GENTREE
GenTreePutArgStk() : GenTreeUnOp()
diff --git a/src/jit/importer.cpp b/src/jit/importer.cpp
index e285fed5ae..e4c740e338 100644
--- a/src/jit/importer.cpp
+++ b/src/jit/importer.cpp
@@ -1850,14 +1850,10 @@ GenTreeCall* Compiler::impReadyToRunHelperToTree(
CORINFO_LOOKUP_KIND* pGenericLookupKind /* =NULL. Only used with generics */)
{
CORINFO_CONST_LOOKUP lookup;
-#if COR_JIT_EE_VERSION > 460
if (!info.compCompHnd->getReadyToRunHelper(pResolvedToken, pGenericLookupKind, helper, &lookup))
{
return nullptr;
}
-#else
- info.compCompHnd->getReadyToRunHelper(pResolvedToken, helper, &lookup);
-#endif
GenTreeCall* op1 = gtNewHelperCallNode(helper, type, GTF_EXCEPT, args);
@@ -2179,9 +2175,12 @@ bool Compiler::impSpillStackEntry(unsigned level,
}
}
+ bool isNewTemp = false;
+
if (tnum == BAD_VAR_NUM)
{
- tnum = lvaGrabTemp(true DEBUGARG(reason));
+ tnum = lvaGrabTemp(true DEBUGARG(reason));
+ isNewTemp = true;
}
else if (tiVerificationNeeded && lvaTable[tnum].TypeGet() != TYP_UNDEF)
{
@@ -2211,6 +2210,13 @@ bool Compiler::impSpillStackEntry(unsigned level,
/* Assign the spilled entry to the temp */
impAssignTempGen(tnum, tree, verCurrentState.esStack[level].seTypeInfo.GetClassHandle(), level);
+ // If temp is newly introduced and a ref type, grab what type info we can.
+ if (isNewTemp && (lvaTable[tnum].lvType == TYP_REF))
+ {
+ CORINFO_CLASS_HANDLE stkHnd = verCurrentState.esStack[level].seTypeInfo.GetClassHandle();
+ lvaSetClass(tnum, tree, stkHnd);
+ }
+
// The tree type may be modified by impAssignTempGen, so use the type of the lclVar.
var_types type = genActualType(lvaTable[tnum].TypeGet());
GenTreePtr temp = gtNewLclvNode(tnum, type);
@@ -2997,14 +3003,12 @@ GenTreePtr Compiler::impInitializeArrayIntrinsic(CORINFO_SIG_INFO* sig)
#endif
)
{
-#if COR_JIT_EE_VERSION > 460
if (newArrayCall->gtCall.gtCallMethHnd != eeFindHelper(CORINFO_HELP_NEW_MDARR_NONVARARG))
{
return nullptr;
}
isMDArray = true;
-#endif
}
CORINFO_CLASS_HANDLE arrayClsHnd = (CORINFO_CLASS_HANDLE)newArrayCall->gtCall.compileTimeHelperArgumentHandle;
@@ -3278,13 +3282,9 @@ GenTreePtr Compiler::impIntrinsic(GenTreePtr newobjThis,
bool tailCall,
CorInfoIntrinsics* pIntrinsicID)
{
- bool mustExpand = false;
-#if COR_JIT_EE_VERSION > 460
+ bool mustExpand = false;
CorInfoIntrinsics intrinsicID = info.compCompHnd->getIntrinsicID(method, &mustExpand);
-#else
- CorInfoIntrinsics intrinsicID = info.compCompHnd->getIntrinsicID(method);
-#endif
- *pIntrinsicID = intrinsicID;
+ *pIntrinsicID = intrinsicID;
#ifndef _TARGET_ARM_
genTreeOps interlockedOperator;
@@ -4989,7 +4989,6 @@ GenTreePtr Compiler::impImportLdvirtftn(GenTreePtr thisPtr,
NO_WAY("Virtual call to a function added via EnC is not supported");
}
-#if COR_JIT_EE_VERSION > 460
// CoreRT generic virtual method
if (((pCallInfo->sig.callConv & CORINFO_CALLCONV_GENERIC) != 0) && IsTargetAbi(CORINFO_CORERT_ABI))
{
@@ -5006,7 +5005,6 @@ GenTreePtr Compiler::impImportLdvirtftn(GenTreePtr thisPtr,
return gtNewHelperCallNode(CORINFO_HELP_GVMLOOKUP_FOR_SLOT, TYP_I_IMPL, GTF_EXCEPT,
gtNewArgList(thisPtr, runtimeMethodHandle));
}
-#endif // COR_JIT_EE_VERSION
#ifdef FEATURE_READYTORUN_COMPILER
if (opts.IsReadyToRun())
@@ -5257,7 +5255,6 @@ void Compiler::impImportNewObjArray(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORI
//
CLANG_FORMAT_COMMENT_ANCHOR;
-#if COR_JIT_EE_VERSION > 460
if (!opts.IsReadyToRun() || IsTargetAbi(CORINFO_CORERT_ABI))
{
LclVarDsc* newObjArrayArgsVar;
@@ -5317,7 +5314,6 @@ void Compiler::impImportNewObjArray(CORINFO_RESOLVED_TOKEN* pResolvedToken, CORI
node = gtNewHelperCallNode(CORINFO_HELP_NEW_MDARR_NONVARARG, TYP_REF, 0, args);
}
else
-#endif
{
//
// The varargs helper needs the type and method handles as last
@@ -5941,7 +5937,7 @@ GenTreePtr Compiler::impImportStaticFieldAccess(CORINFO_RESOLVED_TOKEN* pResolve
}
break;
}
-#if COR_JIT_EE_VERSION > 460
+
case CORINFO_FIELD_STATIC_READYTORUN_HELPER:
{
#ifdef FEATURE_READYTORUN_COMPILER
@@ -5970,7 +5966,7 @@ GenTreePtr Compiler::impImportStaticFieldAccess(CORINFO_RESOLVED_TOKEN* pResolve
#endif // FEATURE_READYTORUN_COMPILER
}
break;
-#endif // COR_JIT_EE_VERSION > 460
+
default:
{
if (!(access & CORINFO_ACCESS_ADDRESS))
@@ -6130,25 +6126,6 @@ void Compiler::impInsertHelperCall(CORINFO_HELPER_DESC* helperInfo)
impAppendTree(callout, (unsigned)CHECK_SPILL_NONE, impCurStmtOffs);
}
-void Compiler::impInsertCalloutForDelegate(CORINFO_METHOD_HANDLE callerMethodHnd,
- CORINFO_METHOD_HANDLE calleeMethodHnd,
- CORINFO_CLASS_HANDLE delegateTypeHnd)
-{
-#ifdef FEATURE_CORECLR
- if (!info.compCompHnd->isDelegateCreationAllowed(delegateTypeHnd, calleeMethodHnd))
- {
- // Call the JIT_DelegateSecurityCheck helper before calling the actual function.
- // This helper throws an exception if the CLR host disallows the call.
-
- GenTreePtr helper = gtNewHelperCallNode(CORINFO_HELP_DELEGATE_SECURITY_CHECK, TYP_VOID, GTF_EXCEPT,
- gtNewArgList(gtNewIconEmbClsHndNode(delegateTypeHnd),
- gtNewIconEmbMethHndNode(calleeMethodHnd)));
- // Append the callout statement
- impAppendTree(helper, (unsigned)CHECK_SPILL_NONE, impCurStmtOffs);
- }
-#endif // FEATURE_CORECLR
-}
-
// Checks whether the return types of caller and callee are compatible
// so that callee can be tail called. Note that here we don't check
// compatibility in IL Verifier sense, but on the lines of return type
@@ -6971,6 +6948,14 @@ var_types Compiler::impImportCall(OPCODE opcode,
}
#endif // !FEATURE_VARARG
+#ifdef UNIX_X86_ABI
+ if (call->gtCall.callSig == nullptr)
+ {
+ call->gtCall.callSig = new (this, CMK_CorSig) CORINFO_SIG_INFO;
+ *call->gtCall.callSig = *sig;
+ }
+#endif // UNIX_X86_ABI
+
if ((sig->callConv & CORINFO_CALLCONV_MASK) == CORINFO_CALLCONV_VARARG ||
(sig->callConv & CORINFO_CALLCONV_MASK) == CORINFO_CALLCONV_NATIVEVARARG)
{
@@ -9425,6 +9410,9 @@ GenTreePtr Compiler::impCastClassOrIsInstToTree(GenTreePtr op1,
// Make QMark node a top level node by spilling it.
unsigned tmp = lvaGrabTemp(true DEBUGARG("spilling QMark2"));
impAssignTempGen(tmp, qmarkNull, (unsigned)CHECK_SPILL_NONE);
+
+ // TODO: Is it possible op1 has a better type?
+ lvaSetClass(tmp, pResolvedToken->hClass);
return gtNewLclvNode(tmp, TYP_REF);
#endif
}
@@ -9682,6 +9670,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
GenTreeArgList* args = nullptr; // What good do these "DUMMY_INIT"s do?
GenTreePtr newObjThisPtr = DUMMY_INIT(NULL);
bool uns = DUMMY_INIT(false);
+ bool isLocal = false;
/* Get the next opcode and the size of its parameters */
@@ -9937,7 +9926,9 @@ void Compiler::impImportBlockCode(BasicBlock* block)
{
lclNum = lvaArg0Var;
}
- lvaTable[lclNum].lvArgWrite = 1;
+
+ // We should have seen this arg write in the prescan
+ assert(lvaTable[lclNum].lvHasILStoreOp);
if (tiVerificationNeeded)
{
@@ -9954,12 +9945,14 @@ void Compiler::impImportBlockCode(BasicBlock* block)
goto VAR_ST;
case CEE_STLOC:
- lclNum = getU2LittleEndian(codeAddr);
+ lclNum = getU2LittleEndian(codeAddr);
+ isLocal = true;
JITDUMP(" %u", lclNum);
goto LOC_ST;
case CEE_STLOC_S:
- lclNum = getU1LittleEndian(codeAddr);
+ lclNum = getU1LittleEndian(codeAddr);
+ isLocal = true;
JITDUMP(" %u", lclNum);
goto LOC_ST;
@@ -9967,7 +9960,8 @@ void Compiler::impImportBlockCode(BasicBlock* block)
case CEE_STLOC_1:
case CEE_STLOC_2:
case CEE_STLOC_3:
- lclNum = (opcode - CEE_STLOC_0);
+ isLocal = true;
+ lclNum = (opcode - CEE_STLOC_0);
assert(lclNum >= 0 && lclNum < 4);
LOC_ST:
@@ -10068,6 +10062,23 @@ void Compiler::impImportBlockCode(BasicBlock* block)
}
}
+ // If this is a local and the local is a ref type, see
+ // if we can improve type information based on the
+ // value being assigned.
+ if (isLocal && (lclTyp == TYP_REF))
+ {
+ // We should have seen a stloc in our IL prescan.
+ assert(lvaTable[lclNum].lvHasILStoreOp);
+
+ const bool isSingleILStoreLocal =
+ !lvaTable[lclNum].lvHasMultipleILStoreOp && !lvaTable[lclNum].lvHasLdAddrOp;
+
+ if (isSingleILStoreLocal)
+ {
+ lvaUpdateClass(lclNum, op1, clsHnd);
+ }
+ }
+
/* Filter out simple assignments to itself */
if (op1->gtOper == GT_LCL_VAR && lclNum == op1->gtLclVarCommon.gtLclNum)
@@ -11941,6 +11952,12 @@ void Compiler::impImportBlockCode(BasicBlock* block)
impAssignTempGen(tmpNum, op1, tiRetVal.GetClassHandle(), (unsigned)CHECK_SPILL_ALL);
var_types type = genActualType(lvaTable[tmpNum].TypeGet());
op1 = gtNewLclvNode(tmpNum, type);
+
+ // Propagate type info to the temp
+ if (type == TYP_REF)
+ {
+ lvaSetClass(tmpNum, op1, tiRetVal.GetClassHandle());
+ }
}
op1 = impCloneExpr(op1, &op2, tiRetVal.GetClassHandle(), (unsigned)CHECK_SPILL_ALL,
@@ -12430,11 +12447,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
/* NEWOBJ does not respond to CONSTRAINED */
prefixFlags &= ~PREFIX_CONSTRAINED;
-#if COR_JIT_EE_VERSION > 460
_impResolveToken(CORINFO_TOKENKIND_NewObj);
-#else
- _impResolveToken(CORINFO_TOKENKIND_Method);
-#endif
eeGetCallInfo(&resolvedToken, nullptr /* constraint typeRef*/,
addVerifyFlag(combine(CORINFO_CALLINFO_SECURITYCHECKS, CORINFO_CALLINFO_ALLOWINSTPARAM)),
@@ -12533,10 +12546,6 @@ void Compiler::impImportBlockCode(BasicBlock* block)
/* get a temporary for the new object */
lclNum = lvaGrabTemp(true DEBUGARG("NewObj constructor temp"));
- // Note the class handle...
- lvaTable[lclNum].lvClassHnd = resolvedToken.hClass;
- lvaTable[lclNum].lvClassIsExact = 1;
-
// In the value class case we only need clsHnd for size calcs.
//
// The lookup of the code pointer will be handled by CALL in this case
@@ -12642,6 +12651,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
// without exhaustive walk over all expressions.
impAssignTempGen(lclNum, op1, (unsigned)CHECK_SPILL_NONE);
+ lvaSetClass(lclNum, resolvedToken.hClass, true /* is Exact */);
newObjThisPtr = gtNewLclvNode(lclNum, TYP_REF);
}
@@ -12827,14 +12837,6 @@ void Compiler::impImportBlockCode(BasicBlock* block)
assert(verCheckDelegateCreation(delegateCreateStart, codeAddr - 1, delegateMethodRef));
}
#endif
-
-#ifdef FEATURE_CORECLR
- // In coreclr the delegate transparency rule needs to be enforced even if verification is disabled
- typeInfo tiActualFtn = impStackTop(0).seTypeInfo;
- CORINFO_METHOD_HANDLE delegateMethodHandle = tiActualFtn.GetMethod2();
-
- impInsertCalloutForDelegate(info.compMethodHnd, delegateMethodHandle, resolvedToken.hClass);
-#endif // FEATURE_CORECLR
}
callTyp = impImportCall(opcode, &resolvedToken, constraintCall ? &constrainedResolvedToken : nullptr,
@@ -12921,9 +12923,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
return;
case CORINFO_FIELD_STATIC_GENERICS_STATIC_HELPER:
-#if COR_JIT_EE_VERSION > 460
case CORINFO_FIELD_STATIC_READYTORUN_HELPER:
-#endif
/* We may be able to inline the field accessors in specific instantiations of generic
* methods */
compInlineResult->NoteFatal(InlineObservation::CALLSITE_LDFLD_NEEDS_HELPER);
@@ -13154,9 +13154,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
case CORINFO_FIELD_STATIC_RVA_ADDRESS:
case CORINFO_FIELD_STATIC_SHARED_STATIC_HELPER:
case CORINFO_FIELD_STATIC_GENERICS_STATIC_HELPER:
-#if COR_JIT_EE_VERSION > 460
case CORINFO_FIELD_STATIC_READYTORUN_HELPER:
-#endif
op1 = impImportStaticFieldAccess(&resolvedToken, (CORINFO_ACCESS_FLAGS)aflags, &fieldInfo,
lclTyp);
break;
@@ -13180,19 +13178,17 @@ void Compiler::impImportBlockCode(BasicBlock* block)
}
break;
-#if COR_JIT_EE_VERSION > 460
case CORINFO_FIELD_INTRINSIC_ISLITTLEENDIAN:
{
assert(aflags & CORINFO_ACCESS_GET);
#if BIGENDIAN
op1 = gtNewIconNode(0, lclTyp);
#else
- op1 = gtNewIconNode(1, lclTyp);
+ op1 = gtNewIconNode(1, lclTyp);
#endif
goto FIELD_DONE;
}
break;
-#endif
default:
assert(!"Unexpected fieldAccessor");
@@ -13314,10 +13310,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
return;
case CORINFO_FIELD_STATIC_GENERICS_STATIC_HELPER:
-#if COR_JIT_EE_VERSION > 460
case CORINFO_FIELD_STATIC_READYTORUN_HELPER:
-#endif
-
/* We may be able to inline the field accessors in specific instantiations of generic
* methods */
compInlineResult->NoteFatal(InlineObservation::CALLSITE_STFLD_NEEDS_HELPER);
@@ -13436,9 +13429,7 @@ void Compiler::impImportBlockCode(BasicBlock* block)
case CORINFO_FIELD_STATIC_RVA_ADDRESS:
case CORINFO_FIELD_STATIC_SHARED_STATIC_HELPER:
case CORINFO_FIELD_STATIC_GENERICS_STATIC_HELPER:
-#if COR_JIT_EE_VERSION > 460
case CORINFO_FIELD_STATIC_READYTORUN_HELPER:
-#endif
op1 = impImportStaticFieldAccess(&resolvedToken, (CORINFO_ACCESS_FLAGS)aflags, &fieldInfo,
lclTyp);
break;
@@ -13614,9 +13605,10 @@ void Compiler::impImportBlockCode(BasicBlock* block)
Verify(elemTypeHnd == nullptr ||
!(info.compCompHnd->getClassAttribs(elemTypeHnd) & CORINFO_FLG_CONTAINS_STACK_PTR),
"array of byref-like type");
- tiRetVal = verMakeTypeInfo(resolvedToken.hClass);
}
+ tiRetVal = verMakeTypeInfo(resolvedToken.hClass);
+
accessAllowedResult =
info.compCompHnd->canAccessClass(&resolvedToken, info.compMethodHnd, &calloutHelper);
impHandleAccessAllowed(accessAllowedResult, &calloutHelper);
@@ -16930,7 +16922,7 @@ void Compiler::impMakeDiscretionaryInlineObservations(InlineInfo* pInlineInfo, I
{
frequency = InlineCallsiteFrequency::LOOP;
}
- else if ((pInlineInfo->iciBlock->bbFlags & BBF_PROF_WEIGHT) && (pInlineInfo->iciBlock->bbWeight > BB_ZERO_WEIGHT))
+ else if (pInlineInfo->iciBlock->hasProfileWeight() && (pInlineInfo->iciBlock->bbWeight > BB_ZERO_WEIGHT))
{
frequency = InlineCallsiteFrequency::WARM;
}
@@ -17733,9 +17725,19 @@ unsigned Compiler::impInlineFetchLocal(unsigned lclNum DEBUGARG(const char* reas
impInlineInfo->lclTmpNum[lclNum] = tmpNum = lvaGrabTemp(false DEBUGARG(reason));
// Copy over key info
- lvaTable[tmpNum].lvType = lclTyp;
- lvaTable[tmpNum].lvHasLdAddrOp = inlineeLocal.lclHasLdlocaOp;
- lvaTable[tmpNum].lvPinned = inlineeLocal.lclIsPinned;
+ lvaTable[tmpNum].lvType = lclTyp;
+ lvaTable[tmpNum].lvHasLdAddrOp = inlineeLocal.lclHasLdlocaOp;
+ lvaTable[tmpNum].lvPinned = inlineeLocal.lclIsPinned;
+ lvaTable[tmpNum].lvHasILStoreOp = inlineeLocal.lclHasStlocOp;
+ lvaTable[tmpNum].lvHasMultipleILStoreOp = inlineeLocal.lclHasMultipleStlocOp;
+
+ // Copy over class handle for ref types. Note this may be a
+ // shared type -- someday perhaps we can get the exact
+ // signature and pass in a more precise type.
+ if (lclTyp == TYP_REF)
+ {
+ lvaSetClass(tmpNum, inlineeLocal.lclVerTypeInfo.GetClassHandleForObjRef());
+ }
if (inlineeLocal.lclVerTypeInfo.IsStruct())
{
@@ -17770,53 +17772,89 @@ unsigned Compiler::impInlineFetchLocal(unsigned lclNum DEBUGARG(const char* reas
return tmpNum;
}
-// A method used to return the GenTree (usually a GT_LCL_VAR) representing the arguments of the inlined method.
-// Only use this method for the arguments of the inlinee method.
-// !!! Do not use it for the locals of the inlinee method. !!!!
+//------------------------------------------------------------------------
+// impInlineFetchArg: return tree node for argument value in an inlinee
+//
+// Arguments:
+// lclNum -- argument number in inlinee IL
+// inlArgInfo -- argument info for inlinee
+// lclVarInfo -- var info for inlinee
+//
+// Returns:
+// Tree for the argument's value. Often an inlinee-scoped temp
+// GT_LCL_VAR but can be other tree kinds, if the argument
+// expression from the caller can be directly substituted into the
+// inlinee body.
+//
+// Notes:
+// Must be used only for arguments -- use impInlineFetchLocal for
+// inlinee locals.
+//
+// Direct substitution is performed when the formal argument cannot
+// change value in the inlinee body (no starg or ldarga), and the
+// actual argument expression's value cannot be changed if it is
+// substituted it into the inlinee body.
+//
+// Even if an inlinee-scoped temp is returned here, it may later be
+// "bashed" to a caller-supplied tree when arguments are actually
+// passed (see fgInlinePrependStatements). Bashing can happen if
+// the argument ends up being single use and other conditions are
+// met. So the contents of the tree returned here may not end up
+// being the ones ultimately used for the argument.
+//
+// This method will side effect inlArgInfo. It should only be called
+// for actual uses of the argument in the inlinee.
GenTreePtr Compiler::impInlineFetchArg(unsigned lclNum, InlArgInfo* inlArgInfo, InlLclVarInfo* lclVarInfo)
{
- /* Get the argument type */
- var_types lclTyp = lclVarInfo[lclNum].lclTypeInfo;
-
- GenTreePtr op1 = nullptr;
+ // Cache the relevant arg and lcl info for this argument.
+ // We will modify argInfo but not lclVarInfo.
+ InlArgInfo& argInfo = inlArgInfo[lclNum];
+ const InlLclVarInfo& lclInfo = lclVarInfo[lclNum];
+ const bool argCanBeModified = argInfo.argHasLdargaOp || argInfo.argHasStargOp;
+ const var_types lclTyp = lclInfo.lclTypeInfo;
+ GenTreePtr op1 = nullptr;
- // constant or address of local
- if (inlArgInfo[lclNum].argIsInvariant && !inlArgInfo[lclNum].argHasLdargaOp && !inlArgInfo[lclNum].argHasStargOp)
+ if (argInfo.argIsInvariant && !argCanBeModified)
{
- /* Clone the constant. Note that we cannot directly use argNode
- in the trees even if inlArgInfo[lclNum].argIsUsed==false as this
- would introduce aliasing between inlArgInfo[].argNode and
- impInlineExpr. Then gtFoldExpr() could change it, causing further
- references to the argument working off of the bashed copy. */
-
- op1 = gtCloneExpr(inlArgInfo[lclNum].argNode);
+ // Directly substitute constants or addresses of locals
+ //
+ // Clone the constant. Note that we cannot directly use
+ // argNode in the trees even if !argInfo.argIsUsed as this
+ // would introduce aliasing between inlArgInfo[].argNode and
+ // impInlineExpr. Then gtFoldExpr() could change it, causing
+ // further references to the argument working off of the
+ // bashed copy.
+ op1 = gtCloneExpr(argInfo.argNode);
PREFIX_ASSUME(op1 != nullptr);
- inlArgInfo[lclNum].argTmpNum = (unsigned)-1; // illegal temp
+ argInfo.argTmpNum = BAD_VAR_NUM;
}
- else if (inlArgInfo[lclNum].argIsLclVar && !inlArgInfo[lclNum].argHasLdargaOp && !inlArgInfo[lclNum].argHasStargOp)
+ else if (argInfo.argIsLclVar && !argCanBeModified)
{
- /* Argument is a local variable (of the caller)
- * Can we re-use the passed argument node? */
-
- op1 = inlArgInfo[lclNum].argNode;
- inlArgInfo[lclNum].argTmpNum = op1->gtLclVarCommon.gtLclNum;
+ // Directly substitute caller locals
+ //
+ // Use the caller-supplied node if this is the first use.
+ op1 = argInfo.argNode;
+ argInfo.argTmpNum = op1->gtLclVarCommon.gtLclNum;
- if (inlArgInfo[lclNum].argIsUsed)
+ // Use an equivalent copy if this is the second or subsequent use.
+ if (argInfo.argIsUsed)
{
assert(op1->gtOper == GT_LCL_VAR);
assert(lclNum == op1->gtLclVar.gtLclILoffs);
+ var_types newTyp = lclTyp;
+
if (!lvaTable[op1->gtLclVarCommon.gtLclNum].lvNormalizeOnLoad())
{
- lclTyp = genActualType(lclTyp);
+ newTyp = genActualType(lclTyp);
}
- /* Create a new lcl var node - remember the argument lclNum */
- op1 = gtNewLclvNode(op1->gtLclVarCommon.gtLclNum, lclTyp, op1->gtLclVar.gtLclILoffs);
+ // Create a new lcl var node - remember the argument lclNum
+ op1 = gtNewLclvNode(op1->gtLclVarCommon.gtLclNum, newTyp, op1->gtLclVar.gtLclILoffs);
}
}
- else if (inlArgInfo[lclNum].argIsByRefToStructLocal && !inlArgInfo[lclNum].argHasStargOp)
+ else if (argInfo.argIsByRefToStructLocal && !argInfo.argHasStargOp)
{
/* Argument is a by-ref address to a struct, a normed struct, or its field.
In these cases, don't spill the byref to a local, simply clone the tree and use it.
@@ -17835,59 +17873,65 @@ GenTreePtr Compiler::impInlineFetchArg(unsigned lclNum, InlArgInfo* inlArgInfo,
then we change the argument tree (of "ldloca.s V_1") to TYP_I_IMPL to match the callee signature. We'll
soon afterwards reject the inlining anyway, since the tree we return isn't a GT_LCL_VAR.
*/
- assert(inlArgInfo[lclNum].argNode->TypeGet() == TYP_BYREF ||
- inlArgInfo[lclNum].argNode->TypeGet() == TYP_I_IMPL);
- op1 = gtCloneExpr(inlArgInfo[lclNum].argNode);
+ assert(argInfo.argNode->TypeGet() == TYP_BYREF || argInfo.argNode->TypeGet() == TYP_I_IMPL);
+ op1 = gtCloneExpr(argInfo.argNode);
}
else
{
/* Argument is a complex expression - it must be evaluated into a temp */
- if (inlArgInfo[lclNum].argHasTmp)
+ if (argInfo.argHasTmp)
{
- assert(inlArgInfo[lclNum].argIsUsed);
- assert(inlArgInfo[lclNum].argTmpNum < lvaCount);
+ assert(argInfo.argIsUsed);
+ assert(argInfo.argTmpNum < lvaCount);
/* Create a new lcl var node - remember the argument lclNum */
- op1 = gtNewLclvNode(inlArgInfo[lclNum].argTmpNum, genActualType(lclTyp));
+ op1 = gtNewLclvNode(argInfo.argTmpNum, genActualType(lclTyp));
/* This is the second or later use of the this argument,
so we have to use the temp (instead of the actual arg) */
- inlArgInfo[lclNum].argBashTmpNode = nullptr;
+ argInfo.argBashTmpNode = nullptr;
}
else
{
/* First time use */
- assert(inlArgInfo[lclNum].argIsUsed == false);
+ assert(!argInfo.argIsUsed);
/* Reserve a temp for the expression.
* Use a large size node as we may change it later */
- unsigned tmpNum = lvaGrabTemp(true DEBUGARG("Inlining Arg"));
+ const unsigned tmpNum = lvaGrabTemp(true DEBUGARG("Inlining Arg"));
lvaTable[tmpNum].lvType = lclTyp;
+
+ // Copy over class handle for ref types. Note this may be
+ // further improved if it is a shared type and we know the exact context.
+ if (lclTyp == TYP_REF)
+ {
+ lvaSetClass(tmpNum, lclInfo.lclVerTypeInfo.GetClassHandleForObjRef());
+ }
+
assert(lvaTable[tmpNum].lvAddrExposed == 0);
- if (inlArgInfo[lclNum].argHasLdargaOp)
+ if (argInfo.argHasLdargaOp)
{
lvaTable[tmpNum].lvHasLdAddrOp = 1;
}
- if (lclVarInfo[lclNum].lclVerTypeInfo.IsStruct())
+ if (lclInfo.lclVerTypeInfo.IsStruct())
{
if (varTypeIsStruct(lclTyp))
{
- lvaSetStruct(tmpNum, impInlineInfo->lclVarInfo[lclNum].lclVerTypeInfo.GetClassHandle(),
- true /* unsafe value cls check */);
+ lvaSetStruct(tmpNum, lclInfo.lclVerTypeInfo.GetClassHandle(), true /* unsafe value cls check */);
}
else
{
// This is a wrapped primitive. Make sure the verstate knows that
- lvaTable[tmpNum].lvVerTypeInfo = impInlineInfo->lclVarInfo[lclNum].lclVerTypeInfo;
+ lvaTable[tmpNum].lvVerTypeInfo = lclInfo.lclVerTypeInfo;
}
}
- inlArgInfo[lclNum].argHasTmp = true;
- inlArgInfo[lclNum].argTmpNum = tmpNum;
+ argInfo.argHasTmp = true;
+ argInfo.argTmpNum = tmpNum;
// If we require strict exception order, then arguments must
// be evaluated in sequence before the body of the inlined method.
@@ -17898,7 +17942,7 @@ GenTreePtr Compiler::impInlineFetchArg(unsigned lclNum, InlArgInfo* inlArgInfo,
// TODO-1stClassStructs: We currently do not reuse an existing lclVar
// if it is a struct, because it requires some additional handling.
- if (!varTypeIsStruct(lclTyp) && (!inlArgInfo[lclNum].argHasSideEff) && (!inlArgInfo[lclNum].argHasGlobRef))
+ if (!varTypeIsStruct(lclTyp) && !argInfo.argHasSideEff && !argInfo.argHasGlobRef)
{
/* Get a *LARGE* LCL_VAR node */
op1 = gtNewLclLNode(tmpNum, genActualType(lclTyp), lclNum);
@@ -17907,21 +17951,20 @@ GenTreePtr Compiler::impInlineFetchArg(unsigned lclNum, InlArgInfo* inlArgInfo,
If there are no further uses of the arg, we may be
able to use the actual arg node instead of the temp.
If we do see any further uses, we will clear this. */
- inlArgInfo[lclNum].argBashTmpNode = op1;
+ argInfo.argBashTmpNode = op1;
}
else
{
/* Get a small LCL_VAR node */
op1 = gtNewLclvNode(tmpNum, genActualType(lclTyp));
/* No bashing of this argument */
- inlArgInfo[lclNum].argBashTmpNode = nullptr;
+ argInfo.argBashTmpNode = nullptr;
}
}
}
- /* Mark the argument as used */
-
- inlArgInfo[lclNum].argIsUsed = true;
+ // Mark this argument as used.
+ argInfo.argIsUsed = true;
return op1;
}
@@ -18363,9 +18406,7 @@ bool Compiler::IsMathIntrinsic(GenTreePtr tree)
// can enable further devirtualization. We currently reinvoke this
// code after inlining, if the return value of the inlined call is
// the 'this obj' of a subsequent virtual call.
-
-#if COR_JIT_EE_VERSION > 460
-
+//
void Compiler::impDevirtualizeCall(GenTreeCall* call,
GenTreePtr thisObj,
CORINFO_CALL_INFO* callInfo,
@@ -18447,6 +18488,18 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call,
CORINFO_CLASS_HANDLE baseClass = info.compCompHnd->getMethodClass(baseMethod);
const DWORD baseClassAttribs = info.compCompHnd->getClassAttribs(baseClass);
+#if !defined(FEATURE_CORECLR)
+ // If base class is not beforefieldinit then devirtualizing may
+ // cause us to miss a base class init trigger. Spec says we don't
+ // need a trigger for ref class callvirts but desktop seems to
+ // have one anyways. So defer.
+ if ((baseClassAttribs & CORINFO_FLG_BEFOREFIELDINIT) == 0)
+ {
+ JITDUMP("\nimpDevirtualizeCall: base class has precise initialization, sorry\n");
+ return;
+ }
+#endif // FEATURE_CORECLR
+
// Is the call an interface call?
const bool isInterface = (baseClassAttribs & CORINFO_FLG_INTERFACE) != 0;
@@ -18488,16 +18541,15 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call,
return;
}
- // Bail (for now) if base class is an interface.
if (isInterface)
{
assert(call->IsVirtualStub());
- JITDUMP("--- base class is interface, sorry\n");
- return;
+ JITDUMP("--- base class is interface\n");
}
// Fetch the method that would be called based on the declared type of 'this'
- CORINFO_METHOD_HANDLE derivedMethod = info.compCompHnd->resolveVirtualMethod(baseMethod, objClass);
+ CORINFO_CONTEXT_HANDLE ownerType = callInfo->contextHandle;
+ CORINFO_METHOD_HANDLE derivedMethod = info.compCompHnd->resolveVirtualMethod(baseMethod, objClass, ownerType);
// If we failed to get a handle, we can't devirtualize. This can
// happen when prejitting, if the devirtualization crosses
@@ -18553,7 +18605,14 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call,
// the time of jitting, objClass has no subclasses that
// override this method), then perhaps we'd be willing to
// make a bet...?
- JITDUMP(" Class NOT final or exact, no devirtualization\n");
+ JITDUMP(" Class not final or exact, method not final, no devirtualization\n");
+ return;
+ }
+
+ // For interface calls we must have an exact type or final class.
+ if (isInterface && !isExact && !objClassIsFinal)
+ {
+ JITDUMP(" Class not final or exact for interface, no devirtualization\n");
return;
}
@@ -18637,16 +18696,3 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call,
}
#endif // defined(DEBUG)
}
-
-#else
-
-// Stubbed out implementation for 4.6 compatjit
-void Compiler::impDevirtualizeCall(GenTreeCall* call,
- GenTreePtr thisObj,
- CORINFO_CALL_INFO* callInfo,
- CORINFO_CONTEXT_HANDLE* exactContextHandle)
-{
- return;
-}
-
-#endif // COR_JIT_EE_VERSION > 460
diff --git a/src/jit/inline.h b/src/jit/inline.h
index bf4d8046b6..ee07130676 100644
--- a/src/jit/inline.h
+++ b/src/jit/inline.h
@@ -514,31 +514,32 @@ struct InlineCandidateInfo
struct InlArgInfo
{
- unsigned argIsUsed : 1; // is this arg used at all?
- unsigned argIsInvariant : 1; // the argument is a constant or a local variable address
- unsigned argIsLclVar : 1; // the argument is a local variable
- unsigned argIsThis : 1; // the argument is the 'this' pointer
- unsigned argHasSideEff : 1; // the argument has side effects
- unsigned argHasGlobRef : 1; // the argument has a global ref
- unsigned argHasTmp : 1; // the argument will be evaluated to a temp
- unsigned argIsByRefToStructLocal : 1; // Is this arg an address of a struct local or a normed struct local or a
- // field in them?
- unsigned argHasLdargaOp : 1; // Is there LDARGA(s) operation on this argument?
- unsigned argHasStargOp : 1; // Is there STARG(s) operation on this argument?
-
- unsigned argTmpNum; // the argument tmp number
- GenTreePtr argNode;
- GenTreePtr argBashTmpNode; // tmp node created, if it may be replaced with actual arg
+ GenTreePtr argNode; // caller node for this argument
+ GenTreePtr argBashTmpNode; // tmp node created, if it may be replaced with actual arg
+ unsigned argTmpNum; // the argument tmp number
+ unsigned argIsUsed : 1; // is this arg used at all?
+ unsigned argIsInvariant : 1; // the argument is a constant or a local variable address
+ unsigned argIsLclVar : 1; // the argument is a local variable
+ unsigned argIsThis : 1; // the argument is the 'this' pointer
+ unsigned argHasSideEff : 1; // the argument has side effects
+ unsigned argHasGlobRef : 1; // the argument has a global ref
+ unsigned argHasTmp : 1; // the argument will be evaluated to a temp
+ unsigned argHasLdargaOp : 1; // Is there LDARGA(s) operation on this argument?
+ unsigned argHasStargOp : 1; // Is there STARG(s) operation on this argument?
+ unsigned argIsByRefToStructLocal : 1; // Is this arg an address of a struct local or a normed struct local or a
+ // field in them?
};
-// InlArgInfo describes inline candidate local variable properties.
+// InlLclVarInfo describes inline candidate argument and local variable properties.
struct InlLclVarInfo
{
- var_types lclTypeInfo;
typeInfo lclVerTypeInfo;
- bool lclHasLdlocaOp; // Is there LDLOCA(s) operation on this argument?
- bool lclIsPinned;
+ var_types lclTypeInfo;
+ unsigned lclHasLdlocaOp : 1; // Is there LDLOCA(s) operation on this local?
+ unsigned lclHasStlocOp : 1; // Is there a STLOC on this local?
+ unsigned lclHasMultipleStlocOp : 1; // Is there more than one STLOC on this local
+ unsigned lclIsPinned : 1;
};
// InlineInfo provides detailed information about a particular inline candidate.
diff --git a/src/jit/jit.h b/src/jit/jit.h
index 916b6802d7..cec24a9b3f 100644
--- a/src/jit/jit.h
+++ b/src/jit/jit.h
@@ -248,23 +248,6 @@
#define __PLACEMENT_NEW_INLINE // don't bring in the global placement new, it is easy to make a mistake
// with our new(compiler*) pattern.
-#if COR_JIT_EE_VER > 460
-#define NO_CLRCONFIG // Don't bring in the usual CLRConfig infrastructure, since the JIT uses the JIT/EE
- // interface to retrieve config values.
-
-// This is needed for contract.inl when FEATURE_STACK_PROBE is enabled.
-struct CLRConfig
-{
- static struct ConfigKey
- {
- } EXTERNAL_NO_SO_NOT_MAINLINE;
- static DWORD GetConfigValue(const ConfigKey& key)
- {
- return 0;
- }
-};
-#endif
-
#include "utilcode.h" // this defines assert as _ASSERTE
#include "host.h" // this redefines assert for the JIT to use assertAbort
#include "utils.h"
diff --git a/src/jit/jitee.h b/src/jit/jitee.h
index f9bd83f5bb..7b0e4a02dc 100644
--- a/src/jit/jitee.h
+++ b/src/jit/jitee.h
@@ -78,6 +78,8 @@ public:
JIT_FLAG_USE_PINVOKE_HELPERS = 36, // The JIT should use the PINVOKE_{BEGIN,END} helpers instead of emitting inline transitions
JIT_FLAG_REVERSE_PINVOKE = 37, // The JIT should insert REVERSE_PINVOKE_{ENTER,EXIT} helpers into method prolog/epilog
JIT_FLAG_DESKTOP_QUIRKS = 38, // The JIT should generate desktop-quirk-compatible code
+ JIT_FLAG_TIER0 = 39, // This is the initial tier for tiered compilation which should generate code as quickly as possible
+ JIT_FLAG_TIER1 = 40, // This is the final tier (for now) for tiered compilation which should generate high quality code
};
// clang-format on
@@ -127,72 +129,6 @@ public:
return m_jitFlags == 0;
}
-#if COR_JIT_EE_VERSION <= 460
-
- void SetFromOldFlags(unsigned corJitFlags, unsigned corJitFlags2)
- {
- Reset();
-
-#define CONVERT_OLD_FLAG(oldf, newf) \
- if ((corJitFlags & (oldf)) != 0) \
- this->Set(JitFlags::newf);
-#define CONVERT_OLD_FLAG2(oldf, newf) \
- if ((corJitFlags2 & (oldf)) != 0) \
- this->Set(JitFlags::newf);
-
- CONVERT_OLD_FLAG(CORJIT_FLG_SPEED_OPT, JIT_FLAG_SPEED_OPT)
- CONVERT_OLD_FLAG(CORJIT_FLG_SIZE_OPT, JIT_FLAG_SIZE_OPT)
- CONVERT_OLD_FLAG(CORJIT_FLG_DEBUG_CODE, JIT_FLAG_DEBUG_CODE)
- CONVERT_OLD_FLAG(CORJIT_FLG_DEBUG_EnC, JIT_FLAG_DEBUG_EnC)
- CONVERT_OLD_FLAG(CORJIT_FLG_DEBUG_INFO, JIT_FLAG_DEBUG_INFO)
- CONVERT_OLD_FLAG(CORJIT_FLG_MIN_OPT, JIT_FLAG_MIN_OPT)
- CONVERT_OLD_FLAG(CORJIT_FLG_GCPOLL_CALLS, JIT_FLAG_GCPOLL_CALLS)
- CONVERT_OLD_FLAG(CORJIT_FLG_MCJIT_BACKGROUND, JIT_FLAG_MCJIT_BACKGROUND)
-
-#if defined(_TARGET_X86_)
-
- CONVERT_OLD_FLAG(CORJIT_FLG_PINVOKE_RESTORE_ESP, JIT_FLAG_PINVOKE_RESTORE_ESP)
- CONVERT_OLD_FLAG(CORJIT_FLG_TARGET_P4, JIT_FLAG_TARGET_P4)
- CONVERT_OLD_FLAG(CORJIT_FLG_USE_FCOMI, JIT_FLAG_USE_FCOMI)
- CONVERT_OLD_FLAG(CORJIT_FLG_USE_CMOV, JIT_FLAG_USE_CMOV)
- CONVERT_OLD_FLAG(CORJIT_FLG_USE_SSE2, JIT_FLAG_USE_SSE2)
-
-#elif defined(_TARGET_AMD64_)
-
- CONVERT_OLD_FLAG(CORJIT_FLG_USE_SSE3_4, JIT_FLAG_USE_SSE3_4)
- CONVERT_OLD_FLAG(CORJIT_FLG_USE_AVX, JIT_FLAG_USE_AVX)
- CONVERT_OLD_FLAG(CORJIT_FLG_USE_AVX2, JIT_FLAG_USE_AVX2)
- CONVERT_OLD_FLAG(CORJIT_FLG_USE_AVX_512, JIT_FLAG_USE_AVX_512)
- CONVERT_OLD_FLAG(CORJIT_FLG_FEATURE_SIMD, JIT_FLAG_FEATURE_SIMD)
-
-#endif // !defined(_TARGET_X86_) && !defined(_TARGET_AMD64_)
-
- CONVERT_OLD_FLAG(CORJIT_FLG_MAKEFINALCODE, JIT_FLAG_MAKEFINALCODE)
- CONVERT_OLD_FLAG(CORJIT_FLG_READYTORUN, JIT_FLAG_READYTORUN)
- CONVERT_OLD_FLAG(CORJIT_FLG_PROF_ENTERLEAVE, JIT_FLAG_PROF_ENTERLEAVE)
- CONVERT_OLD_FLAG(CORJIT_FLG_PROF_REJIT_NOPS, JIT_FLAG_PROF_REJIT_NOPS)
- CONVERT_OLD_FLAG(CORJIT_FLG_PROF_NO_PINVOKE_INLINE, JIT_FLAG_PROF_NO_PINVOKE_INLINE)
- CONVERT_OLD_FLAG(CORJIT_FLG_SKIP_VERIFICATION, JIT_FLAG_SKIP_VERIFICATION)
- CONVERT_OLD_FLAG(CORJIT_FLG_PREJIT, JIT_FLAG_PREJIT)
- CONVERT_OLD_FLAG(CORJIT_FLG_RELOC, JIT_FLAG_RELOC)
- CONVERT_OLD_FLAG(CORJIT_FLG_IMPORT_ONLY, JIT_FLAG_IMPORT_ONLY)
- CONVERT_OLD_FLAG(CORJIT_FLG_IL_STUB, JIT_FLAG_IL_STUB)
- CONVERT_OLD_FLAG(CORJIT_FLG_PROCSPLIT, JIT_FLAG_PROCSPLIT)
- CONVERT_OLD_FLAG(CORJIT_FLG_BBINSTR, JIT_FLAG_BBINSTR)
- CONVERT_OLD_FLAG(CORJIT_FLG_BBOPT, JIT_FLAG_BBOPT)
- CONVERT_OLD_FLAG(CORJIT_FLG_FRAMED, JIT_FLAG_FRAMED)
- CONVERT_OLD_FLAG(CORJIT_FLG_ALIGN_LOOPS, JIT_FLAG_ALIGN_LOOPS)
- CONVERT_OLD_FLAG(CORJIT_FLG_PUBLISH_SECRET_PARAM, JIT_FLAG_PUBLISH_SECRET_PARAM)
- CONVERT_OLD_FLAG(CORJIT_FLG_GCPOLL_INLINE, JIT_FLAG_GCPOLL_INLINE)
-
- CONVERT_OLD_FLAG2(CORJIT_FLG2_SAMPLING_JIT_BACKGROUND, JIT_FLAG_SAMPLING_JIT_BACKGROUND)
-
-#undef CONVERT_OLD_FLAG
-#undef CONVERT_OLD_FLAG2
- }
-
-#else // COR_JIT_EE_VERSION > 460
-
void SetFromFlags(CORJIT_FLAGS flags)
{
// We don't want to have to check every one, so we assume it is exactly the same values as the JitFlag
@@ -253,12 +189,12 @@ public:
FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_USE_PINVOKE_HELPERS, JIT_FLAG_USE_PINVOKE_HELPERS);
FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_REVERSE_PINVOKE, JIT_FLAG_REVERSE_PINVOKE);
FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_DESKTOP_QUIRKS, JIT_FLAG_DESKTOP_QUIRKS);
+ FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_TIER0, JIT_FLAG_TIER0);
+ FLAGS_EQUAL(CORJIT_FLAGS::CORJIT_FLAG_TIER1, JIT_FLAG_TIER1);
#undef FLAGS_EQUAL
}
-#endif // COR_JIT_EE_VERSION > 460
-
private:
unsigned __int64 m_jitFlags;
};
diff --git a/src/jit/jitpch.h b/src/jit/jitpch.h
index 2e69e79208..1fe8f27302 100644
--- a/src/jit/jitpch.h
+++ b/src/jit/jitpch.h
@@ -15,10 +15,6 @@
#include <cstdlib>
#include <intrin.h>
-#if COR_JIT_EE_VERSION <= 460
-#include "corjithost.h"
-#include "jithost.h"
-#endif
#include "jitconfig.h"
#include "jit.h"
#include "iallocator.h"
diff --git a/src/jit/lclvars.cpp b/src/jit/lclvars.cpp
index e0d7d51a09..ab7c15dd35 100644
--- a/src/jit/lclvars.cpp
+++ b/src/jit/lclvars.cpp
@@ -257,7 +257,8 @@ void Compiler::lvaInitTypeRef()
if (strip(corInfoType) == CORINFO_TYPE_CLASS)
{
- varDsc->lvClassHnd = info.compCompHnd->getArgClass(&info.compMethodInfo->locals, localsSig);
+ CORINFO_CLASS_HANDLE clsHnd = info.compCompHnd->getArgClass(&info.compMethodInfo->locals, localsSig);
+ lvaSetClass(varNum, clsHnd);
}
}
@@ -404,6 +405,7 @@ void Compiler::lvaInitThisPtr(InitVarDscInfo* varDscInfo)
else
{
varDsc->lvType = TYP_REF;
+ lvaSetClass(varDscInfo->varNum, info.compClassHnd);
}
if (tiVerificationNeeded)
@@ -420,8 +422,6 @@ void Compiler::lvaInitThisPtr(InitVarDscInfo* varDscInfo)
varDsc->lvVerTypeInfo = typeInfo();
}
- varDsc->lvClassHnd = info.compClassHnd;
-
// Mark the 'this' pointer for the method
varDsc->lvVerTypeInfo.SetIsThisPtr();
@@ -562,7 +562,8 @@ void Compiler::lvaInitUserArgs(InitVarDscInfo* varDscInfo)
if (strip(corInfoType) == CORINFO_TYPE_CLASS)
{
- varDsc->lvClassHnd = info.compCompHnd->getArgClass(&info.compMethodInfo->args, argLst);
+ CORINFO_CLASS_HANDLE clsHnd = info.compCompHnd->getArgClass(&info.compMethodInfo->args, argLst);
+ lvaSetClass(varDscInfo->varNum, clsHnd);
}
// For ARM, ARM64, and AMD64 varargs, all arguments go in integer registers
@@ -676,11 +677,6 @@ void Compiler::lvaInitUserArgs(InitVarDscInfo* varDscInfo)
codeGen->regSet.rsMaskPreSpillRegArg |= regMask;
}
}
- else
- {
- varDsc->lvOnFrame = true; // The final home for this incoming register might be our local stack frame
- }
-
#else // !_TARGET_ARM_
#if defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR structDesc;
@@ -722,13 +718,12 @@ void Compiler::lvaInitUserArgs(InitVarDscInfo* varDscInfo)
}
}
#endif // FEATURE_UNIX_AMD64_STRUCT_PASSING
+#endif // !_TARGET_ARM_
// The final home for this incoming register might be our local stack frame.
// For System V platforms the final home will always be on the local stack frame.
varDsc->lvOnFrame = true;
-#endif // !_TARGET_ARM_
-
bool canPassArgInRegisters = false;
#if defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
@@ -2297,6 +2292,199 @@ void Compiler::lvaSetStruct(unsigned varNum, CORINFO_CLASS_HANDLE typeHnd, bool
}
}
+//------------------------------------------------------------------------
+// lvaSetClass: set class information for a local var.
+//
+// Arguments:
+// varNum -- number of the variable
+// clsHnd -- class handle to use in set or update
+// isExact -- true if class is known exactly
+//
+// Notes:
+// varNum must not already have a ref class handle.
+
+void Compiler::lvaSetClass(unsigned varNum, CORINFO_CLASS_HANDLE clsHnd, bool isExact)
+{
+ noway_assert(varNum < lvaCount);
+
+ // If we are just importing, we cannot reliably track local ref types,
+ // since the jit maps CORINFO_TYPE_VAR to TYP_REF.
+ if (compIsForImportOnly())
+ {
+ return;
+ }
+
+ // Else we should have a type handle.
+ assert(clsHnd != nullptr);
+
+ LclVarDsc* varDsc = &lvaTable[varNum];
+ assert(varDsc->lvType == TYP_REF);
+
+ // We shoud not have any ref type information for this var.
+ assert(varDsc->lvClassHnd == nullptr);
+ assert(!varDsc->lvClassIsExact);
+
+ JITDUMP("\nlvaSetClass: setting class for V%02i to (%p) %s %s\n", varNum, clsHnd,
+ info.compCompHnd->getClassName(clsHnd), isExact ? " [exact]" : "");
+
+ varDsc->lvClassHnd = clsHnd;
+ varDsc->lvClassIsExact = isExact;
+}
+
+//------------------------------------------------------------------------
+// lvaSetClass: set class information for a local var from a tree or stack type
+//
+// Arguments:
+// varNum -- number of the variable. Must be a single def local
+// tree -- tree establishing the variable's value
+// stackHnd -- handle for the type from the evaluation stack
+//
+// Notes:
+// Preferentially uses the tree's type, when available. Since not all
+// tree kinds can track ref types, the stack type is used as a
+// fallback.
+
+void Compiler::lvaSetClass(unsigned varNum, GenTreePtr tree, CORINFO_CLASS_HANDLE stackHnd)
+{
+ bool isExact = false;
+ bool isNonNull = false;
+ CORINFO_CLASS_HANDLE clsHnd = gtGetClassHandle(tree, &isExact, &isNonNull);
+
+ if (clsHnd != nullptr)
+ {
+ lvaSetClass(varNum, clsHnd, isExact);
+ }
+ else if (stackHnd != nullptr)
+ {
+ lvaSetClass(varNum, stackHnd);
+ }
+}
+
+//------------------------------------------------------------------------
+// lvaUpdateClass: update class information for a local var.
+//
+// Arguments:
+// varNum -- number of the variable
+// clsHnd -- class handle to use in set or update
+// isExact -- true if class is known exactly
+//
+// Notes:
+//
+// This method models the type update rule for an assignment.
+//
+// Updates currently should only happen for single-def user args or
+// locals, when we are processing the expression actually being
+// used to initialize the local (or inlined arg). The update will
+// change the local from the declared type to the type of the
+// initial value.
+//
+// These updates should always *improve* what we know about the
+// type, that is making an inexact type exact, or changing a type
+// to some subtype. However the jit lacks precise type information
+// for shared code, so ensuring this is so is currently not
+// possible.
+
+void Compiler::lvaUpdateClass(unsigned varNum, CORINFO_CLASS_HANDLE clsHnd, bool isExact)
+{
+ noway_assert(varNum < lvaCount);
+
+ // If we are just importing, we cannot reliably track local ref types,
+ // since the jit maps CORINFO_TYPE_VAR to TYP_REF.
+ if (compIsForImportOnly())
+ {
+ return;
+ }
+
+ // Else we should have a class handle to consider
+ assert(clsHnd != nullptr);
+
+ LclVarDsc* varDsc = &lvaTable[varNum];
+ assert(varDsc->lvType == TYP_REF);
+
+ // We should already have a class
+ assert(varDsc->lvClassHnd != nullptr);
+
+#if defined(DEBUG)
+
+ // In general we only expect one update per local var. However if
+ // a block is re-imported and that block has the only STLOC for
+ // the var, we may see multiple updates. All subsequent updates
+ // should agree on the type, since reimportation is triggered by
+ // type mismatches for things other than ref types.
+ if (varDsc->lvClassInfoUpdated)
+ {
+ assert(varDsc->lvClassHnd == clsHnd);
+ assert(varDsc->lvClassIsExact == isExact);
+ }
+
+ // This counts as an update, even if nothing changes.
+ varDsc->lvClassInfoUpdated = true;
+
+#endif // defined(DEBUG)
+
+ // If previous type was exact, there is nothing to update. Would
+ // like to verify new type is compatible but can't do this yet.
+ if (varDsc->lvClassIsExact)
+ {
+ return;
+ }
+
+ // Are we updating the type?
+ if (varDsc->lvClassHnd != clsHnd)
+ {
+ JITDUMP("\nlvaUpdateClass: Updating class for V%02i from (%p) %s to (%p) %s %s\n", varNum, varDsc->lvClassHnd,
+ info.compCompHnd->getClassName(varDsc->lvClassHnd), clsHnd, info.compCompHnd->getClassName(clsHnd),
+ isExact ? " [exact]" : "");
+
+ varDsc->lvClassHnd = clsHnd;
+ varDsc->lvClassIsExact = isExact;
+ return;
+ }
+
+ // Class info matched. Are we updating exactness?
+ if (isExact)
+ {
+ JITDUMP("\nlvaUpdateClass: Updating class for V%02i (%p) %s to be exact\n", varNum, varDsc->lvClassHnd,
+ info.compCompHnd->getClassName(varDsc->lvClassHnd));
+
+ varDsc->lvClassIsExact = isExact;
+ return;
+ }
+
+ // Else we have the same handle and (in)exactness as before. Do nothing.
+ return;
+}
+
+//------------------------------------------------------------------------
+// lvaUpdateClass: Uupdate class information for a local var from a tree
+// or stack type
+//
+// Arguments:
+// varNum -- number of the variable. Must be a single def local
+// tree -- tree establishing the variable's value
+// stackHnd -- handle for the type from the evaluation stack
+//
+// Notes:
+// Preferentially uses the tree's type, when available. Since not all
+// tree kinds can track ref types, the stack type is used as a
+// fallback.
+
+void Compiler::lvaUpdateClass(unsigned varNum, GenTreePtr tree, CORINFO_CLASS_HANDLE stackHnd)
+{
+ bool isExact = false;
+ bool isNonNull = false;
+ CORINFO_CLASS_HANDLE clsHnd = gtGetClassHandle(tree, &isExact, &isNonNull);
+
+ if (clsHnd != nullptr)
+ {
+ lvaUpdateClass(varNum, clsHnd, isExact);
+ }
+ else if (stackHnd != nullptr)
+ {
+ lvaUpdateClass(varNum, stackHnd);
+ }
+}
+
/*****************************************************************************
* Returns the array of BYTEs containing the GC layout information
*/
@@ -2394,8 +2582,41 @@ unsigned Compiler::lvaLclExactSize(unsigned varNum)
return genTypeSize(varType);
}
+// getCalledCount -- get the value used to normalized weights for this method
+// if we don't have profile data then getCalledCount will return BB_UNITY_WEIGHT (100)
+// otherwise it returns the number of times that profile data says the method was called.
+//
+BasicBlock::weight_t BasicBlock::getCalledCount(Compiler* comp)
+{
+ // when we don't have profile data then fgCalledCount will be BB_UNITY_WEIGHT (100)
+ BasicBlock::weight_t calledCount = comp->fgCalledCount;
+
+ // If we haven't yet reach the place where we setup fgCalledCount it could still be zero
+ // so return a reasonable value to use until we set it.
+ //
+ if (calledCount == 0)
+ {
+ if (comp->fgIsUsingProfileWeights())
+ {
+ // When we use profile data block counts we have exact counts,
+ // not multiples of BB_UNITY_WEIGHT (100)
+ calledCount = 1;
+ }
+ else
+ {
+ calledCount = comp->fgFirstBB->bbWeight;
+
+ if (calledCount == 0)
+ {
+ calledCount = BB_UNITY_WEIGHT;
+ }
+ }
+ }
+ return calledCount;
+}
+
// getBBWeight -- get the normalized weight of this block
-unsigned BasicBlock::getBBWeight(Compiler* comp)
+BasicBlock::weight_t BasicBlock::getBBWeight(Compiler* comp)
{
if (this->bbWeight == 0)
{
@@ -2403,22 +2624,50 @@ unsigned BasicBlock::getBBWeight(Compiler* comp)
}
else
{
- unsigned calledWeight = comp->fgCalledWeight;
- if (calledWeight == 0)
- {
- calledWeight = comp->fgFirstBB->bbWeight;
- if (calledWeight == 0)
- {
- calledWeight = BB_UNITY_WEIGHT;
- }
- }
+ weight_t calledCount = getCalledCount(comp);
+
+ // Normalize the bbWeights by multiplying by BB_UNITY_WEIGHT and dividing by the calledCount.
+ //
+ // 1. For methods that do not have IBC data the called weight will always be 100 (BB_UNITY_WEIGHT)
+ // and the entry point bbWeight value is almost always 100 (BB_UNITY_WEIGHT)
+ // 2. For methods that do have IBC data the called weight is the actual number of calls
+ // from the IBC data and the entry point bbWeight value is almost always the actual
+ // number of calls from the IBC data.
+ //
+ // "almost always" - except for the rare case where a loop backedge jumps to BB01
+ //
+ // We also perform a rounding operation by adding half of the 'calledCount' before performing
+ // the division.
+ //
+ // Thus for both cases we will return 100 (BB_UNITY_WEIGHT) for the entry point BasicBlock
+ //
+ // Note that with a 100 (BB_UNITY_WEIGHT) values between 1 and 99 represent decimal fractions.
+ // (i.e. 33 represents 33% and 75 represents 75%, and values greater than 100 require
+ // some kind of loop backedge)
+ //
+
if (this->bbWeight < (BB_MAX_WEIGHT / BB_UNITY_WEIGHT))
{
- return max(1, (((this->bbWeight * BB_UNITY_WEIGHT) + (calledWeight / 2)) / calledWeight));
+ // Calculate the result using unsigned arithmetic
+ weight_t result = ((this->bbWeight * BB_UNITY_WEIGHT) + (calledCount / 2)) / calledCount;
+
+ // We don't allow a value of zero, as that would imply rarely run
+ return max(1, result);
}
else
{
- return (unsigned)((((double)this->bbWeight * (double)BB_UNITY_WEIGHT) / (double)calledWeight) + 0.5);
+ // Calculate the full result using floating point
+ double fullResult = ((double)this->bbWeight * (double)BB_UNITY_WEIGHT) / (double)calledCount;
+
+ if (fullResult < (double)BB_MAX_WEIGHT)
+ {
+ // Add 0.5 and truncate to unsigned
+ return (weight_t)(fullResult + 0.5);
+ }
+ else
+ {
+ return BB_MAX_WEIGHT;
+ }
}
}
}
@@ -2699,7 +2948,7 @@ int __cdecl Compiler::RefCntCmp(const void* op1, const void* op2)
}
if (varTypeIsGC(dsc2->TypeGet()))
{
- weight1 += BB_UNITY_WEIGHT / 2;
+ weight2 += BB_UNITY_WEIGHT / 2;
}
if (dsc2->lvRegister)
@@ -6430,6 +6679,14 @@ void Compiler::lvaDumpEntry(unsigned lclNum, FrameLayoutState curState, size_t r
{
printf(" stack-byref");
}
+ if (varDsc->lvClassHnd != nullptr)
+ {
+ printf(" class-hnd");
+ }
+ if (varDsc->lvClassIsExact)
+ {
+ printf(" exact");
+ }
#ifndef _TARGET_64BIT_
if (varDsc->lvStructDoubleAlign)
printf(" double-align");
diff --git a/src/jit/legacynonjit/.gitmirror b/src/jit/legacynonjit/.gitmirror
new file mode 100644
index 0000000000..f507630f94
--- /dev/null
+++ b/src/jit/legacynonjit/.gitmirror
@@ -0,0 +1 @@
+Only contents of this folder, excluding subfolders, will be mirrored by the Git-TFS Mirror. \ No newline at end of file
diff --git a/src/jit/legacynonjit/CMakeLists.txt b/src/jit/legacynonjit/CMakeLists.txt
new file mode 100644
index 0000000000..de66d81e8e
--- /dev/null
+++ b/src/jit/legacynonjit/CMakeLists.txt
@@ -0,0 +1,67 @@
+project(legacynonjit)
+
+add_definitions(-DALT_JIT)
+add_definitions(-DFEATURE_NO_HOST)
+add_definitions(-DSELF_NO_HOST)
+add_definitions(-DFEATURE_READYTORUN_COMPILER)
+remove_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE)
+
+remove_definitions(-DFEATURE_SIMD)
+remove_definitions(-DFEATURE_AVX_SUPPORT)
+
+add_definitions(-DLEGACY_BACKEND)
+
+remove_definitions(-D_TARGET_X86_=1)
+add_definitions(-D_TARGET_ARM_)
+set(JIT_ARCH_ALTJIT_SOURCES ${JIT_ARM_SOURCES})
+
+if(WIN32)
+ add_definitions(-DFX_VER_INTERNALNAME_STR=legacynonjit.dll)
+endif(WIN32)
+
+add_library_clr(legacynonjit
+ SHARED
+ ${SHARED_LIB_SOURCES}
+ ${JIT_ARCH_ALTJIT_SOURCES}
+)
+
+add_dependencies(legacynonjit jit_exports)
+
+set_property(TARGET legacynonjit APPEND_STRING PROPERTY LINK_FLAGS ${JIT_EXPORTS_LINKER_OPTION})
+set_property(TARGET legacynonjit APPEND_STRING PROPERTY LINK_DEPENDS ${JIT_EXPORTS_FILE})
+
+set(RYUJIT_LINK_LIBRARIES
+ utilcodestaticnohost
+ gcinfo
+)
+
+if(CLR_CMAKE_PLATFORM_UNIX)
+ list(APPEND RYUJIT_LINK_LIBRARIES
+ mscorrc_debug
+ coreclrpal
+ palrt
+ )
+else()
+ list(APPEND RYUJIT_LINK_LIBRARIES
+ ${STATIC_MT_CRT_LIB}
+ ${STATIC_MT_VCRT_LIB}
+ kernel32.lib
+ advapi32.lib
+ ole32.lib
+ oleaut32.lib
+ uuid.lib
+ user32.lib
+ version.lib
+ shlwapi.lib
+ bcrypt.lib
+ crypt32.lib
+ RuntimeObject.lib
+ )
+endif(CLR_CMAKE_PLATFORM_UNIX)
+
+target_link_libraries(legacynonjit
+ ${RYUJIT_LINK_LIBRARIES}
+)
+
+# add the install targets
+install_clr(legacynonjit)
diff --git a/src/jit/legacynonjit/legacynonjit.def b/src/jit/legacynonjit/legacynonjit.def
new file mode 100644
index 0000000000..1603af74ca
--- /dev/null
+++ b/src/jit/legacynonjit/legacynonjit.def
@@ -0,0 +1,7 @@
+; 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.
+EXPORTS
+ getJit
+ jitStartup
+ sxsJitStartup
diff --git a/src/jit/liveness.cpp b/src/jit/liveness.cpp
index c6663185e4..47950aee63 100644
--- a/src/jit/liveness.cpp
+++ b/src/jit/liveness.cpp
@@ -1189,9 +1189,7 @@ class LiveVarAnalysis
}
/* Compute the 'm_liveIn' set */
- VarSetOps::Assign(m_compiler, m_liveIn, m_liveOut);
- VarSetOps::DiffD(m_compiler, m_liveIn, block->bbVarDef);
- VarSetOps::UnionD(m_compiler, m_liveIn, block->bbVarUse);
+ VarSetOps::LivenessD(m_compiler, m_liveIn, block->bbVarDef, block->bbVarUse, m_liveOut);
// Even if block->bbMemoryDef is set, we must assume that it doesn't kill memory liveness from m_memoryLiveOut,
// since (without proof otherwise) the use and def may touch different memory at run-time.
@@ -1218,12 +1216,8 @@ class LiveVarAnalysis
noway_assert(block->bbFlags & BBF_INTERNAL);
- liveInChanged =
- !VarSetOps::Equal(m_compiler, VarSetOps::Intersection(m_compiler, block->bbLiveIn, m_liveIn),
- m_liveIn);
- if (liveInChanged ||
- !VarSetOps::Equal(m_compiler, VarSetOps::Intersection(m_compiler, block->bbLiveOut, m_liveOut),
- m_liveOut))
+ liveInChanged = !VarSetOps::IsSubset(m_compiler, m_liveIn, block->bbLiveIn);
+ if (liveInChanged || !VarSetOps::IsSubset(m_compiler, m_liveOut, block->bbLiveOut))
{
#ifdef DEBUG
if (m_compiler->verbose)
@@ -1834,7 +1828,7 @@ VARSET_VALRET_TP Compiler::fgComputeLife(VARSET_VALARG_TP lifeArg,
VARSET_TP VARSET_INIT(this, keepAliveVars, volatileVars);
VarSetOps::UnionD(this, keepAliveVars, compCurBB->bbScope); // Don't kill vars in scope
- noway_assert(VarSetOps::Equal(this, VarSetOps::Intersection(this, keepAliveVars, life), keepAliveVars));
+ noway_assert(VarSetOps::IsSubset(this, keepAliveVars, life));
noway_assert(compCurStmt->gtOper == GT_STMT);
noway_assert(endNode || (startNode == compCurStmt->gtStmt.gtStmtExpr));
@@ -1882,7 +1876,7 @@ VARSET_VALRET_TP Compiler::fgComputeLifeLIR(VARSET_VALARG_TP lifeArg, BasicBlock
VARSET_TP VARSET_INIT(this, keepAliveVars, volatileVars);
VarSetOps::UnionD(this, keepAliveVars, block->bbScope); // Don't kill vars in scope
- noway_assert(VarSetOps::Equal(this, VarSetOps::Intersection(this, keepAliveVars, life), keepAliveVars));
+ noway_assert(VarSetOps::IsSubset(this, keepAliveVars, life));
LIR::Range& blockRange = LIR::AsRange(block);
GenTree* firstNonPhiNode = blockRange.FirstNonPhiNode();
@@ -2997,7 +2991,7 @@ void Compiler::fgInterBlockLocalVarLiveness()
// which may expose more dead stores.
fgLocalVarLivenessChanged = true;
- noway_assert(VarSetOps::Equal(this, VarSetOps::Intersection(this, life, block->bbLiveIn), life));
+ noway_assert(VarSetOps::IsSubset(this, life, block->bbLiveIn));
/* set the new bbLiveIn */
diff --git a/src/jit/lower.cpp b/src/jit/lower.cpp
index 9242c395a3..5aad06a065 100644
--- a/src/jit/lower.cpp
+++ b/src/jit/lower.cpp
@@ -940,23 +940,11 @@ GenTreePtr Lowering::NewPutArg(GenTreeCall* call, GenTreePtr arg, fgArgTabEntryP
// This provides the info to put this argument in in-coming arg area slot
// instead of in out-going arg area slot.
- PUT_STRUCT_ARG_STK_ONLY(assert(info->isStruct == varTypeIsStruct(type))); // Make sure state is
- // correct
+ PUT_STRUCT_ARG_STK_ONLY(assert(info->isStruct == varTypeIsStruct(type))); // Make sure state is correct
-#if FEATURE_FASTTAILCALL
putArg = new (comp, GT_PUTARG_STK)
GenTreePutArgStk(GT_PUTARG_STK, type, arg, info->slotNum PUT_STRUCT_ARG_STK_ONLY_ARG(info->numSlots),
- call->IsFastTailCall() DEBUGARG(call));
-#else
- putArg = new (comp, GT_PUTARG_STK)
- GenTreePutArgStk(GT_PUTARG_STK, type, arg,
- info->slotNum PUT_STRUCT_ARG_STK_ONLY_ARG(info->numSlots) DEBUGARG(call));
-#endif
-
-#if defined(UNIX_X86_ABI)
- assert((info->padStkAlign > 0 && info->numSlots > 0) || (info->padStkAlign == 0));
- putArg->AsPutArgStk()->setArgPadding(info->padStkAlign);
-#endif
+ call->IsFastTailCall(), call);
#ifdef FEATURE_PUT_STRUCT_ARG_STK
// If the ArgTabEntry indicates that this arg is a struct
@@ -2554,7 +2542,7 @@ GenTree* Lowering::LowerDirectCall(GenTreeCall* call)
GenTree* indir = Ind(cellAddr);
#ifdef FEATURE_READYTORUN_COMPILER
-#ifdef _TARGET_ARM64_
+#if defined(_TARGET_ARM64_)
// For arm64, we dispatch code same as VSD using X11 for indirection cell address,
// which ZapIndirectHelperThunk expects.
if (call->IsR2RRelativeIndir())
@@ -2562,6 +2550,11 @@ GenTree* Lowering::LowerDirectCall(GenTreeCall* call)
cellAddr->gtRegNum = REG_R2R_INDIRECT_PARAM;
indir->gtRegNum = REG_JUMP_THUNK_PARAM;
}
+#elif defined(_TARGET_ARM_)
+ if (call->IsR2RRelativeIndir())
+ {
+ cellAddr->gtRegNum = REG_JUMP_THUNK_PARAM;
+ }
#endif
#endif
result = indir;
@@ -2847,6 +2840,9 @@ void Lowering::InsertPInvokeMethodProlog()
JITDUMP("======= Inserting PInvoke method prolog\n");
+ // The first BB must be a scratch BB in order for us to be able to safely insert the P/Invoke prolog.
+ assert(comp->fgFirstBBisScratch());
+
LIR::Range& firstBlockRange = LIR::AsRange(comp->fgFirstBB);
const CORINFO_EE_INFO* pInfo = comp->eeGetEEInfo();
@@ -2881,10 +2877,8 @@ void Lowering::InsertPInvokeMethodProlog()
store->gtOp.gtOp1 = call;
store->gtFlags |= GTF_VAR_DEF;
- GenTree* insertionPoint = firstBlockRange.FirstNonPhiOrCatchArgNode();
-
comp->fgMorphTree(store);
- firstBlockRange.InsertBefore(insertionPoint, LIR::SeqTree(comp, store));
+ firstBlockRange.InsertAtEnd(LIR::SeqTree(comp, store));
DISPTREERANGE(firstBlockRange, store);
#if !defined(_TARGET_X86_) && !defined(_TARGET_ARM_)
@@ -2898,7 +2892,7 @@ void Lowering::InsertPInvokeMethodProlog()
GenTreeLclFld(GT_STORE_LCL_FLD, TYP_I_IMPL, comp->lvaInlinedPInvokeFrameVar, callFrameInfo.offsetOfCallSiteSP);
storeSP->gtOp1 = PhysReg(REG_SPBASE);
- firstBlockRange.InsertBefore(insertionPoint, LIR::SeqTree(comp, storeSP));
+ firstBlockRange.InsertAtEnd(LIR::SeqTree(comp, storeSP));
DISPTREERANGE(firstBlockRange, storeSP);
#endif // !defined(_TARGET_X86_) && !defined(_TARGET_ARM_)
@@ -2914,7 +2908,7 @@ void Lowering::InsertPInvokeMethodProlog()
callFrameInfo.offsetOfCalleeSavedFP);
storeFP->gtOp1 = PhysReg(REG_FPBASE);
- firstBlockRange.InsertBefore(insertionPoint, LIR::SeqTree(comp, storeFP));
+ firstBlockRange.InsertAtEnd(LIR::SeqTree(comp, storeFP));
DISPTREERANGE(firstBlockRange, storeFP);
#endif // !defined(_TARGET_ARM_)
@@ -2929,7 +2923,7 @@ void Lowering::InsertPInvokeMethodProlog()
// Push a frame - if we are NOT in an IL stub, this is done right before the call
// The init routine sets InlinedCallFrame's m_pNext, so we just set the thead's top-of-stack
GenTree* frameUpd = CreateFrameLinkUpdate(PushFrame);
- firstBlockRange.InsertBefore(insertionPoint, LIR::SeqTree(comp, frameUpd));
+ firstBlockRange.InsertAtEnd(LIR::SeqTree(comp, frameUpd));
DISPTREERANGE(firstBlockRange, frameUpd);
}
#endif // _TARGET_64BIT_
@@ -3036,7 +3030,6 @@ void Lowering::InsertPInvokeCallProlog(GenTreeCall* call)
noway_assert(comp->lvaInlinedPInvokeFrameVar != BAD_VAR_NUM);
-#if COR_JIT_EE_VERSION > 460
if (comp->opts.ShouldUsePInvokeHelpers())
{
// First argument is the address of the frame variable.
@@ -3052,7 +3045,6 @@ void Lowering::InsertPInvokeCallProlog(GenTreeCall* call)
LowerNode(helperCall); // helper call is inserted before current node and should be lowered here.
return;
}
-#endif
// Emit the following sequence:
//
@@ -3185,7 +3177,6 @@ void Lowering::InsertPInvokeCallEpilog(GenTreeCall* call)
{
JITDUMP("======= Inserting PInvoke call epilog\n");
-#if COR_JIT_EE_VERSION > 460
if (comp->opts.ShouldUsePInvokeHelpers())
{
noway_assert(comp->lvaInlinedPInvokeFrameVar != BAD_VAR_NUM);
@@ -3203,7 +3194,6 @@ void Lowering::InsertPInvokeCallEpilog(GenTreeCall* call)
BlockRange().InsertAfter(call, LIR::SeqTree(comp, helperCall));
return;
}
-#endif
// gcstate = 1
GenTree* insertionPoint = call->gtNext;
@@ -3324,18 +3314,7 @@ GenTree* Lowering::LowerNonvirtPinvokeCall(GenTreeCall* call)
CORINFO_METHOD_HANDLE methHnd = call->gtCallMethHnd;
CORINFO_CONST_LOOKUP lookup;
-#if COR_JIT_EE_VERSION > 460
comp->info.compCompHnd->getAddressOfPInvokeTarget(methHnd, &lookup);
-#else
- void* pIndirection;
- lookup.accessType = IAT_PVALUE;
- lookup.addr = comp->info.compCompHnd->getAddressOfPInvokeFixup(methHnd, &pIndirection);
- if (lookup.addr == nullptr)
- {
- lookup.accessType = IAT_PPVALUE;
- lookup.addr = pIndirection;
- }
-#endif
void* addr = lookup.addr;
switch (lookup.accessType)
diff --git a/src/jit/lsraarm.cpp b/src/jit/lsraarm.cpp
index 3a2206bf8d..912fd36c19 100644
--- a/src/jit/lsraarm.cpp
+++ b/src/jit/lsraarm.cpp
@@ -728,6 +728,88 @@ void Lowering::TreeNodeInfoInitPutArgStk(GenTreePutArgStk* argNode, fgArgTabEntr
}
}
+void Lowering::TreeNodeInfoInitLclHeap(GenTree* tree)
+{
+ TreeNodeInfo* info = &(tree->gtLsraInfo);
+ LinearScan* l = m_lsra;
+ Compiler* compiler = comp;
+
+ info->srcCount = 1;
+ info->dstCount = 1;
+
+ // Need a variable number of temp regs (see genLclHeap() in codegenarm.cpp):
+ // Here '-' means don't care.
+ //
+ // Size? Init Memory? # temp regs
+ // 0 - 0
+ // const and <=4 ptr words - hasPspSym ? 1 : 0
+ // const and <PageSize No hasPspSym ? 1 : 0
+ // >4 ptr words Yes hasPspSym ? 2 : 1
+ // Non-const Yes hasPspSym ? 2 : 1
+ // Non-const No hasPspSym ? 2 : 1
+
+ bool hasPspSym;
+#if FEATURE_EH_FUNCLETS
+ hasPspSym = (compiler->lvaPSPSym != BAD_VAR_NUM);
+#else
+ hasPspSym = false;
+#endif
+
+ GenTreePtr size = tree->gtOp.gtOp1;
+ if (size->IsCnsIntOrI())
+ {
+ MakeSrcContained(tree, size);
+
+ size_t sizeVal = size->gtIntCon.gtIconVal;
+ if (sizeVal == 0)
+ {
+ info->internalIntCount = 0;
+ }
+ else
+ {
+ sizeVal = AlignUp(sizeVal, STACK_ALIGN);
+ size_t cntStackAlignedWidthItems = (sizeVal >> STACK_ALIGN_SHIFT);
+
+ // For small allocations up to 4 store instructions
+ if (cntStackAlignedWidthItems <= 4)
+ {
+ info->internalIntCount = 0;
+ }
+ else if (!compiler->info.compInitMem)
+ {
+ // No need to initialize allocated stack space.
+ if (sizeVal < compiler->eeGetPageSize())
+ {
+ info->internalIntCount = 0;
+ }
+ else
+ {
+ // target (regCnt) + tmp + [psp]
+ info->internalIntCount = 1;
+ info->isInternalRegDelayFree = true;
+ }
+ }
+ else
+ {
+ // target (regCnt) + tmp + [psp]
+ info->internalIntCount = 1;
+ info->isInternalRegDelayFree = true;
+ }
+
+ if (hasPspSym)
+ {
+ info->internalIntCount++;
+ }
+ }
+ }
+ else
+ {
+ // target (regCnt) + tmp + [psp]
+ info->internalIntCount = hasPspSym ? 2 : 1;
+ info->isInternalRegDelayFree = true;
+ }
+}
+
//------------------------------------------------------------------------
// TreeNodeInfoInitBlockStore: Set the NodeInfo for a block store.
//
@@ -897,7 +979,6 @@ void Lowering::TreeNodeInfoInit(GenTree* tree)
JITDUMP("TreeNodeInfoInit for: ");
DISPNODE(tree);
- NYI_IF(tree->TypeGet() == TYP_STRUCT, "lowering struct");
NYI_IF(tree->TypeGet() == TYP_DOUBLE, "lowering double");
switch (tree->OperGet())
@@ -991,9 +1072,27 @@ void Lowering::TreeNodeInfoInit(GenTree* tree)
info->srcCount = 2;
}
- if (tree->gtOverflow())
+ CastInfo castInfo;
+
+ // Get information about the cast.
+ getCastDescription(tree, &castInfo);
+
+ if (castInfo.requiresOverflowCheck)
{
- NYI_ARM("overflow checks");
+ var_types srcType = castOp->TypeGet();
+ emitAttr cmpSize = EA_ATTR(genTypeSize(srcType));
+
+ // If we cannot store the comparisons in an immediate for either
+ // comparing against the max or min value, then we will need to
+ // reserve a temporary register.
+
+ bool canStoreMaxValue = emitter::emitIns_valid_imm_for_cmp(castInfo.typeMax, INS_FLAGS_DONT_CARE);
+ bool canStoreMinValue = emitter::emitIns_valid_imm_for_cmp(castInfo.typeMin, INS_FLAGS_DONT_CARE);
+
+ if (!canStoreMaxValue || !canStoreMinValue)
+ {
+ info->internalIntCount = 1;
+ }
}
}
break;
@@ -1279,6 +1378,10 @@ void Lowering::TreeNodeInfoInit(GenTree* tree)
TreeNodeInfoInitBlockStore(tree->AsBlk());
break;
+ case GT_LCLHEAP:
+ TreeNodeInfoInitLclHeap(tree);
+ break;
+
case GT_STOREIND:
{
info->srcCount = 2;
@@ -1340,11 +1443,6 @@ void Lowering::TreeNodeInfoInit(GenTree* tree)
case GT_LCL_FLD_ADDR:
case GT_LCL_VAR:
case GT_LCL_VAR_ADDR:
- {
- unsigned varNum = tree->gtLclVarCommon.gtLclNum;
- LclVarDsc* varDsc = comp->lvaTable + varNum;
- NYI_IF(varTypeIsStruct(varDsc), "lowering struct var");
- }
case GT_PHYSREG:
case GT_CLS_VAR_ADDR:
case GT_IL_OFFSET:
@@ -1354,6 +1452,7 @@ void Lowering::TreeNodeInfoInit(GenTree* tree)
case GT_LABEL:
case GT_PINVOKE_PROLOG:
case GT_JCC:
+ case GT_MEMORYBARRIER:
info->dstCount = tree->IsValue() ? 1 : 0;
if (kind & (GTK_CONST | GTK_LEAF))
{
diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp
index 96edb3b835..bb2e7e43eb 100644
--- a/src/jit/morph.cpp
+++ b/src/jit/morph.cpp
@@ -858,7 +858,9 @@ fgArgInfo::fgArgInfo(Compiler* comp, GenTreeCall* call, unsigned numArgs)
nextSlotNum = INIT_ARG_STACK_SLOT;
stkLevel = 0;
#if defined(UNIX_X86_ABI)
- padStkAlign = 0;
+ alignmentDone = false;
+ stkSizeBytes = 0;
+ padStkAlign = 0;
#endif
#if FEATURE_FIXED_OUT_ARGS
outArgSize = 0;
@@ -902,7 +904,9 @@ fgArgInfo::fgArgInfo(GenTreeCall* newCall, GenTreeCall* oldCall)
nextSlotNum = INIT_ARG_STACK_SLOT;
stkLevel = oldArgInfo->stkLevel;
#if defined(UNIX_X86_ABI)
- padStkAlign = oldArgInfo->padStkAlign;
+ alignmentDone = oldArgInfo->alignmentDone;
+ stkSizeBytes = oldArgInfo->stkSizeBytes;
+ padStkAlign = oldArgInfo->padStkAlign;
#endif
#if FEATURE_FIXED_OUT_ARGS
outArgSize = oldArgInfo->outArgSize;
@@ -1086,19 +1090,16 @@ fgArgTabEntryPtr fgArgInfo::AddRegArg(
{
fgArgTabEntryPtr curArgTabEntry = new (compiler, CMK_fgArgInfo) fgArgTabEntry;
- curArgTabEntry->argNum = argNum;
- curArgTabEntry->node = node;
- curArgTabEntry->parent = parent;
- curArgTabEntry->regNum = regNum;
- curArgTabEntry->slotNum = 0;
- curArgTabEntry->numRegs = numRegs;
- curArgTabEntry->numSlots = 0;
- curArgTabEntry->alignment = alignment;
- curArgTabEntry->lateArgInx = (unsigned)-1;
- curArgTabEntry->tmpNum = (unsigned)-1;
-#if defined(UNIX_X86_ABI)
- curArgTabEntry->padStkAlign = 0;
-#endif
+ curArgTabEntry->argNum = argNum;
+ curArgTabEntry->node = node;
+ curArgTabEntry->parent = parent;
+ curArgTabEntry->regNum = regNum;
+ curArgTabEntry->slotNum = 0;
+ curArgTabEntry->numRegs = numRegs;
+ curArgTabEntry->numSlots = 0;
+ curArgTabEntry->alignment = alignment;
+ curArgTabEntry->lateArgInx = (unsigned)-1;
+ curArgTabEntry->tmpNum = (unsigned)-1;
curArgTabEntry->isSplit = false;
curArgTabEntry->isTmp = false;
curArgTabEntry->needTmp = false;
@@ -1164,19 +1165,16 @@ fgArgTabEntryPtr fgArgInfo::AddStkArg(unsigned argNum,
curArgTabEntry->isStruct = isStruct; // is this a struct arg
#endif // defined(FEATURE_UNIX_AMD64_STRUCT_PASSING)
- curArgTabEntry->argNum = argNum;
- curArgTabEntry->node = node;
- curArgTabEntry->parent = parent;
- curArgTabEntry->regNum = REG_STK;
- curArgTabEntry->slotNum = nextSlotNum;
- curArgTabEntry->numRegs = 0;
- curArgTabEntry->numSlots = numSlots;
- curArgTabEntry->alignment = alignment;
- curArgTabEntry->lateArgInx = (unsigned)-1;
- curArgTabEntry->tmpNum = (unsigned)-1;
-#if defined(UNIX_X86_ABI)
- curArgTabEntry->padStkAlign = 0;
-#endif
+ curArgTabEntry->argNum = argNum;
+ curArgTabEntry->node = node;
+ curArgTabEntry->parent = parent;
+ curArgTabEntry->regNum = REG_STK;
+ curArgTabEntry->slotNum = nextSlotNum;
+ curArgTabEntry->numRegs = 0;
+ curArgTabEntry->numSlots = numSlots;
+ curArgTabEntry->alignment = alignment;
+ curArgTabEntry->lateArgInx = (unsigned)-1;
+ curArgTabEntry->tmpNum = (unsigned)-1;
curArgTabEntry->isSplit = false;
curArgTabEntry->isTmp = false;
curArgTabEntry->needTmp = false;
@@ -1702,52 +1700,6 @@ void fgArgInfo::ArgsComplete()
argsComplete = true;
}
-#if defined(UNIX_X86_ABI)
-// Get the stack alignment value for a Call holding this object
-//
-// NOTE: This function will calculate number of padding slots, to align the
-// stack before pushing arguments to the stack. Padding value is stored in
-// the first argument in fgArgTabEntry structure padStkAlign member so that
-// code (sub esp, n) can be emitted before generating argument push in
-// fgArgTabEntry node. As of result stack will be aligned right before
-// making a "Call". After the Call, stack is re-adjusted to the value it
-// was with fgArgInfo->padStkAlign value as we cann't use the one in fgArgTabEntry.
-//
-void fgArgInfo::ArgsAlignPadding()
-{
- // To get the padding amount, sum up all the slots and get the remainder for padding
- unsigned curInx;
- unsigned numSlots = 0;
- fgArgTabEntryPtr firstArgTabEntry = nullptr;
-
- for (curInx = 0; curInx < argCount; curInx++)
- {
- fgArgTabEntryPtr curArgTabEntry = argTable[curInx];
- if (curArgTabEntry->numSlots > 0)
- {
- // The argument may be REG_STK or constant or register that goes to stack
- assert(nextSlotNum >= curArgTabEntry->slotNum);
-
- numSlots += curArgTabEntry->numSlots;
- if (firstArgTabEntry == nullptr)
- {
- // First argument will be used to hold the padding amount
- firstArgTabEntry = curArgTabEntry;
- }
- }
- }
-
- if (firstArgTabEntry != nullptr)
- {
- const int numSlotsAligned = STACK_ALIGN / TARGET_POINTER_SIZE;
- // Set stack align pad for the first argument
- firstArgTabEntry->padStkAlign = AlignmentPad(numSlots, numSlotsAligned);
- // Set also for fgArgInfo that will be used to reset stack pointer after the Call
- this->padStkAlign = firstArgTabEntry->padStkAlign;
- }
-}
-#endif // UNIX_X86_ABI
-
void fgArgInfo::SortArgs()
{
assert(argsComplete == true);
@@ -2837,9 +2789,9 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* call)
// so we record the stack depth on the first morph call when reMorphing
// was false (via RecordStkLevel) and then retrieve that value here (via RetrieveStkLevel)
//
- unsigned callStkLevel = call->fgArgInfo->RetrieveStkLevel();
if (call->gtCallLateArgs != nullptr)
{
+ unsigned callStkLevel = call->fgArgInfo->RetrieveStkLevel();
fgPtrArgCntCur += callStkLevel;
call->gtCallLateArgs = fgMorphTree(call->gtCallLateArgs)->AsArgList();
flagsSummary |= call->gtCallLateArgs->gtFlags;
@@ -4287,10 +4239,6 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* call)
{
call->fgArgInfo->ArgsComplete();
-#if defined(UNIX_X86_ABI)
- call->fgArgInfo->ArgsAlignPadding();
-#endif // UNIX_X86_ABI
-
#ifdef LEGACY_BACKEND
call->gtCallRegUsedMask = genIntAllRegArgMask(intArgRegNum);
#if defined(_TARGET_ARM_)
@@ -4332,6 +4280,9 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* call)
fgPtrArgCntMax = fgPtrArgCntCur;
}
+ assert(fgPtrArgCntCur >= genPtrArgCntSav);
+ call->fgArgInfo->SetStkSizeBytes((fgPtrArgCntCur - genPtrArgCntSav) * TARGET_POINTER_SIZE);
+
/* The call will pop all the arguments we pushed */
fgPtrArgCntCur = genPtrArgCntSav;
@@ -9678,6 +9629,7 @@ GenTreePtr Compiler::fgMorphCopyBlock(GenTreePtr tree)
assert(dest->gtOper == GT_LCL_FLD);
blockWidth = genTypeSize(dest->TypeGet());
destAddr = gtNewOperNode(GT_ADDR, TYP_BYREF, dest);
+ destFldSeq = dest->AsLclFld()->gtFieldSeq;
}
}
else
@@ -9799,12 +9751,13 @@ GenTreePtr Compiler::fgMorphCopyBlock(GenTreePtr tree)
// Check to see if we are required to do a copy block because the struct contains holes
// and either the src or dest is externally visible
//
- bool requiresCopyBlock = false;
- bool srcSingleLclVarAsg = false;
+ bool requiresCopyBlock = false;
+ bool srcSingleLclVarAsg = false;
+ bool destSingleLclVarAsg = false;
- if ((destLclVar != nullptr) && (srcLclVar == destLclVar))
+ if ((destLclVar != nullptr) && (srcLclVar == destLclVar) && (destFldSeq == srcFldSeq))
{
- // Beyond perf reasons, it is not prudent to have a copy of a struct to itself.
+ // Self-assign; no effect.
GenTree* nop = gtNewNothingNode();
INDEBUG(nop->gtDebugFlags |= GTF_DEBUG_NODE_MORPHED);
return nop;
@@ -9916,6 +9869,30 @@ GenTreePtr Compiler::fgMorphCopyBlock(GenTreePtr tree)
}
}
}
+ else
+ {
+ assert(srcDoFldAsg);
+ // Check for the symmetric case (which happens for the _pointer field of promoted spans):
+ //
+ // [000240] -----+------ /--* lclVar struct(P) V18 tmp9
+ // /--* byref V18._value (offs=0x00) -> V30 tmp21
+ // [000245] -A------R--- * = struct (copy)
+ // [000244] -----+------ \--* obj(8) struct
+ // [000243] -----+------ \--* addr byref
+ // [000242] D----+-N---- \--* lclVar byref V28 tmp19
+ //
+ if (blockWidthIsConst && (srcLclVar->lvFieldCnt == 1) && (destLclVar != nullptr) &&
+ (blockWidth == genTypeSize(destLclVar->TypeGet())))
+ {
+ // Check for type agreement
+ unsigned fieldLclNum = lvaTable[srcLclNum].lvFieldLclStart;
+ var_types srcType = lvaTable[fieldLclNum].TypeGet();
+ if (destLclVar->TypeGet() == srcType)
+ {
+ destSingleLclVarAsg = true;
+ }
+ }
+ }
}
// If we require a copy block the set both of the field assign bools to false
@@ -9932,7 +9909,7 @@ GenTreePtr Compiler::fgMorphCopyBlock(GenTreePtr tree)
// when they are not reg-sized non-field-addressed structs and we are using a CopyBlock
// or the struct is not promoted
//
- if (!destDoFldAsg && (destLclVar != nullptr))
+ if (!destDoFldAsg && (destLclVar != nullptr) && !destSingleLclVarAsg)
{
if (!destLclVar->lvRegStruct)
{
@@ -10186,45 +10163,56 @@ GenTreePtr Compiler::fgMorphCopyBlock(GenTreePtr tree)
noway_assert(srcLclNum != BAD_VAR_NUM);
unsigned fieldLclNum = lvaTable[srcLclNum].lvFieldLclStart + i;
- if (addrSpill)
+ if (destSingleLclVarAsg)
{
- assert(addrSpillTemp != BAD_VAR_NUM);
- dest = gtNewLclvNode(addrSpillTemp, TYP_BYREF);
+ noway_assert(fieldCnt == 1);
+ noway_assert(destLclVar != nullptr);
+ noway_assert(addrSpill == nullptr);
+
+ dest = gtNewLclvNode(destLclNum, destLclVar->TypeGet());
}
else
{
- dest = gtCloneExpr(destAddr);
- noway_assert(dest != nullptr);
-
- // Is the address of a local?
- GenTreeLclVarCommon* lclVarTree = nullptr;
- bool isEntire = false;
- bool* pIsEntire = (blockWidthIsConst ? &isEntire : nullptr);
- if (dest->DefinesLocalAddr(this, blockWidth, &lclVarTree, pIsEntire))
+ if (addrSpill)
{
- lclVarTree->gtFlags |= GTF_VAR_DEF;
- if (!isEntire)
+ assert(addrSpillTemp != BAD_VAR_NUM);
+ dest = gtNewLclvNode(addrSpillTemp, TYP_BYREF);
+ }
+ else
+ {
+ dest = gtCloneExpr(destAddr);
+ noway_assert(dest != nullptr);
+
+ // Is the address of a local?
+ GenTreeLclVarCommon* lclVarTree = nullptr;
+ bool isEntire = false;
+ bool* pIsEntire = (blockWidthIsConst ? &isEntire : nullptr);
+ if (dest->DefinesLocalAddr(this, blockWidth, &lclVarTree, pIsEntire))
{
- lclVarTree->gtFlags |= GTF_VAR_USEASG;
+ lclVarTree->gtFlags |= GTF_VAR_DEF;
+ if (!isEntire)
+ {
+ lclVarTree->gtFlags |= GTF_VAR_USEASG;
+ }
}
}
- }
- GenTreePtr fieldOffsetNode = gtNewIconNode(lvaTable[fieldLclNum].lvFldOffset, TYP_I_IMPL);
- // Have to set the field sequence -- which means we need the field handle.
- CORINFO_CLASS_HANDLE classHnd = lvaTable[srcLclNum].lvVerTypeInfo.GetClassHandle();
- CORINFO_FIELD_HANDLE fieldHnd =
- info.compCompHnd->getFieldInClass(classHnd, lvaTable[fieldLclNum].lvFldOrdinal);
- curFieldSeq = GetFieldSeqStore()->CreateSingleton(fieldHnd);
- fieldOffsetNode->gtIntCon.gtFieldSeq = curFieldSeq;
+ GenTreePtr fieldOffsetNode = gtNewIconNode(lvaTable[fieldLclNum].lvFldOffset, TYP_I_IMPL);
+ // Have to set the field sequence -- which means we need the field handle.
+ CORINFO_CLASS_HANDLE classHnd = lvaTable[srcLclNum].lvVerTypeInfo.GetClassHandle();
+ CORINFO_FIELD_HANDLE fieldHnd =
+ info.compCompHnd->getFieldInClass(classHnd, lvaTable[fieldLclNum].lvFldOrdinal);
+ curFieldSeq = GetFieldSeqStore()->CreateSingleton(fieldHnd);
+ fieldOffsetNode->gtIntCon.gtFieldSeq = curFieldSeq;
- dest = gtNewOperNode(GT_ADD, TYP_BYREF, dest, fieldOffsetNode);
+ dest = gtNewOperNode(GT_ADD, TYP_BYREF, dest, fieldOffsetNode);
- dest = gtNewOperNode(GT_IND, lvaTable[fieldLclNum].TypeGet(), dest);
+ dest = gtNewOperNode(GT_IND, lvaTable[fieldLclNum].TypeGet(), dest);
- // !!! The destination could be on stack. !!!
- // This flag will let us choose the correct write barrier.
- dest->gtFlags |= GTF_IND_TGTANYWHERE;
+ // !!! The destination could be on stack. !!!
+ // This flag will let us choose the correct write barrier.
+ dest->gtFlags |= GTF_IND_TGTANYWHERE;
+ }
}
if (srcDoFldAsg)
@@ -10869,7 +10857,6 @@ GenTreePtr Compiler::fgMorphSmpOp(GenTreePtr tree, MorphAddrContext* mac)
op1->gtOp.gtOp1 = gtNewOperNode(GT_NOP, TYP_INT, op1->gtCast.CastOp());
op1->gtFlags &= ~GTF_ALL_EFFECT;
op1->gtFlags |= (op1->gtCast.CastOp()->gtFlags & GTF_ALL_EFFECT);
- op1->gtFlags |= GTF_DONT_CSE;
}
if (op2->gtCast.CastOp()->OperGet() != GT_NOP)
@@ -10877,9 +10864,11 @@ GenTreePtr Compiler::fgMorphSmpOp(GenTreePtr tree, MorphAddrContext* mac)
op2->gtOp.gtOp1 = gtNewOperNode(GT_NOP, TYP_INT, op2->gtCast.CastOp());
op2->gtFlags &= ~GTF_ALL_EFFECT;
op2->gtFlags |= (op2->gtCast.CastOp()->gtFlags & GTF_ALL_EFFECT);
- op2->gtFlags |= GTF_DONT_CSE;
}
+ op1->gtFlags |= GTF_DONT_CSE;
+ op2->gtFlags |= GTF_DONT_CSE;
+
tree->gtFlags &= ~GTF_ALL_EFFECT;
tree->gtFlags |= ((op1->gtFlags | op2->gtFlags) & GTF_ALL_EFFECT);
@@ -14196,13 +14185,13 @@ GenTreePtr Compiler::fgRecognizeAndMorphBitwiseRotation(GenTreePtr tree)
//
// OR ROL
// / \ / \
- // LSH RSZ -> x y
+ // LSH RSZ -> x y
// / \ / \
- // x AND x AND
+ // x AND x AND
// / \ / \
- // y 31 ADD 31
+ // y 31 ADD 31
// / \
- // NEG 32
+ // NEG 32
// |
// y
// The patterns recognized:
@@ -15132,13 +15121,13 @@ bool Compiler::fgFoldConditional(BasicBlock* block)
// else if bTaken has valid profile weight and block does not we try to adjust block's weight
// We can only adjust the block weights when (the edge block -> bTaken) is the only edge into bTaken
//
- if (block->bbFlags & BBF_PROF_WEIGHT)
+ if (block->hasProfileWeight())
{
// The edge weights for (block -> bTaken) are 100% of block's weight
edgeTaken->flEdgeWeightMin = block->bbWeight;
edgeTaken->flEdgeWeightMax = block->bbWeight;
- if ((bTaken->bbFlags & BBF_PROF_WEIGHT) == 0)
+ if (!bTaken->hasProfileWeight())
{
if ((bTaken->countOfInEdges() == 1) || (bTaken->bbWeight < block->bbWeight))
{
@@ -15148,7 +15137,7 @@ bool Compiler::fgFoldConditional(BasicBlock* block)
}
}
}
- else if (bTaken->bbFlags & BBF_PROF_WEIGHT)
+ else if (bTaken->hasProfileWeight())
{
if (bTaken->countOfInEdges() == 1)
{
diff --git a/src/jit/optcse.cpp b/src/jit/optcse.cpp
index 519e31f0f5..41aad403d9 100644
--- a/src/jit/optcse.cpp
+++ b/src/jit/optcse.cpp
@@ -321,8 +321,8 @@ Compiler::fgWalkResult Compiler::optCSE_MaskHelper(GenTreePtr* pTree, fgWalkData
//
void Compiler::optCSE_GetMaskData(GenTreePtr tree, optCSE_MaskData* pMaskData)
{
- pMaskData->CSE_defMask = BitVecOps::MakeCopy(cseTraits, cseEmpty);
- pMaskData->CSE_useMask = BitVecOps::MakeCopy(cseTraits, cseEmpty);
+ pMaskData->CSE_defMask = BitVecOps::MakeEmpty(cseTraits);
+ pMaskData->CSE_useMask = BitVecOps::MakeEmpty(cseTraits);
fgWalkTreePre(&tree, optCSE_MaskHelper, (void*)pMaskData);
}
@@ -498,10 +498,7 @@ void Compiler::optValnumCSE_Init()
// Init traits and full/empty bitvectors. This will be used to track the
// individual cse indexes.
cseTraits = new (getAllocator()) BitVecTraits(EXPSET_SZ, this);
- cseFull = BitVecOps::UninitVal();
- cseEmpty = BitVecOps::UninitVal();
- BitVecOps::AssignNoCopy(cseTraits, cseFull, BitVecOps::MakeFull(cseTraits));
- BitVecOps::AssignNoCopy(cseTraits, cseEmpty, BitVecOps::MakeEmpty(cseTraits));
+ cseFull = BitVecOps::MakeFull(cseTraits);
/* Allocate and clear the hash bucket table */
@@ -895,7 +892,7 @@ void Compiler::optValnumCSE_InitDataFlow()
if (init_to_zero)
{
/* Initialize to {ZERO} prior to dataflow */
- block->bbCseIn = BitVecOps::MakeCopy(cseTraits, cseEmpty);
+ block->bbCseIn = BitVecOps::MakeEmpty(cseTraits);
}
else
{
@@ -906,7 +903,7 @@ void Compiler::optValnumCSE_InitDataFlow()
block->bbCseOut = BitVecOps::MakeCopy(cseTraits, cseFull);
/* Initialize to {ZERO} prior to locating the CSE candidates */
- block->bbCseGen = BitVecOps::MakeCopy(cseTraits, cseEmpty);
+ block->bbCseGen = BitVecOps::MakeEmpty(cseTraits);
}
// We walk the set of CSE candidates and set the bit corresponsing to the CSEindex
@@ -960,42 +957,31 @@ void Compiler::optValnumCSE_InitDataFlow()
*/
class CSE_DataFlow
{
-private:
- EXPSET_TP m_preMergeOut;
-
- Compiler* m_pCompiler;
+ BitVecTraits* m_pBitVecTraits;
+ EXPSET_TP m_preMergeOut;
public:
- CSE_DataFlow(Compiler* pCompiler) : m_pCompiler(pCompiler)
- {
- }
-
- Compiler* getCompiler()
+ CSE_DataFlow(Compiler* pCompiler) : m_pBitVecTraits(pCompiler->cseTraits), m_preMergeOut(BitVecOps::UninitVal())
{
- return m_pCompiler;
}
// At the start of the merge function of the dataflow equations, initialize premerge state (to detect changes.)
void StartMerge(BasicBlock* block)
{
- m_preMergeOut = BitVecOps::MakeCopy(m_pCompiler->cseTraits, block->bbCseOut);
+ BitVecOps::Assign(m_pBitVecTraits, m_preMergeOut, block->bbCseOut);
}
// During merge, perform the actual merging of the predecessor's (since this is a forward analysis) dataflow flags.
void Merge(BasicBlock* block, BasicBlock* predBlock, flowList* preds)
{
- BitVecOps::IntersectionD(m_pCompiler->cseTraits, block->bbCseIn, predBlock->bbCseOut);
+ BitVecOps::IntersectionD(m_pBitVecTraits, block->bbCseIn, predBlock->bbCseOut);
}
// At the end of the merge store results of the dataflow equations, in a postmerge state.
bool EndMerge(BasicBlock* block)
{
- BitVecTraits* traits = m_pCompiler->cseTraits;
- EXPSET_TP mergeOut = BitVecOps::MakeCopy(traits, block->bbCseIn);
- BitVecOps::UnionD(traits, mergeOut, block->bbCseGen);
- BitVecOps::IntersectionD(traits, mergeOut, block->bbCseOut);
- BitVecOps::Assign(traits, block->bbCseOut, mergeOut);
- return (!BitVecOps::Equal(traits, mergeOut, m_preMergeOut));
+ BitVecOps::DataFlowD(m_pBitVecTraits, block->bbCseOut, block->bbCseGen, block->bbCseIn);
+ return !BitVecOps::Equal(m_pBitVecTraits, block->bbCseOut, m_preMergeOut);
}
};
@@ -1061,6 +1047,8 @@ void Compiler::optValnumCSE_Availablity()
printf("Labeling the CSEs with Use/Def information\n");
}
#endif
+ EXPSET_TP available_cses = BitVecOps::MakeEmpty(cseTraits);
+
for (BasicBlock* block = fgFirstBB; block; block = block->bbNext)
{
GenTreePtr stmt;
@@ -1070,7 +1058,7 @@ void Compiler::optValnumCSE_Availablity()
compCurBB = block;
- EXPSET_TP available_cses = BitVecOps::MakeCopy(cseTraits, block->bbCseIn);
+ BitVecOps::Assign(cseTraits, available_cses, block->bbCseIn);
optCSEweight = block->getBBWeight(this);
diff --git a/src/jit/optimizer.cpp b/src/jit/optimizer.cpp
index 64eae4accf..c18ebc55d0 100644
--- a/src/jit/optimizer.cpp
+++ b/src/jit/optimizer.cpp
@@ -227,7 +227,7 @@ void Compiler::optMarkLoopBlocks(BasicBlock* begBlk, BasicBlock* endBlk, bool ex
unsigned weight;
- if ((curBlk->bbFlags & BBF_PROF_WEIGHT) != 0)
+ if (curBlk->hasProfileWeight())
{
// We have real profile weights, so we aren't going to change this blocks weight
weight = curBlk->bbWeight;
@@ -370,7 +370,7 @@ void Compiler::optUnmarkLoopBlocks(BasicBlock* begBlk, BasicBlock* endBlk)
// Don't unmark blocks that are set to BB_MAX_WEIGHT
// Don't unmark blocks when we are using profile weights
//
- if (!curBlk->isMaxBBWeight() && ((curBlk->bbFlags & BBF_PROF_WEIGHT) == 0))
+ if (!curBlk->isMaxBBWeight() && !curBlk->hasProfileWeight())
{
if (!fgDominate(curBlk, endBlk))
{
@@ -3527,8 +3527,7 @@ void Compiler::fgOptWhileLoop(BasicBlock* block)
{
// Only rely upon the profile weight when all three of these blocks
// have good profile weights
- if ((block->bbFlags & BBF_PROF_WEIGHT) && (bTest->bbFlags & BBF_PROF_WEIGHT) &&
- (block->bbNext->bbFlags & BBF_PROF_WEIGHT))
+ if (block->hasProfileWeight() && bTest->hasProfileWeight() && block->bbNext->hasProfileWeight())
{
allProfileWeightsAreValid = true;
@@ -6553,9 +6552,8 @@ void Compiler::fgCreateLoopPreHeader(unsigned lnum)
}
else
{
- bool allValidProfileWeights = ((head->bbFlags & BBF_PROF_WEIGHT) != 0) &&
- ((head->bbJumpDest->bbFlags & BBF_PROF_WEIGHT) != 0) &&
- ((head->bbNext->bbFlags & BBF_PROF_WEIGHT) != 0);
+ bool allValidProfileWeights =
+ (head->hasProfileWeight() && head->bbJumpDest->hasProfileWeight() && head->bbNext->hasProfileWeight());
if (allValidProfileWeights)
{
diff --git a/src/jit/protononjit/CMakeLists.txt b/src/jit/protononjit/CMakeLists.txt
index ed6932e9a2..e209e4cd36 100644
--- a/src/jit/protononjit/CMakeLists.txt
+++ b/src/jit/protononjit/CMakeLists.txt
@@ -21,6 +21,17 @@ else()
clr_unknown_arch()
endif()
+if (NOT WIN32)
+ if (CLR_CMAKE_PLATFORM_ARCH_I386)
+ remove_definitions(-DUNIX_X86_ABI)
+ elseif(CLR_CMAKE_PLATFORM_ARCH_AMD64)
+ remove_definitions(-DUNIX_AMD64_ABI)
+ remove_definitions(-DFEATURE_UNIX_AMD64_STRUCT_PASSING)
+ else()
+ clr_unknown_arch()
+ endif()
+endif(NOT WIN32)
+
if(WIN32)
add_definitions(-DFX_VER_INTERNALNAME_STR=protononjit.dll)
endif(WIN32)
diff --git a/src/jit/rangecheck.cpp b/src/jit/rangecheck.cpp
index 22b5328b08..91ae81e322 100644
--- a/src/jit/rangecheck.cpp
+++ b/src/jit/rangecheck.cpp
@@ -506,7 +506,7 @@ void RangeCheck::MergeEdgeAssertions(GenTreePtr tree, const ASSERT_VALARG_TP ass
{
index++;
- Compiler::AssertionDsc* curAssertion = m_pCompiler->optGetAssertion((Compiler::AssertionIndex)index);
+ Compiler::AssertionDsc* curAssertion = m_pCompiler->optGetAssertion((AssertionIndex)index);
// Current assertion is about array length.
if (!curAssertion->IsArrLenArithBound() && !curAssertion->IsArrLenBound() && !curAssertion->IsConstantBound())
@@ -517,7 +517,7 @@ void RangeCheck::MergeEdgeAssertions(GenTreePtr tree, const ASSERT_VALARG_TP ass
#ifdef DEBUG
if (m_pCompiler->verbose)
{
- m_pCompiler->optPrintAssertion(curAssertion, (Compiler::AssertionIndex)index);
+ m_pCompiler->optPrintAssertion(curAssertion, (AssertionIndex)index);
}
#endif
@@ -617,7 +617,7 @@ void RangeCheck::MergeEdgeAssertions(GenTreePtr tree, const ASSERT_VALARG_TP ass
#ifdef DEBUG
if (m_pCompiler->verbose)
{
- m_pCompiler->optPrintAssertion(curAssertion, (Compiler::AssertionIndex)index);
+ m_pCompiler->optPrintAssertion(curAssertion, (AssertionIndex)index);
}
#endif
diff --git a/src/jit/utils.cpp b/src/jit/utils.cpp
index e3654b0563..9fbe394a21 100644
--- a/src/jit/utils.cpp
+++ b/src/jit/utils.cpp
@@ -698,18 +698,24 @@ const char* refCntWtd2str(unsigned refCntWtd)
nump = (nump == num1) ? num2 : num1;
- unsigned valueInt = refCntWtd / BB_UNITY_WEIGHT;
- unsigned valueFrac = refCntWtd % BB_UNITY_WEIGHT;
-
- if (valueFrac == 0)
+ if (refCntWtd == BB_MAX_WEIGHT)
{
- sprintf_s(temp, bufSize, "%2u ", valueInt);
+ sprintf_s(temp, bufSize, "MAX ");
}
else
{
- sprintf_s(temp, bufSize, "%2u.%1u", valueInt, (valueFrac * 10 / BB_UNITY_WEIGHT));
- }
+ unsigned valueInt = refCntWtd / BB_UNITY_WEIGHT;
+ unsigned valueFrac = refCntWtd % BB_UNITY_WEIGHT;
+ if (valueFrac == 0)
+ {
+ sprintf_s(temp, bufSize, "%u ", valueInt);
+ }
+ else
+ {
+ sprintf_s(temp, bufSize, "%u.%02u", valueInt, (valueFrac * 100 / BB_UNITY_WEIGHT));
+ }
+ }
return temp;
}
@@ -780,7 +786,7 @@ void ConfigMethodRange::InitRanges(const wchar_t* rangeStr, unsigned capacity)
}
// Allocate some persistent memory
- ICorJitHost* jitHost = JitHost::getJitHost();
+ ICorJitHost* jitHost = g_jitHost;
m_ranges = (Range*)jitHost->allocateMemory(capacity * sizeof(Range));
m_entries = capacity;
@@ -1412,9 +1418,7 @@ void HelperCallProperties::init()
case CORINFO_HELP_GETGENERICS_GCSTATIC_BASE:
case CORINFO_HELP_GETGENERICS_NONGCSTATIC_BASE:
case CORINFO_HELP_READYTORUN_STATIC_BASE:
-#if COR_JIT_EE_VERSION > 460
case CORINFO_HELP_READYTORUN_GENERIC_STATIC_BASE:
-#endif // COR_JIT_EE_VERSION > 460
// These may invoke static class constructors
// These can throw InvalidProgram exception if the class can not be constructed
@@ -1464,9 +1468,7 @@ void HelperCallProperties::init()
case CORINFO_HELP_VERIFICATION:
case CORINFO_HELP_RNGCHKFAIL:
case CORINFO_HELP_THROWDIVZERO:
-#if COR_JIT_EE_VERSION > 460
case CORINFO_HELP_THROWNULLREF:
-#endif // COR_JIT_EE_VERSION
case CORINFO_HELP_THROW:
case CORINFO_HELP_RETHROW:
diff --git a/src/jit/valuenum.cpp b/src/jit/valuenum.cpp
index b771bf6253..66b7978674 100644
--- a/src/jit/valuenum.cpp
+++ b/src/jit/valuenum.cpp
@@ -3182,10 +3182,10 @@ bool ValueNumStore::IsVNArrLenUnsignedBound(ValueNum vn, ArrLenUnsignedBoundInfo
if (GetVNFunc(vn, &funcApp))
{
- if (IsVNArrLen(funcApp.m_args[1]))
+ if ((funcApp.m_func == VNF_LT_UN) || (funcApp.m_func == VNF_GE_UN))
{
// We only care about "(uint)i < (uint)a.len" and its negation "(uint)i >= (uint)a.len"
- if ((funcApp.m_func == VNF_LT_UN) || (funcApp.m_func == VNF_GE_UN))
+ if (IsVNArrLen(funcApp.m_args[1]))
{
info->vnIdx = funcApp.m_args[0];
info->cmpOper = funcApp.m_func;
@@ -3193,10 +3193,10 @@ bool ValueNumStore::IsVNArrLenUnsignedBound(ValueNum vn, ArrLenUnsignedBoundInfo
return true;
}
}
- else if (IsVNArrLen(funcApp.m_args[0]))
+ else if ((funcApp.m_func == VNF_GT_UN) || (funcApp.m_func == VNF_LE_UN))
{
// We only care about "(uint)a.len > (uint)i" and its negation "(uint)a.len <= (uint)i"
- if ((funcApp.m_func == VNF_GT_UN) || (funcApp.m_func == VNF_LE_UN))
+ if (IsVNArrLen(funcApp.m_args[0]))
{
info->vnIdx = funcApp.m_args[1];
// Let's keep a consistent operand order - it's always i < a.len, never a.len > i
@@ -7591,11 +7591,9 @@ VNFunc Compiler::fgValueNumberHelperMethVNFunc(CorInfoHelpFunc helpFunc)
case CORINFO_HELP_READYTORUN_STATIC_BASE:
vnf = VNF_ReadyToRunStaticBase;
break;
-#if COR_JIT_EE_VERSION > 460
case CORINFO_HELP_READYTORUN_GENERIC_STATIC_BASE:
vnf = VNF_ReadyToRunGenericStaticBase;
break;
-#endif // COR_JIT_EE_VERSION > 460
case CORINFO_HELP_GETSHARED_GCSTATIC_BASE_DYNAMICCLASS:
vnf = VNF_GetsharedGcstaticBaseDynamicclass;
break;
diff --git a/src/md/compiler/mdperf.h b/src/md/compiler/mdperf.h
index 77def32d21..a83c8c9ba7 100644
--- a/src/md/compiler/mdperf.h
+++ b/src/md/compiler/mdperf.h
@@ -143,7 +143,6 @@
MD_FUNC(GetCustomAttributeProps)\
MD_FUNC(FindTypeRef)\
MD_FUNC(RefToDefOptimization)\
- MD_FUNC(ProcessFilter)\
MD_FUNC(DefineAssembly)\
MD_FUNC(DefineAssemblyRef)\
MD_FUNC(DefineFile)\
diff --git a/src/md/compiler/mdvalidator.cpp b/src/md/compiler/mdvalidator.cpp
index 0b86738cfb..ce6c14e468 100644
--- a/src/md/compiler/mdvalidator.cpp
+++ b/src/md/compiler/mdvalidator.cpp
@@ -5207,7 +5207,7 @@ HRESULT RegMeta::ValidateAssembly(RID rid)
dwFlags = (CorAssemblyFlags) pMiniMd->getFlagsOfAssembly(pRecord);
// Validate the flags
- invalidAssemblyFlags = dwFlags & (~(afPublicKey | afRetargetable | afPA_FullMask | afEnableJITcompileTracking | afDisableJITcompileOptimizer | afContentType_Mask));
+ invalidAssemblyFlags = dwFlags & (~(afPublicKey | afRetargetable | afPA_FullMask | afDebuggableAttributeMask | afContentType_Mask));
// Validate we only set a legal processor architecture flags
// The processor architecture flags were introduced in CLR v2.0.
diff --git a/src/md/compiler/newmerger.cpp b/src/md/compiler/newmerger.cpp
deleted file mode 100644
index d5199bb570..0000000000
--- a/src/md/compiler/newmerger.cpp
+++ /dev/null
@@ -1,6303 +0,0 @@
-// 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.
-//*****************************************************************************
-// NewMerger.cpp
-//
-
-//
-// contains utility code to MD directory
-//
-// This file provides Compiler Support functionality in metadata.
-//*****************************************************************************
-#include "stdafx.h"
-
-#include "newmerger.h"
-#include "regmeta.h"
-
-
-#include "importhelper.h"
-#include "rwutil.h"
-#include "mdlog.h"
-#include <posterror.h>
-#include <sstring.h>
-#include "ndpversion.h"
-
-#ifdef FEATURE_METADATA_EMIT_ALL
-
-#define MODULEDEFTOKEN TokenFromRid(1, mdtModule)
-
-#define COR_MSCORLIB_NAME "mscorlib"
-#define COR_MSCORLIB_TYPEREF {0xb7, 0x7a, 0x5c, 0x56,0x19,0x34,0xe0,0x89}
-
-#define COR_CONSTRUCTOR_METADATA_IDENTIFIER W(".ctor")
-
-#define COR_COMPILERSERVICE_NAMESPACE "System.Runtime.CompilerServices"
-#define COR_EXCEPTIONSERVICE_NAMESPACE "System.Runtime.ExceptionServices"
-#define COR_SUPPRESS_MERGE_CHECK_ATTRIBUTE "SuppressMergeCheckAttribute"
-#define COR_HANDLE_PROCESS_CORRUPTED_STATE_EXCEPTION_ATTRIBUTE "HandleProcessCorruptedStateExceptionsAttribute"
-#define COR_MISCBITS_NAMESPACE "Microsoft.VisualC"
-#define COR_MISCBITS_ATTRIBUTE "Microsoft.VisualC.MiscellaneousBitsAttribute"
-#define COR_NATIVECPPCLASS_ATTRIBUTE "System.Runtime.CompilerServices.NativeCppClassAttribute"
-
-// MODULE_CA_LOCATION W("System.Runtime.CompilerServices.AssemblyAttributesGoHere")
-#define MODULE_CA_TYPENAME "AssemblyAttributesGoHere" // fake assembly type-ref for hanging Assembly-level CAs off of
-
-//*****************************************************************************
-// BEGIN: Security Critical Attributes and Enumeration
-//*****************************************************************************
-#define COR_SECURITYCRITICALSCOPE_ENUM_W W("System.Security.SecurityCriticalScope")
-
-#define COR_SECURITYCRITICAL_ATTRIBUTE_FULL "System.Security.SecurityCriticalAttribute"
-#define COR_SECURITYTRANSPARENT_ATTRIBUTE_FULL "System.Security.SecurityTransparentAttribute"
-#define COR_SECURITYTREATASSAFE_ATTRIBUTE_FULL "System.Security.SecurityTreatAsSafeAttribute"
-
-#define COR_SECURITYCRITICAL_ATTRIBUTE_FULL_W W("System.Security.SecurityCriticalAttribute")
-#define COR_SECURITYTRANSPARENT_ATTRIBUTE_FULL_W W("System.Security.SecurityTransparentAttribute")
-#define COR_SECURITYTREATASSAFE_ATTRIBUTE_FULL_W W("System.Security.SecurityTreatAsSafeAttribute")
-#define COR_SECURITYSAFECRITICAL_ATTRIBUTE_FULL_W W("System.Security.SecuritySafeCriticalAttribute")
-
- // definitions of enumeration for System.Security.SecurityCriticalScope (Explicit or Everything)
-#define COR_SECURITYCRITICAL_CTOR_ARGCOUNT_NO_SCOPE 0
-#define COR_SECURITYCRITICAL_CTOR_ARGCOUNT_SCOPE_EVERYTHING 1
-#define COR_SECURITYCRITICAL_CTOR_NO_SCOPE_SIG_MAX_SIZE (3)
-#define COR_SECURITYCRITICAL_CTOR_SCOPE_SIG_MAX_SIZE (5 + sizeof(mdTypeRef) * 1)
-
-#define COR_SECURITYCRITICAL_ATTRIBUTE_NAMESPACE "System.Security"
-#define COR_SECURITYCRITICAL_ATTRIBUTE "SecurityCriticalAttribute"
-#define COR_SECURITYTRANSPARENT_ATTRIBUTE_NAMESPACE "System.Security"
-#define COR_SECURITYTRANSPARENT_ATTRIBUTE "SecurityTransparentAttribute"
-#define COR_SECURITYTREATASSAFE_ATTRIBUTE_NAMESPACE "System.Security"
-#define COR_SECURITYTREATASSAFE_ATTRIBUTE "SecurityTreatAsSafeAttribute"
-#define COR_SECURITYSAFECRITICAL_ATTRIBUTE "SecuritySafeCriticalAttribute"
-
-
-#define COR_SECURITYCRITICAL_ATTRIBUTE_VALUE_EVERYTHING { 0x01, 0x00 ,0x01, 0x00, 0x00, 0x00 ,0x00, 0x00 }
-#define COR_SECURITYCRITICAL_ATTRIBUTE_VALUE_EXPLICIT {0x01, 0x00, 0x00 ,0x00}
-#define COR_SECURITYTREATASSAFE_ATTRIBUTE_VALUE {0x01, 0x00, 0x00 ,0x00}
-
-
- // if true, then registry has been read for enabling or disabling SecurityCritical support
-static BOOL g_fRefShouldMergeCriticalChecked = FALSE;
-
-// by default, security critical attributes will be merged (e.g. unmarked CRT marked Critical/TAS)
-// - unless registry config explicitly disables merging
-static BOOL g_fRefShouldMergeCritical = TRUE;
-//*****************************************************************************
-// END: Security Critical Attributes and Enumeration
-//*****************************************************************************
-
-//*****************************************************************************
-// Checks to see if the given type is managed or native. We'll key off of the
-// Custom Attribute "Microsoft.VisualC.MiscellaneousBitsAttribute". If the third
-// byte has the 01000000 bit set then it is an unmanaged type.
-// If we can't find the attribute, we will also check for the presence of the
-// "System.Runtime.CompilerServices.NativeCppClassAttribute" Custom Attribute
-// since the CPP compiler stopped emitting MiscellaneousBitsAttribute in Dev11.
-//*****************************************************************************
-HRESULT IsManagedType(CMiniMdRW* pMiniMd,
- mdTypeDef td,
- BOOL *fIsManagedType)
-{
- // First look for the custom attribute
- HENUMInternal hEnum;
- HRESULT hr = S_OK;
-
- IfFailRet(pMiniMd->CommonEnumCustomAttributeByName(td, COR_MISCBITS_ATTRIBUTE, false, &hEnum));
-
- // If there aren't any custom attributes here, then this must be a managed type
- if (hEnum.m_ulCount > 0)
- {
- // Let's loop through these, and see if any of them have that magical bit set.
- mdCustomAttribute ca;
- CustomAttributeRec *pRec;
- ULONG cbData = 0;
-
- while(HENUMInternal::EnumNext(&hEnum, &ca))
- {
- const BYTE* pData = NULL;
-
- IfFailGo(pMiniMd->GetCustomAttributeRecord(RidFromToken(ca), &pRec));
- IfFailGo(pMiniMd->getValueOfCustomAttribute(pRec, &pData, &cbData));
-
- if (pData != NULL && cbData >=3)
- {
- // See if the magical bit is set to make this an unmanaged type
- if ((*(pData+2)&0x40) > 0)
- {
- // Yes, this is an unmanaged type
- HENUMInternal::ClearEnum(&hEnum);
- *fIsManagedType = FALSE;
- return S_OK;
- }
- }
- }
-
- }
-
- HENUMInternal::ClearEnum(&hEnum);
-
- // If this was emitted by a Dev11+ CPP compiler, we only have NativeCppClassAttribute
- // so let's check for that before calling this a managed class.
- IfFailRet(pMiniMd->CommonEnumCustomAttributeByName(td, COR_NATIVECPPCLASS_ATTRIBUTE, false, &hEnum));
- if (hEnum.m_ulCount > 0)
- {
- // Yes, this is an unmanaged type
- HENUMInternal::ClearEnum(&hEnum);
- *fIsManagedType = FALSE;
- return S_OK;
- }
-
- // Nope, this isn't an unmanaged type.... must be managed
- HENUMInternal::ClearEnum(&hEnum);
- *fIsManagedType = TRUE;
- hr = S_OK;
-ErrExit:
- return hr;
-}// IsManagedType
-
-
-//*****************************************************************************
-// "Is CustomAttribute from certain namespace and assembly" check helper
-// Returns S_OK and fills **ppTypeRefRec.
-// Returns error code or S_FALSE otherwise as not found and fills **ppTypeRefRec with NULL.
-//*****************************************************************************
-HRESULT IsAttributeFromNamespace(
- CMiniMdRW *pMiniMd,
- mdToken tk,
- LPCSTR szNamespace,
- LPCSTR szAssembly,
- TypeRefRec **ppTypeRefRec)
-{
- HRESULT hr = S_OK;
- if(TypeFromToken(tk) == mdtMemberRef)
- {
- MemberRefRec *pMemRefRec;
- IfFailGo(pMiniMd->GetMemberRefRecord(RidFromToken(tk), &pMemRefRec));
- tk = pMiniMd->getClassOfMemberRef(pMemRefRec);
- }
- if(TypeFromToken(tk) == mdtTypeRef)
- {
- TypeRefRec *pTypeRefRec;
- IfFailGo(pMiniMd->GetTypeRefRecord(RidFromToken(tk), &pTypeRefRec));
- LPCSTR szTypeRefNamespace;
- IfFailGo(pMiniMd->getNamespaceOfTypeRef(pTypeRefRec, &szTypeRefNamespace));
- if (strcmp(szTypeRefNamespace, szNamespace) == 0)
- {
- mdToken tkResTmp = pMiniMd->getResolutionScopeOfTypeRef(pTypeRefRec);
- if (TypeFromToken(tkResTmp) == mdtAssemblyRef)
- {
- AssemblyRefRec *pAsmRefRec;
- IfFailGo(pMiniMd->GetAssemblyRefRecord(RidFromToken(tkResTmp), &pAsmRefRec));
- LPCSTR szAssemblyRefName;
- IfFailGo(pMiniMd->getNameOfAssemblyRef(pAsmRefRec, &szAssemblyRefName));
- if(SString::_stricmp(szAssemblyRefName, szAssembly) == 0)
- {
- *ppTypeRefRec = pTypeRefRec;
- return S_OK;
- }
- }
- }
- }
- // Record not found
- hr = S_FALSE;
-ErrExit:
- *ppTypeRefRec = NULL;
- return hr;
-}
-
-//*****************************************************************************
-// constructor
-//*****************************************************************************
-NEWMERGER::NEWMERGER()
- : m_pRegMetaEmit(0),
- m_pImportDataList(NULL),
- m_optimizeRefToDef(MDRefToDefDefault),
- m_isscsSecurityCritical(ISSCS_Unknown),
- m_isscsSecurityCriticalAllScopes(~ISSCS_Unknown)
-{
- m_pImportDataTail = &(m_pImportDataList);
-#if _DEBUG
- m_iImport = 0;
-#endif // _DEBUG
-} // NEWMERGER::NEWMERGER()
-
-//*****************************************************************************
-// initializer
-//*****************************************************************************
-HRESULT NEWMERGER::Init(RegMeta *pRegMeta)
-{
- HRESULT hr = NOERROR;
- MergeTypeData * pMTD;
-
- m_pRegMetaEmit = pRegMeta;
-
- // burn an entry so that the RID matches the array index
- IfNullGo(pMTD = m_rMTDs.Append());
-
- pMTD->m_bSuppressMergeCheck = false;
- pMTD->m_cMethods = 0;
- pMTD->m_cFields = 0;
- pMTD->m_cEvents = 0;
- pMTD->m_cProperties = 0;
-
-ErrExit:
- return hr;
-} // NEWMERGER::Init
-
-//*****************************************************************************
-// destructor
-//*****************************************************************************
-NEWMERGER::~NEWMERGER()
-{
- if (m_pImportDataList)
- {
- // delete this list and release all AddRef'ed interfaces!
- MergeImportData *pNext;
- for (pNext = m_pImportDataList; pNext != NULL; )
- {
- pNext = m_pImportDataList->m_pNextImportData;
- if (m_pImportDataList->m_pHandler)
- m_pImportDataList->m_pHandler->Release();
- if (m_pImportDataList->m_pHostMapToken)
- m_pImportDataList->m_pHostMapToken->Release();
- if (m_pImportDataList->m_pMDTokenMap)
- delete m_pImportDataList->m_pMDTokenMap;
- m_pImportDataList->m_pRegMetaImport->Release();
- delete m_pImportDataList;
- m_pImportDataList = pNext;
- }
- }
-} // NEWMERGER::~NEWMERGER
-
-//*****************************************************************************
-CMiniMdRW *NEWMERGER::GetMiniMdEmit()
-{
- return &(m_pRegMetaEmit->m_pStgdb->m_MiniMd);
-} // CMiniMdRW *NEWMERGER::GetMiniMdEmit()
-
-//*****************************************************************************
-// Adding a new import
-//*****************************************************************************
-HRESULT NEWMERGER::AddImport(
- IMetaDataImport2 *pImport, // [IN] The scope to be merged.
- IMapToken *pHostMapToken, // [IN] Host IMapToken interface to receive token remap notification
- IUnknown *pHandler) // [IN] An object to receive error notification.
-{
- HRESULT hr = NOERROR;
- MergeImportData *pData;
-
- RegMeta *pRM = static_cast<RegMeta*>(pImport);
-
- // Add a MergeImportData to track the information for this import scope
- pData = new (nothrow) MergeImportData;
- IfNullGo( pData );
- pData->m_pRegMetaImport = pRM;
- pData->m_pRegMetaImport->AddRef();
- pData->m_pHostMapToken = pHostMapToken;
- if (pData->m_pHostMapToken)
- pData->m_pHostMapToken->AddRef();
- if (pHandler)
- {
- pData->m_pHandler = pHandler;
- pData->m_pHandler->AddRef();
- }
- else
- {
- pData->m_pHandler = NULL;
- }
-
- pData->m_pMDTokenMap = NULL;
- pData->m_pNextImportData = NULL;
-#if _DEBUG
- pData->m_iImport = ++m_iImport;
-#endif // _DEBUG
-
- pData->m_tkHandleProcessCorruptedStateCtor = mdTokenNil;
- // add the newly create node to the tail of the list
- *m_pImportDataTail = pData;
- m_pImportDataTail = &(pData->m_pNextImportData);
-
-ErrExit:
-
- return hr;
-} // HRESULT NEWMERGER::AddImport()
-
-HRESULT NEWMERGER::InitMergeTypeData()
-{
- CMiniMdRW *pMiniMdEmit;
- ULONG cTypeDefRecs;
- ULONG i, j;
- bool bSuppressMergeCheck;
-
- ULONG ridStart, ridEnd;
- RID ridMap;
-
- mdToken tkSuppressMergeCheckCtor = mdTokenNil;
- mdToken tkCA;
- mdMethodDef mdEmit;
- mdFieldDef fdEmit;
- mdEvent evEmit;
- mdProperty prEmit;
-
- TypeDefRec *pTypeDefRec;
- EventMapRec *pEventMapRec;
- PropertyMapRec *pPropertyMapRec;
-
- MergeTypeData *pMTD;
-
- HRESULT hr = NOERROR;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- // cache the SuppressMergeCheckAttribute.ctor token
- ImportHelper::FindCustomAttributeCtorByName(
- pMiniMdEmit, COR_MSCORLIB_NAME,
- COR_COMPILERSERVICE_NAMESPACE, COR_SUPPRESS_MERGE_CHECK_ATTRIBUTE,
- &tkSuppressMergeCheckCtor);
-
- cTypeDefRecs = pMiniMdEmit->getCountTypeDefs();
- _ASSERTE(m_rMTDs.Count() > 0);
-
- for (i = m_rMTDs.Count(); i <= cTypeDefRecs; i++)
- {
- IfNullGo(pMTD = m_rMTDs.Append());
-
- pMTD->m_cMethods = 0;
- pMTD->m_cFields = 0;
- pMTD->m_cEvents = 0;
- pMTD->m_cProperties = 0;
- pMTD->m_bSuppressMergeCheck = (tkSuppressMergeCheckCtor != mdTokenNil) &&
- (S_OK == ImportHelper::FindCustomAttributeByToken(pMiniMdEmit,
- TokenFromRid(i, mdtTypeDef), tkSuppressMergeCheckCtor,
- NULL, 0, &tkCA));
-
- IfFailGo(pMiniMdEmit->GetTypeDefRecord(i, &pTypeDefRec));
-
- // Count the number methods
- ridStart = pMiniMdEmit->getMethodListOfTypeDef(pTypeDefRec);
- IfFailGo(pMiniMdEmit->getEndMethodListOfTypeDef(i, &ridEnd));
-
- for (j = ridStart; j < ridEnd; j++)
- {
- IfFailGo(pMiniMdEmit->GetMethodRid(j, (ULONG *)&mdEmit));
- bSuppressMergeCheck = pMTD->m_bSuppressMergeCheck ||
- ((tkSuppressMergeCheckCtor != mdTokenNil) &&
- (S_OK == ImportHelper::FindCustomAttributeByToken(pMiniMdEmit,
- mdEmit, tkSuppressMergeCheckCtor, NULL, 0, &tkCA)));
-
- if (!bSuppressMergeCheck)
- {
- pMTD->m_cMethods++;
- }
- }
-
- // Count the number fields
- ridStart = pMiniMdEmit->getFieldListOfTypeDef(pTypeDefRec);
- IfFailGo(pMiniMdEmit->getEndFieldListOfTypeDef(i, &ridEnd));
-
- for (j = ridStart; j < ridEnd; j++)
- {
- IfFailGo(pMiniMdEmit->GetFieldRid(j, (ULONG *)&fdEmit));
- bSuppressMergeCheck = pMTD->m_bSuppressMergeCheck ||
- ((tkSuppressMergeCheckCtor != mdTokenNil) &&
- (S_OK == ImportHelper::FindCustomAttributeByToken(pMiniMdEmit,
- fdEmit, tkSuppressMergeCheckCtor, NULL, 0, &tkCA)));
-
- if (!bSuppressMergeCheck)
- {
- pMTD->m_cFields++;
- }
- }
-
- // Count the number of events
- IfFailGo(pMiniMdEmit->FindEventMapFor(i, &ridMap));
- if (!InvalidRid(ridMap))
- {
- IfFailGo(pMiniMdEmit->GetEventMapRecord(ridMap, &pEventMapRec));
- ridStart = pMiniMdEmit->getEventListOfEventMap(pEventMapRec);
- IfFailGo(pMiniMdEmit->getEndEventListOfEventMap(ridMap, &ridEnd));
-
- for (j = ridStart; j < ridEnd; j++)
- {
- IfFailGo(pMiniMdEmit->GetEventRid(j, (ULONG *)&evEmit));
- bSuppressMergeCheck = pMTD->m_bSuppressMergeCheck ||
- ((tkSuppressMergeCheckCtor != mdTokenNil) &&
- (S_OK == ImportHelper::FindCustomAttributeByToken(pMiniMdEmit,
- evEmit, tkSuppressMergeCheckCtor, NULL, 0, &tkCA)));
-
- if (!bSuppressMergeCheck)
- {
- pMTD->m_cEvents++;
- }
- }
- }
-
- // Count the number of properties
- IfFailGo(pMiniMdEmit->FindPropertyMapFor(i, &ridMap));
- if (!InvalidRid(ridMap))
- {
- IfFailGo(pMiniMdEmit->GetPropertyMapRecord(ridMap, &pPropertyMapRec));
- ridStart = pMiniMdEmit->getPropertyListOfPropertyMap(pPropertyMapRec);
- IfFailGo(pMiniMdEmit->getEndPropertyListOfPropertyMap(ridMap, &ridEnd));
-
- for (j = ridStart; j < ridEnd; j++)
- {
- IfFailGo(pMiniMdEmit->GetPropertyRid(j, (ULONG *)&prEmit));
- bSuppressMergeCheck = pMTD->m_bSuppressMergeCheck ||
- ((tkSuppressMergeCheckCtor != mdTokenNil) &&
- (S_OK == ImportHelper::FindCustomAttributeByToken(pMiniMdEmit,
- prEmit, tkSuppressMergeCheckCtor, NULL, 0, &tkCA)));
-
- if (!bSuppressMergeCheck)
- {
- pMTD->m_cProperties++;
- }
- }
- }
- }
-
-ErrExit:
- return hr;
-}
-
-//*****************************************************************************
-// Merge now
-//*****************************************************************************
-HRESULT NEWMERGER::Merge(MergeFlags dwMergeFlags, CorRefToDefCheck optimizeRefToDef)
-{
- MergeImportData *pImportData = m_pImportDataList;
- MDTOKENMAP **pPrevMap = NULL;
- MDTOKENMAP *pMDTokenMap;
- HRESULT hr = NOERROR;
- MDTOKENMAP *pCurTKMap;
- int i;
-
-#if _DEBUG
- {
- LOG((LOGMD, "++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"));
- LOG((LOGMD, "Merge scope list\n"));
- i = 0;
- for (MergeImportData *pID = m_pImportDataList; pID != NULL; pID = pID->m_pNextImportData)
- {
- WCHAR szScope[1024], szGuid[40];
- GUID mvid;
- ULONG cchScope;
- pID->m_pRegMetaImport->GetScopeProps(szScope, 1024, &cchScope, &mvid);
- szScope[1023] = 0;
- GuidToLPWSTR(mvid, szGuid, 40);
- ++i; // Counter is 1-based.
- LOG((LOGMD, "%3d: %ls : %ls\n", i, szGuid, szScope));
- }
- LOG((LOGMD, "++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"));
- }
-#endif // _DEBUG
-
- m_dwMergeFlags = dwMergeFlags;
- m_optimizeRefToDef = optimizeRefToDef;
-
- // check to see if we need to do dup check
- m_fDupCheck = ((m_dwMergeFlags & NoDupCheck) != NoDupCheck);
-
- while (pImportData)
- {
- // Verify that we have a filter for each import scope.
- IfNullGo( pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd.GetFilterTable() );
-
- // cache the SuppressMergeCheckAttribute.ctor token for each import scope
- ImportHelper::FindCustomAttributeCtorByName(
- &pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd, COR_MSCORLIB_NAME,
- COR_COMPILERSERVICE_NAMESPACE, COR_SUPPRESS_MERGE_CHECK_ATTRIBUTE,
- &pImportData->m_tkSuppressMergeCheckCtor);
-
- // cache the HandleProcessCorruptedStateExceptionsAttribute.ctor token for each import scope
- ImportHelper::FindCustomAttributeCtorByName(
- &pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd, COR_MSCORLIB_NAME,
- COR_EXCEPTIONSERVICE_NAMESPACE, COR_HANDLE_PROCESS_CORRUPTED_STATE_EXCEPTION_ATTRIBUTE,
- &pImportData->m_tkHandleProcessCorruptedStateCtor);
-
- // check for security critical attribute in the assembly (i.e. explicit annotations)
- InputScopeSecurityCriticalStatus isscsTemp = CheckInputScopeIsCritical(pImportData, hr);
- IfFailGo(hr);
- // clear the unset flag bits (e.g. if critical, clear transparent bit)
- // whatever bits remain are bits that have been set in all scopes
- if (ISSCS_Unknown == (isscsTemp & ISSCS_SECURITYCRITICAL_FLAGS))
- m_isscsSecurityCriticalAllScopes &= ISSCS_SECURITYCRITICAL_LEGACY;
- else
- m_isscsSecurityCriticalAllScopes &= isscsTemp;
- // set the flag bits (essentially, this allows us to see if _any_ scopes requested a bit)
- m_isscsSecurityCritical |= isscsTemp;
-
- // create the tokenmap class to track metadata token remap for each import scope
- pMDTokenMap = new (nothrow) MDTOKENMAP;
- IfNullGo(pMDTokenMap);
- IfFailGo(pMDTokenMap->Init((IMetaDataImport2*)pImportData->m_pRegMetaImport));
- pImportData->m_pMDTokenMap = pMDTokenMap;
- pImportData->m_pMDTokenMap->m_pMap = pImportData->m_pHostMapToken;
- if (pImportData->m_pHostMapToken)
- pImportData->m_pHostMapToken->AddRef();
- pImportData->m_pMDTokenMap->m_pNextMap = NULL;
- if (pPrevMap)
- *pPrevMap = pImportData->m_pMDTokenMap;
- pPrevMap = &(pImportData->m_pMDTokenMap->m_pNextMap);
- pImportData = pImportData->m_pNextImportData;
- }
-
- // Populate the m_rMTDs with the type info already defined in the emit scope
- IfFailGo( InitMergeTypeData() );
-
- // 1. Merge Module
- IfFailGo( MergeModule( ) );
-
- // 2. Merge TypeDef partially (i.e. only name)
- IfFailGo( MergeTypeDefNamesOnly() );
-
- // 3. Merge ModuleRef property and do ModuleRef to ModuleDef optimization
- IfFailGo( MergeModuleRefs() );
-
- // 4. Merge AssemblyRef.
- IfFailGo( MergeAssemblyRefs() );
-
- // 5. Merge TypeRef with TypeRef to TypeDef optimization
- IfFailGo( MergeTypeRefs() );
-
- // 6. Merge TypeSpec & MethodSpec
- IfFailGo( MergeTypeSpecs() );
-
- // 7. Now Merge the remaining of TypeDef records
- IfFailGo( CompleteMergeTypeDefs() );
-
- // 8. Merge Methods and Fields. Such that Signature translation is respecting the TypeRef to TypeDef optimization.
- IfFailGo( MergeTypeDefChildren() );
-
- // 9. Merge MemberRef with MemberRef to MethodDef/FieldDef optimization
- IfFailGo( MergeMemberRefs( ) );
-
- // 10. Merge InterfaceImpl
- IfFailGo( MergeInterfaceImpls( ) );
-
- // merge all of the remaining in metadata ....
-
- // 11. constant has dependency on property, field, param
- IfFailGo( MergeConstants() );
-
- // 12. field marshal has dependency on param and field
- IfFailGo( MergeFieldMarshals() );
-
- // 13. in ClassLayout, move over the FieldLayout and deal with FieldLayout as well
- IfFailGo( MergeClassLayouts() );
-
- // 14. FieldLayout has dependency on FieldDef.
- IfFailGo( MergeFieldLayouts() );
-
- // 15. FieldRVA has dependency on FieldDef.
- IfFailGo( MergeFieldRVAs() );
-
- // 16. MethodImpl has dependency on MemberRef, MethodDef, TypeRef and TypeDef.
- IfFailGo( MergeMethodImpls() );
-
- // 17. pinvoke depends on MethodDef and ModuleRef
- IfFailGo( MergePinvoke() );
-
- IfFailGo( MergeStandAloneSigs() );
-
- IfFailGo( MergeMethodSpecs() );
-
- IfFailGo( MergeStrings() );
-
- if (m_dwMergeFlags & MergeManifest)
- {
- // keep the manifest!!
- IfFailGo( MergeAssembly() );
- IfFailGo( MergeFiles() );
- IfFailGo( MergeExportedTypes() );
- IfFailGo( MergeManifestResources() );
- }
- else if (m_dwMergeFlags & ::MergeExportedTypes)
- {
- IfFailGo( MergeFiles() );
- IfFailGo( MergeExportedTypes() );
- }
-
- IfFailGo( MergeCustomAttributes() );
- IfFailGo( MergeDeclSecuritys() );
-
-
- // Please don't add any MergeXxx() below here. CustomAttributess must be
- // very late, because custom values are various other types.
-
- // Fixup list cannot be merged. Linker will need to re-emit them.
-
- // Now call back to host for the result of token remap
- //
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // Send token remap information for each import scope
- pCurTKMap = pImportData->m_pMDTokenMap;
- TOKENREC *pRec;
- if (pImportData->m_pHostMapToken)
- {
- for (i = 0; i < pCurTKMap->Count(); i++)
- {
- pRec = pCurTKMap->Get(i);
- if (!pRec->IsEmpty())
- pImportData->m_pHostMapToken->Map(pRec->m_tkFrom, pRec->m_tkTo);
- }
- }
- }
-
- // And last, but not least, let's do Security critical module-level attribute consolidation
- // and metadata fixups.
- IfFailGo( MergeSecurityCriticalAttributes() );
-
-
-
-
-
-#if _DEBUG
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // dump the mapping
- LOG((LOGMD, "++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"));
- LOG((LOGMD, "Dumping token remap for one import scope!\n"));
- LOG((LOGMD, "This is the %d import scope for merge!\n", pImportData->m_iImport));
-
- pCurTKMap = pImportData->m_pMDTokenMap;
- TOKENREC *pRec;
- for (i = 0; i < pCurTKMap->Count(); i++)
- {
- pRec = pCurTKMap->Get(i);
- if (!pRec->IsEmpty())
- {
- LOG((LOGMD, " Token 0x%08x ====>>>> Token 0x%08x\n", pRec->m_tkFrom, pRec->m_tkTo));
- }
- }
- LOG((LOGMD, "End dumping token remap!\n"));
- LOG((LOGMD, "++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"));
- }
-#endif // _DEBUG
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::Merge()
-
-
-//*****************************************************************************
-// Merge ModuleDef
-//*****************************************************************************
-HRESULT NEWMERGER::MergeModule()
-{
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
- HRESULT hr = NOERROR;
- TOKENREC *pTokenRec;
-
- // we don't really merge Module information but we create a one to one mapping for each module token into the TokenMap
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- // set the current MDTokenMap
-
- pCurTkMap = pImportData->m_pMDTokenMap;
- IfFailGo( pCurTkMap->InsertNotFound(MODULEDEFTOKEN, true, MODULEDEFTOKEN, &pTokenRec) );
- }
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeModule()
-
-
-//*****************************************************************************
-// Merge TypeDef but only Names. This is a partial merge to support TypeRef to TypeDef optimization
-//*****************************************************************************
-HRESULT NEWMERGER::MergeTypeDefNamesOnly()
-{
- HRESULT hr = NOERROR;
- TypeDefRec *pRecImport = NULL;
- TypeDefRec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG iCount;
- ULONG i;
- mdTypeDef tdEmit;
- mdTypeDef tdImport;
- bool bDuplicate;
- DWORD dwFlags;
- DWORD dwExportFlags;
- NestedClassRec *pNestedRec;
- RID iNestedRec;
- mdTypeDef tdNester;
- TOKENREC *pTokenRec;
-
- LPCUTF8 szNameImp;
- LPCUTF8 szNamespaceImp;
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- MergeTypeData *pMTD;
- BOOL bSuppressMergeCheck;
- mdCustomAttribute tkCA;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- iCount = pMiniMdImport->getCountTypeDefs();
-
- // Merge the typedefs
- for (i = 1; i <= iCount; i++)
- {
- // only merge those TypeDefs that are marked
- if ( pMiniMdImport->GetFilterTable()->IsTypeDefMarked(TokenFromRid(i, mdtTypeDef)) == false)
- continue;
-
- // compare it with the emit scope
- IfFailGo(pMiniMdImport->GetTypeDefRecord(i, &pRecImport));
- IfFailGo(pMiniMdImport->getNameOfTypeDef(pRecImport, &szNameImp));
- IfFailGo(pMiniMdImport->getNamespaceOfTypeDef(pRecImport, &szNamespaceImp));
-
- // If the class is a Nested class, get the parent token.
- dwFlags = pMiniMdImport->getFlagsOfTypeDef(pRecImport);
- if (IsTdNested(dwFlags))
- {
- IfFailGo(pMiniMdImport->FindNestedClassHelper(TokenFromRid(i, mdtTypeDef), &iNestedRec));
- if (InvalidRid(iNestedRec))
- {
- _ASSERTE(!"Bad state!");
- IfFailGo(META_E_BADMETADATA);
- }
- else
- {
- IfFailGo(pMiniMdImport->GetNestedClassRecord(iNestedRec, &pNestedRec));
- tdNester = pMiniMdImport->getEnclosingClassOfNestedClass(pNestedRec);
- _ASSERTE(!IsNilToken(tdNester));
- IfFailGo(pCurTkMap->Remap(tdNester, &tdNester));
- }
- }
- else
- tdNester = mdTokenNil;
-
- bSuppressMergeCheck = (pImportData->m_tkSuppressMergeCheckCtor != mdTokenNil) &&
- (S_OK == ImportHelper::FindCustomAttributeByToken(pMiniMdImport,
- TokenFromRid(i, mdtTypeDef), pImportData->m_tkSuppressMergeCheckCtor,
- NULL, 0, &tkCA));
-
- // does this TypeDef already exist in the emit scope?
- if ( ImportHelper::FindTypeDefByName(
- pMiniMdEmit,
- szNamespaceImp,
- szNameImp,
- tdNester,
- &tdEmit) == S_OK )
- {
- // Yes, it does
- bDuplicate = true;
-
- // Let's look at their accessiblities.
- IfFailGo(pMiniMdEmit->GetTypeDefRecord(RidFromToken(tdEmit), &pRecEmit));
- dwExportFlags = pMiniMdEmit->getFlagsOfTypeDef(pRecEmit);
-
- // Managed types need to have the same accessiblity
- BOOL fManagedType = FALSE;
- IfFailGo(IsManagedType(pMiniMdImport, TokenFromRid(i, mdtTypeDef), &fManagedType));
- if (fManagedType)
- {
- if ((dwFlags&tdVisibilityMask) != (dwExportFlags&tdVisibilityMask))
- {
- CheckContinuableErrorEx(META_E_MISMATCHED_VISIBLITY, pImportData, TokenFromRid(i, mdtTypeDef));
- }
-
- }
- pMTD = m_rMTDs.Get(RidFromToken(tdEmit));
- if (pMTD->m_bSuppressMergeCheck != bSuppressMergeCheck)
- {
- CheckContinuableErrorEx(META_E_MD_INCONSISTENCY, pImportData, TokenFromRid(i, mdtTypeDef));
- }
- }
- else
- {
- // No, it doesn't. Copy it over.
- bDuplicate = false;
- IfFailGo(pMiniMdEmit->AddTypeDefRecord(&pRecEmit, (RID *)&tdEmit));
-
- // make sure the index matches
- _ASSERTE(((mdTypeDef)m_rMTDs.Count()) == tdEmit);
-
- IfNullGo(pMTD = m_rMTDs.Append());
-
- pMTD->m_cMethods = 0;
- pMTD->m_cFields = 0;
- pMTD->m_cEvents = 0;
- pMTD->m_cProperties = 0;
- pMTD->m_bSuppressMergeCheck = bSuppressMergeCheck;
-
- tdEmit = TokenFromRid( tdEmit, mdtTypeDef );
-
- // Set Full Qualified Name.
- IfFailGo( CopyTypeDefPartially( pRecEmit, pMiniMdImport, pRecImport) );
-
- // Create a NestedClass record if the class is a Nested class.
- if (! IsNilToken(tdNester))
- {
- IfFailGo(pMiniMdEmit->AddNestedClassRecord(&pNestedRec, &iNestedRec));
-
- // copy over the information
- IfFailGo( pMiniMdEmit->PutToken(TBL_NestedClass, NestedClassRec::COL_NestedClass,
- pNestedRec, tdEmit));
-
- // tdNester has already been remapped above to the Emit scope.
- IfFailGo( pMiniMdEmit->PutToken(TBL_NestedClass, NestedClassRec::COL_EnclosingClass,
- pNestedRec, tdNester));
- IfFailGo( pMiniMdEmit->AddNestedClassToHash(iNestedRec) );
-
- }
- }
-
- // record the token movement
- tdImport = TokenFromRid(i, mdtTypeDef);
- IfFailGo( pCurTkMap->InsertNotFound(tdImport, bDuplicate, tdEmit, &pTokenRec) );
- }
- }
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeTypeDefNamesOnly()
-
-
-//*****************************************************************************
-// Merge EnclosingType tables
-//*****************************************************************************
-HRESULT NEWMERGER::CopyTypeDefPartially(
- TypeDefRec *pRecEmit, // [IN] the emit record to fill
- CMiniMdRW *pMiniMdImport, // [IN] the importing scope
- TypeDefRec *pRecImp) // [IN] the record to import
-
-{
- HRESULT hr;
- LPCUTF8 szNameImp;
- LPCUTF8 szNamespaceImp;
- CMiniMdRW *pMiniMdEmit = GetMiniMdEmit();
-
- IfFailGo(pMiniMdImport->getNameOfTypeDef(pRecImp, &szNameImp));
- IfFailGo(pMiniMdImport->getNamespaceOfTypeDef(pRecImp, &szNamespaceImp));
-
- IfFailGo( pMiniMdEmit->PutString( TBL_TypeDef, TypeDefRec::COL_Name, pRecEmit, szNameImp) );
- IfFailGo( pMiniMdEmit->PutString( TBL_TypeDef, TypeDefRec::COL_Namespace, pRecEmit, szNamespaceImp) );
-
- pRecEmit->SetFlags(pRecImp->GetFlags());
-
- // Don't copy over the extends until TypeRef's remap is calculated
-
-ErrExit:
- return hr;
-
-} // HRESULT NEWMERGER::CopyTypeDefPartially()
-
-
-//*****************************************************************************
-// Merge ModuleRef tables including ModuleRef to ModuleDef optimization
-//*****************************************************************************
-HRESULT NEWMERGER::MergeModuleRefs()
-{
- HRESULT hr = NOERROR;
- ModuleRefRec *pRecImport = NULL;
- ModuleRefRec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG iCount;
- ULONG i;
- mdModuleRef mrEmit;
- bool bDuplicate = false;
- TOKENREC *pTokenRec;
- LPCUTF8 szNameImp;
- bool isModuleDef;
-
- MergeImportData *pImportData;
- MergeImportData *pData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
- iCount = pMiniMdImport->getCountModuleRefs();
-
- // loop through all ModuleRef
- for (i = 1; i <= iCount; i++)
- {
- // only merge those ModuleRefs that are marked
- if ( pMiniMdImport->GetFilterTable()->IsModuleRefMarked(TokenFromRid(i, mdtModuleRef)) == false)
- continue;
-
- isModuleDef = false;
-
- // compare it with the emit scope
- IfFailGo(pMiniMdImport->GetModuleRefRecord(i, &pRecImport));
- IfFailGo(pMiniMdImport->getNameOfModuleRef(pRecImport, &szNameImp));
-
- // Only do the ModuleRef to ModuleDef optimization if ModuleRef's name is meaningful!
- if ( szNameImp && szNameImp[0] != '\0')
- {
-
- // Check to see if this ModuleRef has become the ModuleDef token
- for (pData = m_pImportDataList; pData != NULL; pData = pData->m_pNextImportData)
- {
- CMiniMdRW *pMiniMd = &(pData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- ModuleRec *pRec;
- LPCUTF8 szName;
-
- IfFailGo(pMiniMd->GetModuleRecord(MODULEDEFTOKEN, &pRec));
- IfFailGo(pMiniMd->getNameOfModule(pRec, &szName));
- if (szName && szName[0] != '\0' && strcmp(szNameImp, szName) == 0)
- {
- // We found an import Module for merging that has the same name as the ModuleRef
- isModuleDef = true;
- bDuplicate = true;
- mrEmit = MODULEDEFTOKEN; // set the resulting token to ModuleDef Token
- break;
- }
- }
- }
-
- if (isModuleDef == false)
- {
- // does this ModuleRef already exist in the emit scope?
- hr = ImportHelper::FindModuleRef(pMiniMdEmit,
- szNameImp,
- &mrEmit);
- if (hr == S_OK)
- {
- // Yes, it does
- bDuplicate = true;
- }
- else if (hr == CLDB_E_RECORD_NOTFOUND)
- {
- // No, it doesn't. Copy it over.
- bDuplicate = false;
- IfFailGo(pMiniMdEmit->AddModuleRefRecord(&pRecEmit, (RID*)&mrEmit));
- mrEmit = TokenFromRid(mrEmit, mdtModuleRef);
-
- // Set ModuleRef Name.
- IfFailGo( pMiniMdEmit->PutString(TBL_ModuleRef, ModuleRefRec::COL_Name, pRecEmit, szNameImp) );
- }
- else
- IfFailGo(hr);
- }
-
- // record the token movement
- IfFailGo( pCurTkMap->InsertNotFound(
- TokenFromRid(i, mdtModuleRef),
- bDuplicate,
- mrEmit,
- &pTokenRec) );
- }
- }
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeModuleRefs()
-
-
-//*****************************************************************************
-// Merge AssemblyRef tables
-//*****************************************************************************
-HRESULT NEWMERGER::MergeAssemblyRefs()
-{
- HRESULT hr = NOERROR;
- AssemblyRefRec *pRecImport = NULL;
- AssemblyRefRec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- mdAssemblyRef arEmit;
- bool bDuplicate = false;
- LPCUTF8 szTmp;
- const void *pbTmp;
- ULONG cbTmp;
- ULONG iCount;
- ULONG i;
- ULONG iRecord;
- TOKENREC *pTokenRec;
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
- iCount = pMiniMdImport->getCountAssemblyRefs();
-
- // loope through all the AssemblyRefs.
- for (i = 1; i <= iCount; i++)
- {
- // Compare with the emit scope.
- IfFailGo(pMiniMdImport->GetAssemblyRefRecord(i, &pRecImport));
- IfFailGo(pMiniMdImport->getPublicKeyOrTokenOfAssemblyRef(pRecImport, (const BYTE **)&pbTmp, &cbTmp));
- hr = CLDB_E_RECORD_NOTFOUND;
- if (m_fDupCheck)
- {
- LPCSTR szAssemblyRefName;
- LPCSTR szAssemblyRefLocale;
- IfFailGo(pMiniMdImport->getNameOfAssemblyRef(pRecImport, &szAssemblyRefName));
- IfFailGo(pMiniMdImport->getLocaleOfAssemblyRef(pRecImport, &szAssemblyRefLocale));
- hr = ImportHelper::FindAssemblyRef(
- pMiniMdEmit,
- szAssemblyRefName,
- szAssemblyRefLocale,
- pbTmp,
- cbTmp,
- pRecImport->GetMajorVersion(),
- pRecImport->GetMinorVersion(),
- pRecImport->GetBuildNumber(),
- pRecImport->GetRevisionNumber(),
- pRecImport->GetFlags(),
- &arEmit);
- }
- if (hr == S_OK)
- {
- // Yes, it does
- bDuplicate = true;
-
- // <TODO>@FUTURE: more verification?</TODO>
- }
- else if (hr == CLDB_E_RECORD_NOTFOUND)
- {
- // No, it doesn't. Copy it over.
- bDuplicate = false;
- IfFailGo(pMiniMdEmit->AddAssemblyRefRecord(&pRecEmit, &iRecord));
- arEmit = TokenFromRid(iRecord, mdtAssemblyRef);
-
- pRecEmit->Copy(pRecImport);
-
- IfFailGo(pMiniMdImport->getPublicKeyOrTokenOfAssemblyRef(pRecImport, (const BYTE **)&pbTmp, &cbTmp));
- IfFailGo(pMiniMdEmit->PutBlob(TBL_AssemblyRef, AssemblyRefRec::COL_PublicKeyOrToken,
- pRecEmit, pbTmp, cbTmp));
-
- IfFailGo(pMiniMdImport->getNameOfAssemblyRef(pRecImport, &szTmp));
- IfFailGo(pMiniMdEmit->PutString(TBL_AssemblyRef, AssemblyRefRec::COL_Name,
- pRecEmit, szTmp));
-
- IfFailGo(pMiniMdImport->getLocaleOfAssemblyRef(pRecImport, &szTmp));
- IfFailGo(pMiniMdEmit->PutString(TBL_AssemblyRef, AssemblyRefRec::COL_Locale,
- pRecEmit, szTmp));
-
- IfFailGo(pMiniMdImport->getHashValueOfAssemblyRef(pRecImport, (const BYTE **)&pbTmp, &cbTmp));
- IfFailGo(pMiniMdEmit->PutBlob(TBL_AssemblyRef, AssemblyRefRec::COL_HashValue,
- pRecEmit, pbTmp, cbTmp));
-
- }
- else
- IfFailGo(hr);
-
- // record the token movement.
- IfFailGo(pCurTkMap->InsertNotFound(
- TokenFromRid(i, mdtAssemblyRef),
- bDuplicate,
- arEmit,
- &pTokenRec));
- }
- }
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeAssemblyRefs()
-
-
-//*****************************************************************************
-// Merge TypeRef tables also performing TypeRef to TypeDef opitimization. ie.
-// we will not introduce a TypeRef record if we can optimize it to a TypeDef.
-//*****************************************************************************
-HRESULT NEWMERGER::MergeTypeRefs()
-{
- HRESULT hr = NOERROR;
- TypeRefRec *pRecImport = NULL;
- TypeRefRec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG iCount;
- ULONG i;
- mdTypeRef trEmit;
- bool bDuplicate = false;
- TOKENREC *pTokenRec;
- bool isTypeDef;
-
- mdToken tkResImp;
- mdToken tkResEmit;
- LPCUTF8 szNameImp;
- LPCUTF8 szNamespaceImp;
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
- iCount = pMiniMdImport->getCountTypeRefs();
-
- // loop through all TypeRef
- for (i = 1; i <= iCount; i++)
- {
- // only merge those TypeRefs that are marked
- if ( pMiniMdImport->GetFilterTable()->IsTypeRefMarked(TokenFromRid(i, mdtTypeRef)) == false)
- continue;
-
- isTypeDef = false;
-
- // compare it with the emit scope
- IfFailGo(pMiniMdImport->GetTypeRefRecord(i, &pRecImport));
- tkResImp = pMiniMdImport->getResolutionScopeOfTypeRef(pRecImport);
- IfFailGo(pMiniMdImport->getNamespaceOfTypeRef(pRecImport, &szNamespaceImp));
- IfFailGo(pMiniMdImport->getNameOfTypeRef(pRecImport, &szNameImp));
- if (!IsNilToken(tkResImp))
- {
- IfFailGo(pCurTkMap->Remap(tkResImp, &tkResEmit));
- }
- else
- {
- tkResEmit = tkResImp;
- }
-
- // There are some interesting cases to consider here.
- // 1) If the TypeRef's ResolutionScope is a nil token, or is the MODULEDEFTOKEN (current module),
- // then the TypeRef refers to a type in the current scope, so we should find a corresponding
- // TypeDef in the output scope. If we find the TypeDef, we'll remap this TypeRef token
- // to that TypeDef token.
- // If we don't find that TypeDef, or if "TypeRef to TypeDef" optimization is turned off, we'll
- // create the TypeRef in the output scope.
- // 2) If the TypeRef's ResolutionScope has been resolved to a TypeDef, then this TypeRef was part
- // of a nested type definition. In that case, we'd better find a corresponding TypeDef
- // or we have an error.
- if (IsNilToken(tkResEmit) || tkResEmit == MODULEDEFTOKEN || TypeFromToken(tkResEmit) == mdtTypeDef)
- {
- hr = ImportHelper::FindTypeDefByName(
- pMiniMdEmit,
- szNamespaceImp,
- szNameImp,
- (TypeFromToken(tkResEmit) == mdtTypeDef) ? tkResEmit : mdTokenNil,
- &trEmit);
- if (hr == S_OK)
- {
- isTypeDef = true;
-
- // it really does not matter if we set the duplicate to true or false.
- bDuplicate = true;
- }
- }
-
- // If the ResolutionScope was merged as a TypeDef, and this token wasn't found as TypeDef, send the error.
- if (TypeFromToken(tkResEmit) == mdtTypeDef && !isTypeDef)
- {
- // Send the error notification. Use the "continuable error" callback, but even if linker says it is
- // ok, don't continue.
- CheckContinuableErrorEx(META_E_TYPEDEF_MISSING, pImportData, TokenFromRid(i, mdtTypeRef));
- IfFailGo(META_E_TYPEDEF_MISSING);
- }
-
- // If this TypeRef cannot be optmized to a TypeDef or the Ref to Def optimization is turned off, do the following.
- if (!isTypeDef || !((m_optimizeRefToDef & MDTypeRefToDef) == MDTypeRefToDef))
- {
- // does this TypeRef already exist in the emit scope?
- if ( m_fDupCheck && ImportHelper::FindTypeRefByName(
- pMiniMdEmit,
- tkResEmit,
- szNamespaceImp,
- szNameImp,
- &trEmit) == S_OK )
- {
- // Yes, it does
- bDuplicate = true;
- }
- else
- {
- // No, it doesn't. Copy it over.
- bDuplicate = false;
- IfFailGo(pMiniMdEmit->AddTypeRefRecord(&pRecEmit, (RID*)&trEmit));
- trEmit = TokenFromRid(trEmit, mdtTypeRef);
-
- // Set ResolutionScope. tkResEmit has already been re-mapped.
- IfFailGo(pMiniMdEmit->PutToken(TBL_TypeRef, TypeRefRec::COL_ResolutionScope,
- pRecEmit, tkResEmit));
-
- // Set Name.
- IfFailGo(pMiniMdEmit->PutString(TBL_TypeRef, TypeRefRec::COL_Name,
- pRecEmit, szNameImp));
- IfFailGo(pMiniMdEmit->AddNamedItemToHash(TBL_TypeRef, trEmit, szNameImp, 0));
-
- // Set Namespace.
- IfFailGo(pMiniMdEmit->PutString(TBL_TypeRef, TypeRefRec::COL_Namespace,
- pRecEmit, szNamespaceImp));
- }
- }
-
- // record the token movement
- IfFailGo( pCurTkMap->InsertNotFound(
- TokenFromRid(i, mdtTypeRef),
- bDuplicate,
- trEmit,
- &pTokenRec) );
- }
- }
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeTypeRefs()
-
-
-//*****************************************************************************
-// copy over the remaining information of partially merged TypeDef records. Right now only
-// extends field is delayed to here. The reason that we delay extends field is because we want
-// to optimize TypeRef to TypeDef if possible.
-//*****************************************************************************
-HRESULT NEWMERGER::CompleteMergeTypeDefs()
-{
- HRESULT hr = NOERROR;
- TypeDefRec *pRecImport = NULL;
- TypeDefRec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG iCount;
- ULONG i;
- TOKENREC *pTokenRec;
- mdToken tkExtendsImp;
- mdToken tkExtendsEmit;
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- iCount = pMiniMdImport->getCountTypeDefs();
-
- // Merge the typedefs
- for (i = 1; i <= iCount; i++)
- {
- // only merge those TypeDefs that are marked
- if ( pMiniMdImport->GetFilterTable()->IsTypeDefMarked(TokenFromRid(i, mdtTypeDef)) == false)
- continue;
-
- if ( !pCurTkMap->Find(TokenFromRid(i, mdtTypeDef), &pTokenRec) )
- {
- _ASSERTE( !"bad state!");
- IfFailGo( META_E_BADMETADATA );
- }
-
- if (pTokenRec->m_isDuplicate == false)
- {
- // get the extends token from the import
- IfFailGo(pMiniMdImport->GetTypeDefRecord(i, &pRecImport));
- tkExtendsImp = pMiniMdImport->getExtendsOfTypeDef(pRecImport);
-
- // map the extends token to an merged token
- IfFailGo( pCurTkMap->Remap(tkExtendsImp, &tkExtendsEmit) );
-
- // set the extends to the merged TypeDef records.
- IfFailGo(pMiniMdEmit->GetTypeDefRecord(RidFromToken(pTokenRec->m_tkTo), &pRecEmit));
- IfFailGo(pMiniMdEmit->PutToken(TBL_TypeDef, TypeDefRec::COL_Extends, pRecEmit, tkExtendsEmit));
- }
- else
- {
- // <TODO>@FUTURE: we can check to make sure the import extends maps to the one that is set to the emit scope.
- // Otherwise, it is a error to report to linker.</TODO>
- }
- }
- }
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::CompleteMergeTypeDefs()
-
-
-//*****************************************************************************
-// merging TypeSpecs
-//*****************************************************************************
-HRESULT NEWMERGER::MergeTypeSpecs()
-{
- HRESULT hr = NOERROR;
- TypeSpecRec *pRecImport = NULL;
- TypeSpecRec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG iCount;
- ULONG i;
- TOKENREC *pTokenRec;
- mdTypeSpec tsImp;
- mdTypeSpec tsEmit;
- bool fDuplicate;
- PCCOR_SIGNATURE pbSig;
- ULONG cbSig;
- ULONG cbEmit;
- CQuickBytes qbSig;
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- iCount = pMiniMdImport->getCountTypeSpecs();
-
- // loop through all TypeSpec
- for (i = 1; i <= iCount; i++)
- {
- // only merge those TypeSpecs that are marked
- if ( pMiniMdImport->GetFilterTable()->IsTypeSpecMarked(TokenFromRid(i, mdtTypeSpec)) == false)
- continue;
-
- // compare it with the emit scope
- IfFailGo(pMiniMdImport->GetTypeSpecRecord(i, &pRecImport));
- IfFailGo(pMiniMdImport->getSignatureOfTypeSpec(pRecImport, &pbSig, &cbSig));
-
- // convert tokens contained in signature to new scope
- IfFailGo(ImportHelper::MergeUpdateTokenInFieldSig(
- NULL, // Assembly emit scope.
- pMiniMdEmit, // The emit scope.
- NULL, NULL, 0, // Import assembly information.
- pMiniMdImport, // The scope to merge into the emit scope.
- pbSig, // signature from the imported scope
- pCurTkMap, // Internal token mapping structure.
- &qbSig, // [OUT] translated signature
- 0, // start from first byte of the signature
- 0, // don't care how many bytes consumed
- &cbEmit)); // number of bytes write to cbEmit
-
- hr = CLDB_E_RECORD_NOTFOUND;
- if (m_fDupCheck)
- hr = ImportHelper::FindTypeSpec(
- pMiniMdEmit,
- (PCOR_SIGNATURE) qbSig.Ptr(),
- cbEmit,
- &tsEmit );
-
- if ( hr == S_OK )
- {
- // find a duplicate
- fDuplicate = true;
- }
- else
- {
- // copy over
- fDuplicate = false;
- IfFailGo(pMiniMdEmit->AddTypeSpecRecord(&pRecEmit, (ULONG *)&tsEmit));
- tsEmit = TokenFromRid(tsEmit, mdtTypeSpec);
- IfFailGo( pMiniMdEmit->PutBlob(
- TBL_TypeSpec,
- TypeSpecRec::COL_Signature,
- pRecEmit,
- (PCOR_SIGNATURE)qbSig.Ptr(),
- cbEmit));
- }
- tsImp = TokenFromRid(i, mdtTypeSpec);
-
- // Record the token movement
- IfFailGo( pCurTkMap->InsertNotFound(tsImp, fDuplicate, tsEmit, &pTokenRec) );
- }
- }
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeTypeSpecs()
-
-
-//*****************************************************************************
-// merging Children of TypeDefs. This includes field, method, parameter, property, event
-//*****************************************************************************
-HRESULT NEWMERGER::MergeTypeDefChildren()
-{
- HRESULT hr = NOERROR;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG iCount;
- ULONG i;
- mdTypeDef tdEmit;
- mdTypeDef tdImport;
- TOKENREC *pTokenRec;
-
-#if _DEBUG
- TypeDefRec *pRecImport = NULL;
- LPCUTF8 szNameImp;
- LPCUTF8 szNamespaceImp;
-#endif // _DEBUG
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
- iCount = pMiniMdImport->getCountTypeDefs();
-
- // loop through all TypeDef again to merge/copy Methods, fields, events, and properties
- //
- for (i = 1; i <= iCount; i++)
- {
- // only merge those TypeDefs that are marked
- if ( pMiniMdImport->GetFilterTable()->IsTypeDefMarked(TokenFromRid(i, mdtTypeDef)) == false)
- continue;
-
-#if _DEBUG
- IfFailGo(pMiniMdImport->GetTypeDefRecord(i, &pRecImport));
- IfFailGo(pMiniMdImport->getNameOfTypeDef(pRecImport, &szNameImp));
- IfFailGo(pMiniMdImport->getNamespaceOfTypeDef(pRecImport, &szNamespaceImp));
-#endif // _DEBUG
-
- // check to see if the typedef is duplicate or not
- tdImport = TokenFromRid(i, mdtTypeDef);
- if ( pCurTkMap->Find( tdImport, &pTokenRec) == false)
- {
- _ASSERTE( !"bad state!");
- IfFailGo( META_E_BADMETADATA );
- }
- tdEmit = pTokenRec->m_tkTo;
- if (pTokenRec->m_isDuplicate == false)
- {
- // now move all of the children records over
- IfFailGo( CopyMethods(pImportData, tdImport, tdEmit) );
- IfFailGo( CopyFields(pImportData, tdImport, tdEmit) );
-
- IfFailGo( CopyEvents(pImportData, tdImport, tdEmit) );
-
- // Property has dependency on events
- IfFailGo( CopyProperties(pImportData, tdImport, tdEmit) );
-
- // Generic Params.
- IfFailGo( CopyGenericParams(pImportData, tdImport, tdEmit) );
- }
- else
- {
- // verify the children records
- IfFailGo( VerifyMethods(pImportData, tdImport, tdEmit) );
- IfFailGo( VerifyFields(pImportData, tdImport, tdEmit) );
- IfFailGo( VerifyEvents(pImportData, tdImport, tdEmit) );
-
- // property has dependency on events
- IfFailGo( VerifyProperties(pImportData, tdImport, tdEmit) );
-
- IfFailGo( VerifyGenericParams(pImportData, tdImport, tdEmit) );
- }
- }
- }
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeTypeDefChildren()
-
-
-//*******************************************************************************
-// Helper to copy an Method record
-//*******************************************************************************
-HRESULT NEWMERGER::CopyMethod(
- MergeImportData *pImportData, // [IN] import scope
- MethodRec *pRecImp, // [IN] the record to import
- MethodRec *pRecEmit) // [IN] the emit record to fill
-{
- HRESULT hr;
- CMiniMdRW *pMiniMdImp = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- CMiniMdRW *pMiniMdEmit = GetMiniMdEmit();
- LPCUTF8 szName;
- PCCOR_SIGNATURE pbSig;
- ULONG cbSig;
- ULONG cbEmit;
- CQuickBytes qbSig;
- MDTOKENMAP *pCurTkMap;
-
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- // copy over the fix part of the record
- pRecEmit->Copy(pRecImp);
-
- // copy over the name
- IfFailGo(pMiniMdImp->getNameOfMethod(pRecImp, &szName));
- IfFailGo(pMiniMdEmit->PutString(TBL_Method, MethodRec::COL_Name, pRecEmit, szName));
-
- // copy over the signature
- IfFailGo(pMiniMdImp->getSignatureOfMethod(pRecImp, &pbSig, &cbSig));
-
- // convert rid contained in signature to new scope
- IfFailGo(ImportHelper::MergeUpdateTokenInSig(
- NULL, // Assembly emit scope.
- pMiniMdEmit, // The emit scope.
- NULL, NULL, 0, // Import assembly scope information.
- pMiniMdImp, // The scope to merge into the emit scope.
- pbSig, // signature from the imported scope
- pCurTkMap, // Internal token mapping structure.
- &qbSig, // [OUT] translated signature
- 0, // start from first byte of the signature
- 0, // don't care how many bytes consumed
- &cbEmit)); // number of bytes write to cbEmit
-
- IfFailGo(pMiniMdEmit->PutBlob(TBL_Method, MethodRec::COL_Signature, pRecEmit, qbSig.Ptr(), cbEmit));
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::CopyMethod()
-
-
-//*******************************************************************************
-// Helper to copy an field record
-//*******************************************************************************
-HRESULT NEWMERGER::CopyField(
- MergeImportData *pImportData, // [IN] import scope
- FieldRec *pRecImp, // [IN] the record to import
- FieldRec *pRecEmit) // [IN] the emit record to fill
-{
- HRESULT hr;
- CMiniMdRW *pMiniMdImp = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- CMiniMdRW *pMiniMdEmit = GetMiniMdEmit();
- LPCUTF8 szName;
- PCCOR_SIGNATURE pbSig;
- ULONG cbSig;
- ULONG cbEmit;
- CQuickBytes qbSig;
- MDTOKENMAP *pCurTkMap;
-
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- // copy over the fix part of the record
- pRecEmit->SetFlags(pRecImp->GetFlags());
-
- // copy over the name
- IfFailGo(pMiniMdImp->getNameOfField(pRecImp, &szName));
- IfFailGo(pMiniMdEmit->PutString(TBL_Field, FieldRec::COL_Name, pRecEmit, szName));
-
- // copy over the signature
- IfFailGo(pMiniMdImp->getSignatureOfField(pRecImp, &pbSig, &cbSig));
-
- // convert rid contained in signature to new scope
- IfFailGo(ImportHelper::MergeUpdateTokenInSig(
- NULL, // Emit assembly scope.
- pMiniMdEmit, // The emit scope.
- NULL, NULL, 0, // Import assembly scope information.
- pMiniMdImp, // The scope to merge into the emit scope.
- pbSig, // signature from the imported scope
- pCurTkMap, // Internal token mapping structure.
- &qbSig, // [OUT] translated signature
- 0, // start from first byte of the signature
- 0, // don't care how many bytes consumed
- &cbEmit)); // number of bytes write to cbEmit
-
- IfFailGo(pMiniMdEmit->PutBlob(TBL_Field, FieldRec::COL_Signature, pRecEmit, qbSig.Ptr(), cbEmit));
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::CopyField()
-
-//*******************************************************************************
-// Helper to copy an field record
-//*******************************************************************************
-HRESULT NEWMERGER::CopyParam(
- MergeImportData *pImportData, // [IN] import scope
- ParamRec *pRecImp, // [IN] the record to import
- ParamRec *pRecEmit) // [IN] the emit record to fill
-{
- HRESULT hr;
- CMiniMdRW *pMiniMdImp = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- CMiniMdRW *pMiniMdEmit = GetMiniMdEmit();
- LPCUTF8 szName;
- MDTOKENMAP *pCurTkMap;
-
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- // copy over the fix part of the record
- pRecEmit->Copy(pRecImp);
-
- // copy over the name
- IfFailGo(pMiniMdImp->getNameOfParam(pRecImp, &szName));
- IfFailGo(pMiniMdEmit->PutString(TBL_Param, ParamRec::COL_Name, pRecEmit, szName));
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::CopyParam()
-
-//*******************************************************************************
-// Helper to copy an Event record
-//*******************************************************************************
-HRESULT NEWMERGER::CopyEvent(
- MergeImportData *pImportData, // [IN] import scope
- EventRec *pRecImp, // [IN] the record to import
- EventRec *pRecEmit) // [IN] the emit record to fill
-{
- HRESULT hr = NOERROR;
- CMiniMdRW *pMiniMdImp = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- CMiniMdRW *pMiniMdEmit = GetMiniMdEmit();
- mdToken tkEventTypeImp;
- mdToken tkEventTypeEmit; // could be TypeDef or TypeRef
- LPCUTF8 szName;
- MDTOKENMAP *pCurTkMap;
-
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- pRecEmit->SetEventFlags(pRecImp->GetEventFlags());
-
- //move over the event name
- IfFailGo(pMiniMdImp->getNameOfEvent(pRecImp, &szName));
- IfFailGo( pMiniMdEmit->PutString(TBL_Event, EventRec::COL_Name, pRecEmit, szName) );
-
- // move over the EventType
- tkEventTypeImp = pMiniMdImp->getEventTypeOfEvent(pRecImp);
- if ( !IsNilToken(tkEventTypeImp) )
- {
- IfFailGo( pCurTkMap->Remap(tkEventTypeImp, &tkEventTypeEmit) );
- IfFailGo(pMiniMdEmit->PutToken(TBL_Event, EventRec::COL_EventType, pRecEmit, tkEventTypeEmit));
- }
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::CopyEvent()
-
-
-//*******************************************************************************
-// Helper to copy a property record
-//*******************************************************************************
-HRESULT NEWMERGER::CopyProperty(
- MergeImportData *pImportData, // [IN] import scope
- PropertyRec *pRecImp, // [IN] the record to import
- PropertyRec *pRecEmit) // [IN] the emit record to fill
-{
- HRESULT hr = NOERROR;
- CMiniMdRW *pMiniMdImp = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- CMiniMdRW *pMiniMdEmit = GetMiniMdEmit();
- LPCUTF8 szName;
- PCCOR_SIGNATURE pbSig;
- ULONG cbSig;
- ULONG cbEmit;
- CQuickBytes qbSig;
- MDTOKENMAP *pCurTkMap;
-
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- // move over the flag value
- pRecEmit->SetPropFlags(pRecImp->GetPropFlags());
-
- //move over the property name
- IfFailGo(pMiniMdImp->getNameOfProperty(pRecImp, &szName));
- IfFailGo( pMiniMdEmit->PutString(TBL_Property, PropertyRec::COL_Name, pRecEmit, szName) );
-
- // move over the type of the property
- IfFailGo(pMiniMdImp->getTypeOfProperty(pRecImp, &pbSig, &cbSig));
-
- // convert rid contained in signature to new scope
- IfFailGo( ImportHelper::MergeUpdateTokenInSig(
- NULL, // Assembly emit scope.
- pMiniMdEmit, // The emit scope.
- NULL, NULL, 0, // Import assembly scope information.
- pMiniMdImp, // The scope to merge into the emit scope.
- pbSig, // signature from the imported scope
- pCurTkMap, // Internal token mapping structure.
- &qbSig, // [OUT] translated signature
- 0, // start from first byte of the signature
- 0, // don't care how many bytes consumed
- &cbEmit) ); // number of bytes write to cbEmit
-
- IfFailGo(pMiniMdEmit->PutBlob(TBL_Property, PropertyRec::COL_Type, pRecEmit, qbSig.Ptr(), cbEmit));
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::CopyProperty()
-
-
-//*****************************************************************************
-// Copy MethodSemantics for an event or a property
-//*****************************************************************************
-HRESULT NEWMERGER::CopyMethodSemantics(
- MergeImportData *pImportData,
- mdToken tkImport, // Event or property in the import scope
- mdToken tkEmit) // corresponding event or property in the emitting scope
-{
- HRESULT hr = NOERROR;
- MethodSemanticsRec *pRecImport = NULL;
- MethodSemanticsRec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- CMiniMdRW *pMiniMdEmit = GetMiniMdEmit();
- ULONG i;
- ULONG msEmit; // MethodSemantics are just index not tokens
- mdToken tkMethodImp;
- mdToken tkMethodEmit;
- MDTOKENMAP *pCurTkMap;
- HENUMInternal hEnum;
-
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- // copy over the associates
- IfFailGo( pMiniMdImport->FindMethodSemanticsHelper(tkImport, &hEnum) );
- while (HENUMInternal::EnumNext(&hEnum, (mdToken *) &i))
- {
- IfFailGo(pMiniMdImport->GetMethodSemanticsRecord(i, &pRecImport));
- IfFailGo(pMiniMdEmit->AddMethodSemanticsRecord(&pRecEmit, &msEmit));
- pRecEmit->SetSemantic(pRecImport->GetSemantic());
-
- // set the MethodSemantics
- tkMethodImp = pMiniMdImport->getMethodOfMethodSemantics(pRecImport);
- IfFailGo( pCurTkMap->Remap(tkMethodImp, &tkMethodEmit) );
- IfFailGo( pMiniMdEmit->PutToken(TBL_MethodSemantics, MethodSemanticsRec::COL_Method, pRecEmit, tkMethodEmit));
-
- // set the associate
- _ASSERTE( pMiniMdImport->getAssociationOfMethodSemantics(pRecImport) == tkImport );
- IfFailGo( pMiniMdEmit->PutToken(TBL_MethodSemantics, MethodSemanticsRec::COL_Association, pRecEmit, tkEmit));
-
- // no need to record the movement since it is not a token
- IfFailGo( pMiniMdEmit->AddMethodSemanticsToHash(msEmit) );
- }
-ErrExit:
- HENUMInternal::ClearEnum(&hEnum);
- return hr;
-} // HRESULT NEWMERGER::CopyMethodSemantics()
-
-
-//*****************************************************************************
-// Copy Methods given a TypeDef
-//*****************************************************************************
-HRESULT NEWMERGER::CopyMethods(
- MergeImportData *pImportData,
- mdTypeDef tdImport,
- mdTypeDef tdEmit)
-{
- HRESULT hr = NOERROR;
- MethodRec *pRecImport = NULL;
- MethodRec *pRecEmit = NULL;
- TypeDefRec *pTypeDefRec;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG ridStart, ridEnd;
- ULONG i;
- mdMethodDef mdEmit;
- mdMethodDef mdImp;
- TOKENREC *pTokenRec;
- MDTOKENMAP *pCurTkMap;
-
- MergeTypeData *pMTD;
- BOOL bSuppressMergeCheck;
- mdCustomAttribute tkCA;
-
- pMiniMdEmit = GetMiniMdEmit();
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- IfFailGo(pMiniMdImport->GetTypeDefRecord(RidFromToken(tdImport), &pTypeDefRec));
- ridStart = pMiniMdImport->getMethodListOfTypeDef(pTypeDefRec);
- IfFailGo(pMiniMdImport->getEndMethodListOfTypeDef(RidFromToken(tdImport), &ridEnd));
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- pMTD = m_rMTDs.Get(RidFromToken(tdEmit));
-
- // make sure we didn't count the methods yet
- _ASSERTE(pMTD->m_cMethods == 0);
-
- // loop through all Methods
- for (i = ridStart; i < ridEnd; i++)
- {
- // compare it with the emit scope
- IfFailGo(pMiniMdImport->GetMethodRid(i, (ULONG *)&mdImp));
-
- // only merge those MethodDefs that are marked
- if ( pMiniMdImport->GetFilterTable()->IsMethodMarked(TokenFromRid(mdImp, mdtMethodDef)) == false)
- continue;
-
- IfFailGo(pMiniMdImport->GetMethodRecord(mdImp, &pRecImport));
- IfFailGo(pMiniMdEmit->AddMethodRecord(&pRecEmit, (RID *)&mdEmit));
-
- // copy the method content over
- IfFailGo( CopyMethod(pImportData, pRecImport, pRecEmit) );
-
- IfFailGo( pMiniMdEmit->AddMethodToTypeDef(RidFromToken(tdEmit), mdEmit));
-
- // record the token movement
- mdImp = TokenFromRid(mdImp, mdtMethodDef);
- mdEmit = TokenFromRid(mdEmit, mdtMethodDef);
- IfFailGo( pMiniMdEmit->AddMemberDefToHash(
- mdEmit,
- tdEmit) );
-
- IfFailGo( pCurTkMap->InsertNotFound(mdImp, false, mdEmit, &pTokenRec) );
-
- // copy over the children
- IfFailGo( CopyParams(pImportData, mdImp, mdEmit) );
- IfFailGo( CopyGenericParams(pImportData, mdImp, mdEmit) );
-
- bSuppressMergeCheck = pMTD->m_bSuppressMergeCheck ||
- ((pImportData->m_tkSuppressMergeCheckCtor != mdTokenNil) &&
- (S_OK == ImportHelper::FindCustomAttributeByToken(pMiniMdImport,
- mdImp, pImportData->m_tkSuppressMergeCheckCtor, NULL, 0, &tkCA)));
-
-
- if (!bSuppressMergeCheck) {
- pMTD->m_cMethods++;
- }
- }
-
- // make sure we don't count any methods if merge check is suppressed on the type
- _ASSERTE(pMTD->m_cMethods == 0 || !pMTD->m_bSuppressMergeCheck);
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::CopyMethods()
-
-
-//*****************************************************************************
-// Copy Fields given a TypeDef
-//*****************************************************************************
-HRESULT NEWMERGER::CopyFields(
- MergeImportData *pImportData,
- mdTypeDef tdImport,
- mdTypeDef tdEmit)
-{
- HRESULT hr = NOERROR;
- FieldRec *pRecImport = NULL;
- FieldRec *pRecEmit = NULL;
- TypeDefRec *pTypeDefRec;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG ridStart, ridEnd;
- ULONG i;
- mdFieldDef fdEmit;
- mdFieldDef fdImp;
- bool bDuplicate;
- TOKENREC *pTokenRec;
- PCCOR_SIGNATURE pvSigBlob;
- ULONG cbSigBlob;
- MDTOKENMAP *pCurTkMap;
-
- MergeTypeData *pMTD;
- BOOL bSuppressMergeCheck;
- mdCustomAttribute tkCA;
-
- pMiniMdEmit = GetMiniMdEmit();
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- IfFailGo(pMiniMdImport->GetTypeDefRecord(RidFromToken(tdImport), &pTypeDefRec));
- ridStart = pMiniMdImport->getFieldListOfTypeDef(pTypeDefRec);
- IfFailGo(pMiniMdImport->getEndFieldListOfTypeDef(RidFromToken(tdImport), &ridEnd));
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- pMTD = m_rMTDs.Get(RidFromToken(tdEmit));
-
- // make sure we didn't count the methods yet
- _ASSERTE(pMTD->m_cFields == 0);
-
- // loop through all FieldDef of a TypeDef
- for (i = ridStart; i < ridEnd; i++)
- {
- // compare it with the emit scope
- IfFailGo(pMiniMdImport->GetFieldRid(i, (ULONG *)&fdImp));
-
- // only merge those FieldDefs that are marked
- if ( pMiniMdImport->GetFilterTable()->IsFieldMarked(TokenFromRid(fdImp, mdtFieldDef)) == false)
- continue;
-
-
- IfFailGo(pMiniMdImport->GetFieldRecord(fdImp, &pRecImport));
- bDuplicate = false;
- IfFailGo(pMiniMdEmit->AddFieldRecord(&pRecEmit, (RID *)&fdEmit));
-
- // copy the field content over
- IfFailGo( CopyField(pImportData, pRecImport, pRecEmit) );
-
- IfFailGo( pMiniMdEmit->AddFieldToTypeDef(RidFromToken(tdEmit), fdEmit));
-
- // record the token movement
- fdImp = TokenFromRid(fdImp, mdtFieldDef);
- fdEmit = TokenFromRid(fdEmit, mdtFieldDef);
- IfFailGo(pMiniMdEmit->getSignatureOfField(pRecEmit, &pvSigBlob, &cbSigBlob));
- IfFailGo( pMiniMdEmit->AddMemberDefToHash(
- fdEmit,
- tdEmit) );
-
- IfFailGo( pCurTkMap->InsertNotFound(fdImp, false, fdEmit, &pTokenRec) );
-
- // count the number of fields that didn't suppress merge check
- // non-static fields doesn't inherite the suppress merge check attribute from the type
- bSuppressMergeCheck =
- (IsFdStatic(pRecEmit->GetFlags()) && pMTD->m_bSuppressMergeCheck) ||
- ((pImportData->m_tkSuppressMergeCheckCtor != mdTokenNil) &&
- (S_OK == ImportHelper::FindCustomAttributeByToken(pMiniMdImport,
- fdImp, pImportData->m_tkSuppressMergeCheckCtor, NULL, 0, &tkCA)));
-
- if (!bSuppressMergeCheck) {
- pMTD->m_cFields++;
- }
- }
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::CopyFields()
-
-
-//*****************************************************************************
-// Copy Events given a TypeDef
-//*****************************************************************************
-HRESULT NEWMERGER::CopyEvents(
- MergeImportData *pImportData,
- mdTypeDef tdImport,
- mdTypeDef tdEmit)
-{
- HRESULT hr = NOERROR;
- CMiniMdRW *pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- CMiniMdRW *pMiniMdEmit = GetMiniMdEmit();
- RID ridEventMap;
- EventMapRec *pEventMapRec;
- EventRec *pRecImport;
- EventRec *pRecEmit;
- ULONG ridStart;
- ULONG ridEnd;
- ULONG i;
- mdEvent evImp;
- mdEvent evEmit;
- TOKENREC *pTokenRec;
- ULONG iEventMap;
- EventMapRec *pEventMap;
- MDTOKENMAP *pCurTkMap;
-
- MergeTypeData *pMTD;
- BOOL bSuppressMergeCheck;
- mdCustomAttribute tkCA;
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- pMTD = m_rMTDs.Get(RidFromToken(tdEmit));
-
- // make sure we didn't count the events yet
- _ASSERTE(pMTD->m_cEvents == 0);
-
- IfFailGo(pMiniMdImport->FindEventMapFor(RidFromToken(tdImport), &ridEventMap));
- if (!InvalidRid(ridEventMap))
- {
- IfFailGo(pMiniMdImport->GetEventMapRecord(ridEventMap, &pEventMapRec));
- ridStart = pMiniMdImport->getEventListOfEventMap(pEventMapRec);
- IfFailGo(pMiniMdImport->getEndEventListOfEventMap(ridEventMap, &ridEnd));
-
- if (ridEnd > ridStart)
- {
- // If there is any event, create the eventmap record in the emit scope
- // Create new record.
- IfFailGo(pMiniMdEmit->AddEventMapRecord(&pEventMap, &iEventMap));
-
- // Set parent.
- IfFailGo(pMiniMdEmit->PutToken(TBL_EventMap, EventMapRec::COL_Parent, pEventMap, tdEmit));
- }
-
- for (i = ridStart; i < ridEnd; i++)
- {
- // get the real event rid
- IfFailGo(pMiniMdImport->GetEventRid(i, (ULONG *)&evImp));
-
- // only merge those Events that are marked
- if ( pMiniMdImport->GetFilterTable()->IsEventMarked(TokenFromRid(evImp, mdtEvent)) == false)
- continue;
-
- IfFailGo(pMiniMdImport->GetEventRecord(evImp, &pRecImport));
- IfFailGo(pMiniMdEmit->AddEventRecord(&pRecEmit, (RID *)&evEmit));
-
- // copy the event record over
- IfFailGo( CopyEvent(pImportData, pRecImport, pRecEmit) );
-
- // Add Event to the EventMap.
- IfFailGo( pMiniMdEmit->AddEventToEventMap(iEventMap, evEmit) );
-
- // record the token movement
- evImp = TokenFromRid(evImp, mdtEvent);
- evEmit = TokenFromRid(evEmit, mdtEvent);
-
- IfFailGo( pCurTkMap->InsertNotFound(evImp, false, evEmit, &pTokenRec) );
-
- // copy over the method semantics
- IfFailGo( CopyMethodSemantics(pImportData, evImp, evEmit) );
-
- bSuppressMergeCheck = pMTD->m_bSuppressMergeCheck ||
- ((pImportData->m_tkSuppressMergeCheckCtor != mdTokenNil) &&
- (S_OK == ImportHelper::FindCustomAttributeByToken(pMiniMdImport,
- evImp, pImportData->m_tkSuppressMergeCheckCtor, NULL, 0, &tkCA)));
-
- if (!bSuppressMergeCheck) {
- pMTD->m_cEvents++;
- }
- }
- }
-
- // make sure we don't count any events if merge check is suppressed on the type
- _ASSERTE(pMTD->m_cEvents == 0 || !pMTD->m_bSuppressMergeCheck);
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::CopyEvents()
-
-
-//*****************************************************************************
-// Copy Properties given a TypeDef
-//*****************************************************************************
-HRESULT NEWMERGER::CopyProperties(
- MergeImportData *pImportData,
- mdTypeDef tdImport,
- mdTypeDef tdEmit)
-{
- HRESULT hr = NOERROR;
- CMiniMdRW *pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- CMiniMdRW *pMiniMdEmit = GetMiniMdEmit();
- RID ridPropertyMap;
- PropertyMapRec *pPropertyMapRec;
- PropertyRec *pRecImport;
- PropertyRec *pRecEmit;
- ULONG ridStart;
- ULONG ridEnd;
- ULONG i;
- mdProperty prImp;
- mdProperty prEmit;
- TOKENREC *pTokenRec;
- ULONG iPropertyMap;
- PropertyMapRec *pPropertyMap;
- MDTOKENMAP *pCurTkMap;
-
- MergeTypeData *pMTD;
- BOOL bSuppressMergeCheck;
- mdCustomAttribute tkCA;
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- pMTD = m_rMTDs.Get(RidFromToken(tdEmit));
-
- // make sure we didn't count the properties yet
- _ASSERTE(pMTD->m_cProperties == 0);
-
- IfFailGo(pMiniMdImport->FindPropertyMapFor(RidFromToken(tdImport), &ridPropertyMap));
- if (!InvalidRid(ridPropertyMap))
- {
- IfFailGo(pMiniMdImport->GetPropertyMapRecord(ridPropertyMap, &pPropertyMapRec));
- ridStart = pMiniMdImport->getPropertyListOfPropertyMap(pPropertyMapRec);
- IfFailGo(pMiniMdImport->getEndPropertyListOfPropertyMap(ridPropertyMap, &ridEnd));
-
- if (ridEnd > ridStart)
- {
- // If there is any event, create the PropertyMap record in the emit scope
- // Create new record.
- IfFailGo(pMiniMdEmit->AddPropertyMapRecord(&pPropertyMap, &iPropertyMap));
-
- // Set parent.
- IfFailGo(pMiniMdEmit->PutToken(TBL_PropertyMap, PropertyMapRec::COL_Parent, pPropertyMap, tdEmit));
- }
-
- for (i = ridStart; i < ridEnd; i++)
- {
- // get the property rid
- IfFailGo(pMiniMdImport->GetPropertyRid(i, (ULONG *)&prImp));
-
- // only merge those Properties that are marked
- if ( pMiniMdImport->GetFilterTable()->IsPropertyMarked(TokenFromRid(prImp, mdtProperty)) == false)
- continue;
-
-
- IfFailGo(pMiniMdImport->GetPropertyRecord(prImp, &pRecImport));
- IfFailGo(pMiniMdEmit->AddPropertyRecord(&pRecEmit, (RID *)&prEmit));
-
- // copy the property record over
- IfFailGo( CopyProperty(pImportData, pRecImport, pRecEmit) );
-
- // Add Property to the PropertyMap.
- IfFailGo( pMiniMdEmit->AddPropertyToPropertyMap(iPropertyMap, prEmit) );
-
- // record the token movement
- prImp = TokenFromRid(prImp, mdtProperty);
- prEmit = TokenFromRid(prEmit, mdtProperty);
-
- IfFailGo( pCurTkMap->InsertNotFound(prImp, false, prEmit, &pTokenRec) );
-
- // copy over the method semantics
- IfFailGo( CopyMethodSemantics(pImportData, prImp, prEmit) );
-
- bSuppressMergeCheck = pMTD->m_bSuppressMergeCheck ||
- ((pImportData->m_tkSuppressMergeCheckCtor != mdTokenNil) &&
- (S_OK == ImportHelper::FindCustomAttributeByToken(pMiniMdImport,
- prImp, pImportData->m_tkSuppressMergeCheckCtor, NULL, 0, &tkCA)));
-
- if (!bSuppressMergeCheck) {
- pMTD->m_cProperties++;
- }
- }
- }
-
- // make sure we don't count any properties if merge check is suppressed on the type
- _ASSERTE(pMTD->m_cProperties == 0 || !pMTD->m_bSuppressMergeCheck);
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::CopyProperties()
-
-
-//*****************************************************************************
-// Copy Parameters given a TypeDef
-//*****************************************************************************
-HRESULT NEWMERGER::CopyParams(
- MergeImportData *pImportData,
- mdMethodDef mdImport,
- mdMethodDef mdEmit)
-{
- HRESULT hr = NOERROR;
- ParamRec *pRecImport = NULL;
- ParamRec *pRecEmit = NULL;
- MethodRec *pMethodRec;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG ridStart, ridEnd;
- ULONG i;
- mdParamDef pdEmit;
- mdParamDef pdImp;
- TOKENREC *pTokenRec;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- pCurTkMap = pImportData->m_pMDTokenMap;
-
-
- IfFailGo(pMiniMdImport->GetMethodRecord(RidFromToken(mdImport), &pMethodRec));
- ridStart = pMiniMdImport->getParamListOfMethod(pMethodRec);
- IfFailGo(pMiniMdImport->getEndParamListOfMethod(RidFromToken(mdImport), &ridEnd));
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // loop through all InterfaceImpl
- for (i = ridStart; i < ridEnd; i++)
- {
- // Get the param rid
- IfFailGo(pMiniMdImport->GetParamRid(i, (ULONG *)&pdImp));
-
- // only merge those Params that are marked
- if ( pMiniMdImport->GetFilterTable()->IsParamMarked(TokenFromRid(pdImp, mdtParamDef)) == false)
- continue;
-
-
- IfFailGo(pMiniMdImport->GetParamRecord(pdImp, &pRecImport));
- IfFailGo(pMiniMdEmit->AddParamRecord(&pRecEmit, (RID *)&pdEmit));
-
- // copy the Parameter record over
- IfFailGo( CopyParam(pImportData, pRecImport, pRecEmit) );
-
- // warning!! warning!!
- // We cannot add paramRec to method list until it is fully set.
- // AddParamToMethod will use the ulSequence in the record
- IfFailGo( pMiniMdEmit->AddParamToMethod(RidFromToken(mdEmit), pdEmit));
-
- // record the token movement
- pdImp = TokenFromRid(pdImp, mdtParamDef);
- pdEmit = TokenFromRid(pdEmit, mdtParamDef);
-
- IfFailGo( pCurTkMap->InsertNotFound(pdImp, false, pdEmit, &pTokenRec) );
- }
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::CopyParams()
-
-
-//*****************************************************************************
-// Copy GenericParams given a TypeDef
-//*****************************************************************************
-HRESULT NEWMERGER::CopyGenericParams(
- MergeImportData *pImportData,
- mdToken tkImport,
- mdToken tkEmit)
-{
- HRESULT hr = NOERROR;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- TOKENREC *pTokenRec;
- GenericParamRec *pRecImport = NULL;
- GenericParamRec *pRecEmit = NULL;
- MDTOKENMAP *pCurTkMap;
- HENUMInternal hEnum;
- mdGenericParam gpImport;
- mdGenericParam gpEmit;
- LPCSTR szGenericParamName;
-
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- pMiniMdEmit = GetMiniMdEmit();
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- IfFailGo( pMiniMdImport->FindGenericParamHelper(tkImport, &hEnum) );
-
- while (HENUMInternal::EnumNext(&hEnum, (mdToken *) &gpImport))
- {
- // Get the import GenericParam record
- _ASSERTE(TypeFromToken(gpImport) == mdtGenericParam);
- IfFailGo(pMiniMdImport->GetGenericParamRecord(RidFromToken(gpImport), &pRecImport));
-
- // Create new emit record.
- IfFailGo(pMiniMdEmit->AddGenericParamRecord(&pRecEmit, (RID *)&gpEmit));
-
- // copy the GenericParam content
- pRecEmit->SetNumber( pRecImport->GetNumber());
- pRecEmit->SetFlags( pRecImport->GetFlags());
-
- IfFailGo( pMiniMdEmit->PutToken(TBL_GenericParam, GenericParamRec::COL_Owner, pRecEmit, tkEmit));
-
- IfFailGo(pMiniMdImport->getNameOfGenericParam(pRecImport, &szGenericParamName));
- IfFailGo( pMiniMdEmit->PutString(TBL_GenericParam, GenericParamRec::COL_Name, pRecEmit, szGenericParamName));
-
- // record the token movement
- gpImport = TokenFromRid(gpImport, mdtGenericParam);
- gpEmit = TokenFromRid(gpEmit, mdtGenericParam);
-
- IfFailGo( pCurTkMap->InsertNotFound(gpImport, false, gpEmit, &pTokenRec) );
-
- // copy over any constraints
- IfFailGo( CopyGenericParamConstraints(pImportData, gpImport, gpEmit) );
- }
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::CopyGenericParams()
-
-
-//*****************************************************************************
-// Copy GenericParamConstraints given a GenericParam
-//*****************************************************************************
-HRESULT NEWMERGER::CopyGenericParamConstraints(
- MergeImportData *pImportData,
- mdGenericParamConstraint tkImport,
- mdGenericParamConstraint tkEmit)
-{
- HRESULT hr = NOERROR;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- TOKENREC *pTokenRec;
- GenericParamConstraintRec *pRecImport = NULL;
- GenericParamConstraintRec *pRecEmit = NULL;
- MDTOKENMAP *pCurTkMap;
- HENUMInternal hEnum;
- mdGenericParamConstraint gpImport;
- mdGenericParamConstraint gpEmit;
- mdToken tkConstraint;
-
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- pMiniMdEmit = GetMiniMdEmit();
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- IfFailGo( pMiniMdImport->FindGenericParamConstraintHelper(tkImport, &hEnum) );
-
- while (HENUMInternal::EnumNext(&hEnum, (mdToken *) &gpImport))
- {
- // Get the import GenericParam record
- _ASSERTE(TypeFromToken(gpImport) == mdtGenericParamConstraint);
- IfFailGo(pMiniMdImport->GetGenericParamConstraintRecord(RidFromToken(gpImport), &pRecImport));
-
- // Translate the constraint before creating new record.
- tkConstraint = pMiniMdImport->getConstraintOfGenericParamConstraint(pRecImport);
- if (pCurTkMap->Find(tkConstraint, &pTokenRec) == false)
- {
- // This should never fire unless the TypeDefs/Refs weren't merged
- // before this code runs.
- _ASSERTE(!"GenericParamConstraint Constraint not found in MERGER::CopyGenericParamConstraints. Bad state!");
- IfFailGo( META_E_BADMETADATA );
- }
- tkConstraint = pTokenRec->m_tkTo;
-
- // Create new emit record.
- IfFailGo(pMiniMdEmit->AddGenericParamConstraintRecord(&pRecEmit, (RID *)&gpEmit));
-
- // copy the GenericParamConstraint content
- IfFailGo( pMiniMdEmit->PutToken(TBL_GenericParamConstraint, GenericParamConstraintRec::COL_Owner, pRecEmit, tkEmit));
-
- IfFailGo( pMiniMdEmit->PutToken(TBL_GenericParamConstraint, GenericParamConstraintRec::COL_Constraint, pRecEmit, tkConstraint));
- }
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::CopyGenericParamConstraints()
-
-
-//*****************************************************************************
-// Verify GenericParams given a TypeDef
-//*****************************************************************************
-HRESULT NEWMERGER::VerifyGenericParams(
- MergeImportData *pImportData,
- mdToken tkImport,
- mdToken tkEmit)
-{
- HRESULT hr = NOERROR;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- TOKENREC *pTokenRec;
- MDTOKENMAP *pCurTkMap;
- HENUMInternal hEnumImport; // Enumerator for import scope.
- HENUMInternal hEnumEmit; // Enumerator for emit scope.
- ULONG cImport, cEmit; // Count of import & emit records.
- ULONG i; // Enumerating records in import scope.
- ULONG iEmit; // Tracking records in emit scope.
- mdGenericParam gpImport; // Import scope GenericParam token.
- mdGenericParam gpEmit; // Emit scope GenericParam token.
- GenericParamRec *pRecImport = NULL;
- GenericParamRec *pRecEmit = NULL;
- LPCSTR szNameImport; // Name of param in import scope.
- LPCSTR szNameEmit; // Name of param in emit scope.
-
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- pMiniMdEmit = GetMiniMdEmit();
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- // Get enumerators for the input and output scopes.
- IfFailGo(pMiniMdImport->FindGenericParamHelper(tkImport, &hEnumImport));
- IfFailGo(pMiniMdEmit->FindGenericParamHelper(tkEmit, &hEnumEmit));
-
- // The counts should be the same.
- IfFailGo(HENUMInternal::GetCount(&hEnumImport, &cImport));
- IfFailGo(HENUMInternal::GetCount(&hEnumEmit, &cEmit));
-
- if (cImport != cEmit)
- {
- CheckContinuableErrorEx(META_E_GENERICPARAM_INCONSISTENT, pImportData, tkImport);
- // If we are here, the linker says this error is OK.
- }
-
- for (i=iEmit=0; i<cImport; ++i)
- {
- // Get the import GenericParam record
- IfFailGo(HENUMInternal::GetElement(&hEnumImport, i, &gpImport));
- _ASSERTE(TypeFromToken(gpImport) == mdtGenericParam);
- IfFailGo(pMiniMdImport->GetGenericParamRecord(RidFromToken(gpImport), &pRecImport));
-
- // Find the emit record. If the import and emit scopes are ordered the same
- // this is easy; otherwise go looking for it.
- // Get the "next" emit record.
- if (iEmit < cEmit)
- {
- IfFailGo(HENUMInternal::GetElement(&hEnumEmit, iEmit, &gpEmit));
- _ASSERTE(TypeFromToken(gpEmit) == mdtGenericParam);
- IfFailGo(pMiniMdEmit->GetGenericParamRecord(RidFromToken(gpEmit), &pRecEmit));
- }
-
- // If the import and emit sequence numbers don't match, go looking.
- // Also, if we would have walked off end of array, go looking.
- if (iEmit >= cEmit || pRecImport->GetNumber() != pRecEmit->GetNumber())
- {
- for (iEmit=0; iEmit<cEmit; ++iEmit)
- {
- IfFailGo( HENUMInternal::GetElement(&hEnumEmit, iEmit, &gpEmit));
- _ASSERTE(TypeFromToken(gpEmit) == mdtGenericParam);
- IfFailGo(pMiniMdEmit->GetGenericParamRecord(RidFromToken(gpEmit), &pRecEmit));
-
- // The one we want?
- if (pRecImport->GetNumber() == pRecEmit->GetNumber())
- break;
- }
- if (iEmit >= cEmit)
- goto Error; // Didn't find it
- }
-
- // Check that these "n'th" GenericParam records match.
-
- // Flags.
- if (pRecImport->GetFlags() != pRecEmit->GetFlags())
- goto Error;
-
- // Name.
- IfFailGo(pMiniMdImport->getNameOfGenericParam(pRecImport, &szNameImport));
- IfFailGo(pMiniMdEmit->getNameOfGenericParam(pRecEmit, &szNameEmit));
- if (strcmp(szNameImport, szNameEmit) != 0)
- goto Error;
-
- // Verify any constraints.
- gpImport = TokenFromRid(gpImport, mdtGenericParam);
- gpEmit = TokenFromRid(gpEmit, mdtGenericParam);
- hr = VerifyGenericParamConstraints(pImportData, gpImport, gpEmit);
-
- if (SUCCEEDED(hr))
- {
- // record the token movement
- IfFailGo( pCurTkMap->InsertNotFound(gpImport, true, gpEmit, &pTokenRec) );
- }
- else
- {
-Error:
- // inconsistent in GenericParams
- hr = S_OK; // discard old error; new error will be returned from CheckContinuableError
- CheckContinuableErrorEx(META_E_GENERICPARAM_INCONSISTENT, pImportData, tkImport);
- }
- }
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::VerifyGenericParams()
-
-
-//*****************************************************************************
-// Verify GenericParamConstraints given a GenericParam
-//*****************************************************************************
-HRESULT NEWMERGER::VerifyGenericParamConstraints(
- MergeImportData *pImportData, // The import scope.
- mdGenericParam gpImport, // Import GenericParam.
- mdGenericParam gpEmit) // Emit GenericParam.
-{
- HRESULT hr = NOERROR;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- TOKENREC *pTokenRec;
- HENUMInternal hEnumImport; // Enumerator for import scope.
- HENUMInternal hEnumEmit; // Enumerator for emit scope.
- ULONG cImport, cEmit; // Count of import & emit records.
- ULONG i; // Enumerating records in import scope.
- ULONG iEmit; // Tracking records in emit scope.
- GenericParamConstraintRec *pRecImport = NULL;
- GenericParamConstraintRec *pRecEmit = NULL;
- MDTOKENMAP *pCurTkMap;
- mdToken tkConstraintImport = mdTokenNil;
- mdToken tkConstraintEmit = mdTokenNil;
-
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- pMiniMdEmit = GetMiniMdEmit();
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- // Get enumerators for the input and output scopes.
- IfFailGo(pMiniMdImport->FindGenericParamConstraintHelper(gpImport, &hEnumImport));
- IfFailGo(pMiniMdEmit->FindGenericParamConstraintHelper(gpEmit, &hEnumEmit));
-
- // The counts should be the same.
- IfFailGo(HENUMInternal::GetCount(&hEnumImport, &cImport));
- IfFailGo(HENUMInternal::GetCount(&hEnumEmit, &cEmit));
-
- if (cImport != cEmit)
- IfFailGo(META_E_GENERICPARAM_INCONSISTENT); // Different numbers of constraints.
-
- for (i=iEmit=0; i<cImport; ++i)
- {
- // Get the import GenericParam record
- IfFailGo( HENUMInternal::GetElement(&hEnumImport, i, &gpImport));
- _ASSERTE(TypeFromToken(gpImport) == mdtGenericParamConstraint);
- IfFailGo(pMiniMdImport->GetGenericParamConstraintRecord(RidFromToken(gpImport), &pRecImport));
-
- // Get the constraint.
- tkConstraintImport = pMiniMdImport->getConstraintOfGenericParamConstraint(pRecImport);
- if (pCurTkMap->Find(tkConstraintImport, &pTokenRec) == false)
- {
- // This should never fire unless the TypeDefs/Refs weren't merged
- // before this code runs.
- _ASSERTE(!"GenericParamConstraint Constraint not found in MERGER::VerifyGenericParamConstraints. Bad state!");
- IfFailGo( META_E_BADMETADATA );
- }
- tkConstraintImport = pTokenRec->m_tkTo;
-
- // Find the emit record. If the import and emit scopes are ordered the same
- // this is easy; otherwise go looking for it.
- // Get the "next" emit record.
- if (iEmit < cEmit)
- {
- IfFailGo( HENUMInternal::GetElement(&hEnumEmit, iEmit, &gpEmit));
- _ASSERTE(TypeFromToken(gpEmit) == mdtGenericParamConstraint);
- IfFailGo(pMiniMdEmit->GetGenericParamConstraintRecord(RidFromToken(gpEmit), &pRecEmit));
- tkConstraintEmit = pMiniMdEmit->getConstraintOfGenericParamConstraint(pRecEmit);
- }
-
- // If the import and emit constraints don't match, go looking.
- if (iEmit >= cEmit || tkConstraintEmit != tkConstraintImport)
- {
- for (iEmit=0; iEmit<cEmit; ++iEmit)
- {
- IfFailGo( HENUMInternal::GetElement(&hEnumEmit, iEmit, &gpEmit));
- _ASSERTE(TypeFromToken(gpEmit) == mdtGenericParamConstraint);
- IfFailGo(pMiniMdEmit->GetGenericParamConstraintRecord(RidFromToken(gpEmit), &pRecEmit));
- tkConstraintEmit = pMiniMdEmit->getConstraintOfGenericParamConstraint(pRecEmit);
-
- // The one we want?
- if (tkConstraintEmit == tkConstraintImport)
- break;
- }
- if (iEmit >= cEmit)
- {
- IfFailGo(META_E_GENERICPARAM_INCONSISTENT); // Didn't find the constraint
- }
- }
- }
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::VerifyGenericParamConstraints()
-
-
-//*****************************************************************************
-// Verify Methods
-//*****************************************************************************
-HRESULT NEWMERGER::VerifyMethods(
- MergeImportData *pImportData,
- mdTypeDef tdImport,
- mdTypeDef tdEmit)
-{
- HRESULT hr = NOERROR;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- MethodRec *pRecImp;
- MethodRec *pRecEmit;
- ULONG ridStart;
- ULONG ridEnd;
- ULONG i;
-
- TypeDefRec *pTypeDefRec;
- LPCUTF8 szName;
- PCCOR_SIGNATURE pbSig;
- ULONG cbSig;
- ULONG cbEmit;
- CQuickBytes qbSig;
- TOKENREC *pTokenRec;
- mdMethodDef mdImp;
- mdMethodDef mdEmit;
- MDTOKENMAP *pCurTkMap;
-
- MergeTypeData *pMTD;
- BOOL bSuppressMergeCheck;
- ULONG cImport = 0; // count of non-merge check suppressed methods
- mdCustomAttribute tkCA;
-
- pMiniMdEmit = GetMiniMdEmit();
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // Get a count of records in the import scope; prepare to enumerate them.
- IfFailGo(pMiniMdImport->GetTypeDefRecord(RidFromToken(tdImport), &pTypeDefRec));
- ridStart = pMiniMdImport->getMethodListOfTypeDef(pTypeDefRec);
- IfFailGo(pMiniMdImport->getEndMethodListOfTypeDef(RidFromToken(tdImport), &ridEnd));
-
- pMTD = m_rMTDs.Get(RidFromToken(tdEmit));
-
- // loop through all Methods of the TypeDef
- for (i = ridStart; i < ridEnd; i++)
- {
- IfFailGo(pMiniMdImport->GetMethodRid(i, (ULONG *)&mdImp));
-
- // only verify those Methods that are marked
- if ( pMiniMdImport->GetFilterTable()->IsMethodMarked(TokenFromRid(mdImp, mdtMethodDef)) == false)
- continue;
-
- IfFailGo(pMiniMdImport->GetMethodRecord(mdImp, &pRecImp));
-
- if (m_fDupCheck == FALSE && tdImport == pImportData->m_pRegMetaImport->m_tdModule) // TokenFromRid(1, mdtTypeDef))
- {
- // No dup check. This is the scenario that we only have one import scope. Just copy over the
- // globals.
- goto CopyMethodLabel;
- }
-
- IfFailGo(pMiniMdImport->getNameOfMethod(pRecImp, &szName));
- IfFailGo(pMiniMdImport->getSignatureOfMethod(pRecImp, &pbSig, &cbSig));
-
- mdImp = TokenFromRid(mdImp, mdtMethodDef);
-
- if ( IsMdPrivateScope( pRecImp->GetFlags() ) )
- {
- // Trigger additive merge
- goto CopyMethodLabel;
- }
-
- // convert rid contained in signature to new scope
- IfFailGo(ImportHelper::MergeUpdateTokenInSig(
- NULL, // Assembly emit scope.
- pMiniMdEmit, // The emit scope.
- NULL, NULL, 0, // Import assembly scope information.
- pMiniMdImport, // The scope to merge into the emit scope.
- pbSig, // signature from the imported scope
- pCurTkMap, // Internal token mapping structure.
- &qbSig, // [OUT] translated signature
- 0, // start from first byte of the signature
- 0, // don't care how many bytes consumed
- &cbEmit)); // number of bytes write to cbEmit
-
- hr = ImportHelper::FindMethod(
- pMiniMdEmit,
- tdEmit,
- szName,
- (const COR_SIGNATURE *)qbSig.Ptr(),
- cbEmit,
- &mdEmit);
-
- bSuppressMergeCheck = pMTD->m_bSuppressMergeCheck ||
- ((pImportData->m_tkSuppressMergeCheckCtor != mdTokenNil) &&
- (S_OK == ImportHelper::FindCustomAttributeByToken(pMiniMdImport,
- mdImp, pImportData->m_tkSuppressMergeCheckCtor, NULL, 0, &tkCA)));
-
- if (bSuppressMergeCheck || (tdImport == pImportData->m_pRegMetaImport->m_tdModule))
- {
- // global functions! Make sure that we move over the non-duplicate global function
- // declaration
- //
- if (hr == S_OK)
- {
- // found the duplicate
- IfFailGo( VerifyMethod(pImportData, mdImp, mdEmit) );
- }
- else
- {
-CopyMethodLabel:
- // not a duplicate! Copy over the
- IfFailGo(pMiniMdEmit->AddMethodRecord(&pRecEmit, (RID *)&mdEmit));
-
- // copy the method content over
- IfFailGo( CopyMethod(pImportData, pRecImp, pRecEmit) );
-
- IfFailGo( pMiniMdEmit->AddMethodToTypeDef(RidFromToken(tdEmit), mdEmit));
-
- // record the token movement
- mdEmit = TokenFromRid(mdEmit, mdtMethodDef);
- IfFailGo( pMiniMdEmit->AddMemberDefToHash(
- mdEmit,
- tdEmit) );
-
- mdImp = TokenFromRid(mdImp, mdtMethodDef);
- IfFailGo( pCurTkMap->InsertNotFound(mdImp, false, mdEmit, &pTokenRec) );
-
- // copy over the children
- IfFailGo( CopyParams(pImportData, mdImp, mdEmit) );
- IfFailGo( CopyGenericParams(pImportData, mdImp, mdEmit) );
-
- }
- }
- else
- {
- if (hr == S_OK)
- {
- // Good! We are supposed to find a duplicate
- IfFailGo( VerifyMethod(pImportData, mdImp, mdEmit) );
- }
- else
- {
- // Oops! The typedef is duplicated but the method is not!!
- hr = S_OK; // discard old error; new error will be returned from CheckContinuableError
- CheckContinuableErrorEx(META_E_METHD_NOT_FOUND, pImportData, mdImp);
- }
-
- cImport++;
- }
- }
-
- // The counts should be the same, unless this is <module>
- if (cImport != pMTD->m_cMethods && tdImport != pImportData->m_pRegMetaImport->m_tdModule)
- {
- CheckContinuableErrorEx(META_E_METHOD_COUNTS, pImportData, tdImport);
- // If we are here, the linker says this error is OK.
- }
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::VerifyMethods()
-
-
-//*****************************************************************************
-// verify a duplicated method
-//*****************************************************************************
-HRESULT NEWMERGER::VerifyMethod(
- MergeImportData *pImportData,
- mdMethodDef mdImp, // [IN] the emit record to fill
- mdMethodDef mdEmit) // [IN] the record to import
-{
- HRESULT hr;
- MethodRec *pRecImp;
- MethodRec *pRecEmit;
- TOKENREC *pTokenRec;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- IfFailGo( pCurTkMap->InsertNotFound(mdImp, true, mdEmit, &pTokenRec) );
-
- IfFailGo(pMiniMdImport->GetMethodRecord(RidFromToken(mdImp), &pRecImp));
-
- // We need to make sure that the impl flags are propagated .
- // Rules are: if the first method has miForwardRef flag set but the new method does not,
- // we want to disable the miForwardRef flag. If the one found in the emit scope does not have
- // miForwardRef set and the second one doesn't either, we want to make sure that the rest of
- // impl flags are the same.
- //
- if ( !IsMiForwardRef( pRecImp->GetImplFlags() ) )
- {
- IfFailGo(pMiniMdEmit->GetMethodRecord(RidFromToken(mdEmit), &pRecEmit));
- if (!IsMiForwardRef(pRecEmit->GetImplFlags()))
- {
- // make sure the rest of ImplFlags are the same
- if (pRecEmit->GetImplFlags() != pRecImp->GetImplFlags())
- {
- // inconsistent in implflags
- CheckContinuableErrorEx(META_E_METHDIMPL_INCONSISTENT, pImportData, mdImp);
- }
- }
- else
- {
- // propagate the importing ImplFlags
- pRecEmit->SetImplFlags(pRecImp->GetImplFlags());
- }
- }
-
- // verify the children
- IfFailGo( VerifyParams(pImportData, mdImp, mdEmit) );
- IfFailGo( VerifyGenericParams(pImportData, mdImp, mdEmit) );
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::VerifyMethod()
-
-
-//*****************************************************************************
-// Verify Fields
-//*****************************************************************************
-HRESULT NEWMERGER::VerifyFields(
- MergeImportData *pImportData,
- mdTypeDef tdImport,
- mdTypeDef tdEmit)
-{
- HRESULT hr = NOERROR;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- FieldRec *pRecImp;
- FieldRec *pRecEmit;
- mdFieldDef fdImp;
- mdFieldDef fdEmit;
- ULONG ridStart;
- ULONG ridEnd;
- ULONG i;
-
- TypeDefRec *pTypeDefRec;
- LPCUTF8 szName;
- PCCOR_SIGNATURE pbSig;
- ULONG cbSig;
- ULONG cbEmit;
- CQuickBytes qbSig;
- TOKENREC *pTokenRec;
- MDTOKENMAP *pCurTkMap;
-
- MergeTypeData *pMTD;
- BOOL bSuppressMergeCheck;
- ULONG cImport = 0; // count of non-merge check suppressed fields
- mdCustomAttribute tkCA;
-
- pMiniMdEmit = GetMiniMdEmit();
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // Get a count of records in the import scope; prepare to enumerate them.
- IfFailGo(pMiniMdImport->GetTypeDefRecord(RidFromToken(tdImport), &pTypeDefRec));
- ridStart = pMiniMdImport->getFieldListOfTypeDef(pTypeDefRec);
- IfFailGo(pMiniMdImport->getEndFieldListOfTypeDef(RidFromToken(tdImport), &ridEnd));
-
- pMTD = m_rMTDs.Get(RidFromToken(tdEmit));
-
- // loop through all fields of the TypeDef
- for (i = ridStart; i < ridEnd; i++)
- {
- IfFailGo(pMiniMdImport->GetFieldRid(i, (ULONG *)&fdImp));
-
- // only verify those fields that are marked
- if ( pMiniMdImport->GetFilterTable()->IsFieldMarked(TokenFromRid(fdImp, mdtFieldDef)) == false)
- continue;
-
- IfFailGo(pMiniMdImport->GetFieldRecord(fdImp, &pRecImp));
-
- if (m_fDupCheck == FALSE && tdImport == pImportData->m_pRegMetaImport->m_tdModule)
- {
- // No dup check. This is the scenario that we only have one import scope. Just copy over the
- // globals.
- goto CopyFieldLabel;
- }
-
- IfFailGo(pMiniMdImport->getNameOfField(pRecImp, &szName));
- IfFailGo(pMiniMdImport->getSignatureOfField(pRecImp, &pbSig, &cbSig));
-
- if ( IsFdPrivateScope(pRecImp->GetFlags()))
- {
- // Trigger additive merge
- fdImp = TokenFromRid(fdImp, mdtFieldDef);
- goto CopyFieldLabel;
- }
-
- // convert rid contained in signature to new scope
- IfFailGo(ImportHelper::MergeUpdateTokenInSig(
- NULL, // Assembly emit scope.
- pMiniMdEmit, // The emit scope.
- NULL, NULL, 0, // Import assembly scope information.
- pMiniMdImport, // The scope to merge into the emit scope.
- pbSig, // signature from the imported scope
- pCurTkMap, // Internal token mapping structure.
- &qbSig, // [OUT] translated signature
- 0, // start from first byte of the signature
- 0, // don't care how many bytes consumed
- &cbEmit)); // number of bytes write to cbEmit
-
- hr = ImportHelper::FindField(
- pMiniMdEmit,
- tdEmit,
- szName,
- (const COR_SIGNATURE *)qbSig.Ptr(),
- cbEmit,
- &fdEmit);
-
- fdImp = TokenFromRid(fdImp, mdtFieldDef);
-
- bSuppressMergeCheck =
- (IsFdStatic(pRecImp->GetFlags()) && pMTD->m_bSuppressMergeCheck) ||
- ((pImportData->m_tkSuppressMergeCheckCtor != mdTokenNil) &&
- (S_OK == ImportHelper::FindCustomAttributeByToken(pMiniMdImport,
- fdImp, pImportData->m_tkSuppressMergeCheckCtor, NULL, 0, &tkCA)));
-
- if (bSuppressMergeCheck || (tdImport == pImportData->m_pRegMetaImport->m_tdModule))
- {
- // global data! Make sure that we move over the non-duplicate global function
- // declaration
- //
- if (hr == S_OK)
- {
- // found the duplicate
- IfFailGo( pCurTkMap->InsertNotFound(fdImp, true, fdEmit, &pTokenRec) );
- }
- else
- {
-CopyFieldLabel:
- // not a duplicate! Copy over the
- IfFailGo(pMiniMdEmit->AddFieldRecord(&pRecEmit, (RID *)&fdEmit));
-
- // copy the field record over
- IfFailGo( CopyField(pImportData, pRecImp, pRecEmit) );
-
- IfFailGo( pMiniMdEmit->AddFieldToTypeDef(RidFromToken(tdEmit), fdEmit));
-
- // record the token movement
- fdEmit = TokenFromRid(fdEmit, mdtFieldDef);
- IfFailGo( pMiniMdEmit->AddMemberDefToHash(
- fdEmit,
- tdEmit) );
-
- fdImp = TokenFromRid(fdImp, mdtFieldDef);
- IfFailGo( pCurTkMap->InsertNotFound(fdImp, false, fdEmit, &pTokenRec) );
- }
- }
- else
- {
- if (hr == S_OK)
- {
- // Good! We are supposed to find a duplicate
- IfFailGo( pCurTkMap->InsertNotFound(fdImp, true, fdEmit, &pTokenRec) );
- }
- else
- {
- // Oops! The typedef is duplicated but the field is not!!
- hr = S_OK; // discard old error; new error will be returned from CheckContinuableError
- CheckContinuableErrorEx(META_E_FIELD_NOT_FOUND, pImportData, fdImp);
- }
-
- cImport++;
- }
- }
-
- // The counts should be the same, unless this is <module>
- if (cImport != pMTD->m_cFields && tdImport != pImportData->m_pRegMetaImport->m_tdModule)
- {
- CheckContinuableErrorEx(META_E_FIELD_COUNTS, pImportData, tdImport);
- // If we are here, the linker says this error is OK.
- }
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::VerifyFields()
-
-
-//*****************************************************************************
-// Verify Events
-//*****************************************************************************
-HRESULT NEWMERGER::VerifyEvents(
- MergeImportData *pImportData,
- mdTypeDef tdImport,
- mdTypeDef tdEmit)
-{
- HRESULT hr = NOERROR;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- RID ridEventMap, ridEventMapEmit;
- EventMapRec *pEventMapRec;
- EventRec *pRecImport;
- ULONG ridStart;
- ULONG ridEnd;
- ULONG i;
- mdEvent evImport;
- mdEvent evEmit;
- TOKENREC *pTokenRec;
- LPCUTF8 szName;
- mdToken tkType;
- MDTOKENMAP *pCurTkMap;
-
- EventMapRec *pEventMapEmit;
- EventRec *pRecEmit;
- MergeTypeData *pMTD;
- BOOL bSuppressMergeCheck;
- ULONG cImport = 0; // count of non-merge check suppressed events
- mdCustomAttribute tkCA;
-
- pMiniMdEmit = GetMiniMdEmit();
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- IfFailGo(pMiniMdImport->FindEventMapFor(RidFromToken(tdImport), &ridEventMap));
- if (!InvalidRid(ridEventMap))
- {
- // Get a count of records already in emit scope.
- IfFailGo(pMiniMdEmit->FindEventMapFor(RidFromToken(tdEmit), &ridEventMapEmit));
-
- if (InvalidRid(ridEventMapEmit)) {
- // If there is any event, create the eventmap record in the emit scope
- // Create new record.
- IfFailGo(pMiniMdEmit->AddEventMapRecord(&pEventMapEmit, &ridEventMapEmit));
-
- // Set parent.
- IfFailGo(pMiniMdEmit->PutToken(TBL_EventMap, EventMapRec::COL_Parent, pEventMapEmit, tdEmit));
- }
-
- // Get a count of records in the import scope; prepare to enumerate them.
- IfFailGo(pMiniMdImport->GetEventMapRecord(ridEventMap, &pEventMapRec));
- ridStart = pMiniMdImport->getEventListOfEventMap(pEventMapRec);
- IfFailGo(pMiniMdImport->getEndEventListOfEventMap(ridEventMap, &ridEnd));
-
- pMTD = m_rMTDs.Get(RidFromToken(tdEmit));
-
- for (i = ridStart; i < ridEnd; i++)
- {
- // get the property rid
- IfFailGo(pMiniMdImport->GetEventRid(i, (ULONG *)&evImport));
-
- // only verify those Events that are marked
- if ( pMiniMdImport->GetFilterTable()->IsEventMarked(TokenFromRid(evImport, mdtEvent)) == false)
- continue;
-
- IfFailGo(pMiniMdImport->GetEventRecord(evImport, &pRecImport));
- IfFailGo(pMiniMdImport->getNameOfEvent(pRecImport, &szName));
- tkType = pMiniMdImport->getEventTypeOfEvent( pRecImport );
- IfFailGo( pCurTkMap->Remap(tkType, &tkType) );
- evImport = TokenFromRid( evImport, mdtEvent);
-
- hr = ImportHelper::FindEvent(
- pMiniMdEmit,
- tdEmit,
- szName,
- &evEmit);
-
- bSuppressMergeCheck = pMTD->m_bSuppressMergeCheck ||
- ((pImportData->m_tkSuppressMergeCheckCtor != mdTokenNil) &&
- (S_OK == ImportHelper::FindCustomAttributeByToken(pMiniMdImport,
- evImport, pImportData->m_tkSuppressMergeCheckCtor, NULL, 0, &tkCA)));
-
- if (bSuppressMergeCheck)
- {
-
- if (hr == S_OK )
- {
- // Good. We found the matching event when we have a duplicate typedef
- IfFailGo( pCurTkMap->InsertNotFound(evImport, true, evEmit, &pTokenRec) );
- }
- else
- {
- // not a duplicate! Copy over the
- IfFailGo(pMiniMdEmit->AddEventRecord(&pRecEmit, (RID *)&evEmit));
-
- // copy the event record over
- IfFailGo( CopyEvent(pImportData, pRecImport, pRecEmit) );
-
- // Add Event to the EventMap.
- IfFailGo( pMiniMdEmit->AddEventToEventMap(ridEventMapEmit, evEmit) );
-
- // record the token movement
- evEmit = TokenFromRid(evEmit, mdtEvent);
-
- IfFailGo( pCurTkMap->InsertNotFound(evImport, false, evEmit, &pTokenRec) );
-
- // copy over the method semantics
- IfFailGo( CopyMethodSemantics(pImportData, evImport, evEmit) );
- }
- }
- else
- {
- if (hr == S_OK )
- {
- // Good. We found the matching event when we have a duplicate typedef
- IfFailGo( pCurTkMap->InsertNotFound(evImport, true, evEmit, &pTokenRec) );
- }
- else
- {
- // Oops! The typedef is duplicated but the event is not!!
- hr = S_OK; // discard old error; new error will be returned from CheckContinuableError
- CheckContinuableErrorEx(META_E_EVENT_NOT_FOUND, pImportData, evImport);
-
- }
-
- cImport++;
- }
- }
-
- // The counts should be the same, unless this is <module>
- if (cImport != pMTD->m_cEvents && tdImport != pImportData->m_pRegMetaImport->m_tdModule)
- {
- CheckContinuableErrorEx(META_E_EVENT_COUNTS, pImportData, tdImport);
- // If we are here, the linker says this error is OK.
- }
- }
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::VerifyEvents()
-
-
-//*****************************************************************************
-// Verify Properties
-//*****************************************************************************
-HRESULT NEWMERGER::VerifyProperties(
- MergeImportData *pImportData,
- mdTypeDef tdImport,
- mdTypeDef tdEmit)
-{
- HRESULT hr = NOERROR;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- RID ridPropertyMap, ridPropertyMapEmit;
- PropertyMapRec *pPropertyMapRec;
- PropertyRec *pRecImport;
- ULONG ridStart;
- ULONG ridEnd;
- ULONG i;
- mdProperty prImp;
- mdProperty prEmit;
- TOKENREC *pTokenRec;
- LPCUTF8 szName;
- PCCOR_SIGNATURE pbSig;
- ULONG cbSig;
- ULONG cbEmit;
- CQuickBytes qbSig;
- MDTOKENMAP *pCurTkMap;
-
- PropertyMapRec *pPropertyMapEmit;
- PropertyRec *pRecEmit;
- MergeTypeData *pMTD;
- BOOL bSuppressMergeCheck;
- ULONG cImport = 0; // count of non-merge check suppressed properties
- mdCustomAttribute tkCA;
-
- pMiniMdEmit = GetMiniMdEmit();
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- IfFailGo(pMiniMdImport->FindPropertyMapFor(RidFromToken(tdImport), &ridPropertyMap));
- if (!InvalidRid(ridPropertyMap))
- {
- // Get a count of records already in emit scope.
- IfFailGo(pMiniMdEmit->FindPropertyMapFor(RidFromToken(tdEmit), &ridPropertyMapEmit));
-
- if (InvalidRid(ridPropertyMapEmit))
- {
- // If there is any event, create the PropertyMap record in the emit scope
- // Create new record.
- IfFailGo(pMiniMdEmit->AddPropertyMapRecord(&pPropertyMapEmit, &ridPropertyMapEmit));
-
- // Set parent.
- IfFailGo(pMiniMdEmit->PutToken(TBL_PropertyMap, PropertyMapRec::COL_Parent, pPropertyMapEmit, tdEmit));
- }
-
- // Get a count of records in the import scope; prepare to enumerate them.
- IfFailGo(pMiniMdImport->GetPropertyMapRecord(ridPropertyMap, &pPropertyMapRec));
- ridStart = pMiniMdImport->getPropertyListOfPropertyMap(pPropertyMapRec);
- IfFailGo(pMiniMdImport->getEndPropertyListOfPropertyMap(ridPropertyMap, &ridEnd));
-
- pMTD = m_rMTDs.Get(RidFromToken(tdEmit));
-
- for (i = ridStart; i < ridEnd; i++)
- {
- // get the property rid
- IfFailGo(pMiniMdImport->GetPropertyRid(i, (ULONG *)&prImp));
-
- // only verify those Properties that are marked
- if ( pMiniMdImport->GetFilterTable()->IsPropertyMarked(TokenFromRid(prImp, mdtProperty)) == false)
- continue;
-
- IfFailGo(pMiniMdImport->GetPropertyRecord(prImp, &pRecImport));
- IfFailGo(pMiniMdImport->getNameOfProperty(pRecImport, &szName));
- IfFailGo(pMiniMdImport->getTypeOfProperty(pRecImport, &pbSig, &cbSig));
- prImp = TokenFromRid( prImp, mdtProperty);
-
- // convert rid contained in signature to new scope
- IfFailGo( ImportHelper::MergeUpdateTokenInSig(
- NULL, // Emit assembly.
- pMiniMdEmit, // The emit scope.
- NULL, NULL, 0, // Import assembly scope information.
- pMiniMdImport, // The scope to merge into the emit scope.
- pbSig, // signature from the imported scope
- pCurTkMap, // Internal token mapping structure.
- &qbSig, // [OUT] translated signature
- 0, // start from first byte of the signature
- 0, // don't care how many bytes consumed
- &cbEmit) ); // number of bytes write to cbEmit
-
- hr = ImportHelper::FindProperty(
- pMiniMdEmit,
- tdEmit,
- szName,
- (PCCOR_SIGNATURE) qbSig.Ptr(),
- cbEmit,
- &prEmit);
-
- bSuppressMergeCheck = pMTD->m_bSuppressMergeCheck ||
- ((pImportData->m_tkSuppressMergeCheckCtor != mdTokenNil) &&
- (S_OK == ImportHelper::FindCustomAttributeByToken(pMiniMdImport,
- prImp, pImportData->m_tkSuppressMergeCheckCtor, NULL, 0, &tkCA)));
-
- if (bSuppressMergeCheck)
- {
- if (hr == S_OK)
- {
- // Good. We found the matching property when we have a duplicate typedef
- IfFailGo( pCurTkMap->InsertNotFound(prImp, true, prEmit, &pTokenRec) );
- }
- else
- {
- IfFailGo(pMiniMdEmit->AddPropertyRecord(&pRecEmit, (RID *)&prEmit));
-
- // copy the property record over
- IfFailGo( CopyProperty(pImportData, pRecImport, pRecEmit) );
-
- // Add Property to the PropertyMap.
- IfFailGo( pMiniMdEmit->AddPropertyToPropertyMap(ridPropertyMapEmit, prEmit) );
-
- // record the token movement
- prEmit = TokenFromRid(prEmit, mdtProperty);
-
- IfFailGo( pCurTkMap->InsertNotFound(prImp, false, prEmit, &pTokenRec) );
-
- // copy over the method semantics
- IfFailGo( CopyMethodSemantics(pImportData, prImp, prEmit) );
- }
- }
- else
- {
- if (hr == S_OK)
- {
- // Good. We found the matching property when we have a duplicate typedef
- IfFailGo( pCurTkMap->InsertNotFound(prImp, true, prEmit, &pTokenRec) );
- }
- else
- {
- hr = S_OK; // discard old error; new error will be returned from CheckContinuableError
- CheckContinuableErrorEx(META_E_PROP_NOT_FOUND, pImportData, prImp);
- }
-
- cImport++;
- }
- }
-
- // The counts should be the same, unless this is <module>
- if (cImport != pMTD->m_cProperties && tdImport != pImportData->m_pRegMetaImport->m_tdModule)
- {
- CheckContinuableErrorEx(META_E_PROPERTY_COUNTS, pImportData, tdImport);
- // If we are here, the linker says this error is OK.
- }
- }
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::VerifyProperties()
-
-
-//*****************************************************************************
-// Verify Parameters given a Method
-//*****************************************************************************
-HRESULT NEWMERGER::VerifyParams(
- MergeImportData *pImportData,
- mdMethodDef mdImport,
- mdMethodDef mdEmit)
-{
- HRESULT hr = NOERROR;
- ParamRec *pRecImport = NULL;
- ParamRec *pRecEmit = NULL;
- MethodRec *pMethodRec;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG ridStart, ridEnd;
- ULONG ridStartEmit, ridEndEmit;
- ULONG cImport, cEmit;
- ULONG i, j;
- mdParamDef pdEmit = 0;
- mdParamDef pdImp;
- TOKENREC *pTokenRec;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // Get count of params in import scope; prepare to enumerate.
- IfFailGo(pMiniMdImport->GetMethodRecord(RidFromToken(mdImport), &pMethodRec));
- ridStart = pMiniMdImport->getParamListOfMethod(pMethodRec);
- IfFailGo(pMiniMdImport->getEndParamListOfMethod(RidFromToken(mdImport), &ridEnd));
- cImport = ridEnd - ridStart;
-
- // Get count of params in emit scope; prepare to enumerate.
- IfFailGo(pMiniMdEmit->GetMethodRecord(RidFromToken(mdEmit), &pMethodRec));
- ridStartEmit = pMiniMdEmit->getParamListOfMethod(pMethodRec);
- IfFailGo(pMiniMdEmit->getEndParamListOfMethod(RidFromToken(mdEmit), &ridEndEmit));
- cEmit = ridEndEmit - ridStartEmit;
-
- // The counts should be the same.
- if (cImport != cEmit)
- {
- // That is, unless this is <module>, so get the method's parent.
- mdTypeDef tdImport;
- IfFailGo(pMiniMdImport->FindParentOfMethodHelper(mdImport, &tdImport));
- if (tdImport != pImportData->m_pRegMetaImport->m_tdModule)
- CheckContinuableErrorEx(META_E_PARAM_COUNTS, pImportData, mdImport);
- // If we are here, the linker says this error is OK.
- }
-
- // loop through all Parameters
- for (i = ridStart; i < ridEnd; i++)
- {
- // Get the importing param row
- IfFailGo(pMiniMdImport->GetParamRid(i, (ULONG *)&pdImp));
-
- // only verify those Params that are marked
- if ( pMiniMdImport->GetFilterTable()->IsParamMarked(TokenFromRid(pdImp, mdtParamDef)) == false)
- continue;
-
-
- IfFailGo(pMiniMdImport->GetParamRecord(pdImp, &pRecImport));
- pdImp = TokenFromRid(pdImp, mdtParamDef);
-
- // It turns out when we merge a typelib with itself, the emit and import scope
- // has different sequence of parameter
- //
- // find the corresponding emit param row
- for (j = ridStartEmit; j < ridEndEmit; j++)
- {
- IfFailGo(pMiniMdEmit->GetParamRid(j, (ULONG *)&pdEmit));
- IfFailGo(pMiniMdEmit->GetParamRecord(pdEmit, &pRecEmit));
- if (pRecEmit->GetSequence() == pRecImport->GetSequence())
- break;
- }
-
- if (j == ridEndEmit)
- {
- // did not find the corresponding parameter in the emiting scope
- hr = S_OK; // discard old error; new error will be returned from CheckContinuableError
- CheckContinuableErrorEx(META_S_PARAM_MISMATCH, pImportData, pdImp);
- }
-
- else
- {
- _ASSERTE( pRecEmit->GetSequence() == pRecImport->GetSequence() );
-
- pdEmit = TokenFromRid(pdEmit, mdtParamDef);
-
- // record the token movement
-#ifdef WE_DONT_NEED_TO_CHECK_NAMES__THEY_DONT_AFFECT_ANYTHING
- LPCUTF8 szNameImp;
- LPCUTF8 szNameEmit;
- IfFailGo(pMiniMdImport->getNameOfParam(pRecImport, &szNameImp));
- IfFailGo(pMiniMdEmit->getNameOfParam(pRecEmit, &szNameEmit));
- if (szNameImp && szNameEmit && strcmp(szNameImp, szNameEmit) != 0)
- {
- // parameter name doesn't match
- CheckContinuableErrorEx(META_S_PARAM_MISMATCH, pImportData, pdImp);
- }
-#endif
- if (pRecEmit->GetFlags() != pRecImport->GetFlags())
- {
- // flags doesn't match
- CheckContinuableErrorEx(META_S_PARAM_MISMATCH, pImportData, pdImp);
- }
-
- // record token movement. This is a duplicate.
- IfFailGo( pCurTkMap->InsertNotFound(pdImp, true, pdEmit, &pTokenRec) );
- }
- }
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::VerifyParams()
-
-
-//*****************************************************************************
-// merging MemberRef
-//*****************************************************************************
-HRESULT NEWMERGER::MergeMemberRefs( )
-{
- HRESULT hr = NOERROR;
- MemberRefRec *pRecImport = NULL;
- MemberRefRec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG iCount;
- ULONG i;
- mdMemberRef mrEmit;
- mdMemberRef mrImp;
- bool bDuplicate = false;
- TOKENREC *pTokenRec;
- mdToken tkParentImp;
- mdToken tkParentEmit;
-
- LPCUTF8 szNameImp;
- PCCOR_SIGNATURE pbSig;
- ULONG cbSig;
- ULONG cbEmit;
- CQuickBytes qbSig;
-
- bool isRefOptimizedToDef;
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- iCount = pMiniMdImport->getCountMemberRefs();
-
- // loop through all MemberRef
- for (i = 1; i <= iCount; i++)
- {
-
- // only merge those MemberRefs that are marked
- if ( pMiniMdImport->GetFilterTable()->IsMemberRefMarked(TokenFromRid(i, mdtMemberRef)) == false)
- continue;
-
- isRefOptimizedToDef = false;
-
- // compare it with the emit scope
- IfFailGo(pMiniMdImport->GetMemberRefRecord(i, &pRecImport));
- IfFailGo(pMiniMdImport->getNameOfMemberRef(pRecImport, &szNameImp));
- IfFailGo(pMiniMdImport->getSignatureOfMemberRef(pRecImport, &pbSig, &cbSig));
- tkParentImp = pMiniMdImport->getClassOfMemberRef(pRecImport);
-
- IfFailGo( pCurTkMap->Remap(tkParentImp, &tkParentEmit) );
-
- // convert rid contained in signature to new scope
- IfFailGo(ImportHelper::MergeUpdateTokenInSig(
- NULL, // Assembly emit scope.
- pMiniMdEmit, // The emit scope.
- NULL, NULL, 0, // Import assembly information.
- pMiniMdImport, // The scope to merge into the emit scope.
- pbSig, // signature from the imported scope
- pCurTkMap, // Internal token mapping structure.
- &qbSig, // [OUT] translated signature
- 0, // start from first byte of the signature
- 0, // don't care how many bytes consumed
- &cbEmit)); // number of bytes write to cbEmit
-
- // We want to know if we can optimize this MemberRef to a FieldDef or MethodDef
- if (TypeFromToken(tkParentEmit) == mdtTypeDef && RidFromToken(tkParentEmit) != 0)
- {
- // The parent of this MemberRef has been successfully optimized to a TypeDef. Then this MemberRef should be
- // be able to optimized to a MethodDef or FieldDef unless one of the parent in the inheritance hierachy
- // is through TypeRef. Then this MemberRef stay as MemberRef. If This is a VarArg calling convention, then
- // we will remap the MemberRef's parent to a MethodDef or stay as TypeRef.
- //
- mdToken tkParent = tkParentEmit;
- mdToken tkMethDefOrFieldDef;
- PCCOR_SIGNATURE pbSigTmp = (const COR_SIGNATURE *) qbSig.Ptr();
-
- while (TypeFromToken(tkParent) == mdtTypeDef && RidFromToken(tkParent) != 0)
- {
- TypeDefRec *pRec;
- hr = ImportHelper::FindMember(pMiniMdEmit, tkParent, szNameImp, pbSigTmp, cbEmit, &tkMethDefOrFieldDef);
- if (hr == S_OK)
- {
- // We have found a match!!
- if (isCallConv(CorSigUncompressCallingConv(pbSigTmp), IMAGE_CEE_CS_CALLCONV_VARARG))
- {
- // The found MethodDef token will replace this MemberRef's parent token
- _ASSERTE(TypeFromToken(tkMethDefOrFieldDef) == mdtMethodDef);
- tkParentEmit = tkMethDefOrFieldDef;
- break;
- }
- else
- {
- // The found MethodDef/FieldDef token will replace this MemberRef token and we won't introduce a MemberRef
- // record.
- //
- mrEmit = tkMethDefOrFieldDef;
- isRefOptimizedToDef = true;
- bDuplicate = true;
- break;
- }
- }
-
- // now walk up to the parent class of tkParent and try to resolve this MemberRef
- IfFailGo(pMiniMdEmit->GetTypeDefRecord(RidFromToken(tkParent), &pRec));
- tkParent = pMiniMdEmit->getExtendsOfTypeDef(pRec);
- }
-
- // When we exit the loop, there are several possibilities:
- // 1. We found a MethodDef/FieldDef to replace the MemberRef
- // 2. We found a MethodDef matches the MemberRef but the MemberRef is VarArg, thus we want to use the MethodDef in the
- // parent column but not replacing it.
- // 3. We exit because we run out the TypeDef on the parent chain. If it is because we encounter a TypeRef, this TypeRef will
- // replace the parent column of the MemberRef. Or we encounter nil token! (This can be unresolved global MemberRef or
- // compiler error to put an undefined MemberRef. In this case, we should just use the old tkParentEmit
- // on the parent column for the MemberRef.
-
- if (TypeFromToken(tkParent) == mdtTypeRef && RidFromToken(tkParent) != 0)
- {
- // we had walked up the parent's chain to resolve it but we have not been successful and got stopped by a TypeRef.
- // Then we will use this TypeRef as the parent of the emit MemberRef record
- //
- tkParentEmit = tkParent;
- }
- }
- else if ((TypeFromToken(tkParentEmit) == mdtMethodDef &&
- !isCallConv(CorSigUncompressCallingConv(pbSig), IMAGE_CEE_CS_CALLCONV_VARARG)) ||
- (TypeFromToken(tkParentEmit) == mdtFieldDef))
- {
- // If the MemberRef's parent is already a non-vararg MethodDef or FieldDef, we can also
- // safely drop the MemberRef
- mrEmit = tkParentEmit;
- isRefOptimizedToDef = true;
- bDuplicate = true;
- }
-
- // If the Ref cannot be optimized to a Def or MemberRef to Def optmization is turned off, do the following.
- if (isRefOptimizedToDef == false || !((m_optimizeRefToDef & MDMemberRefToDef) == MDMemberRefToDef))
- {
- // does this MemberRef already exist in the emit scope?
- if ( m_fDupCheck && ImportHelper::FindMemberRef(
- pMiniMdEmit,
- tkParentEmit,
- szNameImp,
- (const COR_SIGNATURE *) qbSig.Ptr(),
- cbEmit,
- &mrEmit) == S_OK )
- {
- // Yes, it does
- bDuplicate = true;
- }
- else
- {
- // No, it doesn't. Copy it over.
- bDuplicate = false;
- IfFailGo(pMiniMdEmit->AddMemberRefRecord(&pRecEmit, (RID *)&mrEmit));
- mrEmit = TokenFromRid( mrEmit, mdtMemberRef );
-
- // Copy over the MemberRef context
- IfFailGo(pMiniMdEmit->PutString(TBL_MemberRef, MemberRefRec::COL_Name, pRecEmit, szNameImp));
- IfFailGo(pMiniMdEmit->PutToken(TBL_MemberRef, MemberRefRec::COL_Class, pRecEmit, tkParentEmit));
- IfFailGo(pMiniMdEmit->PutBlob(TBL_MemberRef, MemberRefRec::COL_Signature, pRecEmit,
- qbSig.Ptr(), cbEmit));
- IfFailGo(pMiniMdEmit->AddMemberRefToHash(mrEmit) );
- }
- }
- // record the token movement
- mrImp = TokenFromRid(i, mdtMemberRef);
- IfFailGo( pCurTkMap->InsertNotFound(mrImp, bDuplicate, mrEmit, &pTokenRec) );
- }
- }
-
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeMemberRefs()
-
-
-//*****************************************************************************
-// merge interface impl
-//*****************************************************************************
-HRESULT NEWMERGER::MergeInterfaceImpls( )
-{
- HRESULT hr = NOERROR;
- InterfaceImplRec *pRecImport = NULL;
- InterfaceImplRec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG iCount;
- ULONG i;
- mdTypeDef tkParent;
- mdInterfaceImpl iiEmit;
- bool bDuplicate;
- TOKENREC *pTokenRec;
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
- iCount = pMiniMdImport->getCountInterfaceImpls();
-
- // loop through all InterfaceImpl
- for (i = 1; i <= iCount; i++)
- {
- // only merge those InterfaceImpls that are marked
- if ( pMiniMdImport->GetFilterTable()->IsInterfaceImplMarked(TokenFromRid(i, mdtInterfaceImpl)) == false)
- continue;
-
- // compare it with the emit scope
- IfFailGo(pMiniMdImport->GetInterfaceImplRecord(i, &pRecImport));
- tkParent = pMiniMdImport->getClassOfInterfaceImpl(pRecImport);
-
- // does this TypeRef already exist in the emit scope?
- if ( pCurTkMap->Find(tkParent, &pTokenRec) )
- {
- if ( pTokenRec->m_isDuplicate )
- {
- // parent in the emit scope
- mdToken tkParentEmit;
- mdToken tkInterface;
-
- // remap the typedef token
- tkParentEmit = pTokenRec->m_tkTo;
-
- // remap the implemented interface token
- tkInterface = pMiniMdImport->getInterfaceOfInterfaceImpl(pRecImport);
- IfFailGo( pCurTkMap->Remap( tkInterface, &tkInterface) );
-
- // Set duplicate flag
- bDuplicate = true;
-
- // find the corresponding interfaceimpl in the emit scope
- if ( ImportHelper::FindInterfaceImpl(pMiniMdEmit, tkParentEmit, tkInterface, &iiEmit) != S_OK )
- {
- // bad state!! We have a duplicate typedef but the interface impl is not the same!!
-
- // continuable error
- CheckContinuableErrorEx(
- META_E_INTFCEIMPL_NOT_FOUND,
- pImportData,
- TokenFromRid(i, mdtInterfaceImpl));
-
- iiEmit = mdTokenNil;
- }
- }
- else
- {
- // No, it doesn't. Copy it over.
- bDuplicate = false;
- IfFailGo(pMiniMdEmit->AddInterfaceImplRecord(&pRecEmit, (RID *)&iiEmit));
-
- // copy the interfaceimp record over
- IfFailGo( CopyInterfaceImpl( pRecEmit, pImportData, pRecImport) );
- }
- }
- else
- {
- _ASSERTE( !"bad state!");
- IfFailGo( META_E_BADMETADATA );
- }
-
- // record the token movement
- IfFailGo( pCurTkMap->InsertNotFound(
- TokenFromRid(i, mdtInterfaceImpl),
- bDuplicate,
- TokenFromRid( iiEmit, mdtInterfaceImpl ),
- &pTokenRec) );
- }
- }
-
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeInterfaceImpls()
-
-
-//*****************************************************************************
-// merge all of the constant for field, property, and parameter
-//*****************************************************************************
-HRESULT NEWMERGER::MergeConstants()
-{
- HRESULT hr = NOERROR;
- ConstantRec *pRecImport = NULL;
- ConstantRec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG iCount;
- ULONG i;
- ULONG csEmit; // constant value is not a token
- mdToken tkParentImp;
- TOKENREC *pTokenRec;
- void const *pValue;
- ULONG cbBlob;
-#if _DEBUG
- ULONG typeParent;
-#endif // _DEBUG
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
- iCount = pMiniMdImport->getCountConstants();
-
- // loop through all Constants
- for (i = 1; i <= iCount; i++)
- {
- // compare it with the emit scope
- IfFailGo(pMiniMdImport->GetConstantRecord(i, &pRecImport));
- tkParentImp = pMiniMdImport->getParentOfConstant(pRecImport);
-
- // only move those constant over if their parents are marked
- // If MDTOKENMAP::Find returns false, we don't need to copy the constant value over
- if ( pCurTkMap->Find(tkParentImp, &pTokenRec) )
- {
- // If the parent is duplicated, no need to move over the constant value
- if ( !pTokenRec->m_isDuplicate )
- {
- IfFailGo(pMiniMdEmit->AddConstantRecord(&pRecEmit, &csEmit));
- pRecEmit->SetType(pRecImport->GetType());
-
- // set the parent
- IfFailGo( pMiniMdEmit->PutToken(TBL_Constant, ConstantRec::COL_Parent, pRecEmit, pTokenRec->m_tkTo) );
-
- // move over the constant blob value
- IfFailGo(pMiniMdImport->getValueOfConstant(pRecImport, (const BYTE **)&pValue, &cbBlob));
- IfFailGo( pMiniMdEmit->PutBlob(TBL_Constant, ConstantRec::COL_Value, pRecEmit, pValue, cbBlob) );
- IfFailGo( pMiniMdEmit->AddConstantToHash(csEmit) );
- }
- else
- {
- // <TODO>@FUTURE: more verification on the duplicate??</TODO>
- }
- }
-#if _DEBUG
- // Include this block only under Debug build. The reason is that
- // the linker chooses all the errors that we report (such as unmatched MethodDef or FieldDef)
- // as a continuable error. It is likely to hit this else while the tkparentImp is marked if there
- // is any error reported earlier!!
- else
- {
- typeParent = TypeFromToken(tkParentImp);
- if (typeParent == mdtFieldDef)
- {
- // FieldDef should not be marked.
- if ( pMiniMdImport->GetFilterTable()->IsFieldMarked(tkParentImp) == false)
- continue;
- }
- else if (typeParent == mdtParamDef)
- {
- // ParamDef should not be marked.
- if ( pMiniMdImport->GetFilterTable()->IsParamMarked(tkParentImp) == false)
- continue;
- }
- else
- {
- _ASSERTE(typeParent == mdtProperty);
- // Property should not be marked.
- if ( pMiniMdImport->GetFilterTable()->IsPropertyMarked(tkParentImp) == false)
- continue;
- }
-
- // If we come to here, we have a constant whose parent is marked but we could not
- // find it in the map!! Bad state.
-
- _ASSERTE(!"Ignore this error if you have seen error reported earlier! Otherwise bad token map or bad metadata!");
- }
-#endif // _DEBUG
- // Note that we don't need to record the token movement since constant is not a valid token kind.
- }
- }
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeConstants()
-
-
-//*****************************************************************************
-// Merge field marshal information
-//*****************************************************************************
-HRESULT NEWMERGER::MergeFieldMarshals()
-{
- HRESULT hr = NOERROR;
- FieldMarshalRec *pRecImport = NULL;
- FieldMarshalRec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG iCount;
- ULONG i;
- ULONG fmEmit; // FieldMarhsal is not a token
- mdToken tkParentImp;
- TOKENREC *pTokenRec;
- void const *pValue;
- ULONG cbBlob;
-#if _DEBUG
- ULONG typeParent;
-#endif // _DEBUG
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
- iCount = pMiniMdImport->getCountFieldMarshals();
-
- // loop through all TypeRef
- for (i = 1; i <= iCount; i++)
- {
- // compare it with the emit scope
- IfFailGo(pMiniMdImport->GetFieldMarshalRecord(i, &pRecImport));
- tkParentImp = pMiniMdImport->getParentOfFieldMarshal(pRecImport);
-
- // We want to merge only those field marshals that parents are marked.
- // Find will return false if the parent is not marked
- //
- if ( pCurTkMap->Find(tkParentImp, &pTokenRec) )
- {
- // If the parent is duplicated, no need to move over the constant value
- if ( !pTokenRec->m_isDuplicate )
- {
- IfFailGo(pMiniMdEmit->AddFieldMarshalRecord(&pRecEmit, &fmEmit));
-
- // set the parent
- IfFailGo( pMiniMdEmit->PutToken(
- TBL_FieldMarshal,
- FieldMarshalRec::COL_Parent,
- pRecEmit,
- pTokenRec->m_tkTo) );
-
- // move over the constant blob value
- IfFailGo(pMiniMdImport->getNativeTypeOfFieldMarshal(pRecImport, (const BYTE **)&pValue, &cbBlob));
- IfFailGo( pMiniMdEmit->PutBlob(TBL_FieldMarshal, FieldMarshalRec::COL_NativeType, pRecEmit, pValue, cbBlob) );
- IfFailGo( pMiniMdEmit->AddFieldMarshalToHash(fmEmit) );
-
- }
- else
- {
- // <TODO>@FUTURE: more verification on the duplicate??</TODO>
- }
- }
-#if _DEBUG
- else
- {
- typeParent = TypeFromToken(tkParentImp);
-
- if (typeParent == mdtFieldDef)
- {
- // FieldDefs should not be marked
- if ( pMiniMdImport->GetFilterTable()->IsFieldMarked(tkParentImp) == false)
- continue;
- }
- else
- {
- _ASSERTE(typeParent == mdtParamDef);
- // ParamDefs should not be marked
- if ( pMiniMdImport->GetFilterTable()->IsParamMarked(tkParentImp) == false)
- continue;
- }
-
- // If we come to here, that is we have a FieldMarshal whose parent is marked and we don't find it
- // in the map!!!
-
- // either bad lookup map or bad metadata
- _ASSERTE(!"Ignore this assert if you have seen error reported earlier. Otherwise, it is bad state!");
- }
-#endif // _DEBUG
- }
- // Note that we don't need to record the token movement since FieldMarshal is not a valid token kind.
- }
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeFieldMarshals()
-
-
-//*****************************************************************************
-// Merge class layout information
-//*****************************************************************************
-HRESULT NEWMERGER::MergeClassLayouts()
-{
- HRESULT hr = NOERROR;
- ClassLayoutRec *pRecImport = NULL;
- ClassLayoutRec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG iCount;
- ULONG i;
- ULONG iRecord; // class layout is not a token
- mdToken tkParentImp;
- TOKENREC *pTokenRec;
- RID ridClassLayout;
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
- iCount = pMiniMdImport->getCountClassLayouts();
-
- // loop through all TypeRef
- for (i = 1; i <= iCount; i++)
- {
- // compare it with the emit scope
- IfFailGo(pMiniMdImport->GetClassLayoutRecord(i, &pRecImport));
- tkParentImp = pMiniMdImport->getParentOfClassLayout(pRecImport);
-
- // only merge those TypeDefs that are marked
- if ( pMiniMdImport->GetFilterTable()->IsTypeDefMarked(tkParentImp) == false)
- continue;
-
- if ( pCurTkMap->Find(tkParentImp, &pTokenRec) )
- {
- if ( !pTokenRec->m_isDuplicate )
- {
- // If the parent is not duplicated, just copy over the classlayout information
- IfFailGo(pMiniMdEmit->AddClassLayoutRecord(&pRecEmit, &iRecord));
-
- // copy over the fix part information
- pRecEmit->Copy(pRecImport);
- IfFailGo( pMiniMdEmit->PutToken(TBL_ClassLayout, ClassLayoutRec::COL_Parent, pRecEmit, pTokenRec->m_tkTo));
- IfFailGo( pMiniMdEmit->AddClassLayoutToHash(iRecord) );
- }
- else
- {
-
- IfFailGo(pMiniMdEmit->FindClassLayoutHelper(pTokenRec->m_tkTo, &ridClassLayout));
-
- if (InvalidRid(ridClassLayout))
- {
- // class is duplicated but not class layout info
- CheckContinuableErrorEx(META_E_CLASS_LAYOUT_INCONSISTENT, pImportData, tkParentImp);
- }
- else
- {
- IfFailGo(pMiniMdEmit->GetClassLayoutRecord(RidFromToken(ridClassLayout), &pRecEmit));
- if (pMiniMdImport->getPackingSizeOfClassLayout(pRecImport) != pMiniMdEmit->getPackingSizeOfClassLayout(pRecEmit) ||
- pMiniMdImport->getClassSizeOfClassLayout(pRecImport) != pMiniMdEmit->getClassSizeOfClassLayout(pRecEmit) )
- {
- CheckContinuableErrorEx(META_E_CLASS_LAYOUT_INCONSISTENT, pImportData, tkParentImp);
- }
- }
- }
- }
- else
- {
- // bad lookup map
- _ASSERTE( !"bad state!");
- IfFailGo( META_E_BADMETADATA );
- }
- // no need to record the index movement. Classlayout is not a token.
- }
- }
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeClassLayouts()
-
-//*****************************************************************************
-// Merge field layout information
-//*****************************************************************************
-HRESULT NEWMERGER::MergeFieldLayouts()
-{
- HRESULT hr = NOERROR;
- FieldLayoutRec *pRecImport = NULL;
- FieldLayoutRec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG iCount;
- ULONG i;
- ULONG iRecord; // field layout2 is not a token.
- mdToken tkFieldImp;
- TOKENREC *pTokenRec;
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
- iCount = pMiniMdImport->getCountFieldLayouts();
-
- // loop through all FieldLayout records.
- for (i = 1; i <= iCount; i++)
- {
- // compare it with the emit scope
- IfFailGo(pMiniMdImport->GetFieldLayoutRecord(i, &pRecImport));
- tkFieldImp = pMiniMdImport->getFieldOfFieldLayout(pRecImport);
-
- // only merge those FieldDefs that are marked
- if ( pMiniMdImport->GetFilterTable()->IsFieldMarked(tkFieldImp) == false)
- continue;
-
- if ( pCurTkMap->Find(tkFieldImp, &pTokenRec) )
- {
- if ( !pTokenRec->m_isDuplicate )
- {
- // If the Field is not duplicated, just copy over the FieldLayout information
- IfFailGo(pMiniMdEmit->AddFieldLayoutRecord(&pRecEmit, &iRecord));
-
- // copy over the fix part information
- pRecEmit->Copy(pRecImport);
- IfFailGo( pMiniMdEmit->PutToken(TBL_FieldLayout, FieldLayoutRec::COL_Field, pRecEmit, pTokenRec->m_tkTo));
- IfFailGo( pMiniMdEmit->AddFieldLayoutToHash(iRecord) );
- }
- else
- {
- // <TODO>@FUTURE: more verification??</TODO>
- }
- }
- else
- {
- // bad lookup map
- _ASSERTE( !"bad state!");
- IfFailGo( META_E_BADMETADATA );
- }
- // no need to record the index movement. fieldlayout2 is not a token.
- }
- }
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeFieldLayouts()
-
-
-//*****************************************************************************
-// Merge field RVAs
-//*****************************************************************************
-HRESULT NEWMERGER::MergeFieldRVAs()
-{
- HRESULT hr = NOERROR;
- FieldRVARec *pRecImport = NULL;
- FieldRVARec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG iCount;
- ULONG i;
- ULONG iRecord; // FieldRVA is not a token.
- mdToken tkFieldImp;
- TOKENREC *pTokenRec;
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
- iCount = pMiniMdImport->getCountFieldRVAs();
-
- // loop through all FieldRVA records.
- for (i = 1; i <= iCount; i++)
- {
- // compare it with the emit scope
- IfFailGo(pMiniMdImport->GetFieldRVARecord(i, &pRecImport));
- tkFieldImp = pMiniMdImport->getFieldOfFieldRVA(pRecImport);
-
- // only merge those FieldDefs that are marked
- if ( pMiniMdImport->GetFilterTable()->IsFieldMarked(TokenFromRid(tkFieldImp, mdtFieldDef)) == false)
- continue;
-
- if ( pCurTkMap->Find(tkFieldImp, &pTokenRec) )
- {
- if ( !pTokenRec->m_isDuplicate )
- {
- // If the Field is not duplicated, just copy over the FieldRVA information
- IfFailGo(pMiniMdEmit->AddFieldRVARecord(&pRecEmit, &iRecord));
-
- // copy over the fix part information
- pRecEmit->Copy(pRecImport);
- IfFailGo( pMiniMdEmit->PutToken(TBL_FieldRVA, FieldRVARec::COL_Field, pRecEmit, pTokenRec->m_tkTo));
- IfFailGo( pMiniMdEmit->AddFieldRVAToHash(iRecord) );
- }
- else
- {
- // <TODO>@FUTURE: more verification??</TODO>
- }
- }
- else
- {
- // bad lookup map
- _ASSERTE( !"bad state!");
- IfFailGo( META_E_BADMETADATA );
- }
- // no need to record the index movement. FieldRVA is not a token.
- }
- }
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeFieldRVAs()
-
-
-//*****************************************************************************
-// Merge MethodImpl information
-//*****************************************************************************
-HRESULT NEWMERGER::MergeMethodImpls()
-{
- HRESULT hr = NOERROR;
- MethodImplRec *pRecImport = NULL;
- MethodImplRec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG iCount;
- ULONG i;
- RID iRecord;
- mdTypeDef tkClassImp;
- mdToken tkBodyImp;
- mdToken tkDeclImp;
- TOKENREC *pTokenRecClass;
- mdToken tkBodyEmit;
- mdToken tkDeclEmit;
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
- iCount = pMiniMdImport->getCountMethodImpls();
-
- // loop through all the MethodImpls.
- for (i = 1; i <= iCount; i++)
- {
- // only merge those MethodImpls that are marked.
- if ( pMiniMdImport->GetFilterTable()->IsMethodImplMarked(i) == false)
- continue;
-
- // compare it with the emit scope
- IfFailGo(pMiniMdImport->GetMethodImplRecord(i, &pRecImport));
- tkClassImp = pMiniMdImport->getClassOfMethodImpl(pRecImport);
- tkBodyImp = pMiniMdImport->getMethodBodyOfMethodImpl(pRecImport);
- tkDeclImp = pMiniMdImport->getMethodDeclarationOfMethodImpl(pRecImport);
-
- if ( pCurTkMap->Find(tkClassImp, &pTokenRecClass))
- {
- // If the TypeDef is duplicated, no need to move over the MethodImpl record.
- if ( !pTokenRecClass->m_isDuplicate )
- {
- // Create a new record and set the data.
-
- // <TODO>@FUTURE: We might want to consider changing the error for the remap into a continuable error.
- // Because we probably can continue merging for more data...</TODO>
-
- IfFailGo( pCurTkMap->Remap(tkBodyImp, &tkBodyEmit) );
- IfFailGo( pCurTkMap->Remap(tkDeclImp, &tkDeclEmit) );
- IfFailGo(pMiniMdEmit->AddMethodImplRecord(&pRecEmit, &iRecord));
- IfFailGo( pMiniMdEmit->PutToken(TBL_MethodImpl, MethodImplRec::COL_Class, pRecEmit, pTokenRecClass->m_tkTo) );
- IfFailGo( pMiniMdEmit->PutToken(TBL_MethodImpl, MethodImplRec::COL_MethodBody, pRecEmit, tkBodyEmit) );
- IfFailGo( pMiniMdEmit->PutToken(TBL_MethodImpl, MethodImplRec::COL_MethodDeclaration, pRecEmit, tkDeclEmit) );
- IfFailGo( pMiniMdEmit->AddMethodImplToHash(iRecord) );
- }
- else
- {
- // <TODO>@FUTURE: more verification on the duplicate??</TODO>
- }
- // No need to record the token movement, MethodImpl is not a token.
- }
- else
- {
- // either bad lookup map or bad metadata
- _ASSERTE(!"bad state");
- IfFailGo( META_E_BADMETADATA );
- }
- }
- }
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeMethodImpls()
-
-
-//*****************************************************************************
-// Merge PInvoke
-//*****************************************************************************
-HRESULT NEWMERGER::MergePinvoke()
-{
- HRESULT hr = NOERROR;
- ImplMapRec *pRecImport = NULL;
- ImplMapRec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG iCount;
- ULONG i;
- mdModuleRef mrImp;
- mdModuleRef mrEmit;
- mdMethodDef mdImp;
- RID mdImplMap;
- TOKENREC *pTokenRecMR;
- TOKENREC *pTokenRecMD;
-
- USHORT usMappingFlags;
- LPCUTF8 szImportName;
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
- iCount = pMiniMdImport->getCountImplMaps();
-
- // loop through all ImplMaps
- for (i = 1; i <= iCount; i++)
- {
- // compare it with the emit scope
- IfFailGo(pMiniMdImport->GetImplMapRecord(i, &pRecImport));
-
- // Get the MethodDef token in the new space.
- mdImp = pMiniMdImport->getMemberForwardedOfImplMap(pRecImport);
-
- // only merge those MethodDefs that are marked
- if ( pMiniMdImport->GetFilterTable()->IsMethodMarked(mdImp) == false)
- continue;
-
- // Get the ModuleRef token in the new space.
- mrImp = pMiniMdImport->getImportScopeOfImplMap(pRecImport);
-
- // map the token to the new scope
- if (pCurTkMap->Find(mrImp, &pTokenRecMR) == false)
- {
- // This should never fire unless the module refs weren't merged
- // before this code ran.
- _ASSERTE(!"Parent ModuleRef not found in MERGER::MergePinvoke. Bad state!");
- IfFailGo( META_E_BADMETADATA );
- }
-
- // If the ModuleRef has been remapped to the "module token", we need to undo that
- // for the pinvokeimpl. A pinvoke can only have a ModuleRef for the ImportScope.
- mrEmit = pTokenRecMR->m_tkTo;
- if (mrEmit == MODULEDEFTOKEN)
- { // Yes, the ModuleRef has been remapped to the module token. So,
- // find the ModuleRef in the output scope; if it is not found, add
- // it.
- ModuleRefRec *pModRefImport;
- LPCUTF8 szNameImp;
- IfFailGo(pMiniMdImport->GetModuleRefRecord(RidFromToken(mrImp), &pModRefImport));
- IfFailGo(pMiniMdImport->getNameOfModuleRef(pModRefImport, &szNameImp));
-
- // does this ModuleRef already exist in the emit scope?
- hr = ImportHelper::FindModuleRef(pMiniMdEmit,
- szNameImp,
- &mrEmit);
-
- if (hr == CLDB_E_RECORD_NOTFOUND)
- { // No, it doesn't. Copy it over.
- ModuleRefRec *pModRefEmit;
- IfFailGo(pMiniMdEmit->AddModuleRefRecord(&pModRefEmit, (RID*)&mrEmit));
- mrEmit = TokenFromRid(mrEmit, mdtModuleRef);
-
- // Set ModuleRef Name.
- IfFailGo( pMiniMdEmit->PutString(TBL_ModuleRef, ModuleRefRec::COL_Name, pModRefEmit, szNameImp) );
- }
- else
- IfFailGo(hr);
- }
-
-
- if (pCurTkMap->Find(mdImp, &pTokenRecMD) == false)
- {
- // This should never fire unless the method defs weren't merged
- // before this code ran.
- _ASSERTE(!"Parent MethodDef not found in MERGER::MergePinvoke. Bad state!");
- IfFailGo( META_E_BADMETADATA );
- }
-
-
- // Get copy of rest of data.
- usMappingFlags = pMiniMdImport->getMappingFlagsOfImplMap(pRecImport);
- IfFailGo(pMiniMdImport->getImportNameOfImplMap(pRecImport, &szImportName));
-
- // If the method associated with PInvokeMap is not duplicated, then don't bother to look up the
- // duplicated PInvokeMap information.
- if (pTokenRecMD->m_isDuplicate == true)
- {
- // Does the correct ImplMap entry exist in the emit scope?
- IfFailGo(pMiniMdEmit->FindImplMapHelper(pTokenRecMD->m_tkTo, &mdImplMap));
- }
- else
- {
- mdImplMap = mdTokenNil;
- }
- if (!InvalidRid(mdImplMap))
- {
- // Verify that the rest of the data is identical, else it's an error.
- IfFailGo(pMiniMdEmit->GetImplMapRecord(mdImplMap, &pRecEmit));
- _ASSERTE(pMiniMdEmit->getMemberForwardedOfImplMap(pRecEmit) == pTokenRecMD->m_tkTo);
- LPCSTR szImplMapImportName;
- IfFailGo(pMiniMdEmit->getImportNameOfImplMap(pRecEmit, &szImplMapImportName));
- if (pMiniMdEmit->getImportScopeOfImplMap(pRecEmit) != mrEmit ||
- pMiniMdEmit->getMappingFlagsOfImplMap(pRecEmit) != usMappingFlags ||
- strcmp(szImplMapImportName, szImportName))
- {
- // Mismatched p-invoke entries are found.
- _ASSERTE(!"Mismatched P-invoke entries during merge. Bad State!");
- IfFailGo(E_FAIL);
- }
- }
- else
- {
- IfFailGo(pMiniMdEmit->AddImplMapRecord(&pRecEmit, &mdImplMap));
-
- // Copy rest of data.
- IfFailGo( pMiniMdEmit->PutToken(TBL_ImplMap, ImplMapRec::COL_MemberForwarded, pRecEmit, pTokenRecMD->m_tkTo) );
- IfFailGo( pMiniMdEmit->PutToken(TBL_ImplMap, ImplMapRec::COL_ImportScope, pRecEmit, mrEmit) );
- IfFailGo( pMiniMdEmit->PutString(TBL_ImplMap, ImplMapRec::COL_ImportName, pRecEmit, szImportName) );
- pRecEmit->SetMappingFlags(usMappingFlags);
- IfFailGo( pMiniMdEmit->AddImplMapToHash(mdImplMap) );
- }
- }
- }
-
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergePinvoke()
-
-
-//*****************************************************************************
-// Merge StandAloneSigs
-//*****************************************************************************
-HRESULT NEWMERGER::MergeStandAloneSigs()
-{
- HRESULT hr = NOERROR;
- StandAloneSigRec *pRecImport = NULL;
- StandAloneSigRec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG iCount;
- ULONG i;
- TOKENREC *pTokenRec;
- mdSignature saImp;
- mdSignature saEmit;
- bool fDuplicate;
- PCCOR_SIGNATURE pbSig;
- ULONG cbSig;
- ULONG cbEmit;
- CQuickBytes qbSig;
- PCOR_SIGNATURE rgSig;
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
- iCount = pMiniMdImport->getCountStandAloneSigs();
-
- // loop through all Signatures
- for (i = 1; i <= iCount; i++)
- {
- // only merge those Signatures that are marked
- if ( pMiniMdImport->GetFilterTable()->IsSignatureMarked(TokenFromRid(i, mdtSignature)) == false)
- continue;
-
- // compare it with the emit scope
- IfFailGo(pMiniMdImport->GetStandAloneSigRecord(i, &pRecImport));
- IfFailGo(pMiniMdImport->getSignatureOfStandAloneSig(pRecImport, &pbSig, &cbSig));
-
- // This is a signature containing the return type after count of args
- // convert rid contained in signature to new scope
- IfFailGo(ImportHelper::MergeUpdateTokenInSig(
- NULL, // Assembly emit scope.
- pMiniMdEmit, // The emit scope.
- NULL, NULL, 0, // Assembly import scope info.
- pMiniMdImport, // The scope to merge into the emit scope.
- pbSig, // signature from the imported scope
- pCurTkMap, // Internal token mapping structure.
- &qbSig, // [OUT] translated signature
- 0, // start from first byte of the signature
- 0, // don't care how many bytes consumed
- &cbEmit)); // number of bytes write to cbEmit
- rgSig = ( PCOR_SIGNATURE ) qbSig.Ptr();
-
- hr = ImportHelper::FindStandAloneSig(
- pMiniMdEmit,
- rgSig,
- cbEmit,
- &saEmit );
- if ( hr == S_OK )
- {
- // find a duplicate
- fDuplicate = true;
- }
- else
- {
- // copy over
- fDuplicate = false;
- IfFailGo(pMiniMdEmit->AddStandAloneSigRecord(&pRecEmit, (ULONG *)&saEmit));
- saEmit = TokenFromRid(saEmit, mdtSignature);
- IfFailGo( pMiniMdEmit->PutBlob(TBL_StandAloneSig, StandAloneSigRec::COL_Signature, pRecEmit, rgSig, cbEmit));
- }
- saImp = TokenFromRid(i, mdtSignature);
-
- // Record the token movement
- IfFailGo( pCurTkMap->InsertNotFound(saImp, fDuplicate, saEmit, &pTokenRec) );
- }
- }
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeStandAloneSigs()
-
-//*****************************************************************************
-// Merge MethodSpecs
-//*****************************************************************************
-HRESULT NEWMERGER::MergeMethodSpecs()
-{
- HRESULT hr = NOERROR;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG iCount;
- ULONG i;
- mdToken tk;
- ULONG iRecord;
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- // Loop through all MethodSpec
- iCount = pMiniMdImport->getCountMethodSpecs();
- for (i=1; i<=iCount; ++i)
- {
- MethodSpecRec *pRecImport;
- MethodSpecRec *pRecEmit;
- TOKENREC *pTokenRecMethod;
- TOKENREC *pTokenRecMethodNew;
- PCCOR_SIGNATURE pvSig;
- ULONG cbSig;
- CQuickBytes qbSig;
- ULONG cbEmit;
-
- // Only copy marked records.
- if (!pMiniMdImport->GetFilterTable()->IsMethodSpecMarked(i))
- continue;
-
- IfFailGo(pMiniMdImport->GetMethodSpecRecord(i, &pRecImport));
- tk = pMiniMdImport->getMethodOfMethodSpec(pRecImport);
-
- // Map the token to the new scope.
- if (pCurTkMap->Find(tk, &pTokenRecMethod) == false)
- {
- // This should never fire unless the TypeDefs/Refs weren't merged
- // before this code runs.
- _ASSERTE(!"MethodSpec method not found in MERGER::MergeGenericsInfo. Bad state!");
- IfFailGo( META_E_BADMETADATA );
- }
- // Copy to output scope.
- IfFailGo(pMiniMdEmit->AddMethodSpecRecord(&pRecEmit, &iRecord));
- IfFailGo( pMiniMdEmit->PutToken(TBL_MethodSpec, MethodSpecRec::COL_Method, pRecEmit, pTokenRecMethod->m_tkTo));
-
- // Copy the signature, translating any embedded tokens.
- IfFailGo(pMiniMdImport->getInstantiationOfMethodSpec(pRecImport, &pvSig, &cbSig));
-
- // ...convert rid contained in signature to new scope
- IfFailGo(ImportHelper::MergeUpdateTokenInSig(
- NULL, // Assembly emit scope.
- pMiniMdEmit, // The emit scope.
- NULL, NULL, 0, // Import assembly scope information.
- pMiniMdImport, // The scope to merge into the emit scope.
- pvSig, // signature from the imported scope
- pCurTkMap, // Internal token mapping structure.
- &qbSig, // [OUT] translated signature
- 0, // start from first byte of the signature
- 0, // don't care how many bytes consumed
- &cbEmit)); // number of bytes write to cbEmit
-
- // ...persist the converted signature
- IfFailGo( pMiniMdEmit->PutBlob(TBL_MethodSpec, MethodSpecRec::COL_Instantiation, pRecEmit, qbSig.Ptr(), cbEmit) );
-
- IfFailGo( pCurTkMap->InsertNotFound(TokenFromRid(i, mdtMethodSpec), false,
- TokenFromRid(iRecord, mdtMethodSpec), &pTokenRecMethodNew) );
- }
- }
-
- ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeMethodSpecs()
-
-//*****************************************************************************
-// Merge DeclSecuritys
-//*****************************************************************************
-HRESULT NEWMERGER::MergeDeclSecuritys()
-{
- HRESULT hr = NOERROR;
- DeclSecurityRec *pRecImport = NULL;
- DeclSecurityRec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG iCount;
- ULONG i;
- mdToken tkParentImp;
- TOKENREC *pTokenRec;
- void const *pValue;
- ULONG cbBlob;
- mdPermission pmImp;
- mdPermission pmEmit;
- bool fDuplicate;
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
- iCount = pMiniMdImport->getCountDeclSecuritys();
-
- // loop through all DeclSecurity
- for (i = 1; i <= iCount; i++)
- {
- // only merge those DeclSecurities that are marked
- if ( pMiniMdImport->GetFilterTable()->IsDeclSecurityMarked(TokenFromRid(i, mdtPermission)) == false)
- continue;
-
- // compare it with the emit scope
- IfFailGo(pMiniMdImport->GetDeclSecurityRecord(i, &pRecImport));
- tkParentImp = pMiniMdImport->getParentOfDeclSecurity(pRecImport);
- if ( pCurTkMap->Find(tkParentImp, &pTokenRec) )
- {
- if ( !pTokenRec->m_isDuplicate )
- {
- // If the parent is not duplicated, just copy over the custom value
- goto CopyPermission;
- }
- else
- {
- // Try to see if the Permission is there in the emit scope or not.
- // If not, move it over still
- if ( ImportHelper::FindPermission(
- pMiniMdEmit,
- pTokenRec->m_tkTo,
- pRecImport->GetAction(),
- &pmEmit) == S_OK )
- {
- // found a match
- // <TODO>@FUTURE: more verification??</TODO>
- fDuplicate = true;
- }
- else
- {
- // Parent is duplicated but the Permission is not. Still copy over the
- // Permission.
-CopyPermission:
- fDuplicate = false;
- IfFailGo(pMiniMdEmit->AddDeclSecurityRecord(&pRecEmit, (ULONG *)&pmEmit));
- pmEmit = TokenFromRid(pmEmit, mdtPermission);
-
- pRecEmit->Copy(pRecImport);
-
- // set the parent
- IfFailGo( pMiniMdEmit->PutToken(
- TBL_DeclSecurity,
- DeclSecurityRec::COL_Parent,
- pRecEmit,
- pTokenRec->m_tkTo) );
-
- // move over the CustomAttribute blob value
- IfFailGo(pMiniMdImport->getPermissionSetOfDeclSecurity(pRecImport, (const BYTE **)&pValue, &cbBlob));
- IfFailGo(pMiniMdEmit->PutBlob(
- TBL_DeclSecurity,
- DeclSecurityRec::COL_PermissionSet,
- pRecEmit,
- pValue,
- cbBlob));
- }
- }
- pmEmit = TokenFromRid(pmEmit, mdtPermission);
- pmImp = TokenFromRid(i, mdtPermission);
-
- // Record the token movement
- IfFailGo( pCurTkMap->InsertNotFound(pmImp, fDuplicate, pmEmit, &pTokenRec) );
- }
- else
- {
- // bad lookup map
- _ASSERTE(!"bad state");
- IfFailGo( META_E_BADMETADATA );
- }
- }
- }
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeDeclSecuritys()
-
-
-//*****************************************************************************
-// Merge Strings
-//*****************************************************************************
-HRESULT NEWMERGER::MergeStrings()
-{
- HRESULT hr = NOERROR;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- TOKENREC *pTokenRec;
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- for (UINT32 nIndex = 0; ;)
- {
- MetaData::DataBlob userString;
- UINT32 nNextIndex;
- UINT32 nEmitIndex;
-
- hr = pMiniMdImport->GetUserStringAndNextIndex(
- nIndex,
- &userString,
- &nNextIndex);
- IfFailGo(hr);
- if (hr == S_FALSE)
- { // We reached the last user string
- hr = S_OK;
- break;
- }
- _ASSERTE(hr == S_OK);
-
- // Skip empty strings
- if (userString.IsEmpty())
- {
- nIndex = nNextIndex;
- continue;
- }
-
- if (pMiniMdImport->GetFilterTable()->IsUserStringMarked(TokenFromRid(nIndex, mdtString)) == false)
- {
- // Process next user string in the heap
- nIndex = nNextIndex;
- continue;
- }
-
- IfFailGo(pMiniMdEmit->PutUserString(
- userString,
- &nEmitIndex));
-
- IfFailGo(pCurTkMap->InsertNotFound(
- TokenFromRid(nIndex, mdtString),
- false,
- TokenFromRid(nEmitIndex, mdtString),
- &pTokenRec));
-
- // Process next user string in the heap
- nIndex = nNextIndex;
- }
- }
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeStrings()
-
-// Helper method to merge the module-level security critical attributes
-// Strips all module-level security critical attribute [that won't be ultimately needed]
-// Returns:
-// FAILED(hr): Failure occurred retrieving metadata or parsing scopes
-// S_OK: Attribute should be merged into final output scope
-// S_FALSE: Attribute should be ignored/dropped from output scope
-HRESULT NEWMERGER::MergeSecurityCriticalModuleLevelAttributes(
- MergeImportData* pImportData, // import scope
- mdToken tkParentImp, // parent token with attribute
- TOKENREC* pTypeRec, // token record of attribute ctor
- mdToken mrSecurityTreatAsSafeAttributeCtor, // 'generic' TAS attribute token
- mdToken mrSecurityTransparentAttributeCtor, // 'generic' Transparent attribute token
- mdToken mrSecurityCriticalExplicitAttributeCtor, // 'generic' Critical attribute token
- mdToken mrSecurityCriticalEverythingAttributeCtor)
-{
- HRESULT hr = S_OK;
-
- // if ANY assembly-level critical attributes were specified, then we'll output
- // one assembly-level Critical(Explicit) attribute only
- // AND if this scope has tags
- if (ISSCS_Unknown != pImportData->m_isscsSecurityCriticalStatus)
- {
- _ASSERTE(ISSCS_Unknown != m_isscsSecurityCritical);
- // drop only assembly-level attributes
- TypeRefRec* pTypeRefRec;
- // metadata emitter
- CMiniMdRW* pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // if compiler is generating a module - then this will be a module token
- LPCSTR szTypeRefName;
- if (tkParentImp == MODULEDEFTOKEN ||
- // otherwise, if merging assemblies, we have a fake type ref called MODULE_CA_LOCATION
- (TypeFromToken(tkParentImp) == mdtTypeRef &&
- (IsAttributeFromNamespace(pMiniMdImport, tkParentImp,
- COR_COMPILERSERVICE_NAMESPACE, COR_MSCORLIB_NAME,
- &pTypeRefRec) == S_OK) &&
- (pMiniMdImport->getNameOfTypeRef(pTypeRefRec, &szTypeRefName) == S_OK) &&
- (strcmp(MODULE_CA_TYPENAME, szTypeRefName) == 0)))
- {
- // drop the TAS attribute (unless all scopes have TAS)
- if ( pTypeRec->m_tkTo == mrSecurityTreatAsSafeAttributeCtor )
- {
- if ((m_isscsSecurityCriticalAllScopes & ISSCS_SecurityTreatAsSafe) ==
- ISSCS_SecurityTreatAsSafe)
- {
- _ASSERTE((pImportData->m_isscsSecurityCriticalStatus & ISSCS_SecurityTreatAsSafe) ==
- ISSCS_SecurityTreatAsSafe);
- return S_OK;
- }
- return S_FALSE;
- }
- // drop the Transparent attribute (unless all scopes have Transparent)
- else if (pTypeRec->m_tkTo == mrSecurityTransparentAttributeCtor)
- {
- if ((m_isscsSecurityCriticalAllScopes & ISSCS_SecurityTransparent) ==
- ISSCS_SecurityTransparent)
- {
- _ASSERTE((pImportData->m_isscsSecurityCriticalStatus & ISSCS_SecurityTransparent) ==
- ISSCS_SecurityTransparent);
- return S_OK;
- }
- return S_FALSE;
- }
- else if (pTypeRec->m_tkTo == mrSecurityCriticalExplicitAttributeCtor)
- {
- // if NOT Critical Everything, then leave the Critical.Explicit attribute
- // the Critical.Explicit attribute will be used as the final global attribute
- if ((m_isscsSecurityCriticalAllScopes & ISSCS_SecurityCriticalEverything) !=
- ISSCS_SecurityCriticalEverything)
- {
- _ASSERTE((pImportData->m_isscsSecurityCriticalStatus & ISSCS_SecurityCriticalExplicit) ==
- ISSCS_SecurityCriticalExplicit);
- return S_OK;
- }
- else
- {
- // drop this attribute
- return S_FALSE;
- }
- }
- else if (pTypeRec->m_tkTo == mrSecurityCriticalEverythingAttributeCtor)
- {
- // OPTIMIZATION: if all attributes are Critical.Everything,
- // then leave the global Critical attribute
- if ((m_isscsSecurityCriticalAllScopes & ISSCS_SecurityCriticalEverything) ==
- ISSCS_SecurityCriticalEverything)
- {
- _ASSERTE((pImportData->m_isscsSecurityCriticalStatus & ISSCS_SecurityCriticalEverything) ==
- ISSCS_SecurityCriticalEverything);
- return S_OK;
- }
- else
- {
- // drop this attribute
- return S_FALSE;
- }
- }
- }
- }
-
- return hr;
-} // NEWMERGER::MergeSecurityCriticalModuleLevelAttributes
-
-// HELPER: Retrieve the meta-data info related to SecurityCritical
-HRESULT NEWMERGER::RetrieveStandardSecurityCriticalMetaData(
- mdAssemblyRef& tkMscorlib,
- mdTypeRef& securityEnum,
- BYTE*& rgSigBytesSecurityCriticalEverythingCtor,
- DWORD& dwSigEverythingSize,
- BYTE*& rgSigBytesSecurityCriticalExplicitCtor,
- DWORD& dwSigExplicitSize)
-{
- HRESULT hr = S_OK;
-
- CMiniMdRW* emit = GetMiniMdEmit();
-
- // get typeref for mscorlib
- BYTE pbMscorlibToken[] = COR_MSCORLIB_TYPEREF;
- BYTE* pCurr = rgSigBytesSecurityCriticalEverythingCtor;
-
- IfFailGo(ImportHelper::FindAssemblyRef(emit,
- COR_MSCORLIB_NAME,
- NULL,
- pbMscorlibToken,
- sizeof(pbMscorlibToken),
- asm_rmj,
- asm_rmm,
- asm_rup,
- asm_rpt,
- 0,
- &tkMscorlib));
-
- IfFailGo(m_pRegMetaEmit->DefineTypeRefByName(tkMscorlib,
- COR_SECURITYCRITICALSCOPE_ENUM_W,
- &securityEnum));
-
- // build the constructor sig that takes SecurityCriticalScope argument
- if (rgSigBytesSecurityCriticalEverythingCtor)
- {
- *pCurr++ = IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS;
- *pCurr++ = COR_SECURITYCRITICAL_CTOR_ARGCOUNT_SCOPE_EVERYTHING; // one argument to constructor
- *pCurr++ = ELEMENT_TYPE_VOID;
- *pCurr++ = ELEMENT_TYPE_VALUETYPE;
- pCurr += CorSigCompressToken(securityEnum, pCurr);
- dwSigEverythingSize = (DWORD)(pCurr - rgSigBytesSecurityCriticalEverythingCtor);
- _ASSERTE(dwSigEverythingSize <= COR_SECURITYCRITICAL_CTOR_SCOPE_SIG_MAX_SIZE);
- }
-
- // if Explicit ctor is requested
- if (rgSigBytesSecurityCriticalExplicitCtor)
- {
- // build the constructor sig that has NO arguments
- pCurr = rgSigBytesSecurityCriticalExplicitCtor;
- *pCurr++ = IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS;
- *pCurr++ = COR_SECURITYCRITICAL_CTOR_ARGCOUNT_NO_SCOPE; // no arguments to constructor
- *pCurr++ = ELEMENT_TYPE_VOID;
- dwSigExplicitSize = (DWORD)(pCurr - rgSigBytesSecurityCriticalExplicitCtor);
- _ASSERTE(dwSigExplicitSize <= COR_SECURITYCRITICAL_CTOR_NO_SCOPE_SIG_MAX_SIZE);
- }
-
-ErrExit:
- return hr;
-} // NEWMERGER::RetrieveStandardSecurityCriticalMetaData
-
-//*****************************************************************************
-// Merge CustomAttributes
-//*****************************************************************************
-HRESULT NEWMERGER::MergeCustomAttributes()
-{
-
- HRESULT hr = NOERROR;
- CustomAttributeRec *pRecImport = NULL;
- CustomAttributeRec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- ULONG iCount;
- ULONG i;
- mdToken tkParentImp; // Token of attributed object (parent).
- TOKENREC *pTokenRec; // Parent's remap.
- mdToken tkType; // Token of attribute's type.
- TOKENREC *pTypeRec; // Type's remap.
- void const *pValue; // The actual value.
- ULONG cbBlob; // Size of the value.
- mdToken cvImp;
- mdToken cvEmit;
- bool fDuplicate;
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- TypeRefRec *pTypeRefRec;
- ULONG cTypeRefRecs;
- mdToken mrSuppressMergeCheckAttributeCtor = mdTokenNil;
- mdToken mrSecurityCriticalExplicitAttributeCtor = mdTokenNil;
- mdToken mrSecurityCriticalEverythingAttributeCtor = mdTokenNil;
- mdToken mrSecurityTransparentAttributeCtor = mdTokenNil;
- mdToken mrSecurityTreatAsSafeAttributeCtor = mdTokenNil;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- // Find out the TypeRef referring to our library's System.CompilerServices.SuppressMergeCheckAttribute,
- // System.Security.SecurityCriticalAttribute, System.Security.SecurityTransparentAttribute, and
- // System.Security.SecurityTreatAsSafeAttibute
- cTypeRefRecs = pMiniMdEmit->getCountTypeRefs();
-
- { // retrieve global attribute TypeRefs
-
- mdAssemblyRef tkMscorlib = mdTokenNil;
- mdTypeRef securityEnum = mdTokenNil;
-
- NewArrayHolder<BYTE> rgSigBytesSecurityCriticalEverythingCtor(new (nothrow)BYTE[COR_SECURITYCRITICAL_CTOR_SCOPE_SIG_MAX_SIZE]);
- BYTE* pSigBytesSecurityCriticalEverythingCtor = rgSigBytesSecurityCriticalEverythingCtor.GetValue();
- IfFailGo((pSigBytesSecurityCriticalEverythingCtor == NULL)?E_OUTOFMEMORY:S_OK);
- DWORD dwSigEverythingSize = 0;
-
- NewArrayHolder<BYTE> rgSigBytesSecurityCriticalExplicitCtor(new (nothrow)BYTE[COR_SECURITYCRITICAL_CTOR_NO_SCOPE_SIG_MAX_SIZE]);
- BYTE* pSigBytesSecurityCriticalExplicitCtor = rgSigBytesSecurityCriticalExplicitCtor.GetValue();
- IfFailGo((pSigBytesSecurityCriticalExplicitCtor == NULL)?E_OUTOFMEMORY:S_OK);
- DWORD dwSigExplicitSize = 0;
-
- // retrieve security critical metadata info if necessary
- if(ISSCS_Unknown != m_isscsSecurityCritical)
- {
-
- hr = RetrieveStandardSecurityCriticalMetaData(
- tkMscorlib,
- securityEnum,
- pSigBytesSecurityCriticalEverythingCtor,
- dwSigEverythingSize,
- pSigBytesSecurityCriticalExplicitCtor,
- dwSigExplicitSize);
-
- }
-
- // Search for the TypeRef.
- for (i = 1; i <= cTypeRefRecs; i++)
- {
- mdToken tkTmp = TokenFromRid(i,mdtTypeRef);
-
- if (IsAttributeFromNamespace(pMiniMdEmit, tkTmp,
- COR_COMPILERSERVICE_NAMESPACE, COR_MSCORLIB_NAME,
- &pTypeRefRec) == S_OK)
- {
- LPCSTR szNameOfTypeRef;
- IfFailGo(pMiniMdEmit->getNameOfTypeRef(pTypeRefRec, &szNameOfTypeRef));
- if (strcmp(szNameOfTypeRef, COR_SUPPRESS_MERGE_CHECK_ATTRIBUTE) == 0)
- {
- hr = ImportHelper::FindMemberRef(
- pMiniMdEmit, tkTmp,
- COR_CTOR_METHOD_NAME,
- NULL, 0,
- &mrSuppressMergeCheckAttributeCtor);
- if (S_OK == hr) continue;
- }
- }
- else
- // if we are merging security critical attributes, then look for transparent-related attributes
- if ((ISSCS_Unknown != m_isscsSecurityCritical) &&
- (IsAttributeFromNamespace(pMiniMdEmit, tkTmp,
- COR_SECURITYCRITICAL_ATTRIBUTE_NAMESPACE, COR_MSCORLIB_NAME,
- &pTypeRefRec) == S_OK))
- {
- LPCSTR szNameOfTypeRef;
- IfFailGo(pMiniMdEmit->getNameOfTypeRef(pTypeRefRec, &szNameOfTypeRef));
-
- // look for the SecurityCritical attribute
- if (strcmp(szNameOfTypeRef, COR_SECURITYCRITICAL_ATTRIBUTE) == 0)
- {
- // since the SecurityCritical attribute can be either
- // parameterless constructor or SecurityCriticalScope constructor, we
- // look for both
- hr = ImportHelper::FindMemberRef(
- pMiniMdEmit, tkTmp,
- COR_CTOR_METHOD_NAME,
- rgSigBytesSecurityCriticalEverythingCtor.GetValue(), dwSigEverythingSize,
- &mrSecurityCriticalEverythingAttributeCtor);
- if (S_OK == hr) continue;
- hr = ImportHelper::FindMemberRef(
- pMiniMdEmit, tkTmp,
- COR_CTOR_METHOD_NAME,
- rgSigBytesSecurityCriticalExplicitCtor.GetValue(), dwSigExplicitSize,
- &mrSecurityCriticalExplicitAttributeCtor);
- if (S_OK == hr) continue;
- }
- else
- // look for the SecurityTransparent attribute
- if (strcmp(szNameOfTypeRef, COR_SECURITYTRANSPARENT_ATTRIBUTE) == 0)
- {
- hr = ImportHelper::FindMemberRef(
- pMiniMdEmit, tkTmp,
- COR_CTOR_METHOD_NAME,
- NULL, 0,
- &mrSecurityTransparentAttributeCtor);
- if (S_OK == hr) continue;
- }
- else
- // look for the SecurityTreatAsSafe attribute
- if (strcmp(szNameOfTypeRef, COR_SECURITYTREATASSAFE_ATTRIBUTE) == 0)
- {
- hr = ImportHelper::FindMemberRef(
- pMiniMdEmit, tkTmp,
- COR_CTOR_METHOD_NAME,
- NULL, 0,
- &mrSecurityTreatAsSafeAttributeCtor);
- if (S_OK == hr) continue;
- }
- }
- hr = S_OK; // ignore failures since the attribute may not be used
- }
- }
-
- // Loop over every module scope
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // We know that the filter table is not null here. Tell PREFIX that we know it.
- PREFIX_ASSUME( pMiniMdImport->GetFilterTable() != NULL );
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
- iCount = pMiniMdImport->getCountCustomAttributes();
-
- // loop through all CustomAttribute
- for (i = 1; i <= iCount; i++)
- {
- // compare it with the emit scope
- IfFailGo(pMiniMdImport->GetCustomAttributeRecord(i, &pRecImport));
- tkParentImp = pMiniMdImport->getParentOfCustomAttribute(pRecImport);
- tkType = pMiniMdImport->getTypeOfCustomAttribute(pRecImport);
- IfFailGo(pMiniMdImport->getValueOfCustomAttribute(pRecImport, (const BYTE **)&pValue, &cbBlob));
-
- // only merge those CustomAttributes that are marked
- if ( pMiniMdImport->GetFilterTable()->IsCustomAttributeMarked(TokenFromRid(i, mdtCustomAttribute)) == false)
- continue;
-
- // Check the type of the CustomAttribute. If it is not marked, then we don't need to move over the CustomAttributes.
- // This will only occur for compiler defined discardable CAs during linking.
- //
- if ( pMiniMdImport->GetFilterTable()->IsTokenMarked(tkType) == false)
- continue;
-
- if ( pCurTkMap->Find(tkParentImp, &pTokenRec) )
- {
- // If the From token type is different from the To token's type, we have optimized the ref to def.
- // In this case, we are dropping the CA associated with the Ref tokens.
- //
- if (TypeFromToken(tkParentImp) == TypeFromToken(pTokenRec->m_tkTo))
- {
-
- // If tkParentImp is a MemberRef and it is also mapped to a MemberRef in the merged scope with a MethodDef
- // parent, then it is a MemberRef optimized to a MethodDef. We are keeping the MemberRef because it is a
- // vararg call. So we can drop CAs on this MemberRef.
- if (TypeFromToken(tkParentImp) == mdtMemberRef)
- {
- MemberRefRec *pTempRec;
- IfFailGo(pMiniMdEmit->GetMemberRefRecord(RidFromToken(pTokenRec->m_tkTo), &pTempRec));
- if (TypeFromToken(pMiniMdEmit->getClassOfMemberRef(pTempRec)) == mdtMethodDef)
- continue;
- }
-
-
- if (! pCurTkMap->Find(tkType, &pTypeRec) )
- {
- _ASSERTE(!"CustomAttribute Type not found in output scope");
- IfFailGo(META_E_BADMETADATA);
- }
-
- // Determine if we need to copy or ignore security-critical-related attributes
- hr = MergeSecurityCriticalModuleLevelAttributes(
- pImportData, tkParentImp, pTypeRec,
- mrSecurityTreatAsSafeAttributeCtor, mrSecurityTransparentAttributeCtor,
- mrSecurityCriticalExplicitAttributeCtor,
- mrSecurityCriticalEverythingAttributeCtor);
- IfFailGo(hr);
- // S_FALSE means skip attribute
- if (hr == S_FALSE) continue;
- // S_OK means consider copying attribute
-
- // if it's the SuppressMergeCheckAttribute, don't copy it
- if ( pTypeRec->m_tkTo == mrSuppressMergeCheckAttributeCtor )
- {
- continue;
- }
-
- if ( pTokenRec->m_isDuplicate)
- {
- // Try to see if the custom value is there in the emit scope or not.
- // If not, move it over still
- hr = ImportHelper::FindCustomAttributeByToken(
- pMiniMdEmit,
- pTokenRec->m_tkTo,
- pTypeRec->m_tkTo,
- pValue,
- cbBlob,
- &cvEmit);
-
- if ( hr == S_OK )
- {
- // found a match
- // <TODO>@FUTURE: more verification??</TODO>
- fDuplicate = true;
- }
- else
- {
- TypeRefRec *pAttributeTypeRefRec;
- // We need to allow additive merge on TypeRef for CustomAttributes because compiler
- // could build module but not assembly. They are hanging of Assembly level CAs on a bogus
- // TypeRef.
- // Also allow additive merge for CAs from CompilerServices and Microsoft.VisualC
- if (tkParentImp == MODULEDEFTOKEN
- || TypeFromToken(tkParentImp) == mdtTypeRef
- || (IsAttributeFromNamespace(pMiniMdImport, tkType,
- COR_COMPILERSERVICE_NAMESPACE, COR_MSCORLIB_NAME,
- &pAttributeTypeRefRec) == S_OK)
- || (IsAttributeFromNamespace(pMiniMdImport, tkType,
- COR_MISCBITS_NAMESPACE, COR_MISCBITS_NAMESPACE,
- &pAttributeTypeRefRec) == S_OK))
- {
- // clear the error
- hr = NOERROR;
-
- // custom value of module token! Copy over the custom value
- goto CopyCustomAttribute;
- }
-
- // another case to support additive merge if the CA on MehtodDef is
- // HandleProcessCorruptedStateExceptionsAttribute
- if ( TypeFromToken(tkParentImp) == mdtMethodDef && tkType == pImportData->m_tkHandleProcessCorruptedStateCtor)
- {
- // clear the error
- hr = NOERROR;
-
- // custom value of module token! Copy over the custom value
- goto CopyCustomAttribute;
- }
- CheckContinuableErrorEx(META_E_MD_INCONSISTENCY, pImportData, TokenFromRid(i, mdtCustomAttribute));
- }
- }
- else
- {
-CopyCustomAttribute:
- if ((m_dwMergeFlags & DropMemberRefCAs) && TypeFromToken(pTokenRec->m_tkTo) == mdtMemberRef)
- {
- // CustomAttributes associated with MemberRef. If the parent of MemberRef is a MethodDef or FieldDef, drop
- // the custom attribute.
- MemberRefRec *pMemberRefRec;
- IfFailGo(pMiniMdEmit->GetMemberRefRecord(RidFromToken(pTokenRec->m_tkTo), &pMemberRefRec));
- mdToken mrParent = pMiniMdEmit->getClassOfMemberRef(pMemberRefRec);
- if (TypeFromToken(mrParent) == mdtMethodDef || TypeFromToken(mrParent) == mdtFieldDef)
- {
- // Don't bother to copy over
- continue;
- }
- }
-
- // Parent is duplicated but the custom value is not. Still copy over the
- // custom value.
- fDuplicate = false;
- IfFailGo(pMiniMdEmit->AddCustomAttributeRecord(&pRecEmit, (ULONG *)&cvEmit));
- cvEmit = TokenFromRid(cvEmit, mdtCustomAttribute);
-
- // set the parent
- IfFailGo( pMiniMdEmit->PutToken(TBL_CustomAttribute, CustomAttributeRec::COL_Parent, pRecEmit, pTokenRec->m_tkTo) );
- // set the type
- IfFailGo( pMiniMdEmit->PutToken(TBL_CustomAttribute, CustomAttributeRec::COL_Type, pRecEmit, pTypeRec->m_tkTo));
-
- // move over the CustomAttribute blob value
- IfFailGo(pMiniMdImport->getValueOfCustomAttribute(pRecImport, (const BYTE **)&pValue, &cbBlob));
-
- IfFailGo( pMiniMdEmit->PutBlob(TBL_CustomAttribute, CustomAttributeRec::COL_Value, pRecEmit, pValue, cbBlob));
- IfFailGo( pMiniMdEmit->AddCustomAttributesToHash(cvEmit) );
- }
- cvEmit = TokenFromRid(cvEmit, mdtCustomAttribute);
- cvImp = TokenFromRid(i, mdtCustomAttribute);
-
- // Record the token movement
- IfFailGo( pCurTkMap->InsertNotFound(cvImp, pTokenRec->m_isDuplicate, cvEmit, &pTokenRec) );
- }
- }
- else
- {
-
- // either bad lookup map or bad metadata
- _ASSERTE(!"Bad state");
- IfFailGo( META_E_BADMETADATA );
- }
- }
- }
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeCustomAttributes()
-
-//*******************************************************************************
-// Helper to check if input scope has assembly-level security transparent awareness (either SecurityTransparent or SecurityCritical)
-// SIDE EFFECT: pImportData->m_isscsSecurityCriticalStatus will be explicitly set [same value as return value]
-// SecurityCritical.Explicit attribute injection occurs for all scopes that have tags (e.g. NOT ISSCS_Unknown)
-// If the tagged scopes are all SecurityCritical.Everything, then the final attribute should be SecurityCritical.Everything
-// anyway. Otherwise, at least one SecurityCritical.Explicit tag will be used/injected
-//*******************************************************************************
-InputScopeSecurityCriticalStatus NEWMERGER::CheckInputScopeIsCritical(MergeImportData* pImportData, HRESULT& hr)
-{
- hr = S_OK;
-
- // the attribute should be in a known state no matter how we return from this function
- // default to no attribute explicitly specified
- pImportData->m_isscsSecurityCriticalStatus = ISSCS_Unknown;
-
- mdTypeRef fakeModuleTypeRef = mdTokenNil;
- mdAssemblyRef tkMscorlib = mdTokenNil;
-
- // TODO: Should we remove the ability to disable merging critical attributes?
- if (g_fRefShouldMergeCriticalChecked == FALSE)
- {
- // shouldn't require thread safety lock
- g_fRefShouldMergeCritical = (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_MergeCriticalAttributes) != 0);
- g_fRefShouldMergeCriticalChecked = TRUE;
- }
-
- // return no merge needed, if the merge critical attribute setting is not enabled.
- if (!g_fRefShouldMergeCritical) return ISSCS_Unknown;
-
- // get typeref for mscorlib
- BYTE pbMscorlibToken[] = COR_MSCORLIB_TYPEREF;
-
- CMiniMdRW* pImportedMiniMd = &pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd;
-
- if (S_OK != ImportHelper::FindAssemblyRef(pImportedMiniMd,
- COR_MSCORLIB_NAME,
- NULL,
- pbMscorlibToken,
- sizeof(pbMscorlibToken),
- asm_rmj,
- asm_rmm,
- asm_rup,
- asm_rpt,
- 0,
- &tkMscorlib))
- {
- // there isn't an mscorlib ref here... we can't have the security critical attribute
- return ISSCS_Unknown;
- }
-
- if (S_OK != ImportHelper::FindTypeRefByName(pImportedMiniMd,
- tkMscorlib,
- COR_COMPILERSERVICE_NAMESPACE,
- MODULE_CA_TYPENAME,
- &fakeModuleTypeRef))
- {
- // for now let use the fake module ref as the assembly def
- fakeModuleTypeRef = 0x000001;
- }
-
- // Check the input scope for TreatAsSafe
- if (S_OK == ImportHelper::GetCustomAttributeByName(pImportedMiniMd,
- fakeModuleTypeRef, // This is the assembly def token
- COR_SECURITYTREATASSAFE_ATTRIBUTE_FULL,
- NULL,
- NULL))
- {
- pImportData->m_isscsSecurityCriticalStatus |= ISSCS_SecurityTreatAsSafe;
- }
-
- // Check the input scope for security transparency awareness
- // For example, the assembly is marked SecurityTransparent, SecurityCritical(Explicit), or SecurityCritical(Everything)
-
-
- const void *pbData = NULL; // [OUT] Put pointer to data here.
- ULONG cbData = 0; // number of bytes in pbData
-
- // Check if the SecurityTransparent attribute is present
- if (S_OK == ImportHelper::GetCustomAttributeByName(pImportedMiniMd,
- fakeModuleTypeRef, // This is the assembly def token
- COR_SECURITYTRANSPARENT_ATTRIBUTE_FULL,
- NULL,
- NULL))
- {
- pImportData->m_isscsSecurityCriticalStatus |= ISSCS_SecurityTransparent;
- }
- else
- // Check if the SecurityCritical attribute is present
- if (S_OK == ImportHelper::GetCustomAttributeByName(pImportedMiniMd,
- fakeModuleTypeRef, // This is the assembly def token
- COR_SECURITYCRITICAL_ATTRIBUTE_FULL,
- &pbData,
- &cbData))
- {
- // find out if critical everything or explicit
-
- // default to critical
- pImportData->m_isscsSecurityCriticalStatus = ISSCS_SecurityCritical;
-
- BYTE rgSecurityCriticalEverythingCtorValue[] = COR_SECURITYCRITICAL_ATTRIBUTE_VALUE_EVERYTHING;
- // if value is non-0 (i.e. 1), then mark as SecurityCritical everything, otherwise, explicit
- if (NULL != pbData && cbData == 8 &&
- memcmp(rgSecurityCriticalEverythingCtorValue, pbData, cbData) == 0)
- {
- pImportData->m_isscsSecurityCriticalStatus |= ISSCS_SecurityCriticalEverything;
- }
- else
- {
- pImportData->m_isscsSecurityCriticalStatus |= ISSCS_SecurityCriticalExplicit;
- }
- }
-
- return pImportData->m_isscsSecurityCriticalStatus;
-} // HRESULT NEWMERGER::CheckInputScopeIsCritical()
-
-//*******************************************************************************
-// Helper to merge security critical annotations across assemblies and types
-//*******************************************************************************
-HRESULT NEWMERGER::MergeSecurityCriticalAttributes()
-{
- // if no assembly-level critical attributes were specified, then none are needed,
- // and no need to do special attribute merging
- if (ISSCS_Unknown == m_isscsSecurityCritical)
- {
- return S_OK;
- }
- // or if the global-scope already has TAS/Critical.Everything, then ignore individual type fixes
- else if ((ISSCS_SECURITYCRITICAL_LEGACY & m_isscsSecurityCriticalAllScopes) == ISSCS_SECURITYCRITICAL_LEGACY)
- {
- return S_OK;
- }
-
- HRESULT hr = S_OK;
-
- CMiniMdRW* emit = GetMiniMdEmit();
- // The attribute we want to decorate all of the types with has not been defined.
- mdMemberRef tkSecurityCriticalEverythingAttribute = mdTokenNil;
- mdMemberRef tkSecurityTreatAsSafeAttribute = mdTokenNil;
- mdMemberRef tkSecuritySafeCriticalAttribute = mdTokenNil;
-
- mdAssemblyRef tkMscorlib = mdTokenNil;
- mdTypeRef fakeModuleTypeRef = mdTokenNil;
- mdTypeRef securityEnum = mdTokenNil;
-
- DWORD dwSigSize;
- BYTE* rgSigBytesSecurityCriticalExplicitCtor = 0;
- DWORD dwSigSize_TEMP;
-
- BYTE rgSigBytesTreatAsSafeCtor[] = {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0x00, ELEMENT_TYPE_VOID};
-
- BYTE rgSecurityCriticalEverythingCtorValue[] = COR_SECURITYCRITICAL_ATTRIBUTE_VALUE_EVERYTHING;
-
-
- mdTypeRef tkSecurityCriticalEverythingAttributeType = mdTokenNil;
- mdTypeRef tkSecurityTreatAsSafeAttributeType = mdTokenNil;
-
- NewArrayHolder<BYTE> rgSigBytesSecurityCriticalEverythingCtor(new (nothrow)BYTE[COR_SECURITYCRITICAL_CTOR_SCOPE_SIG_MAX_SIZE]);
- BYTE* pSigBytesSecurityCriticalEverythingCtor = rgSigBytesSecurityCriticalEverythingCtor.GetValue();
- IfFailGo((pSigBytesSecurityCriticalEverythingCtor == NULL)?E_OUTOFMEMORY:S_OK);
-
- IfFailGo(RetrieveStandardSecurityCriticalMetaData(
- tkMscorlib,
- securityEnum,
- pSigBytesSecurityCriticalEverythingCtor,
- dwSigSize,
- rgSigBytesSecurityCriticalExplicitCtor,
- dwSigSize_TEMP));
-
- if (S_OK != ImportHelper::FindTypeRefByName(emit,
- tkMscorlib,
- COR_COMPILERSERVICE_NAMESPACE,
- MODULE_CA_TYPENAME,
- &fakeModuleTypeRef))
- {
- // for now let use the fake module ref as the assembly def
- fakeModuleTypeRef = 0x000001;
- }
-
- IfFailGo(m_pRegMetaEmit->DefineTypeRefByName(
- tkMscorlib, COR_SECURITYCRITICAL_ATTRIBUTE_FULL_W, &tkSecurityCriticalEverythingAttributeType));
-
- IfFailGo(m_pRegMetaEmit->DefineMemberRef(tkSecurityCriticalEverythingAttributeType,
- COR_CONSTRUCTOR_METADATA_IDENTIFIER,
- rgSigBytesSecurityCriticalEverythingCtor.GetValue(),
- dwSigSize,
- &tkSecurityCriticalEverythingAttribute));
-
- IfFailGo(m_pRegMetaEmit->DefineTypeRefByName(
- tkMscorlib, COR_SECURITYTREATASSAFE_ATTRIBUTE_FULL_W,
- &tkSecurityTreatAsSafeAttributeType));
-
- IfFailGo(m_pRegMetaEmit->DefineMemberRef(tkSecurityTreatAsSafeAttributeType,
- COR_CONSTRUCTOR_METADATA_IDENTIFIER,
- rgSigBytesTreatAsSafeCtor,
- sizeof(rgSigBytesTreatAsSafeCtor),
- &tkSecurityTreatAsSafeAttribute));
-
-
- // place this block in a new scope so that we can safely goto past it
- {
- mdTypeRef tkSecuritySafeCriticalAttributeType = mdTokenNil;
- if (FAILED (hr = m_pRegMetaEmit->DefineTypeRefByName(tkMscorlib, COR_SECURITYSAFECRITICAL_ATTRIBUTE_FULL_W,
- &tkSecuritySafeCriticalAttributeType)))
- {
- _ASSERTE(!"Couldn't Emit a Typeref for SafeCritical attribute");
- return hr;
- }
-
- BYTE rgSigBytesSafeCriticalCtor[] = {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0x00, ELEMENT_TYPE_VOID};
- if (FAILED(hr = m_pRegMetaEmit->DefineMemberRef(tkSecuritySafeCriticalAttributeType,
- W(".ctor"),
- rgSigBytesSafeCriticalCtor,
- sizeof(rgSigBytesSafeCriticalCtor),
- &tkSecuritySafeCriticalAttribute)))
- {
- _ASSERTE(!"Couldn't Emit a MemberRef for SafeCritical attribute .ctor");
- return hr;
- }
- }
-
-
- for (MergeImportData* pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // if the import is marked TAS, then we need to explicitly mark each type as TAS
- // if the import is marked Crit/Everything, then we need to explicitly mark each type as Crit
- // if the import is not marked at all, then we need to explicitly mark each type TAS/Crit
-
- // if the import is marked ONLY Crit/Explicit or ONLY Transparent then we can ignore it
- if (ISSCS_SecurityTransparent == pImportData->m_isscsSecurityCriticalStatus ||
- ISSCS_SecurityCriticalExplicit == pImportData->m_isscsSecurityCriticalStatus) continue;
-
- // Run through the scopes that need to have their types decorated with this attribute
- MDTOKENMAP*pCurTKMap = pImportData->m_pMDTokenMap;
- BYTE rgTreatAsSafeCtorValue[] = COR_SECURITYTREATASSAFE_ATTRIBUTE_VALUE;
-
- BOOL fMarkEachTokenAsCritical = FALSE;
- // if the import is unmarked or marked Crit/Everything,
- // then we need to explicitly mark each token as Crit
- // Unless the the global scope already has SecurityCritical.Everything
- if (((ISSCS_SecurityCriticalEverything & m_isscsSecurityCriticalAllScopes) != ISSCS_SecurityCriticalEverything) &&
- (((ISSCS_SecurityCriticalEverything & pImportData->m_isscsSecurityCriticalStatus) == ISSCS_SecurityCriticalEverything ) ||
-
- // OR this scope is NOT transparent or critical-explicit
- (ISSCS_SecurityTransparent & pImportData->m_isscsSecurityCriticalStatus) == 0 ||
- (ISSCS_SecurityCritical & pImportData->m_isscsSecurityCriticalStatus) == 0 ||
-
- // OR this scope is UNKNOWN
- (ISSCS_Unknown == (ISSCS_SECURITYCRITICAL_FLAGS & pImportData->m_isscsSecurityCriticalStatus))))
- {
- fMarkEachTokenAsCritical = TRUE;
- }
-
- BOOL fMarkEachTokenAsSafe = FALSE;
- // if the import is unmarked or marked TAS,
- // then we need to explicitly mark each token as TAS
- // Unless the the global scope already has SecurityTreatAsSafe
- if (((ISSCS_SecurityTreatAsSafe & m_isscsSecurityCriticalAllScopes) != ISSCS_SecurityTreatAsSafe) &&
- ((ISSCS_SecurityTreatAsSafe & pImportData->m_isscsSecurityCriticalStatus) ||
- ISSCS_Unknown == (pImportData->m_isscsSecurityCriticalStatus & ISSCS_SECURITYCRITICAL_FLAGS)))
- {
- fMarkEachTokenAsSafe = TRUE;
- }
-
- BYTE rgSafeCriticalCtorValue[] = {0x01, 0x00, 0x00 ,0x00};
-
- for (int i = 0; i < pCurTKMap->Count(); i++)
- {
- TOKENREC* pRec = pCurTKMap->Get(i);
- BOOL fInjectSecurityAttributes = FALSE;
-
- // skip empty records
- if (pRec->IsEmpty()) continue;
-
- // If this scope contained a typeref that was resolved to a typedef, let's not mark it. We'll let the owner
- // of the actual typedef decide if that type should be marked.
- if ((TypeFromToken(pRec->m_tkFrom) == mdtTypeRef) && (TypeFromToken(pRec->m_tkTo) == mdtTypeDef))
- continue;
-
- // Same for method refs/method defs
- if ((TypeFromToken(pRec->m_tkFrom) == mdtMemberRef) && (TypeFromToken(pRec->m_tkTo) == mdtMethodDef))
- continue;
-
- // check for typedefs, but don't put this on the global typedef
- if ((TypeFromToken(pRec->m_tkTo) == mdtTypeDef) && (pRec->m_tkTo != TokenFromRid(1, mdtTypeDef)))
- {
- // by default we will inject
- fInjectSecurityAttributes = TRUE;
- // except for Enums
- DWORD dwClassAttrs = 0;
- mdTypeRef crExtends = mdTokenNil;
-
- if (FAILED(hr = m_pRegMetaEmit->GetTypeDefProps(pRec->m_tkTo, NULL, NULL, 0 , &dwClassAttrs, &crExtends)))
- {
- // TODO: should we fail ??
- }
-
- // check for Enum types
- if (!IsNilToken(crExtends) && (TypeFromToken(crExtends)==mdtTypeRef))
- {
- // get the namespace and the name for this token
- CMiniMdRW *pMiniMd = GetMiniMdEmit();
- TypeRefRec *pTypeRefRec;
- IfFailGo(pMiniMd->GetTypeRefRecord(RidFromToken(crExtends), &pTypeRefRec));
- LPCSTR szNamespace;
- LPCSTR szName;
- IfFailGo(pMiniMd->getNamespaceOfTypeRef(pTypeRefRec, &szNamespace));;
- IfFailGo(pMiniMd->getNameOfTypeRef(pTypeRefRec, &szName));
- // check for System.Enum
- BOOL bIsEnum = (!strcmp(szNamespace,"System"))&&(!strcmp(szName,"Enum"));
- if (bIsEnum)
- {
- fInjectSecurityAttributes = FALSE;
- }
- }
- }
- else // check for global method defs
- if (TypeFromToken(pRec->m_tkTo) == mdtMethodDef)
- {
- int isGlobal = 0;
- if (!FAILED(m_pRegMetaEmit->IsGlobal(pRec->m_tkTo, &isGlobal)))
- {
- // check for global methods
- if (isGlobal != 0)
- {
- fInjectSecurityAttributes = TRUE;
- }
- }
- }
-
- if (fInjectSecurityAttributes)
- {
- // check to see if the token already has a custom attribute
- const void *pbData = NULL; // [OUT] Put pointer to data here.
- ULONG cbData = 0;
-
- if (fMarkEachTokenAsCritical)
- {
- // Check if the Type already has SecurityCritical
- BOOL fInjectSecurityCriticalEverything = TRUE;
- if (S_OK == m_pRegMetaEmit->GetCustomAttributeByName(pRec->m_tkTo, COR_SECURITYCRITICAL_ATTRIBUTE_FULL_W, &pbData, &cbData))
- {
- // if value is non-0 (i.e. 1), then it is SecurityCritical.Everything - so do not inject another
- fInjectSecurityCriticalEverything = !(NULL != pbData && cbData == 8 &&
- memcmp(rgSecurityCriticalEverythingCtorValue, pbData, cbData) == 0);
- }
-
- // either inject or overwrite SecurityCritical.Everything
- if (fInjectSecurityCriticalEverything)
- {
- IfFailGo(m_pRegMetaEmit->DefineCustomAttribute(
- pRec->m_tkTo, tkSecurityCriticalEverythingAttribute,
- rgSecurityCriticalEverythingCtorValue, // Use this if you need specific custom attribute data (presence of the attribute isn't enough)
- sizeof(rgSecurityCriticalEverythingCtorValue), // Length of your custom attribute data
- NULL));
- }
- }
-
- // If the Type does NOT already have TAS then add it
- if (fMarkEachTokenAsSafe &&
- S_OK != m_pRegMetaEmit->GetCustomAttributeByName(pRec->m_tkTo, COR_SECURITYTREATASSAFE_ATTRIBUTE_FULL_W, &pbData, &cbData))
- {
- IfFailGo(m_pRegMetaEmit->DefineCustomAttribute(
- pRec->m_tkTo, tkSecurityTreatAsSafeAttribute,
- rgTreatAsSafeCtorValue, // Use this if you need specific custom attribute data (presence of the attribute isn't enough)
- sizeof(rgTreatAsSafeCtorValue), // Length of your custom attribute data
- NULL));
- }
-
- hr = m_pRegMetaEmit->DefineCustomAttribute(pRec->m_tkTo, tkSecuritySafeCriticalAttribute,
- rgSafeCriticalCtorValue, // Use this if you need specific custom attribute data (presence of the attribute isn't enough)
- sizeof(rgSafeCriticalCtorValue), // Length of your custom attribute data
- NULL);
-
- }
- }
- }
-
- // If the global scope is not Transparent, we should emit SecurityCritical.Explicit || Everything
- if ((m_isscsSecurityCriticalAllScopes & ISSCS_SecurityTransparent) != ISSCS_SecurityTransparent &&
- (m_isscsSecurityCritical & ISSCS_SecurityCriticalEverything) != ISSCS_SecurityCriticalExplicit)
- {
- BOOL fEmitSecurityEverything = FALSE;
- // in the case of Unmarked and TAS/Unmarked, we need to emit the SecurityCritical.Everything attribute
- // if it hasn't already been emitted
- if ((m_isscsSecurityCriticalAllScopes & ISSCS_SecurityCriticalEverything) ==
- ISSCS_SecurityCriticalEverything)
- {
- fEmitSecurityEverything = TRUE;
- }
- // otherwise, emit the SecurityCritical.Explicit attribute
-
- BOOL fSecurityCriticalExists = FALSE;
- // check to see if the assembly already has the appropriate SecurityCritical attribute
- // [from one of the input scopes]
- const void *pbData = NULL;
- ULONG cbData = 0;
- if (S_OK == ImportHelper::GetCustomAttributeByName(emit,
- fakeModuleTypeRef, // This is the assembly def token
- COR_SECURITYCRITICAL_ATTRIBUTE_FULL,
- &pbData,
- &cbData))
- {
- // find out if critical everything or explicit
- // default to critical
- // if value is non-0 (i.e. 1), then mark as SecurityCritical everything, otherwise, explicit
- if (NULL != pbData && cbData == 8 &&
- memcmp(rgSecurityCriticalEverythingCtorValue, pbData, cbData) == 0)
- {
- if (!fEmitSecurityEverything)
- {
- _ASSERTE(!"Unexpected SecurityCritical.Everything attribute detected");
- IfFailGo(META_E_BADMETADATA);
- }
- }
- else
- {
- if (fEmitSecurityEverything)
- {
- _ASSERTE(!"Unexpected SecurityCritical.Explicit attribute detected");
- IfFailGo(META_E_BADMETADATA);
- }
- }
- fSecurityCriticalExists = TRUE;
- }
-
- if (!fSecurityCriticalExists)
- {
- // retrieve the type and CustomAttribute
- mdCustomAttribute tkSecurityCriticalAttributeExplicit;
-
- mdTypeRef tkSecurityCriticalExplicitAttributeType = mdTokenNil;
-
- IfFailGo(m_pRegMetaEmit->DefineTypeRefByName(
- tkMscorlib, COR_SECURITYCRITICAL_ATTRIBUTE_FULL_W,
- &tkSecurityCriticalExplicitAttributeType));
-
- BYTE rgSigBytesSecurityCriticalExplicitCtorLocal[] = {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0x00, ELEMENT_TYPE_VOID};
- BYTE rgSecurityCriticalExplicitCtorValue[] = COR_SECURITYCRITICAL_ATTRIBUTE_VALUE_EXPLICIT;
-
- IfFailGo(m_pRegMetaEmit->DefineMemberRef(tkSecurityCriticalExplicitAttributeType,
- COR_CONSTRUCTOR_METADATA_IDENTIFIER,
- rgSigBytesSecurityCriticalExplicitCtorLocal,
- sizeof(rgSigBytesSecurityCriticalExplicitCtorLocal),
- &tkSecurityCriticalAttributeExplicit));
-
- IfFailGo(m_pRegMetaEmit->DefineCustomAttribute(
- fakeModuleTypeRef,
- fEmitSecurityEverything?tkSecurityCriticalEverythingAttribute:tkSecurityCriticalAttributeExplicit,
- fEmitSecurityEverything?rgSecurityCriticalEverythingCtorValue:rgSecurityCriticalExplicitCtorValue,
- fEmitSecurityEverything?sizeof(rgSecurityCriticalEverythingCtorValue):sizeof(rgSecurityCriticalExplicitCtorValue),
- NULL));
-
- }
- }
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeSecurityCriticalAttributes()
-
-//*******************************************************************************
-// Helper to copy an InterfaceImpl record
-//*******************************************************************************
-HRESULT NEWMERGER::CopyInterfaceImpl(
- InterfaceImplRec *pRecEmit, // [IN] the emit record to fill
- MergeImportData *pImportData, // [IN] the importing context
- InterfaceImplRec *pRecImp) // [IN] the record to import
-{
- HRESULT hr;
- mdToken tkParent;
- mdToken tkInterface;
- CMiniMdRW *pMiniMdEmit = GetMiniMdEmit();
- CMiniMdRW *pMiniMdImp;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdImp = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
-
- tkParent = pMiniMdImp->getClassOfInterfaceImpl(pRecImp);
- tkInterface = pMiniMdImp->getInterfaceOfInterfaceImpl(pRecImp);
-
- IfFailGo( pCurTkMap->Remap(tkParent, &tkParent) );
- IfFailGo( pCurTkMap->Remap(tkInterface, &tkInterface) );
-
- IfFailGo( pMiniMdEmit->PutToken( TBL_InterfaceImpl, InterfaceImplRec::COL_Class, pRecEmit, tkParent) );
- IfFailGo( pMiniMdEmit->PutToken( TBL_InterfaceImpl, InterfaceImplRec::COL_Interface, pRecEmit, tkInterface) );
-
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::CopyInterfaceImpl()
-
-
-//*****************************************************************************
-// Merge Assembly table
-//*****************************************************************************
-HRESULT NEWMERGER::MergeAssembly()
-{
- HRESULT hr = NOERROR;
- AssemblyRec *pRecImport = NULL;
- AssemblyRec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- LPCUTF8 szTmp;
- const BYTE *pbTmp;
- ULONG cbTmp;
- ULONG iRecord;
- TOKENREC *pTokenRec;
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
- if (!pMiniMdImport->getCountAssemblys())
- goto ErrExit; // There is no Assembly in the import scope to merge.
-
- // Copy the Assembly map record to the Emit scope and send a token remap notifcation
- // to the client. No duplicate checking needed since the Assembly can be present in
- // only one scope and there can be atmost one entry.
- IfFailGo(pMiniMdImport->GetAssemblyRecord(1, &pRecImport));
- IfFailGo(pMiniMdEmit->AddAssemblyRecord(&pRecEmit, &iRecord));
-
- pRecEmit->Copy(pRecImport);
-
- IfFailGo(pMiniMdImport->getPublicKeyOfAssembly(pRecImport, &pbTmp, &cbTmp));
- IfFailGo(pMiniMdEmit->PutBlob(TBL_Assembly, AssemblyRec::COL_PublicKey, pRecEmit,
- pbTmp, cbTmp));
-
- IfFailGo(pMiniMdImport->getNameOfAssembly(pRecImport, &szTmp));
- IfFailGo(pMiniMdEmit->PutString(TBL_Assembly, AssemblyRec::COL_Name, pRecEmit, szTmp));
-
- IfFailGo(pMiniMdImport->getLocaleOfAssembly(pRecImport, &szTmp));
- IfFailGo(pMiniMdEmit->PutString(TBL_Assembly, AssemblyRec::COL_Locale, pRecEmit, szTmp));
-
- // record the token movement.
- IfFailGo(pCurTkMap->InsertNotFound(
- TokenFromRid(1, mdtAssembly),
- false,
- TokenFromRid(iRecord, mdtAssembly),
- &pTokenRec));
- }
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeAssembly()
-
-
-
-
-//*****************************************************************************
-// Merge File table
-//*****************************************************************************
-HRESULT NEWMERGER::MergeFiles()
-{
- HRESULT hr = NOERROR;
- FileRec *pRecImport = NULL;
- FileRec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- LPCUTF8 szTmp;
- const void *pbTmp;
- ULONG cbTmp;
- ULONG iCount;
- ULONG i;
- ULONG iRecord;
- TOKENREC *pTokenRec;
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
- iCount = pMiniMdImport->getCountFiles();
-
- // Loop through all File records and copy them to the Emit scope.
- // Since there can only be one File table in all the scopes combined,
- // there isn't any duplicate checking that needs to be done.
- for (i = 1; i <= iCount; i++)
- {
- IfFailGo(pMiniMdImport->GetFileRecord(i, &pRecImport));
- IfFailGo(pMiniMdEmit->AddFileRecord(&pRecEmit, &iRecord));
-
- pRecEmit->Copy(pRecImport);
-
- IfFailGo(pMiniMdImport->getNameOfFile(pRecImport, &szTmp));
- IfFailGo(pMiniMdEmit->PutString(TBL_File, FileRec::COL_Name, pRecEmit, szTmp));
-
- IfFailGo(pMiniMdImport->getHashValueOfFile(pRecImport, (const BYTE **)&pbTmp, &cbTmp));
- IfFailGo(pMiniMdEmit->PutBlob(TBL_File, FileRec::COL_HashValue, pRecEmit, pbTmp, cbTmp));
-
- // record the token movement.
- IfFailGo(pCurTkMap->InsertNotFound(
- TokenFromRid(i, mdtFile),
- false,
- TokenFromRid(iRecord, mdtFile),
- &pTokenRec));
- }
- }
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeFiles()
-
-
-//*****************************************************************************
-// Merge ExportedType table
-//*****************************************************************************
-HRESULT NEWMERGER::MergeExportedTypes()
-{
- HRESULT hr = NOERROR;
- ExportedTypeRec *pRecImport = NULL;
- ExportedTypeRec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- LPCUTF8 szTmp;
- mdToken tkTmp;
- ULONG iCount;
- ULONG i;
- ULONG iRecord;
- TOKENREC *pTokenRec;
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
- iCount = pMiniMdImport->getCountExportedTypes();
-
- // Loop through all ExportedType records and copy them to the Emit scope.
- // Since there can only be one ExportedType table in all the scopes combined,
- // there isn't any duplicate checking that needs to be done.
- for (i = 1; i <= iCount; i++)
- {
- IfFailGo(pMiniMdImport->GetExportedTypeRecord(i, &pRecImport));
- IfFailGo(pMiniMdEmit->AddExportedTypeRecord(&pRecEmit, &iRecord));
-
- pRecEmit->Copy(pRecImport);
-
- IfFailGo(pMiniMdImport->getTypeNameOfExportedType(pRecImport, &szTmp));
- IfFailGo(pMiniMdEmit->PutString(TBL_ExportedType, ExportedTypeRec::COL_TypeName, pRecEmit, szTmp));
-
- IfFailGo(pMiniMdImport->getTypeNamespaceOfExportedType(pRecImport, &szTmp));
- IfFailGo(pMiniMdEmit->PutString(TBL_ExportedType, ExportedTypeRec::COL_TypeNamespace, pRecEmit, szTmp));
-
- tkTmp = pMiniMdImport->getImplementationOfExportedType(pRecImport);
- IfFailGo(pCurTkMap->Remap(tkTmp, &tkTmp));
- IfFailGo(pMiniMdEmit->PutToken(TBL_ExportedType, ExportedTypeRec::COL_Implementation,
- pRecEmit, tkTmp));
-
-
- // record the token movement.
- IfFailGo(pCurTkMap->InsertNotFound(
- TokenFromRid(i, mdtExportedType),
- false,
- TokenFromRid(iRecord, mdtExportedType),
- &pTokenRec));
- }
- }
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeExportedTypes()
-
-
-//*****************************************************************************
-// Merge ManifestResource table
-//*****************************************************************************
-HRESULT NEWMERGER::MergeManifestResources()
-{
- HRESULT hr = NOERROR;
- ManifestResourceRec *pRecImport = NULL;
- ManifestResourceRec *pRecEmit = NULL;
- CMiniMdRW *pMiniMdImport;
- CMiniMdRW *pMiniMdEmit;
- LPCUTF8 szTmp;
- mdToken tkTmp;
- ULONG iCount;
- ULONG i;
- ULONG iRecord;
- TOKENREC *pTokenRec;
-
- MergeImportData *pImportData;
- MDTOKENMAP *pCurTkMap;
-
- pMiniMdEmit = GetMiniMdEmit();
-
- for (pImportData = m_pImportDataList; pImportData != NULL; pImportData = pImportData->m_pNextImportData)
- {
- // for each import scope
- pMiniMdImport = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
-
- // set the current MDTokenMap
- pCurTkMap = pImportData->m_pMDTokenMap;
- iCount = pMiniMdImport->getCountManifestResources();
-
- // Loop through all ManifestResource records and copy them to the Emit scope.
- // Since there can only be one ManifestResource table in all the scopes combined,
- // there isn't any duplicate checking that needs to be done.
- for (i = 1; i <= iCount; i++)
- {
- IfFailGo(pMiniMdImport->GetManifestResourceRecord(i, &pRecImport));
- IfFailGo(pMiniMdEmit->AddManifestResourceRecord(&pRecEmit, &iRecord));
-
- pRecEmit->Copy(pRecImport);
-
- IfFailGo(pMiniMdImport->getNameOfManifestResource(pRecImport, &szTmp));
- IfFailGo(pMiniMdEmit->PutString(TBL_ManifestResource, ManifestResourceRec::COL_Name,
- pRecEmit, szTmp));
-
- tkTmp = pMiniMdImport->getImplementationOfManifestResource(pRecImport);
- IfFailGo(pCurTkMap->Remap(tkTmp, &tkTmp));
- IfFailGo(pMiniMdEmit->PutToken(TBL_ManifestResource, ManifestResourceRec::COL_Implementation,
- pRecEmit, tkTmp));
-
- // record the token movement.
- IfFailGo(pCurTkMap->InsertNotFound(
- TokenFromRid(i, mdtManifestResource),
- false,
- TokenFromRid(iRecord, mdtManifestResource),
- &pTokenRec));
- }
- }
-ErrExit:
- return hr;
-} // HRESULT NEWMERGER::MergeManifestResources()
-
-
-
-
-
-//*****************************************************************************
-// Error handling. Call back to host to see what they want to do.
-//*****************************************************************************
-HRESULT NEWMERGER::OnError(
- HRESULT hrIn, // The error HR we're reporting.
- MergeImportData *pImportData, // The input scope with the error.
- mdToken token) // The token with the error.
-{
- // This function does a QI and a Release on every call. However, it should be
- // called very infrequently, and lets the scope just keep a generic handler.
- IMetaDataError *pIErr = NULL;
- IUnknown *pHandler = pImportData->m_pHandler;
- CMiniMdRW *pMiniMd = &(pImportData->m_pRegMetaImport->m_pStgdb->m_MiniMd);
- CQuickArray<WCHAR> rName; // Name of the TypeDef in unicode.
- LPCUTF8 szTypeName;
- LPCUTF8 szNSName;
- TypeDefRec *pTypeRec;
- int iLen; // Length of a name.
- mdToken tkParent;
- HRESULT hr = NOERROR;
-
- if (pHandler && pHandler->QueryInterface(IID_IMetaDataError, (void**)&pIErr)==S_OK)
- {
- switch (hrIn)
- {
-
- case META_E_PARAM_COUNTS:
- case META_E_METHD_NOT_FOUND:
- case META_E_METHDIMPL_INCONSISTENT:
- {
- LPCUTF8 szMethodName;
- MethodRec *pMethodRec;
-
- // Method name.
- _ASSERTE(TypeFromToken(token) == mdtMethodDef);
- IfFailGo(pMiniMd->GetMethodRecord(RidFromToken(token), &pMethodRec));
- IfFailGo(pMiniMd->getNameOfMethod(pMethodRec, &szMethodName));
- MAKE_WIDEPTR_FROMUTF8_NOTHROW(wzMethodName, szMethodName);
- IfNullGo(wzMethodName);
-
- // Type and its name.
- IfFailGo( pMiniMd->FindParentOfMethodHelper(token, &tkParent) );
- IfFailGo(pMiniMd->GetTypeDefRecord(RidFromToken(tkParent), &pTypeRec));
- IfFailGo(pMiniMd->getNameOfTypeDef(pTypeRec, &szTypeName));
- IfFailGo(pMiniMd->getNamespaceOfTypeDef(pTypeRec, &szNSName));
- // Put namespace + name together.
- iLen = ns::GetFullLength(szNSName, szTypeName);
- IfFailGo(rName.ReSizeNoThrow(iLen+1));
- ns::MakePath(rName.Ptr(), iLen+1, szNSName, szTypeName);
-
- PostError(hrIn, (LPWSTR) rName.Ptr(), wzMethodName, token);
- break;
- }
- case META_E_FIELD_NOT_FOUND:
- {
- LPCUTF8 szFieldName;
- FieldRec *pFieldRec;
-
- // Field name.
- _ASSERTE(TypeFromToken(token) == mdtFieldDef);
- IfFailGo(pMiniMd->GetFieldRecord(RidFromToken(token), &pFieldRec));
- IfFailGo(pMiniMd->getNameOfField(pFieldRec, &szFieldName));
- MAKE_WIDEPTR_FROMUTF8_NOTHROW(wzFieldName, szFieldName);
- IfNullGo(wzFieldName);
-
- // Type and its name.
- IfFailGo( pMiniMd->FindParentOfFieldHelper(token, &tkParent) );
- IfFailGo(pMiniMd->GetTypeDefRecord(RidFromToken(tkParent), &pTypeRec));
- IfFailGo(pMiniMd->getNameOfTypeDef(pTypeRec, &szTypeName));
- IfFailGo(pMiniMd->getNamespaceOfTypeDef(pTypeRec, &szNSName));
- // Put namespace + name together.
- iLen = ns::GetFullLength(szNSName, szTypeName);
- IfFailGo(rName.ReSizeNoThrow(iLen+1));
- ns::MakePath(rName.Ptr(), iLen+1, szNSName, szTypeName);
-
- PostError(hrIn, (LPWSTR) rName.Ptr(), wzFieldName, token);
- break;
- }
- case META_E_EVENT_NOT_FOUND:
- {
- LPCUTF8 szEventName;
- EventRec *pEventRec;
-
- // Event name.
- _ASSERTE(TypeFromToken(token) == mdtEvent);
- IfFailGo(pMiniMd->GetEventRecord(RidFromToken(token), &pEventRec));
- IfFailGo(pMiniMd->getNameOfEvent(pEventRec, &szEventName));
- MAKE_WIDEPTR_FROMUTF8_NOTHROW(wzEventName, szEventName);
- IfNullGo(wzEventName);
-
- // Type and its name.
- IfFailGo( pMiniMd->FindParentOfEventHelper(token, &tkParent) );
- IfFailGo(pMiniMd->GetTypeDefRecord(RidFromToken(tkParent), &pTypeRec));
- IfFailGo(pMiniMd->getNameOfTypeDef(pTypeRec, &szTypeName));
- IfFailGo(pMiniMd->getNamespaceOfTypeDef(pTypeRec, &szNSName));
- // Put namespace + name together.
- iLen = ns::GetFullLength(szNSName, szTypeName);
- IfFailGo(rName.ReSizeNoThrow(iLen+1));
- ns::MakePath(rName.Ptr(), iLen+1, szNSName, szTypeName);
-
- PostError(hrIn, (LPWSTR) rName.Ptr(), wzEventName, token);
- break;
- }
- case META_E_PROP_NOT_FOUND:
- {
- LPCUTF8 szPropertyName;
- PropertyRec *pPropertyRec;
-
- // Property name.
- _ASSERTE(TypeFromToken(token) == mdtProperty);
- IfFailGo(pMiniMd->GetPropertyRecord(RidFromToken(token), &pPropertyRec));
- IfFailGo(pMiniMd->getNameOfProperty(pPropertyRec, &szPropertyName));
- MAKE_WIDEPTR_FROMUTF8_NOTHROW(wzPropertyName, szPropertyName);
- IfNullGo(wzPropertyName);
-
- // Type and its name.
- IfFailGo( pMiniMd->FindParentOfPropertyHelper(token, &tkParent) );
- IfFailGo(pMiniMd->GetTypeDefRecord(RidFromToken(tkParent), &pTypeRec));
- IfFailGo(pMiniMd->getNameOfTypeDef(pTypeRec, &szTypeName));
- IfFailGo(pMiniMd->getNamespaceOfTypeDef(pTypeRec, &szNSName));
- // Put namespace + name together.
- iLen = ns::GetFullLength(szNSName, szTypeName);
- IfFailGo(rName.ReSizeNoThrow(iLen+1));
- ns::MakePath(rName.Ptr(), iLen+1, szNSName, szTypeName);
-
- PostError(hrIn, (LPWSTR) rName.Ptr(), wzPropertyName, token);
- break;
- }
- case META_S_PARAM_MISMATCH:
- {
- LPCUTF8 szMethodName;
- MethodRec *pMethodRec;
- mdToken tkMethod;
-
- // Method name.
- _ASSERTE(TypeFromToken(token) == mdtParamDef);
- IfFailGo( pMiniMd->FindParentOfParamHelper(token, &tkMethod) );
- IfFailGo(pMiniMd->GetMethodRecord(RidFromToken(tkMethod), &pMethodRec));
- IfFailGo(pMiniMd->getNameOfMethod(pMethodRec, &szMethodName));
- MAKE_WIDEPTR_FROMUTF8_NOTHROW(wzMethodName, szMethodName);
- IfNullGo(wzMethodName);
-
- // Type and its name.
- IfFailGo( pMiniMd->FindParentOfMethodHelper(token, &tkParent) );
- IfFailGo(pMiniMd->GetTypeDefRecord(RidFromToken(tkParent), &pTypeRec));
- IfFailGo(pMiniMd->getNameOfTypeDef(pTypeRec, &szTypeName));
- IfFailGo(pMiniMd->getNamespaceOfTypeDef(pTypeRec, &szNSName));
- // Put namespace + name together.
- iLen = ns::GetFullLength(szNSName, szTypeName);
- IfFailGo(rName.ReSizeNoThrow(iLen+1));
- ns::MakePath(rName.Ptr(), iLen+1, szNSName, szTypeName);
-
- // use the error hresult so that we can post the correct error.
- PostError(META_E_PARAM_MISMATCH, wzMethodName, (LPWSTR) rName.Ptr(), token);
- break;
- }
- case META_E_INTFCEIMPL_NOT_FOUND:
- {
- InterfaceImplRec *pRec; // The InterfaceImpl
- mdToken tkIface; // Token of the implemented interface.
- CQuickArray<WCHAR> rIface; // Name of the Implemented Interface in unicode.
- TypeRefRec *pRef; // TypeRef record when II is a typeref.
- InterfaceImplRec *pInterfaceImplRec;
-
- // Get the record.
- _ASSERTE(TypeFromToken(token) == mdtInterfaceImpl);
- IfFailGo(pMiniMd->GetInterfaceImplRecord(RidFromToken(token), &pRec));
- // Get the name of the class.
- tkParent = pMiniMd->getClassOfInterfaceImpl(pRec);
- IfFailGo(pMiniMd->GetTypeDefRecord(RidFromToken(tkParent), &pTypeRec));
- IfFailGo(pMiniMd->getNameOfTypeDef(pTypeRec, &szTypeName));
- IfFailGo(pMiniMd->getNamespaceOfTypeDef(pTypeRec, &szNSName));
- // Put namespace + name together.
- iLen = ns::GetFullLength(szNSName, szTypeName);
- IfFailGo(rName.ReSizeNoThrow(iLen+1));
- ns::MakePath(rName.Ptr(), iLen+1, szNSName, szTypeName);
-
- // Get the name of the implemented interface.
- IfFailGo(pMiniMd->GetInterfaceImplRecord(RidFromToken(token), &pInterfaceImplRec));
- tkIface = pMiniMd->getInterfaceOfInterfaceImpl(pInterfaceImplRec);
- if (TypeFromToken(tkIface) == mdtTypeDef)
- { // If it is a typedef...
- IfFailGo(pMiniMd->GetTypeDefRecord(RidFromToken(tkIface), &pTypeRec));
- IfFailGo(pMiniMd->getNameOfTypeDef(pTypeRec, &szTypeName));
- IfFailGo(pMiniMd->getNamespaceOfTypeDef(pTypeRec, &szNSName));
- }
- else
- { // If it is a typeref...
- _ASSERTE(TypeFromToken(tkIface) == mdtTypeRef);
- IfFailGo(pMiniMd->GetTypeRefRecord(RidFromToken(tkIface), &pRef));
- IfFailGo(pMiniMd->getNameOfTypeRef(pRef, &szTypeName));
- IfFailGo(pMiniMd->getNamespaceOfTypeRef(pRef, &szNSName));
- }
- // Put namespace + name together.
- iLen = ns::GetFullLength(szNSName, szTypeName);
- IfFailGo(rIface.ReSizeNoThrow(iLen+1));
- ns::MakePath(rIface.Ptr(), iLen+1, szNSName, szTypeName);
-
-
- PostError(hrIn, (LPWSTR) rName.Ptr(), (LPWSTR)rIface.Ptr(), token);
- break;
- }
- case META_E_CLASS_LAYOUT_INCONSISTENT:
- case META_E_METHOD_COUNTS:
- case META_E_FIELD_COUNTS:
- case META_E_EVENT_COUNTS:
- case META_E_PROPERTY_COUNTS:
- {
- // get the type name.
- _ASSERTE(TypeFromToken(token) == mdtTypeDef);
- IfFailGo(pMiniMd->GetTypeDefRecord(RidFromToken(token), &pTypeRec));
- IfFailGo(pMiniMd->getNameOfTypeDef(pTypeRec, &szTypeName));
- IfFailGo(pMiniMd->getNamespaceOfTypeDef(pTypeRec, &szNSName));
- // Put namespace + name together.
- iLen = ns::GetFullLength(szNSName, szTypeName);
- IfFailGo(rName.ReSizeNoThrow(iLen+1));
- ns::MakePath(rName.Ptr(), iLen+1, szNSName, szTypeName);
-
- PostError(hrIn, (LPWSTR) rName.Ptr(), token);
- break;
- }
- case META_E_GENERICPARAM_INCONSISTENT:
- {
- // If token is type, get type name; if method, get method name.
- LPWSTR wzName;
- LPCUTF8 szMethodName;
- MethodRec *pMethodRec;
-
- if ((TypeFromToken(token) == mdtMethodDef))
- {
- // Get the method name.
- IfFailGo(pMiniMd->GetMethodRecord(RidFromToken(token), &pMethodRec));
- IfFailGo(pMiniMd->getNameOfMethod(pMethodRec, &szMethodName));
- MAKE_WIDEPTR_FROMUTF8_NOTHROW(wzMethodName, szMethodName);
- IfNullGo(wzMethodName);
- wzName = wzMethodName;
- }
- else
- {
- // Get the type name.
- _ASSERTE(TypeFromToken(token) == mdtTypeDef);
- IfFailGo(pMiniMd->GetTypeDefRecord(RidFromToken(token), &pTypeRec));
- IfFailGo(pMiniMd->getNameOfTypeDef(pTypeRec, &szTypeName));
- IfFailGo(pMiniMd->getNamespaceOfTypeDef(pTypeRec, &szNSName));
- // Put namespace + name together.
- iLen = ns::GetFullLength(szNSName, szTypeName);
- IfFailGo(rName.ReSizeNoThrow(iLen+1));
- ns::MakePath(rName.Ptr(), iLen+1, szNSName, szTypeName);
- wzName = (LPWSTR)rName.Ptr();
- }
-
- PostError(hrIn, wzName, token);
- break;
- }
- case META_E_TYPEDEF_MISSING:
- {
- TypeRefRec *pRef; // TypeRef record when II is a typeref.
-
- // Get the record.
- _ASSERTE(TypeFromToken(token) == mdtTypeRef);
- IfFailGo(pMiniMd->GetTypeRefRecord(RidFromToken(token), &pRef));
- IfFailGo(pMiniMd->getNameOfTypeRef(pRef, &szTypeName));
- IfFailGo(pMiniMd->getNamespaceOfTypeRef(pRef, &szNSName));
-
- // Put namespace + name together.
- iLen = ns::GetFullLength(szNSName, szTypeName);
- IfFailGo(rName.ReSizeNoThrow(iLen+1));
- ns::MakePath(rName.Ptr(), iLen+1, szNSName, szTypeName);
-
-
- PostError(hrIn, (LPWSTR) rName.Ptr(), token);
- break;
- }
- default:
- {
- PostError(hrIn, token);
- break;
- }
- }
- hr = pIErr->OnError(hrIn, token);
- }
- else
- hr = S_FALSE;
-ErrExit:
- if (pIErr)
- pIErr->Release();
- return (hr);
-} // NEWMERGER::OnError
-
-#endif //FEATURE_METADATA_EMIT_ALL
diff --git a/src/md/compiler/newmerger.h b/src/md/compiler/newmerger.h
deleted file mode 100644
index fc89ab7f61..0000000000
--- a/src/md/compiler/newmerger.h
+++ /dev/null
@@ -1,256 +0,0 @@
-// 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.
-//*****************************************************************************
-// NewMerger.h
-//
-
-//
-// Contains utility code for MD directory
-//
-//*****************************************************************************
-#ifndef __NEWMERGER__h__
-#define __NEWMERGER__h__
-
-class RegMeta;
-
-class MDTOKENMAP;
-
-// module-level awareness of Security critical annotions
-typedef BYTE InputScopeSecurityCriticalStatus;
-#define ISSCS_Unknown 0x0
-#define ISSCS_SecurityCritical 0x1
-#define ISSCS_SecurityCriticalEverything (ISSCS_SecurityCritical | 0x2)
-#define ISSCS_SecurityCriticalExplicit (ISSCS_SecurityCritical)
-#define ISSCS_SecurityTransparent 0x4
-#define ISSCS_SecurityTreatAsSafe 0x8
-#define ISSCS_SECURITYCRITICAL_LEGACY (ISSCS_SecurityCriticalEverything | ISSCS_SecurityTreatAsSafe)
-#define ISSCS_SECURITYCRITICAL_FLAGS (ISSCS_SecurityCriticalEverything | ISSCS_SecurityTransparent)
-
-//*********************************************************************
-// MergeImportData
-//*********************************************************************
-class MergeImportData
-{
-public:
- RegMeta *m_pRegMetaImport;
- IUnknown *m_pHandler;
- IMapToken *m_pHostMapToken;
- MDTOKENMAP *m_pMDTokenMap;
- MergeImportData *m_pNextImportData;
-
- mdMemberRef m_tkSuppressMergeCheckCtor; // caches the SuppressMergeCheckAttribute's .ctor token
- mdMemberRef m_tkHandleProcessCorruptedStateCtor; // caches the memberRef token to HandleProcessCorruptedStateExceptionsAttribute's .ctor token
-
- // import contains assembly-level SecurityTransparent or SecurityCritical
- InputScopeSecurityCriticalStatus m_isscsSecurityCriticalStatus;
-#if _DEBUG
- int m_iImport; // debug only. This is the ith import for merge.
-#endif // _DEBUG
-};
-
-//*********************************************************************
-// MergeTypeData
-//*********************************************************************
-struct MergeTypeData
-{
- ULONG m_cMethods;
- ULONG m_cFields;
- ULONG m_cEvents;
- ULONG m_cProperties;
- BOOL m_bSuppressMergeCheck;
-};
-
-
-//*********************************************************************
-// Class to handle merge
-//*********************************************************************
-class NEWMERGER
-{
- friend class RegMeta;
-public:
- NEWMERGER();
- ~NEWMERGER();
-
- HRESULT Init(RegMeta *pRegMetaDest);
-
- HRESULT AddImport(
- IMetaDataImport2 *pImport, // [IN] The scope to be merged.
- IMapToken *pHostMapToken, // [IN] Host IMapToken interface to receive token remap notification
- IUnknown *pHandler); // [IN] An object to receive to receive error notification.
-
- HRESULT Merge(MergeFlags flags, CorRefToDefCheck optimizeRefToDef);
-
-protected:
-
- CMiniMdRW *GetMiniMdEmit();
-
- HRESULT InitMergeTypeData();
-
- HRESULT MergeTypeDefNamesOnly();
- HRESULT MergeModuleRefs();
- HRESULT MergeAssemblyRefs();
- HRESULT MergeTypeRefs();
- HRESULT CompleteMergeTypeDefs();
-
- HRESULT CopyTypeDefPartially(
- TypeDefRec *pRecEmit, // [IN] the emit record to fill
- CMiniMdRW *pMiniMdImport, // [IN] the importing scope
- TypeDefRec *pRecImp); // [IN] the record to import
-
- // helpers for merging tables
- HRESULT MergeModule( );
- HRESULT MergeTypeDefChildren();
- HRESULT MergeInterfaceImpls( );
- HRESULT MergeMemberRefs( );
- HRESULT MergePinvoke();
-
- HRESULT MergeConstants( );
- HRESULT MergeCustomAttributes( );
- HRESULT MergeFieldMarshals( );
- HRESULT MergeDeclSecuritys( );
- HRESULT MergeClassLayouts( );
- HRESULT MergeFieldLayouts( );
- HRESULT MergeFieldRVAs();
- HRESULT MergeMethodImpls( );
- HRESULT MergeStandAloneSigs();
- HRESULT MergeMethodSpecs();
- HRESULT MergeTypeSpecs();
- HRESULT MergeSourceFiles( );
- HRESULT MergeBlocks( );
- HRESULT MergeScopes( );
- HRESULT MergeLocalVariables( );
- HRESULT MergeStrings( );
-
- HRESULT MergeAssembly();
- HRESULT MergeFiles();
- HRESULT MergeExportedTypes();
- HRESULT MergeManifestResources();
-
- // helpers for SecurityCritical-related merging
- InputScopeSecurityCriticalStatus CheckInputScopeIsCritical(MergeImportData* pImportData, HRESULT& hr);
- HRESULT RetrieveStandardSecurityCriticalMetaData(
- mdAssemblyRef& tkMscorlib,
- mdTypeRef& securityEnum,
- BYTE*& rgSigBytesSecurityCriticalEverythingCtor,
- DWORD& dwSigEverythingSize,
- BYTE*& rgSigBytesSecurityCriticalExplicitCtor,
- DWORD& dwSigExplicitSize);
-
- HRESULT MergeSecurityCriticalModuleLevelAttributes(
- MergeImportData* pImportData,
- mdToken tkParentImp, TOKENREC* pTypeRec,
- mdToken mrSecurityTreatAsSafeAttributeCtor,
- mdToken mrSecurityTransparentAttributeCtor,
- mdToken mrSecurityCriticalExplicitAttributeCtor,
- mdToken mrSecurityCriticalEverythingAttributeCtor);
- HRESULT MergeSecurityCriticalAttributes();
-
- // copy over a interfaceimpl record
- HRESULT CopyInterfaceImpl(
- InterfaceImplRec *pRecEmit, // [IN] the emit record to fill
- MergeImportData *pImportData, // [IN] the importing context
- InterfaceImplRec *pRecImp); // [IN] the record to import
-
- // verification helpers
- HRESULT VerifyMethods(MergeImportData *pImportData, mdTypeDef tdImp, mdTypeDef tdEmit);
- HRESULT VerifyFields(MergeImportData *pImportData, mdTypeDef tdImp, mdTypeDef tdEmit);
- HRESULT VerifyEvents(MergeImportData *pImportData, mdTypeDef tdImp, mdTypeDef tdEmit);
- HRESULT VerifyProperties(MergeImportData *pImportData, mdTypeDef tdImp, mdTypeDef tdEmit);
- HRESULT VerifyParams(MergeImportData *pImportData, mdMethodDef mdImp, mdMethodDef mdEmit);
- HRESULT VerifyGenericParams(MergeImportData *pImportData, mdTypeDef tdImp, mdTypeDef tdEmit);
- HRESULT VerifyGenericParamConstraints(MergeImportData *pImportData, mdGenericParam gpImp, mdGenericParam gpEmit);
-
- // Copy helpers
- HRESULT CopyMethods(MergeImportData *pImportData, mdTypeDef tdImp, mdTypeDef tdEmit);
- HRESULT CopyFields(MergeImportData *pImportData, mdTypeDef tdImp, mdTypeDef tdEmit);
- HRESULT CopyEvents(MergeImportData *pImportData, mdTypeDef tdImp, mdTypeDef tdEmit);
- HRESULT CopyProperties(MergeImportData *pImportData, mdTypeDef tdImp, mdTypeDef tdEmit);
- HRESULT CopyParams(MergeImportData *pImportData, mdMethodDef mdImp, mdMethodDef mdEmit);
- HRESULT CopyGenericParams(MergeImportData *pImportData, mdToken tkImp, mdToken tkEmit);
- HRESULT CopyGenericParamConstraints(MergeImportData *pImportData, mdGenericParam gpImp, mdGenericParam gpEmit);
-
- HRESULT CopyMethod(
- MergeImportData *pImportData, // [IN] import scope
- MethodRec *pRecImp, // [IN] the record to import
- MethodRec *pRecEmit); // [IN] the emit record to fill
-
- HRESULT CopyField(
- MergeImportData *pImportData, // [IN] import scope
- FieldRec *pRecImp, // [IN] the record to import
- FieldRec *pRecEmit); // [IN] the emit record to fill
-
- HRESULT CopyEvent(
- MergeImportData *pImportData, // [IN] import scope
- EventRec *pRecImp, // [IN] the record to import
- EventRec *pRecEmit); // [IN] the emit record to fill
-
- HRESULT CopyProperty(
- MergeImportData *pImportData, // [IN] import scope
- PropertyRec *pRecImp, // [IN] the record to import
- PropertyRec *pRecEmit); // [IN] the emit record to fill
-
- HRESULT CopyParam(
- MergeImportData *pImportData, // [IN] import scope
- ParamRec *pRecImp, // [IN] the record to import
- ParamRec *pRecEmit); // [IN] the emit record to fill
-
- HRESULT CopyMethodSemantics(
- MergeImportData *pImportData,
- mdToken tkImport, // Event or property in the import scope
- mdToken tkEmit); // corresponding event or property in the emitting scope
-
- HRESULT VerifyMethod(
- MergeImportData *pImportData,
- mdMethodDef mdImp, // [IN] the emit record to fill
- mdMethodDef mdEmit); // [IN] the record to import
-
- HRESULT OnError(HRESULT hr, MergeImportData *pImportData, mdToken token);
-
-private:
- RegMeta *m_pRegMetaEmit;
- MergeImportData *m_pImportDataList;
- MergeImportData **m_pImportDataTail;
- MergeFlags m_dwMergeFlags;
- BOOL m_fDupCheck;
- CorRefToDefCheck m_optimizeRefToDef;
- // the combined value of the Security Critical input scopes (e.g. UNION of each scope's attributes)
- // if ANY of the scopes have a bit set, then we must do some merging
- InputScopeSecurityCriticalStatus m_isscsSecurityCritical;
- // the common values of the Security Critical input scopes (e.g. INTERSECTION of each scope's attributes)
- // if all scopes have the same bit set, then we can emit one bit at the final output scope
- InputScopeSecurityCriticalStatus m_isscsSecurityCriticalAllScopes;
-
- CDynArray<MergeTypeData> m_rMTDs;
-#if _DEBUG
- int m_iImport; // debug only. To count how many import scopes to be merged.
-#endif // _DEBUG
-};
-
-
-#define CheckContinuableErrorEx(EXPR, HANDLER, TOKEN) \
-{ \
- HRESULT hrOnErr, hrExpr; \
- hrExpr = EXPR; \
- \
- hrOnErr = OnError(hrExpr, HANDLER, TOKEN); \
- if (hrOnErr != S_OK) \
- { \
- if (hrOnErr == S_FALSE) \
- { \
- hr = hrExpr; \
- } \
- else if (SUCCEEDED(hrOnErr)) \
- { \
- hr = E_UNEXPECTED; \
- } \
- else if (FAILED(hrOnErr)) \
- { \
- hr = hrOnErr; \
- } \
- IfFailGo(hr); \
- } \
-}
-
-
-#endif // __NEWMERGER__h__
diff --git a/src/md/compiler/regmeta.cpp b/src/md/compiler/regmeta.cpp
index 337c572e81..f591a6e01b 100644
--- a/src/md/compiler/regmeta.cpp
+++ b/src/md/compiler/regmeta.cpp
@@ -277,11 +277,6 @@ RegMeta::CreateNewMD()
INDEBUG(m_pStgdb->m_MiniMd.Debug_SetLock(m_pSemReadWrite);)
}
-#ifdef FEATURE_METADATA_EMIT_ALL
- // initialize the embedded merger
- m_newMerger.Init(this);
-#endif //FEATURE_METADATA_EMIT_ALL
-
ErrExit:
return hr;
} // RegMeta::CreateNewMD
@@ -340,11 +335,6 @@ HRESULT RegMeta::OpenExistingMD(
if (!IsOfReOpen(dwOpenFlags))
{
-#ifdef FEATURE_METADATA_EMIT_ALL
- // initialize the embedded merger
- m_newMerger.Init(this);
-#endif //FEATURE_METADATA_EMIT_ALL
-
// There must always be a Global Module class and its the first entry in
// the TypeDef table.
m_tdModule = TokenFromRid(1, mdtTypeDef);
@@ -398,11 +388,6 @@ HRESULT RegMeta::OpenExistingMD(
if (!IsOfReOpen(dwOpenFlags))
{
-#ifdef FEATURE_METADATA_EMIT_ALL
- // initialize the embedded merger
- m_newMerger.Init(this);
-#endif //FEATURE_METADATA_EMIT_ALL
-
// There must always be a Global Module class and its the first entry in
// the TypeDef table.
m_tdModule = TokenFromRid(1, mdtTypeDef);
diff --git a/src/md/compiler/regmeta.h b/src/md/compiler/regmeta.h
index 0c4e076c27..04456d8548 100644
--- a/src/md/compiler/regmeta.h
+++ b/src/md/compiler/regmeta.h
@@ -20,8 +20,6 @@
#include "../inc/mdlog.h"
#include "utsem.h"
-#include "newmerger.h"
-
#include "rwutil.h"
#include "mdperf.h"
#include <ivehandler.h>
@@ -183,7 +181,6 @@ class RegMeta :
#endif
, public IMDCommon
{
- friend class NEWMERGER;
friend class CImportTlb;
friend class MDInternalRW;
friend class MDInternalRO;
@@ -1626,8 +1623,6 @@ protected:
}
HRESULT PreSave();
- HRESULT ProcessFilter();
- HRESULT ProcessFilterWorker();
// Initialize the EE
HRESULT StartupEE();
@@ -2025,9 +2020,6 @@ private:
ULONG m_OpenFlags; // Open time flags.
LONG m_cRef; // Ref count.
-#ifdef FEATURE_METADATA_EMIT_ALL
- NEWMERGER m_newMerger; // class for handling merge
-#endif //FEATURE_METADATA_EMIT_ALL
IUnknown *m_pFreeThreadedMarshaler; // FreeThreadedMarshaler
#ifdef FEATURE_METADATA_PERF_STATS
diff --git a/src/md/compiler/regmeta_compilersupport.cpp b/src/md/compiler/regmeta_compilersupport.cpp
index 0bea06699b..571f9288b6 100644
--- a/src/md/compiler/regmeta_compilersupport.cpp
+++ b/src/md/compiler/regmeta_compilersupport.cpp
@@ -49,35 +49,7 @@ STDMETHODIMP RegMeta::Merge( // S_OK or error.
IMapToken *pHostMapToken, // [IN] Host IMapToken interface to receive token remap notification
IUnknown *pHandler) // [IN] An object to receive to receive error notification.
{
-#ifdef FEATURE_METADATA_EMIT_ALL
- HRESULT hr = NOERROR;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- IMetaDataImport2 *pI2=NULL;
-
- LOG((LOGMD, "RegMeta::Merge(0x%08x, 0x%08x)\n", pImport, pHandler));
- START_MD_PERF();
- LOCKWRITE();
-
- IfFailGo(VerifyNotWinMD(pImport, "IMetaDataEmit::Merge(): merging with a .winmd file not supported."));
-
- IfFailGo(pImport->QueryInterface(IID_IMetaDataImport2, (void**)&pI2));
- m_hasOptimizedRefToDef = false;
-
- // track this import
- IfFailGo( m_newMerger.AddImport(pI2, pHostMapToken, pHandler) );
-
-ErrExit:
- if (pI2)
- pI2->Release();
- STOP_MD_PERF(Merge);
- END_ENTRYPOINT_NOTHROW;
-
- return (hr);
-#else //!FEATURE_METADATA_EMIT_ALL
return E_NOTIMPL;
-#endif //!FEATURE_METADATA_EMIT_ALL
} // RegMeta::Merge
@@ -86,32 +58,7 @@ ErrExit:
//*****************************************************************************
STDMETHODIMP RegMeta::MergeEnd() // S_OK or error.
{
-#ifdef FEATURE_METADATA_EMIT_ALL
- HRESULT hr = NOERROR;
-
- BEGIN_ENTRYPOINT_NOTHROW;
-
- LOG((LOGMD, "RegMeta::MergeEnd()\n"));
- START_MD_PERF();
- LOCKWRITE();
- // Merge happens here!!
-
- // <REVISIT_TODO>bug 16719. Merge itself is doing a lots of small changes in literally
- // dozens of places. It would be to hard to maintain and would cause code
- // bloat to auto-grow the tables. So instead, we've opted to just expand
- // the world right away and avoid the trouble.</REVISIT_TODO>
- IfFailGo(m_pStgdb->m_MiniMd.ExpandTables());
-
- IfFailGo(m_newMerger.Merge(m_OptionValue.m_MergeOptions, m_OptionValue.m_RefToDefCheck) );
-
-ErrExit:
- STOP_MD_PERF(MergeEnd);
- END_ENTRYPOINT_NOTHROW;
-
- return (hr);
-#else //!FEATURE_METADATA_EMIT_ALL
return E_NOTIMPL;
-#endif //!FEATURE_METADATA_EMIT_ALL
} // RegMeta::MergeEnd
@@ -282,225 +229,4 @@ ErrExit:
#endif //!FEATURE_METADATA_EMIT_ALL
} // RegMeta::ResetENCLog
-#ifdef FEATURE_METADATA_EMIT_ALL
-
-// Helper for code:RegMeta::ProcessFilter
-HRESULT RegMeta::ProcessFilterWorker()
-{
- HRESULT hr = S_OK;
-
- CMiniMdRW *pMiniMd; // The MiniMd with the data.
- RegMeta *pMetaNew = NULL;
- CMapToken *pMergeMap = NULL;
- IMapToken *pMapNew = NULL;
- MergeTokenManager *pCompositHandler = NULL;
- IMapToken *pHostMapToken = NULL;
-
- // For convenience.
- pMiniMd = &(m_pStgdb->m_MiniMd);
- IfNullGo( pMiniMd->GetFilterTable() );
- _ASSERTE(pMiniMd->GetFilterTable()->Count() != 0); // caller verified this
-
- // Yes, client has used filter to specify what are the metadata needed.
- // We will create another instance of RegMeta and make this module an imported module
- // to be merged into the new RegMeta. We will provide the handler to track all of the token
- // movements. We will replace the merged light weight stgdb to this RegMeta..
- // Then we will need to fix up the MergeTokenManager with this new movement.
- // The reason that we decide to choose this approach is because it will be more complicated
- // and very likely less efficient to fix up the signature blob pool and then compact all of the pools!
- //
-
- // Create a new RegMeta.
- pMetaNew = new (nothrow) RegMeta();
- IfNullGo( pMetaNew );
- pMetaNew->AddRef();
- IfFailGo(pMetaNew->SetOption(&m_OptionValue));
-
-
- // Remember the open type.
- IfFailGo(pMetaNew->CreateNewMD());
- IfFailGo(pMetaNew->AddToCache());
-
- // Ignore the error return by setting handler
- hr = pMetaNew->SetHandler(m_pHandler);
-
- // create the IMapToken to receive token remap information from merge
- pMergeMap = new (nothrow) CMapToken;
- IfNullGo( pMergeMap );
-
- // use merge to filter out the unneeded data. But we need to keep COMType and also need to drop off the
- // CustomAttributes that associated with MemberRef with parent MethodDef
- //
- pMetaNew->m_hasOptimizedRefToDef = false;
- IfFailGo( pMetaNew->m_newMerger.AddImport(this, pMergeMap, NULL) );
- IfFailGo( pMetaNew->m_pStgdb->m_MiniMd.ExpandTables());
- IfFailGo( pMetaNew->m_newMerger.Merge((MergeFlags)(MergeManifest | DropMemberRefCAs | NoDupCheck), MDRefToDefDefault) );
-
- // Now we need to recalculate the token movement
- //
- if (m_newMerger.m_pImportDataList)
- {
-
- // This is the case the filter is applied to merged emit scope. We need calculate how this implicit merge
- // affects the original merge remap. Basically we need to walk all the m_pTkMapList in the merger and replace
- // the to token to the most recent to token.
- //
- MDTOKENMAP *pMDTokenMapList;
-
- pMDTokenMapList = m_newMerger.m_pImportDataList->m_pMDTokenMap;
-
- MDTOKENMAP *pMap;
- TOKENREC *pTKRec;
- ULONG i;
- mdToken tkFinalTo;
- ModuleRec *pMod;
- ModuleRec *pModNew;
- LPCUTF8 szName;
-
- // update each import map from merge to have the m_tkTo points to the final mapped to token
- for (pMap = pMDTokenMapList; pMap; pMap = pMap->m_pNextMap)
- {
- // update each record
- for (i = 0; i < (ULONG) (pMap->Count()); i++)
- {
- TOKENREC *pRecTo;
- pTKRec = pMap->Get(i);
- if ( pMergeMap->Find( pTKRec->m_tkTo, &pRecTo ) )
- {
- // This record is kept by the filter and the tkTo is changed
- pRecTo->m_isFoundInImport = true;
- tkFinalTo = pRecTo->m_tkTo;
- pTKRec->m_tkTo = tkFinalTo;
- pTKRec->m_isDeleted = false;
-
- // send the notification now. Because after merge, we may have everything in order and
- // won't send another set of notification.
- //
- LOG((LOGMD, "TokenRemap in RegMeta::ProcessFilter (IMapToken 0x%08x): from 0x%08x to 0x%08x\n", pMap->m_pMap, pTKRec->m_tkFrom, pTKRec->m_tkTo));
-
- pMap->m_pMap->Map(pTKRec->m_tkFrom, pTKRec->m_tkTo);
- }
- else
- {
- // This record is pruned by the filter upon save
- pTKRec->m_isDeleted = true;
- }
- }
- }
-
- // now walk the pMergeMap and check to see if there is any entry that is not set to true for m_isFoundInImport.
- // These are the records that from calling DefineXXX methods directly on the Emitting scope!
- if (m_pHandler)
- m_pHandler->QueryInterface(IID_IMapToken, (void **)&pHostMapToken);
- if (pHostMapToken)
- {
- for (i = 0; i < (ULONG) (pMergeMap->m_pTKMap->Count()); i++)
- {
- pTKRec = pMergeMap->m_pTKMap->Get(i);
- if (pTKRec->m_isFoundInImport == false)
- {
- LOG((LOGMD, "TokenRemap in RegMeta::ProcessFilter (default IMapToken 0x%08x): from 0x%08x to 0x%08x\n", pHostMapToken, pTKRec->m_tkFrom, pTKRec->m_tkTo));
-
- // send the notification on the IMapToken from SetHandler of this RegMeta
- pHostMapToken->Map(pTKRec->m_tkFrom, pTKRec->m_tkTo);
- }
- }
- }
-
- // Preserve module name across merge.
- IfFailGo(m_pStgdb->m_MiniMd.GetModuleRecord(1, &pMod));
- IfFailGo(pMetaNew->m_pStgdb->m_MiniMd.GetModuleRecord(1, &pModNew));
- IfFailGo(m_pStgdb->m_MiniMd.getNameOfModule(pMod, &szName));
- IfFailGo(pMetaNew->m_pStgdb->m_MiniMd.PutString(TBL_Module, ModuleRec::COL_Name, pModNew, szName));
-
- // now swap the stgdb but keep the merger...
- _ASSERTE( !IsOfExternalStgDB(m_OpenFlags) );
-
- CLiteWeightStgdbRW * pStgdbTmp = m_pStgdb;
- m_pStgdb = pMetaNew->m_pStgdb;
- pMetaNew->m_pStgdb = pStgdbTmp;
- // Update RuntimeVersion string pointers to point to the owning RegMeta string (the strings are 2 copies of the same string content)
- m_pStgdb->m_MiniMd.m_OptionValue.m_RuntimeVersion = m_OptionValue.m_RuntimeVersion;
- pMetaNew->m_pStgdb->m_MiniMd.m_OptionValue.m_RuntimeVersion = pMetaNew->m_OptionValue.m_RuntimeVersion;
- }
- else
- {
- // swap the Stgdb
- CLiteWeightStgdbRW * pStgdbTmp = m_pStgdb;
- m_pStgdb = pMetaNew->m_pStgdb;
- pMetaNew->m_pStgdb = pStgdbTmp;
- // Update RuntimeVersion string pointers to point to the owning RegMeta string (the strings are 2 copies of the same string content)
- m_pStgdb->m_MiniMd.m_OptionValue.m_RuntimeVersion = m_OptionValue.m_RuntimeVersion;
- pMetaNew->m_pStgdb->m_MiniMd.m_OptionValue.m_RuntimeVersion = pMetaNew->m_OptionValue.m_RuntimeVersion;
-
- // Client either open an existing scope and apply the filter mechanism, or client define the scope and then
- // apply the filter mechanism.
-
- // In this case, host better has supplied the handler!!
- _ASSERTE( m_bRemap && m_pHandler);
- IfFailGo( m_pHandler->QueryInterface(IID_IMapToken, (void **) &pMapNew) );
-
-
- {
- // Send the notification of token movement now because after merge we may not move tokens again
- // and thus no token notification will be send.
- MDTOKENMAP *pMap = pMergeMap->m_pTKMap;
- TOKENREC *pTKRec;
- ULONG i;
-
- for (i=0; i < (ULONG) (pMap->Count()); i++)
- {
- pTKRec = pMap->Get(i);
- pMap->m_pMap->Map(pTKRec->m_tkFrom, pTKRec->m_tkTo);
- }
-
- }
-
-
- // What we need to do here is create a IMapToken that will replace the original handler. This new IMapToken
- // upon called will first map the from token to the most original from token.
- //
- pCompositHandler = new (nothrow) MergeTokenManager(pMergeMap->m_pTKMap, NULL);
- IfNullGo( pCompositHandler );
-
- // now update the following field to hold on to the real IMapToken supplied by our client by SetHandler
- if (pMergeMap->m_pTKMap->m_pMap)
- pMergeMap->m_pTKMap->m_pMap->Release();
- _ASSERTE(pMapNew);
- pMergeMap->m_pTKMap->m_pMap = pMapNew;
-
- // ownership transferred
- pMergeMap = NULL;
- pMapNew = NULL;
-
- // now you want to replace all of the IMapToken set by calling SetHandler to this new MergeTokenManager
- IfFailGo( m_pStgdb->m_MiniMd.SetHandler(pCompositHandler) );
-
- m_pHandler = pCompositHandler;
-
- // ownership transferred
- pCompositHandler = NULL;
- }
-
- // Force a ref to def optimization because the remap information was stored in the thrown away CMiniMdRW
- m_hasOptimizedRefToDef = false;
- IfFailGo( RefToDefOptimization() );
-
-ErrExit:
- if (pHostMapToken)
- pHostMapToken->Release();
- if (pMetaNew)
- pMetaNew->Release();
- if (pMergeMap)
- pMergeMap->Release();
- if (pCompositHandler)
- pCompositHandler->Release();
- if (pMapNew)
- pMapNew->Release();
-
- return hr;
-} // RegMeta::ProcessFilter
-
-#endif //FEATURE_METADATA_EMIT_ALL
-
#endif //FEATURE_METADATA_EMIT
diff --git a/src/md/compiler/regmeta_emit.cpp b/src/md/compiler/regmeta_emit.cpp
index 22d2979343..d3268fec8a 100644
--- a/src/md/compiler/regmeta_emit.cpp
+++ b/src/md/compiler/regmeta_emit.cpp
@@ -279,13 +279,6 @@ STDMETHODIMP RegMeta::GetSaveSize( // S_OK or error.
IfFailGo(m_pFilterManager->Mark(TokenFromRid(iCount, mdtAssembly)));
}
}
-#ifdef FEATURE_METADATA_EMIT_ALL
- else if (m_newMerger.m_pImportDataList)
- {
- // always pipe through another pass of merge to drop unnecessary ref for linker.
- MarkAll();
- }
-#endif //FEATURE_METADATA_EMIT_ALL
IfFailGo(PreSave());
@@ -734,7 +727,6 @@ HRESULT RegMeta::PreSave() // Return code.
HRESULT hr = S_OK; // A result.
CMiniMdRW *pMiniMd; // The MiniMd with the data.
unsigned bRemapOld = m_bRemap;
- MergeTokenManager *ptkMgr = NULL;
// For convenience.
pMiniMd = &(m_pStgdb->m_MiniMd);
@@ -745,21 +737,6 @@ HRESULT RegMeta::PreSave() // Return code.
if (m_bSaveOptimized)
goto ErrExit;
-#ifdef FEATURE_METADATA_EMIT_ALL
- if (m_newMerger.m_pImportDataList != NULL)
- {
- // This is the linker scenario. We we have IMap for each scope. We will create an instance of our own mapper
- // who knows how to send notification back to host!
-
- // cache the host provided handler to the end our MergeTokenManager
-
- ptkMgr = new (nothrow) MergeTokenManager(m_newMerger.m_pImportDataList->m_pMDTokenMap, m_pHandler);
- IfNullGo(ptkMgr);
- hr = m_pStgdb->m_MiniMd.SetHandler(ptkMgr);
- _ASSERTE(SUCCEEDED(hr));
- }
-#endif //FEATURE_METADATA_EMIT_ALL
-
IfFailGo(RefToDefOptimization());
// we need to update MethodImpl table here with ref to def result
@@ -808,19 +785,7 @@ HRESULT RegMeta::PreSave() // Return code.
}
}
}
-
-#ifdef FEATURE_METADATA_EMIT_ALL
- IfFailGo(ProcessFilter());
-
- if (m_newMerger.m_pImportDataList != NULL)
- {
- // Allocate a token mapper object that will be used for phase 1 if there is not Handler but
- // linker has provided the IMapToken
- //
- m_bRemap = true;
- }
-#endif //FEATURE_METADATA_EMIT_ALL
-
+
// reget the minimd because it can be swapped in the call of ProcessFilter
pMiniMd = &(m_pStgdb->m_MiniMd);
@@ -831,13 +796,6 @@ HRESULT RegMeta::PreSave() // Return code.
IfFailGo(m_pStgdb->m_MiniMd.PreSave(m_ReorderingOptions, m_pCorProfileData));
ErrExit:
- if (ptkMgr != NULL)
- {
- // recovery the initial state
- hr = m_pStgdb->m_MiniMd.SetHandler(NULL);
- ptkMgr->Release();
- }
-
m_bRemap = bRemapOld;
return hr;
@@ -1008,37 +966,6 @@ ErrExit:
return hr;
} // RegMeta::RefToDefOptimization
-#ifdef FEATURE_METADATA_EMIT_ALL
-
-//*****************************************************************************
-// Process filter
-//*****************************************************************************
-HRESULT RegMeta::ProcessFilter()
-{
- HRESULT hr = S_OK;
-
- CMiniMdRW *pMiniMd; // The MiniMd with the data.
-
- START_MD_PERF();
-
- // For convenience.
- pMiniMd = &(m_pStgdb->m_MiniMd);
- IfNullGo( pMiniMd->GetFilterTable() );
- if ( pMiniMd->GetFilterTable()->Count() == 0 )
- {
- // there is no filter
- goto ErrExit;
- }
- hr = ProcessFilterWorker();
-
-ErrExit:
- STOP_MD_PERF(ProcessFilter);
-
- return hr;
-} // RegMeta::ProcessFilter
-
-#endif //FEATURE_METADATA_EMIT_ALL
-
//*****************************************************************************
// Define a TypeRef given the fully qualified name.
//*****************************************************************************
diff --git a/src/md/compiler/wks/CMakeLists.txt b/src/md/compiler/wks/CMakeLists.txt
index 6bf6c80868..eb39ca7972 100644
--- a/src/md/compiler/wks/CMakeLists.txt
+++ b/src/md/compiler/wks/CMakeLists.txt
@@ -1,4 +1,6 @@
include(../../md_wks.cmake)
+add_definitions(-DFEATURE_METADATA_EMIT_ALL)
+
add_precompiled_header(stdafx.h ../stdafx.cpp MDCOMPILER_SOURCES)
-add_library_clr(mdcompiler_wks ${MDCOMPILER_SOURCES}) \ No newline at end of file
+add_library_clr(mdcompiler_wks ${MDCOMPILER_SOURCES})
diff --git a/src/md/enc/rwutil.cpp b/src/md/enc/rwutil.cpp
index 874d972716..a00eddb3f1 100644
--- a/src/md/enc/rwutil.cpp
+++ b/src/md/enc/rwutil.cpp
@@ -952,149 +952,6 @@ ErrExit:
-
-//*********************************************************************************************************
-//
-// Merge Token manager's constructor
-//
-//*********************************************************************************************************
-MergeTokenManager::MergeTokenManager(MDTOKENMAP *pTkMapList, IUnknown *pHandler)
-{
- m_cRef = 1;
- m_pTkMapList = pTkMapList;
- m_pDefaultHostRemap = NULL;
- if (pHandler)
- pHandler->QueryInterface(IID_IMapToken, (void **) &m_pDefaultHostRemap);
-} // TokenManager::TokenManager()
-
-
-
-//*********************************************************************************************************
-//
-// Merge Token manager's destructor
-//
-//*********************************************************************************************************
-MergeTokenManager::~MergeTokenManager()
-{
- if (m_pDefaultHostRemap)
- m_pDefaultHostRemap->Release();
-} // TokenManager::~TokenManager()
-
-
-
-
-ULONG MergeTokenManager::AddRef()
-{
- return InterlockedIncrement(&m_cRef);
-} // TokenManager::AddRef()
-
-
-
-ULONG MergeTokenManager::Release()
-{
- ULONG cRef = InterlockedDecrement(&m_cRef);
- if (!cRef)
- delete this;
- return (cRef);
-} // TokenManager::Release()
-
-
-HRESULT MergeTokenManager::QueryInterface(REFIID riid, void **ppUnk)
-{
- if (ppUnk == NULL)
- return E_INVALIDARG;
-
- if (IsEqualIID(riid, IID_IMapToken))
- {
- //*ppUnk = (IUnknown *) (IMapToken *) this;
- // it should return the accurate type requested,
- // if IUnknown is returned, it will finally converted to IMapToken*
- *ppUnk = (IMapToken *) this;
- }
- else if (IsEqualIID(riid, IID_IUnknown))
- {
- // add query handling for IUnknown
- // this upcasting (converting a derived-class
- // reference or pointer to a base-class) is safe
- *ppUnk = (IUnknown *) this;
- }
- else
- {
- *ppUnk = NULL;
- return (E_NOINTERFACE);
- }
-
- AddRef();
- return (S_OK);
-} // TokenManager::QueryInterface
-
-
-
-//*********************************************************************************************************
-//
-// Token manager keep tracks a list of tokenmaps. Each tokenmap corresponding
-// to an imported scope. Note that with this, we do have problem in how to
-// tell linker regarding the token movement when the token is added by Define
-// rather than merge. This should be fixed with new merge implementation.
-// The tkImp is the old tokens in the emit scope, tkEmit is the new token in the
-// emit scope. We need to find the token from an import scope that is resolved
-// to the tkImp. We then need to tell linker about this token movement.
-// If we don't find any import scope which generates the tkImp token, that is
-// this tkImp is generated by calling DefinXXX directly on the final merged scope.
-// Then we use the default host remap to send the notification.
-//
-//*********************************************************************************************************
-HRESULT MergeTokenManager::Map(mdToken tkImp, mdToken tkEmit)
-{
- HRESULT hr = NOERROR;
- MDTOKENMAP *pTkMapList = m_pTkMapList;
- bool fFoundInImport = false;
- int iPosition;
- TOKENREC *pRec;
-
- _ASSERTE(m_pTkMapList);
- while ( pTkMapList )
- {
- // FindWithToToken will return the first match with the To token.
- // pTkMapList is sorted with To token. It might contain several From tokens
- // that map to the To token due to ref to def optimiation. Make sure that
- // all notification is sent to all of these From tokens.
- //
- if ( pTkMapList->FindWithToToken(tkImp, &iPosition) )
- {
- // make sure that we don't walk over the last entry
- while (iPosition < pTkMapList->Count())
- {
- pRec = pTkMapList->Get(iPosition);
- if (pRec->m_tkTo != tkImp)
- {
- // we are done!
- break;
- }
-
- // more matching record...
- fFoundInImport = true;
- if (pTkMapList->m_pMap)
- hr = pTkMapList->m_pMap->Map(pRec->m_tkFrom, tkEmit);
- _ASSERTE(SUCCEEDED(hr));
- IfFailGo( hr );
- iPosition++;
- }
- }
- pTkMapList = pTkMapList->m_pNextMap;
- }
-
- if (fFoundInImport == false && m_pDefaultHostRemap)
- {
- // use the default remap to send the notification
- IfFailGo( m_pDefaultHostRemap->Map(tkImp, tkEmit) );
- }
-ErrExit:
- return hr;
-}
-
-
-
//*********************************************************************************************************
//
// CMapToken's constructor
diff --git a/src/md/enc/wks/CMakeLists.txt b/src/md/enc/wks/CMakeLists.txt
index df7664187d..2c0a2b1af5 100644
--- a/src/md/enc/wks/CMakeLists.txt
+++ b/src/md/enc/wks/CMakeLists.txt
@@ -1,4 +1,6 @@
include(../../md_wks.cmake)
+add_definitions(-DFEATURE_METADATA_EMIT_ALL)
+
add_precompiled_header(stdafx.h ../stdafx.cpp MDRUNTIMERW_SOURCES)
add_library_clr(mdruntimerw_wks ${MDRUNTIMERW_SOURCES})
diff --git a/src/md/hotdata/hotdataformat.h b/src/md/hotdata/hotdataformat.h
index 0823010611..3431d18deb 100644
--- a/src/md/hotdata/hotdataformat.h
+++ b/src/md/hotdata/hotdataformat.h
@@ -35,7 +35,7 @@ namespace MetaData
// #HotMetaData
// To help with startup time, we create a section of metadata that is only that meta-data that was touched
// durring IBC profiling. Given an offset into a pool this checks if we have any hot data associated with
-// it. If we do we return a poitner to it, otherwse we return NULL.
+// it. If we do we return a pointer to it, otherwse we return NULL.
#include <pshpack1.h>
diff --git a/src/md/inc/liteweightstgdb.h b/src/md/inc/liteweightstgdb.h
index 1234524731..057e29d1ca 100644
--- a/src/md/inc/liteweightstgdb.h
+++ b/src/md/inc/liteweightstgdb.h
@@ -66,8 +66,6 @@ protected:
friend class CorMetaDataScope;
friend class COR;
friend class RegMeta;
- friend class MERGER;
- friend class NEWMERGER;
friend class MDInternalRO;
friend class MDInternalRW;
};
diff --git a/src/md/inc/rwutil.h b/src/md/inc/rwutil.h
index 5d7f98919c..81966b7fb9 100644
--- a/src/md/inc/rwutil.h
+++ b/src/md/inc/rwutil.h
@@ -181,30 +181,6 @@ private:
//*********************************************************************
//
-// Merge Token manager. This class is created in GetSaveSize as an agent to
-// notify linker regarding token movements. It does not have the ability to
-// keep track token movement.
-//
-//*********************************************************************
-class MergeTokenManager : public IMapToken
-{
-public:
- STDMETHODIMP QueryInterface(REFIID riid, PVOID *pp);
- STDMETHODIMP_(ULONG) AddRef();
- STDMETHODIMP_(ULONG) Release();
- STDMETHODIMP Map(mdToken tkImp, mdToken tkEmit);
- MergeTokenManager(MDTOKENMAP *pTkMapList, IUnknown *pHandler);
- virtual ~MergeTokenManager();
-private:
- LONG m_cRef;
- MDTOKENMAP *m_pTkMapList;
- IMapToken *m_pDefaultHostRemap;
-};
-
-
-
-//*********************************************************************
-//
// This CMapToken class implemented the IMapToken. It is used in RegMeta for
// filter process. This class can track all of the tokens are mapped. It also
// supplies a Find function.
diff --git a/src/md/md_wks.cmake b/src/md/md_wks.cmake
index ab9df6c667..4d72c55a14 100644
--- a/src/md/md_wks.cmake
+++ b/src/md/md_wks.cmake
@@ -3,4 +3,4 @@ add_definitions(-DFEATURE_METADATA_INTERNAL_APIS)
add_definitions(-DFEATURE_METADATA_IN_VM)
if(WIN32)
add_definitions(-DFEATURE_METADATA_VERIFY_LAYOUTS)
-endif(WIN32) \ No newline at end of file
+endif(WIN32)
diff --git a/src/md/runtime/wks/CMakeLists.txt b/src/md/runtime/wks/CMakeLists.txt
index 9a1f72ed25..3e2a8cc6be 100644
--- a/src/md/runtime/wks/CMakeLists.txt
+++ b/src/md/runtime/wks/CMakeLists.txt
@@ -1,5 +1,7 @@
include(../../md_wks.cmake)
+add_definitions(-DFEATURE_METADATA_EMIT_ALL)
+
add_precompiled_header(stdafx.h ../stdafx.cpp MDRUNTIME_SOURCES)
add_library_clr(mdruntime_wks ${MDRUNTIME_SOURCES})
diff --git a/src/md/winmd/wks/CMakeLists.txt b/src/md/winmd/wks/CMakeLists.txt
index 139b68b28c..defcc1d51d 100644
--- a/src/md/winmd/wks/CMakeLists.txt
+++ b/src/md/winmd/wks/CMakeLists.txt
@@ -1,4 +1,6 @@
include(../../md_wks.cmake)
+add_definitions(-DFEATURE_METADATA_EMIT_ALL)
+
add_precompiled_header(stdafx.h ../stdafx.cpp MDWINMD_SOURCES)
-add_library_clr(mdwinmd_wks ${MDWINMD_SOURCES}) \ No newline at end of file
+add_library_clr(mdwinmd_wks ${MDWINMD_SOURCES})
diff --git a/src/mscorlib/Common/System/SR.cs b/src/mscorlib/Common/System/SR.cs
new file mode 100644
index 0000000000..29f3970633
--- /dev/null
+++ b/src/mscorlib/Common/System/SR.cs
@@ -0,0 +1,197 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Threading;
+
+namespace System
+{
+ internal static partial class SR
+ {
+ private static ResourceManager ResourceManager
+ {
+ get;
+ set;
+ }
+
+ // This method is used to decide if we need to append the exception message parameters to the message when calling SR.Format.
+ // by default it returns false.
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ private static bool UsingResourceKeys()
+ {
+ return false;
+ }
+
+ // Needed for debugger integration
+ internal static string GetResourceString(string resourceKey)
+ {
+ return GetResourceString(resourceKey, String.Empty);
+ }
+
+ internal static string GetResourceString(string resourceKey, string defaultString)
+ {
+ string resourceString = null;
+ try { resourceString = InternalGetResourceString(resourceKey); }
+ catch (MissingManifestResourceException) { }
+
+ if (defaultString != null && resourceKey.Equals(resourceString, StringComparison.Ordinal))
+ {
+ return defaultString;
+ }
+
+ return resourceString;
+ }
+
+ private static object _lock = new object();
+ private static List<string> _currentlyLoading;
+ private static int _infinitelyRecursingCount;
+ private static bool _resourceManagerInited = false;
+
+ private static string InternalGetResourceString(string key)
+ {
+ if (key == null || key.Length == 0)
+ {
+ Debug.Assert(false, "SR::GetResourceString with null or empty key. Bug in caller, or weird recursive loading problem?");
+ return key;
+ }
+
+ // We have a somewhat common potential for infinite
+ // loops with mscorlib's ResourceManager. If "potentially dangerous"
+ // code throws an exception, we will get into an infinite loop
+ // inside the ResourceManager and this "potentially dangerous" code.
+ // Potentially dangerous code includes the IO package, CultureInfo,
+ // parts of the loader, some parts of Reflection, Security (including
+ // custom user-written permissions that may parse an XML file at
+ // class load time), assembly load event handlers, etc. Essentially,
+ // this is not a bounded set of code, and we need to fix the problem.
+ // Fortunately, this is limited to mscorlib's error lookups and is NOT
+ // a general problem for all user code using the ResourceManager.
+
+ // The solution is to make sure only one thread at a time can call
+ // GetResourceString. Also, since resource lookups can be
+ // reentrant, if the same thread comes into GetResourceString
+ // twice looking for the exact same resource name before
+ // returning, we're going into an infinite loop and we should
+ // return a bogus string.
+
+ bool lockTaken = false;
+ try
+ {
+ Monitor.Enter(_lock, ref lockTaken);
+
+ // Are we recursively looking up the same resource? Note - our backout code will set
+ // the ResourceHelper's currentlyLoading stack to null if an exception occurs.
+ if (_currentlyLoading != null && _currentlyLoading.Count > 0 && _currentlyLoading.LastIndexOf(key) != -1)
+ {
+ // We can start infinitely recursing for one resource lookup,
+ // then during our failure reporting, start infinitely recursing again.
+ // avoid that.
+ if (_infinitelyRecursingCount > 0)
+ {
+ return key;
+ }
+ _infinitelyRecursingCount++;
+
+ // Note: our infrastructure for reporting this exception will again cause resource lookup.
+ // This is the most direct way of dealing with that problem.
+ string message = $"Infinite recursion during resource lookup within {System.CoreLib.Name}. This may be a bug in {System.CoreLib.Name}, or potentially in certain extensibility points such as assembly resolve events or CultureInfo names. Resource name: {key}";
+ Assert.Fail("[Recursive resource lookup bug]", message, Assert.COR_E_FAILFAST, System.Diagnostics.StackTrace.TraceFormat.NoResourceLookup);
+ Environment.FailFast(message);
+ }
+ if (_currentlyLoading == null)
+ _currentlyLoading = new List<string>();
+
+ // Call class constructors preemptively, so that we cannot get into an infinite
+ // loop constructing a TypeInitializationException. If this were omitted,
+ // we could get the Infinite recursion assert above by failing type initialization
+ // between the Push and Pop calls below.
+ if (!_resourceManagerInited)
+ {
+ RuntimeHelpers.RunClassConstructor(typeof(ResourceManager).TypeHandle);
+ RuntimeHelpers.RunClassConstructor(typeof(ResourceReader).TypeHandle);
+ RuntimeHelpers.RunClassConstructor(typeof(RuntimeResourceSet).TypeHandle);
+ RuntimeHelpers.RunClassConstructor(typeof(BinaryReader).TypeHandle);
+ _resourceManagerInited = true;
+ }
+
+ _currentlyLoading.Add(key); // Push
+
+ if (ResourceManager == null)
+ {
+ ResourceManager = new ResourceManager(SR.ResourceType);
+ }
+ string s = ResourceManager.GetString(key, null);
+ _currentlyLoading.RemoveAt(_currentlyLoading.Count - 1); // Pop
+
+ Debug.Assert(s != null, "Managed resource string lookup failed. Was your resource name misspelled? Did you rebuild mscorlib after adding a resource to resources.txt? Debug this w/ cordbg and bug whoever owns the code that called SR.GetResourceString. Resource name was: \"" + key + "\"");
+ return s ?? key;
+ }
+ catch
+ {
+ if (lockTaken)
+ {
+ // Backout code - throw away potentially corrupt state
+ ResourceManager = null;
+ _currentlyLoading = null;
+ }
+ throw;
+ }
+ finally
+ {
+ if (lockTaken)
+ {
+ Monitor.Exit(_lock);
+ }
+ }
+ }
+
+ internal static string Format(string resourceFormat, params object[] args)
+ {
+ if (args != null)
+ {
+ if (UsingResourceKeys())
+ {
+ return resourceFormat + String.Join(", ", args);
+ }
+
+ return String.Format(resourceFormat, args);
+ }
+
+ return resourceFormat;
+ }
+
+ internal static string Format(string resourceFormat, object p1)
+ {
+ if (UsingResourceKeys())
+ {
+ return String.Join(", ", resourceFormat, p1);
+ }
+
+ return String.Format(resourceFormat, p1);
+ }
+
+ internal static string Format(string resourceFormat, object p1, object p2)
+ {
+ if (UsingResourceKeys())
+ {
+ return String.Join(", ", resourceFormat, p1, p2);
+ }
+
+ return String.Format(resourceFormat, p1, p2);
+ }
+
+ internal static string Format(string resourceFormat, object p1, object p2, object p3)
+ {
+ if (UsingResourceKeys())
+ {
+ return String.Join(", ", resourceFormat, p1, p2, p3);
+ }
+ return String.Format(resourceFormat, p1, p2, p3);
+ }
+ }
+}
diff --git a/src/mscorlib/Resources/Strings.resx b/src/mscorlib/Resources/Strings.resx
new file mode 100644
index 0000000000..0ff48147fd
--- /dev/null
+++ b/src/mscorlib/Resources/Strings.resx
@@ -0,0 +1,3569 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="Acc_CreateAbst" xml:space="preserve">
+ <value>Cannot create an abstract class.</value>
+ </data>
+ <data name="Acc_CreateAbstEx" xml:space="preserve">
+ <value>Cannot create an instance of {0} because it is an abstract class.</value>
+ </data>
+ <data name="Acc_CreateArgIterator" xml:space="preserve">
+ <value>Cannot dynamically create an instance of ArgIterator.</value>
+ </data>
+ <data name="Acc_CreateGeneric" xml:space="preserve">
+ <value>Cannot create a type for which Type.ContainsGenericParameters is true.</value>
+ </data>
+ <data name="Acc_CreateGenericEx" xml:space="preserve">
+ <value>Cannot create an instance of {0} because Type.ContainsGenericParameters is true.</value>
+ </data>
+ <data name="Acc_CreateInterface" xml:space="preserve">
+ <value>Cannot create an instance of an interface.</value>
+ </data>
+ <data name="Acc_CreateInterfaceEx" xml:space="preserve">
+ <value>Cannot create an instance of {0} because it is an interface.</value>
+ </data>
+ <data name="Acc_CreateVoid" xml:space="preserve">
+ <value>Cannot dynamically create an instance of System.Void.</value>
+ </data>
+ <data name="Acc_NotClassInit" xml:space="preserve">
+ <value>Type initializer was not callable.</value>
+ </data>
+ <data name="Acc_ReadOnly" xml:space="preserve">
+ <value>Cannot set a constant field.</value>
+ </data>
+ <data name="Acc_RvaStatic" xml:space="preserve">
+ <value>SkipVerification permission is needed to modify an image-based (RVA) static field.</value>
+ </data>
+ <data name="Access_Void" xml:space="preserve">
+ <value>Cannot create an instance of void.</value>
+ </data>
+ <data name="AggregateException_ctor_DefaultMessage" xml:space="preserve">
+ <value>One or more errors occurred.</value>
+ </data>
+ <data name="AggregateException_ctor_InnerExceptionNull" xml:space="preserve">
+ <value>An element of innerExceptions was null.</value>
+ </data>
+ <data name="AggregateException_DeserializationFailure" xml:space="preserve">
+ <value>The serialization stream contains no inner exceptions.</value>
+ </data>
+ <data name="AggregateException_ToString" xml:space="preserve">
+ <value>{0}{1}---&gt; (Inner Exception #{2}) {3}{4}{5}</value>
+ </data>
+ <data name="AppDomain_AppBaseNotSet" xml:space="preserve">
+ <value>The ApplicationBase must be set before retrieving this property.</value>
+ </data>
+ <data name="Arg_AccessException" xml:space="preserve">
+ <value>Cannot access member.</value>
+ </data>
+ <data name="Arg_AccessViolationException" xml:space="preserve">
+ <value>Attempted to read or write protected memory. This is often an indication that other memory is corrupt.</value>
+ </data>
+ <data name="Arg_AmbiguousMatchException" xml:space="preserve">
+ <value>Ambiguous match found.</value>
+ </data>
+ <data name="Arg_AppDomainUnloadedException" xml:space="preserve">
+ <value>Attempted to access an unloaded AppDomain.</value>
+ </data>
+ <data name="Arg_ApplicationException" xml:space="preserve">
+ <value>Error in the application.</value>
+ </data>
+ <data name="Arg_ArgumentException" xml:space="preserve">
+ <value>Value does not fall within the expected range.</value>
+ </data>
+ <data name="Arg_ArgumentOutOfRangeException" xml:space="preserve">
+ <value>Specified argument was out of the range of valid values.</value>
+ </data>
+ <data name="Arg_ArithmeticException" xml:space="preserve">
+ <value>Overflow or underflow in the arithmetic operation.</value>
+ </data>
+ <data name="Arg_ArrayLengthsDiffer" xml:space="preserve">
+ <value>Array lengths must be the same.</value>
+ </data>
+ <data name="Arg_ArrayPlusOffTooSmall" xml:space="preserve">
+ <value>Destination array is not long enough to copy all the items in the collection. Check array index and length.</value>
+ </data>
+ <data name="Arg_ArrayTypeMismatchException" xml:space="preserve">
+ <value>Attempted to access an element as a type incompatible with the array.</value>
+ </data>
+ <data name="Arg_ArrayZeroError" xml:space="preserve">
+ <value>Array must not be of length zero.</value>
+ </data>
+ <data name="Arg_BadDecimal" xml:space="preserve">
+ <value>Read an invalid decimal value from the buffer.</value>
+ </data>
+ <data name="Arg_BadImageFormatException" xml:space="preserve">
+ <value>Format of the executable (.exe) or library (.dll) is invalid.</value>
+ </data>
+ <data name="Arg_BadLiteralFormat" xml:space="preserve">
+ <value>Encountered an invalid type for a default value.</value>
+ </data>
+ <data name="Arg_BogusIComparer" xml:space="preserve">
+ <value>Unable to sort because the IComparer.Compare() method returns inconsistent results. Either a value does not compare equal to itself, or one value repeatedly compared to another value yields different results. IComparer: '{0}'.</value>
+ </data>
+ <data name="Arg_BufferTooSmall" xml:space="preserve">
+ <value>Not enough space available in the buffer.</value>
+ </data>
+ <data name="Arg_CannotBeNaN" xml:space="preserve">
+ <value>TimeSpan does not accept floating point Not-a-Number values.</value>
+ </data>
+ <data name="Arg_CannotHaveNegativeValue" xml:space="preserve">
+ <value>String cannot contain a minus sign if the base is not 10.</value>
+ </data>
+ <data name="Arg_CATypeResolutionFailed" xml:space="preserve">
+ <value>Failed to resolve type from string "{0}" which was embedded in custom attribute blob.</value>
+ </data>
+ <data name="Arg_COMAccess" xml:space="preserve">
+ <value>Must specify property Set or Get or method call for a COM Object.</value>
+ </data>
+ <data name="Arg_COMException" xml:space="preserve">
+ <value>Error HRESULT E_FAIL has been returned from a call to a COM component.</value>
+ </data>
+ <data name="Arg_COMPropSetPut" xml:space="preserve">
+ <value>Only one of the following binding flags can be set: BindingFlags.SetProperty, BindingFlags.PutDispProperty, BindingFlags.PutRefDispProperty.</value>
+ </data>
+ <data name="Arg_CreatInstAccess" xml:space="preserve">
+ <value>Cannot specify both CreateInstance and another access type.</value>
+ </data>
+ <data name="Arg_CryptographyException" xml:space="preserve">
+ <value>Error occurred during a cryptographic operation.</value>
+ </data>
+ <data name="Arg_CustomAttributeFormatException" xml:space="preserve">
+ <value>Binary format of the specified custom attribute was invalid.</value>
+ </data>
+ <data name="Arg_DataMisalignedException" xml:space="preserve">
+ <value>A datatype misalignment was detected in a load or store instruction.</value>
+ </data>
+ <data name="Arg_DateTimeRange" xml:space="preserve">
+ <value>Combination of arguments to the DateTime constructor is out of the legal range.</value>
+ </data>
+ <data name="Arg_DecBitCtor" xml:space="preserve">
+ <value>Decimal byte array constructor requires an array of length four containing valid decimal bytes.</value>
+ </data>
+ <data name="Arg_DirectoryNotFoundException" xml:space="preserve">
+ <value>Attempted to access a path that is not on the disk.</value>
+ </data>
+ <data name="Arg_DivideByZero" xml:space="preserve">
+ <value>Attempted to divide by zero.</value>
+ </data>
+ <data name="Arg_DlgtNullInst" xml:space="preserve">
+ <value>Delegate to an instance method cannot have null 'this'.</value>
+ </data>
+ <data name="Arg_DlgtTargMeth" xml:space="preserve">
+ <value>Cannot bind to the target method because its signature or security transparency is not compatible with that of the delegate type.</value>
+ </data>
+ <data name="Arg_DlgtTypeMis" xml:space="preserve">
+ <value>Delegates must be of the same type.</value>
+ </data>
+ <data name="Arg_DllNotFoundException" xml:space="preserve">
+ <value>Dll was not found.</value>
+ </data>
+ <data name="Arg_DriveNotFoundException" xml:space="preserve">
+ <value>Attempted to access a drive that is not available.</value>
+ </data>
+ <data name="Arg_DuplicateWaitObjectException" xml:space="preserve">
+ <value>Duplicate objects in argument.</value>
+ </data>
+ <data name="Arg_EHClauseNotClause" xml:space="preserve">
+ <value>This ExceptionHandlingClause is not a clause.</value>
+ </data>
+ <data name="Arg_EHClauseNotFilter" xml:space="preserve">
+ <value>This ExceptionHandlingClause is not a filter.</value>
+ </data>
+ <data name="Arg_EmptyArray" xml:space="preserve">
+ <value>Array may not be empty.</value>
+ </data>
+ <data name="Arg_EmptyOrNullString" xml:space="preserve">
+ <value>String may not be empty or null.</value>
+ </data>
+ <data name="Arg_EndOfStreamException" xml:space="preserve">
+ <value>Attempted to read past the end of the stream.</value>
+ </data>
+ <data name="Arg_EntryPointNotFoundException" xml:space="preserve">
+ <value>Entry point was not found.</value>
+ </data>
+ <data name="Arg_EnumAndObjectMustBeSameType" xml:space="preserve">
+ <value>Object must be the same type as the enum. The type passed in was '{0}'; the enum type was '{1}'.</value>
+ </data>
+ <data name="Arg_EnumFormatUnderlyingTypeAndObjectMustBeSameType" xml:space="preserve">
+ <value>Enum underlying type and the object must be same type or object. Type passed in was '{0}'; the enum underlying type was '{1}'.</value>
+ </data>
+ <data name="Arg_EnumIllegalVal" xml:space="preserve">
+ <value>Illegal enum value: {0}.</value>
+ </data>
+ <data name="Arg_EnumLitValueNotFound" xml:space="preserve">
+ <value>Literal value was not found.</value>
+ </data>
+ <data name="Arg_EnumUnderlyingTypeAndObjectMustBeSameType" xml:space="preserve">
+ <value>Enum underlying type and the object must be same type or object must be a String. Type passed in was '{0}'; the enum underlying type was '{1}'.</value>
+ </data>
+ <data name="Arg_EnumValueNotFound" xml:space="preserve">
+ <value>Requested value '{0}' was not found.</value>
+ </data>
+ <data name="Arg_ExecutionEngineException" xml:space="preserve">
+ <value>Internal error in the runtime.</value>
+ </data>
+ <data name="Arg_ExternalException" xml:space="preserve">
+ <value>External component has thrown an exception.</value>
+ </data>
+ <data name="Arg_FieldAccessException" xml:space="preserve">
+ <value>Attempted to access a field that is not accessible by the caller.</value>
+ </data>
+ <data name="Arg_FieldDeclTarget" xml:space="preserve">
+ <value>Field '{0}' defined on type '{1}' is not a field on the target object which is of type '{2}'.</value>
+ </data>
+ <data name="Arg_FldGetArgErr" xml:space="preserve">
+ <value>No arguments can be provided to Get a field value.</value>
+ </data>
+ <data name="Arg_FldGetPropSet" xml:space="preserve">
+ <value>Cannot specify both GetField and SetProperty.</value>
+ </data>
+ <data name="Arg_FldSetArgErr" xml:space="preserve">
+ <value>Only the field value can be specified to set a field value.</value>
+ </data>
+ <data name="Arg_FldSetGet" xml:space="preserve">
+ <value>Cannot specify both Get and Set on a field.</value>
+ </data>
+ <data name="Arg_FldSetInvoke" xml:space="preserve">
+ <value>Cannot specify Set on a Field and Invoke on a method.</value>
+ </data>
+ <data name="Arg_FldSetPropGet" xml:space="preserve">
+ <value>Cannot specify both SetField and GetProperty.</value>
+ </data>
+ <data name="Arg_FormatException" xml:space="preserve">
+ <value>One of the identified items was in an invalid format.</value>
+ </data>
+ <data name="Arg_GenericParameter" xml:space="preserve">
+ <value>Method must be called on a Type for which Type.IsGenericParameter is false.</value>
+ </data>
+ <data name="Arg_GetMethNotFnd" xml:space="preserve">
+ <value>Property Get method was not found.</value>
+ </data>
+ <data name="Arg_GuidArrayCtor" xml:space="preserve">
+ <value>Byte array for GUID must be exactly {0} bytes long.</value>
+ </data>
+ <data name="Arg_HandleNotAsync" xml:space="preserve">
+ <value>Handle does not support asynchronous operations. The parameters to the FileStream constructor may need to be changed to indicate that the handle was opened synchronously (that is, it was not opened for overlapped I/O).</value>
+ </data>
+ <data name="Arg_HandleNotSync" xml:space="preserve">
+ <value>Handle does not support synchronous operations. The parameters to the FileStream constructor may need to be changed to indicate that the handle was opened asynchronously (that is, it was opened explicitly for overlapped I/O).</value>
+ </data>
+ <data name="Arg_HexStyleNotSupported" xml:space="preserve">
+ <value>The number style AllowHexSpecifier is not supported on floating point data types.</value>
+ </data>
+ <data name="Arg_HTCapacityOverflow" xml:space="preserve">
+ <value>Hashtable's capacity overflowed and went negative. Check load factor, capacity and the current size of the table.</value>
+ </data>
+ <data name="Arg_IndexMustBeInt" xml:space="preserve">
+ <value>All indexes must be of type Int32.</value>
+ </data>
+ <data name="Arg_IndexOutOfRangeException" xml:space="preserve">
+ <value>Index was outside the bounds of the array.</value>
+ </data>
+ <data name="Arg_InsufficientExecutionStackException" xml:space="preserve">
+ <value>Insufficient stack to continue executing the program safely. This can happen from having too many functions on the call stack or function on the stack using too much stack space.</value>
+ </data>
+ <data name="Arg_InvalidANSIString" xml:space="preserve">
+ <value>The ANSI string passed in could not be converted from the default ANSI code page to Unicode.</value>
+ </data>
+ <data name="Arg_InvalidBase" xml:space="preserve">
+ <value>Invalid Base.</value>
+ </data>
+ <data name="Arg_InvalidCastException" xml:space="preserve">
+ <value>Specified cast is not valid.</value>
+ </data>
+ <data name="Arg_InvalidComObjectException" xml:space="preserve">
+ <value>Attempt has been made to use a COM object that does not have a backing class factory.</value>
+ </data>
+ <data name="Arg_InvalidFilterCriteriaException" xml:space="preserve">
+ <value>Specified filter criteria was invalid.</value>
+ </data>
+ <data name="Arg_InvalidHandle" xml:space="preserve">
+ <value>Invalid handle.</value>
+ </data>
+ <data name="Arg_InvalidHexStyle" xml:space="preserve">
+ <value>With the AllowHexSpecifier bit set in the enum bit field, the only other valid bits that can be combined into the enum value must be a subset of those in HexNumber.</value>
+ </data>
+ <data name="Arg_InvalidNeutralResourcesLanguage_Asm_Culture" xml:space="preserve">
+ <value>The NeutralResourcesLanguageAttribute on the assembly "{0}" specifies an invalid culture name: "{1}".</value>
+ </data>
+ <data name="Arg_InvalidNeutralResourcesLanguage_FallbackLoc" xml:space="preserve">
+ <value>The NeutralResourcesLanguageAttribute specifies an invalid or unrecognized ultimate resource fallback location: "{0}".</value>
+ </data>
+ <data name="Arg_InvalidOleVariantTypeException" xml:space="preserve">
+ <value>Specified OLE variant was invalid.</value>
+ </data>
+ <data name="Arg_InvalidOperationException" xml:space="preserve">
+ <value>Operation is not valid due to the current state of the object.</value>
+ </data>
+ <data name="Arg_InvalidSearchPattern" xml:space="preserve">
+ <value>Search pattern cannot contain ".." to move up directories and can be contained only internally in file/directory names, as in "a..b".</value>
+ </data>
+ <data name="Arg_InvalidTypeInRetType" xml:space="preserve">
+ <value>The return Type contains some invalid type (i.e. null, ByRef)</value>
+ </data>
+ <data name="Arg_InvalidTypeInSignature" xml:space="preserve">
+ <value>The signature Type array contains some invalid type (i.e. null, void)</value>
+ </data>
+ <data name="Arg_InvalidUTF8String" xml:space="preserve">
+ <value>The UTF8 string passed in could not be converted to Unicode.</value>
+ </data>
+ <data name="Arg_IOException" xml:space="preserve">
+ <value>I/O error occurred.</value>
+ </data>
+ <data name="Arg_KeyNotFound" xml:space="preserve">
+ <value>The given key was not present in the dictionary.</value>
+ </data>
+ <data name="Arg_LongerThanDestArray" xml:space="preserve">
+ <value>Destination array was not long enough. Check the destination index, length, and the array's lower bounds.</value>
+ </data>
+ <data name="Arg_LongerThanSrcArray" xml:space="preserve">
+ <value>Source array was not long enough. Check the source index, length, and the array's lower bounds.</value>
+ </data>
+ <data name="Arg_LongerThanSrcString" xml:space="preserve">
+ <value>Source string was not long enough. Check sourceIndex and count.</value>
+ </data>
+ <data name="Arg_LowerBoundsMustMatch" xml:space="preserve">
+ <value>The arrays' lower bounds must be identical.</value>
+ </data>
+ <data name="Arg_MarshalAsAnyRestriction" xml:space="preserve">
+ <value>AsAny cannot be used on return types, ByRef parameters, ArrayWithOffset, or parameters passed from unmanaged to managed.</value>
+ </data>
+ <data name="Arg_MarshalDirectiveException" xml:space="preserve">
+ <value>Marshaling directives are invalid.</value>
+ </data>
+ <data name="Arg_MethodAccessException" xml:space="preserve">
+ <value>Attempt to access the method failed.</value>
+ </data>
+ <data name="Arg_MethodAccessException_WithMethodName" xml:space="preserve">
+ <value>Attempt to access the method "{0}" on type "{1}" failed.</value>
+ </data>
+ <data name="Arg_MissingFieldException" xml:space="preserve">
+ <value>Attempted to access a non-existing field.</value>
+ </data>
+ <data name="Arg_MissingManifestResourceException" xml:space="preserve">
+ <value>Unable to find manifest resource.</value>
+ </data>
+ <data name="Arg_MissingMemberException" xml:space="preserve">
+ <value>Attempted to access a missing member.</value>
+ </data>
+ <data name="Arg_MissingMethodException" xml:space="preserve">
+ <value>Attempted to access a missing method.</value>
+ </data>
+ <data name="Arg_MulticastNotSupportedException" xml:space="preserve">
+ <value>Attempted to add multiple callbacks to a delegate that does not support multicast.</value>
+ </data>
+ <data name="Arg_MustBeBoolean" xml:space="preserve">
+ <value>Object must be of type Boolean.</value>
+ </data>
+ <data name="Arg_MustBeByte" xml:space="preserve">
+ <value>Object must be of type Byte.</value>
+ </data>
+ <data name="Arg_MustBeChar" xml:space="preserve">
+ <value>Object must be of type Char.</value>
+ </data>
+ <data name="Arg_MustBeDateTime" xml:space="preserve">
+ <value>Object must be of type DateTime.</value>
+ </data>
+ <data name="Arg_MustBeDateTimeOffset" xml:space="preserve">
+ <value>Object must be of type DateTimeOffset.</value>
+ </data>
+ <data name="Arg_MustBeDecimal" xml:space="preserve">
+ <value>Object must be of type Decimal.</value>
+ </data>
+ <data name="Arg_MustBeDelegate" xml:space="preserve">
+ <value>Type must derive from Delegate.</value>
+ </data>
+ <data name="Arg_MustBeDouble" xml:space="preserve">
+ <value>Object must be of type Double.</value>
+ </data>
+ <data name="Arg_MustBeEnum" xml:space="preserve">
+ <value>Type provided must be an Enum.</value>
+ </data>
+ <data name="Arg_MustBeEnumBaseTypeOrEnum" xml:space="preserve">
+ <value>The value passed in must be an enum base or an underlying type for an enum, such as an Int32.</value>
+ </data>
+ <data name="Arg_MustBeGuid" xml:space="preserve">
+ <value>Object must be of type GUID.</value>
+ </data>
+ <data name="Arg_MustBeInt16" xml:space="preserve">
+ <value>Object must be of type Int16.</value>
+ </data>
+ <data name="Arg_MustBeInt32" xml:space="preserve">
+ <value>Object must be of type Int32.</value>
+ </data>
+ <data name="Arg_MustBeInt64" xml:space="preserve">
+ <value>Object must be of type Int64.</value>
+ </data>
+ <data name="Arg_MustBeInterface" xml:space="preserve">
+ <value>Type passed must be an interface.</value>
+ </data>
+ <data name="Arg_MustBePointer" xml:space="preserve">
+ <value>Type must be a Pointer.</value>
+ </data>
+ <data name="Arg_MustBePrimArray" xml:space="preserve">
+ <value>Object must be an array of primitives.</value>
+ </data>
+ <data name="Arg_MustBeSByte" xml:space="preserve">
+ <value>Object must be of type SByte.</value>
+ </data>
+ <data name="Arg_MustBeSingle" xml:space="preserve">
+ <value>Object must be of type Single.</value>
+ </data>
+ <data name="Arg_MustBeStatic" xml:space="preserve">
+ <value>Method must be a static method.</value>
+ </data>
+ <data name="Arg_MustBeString" xml:space="preserve">
+ <value>Object must be of type String.</value>
+ </data>
+ <data name="Arg_MustBeStringPtrNotAtom" xml:space="preserve">
+ <value>The pointer passed in as a String must not be in the bottom 64K of the process's address space.</value>
+ </data>
+ <data name="Arg_MustBeTimeSpan" xml:space="preserve">
+ <value>Object must be of type TimeSpan.</value>
+ </data>
+ <data name="Arg_MustBeType" xml:space="preserve">
+ <value>Type must be a type provided by the runtime.</value>
+ </data>
+ <data name="Arg_MustBeUInt16" xml:space="preserve">
+ <value>Object must be of type UInt16.</value>
+ </data>
+ <data name="Arg_MustBeUInt32" xml:space="preserve">
+ <value>Object must be of type UInt32.</value>
+ </data>
+ <data name="Arg_MustBeUInt64" xml:space="preserve">
+ <value>Object must be of type UInt64.</value>
+ </data>
+ <data name="Arg_MustBeVersion" xml:space="preserve">
+ <value>Object must be of type Version.</value>
+ </data>
+ <data name="Arg_MustContainEnumInfo" xml:space="preserve">
+ <value>Must specify valid information for parsing in the string.</value>
+ </data>
+ <data name="Arg_NamedParamNull" xml:space="preserve">
+ <value>Named parameter value must not be null.</value>
+ </data>
+ <data name="Arg_NamedParamTooBig" xml:space="preserve">
+ <value>Named parameter array cannot be bigger than argument array.</value>
+ </data>
+ <data name="Arg_NDirectBadObject" xml:space="preserve">
+ <value>No PInvoke conversion exists for value passed to Object-typed parameter.</value>
+ </data>
+ <data name="Arg_Need1DArray" xml:space="preserve">
+ <value>Array was not a one-dimensional array.</value>
+ </data>
+ <data name="Arg_Need2DArray" xml:space="preserve">
+ <value>Array was not a two-dimensional array.</value>
+ </data>
+ <data name="Arg_Need3DArray" xml:space="preserve">
+ <value>Array was not a three-dimensional array.</value>
+ </data>
+ <data name="Arg_NeedAtLeast1Rank" xml:space="preserve">
+ <value>Must provide at least one rank.</value>
+ </data>
+ <data name="Arg_NegativeArgCount" xml:space="preserve">
+ <value>Argument count must not be negative.</value>
+ </data>
+ <data name="Arg_NoAccessSpec" xml:space="preserve">
+ <value>Must specify binding flags describing the invoke operation required (BindingFlags.InvokeMethod CreateInstance GetField SetField GetProperty SetProperty).</value>
+ </data>
+ <data name="Arg_NoDefCTor" xml:space="preserve">
+ <value>No parameterless constructor defined for this object.</value>
+ </data>
+ <data name="Arg_NoITypeInfo" xml:space="preserve">
+ <value>Specified TypeInfo was invalid because it did not support the ITypeInfo interface.</value>
+ </data>
+ <data name="Arg_NoITypeLib" xml:space="preserve">
+ <value>Specified TypeLib was invalid because it did not support the ITypeLib interface.</value>
+ </data>
+ <data name="Arg_NonZeroLowerBound" xml:space="preserve">
+ <value>The lower bound of target array must be zero.</value>
+ </data>
+ <data name="Arg_NoStaticVirtual" xml:space="preserve">
+ <value>Method cannot be both static and virtual.</value>
+ </data>
+ <data name="Arg_NotFiniteNumberException" xml:space="preserve">
+ <value>Number encountered was not a finite quantity.</value>
+ </data>
+ <data name="Arg_NotFoundIFace" xml:space="preserve">
+ <value>Interface not found.</value>
+ </data>
+ <data name="Arg_NotGenericMethodDefinition" xml:space="preserve">
+ <value>{0} is not a GenericMethodDefinition. MakeGenericMethod may only be called on a method for which MethodBase.IsGenericMethodDefinition is true.</value>
+ </data>
+ <data name="Arg_NotGenericParameter" xml:space="preserve">
+ <value>Method may only be called on a Type for which Type.IsGenericParameter is true.</value>
+ </data>
+ <data name="Arg_NotGenericTypeDefinition" xml:space="preserve">
+ <value>{0} is not a GenericTypeDefinition. MakeGenericType may only be called on a type for which Type.IsGenericTypeDefinition is true.</value>
+ </data>
+ <data name="Arg_NotImplementedException" xml:space="preserve">
+ <value>The method or operation is not implemented.</value>
+ </data>
+ <data name="Arg_NotSupportedException" xml:space="preserve">
+ <value>Specified method is not supported.</value>
+ </data>
+ <data name="Arg_NullIndex" xml:space="preserve">
+ <value>Arrays indexes must be set to an object instance.</value>
+ </data>
+ <data name="Arg_NullReferenceException" xml:space="preserve">
+ <value>Object reference not set to an instance of an object.</value>
+ </data>
+ <data name="Arg_ObjObj" xml:space="preserve">
+ <value>Object type cannot be converted to target type.</value>
+ </data>
+ <data name="Arg_ObjObjEx" xml:space="preserve">
+ <value>Object of type '{0}' cannot be converted to type '{1}'.</value>
+ </data>
+ <data name="Arg_OleAutDateInvalid" xml:space="preserve">
+ <value>Not a legal OleAut date.</value>
+ </data>
+ <data name="Arg_OleAutDateScale" xml:space="preserve">
+ <value>OleAut date did not convert to a DateTime correctly.</value>
+ </data>
+ <data name="Arg_OverflowException" xml:space="preserve">
+ <value>Arithmetic operation resulted in an overflow.</value>
+ </data>
+ <data name="Arg_ParamName_Name" xml:space="preserve">
+ <value>Parameter name: {0}</value>
+ </data>
+ <data name="Arg_ParmArraySize" xml:space="preserve">
+ <value>Must specify one or more parameters.</value>
+ </data>
+ <data name="Arg_ParmCnt" xml:space="preserve">
+ <value>Parameter count mismatch.</value>
+ </data>
+ <data name="Arg_PathIllegal" xml:space="preserve">
+ <value>The path is not of a legal form.</value>
+ </data>
+ <data name="Arg_PathIllegalUNC" xml:space="preserve">
+ <value>The UNC path should be of the form \\\\server\\share.</value>
+ </data>
+ <data name="Arg_PlatformNotSupported" xml:space="preserve">
+ <value>Operation is not supported on this platform.</value>
+ </data>
+ <data name="Arg_PrimWiden" xml:space="preserve">
+ <value>Cannot widen from source type to target type either because the source type is a not a primitive type or the conversion cannot be accomplished.</value>
+ </data>
+ <data name="Arg_PropSetGet" xml:space="preserve">
+ <value>Cannot specify both Get and Set on a property.</value>
+ </data>
+ <data name="Arg_PropSetInvoke" xml:space="preserve">
+ <value>Cannot specify Set on a property and Invoke on a method.</value>
+ </data>
+ <data name="Arg_RankException" xml:space="preserve">
+ <value>Attempted to operate on an array with the incorrect number of dimensions.</value>
+ </data>
+ <data name="Arg_RankIndices" xml:space="preserve">
+ <value>Indices length does not match the array rank.</value>
+ </data>
+ <data name="Arg_RankMultiDimNotSupported" xml:space="preserve">
+ <value>Only single dimensional arrays are supported for the requested action.</value>
+ </data>
+ <data name="Arg_RanksAndBounds" xml:space="preserve">
+ <value>Number of lengths and lowerBounds must match.</value>
+ </data>
+ <data name="Arg_ReflectionOnlyCA" xml:space="preserve">
+ <value>It is illegal to reflect on the custom attributes of a Type loaded via ReflectionOnlyGetType (see Assembly.ReflectionOnly) -- use CustomAttributeData instead.</value>
+ </data>
+ <data name="Arg_ReflectionOnlyField" xml:space="preserve">
+ <value>It is illegal to get or set the value on a field on a Type loaded via ReflectionOnlyGetType.</value>
+ </data>
+ <data name="Arg_ReflectionOnlyInvoke" xml:space="preserve">
+ <value>It is illegal to invoke a method on a Type loaded via ReflectionOnlyGetType.</value>
+ </data>
+ <data name="Arg_RegBadKeyKind" xml:space="preserve">
+ <value>The specified RegistryValueKind is an invalid value.</value>
+ </data>
+ <data name="Arg_RegGetOverflowBug" xml:space="preserve">
+ <value>RegistryKey.GetValue does not allow a String that has a length greater than Int32.MaxValue.</value>
+ </data>
+ <data name="Arg_RegInvalidKeyName" xml:space="preserve">
+ <value>Registry key name must start with a valid base key name.</value>
+ </data>
+ <data name="Arg_RegKeyNotFound" xml:space="preserve">
+ <value>The specified registry key does not exist.</value>
+ </data>
+ <data name="Arg_RegKeyStrLenBug" xml:space="preserve">
+ <value>Registry key names should not be greater than 255 characters.</value>
+ </data>
+ <data name="Arg_RegSetBadArrType" xml:space="preserve">
+ <value>RegistryKey.SetValue does not support arrays of type '{0}'. Only Byte[] and String[] are supported.</value>
+ </data>
+ <data name="Arg_RegSetMismatchedKind" xml:space="preserve">
+ <value>The type of the value object did not match the specified RegistryValueKind or the object could not be properly converted.</value>
+ </data>
+ <data name="Arg_RegSetStrArrNull" xml:space="preserve">
+ <value>RegistryKey.SetValue does not allow a String[] that contains a null String reference.</value>
+ </data>
+ <data name="Arg_RegSubKeyValueAbsent" xml:space="preserve">
+ <value>No value exists with that name.</value>
+ </data>
+ <data name="Arg_RegValStrLenBug" xml:space="preserve">
+ <value>Registry value names should not be greater than 16,383 characters.</value>
+ </data>
+ <data name="Arg_RemoveArgNotFound" xml:space="preserve">
+ <value>Cannot remove the specified item because it was not found in the specified Collection.</value>
+ </data>
+ <data name="Arg_ResMgrNotResSet" xml:space="preserve">
+ <value>Type parameter must refer to a subclass of ResourceSet.</value>
+ </data>
+ <data name="Arg_ResourceFileUnsupportedVersion" xml:space="preserve">
+ <value>The ResourceReader class does not know how to read this version of .resources files. Expected version: {0} This file: {1}</value>
+ </data>
+ <data name="Arg_ResourceNameNotExist" xml:space="preserve">
+ <value>The specified resource name "{0}" does not exist in the resource file.</value>
+ </data>
+ <data name="Arg_SafeArrayRankMismatchException" xml:space="preserve">
+ <value>Specified array was not of the expected rank.</value>
+ </data>
+ <data name="Arg_SafeArrayTypeMismatchException" xml:space="preserve">
+ <value>Specified array was not of the expected type.</value>
+ </data>
+ <data name="Arg_SecurityException" xml:space="preserve">
+ <value>Security error.</value>
+ </data>
+ <data name="Arg_SerializationException" xml:space="preserve">
+ <value>Serialization error.</value>
+ </data>
+ <data name="Arg_SetMethNotFnd" xml:space="preserve">
+ <value>Property set method not found.</value>
+ </data>
+ <data name="Arg_StackOverflowException" xml:space="preserve">
+ <value>Operation caused a stack overflow.</value>
+ </data>
+ <data name="Arg_SurrogatesNotAllowedAsSingleChar" xml:space="preserve">
+ <value>Unicode surrogate characters must be written out as pairs together in the same call, not individually. Consider passing in a character array instead.</value>
+ </data>
+ <data name="Arg_SynchronizationLockException" xml:space="preserve">
+ <value>Object synchronization method was called from an unsynchronized block of code.</value>
+ </data>
+ <data name="Arg_SystemException" xml:space="preserve">
+ <value>System error.</value>
+ </data>
+ <data name="Arg_TargetInvocationException" xml:space="preserve">
+ <value>Exception has been thrown by the target of an invocation.</value>
+ </data>
+ <data name="Arg_TargetParameterCountException" xml:space="preserve">
+ <value>Number of parameters specified does not match the expected number.</value>
+ </data>
+ <data name="Arg_ThreadStartException" xml:space="preserve">
+ <value>Thread failed to start.</value>
+ </data>
+ <data name="Arg_ThreadStateException" xml:space="preserve">
+ <value>Thread was in an invalid state for the operation being executed.</value>
+ </data>
+ <data name="Arg_TimeoutException" xml:space="preserve">
+ <value>The operation has timed out.</value>
+ </data>
+ <data name="Arg_TypeAccessException" xml:space="preserve">
+ <value>Attempt to access the type failed.</value>
+ </data>
+ <data name="Arg_TypedReference_Null" xml:space="preserve">
+ <value>The TypedReference must be initialized.</value>
+ </data>
+ <data name="Arg_TypeLoadException" xml:space="preserve">
+ <value>Failure has occurred while loading a type.</value>
+ </data>
+ <data name="Arg_TypeLoadNullStr" xml:space="preserve">
+ <value>A null or zero length string does not represent a valid Type.</value>
+ </data>
+ <data name="Arg_TypeRefPrimitve" xml:space="preserve">
+ <value>TypedReferences cannot be redefined as primitives.</value>
+ </data>
+ <data name="Arg_TypeUnloadedException" xml:space="preserve">
+ <value>Type had been unloaded.</value>
+ </data>
+ <data name="Arg_UnauthorizedAccessException" xml:space="preserve">
+ <value>Attempted to perform an unauthorized operation.</value>
+ </data>
+ <data name="Arg_UnboundGenField" xml:space="preserve">
+ <value>Late bound operations cannot be performed on fields with types for which Type.ContainsGenericParameters is true.</value>
+ </data>
+ <data name="Arg_UnboundGenParam" xml:space="preserve">
+ <value>Late bound operations cannot be performed on types or methods for which ContainsGenericParameters is true.</value>
+ </data>
+ <data name="Arg_UnknownTypeCode" xml:space="preserve">
+ <value>Unknown TypeCode value.</value>
+ </data>
+ <data name="Arg_VarMissNull" xml:space="preserve">
+ <value>Missing parameter does not have a default value.</value>
+ </data>
+ <data name="Arg_VersionString" xml:space="preserve">
+ <value>Version string portion was too short or too long.</value>
+ </data>
+ <data name="Arg_WrongAsyncResult" xml:space="preserve">
+ <value>IAsyncResult object did not come from the corresponding async method on this type.</value>
+ </data>
+ <data name="Arg_WrongType" xml:space="preserve">
+ <value>The value "{0}" is not of type "{1}" and cannot be used in this generic collection.</value>
+ </data>
+ <data name="Argument_AbsolutePathRequired" xml:space="preserve">
+ <value>Absolute path information is required.</value>
+ </data>
+ <data name="Argument_AddingDuplicate" xml:space="preserve">
+ <value>An item with the same key has already been added.</value>
+ </data>
+ <data name="Argument_AddingDuplicate__" xml:space="preserve">
+ <value>Item has already been added. Key in dictionary: '{0}' Key being added: '{1}'</value>
+ </data>
+ <data name="Argument_AddingDuplicateWithKey" xml:space="preserve">
+ <value>An item with the same key has already been added. Key: {0}</value>
+ </data>
+ <data name="Argument_AdjustmentRulesNoNulls" xml:space="preserve">
+ <value>The AdjustmentRule array cannot contain null elements.</value>
+ </data>
+ <data name="Argument_AdjustmentRulesOutOfOrder" xml:space="preserve">
+ <value>The elements of the AdjustmentRule array must be in chronological order and must not overlap.</value>
+ </data>
+ <data name="Argument_AlreadyACCW" xml:space="preserve">
+ <value>The object already has a CCW associated with it.</value>
+ </data>
+ <data name="Argument_AlreadyBoundOrSyncHandle" xml:space="preserve">
+ <value>'handle' has already been bound to the thread pool, or was not opened for asynchronous I/O.</value>
+ </data>
+ <data name="Argument_ArgumentZero" xml:space="preserve">
+ <value>Argument cannot be zero.</value>
+ </data>
+ <data name="Argument_ArrayGetInterfaceMap" xml:space="preserve">
+ <value>Interface maps for generic interfaces on arrays cannot be retrieved.</value>
+ </data>
+ <data name="Argument_ArraysInvalid" xml:space="preserve">
+ <value>Array or pointer types are not valid.</value>
+ </data>
+ <data name="Argument_BadAttributeOnInterfaceMethod" xml:space="preserve">
+ <value>Interface method must be abstract and virtual.</value>
+ </data>
+ <data name="Argument_BadConstantValue" xml:space="preserve">
+ <value>Bad default value.</value>
+ </data>
+ <data name="Argument_BadConstructor" xml:space="preserve">
+ <value>Cannot have private or static constructor.</value>
+ </data>
+ <data name="Argument_BadConstructorCallConv" xml:space="preserve">
+ <value>Constructor must have standard calling convention.</value>
+ </data>
+ <data name="Argument_BadExceptionCodeGen" xml:space="preserve">
+ <value>Incorrect code generation for exception block.</value>
+ </data>
+ <data name="Argument_BadFieldForConstructorBuilder" xml:space="preserve">
+ <value>Field must be on the same type of the given ConstructorInfo.</value>
+ </data>
+ <data name="Argument_BadFieldSig" xml:space="preserve">
+ <value>Field signatures do not have return types.</value>
+ </data>
+ <data name="Argument_BadFieldType" xml:space="preserve">
+ <value>Bad field type in defining field.</value>
+ </data>
+ <data name="Argument_BadFormatSpecifier" xml:space="preserve">
+ <value>Format specifier was invalid.</value>
+ </data>
+ <data name="Argument_BadImageFormatExceptionResolve" xml:space="preserve">
+ <value>A BadImageFormatException has been thrown while parsing the signature. This is likely due to lack of a generic context. Ensure genericTypeArguments and genericMethodArguments are provided and contain enough context.</value>
+ </data>
+ <data name="Argument_BadLabel" xml:space="preserve">
+ <value>Bad label in ILGenerator.</value>
+ </data>
+ <data name="Argument_BadLabelContent" xml:space="preserve">
+ <value>Bad label content in ILGenerator.</value>
+ </data>
+ <data name="Argument_BadNestedTypeFlags" xml:space="preserve">
+ <value>Visibility of interfaces must be one of the following: NestedAssembly, NestedFamANDAssem, NestedFamily, NestedFamORAssem, NestedPrivate or NestedPublic.</value>
+ </data>
+ <data name="Argument_BadObjRef" xml:space="preserve">
+ <value>Invalid ObjRef provided to '{0}'.</value>
+ </data>
+ <data name="Argument_BadParameterCountsForConstructor" xml:space="preserve">
+ <value>Parameter count does not match passed in argument value count.</value>
+ </data>
+ <data name="Argument_BadParameterTypeForCAB" xml:space="preserve">
+ <value>Cannot emit a CustomAttribute with argument of type {0}.</value>
+ </data>
+ <data name="Argument_BadPropertyForConstructorBuilder" xml:space="preserve">
+ <value>Property must be on the same type of the given ConstructorInfo.</value>
+ </data>
+ <data name="Argument_BadSigFormat" xml:space="preserve">
+ <value>Incorrect signature format.</value>
+ </data>
+ <data name="Argument_BadSizeForData" xml:space="preserve">
+ <value>Data size must be &gt; 1 and &lt; 0x3f0000</value>
+ </data>
+ <data name="Argument_BadTypeAttrInvalidLayout" xml:space="preserve">
+ <value>Bad type attributes. Invalid layout attribute specified.</value>
+ </data>
+ <data name="Argument_BadTypeAttrNestedVisibilityOnNonNestedType" xml:space="preserve">
+ <value>Bad type attributes. Nested visibility flag set on a non-nested type.</value>
+ </data>
+ <data name="Argument_BadTypeAttrNonNestedVisibilityNestedType" xml:space="preserve">
+ <value>Bad type attributes. Non-nested visibility flag set on a nested type.</value>
+ </data>
+ <data name="Argument_BadTypeAttrReservedBitsSet" xml:space="preserve">
+ <value>Bad type attributes. Reserved bits set on the type.</value>
+ </data>
+ <data name="Argument_BadTypeInCustomAttribute" xml:space="preserve">
+ <value>An invalid type was used as a custom attribute constructor argument, field or property.</value>
+ </data>
+ <data name="Argument_CannotCreateTypedReference" xml:space="preserve">
+ <value>Cannot use function evaluation to create a TypedReference object.</value>
+ </data>
+ <data name="Argument_CannotGetTypeTokenForByRef" xml:space="preserve">
+ <value>Cannot get TypeToken for a ByRef type.</value>
+ </data>
+ <data name="Argument_CannotSetParentToInterface" xml:space="preserve">
+ <value>Cannot set parent to an interface.</value>
+ </data>
+ <data name="Argument_CantCallSecObjFunc" xml:space="preserve">
+ <value>Cannot evaluate a security function.</value>
+ </data>
+ <data name="Argument_CodepageNotSupported" xml:space="preserve">
+ <value>{0} is not a supported code page.</value>
+ </data>
+ <data name="Argument_CompareOptionOrdinal" xml:space="preserve">
+ <value>CompareOption.Ordinal cannot be used with other options.</value>
+ </data>
+ <data name="Argument_ConflictingDateTimeRoundtripStyles" xml:space="preserve">
+ <value>The DateTimeStyles value RoundtripKind cannot be used with the values AssumeLocal, AssumeUniversal or AdjustToUniversal.</value>
+ </data>
+ <data name="Argument_ConflictingDateTimeStyles" xml:space="preserve">
+ <value>The DateTimeStyles values AssumeLocal and AssumeUniversal cannot be used together.</value>
+ </data>
+ <data name="Argument_ConstantDoesntMatch" xml:space="preserve">
+ <value>Constant does not match the defined type.</value>
+ </data>
+ <data name="Argument_ConstantNotSupported" xml:space="preserve">
+ <value>{0} is not a supported constant type.</value>
+ </data>
+ <data name="Argument_ConstantNull" xml:space="preserve">
+ <value>Null is not a valid constant value for this type.</value>
+ </data>
+ <data name="Argument_ConstructorNeedGenericDeclaringType" xml:space="preserve">
+ <value>The specified constructor must be declared on a generic type definition.</value>
+ </data>
+ <data name="Argument_ConversionOverflow" xml:space="preserve">
+ <value>Conversion buffer overflow.</value>
+ </data>
+ <data name="Argument_ConvertMismatch" xml:space="preserve">
+ <value>The conversion could not be completed because the supplied DateTime did not have the Kind property set correctly. For example, when the Kind property is DateTimeKind.Local, the source time zone must be TimeZoneInfo.Local.</value>
+ </data>
+ <data name="Argument_CORDBBadMethod" xml:space="preserve">
+ <value>Cannot find the method on the object instance.</value>
+ </data>
+ <data name="Argument_CORDBBadVarArgCallConv" xml:space="preserve">
+ <value>Cannot evaluate a VarArgs function.</value>
+ </data>
+ <data name="Argument_CultureIetfNotSupported" xml:space="preserve">
+ <value>Culture IETF Name {0} is not a recognized IETF name.</value>
+ </data>
+ <data name="Argument_CultureInvalidIdentifier" xml:space="preserve">
+ <value>{0} is an invalid culture identifier.</value>
+ </data>
+ <data name="Argument_CultureIsNeutral" xml:space="preserve">
+ <value>Culture ID {0} (0x{0:X4}) is a neutral culture; a region cannot be created from it.</value>
+ </data>
+ <data name="Argument_CultureNotSupported" xml:space="preserve">
+ <value>Culture is not supported.</value>
+ </data>
+ <data name="Argument_CustomAssemblyLoadContextRequestedNameMismatch" xml:space="preserve">
+ <value>Resolved assembly's simple name should be the same as of the requested assembly.</value>
+ </data>
+ <data name="Argument_CustomCultureCannotBePassedByNumber" xml:space="preserve">
+ <value>Customized cultures cannot be passed by LCID, only by name.</value>
+ </data>
+ <data name="Argument_DateTimeBadBinaryData" xml:space="preserve">
+ <value>The binary data must result in a DateTime with ticks between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.</value>
+ </data>
+ <data name="Argument_DateTimeHasTicks" xml:space="preserve">
+ <value>The supplied DateTime must have the Year, Month, and Day properties set to 1. The time cannot be specified more precisely than whole milliseconds.</value>
+ </data>
+ <data name="Argument_DateTimeHasTimeOfDay" xml:space="preserve">
+ <value>The supplied DateTime includes a TimeOfDay setting. This is not supported.</value>
+ </data>
+ <data name="Argument_DateTimeIsInvalid" xml:space="preserve">
+ <value>The supplied DateTime represents an invalid time. For example, when the clock is adjusted forward, any time in the period that is skipped is invalid.</value>
+ </data>
+ <data name="Argument_DateTimeIsNotAmbiguous" xml:space="preserve">
+ <value>The supplied DateTime is not in an ambiguous time range.</value>
+ </data>
+ <data name="Argument_DateTimeKindMustBeUnspecified" xml:space="preserve">
+ <value>The supplied DateTime must have the Kind property set to DateTimeKind.Unspecified.</value>
+ </data>
+ <data name="Argument_DateTimeKindMustBeUnspecifiedOrUtc" xml:space="preserve">
+ <value>The supplied DateTime must have the Kind property set to DateTimeKind.Unspecified or DateTimeKind.Utc.</value>
+ </data>
+ <data name="Argument_DateTimeOffsetInvalidDateTimeStyles" xml:space="preserve">
+ <value>The DateTimeStyles value 'NoCurrentDateDefault' is not allowed when parsing DateTimeOffset.</value>
+ </data>
+ <data name="Argument_DateTimeOffsetIsNotAmbiguous" xml:space="preserve">
+ <value>The supplied DateTimeOffset is not in an ambiguous time range.</value>
+ </data>
+ <data name="Argument_DestinationTooShort" xml:space="preserve">
+ <value>Destination is too short.</value>
+ </data>
+ <data name="Argument_DuplicateTypeName" xml:space="preserve">
+ <value>Duplicate type name within an assembly.</value>
+ </data>
+ <data name="Argument_EmitWriteLineType" xml:space="preserve">
+ <value>EmitWriteLine does not support this field or local type.</value>
+ </data>
+ <data name="Argument_EmptyDecString" xml:space="preserve">
+ <value>Decimal separator cannot be the empty string.</value>
+ </data>
+ <data name="Argument_EmptyFileName" xml:space="preserve">
+ <value>Empty file name is not legal.</value>
+ </data>
+ <data name="Argument_EmptyName" xml:space="preserve">
+ <value>Empty name is not legal.</value>
+ </data>
+ <data name="Argument_EmptyPath" xml:space="preserve">
+ <value>Empty path name is not legal.</value>
+ </data>
+ <data name="Argument_EmptyWaithandleArray" xml:space="preserve">
+ <value>Waithandle array may not be empty.</value>
+ </data>
+ <data name="Argument_EncoderFallbackNotEmpty" xml:space="preserve">
+ <value>Must complete Convert() operation or call Encoder.Reset() before calling GetBytes() or GetByteCount(). Encoder '{0}' fallback '{1}'.</value>
+ </data>
+ <data name="Argument_EncodingConversionOverflowBytes" xml:space="preserve">
+ <value>The output byte buffer is too small to contain the encoded data, encoding '{0}' fallback '{1}'.</value>
+ </data>
+ <data name="Argument_EncodingConversionOverflowChars" xml:space="preserve">
+ <value>The output char buffer is too small to contain the decoded characters, encoding '{0}' fallback '{1}'.</value>
+ </data>
+ <data name="Argument_EncodingNotSupported" xml:space="preserve">
+ <value>'{0}' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.</value>
+ </data>
+ <data name="Argument_EnumTypeDoesNotMatch" xml:space="preserve">
+ <value>The argument type, '{0}', is not the same as the enum type '{1}'.</value>
+ </data>
+ <data name="Argument_FallbackBufferNotEmpty" xml:space="preserve">
+ <value>Cannot change fallback when buffer is not empty. Previous Convert() call left data in the fallback buffer.</value>
+ </data>
+ <data name="Argument_FieldDeclaringTypeGeneric" xml:space="preserve">
+ <value>Cannot resolve field {0} because the declaring type of the field handle {1} is generic. Explicitly provide the declaring type to GetFieldFromHandle.</value>
+ </data>
+ <data name="Argument_FieldNeedGenericDeclaringType" xml:space="preserve">
+ <value>The specified field must be declared on a generic type definition.</value>
+ </data>
+ <data name="Argument_GenConstraintViolation" xml:space="preserve">
+ <value>GenericArguments[{0}], '{1}', on '{2}' violates the constraint of type '{3}'.</value>
+ </data>
+ <data name="Argument_GenericArgsCount" xml:space="preserve">
+ <value>The number of generic arguments provided doesn't equal the arity of the generic type definition.</value>
+ </data>
+ <data name="Argument_GenericsInvalid" xml:space="preserve">
+ <value>Generic types are not valid.</value>
+ </data>
+ <data name="Argument_GlobalFunctionHasToBeStatic" xml:space="preserve">
+ <value>Global members must be static.</value>
+ </data>
+ <data name="Argument_HandleLeak" xml:space="preserve">
+ <value>Cannot pass a GCHandle across AppDomains.</value>
+ </data>
+ <data name="Argument_HasToBeArrayClass" xml:space="preserve">
+ <value>Must be an array type.</value>
+ </data>
+ <data name="Argument_IdnBadBidi" xml:space="preserve">
+ <value>Left to right characters may not be mixed with right to left characters in IDN labels.</value>
+ </data>
+ <data name="Argument_IdnBadLabelSize" xml:space="preserve">
+ <value>IDN labels must be between 1 and 63 characters long.</value>
+ </data>
+ <data name="Argument_IdnBadNameSize" xml:space="preserve">
+ <value>IDN names must be between 1 and {0} characters long.</value>
+ </data>
+ <data name="Argument_IdnBadPunycode" xml:space="preserve">
+ <value>Invalid IDN encoded string.</value>
+ </data>
+ <data name="Argument_IdnBadStd3" xml:space="preserve">
+ <value>Label contains character '{0}' not allowed with UseStd3AsciiRules</value>
+ </data>
+ <data name="Argument_IdnIllegalName" xml:space="preserve">
+ <value>Decoded string is not a valid IDN name.</value>
+ </data>
+ <data name="Argument_IllegalEnvVarName" xml:space="preserve">
+ <value>Environment variable name cannot contain equal character.</value>
+ </data>
+ <data name="Argument_IllegalName" xml:space="preserve">
+ <value>Illegal name.</value>
+ </data>
+ <data name="Argument_ImplementIComparable" xml:space="preserve">
+ <value>At least one object must implement IComparable.</value>
+ </data>
+ <data name="Argument_IndexOutOfArrayBounds" xml:space="preserve">
+ <value>The specified index is out of bounds of the specified array.</value>
+ </data>
+ <data name="Argument_InsufficientSpaceToCopyCollection" xml:space="preserve">
+ <value>The specified space is not sufficient to copy the elements from this Collection.</value>
+ </data>
+ <data name="Argument_InterfaceMap" xml:space="preserve">
+ <value>'this' type cannot be an interface itself.</value>
+ </data>
+ <data name="Argument_InvalidAppendMode" xml:space="preserve">
+ <value>Append access can be requested only in write-only mode.</value>
+ </data>
+ <data name="Argument_InvalidArgumentForComparison" xml:space="preserve">
+ <value>Type of argument is not compatible with the generic comparer.</value>
+ </data>
+ <data name="Argument_InvalidArrayLength" xml:space="preserve">
+ <value>Length of the array must be {0}.</value>
+ </data>
+ <data name="Argument_InvalidArrayType" xml:space="preserve">
+ <value>Target array type is not compatible with the type of items in the collection.</value>
+ </data>
+ <data name="Argument_InvalidAssemblyName" xml:space="preserve">
+ <value>Assembly names may not begin with whitespace or contain the characters '/', or '\\' or ':'.</value>
+ </data>
+ <data name="Argument_InvalidCalendar" xml:space="preserve">
+ <value>Not a valid calendar for the given culture.</value>
+ </data>
+ <data name="Argument_InvalidCharSequence" xml:space="preserve">
+ <value>Invalid Unicode code point found at index {0}.</value>
+ </data>
+ <data name="Argument_InvalidCharSequenceNoIndex" xml:space="preserve">
+ <value>String contains invalid Unicode code points.</value>
+ </data>
+ <data name="Argument_InvalidCodePageBytesIndex" xml:space="preserve">
+ <value>Unable to translate bytes {0} at index {1} from specified code page to Unicode.</value>
+ </data>
+ <data name="Argument_InvalidCodePageConversionIndex" xml:space="preserve">
+ <value>Unable to translate Unicode character \\u{0:X4} at index {1} to specified code page.</value>
+ </data>
+ <data name="Argument_InvalidConstructorDeclaringType" xml:space="preserve">
+ <value>The specified constructor must be declared on the generic type definition of the specified type.</value>
+ </data>
+ <data name="Argument_InvalidConstructorInfo" xml:space="preserve">
+ <value>The ConstructorInfo object is not valid.</value>
+ </data>
+ <data name="Argument_InvalidCultureName" xml:space="preserve">
+ <value>Culture name '{0}' is not supported.</value>
+ </data>
+ <data name="Argument_InvalidDateTimeKind" xml:space="preserve">
+ <value>Invalid DateTimeKind value.</value>
+ </data>
+ <data name="Argument_InvalidDateTimeStyles" xml:space="preserve">
+ <value>An undefined DateTimeStyles value is being used.</value>
+ </data>
+ <data name="Argument_InvalidDigitSubstitution" xml:space="preserve">
+ <value>The DigitSubstitution property must be of a valid member of the DigitShapes enumeration. Valid entries include Context, NativeNational or None.</value>
+ </data>
+ <data name="Argument_InvalidEnum" xml:space="preserve">
+ <value>The Enum type should contain one and only one instance field.</value>
+ </data>
+ <data name="Argument_InvalidEnumValue" xml:space="preserve">
+ <value>The value '{0}' is not valid for this usage of the type {1}.</value>
+ </data>
+ <data name="Argument_InvalidFieldDeclaringType" xml:space="preserve">
+ <value>The specified field must be declared on the generic type definition of the specified type.</value>
+ </data>
+ <data name="Argument_InvalidFileModeAndAccessCombo" xml:space="preserve">
+ <value>Combining FileMode: {0} with FileAccess: {1} is invalid.</value>
+ </data>
+ <data name="Argument_InvalidFlag" xml:space="preserve">
+ <value>Value of flags is invalid.</value>
+ </data>
+ <data name="Argument_InvalidGenericArg" xml:space="preserve">
+ <value>The generic type parameter was not valid</value>
+ </data>
+ <data name="Argument_InvalidGenericInstArray" xml:space="preserve">
+ <value>Generic arguments must be provided for each generic parameter and each generic argument must be a RuntimeType.</value>
+ </data>
+ <data name="Argument_InvalidGroupSize" xml:space="preserve">
+ <value>Every element in the value array should be between one and nine, except for the last element, which can be zero.</value>
+ </data>
+ <data name="Argument_InvalidHandle" xml:space="preserve">
+ <value>The handle is invalid.</value>
+ </data>
+ <data name="Argument_InvalidHighSurrogate" xml:space="preserve">
+ <value>Found a high surrogate char without a following low surrogate at index: {0}. The input may not be in this encoding, or may not contain valid Unicode (UTF-16) characters.</value>
+ </data>
+ <data name="Argument_InvalidId" xml:space="preserve">
+ <value>The specified ID parameter '{0}' is not supported.</value>
+ </data>
+ <data name="Argument_InvalidKindOfTypeForCA" xml:space="preserve">
+ <value>This type cannot be represented as a custom attribute.</value>
+ </data>
+ <data name="Argument_InvalidLabel" xml:space="preserve">
+ <value>Invalid Label.</value>
+ </data>
+ <data name="Argument_InvalidLowSurrogate" xml:space="preserve">
+ <value>Found a low surrogate char without a preceding high surrogate at index: {0}. The input may not be in this encoding, or may not contain valid Unicode (UTF-16) characters.</value>
+ </data>
+ <data name="Argument_InvalidMemberForNamedArgument" xml:space="preserve">
+ <value>The member must be either a field or a property.</value>
+ </data>
+ <data name="Argument_InvalidMethodDeclaringType" xml:space="preserve">
+ <value>The specified method must be declared on the generic type definition of the specified type.</value>
+ </data>
+ <data name="Argument_InvalidName" xml:space="preserve">
+ <value>Invalid name.</value>
+ </data>
+ <data name="Argument_InvalidNativeDigitCount" xml:space="preserve">
+ <value>The NativeDigits array must contain exactly ten members.</value>
+ </data>
+ <data name="Argument_InvalidNativeDigitValue" xml:space="preserve">
+ <value>Each member of the NativeDigits array must be a single text element (one or more UTF16 code points) with a Unicode Nd (Number, Decimal Digit) property indicating it is a digit.</value>
+ </data>
+ <data name="Argument_InvalidNeutralRegionName" xml:space="preserve">
+ <value>The region name {0} should not correspond to neutral culture; a specific culture name is required.</value>
+ </data>
+ <data name="Argument_InvalidNormalizationForm" xml:space="preserve">
+ <value>Invalid or unsupported normalization form.</value>
+ </data>
+ <data name="Argument_InvalidNumberStyles" xml:space="preserve">
+ <value>An undefined NumberStyles value is being used.</value>
+ </data>
+ <data name="Argument_InvalidOffLen" xml:space="preserve">
+ <value>Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.</value>
+ </data>
+ <data name="Argument_InvalidOpCodeOnDynamicMethod" xml:space="preserve">
+ <value>Ldtoken, Ldftn and Ldvirtftn OpCodes cannot target DynamicMethods.</value>
+ </data>
+ <data name="Argument_InvalidParameterInfo" xml:space="preserve">
+ <value>The ParameterInfo object is not valid.</value>
+ </data>
+ <data name="Argument_InvalidParamInfo" xml:space="preserve">
+ <value>Invalid type for ParameterInfo member in Attribute class.</value>
+ </data>
+ <data name="Argument_InvalidPathChars" xml:space="preserve">
+ <value>Illegal characters in path.</value>
+ </data>
+ <data name="Argument_InvalidREG_TZI_FORMAT" xml:space="preserve">
+ <value>The REG_TZI_FORMAT structure is corrupt.</value>
+ </data>
+ <data name="Argument_InvalidRegistryViewCheck" xml:space="preserve">
+ <value>The specified RegistryView value is invalid.</value>
+ </data>
+ <data name="Argument_InvalidResourceCultureName" xml:space="preserve">
+ <value>The given culture name '{0}' cannot be used to locate a resource file. Resource filenames must consist of only letters, numbers, hyphens or underscores.</value>
+ </data>
+ <data name="Argument_InvalidSafeBufferOffLen" xml:space="preserve">
+ <value>Offset and length were greater than the size of the SafeBuffer.</value>
+ </data>
+ <data name="Argument_InvalidSeekOrigin" xml:space="preserve">
+ <value>Invalid seek origin.</value>
+ </data>
+ <data name="Argument_InvalidSerializedString" xml:space="preserve">
+ <value>The specified serialized string '{0}' is not supported.</value>
+ </data>
+ <data name="Argument_InvalidTimeSpanStyles" xml:space="preserve">
+ <value>An undefined TimeSpanStyles value is being used.</value>
+ </data>
+ <data name="Argument_InvalidToken" xml:space="preserve">
+ <value>Token {0:x} is not valid in the scope of module {1}.</value>
+ </data>
+ <data name="Argument_InvalidTypeForCA" xml:space="preserve">
+ <value>Cannot build type parameter for custom attribute with a type that does not support the AssemblyQualifiedName property. The type instance supplied was of type '{0}'.</value>
+ </data>
+ <data name="Argument_InvalidTypeForDynamicMethod" xml:space="preserve">
+ <value>Invalid type owner for DynamicMethod.</value>
+ </data>
+ <data name="Argument_InvalidTypeName" xml:space="preserve">
+ <value>The name of the type is invalid.</value>
+ </data>
+ <data name="Argument_InvalidTypeWithPointersNotSupported" xml:space="preserve">
+ <value>Cannot use type '{0}'. Only value types without pointers or references are supported.</value>
+ </data>
+ <data name="Argument_InvalidUnity" xml:space="preserve">
+ <value>Invalid Unity type.</value>
+ </data>
+ <data name="Argument_InvalidValue" xml:space="preserve">
+ <value>Value was invalid.</value>
+ </data>
+ <data name="Argument_LargeInteger" xml:space="preserve">
+ <value>Integer or token was too large to be encoded.</value>
+ </data>
+ <data name="Argument_LongEnvVarValue" xml:space="preserve">
+ <value>Environment variable name or value is too long.</value>
+ </data>
+ <data name="Argument_MethodDeclaringTypeGeneric" xml:space="preserve">
+ <value>Cannot resolve method {0} because the declaring type of the method handle {1} is generic. Explicitly provide the declaring type to GetMethodFromHandle.</value>
+ </data>
+ <data name="Argument_MethodDeclaringTypeGenericLcg" xml:space="preserve">
+ <value>Method '{0}' has a generic declaring type '{1}'. Explicitly provide the declaring type to GetTokenFor.</value>
+ </data>
+ <data name="Argument_MethodNeedGenericDeclaringType" xml:space="preserve">
+ <value>The specified method cannot be dynamic or global and must be declared on a generic type definition.</value>
+ </data>
+ <data name="Argument_MinMaxValue" xml:space="preserve">
+ <value>'{0}' cannot be greater than {1}.</value>
+ </data>
+ <data name="Argument_MismatchedArrays" xml:space="preserve">
+ <value>Two arrays, {0} and {1}, must be of the same size.</value>
+ </data>
+ <data name="Argument_MissingDefaultConstructor" xml:space="preserve">
+ <value>was missing default constructor.</value>
+ </data>
+ <data name="Argument_MustBeFalse" xml:space="preserve">
+ <value>Argument must be initialized to false</value>
+ </data>
+ <data name="Argument_MustBeRuntimeAssembly" xml:space="preserve">
+ <value>Assembly must be a runtime Assembly object.</value>
+ </data>
+ <data name="Argument_MustBeRuntimeFieldInfo" xml:space="preserve">
+ <value>FieldInfo must be a runtime FieldInfo object.</value>
+ </data>
+ <data name="Argument_MustBeRuntimeMethodInfo" xml:space="preserve">
+ <value>MethodInfo must be a runtime MethodInfo object.</value>
+ </data>
+ <data name="Argument_MustBeRuntimeModule" xml:space="preserve">
+ <value>Module must be a runtime Module object.</value>
+ </data>
+ <data name="Argument_MustBeRuntimeReflectionObject" xml:space="preserve">
+ <value>The object must be a runtime Reflection object.</value>
+ </data>
+ <data name="Argument_MustBeRuntimeType" xml:space="preserve">
+ <value>Type must be a runtime Type object.</value>
+ </data>
+ <data name="Argument_MustBeTypeBuilder" xml:space="preserve">
+ <value>'type' must contain a TypeBuilder as a generic argument.</value>
+ </data>
+ <data name="Argument_MustHaveAttributeBaseClass" xml:space="preserve">
+ <value>Type passed in must be derived from System.Attribute or System.Attribute itself.</value>
+ </data>
+ <data name="Argument_MustHaveLayoutOrBeBlittable" xml:space="preserve">
+ <value>The specified structure must be blittable or have layout information.</value>
+ </data>
+ <data name="Argument_NativeOverlappedAlreadyFree" xml:space="preserve">
+ <value>'overlapped' has already been freed.</value>
+ </data>
+ <data name="Argument_NativeOverlappedWrongBoundHandle" xml:space="preserve">
+ <value>'overlapped' was not allocated by this ThreadPoolBoundHandle instance.</value>
+ </data>
+ <data name="Argument_NeedGenericMethodDefinition" xml:space="preserve">
+ <value>Method must represent a generic method definition on a generic type definition.</value>
+ </data>
+ <data name="Argument_NeedNonGenericObject" xml:space="preserve">
+ <value>The specified object must not be an instance of a generic type.</value>
+ </data>
+ <data name="Argument_NeedNonGenericType" xml:space="preserve">
+ <value>The specified Type must not be a generic type definition.</value>
+ </data>
+ <data name="Argument_NeedStructWithNoRefs" xml:space="preserve">
+ <value>The specified Type must be a struct containing no references.</value>
+ </data>
+ <data name="Argument_NeverValidGenericArgument" xml:space="preserve">
+ <value>The type '{0}' may not be used as a type argument.</value>
+ </data>
+ <data name="Argument_NoDomainManager" xml:space="preserve">
+ <value>The domain manager specified by the host could not be instantiated.</value>
+ </data>
+ <data name="Argument_NoEra" xml:space="preserve">
+ <value>No Era was supplied.</value>
+ </data>
+ <data name="Argument_NoModuleFileExtension" xml:space="preserve">
+ <value>Module file name '{0}' must have file extension.</value>
+ </data>
+ <data name="Argument_NoRegionInvariantCulture" xml:space="preserve">
+ <value>There is no region associated with the Invariant Culture (Culture ID: 0x7F).</value>
+ </data>
+ <data name="Argument_NotATP" xml:space="preserve">
+ <value>Type must be a TransparentProxy</value>
+ </data>
+ <data name="Argument_NotAWritableProperty" xml:space="preserve">
+ <value>Not a writable property.</value>
+ </data>
+ <data name="Argument_NotEnoughBytesToRead" xml:space="preserve">
+ <value>There are not enough bytes remaining in the accessor to read at this position.</value>
+ </data>
+ <data name="Argument_NotEnoughBytesToWrite" xml:space="preserve">
+ <value>There are not enough bytes remaining in the accessor to write at this position.</value>
+ </data>
+ <data name="Argument_NotEnoughGenArguments" xml:space="preserve">
+ <value>The type or method has {1} generic parameter(s), but {0} generic argument(s) were provided. A generic argument must be provided for each generic parameter.</value>
+ </data>
+ <data name="Argument_NotExceptionType" xml:space="preserve">
+ <value>Does not extend Exception.</value>
+ </data>
+ <data name="Argument_NotInExceptionBlock" xml:space="preserve">
+ <value>Not currently in an exception block.</value>
+ </data>
+ <data name="Argument_NotMethodCallOpcode" xml:space="preserve">
+ <value>The specified opcode cannot be passed to EmitCall.</value>
+ </data>
+ <data name="Argument_NotSerializable" xml:space="preserve">
+ <value>Argument passed in is not serializable.</value>
+ </data>
+ <data name="Argument_NoUnderlyingCCW" xml:space="preserve">
+ <value>The object has no underlying COM data associated with it.</value>
+ </data>
+ <data name="Argument_NoUninitializedStrings" xml:space="preserve">
+ <value>Uninitialized Strings cannot be created.</value>
+ </data>
+ <data name="Argument_ObjIsWinRTObject" xml:space="preserve">
+ <value>The object's type must not be a Windows Runtime type.</value>
+ </data>
+ <data name="Argument_ObjNotComObject" xml:space="preserve">
+ <value>The object's type must be __ComObject or derived from __ComObject.</value>
+ </data>
+ <data name="Argument_OffsetAndCapacityOutOfBounds" xml:space="preserve">
+ <value>Offset and capacity were greater than the size of the view.</value>
+ </data>
+ <data name="Argument_OffsetAndLengthOutOfBounds" xml:space="preserve">
+ <value>Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.</value>
+ </data>
+ <data name="Argument_OffsetLocalMismatch" xml:space="preserve">
+ <value>The UTC Offset of the local dateTime parameter does not match the offset argument.</value>
+ </data>
+ <data name="Argument_OffsetOfFieldNotFound" xml:space="preserve">
+ <value>Field passed in is not a marshaled member of the type '{0}'.</value>
+ </data>
+ <data name="Argument_OffsetOutOfRange" xml:space="preserve">
+ <value>Offset must be within plus or minus 14 hours.</value>
+ </data>
+ <data name="Argument_OffsetPrecision" xml:space="preserve">
+ <value>Offset must be specified in whole minutes.</value>
+ </data>
+ <data name="Argument_OffsetUtcMismatch" xml:space="preserve">
+ <value>The UTC Offset for Utc DateTime instances must be 0.</value>
+ </data>
+ <data name="Argument_OneOfCulturesNotSupported" xml:space="preserve">
+ <value>Culture name {0} or {1} is not supported.</value>
+ </data>
+ <data name="Argument_OnlyMscorlib" xml:space="preserve">
+ <value>Only mscorlib's assembly is valid.</value>
+ </data>
+ <data name="Argument_OutOfOrderDateTimes" xml:space="preserve">
+ <value>The DateStart property must come before the DateEnd property.</value>
+ </data>
+ <data name="Argument_PathEmpty" xml:space="preserve">
+ <value>Path cannot be the empty string or all whitespace.</value>
+ </data>
+ <data name="Argument_PathFormatNotSupported" xml:space="preserve">
+ <value>The given path's format is not supported.</value>
+ </data>
+ <data name="Argument_PreAllocatedAlreadyAllocated" xml:space="preserve">
+ <value>'preAllocated' is already in use.</value>
+ </data>
+ <data name="Argument_RecursiveFallback" xml:space="preserve">
+ <value>Recursive fallback not allowed for character \\u{0:X4}.</value>
+ </data>
+ <data name="Argument_RecursiveFallbackBytes" xml:space="preserve">
+ <value>Recursive fallback not allowed for bytes {0}.</value>
+ </data>
+ <data name="Argument_RedefinedLabel" xml:space="preserve">
+ <value>Label multiply defined.</value>
+ </data>
+ <data name="Argument_ResolveField" xml:space="preserve">
+ <value>Token {0:x} is not a valid FieldInfo token in the scope of module {1}.</value>
+ </data>
+ <data name="Argument_ResolveFieldHandle" xml:space="preserve">
+ <value>Type handle '{0}' and field handle with declaring type '{1}' are incompatible. Get RuntimeFieldHandle and declaring RuntimeTypeHandle off the same FieldInfo.</value>
+ </data>
+ <data name="Argument_ResolveMember" xml:space="preserve">
+ <value>Token {0:x} is not a valid MemberInfo token in the scope of module {1}.</value>
+ </data>
+ <data name="Argument_ResolveMethod" xml:space="preserve">
+ <value>Token {0:x} is not a valid MethodBase token in the scope of module {1}.</value>
+ </data>
+ <data name="Argument_ResolveMethodHandle" xml:space="preserve">
+ <value>Type handle '{0}' and method handle with declaring type '{1}' are incompatible. Get RuntimeMethodHandle and declaring RuntimeTypeHandle off the same MethodBase.</value>
+ </data>
+ <data name="Argument_ResolveModuleType" xml:space="preserve">
+ <value>Token {0} resolves to the special module type representing this module.</value>
+ </data>
+ <data name="Argument_ResolveString" xml:space="preserve">
+ <value>Token {0:x} is not a valid string token in the scope of module {1}.</value>
+ </data>
+ <data name="Argument_ResolveType" xml:space="preserve">
+ <value>Token {0:x} is not a valid Type token in the scope of module {1}.</value>
+ </data>
+ <data name="Argument_ResultCalendarRange" xml:space="preserve">
+ <value>The result is out of the supported range for this calendar. The result should be between {0} (Gregorian date) and {1} (Gregorian date), inclusive.</value>
+ </data>
+ <data name="Argument_SemaphoreInitialMaximum" xml:space="preserve">
+ <value>The initial count for the semaphore must be greater than or equal to zero and less than the maximum count.</value>
+ </data>
+ <data name="Argument_ShouldNotSpecifyExceptionType" xml:space="preserve">
+ <value>Should not specify exception type for catch clause for filter block.</value>
+ </data>
+ <data name="Argument_ShouldOnlySetVisibilityFlags" xml:space="preserve">
+ <value>Should only set visibility flags when creating EnumBuilder.</value>
+ </data>
+ <data name="Argument_SigIsFinalized" xml:space="preserve">
+ <value>Completed signature cannot be modified.</value>
+ </data>
+ <data name="Argument_StreamNotReadable" xml:space="preserve">
+ <value>Stream was not readable.</value>
+ </data>
+ <data name="Argument_StreamNotWritable" xml:space="preserve">
+ <value>Stream was not writable.</value>
+ </data>
+ <data name="Argument_StringFirstCharIsZero" xml:space="preserve">
+ <value>The first char in the string is the null character.</value>
+ </data>
+ <data name="Argument_StringZeroLength" xml:space="preserve">
+ <value>String cannot be of zero length.</value>
+ </data>
+ <data name="Argument_StructMustNotBeValueClass" xml:space="preserve">
+ <value>The structure must not be a value class.</value>
+ </data>
+ <data name="Argument_TimeSpanHasSeconds" xml:space="preserve">
+ <value>The TimeSpan parameter cannot be specified more precisely than whole minutes.</value>
+ </data>
+ <data name="Argument_TimeZoneInfoBadTZif" xml:space="preserve">
+ <value>The tzfile does not begin with the magic characters 'TZif'. Please verify that the file is not corrupt.</value>
+ </data>
+ <data name="Argument_TimeZoneInfoInvalidTZif" xml:space="preserve">
+ <value>The TZif data structure is corrupt.</value>
+ </data>
+ <data name="Argument_ToExclusiveLessThanFromExclusive" xml:space="preserve">
+ <value>fromInclusive must be less than or equal to toExclusive.</value>
+ </data>
+ <data name="Argument_TooManyFinallyClause" xml:space="preserve">
+ <value>Exception blocks may have at most one finally clause.</value>
+ </data>
+ <data name="Argument_TransitionTimesAreIdentical" xml:space="preserve">
+ <value>The DaylightTransitionStart property must not equal the DaylightTransitionEnd property.</value>
+ </data>
+ <data name="Argument_TypedReferenceInvalidField" xml:space="preserve">
+ <value>Field in TypedReferences cannot be static or init only.</value>
+ </data>
+ <data name="Argument_TypeIsWinRTType" xml:space="preserve">
+ <value>The type must not be a Windows Runtime type.</value>
+ </data>
+ <data name="Argument_TypeMustBeVisibleFromCom" xml:space="preserve">
+ <value>The specified type must be visible from COM.</value>
+ </data>
+ <data name="Argument_TypeMustNotBeComImport" xml:space="preserve">
+ <value>The type must not be imported from COM.</value>
+ </data>
+ <data name="Argument_TypeNameTooLong" xml:space="preserve">
+ <value>Type name was too long. The fully qualified type name must be less than 1,024 characters.</value>
+ </data>
+ <data name="Argument_TypeNotActivatableViaWindowsRuntime" xml:space="preserve">
+ <value>Type '{0}' does not have an activation factory because it is not activatable by Windows Runtime.</value>
+ </data>
+ <data name="Argument_TypeNotComObject" xml:space="preserve">
+ <value>The type must be __ComObject or be derived from __ComObject.</value>
+ </data>
+ <data name="Argument_TypeNotValid" xml:space="preserve">
+ <value>The Type object is not valid.</value>
+ </data>
+ <data name="Argument_UnclosedExceptionBlock" xml:space="preserve">
+ <value>The IL Generator cannot be used while there are unclosed exceptions.</value>
+
+ </data>
+ <data name="Argument_Unexpected_TypeSource" xml:space="preserve">
+ <value>Unexpected TypeKind when marshaling Windows.Foundation.TypeName.</value>
+ </data>
+ <data name="Argument_UnknownUnmanagedCallConv" xml:space="preserve">
+ <value>Unknown unmanaged calling convention for function signature.</value>
+ </data>
+ <data name="Argument_UnmanagedMemAccessorWrapAround" xml:space="preserve">
+ <value>The UnmanagedMemoryAccessor capacity and offset would wrap around the high end of the address space.</value>
+ </data>
+ <data name="Argument_UnmatchedMethodForLocal" xml:space="preserve">
+ <value>Local passed in does not belong to this ILGenerator.</value>
+ </data>
+ <data name="Argument_UnmatchingSymScope" xml:space="preserve">
+ <value>Non-matching symbol scope.</value>
+ </data>
+ <data name="Argument_UnrecognizedLoaderOptimization" xml:space="preserve">
+ <value>Unrecognized LOADER_OPTIMIZATION property value. Supported values may include "SingleDomain", "MultiDomain", "MultiDomainHost", and "NotSpecified".</value>
+ </data>
+ <data name="Argument_UTCOutOfRange" xml:space="preserve">
+ <value>The UTC time represented when the offset is applied must be between year 0 and 10,000.</value>
+ </data>
+ <data name="Argument_VerStringTooLong" xml:space="preserve">
+ <value>The unmanaged Version information is too large to persist.</value>
+ </data>
+ <data name="Argument_WaitHandleNameTooLong" xml:space="preserve">
+ <value>The name can be no more than {0} characters in length.</value>
+ </data>
+ <data name="Argument_WinRTSystemRuntimeType" xml:space="preserve">
+ <value>Cannot marshal type '{0}' to Windows Runtime. Only 'System.RuntimeType' is supported.</value>
+ </data>
+ <data name="ArgumentException_BadMethodImplBody" xml:space="preserve">
+ <value>MethodOverride's body must be from this type.</value>
+ </data>
+ <data name="ArgumentException_BufferNotFromPool" xml:space="preserve">
+ <value>The buffer is not associated with this pool and may not be returned to it.</value>
+ </data>
+ <data name="ArgumentException_OtherNotArrayOfCorrectLength" xml:space="preserve">
+ <value>Object is not a array with the same number of elements as the array to compare it to.</value>
+ </data>
+ <data name="ArgumentException_TupleIncorrectType" xml:space="preserve">
+ <value>Argument must be of type {0}.</value>
+ </data>
+ <data name="ArgumentException_TupleLastArgumentNotATuple" xml:space="preserve">
+ <value>The last element of an eight element tuple must be a Tuple.</value>
+ </data>
+ <data name="ArgumentException_ValueTupleIncorrectType" xml:space="preserve">
+ <value>Argument must be of type {0}.</value>
+ </data>
+ <data name="ArgumentException_ValueTupleLastArgumentNotAValueTuple" xml:space="preserve">
+ <value>The last element of an eight element ValueTuple must be a ValueTuple.</value>
+ </data>
+ <data name="ArgumentNull_Array" xml:space="preserve">
+ <value>Array cannot be null.</value>
+ </data>
+ <data name="ArgumentNull_ArrayElement" xml:space="preserve">
+ <value>At least one element in the specified array was null.</value>
+ </data>
+ <data name="ArgumentNull_ArrayValue" xml:space="preserve">
+ <value>Found a null value within an array.</value>
+ </data>
+ <data name="ArgumentNull_Assembly" xml:space="preserve">
+ <value>Assembly cannot be null.</value>
+ </data>
+ <data name="ArgumentNull_AssemblyName" xml:space="preserve">
+ <value>AssemblyName cannot be null.</value>
+ </data>
+ <data name="ArgumentNull_AssemblyNameName" xml:space="preserve">
+ <value>AssemblyName.Name cannot be null or an empty string.</value>
+ </data>
+ <data name="ArgumentNull_Buffer" xml:space="preserve">
+ <value>Buffer cannot be null.</value>
+ </data>
+ <data name="ArgumentNull_Collection" xml:space="preserve">
+ <value>Collection cannot be null.</value>
+ </data>
+ <data name="ArgumentNull_FileName" xml:space="preserve">
+ <value>File name cannot be null.</value>
+ </data>
+ <data name="ArgumentNull_Generic" xml:space="preserve">
+ <value>Value cannot be null.</value>
+ </data>
+ <data name="ArgumentNull_GUID" xml:space="preserve">
+ <value>GUID cannot be null.</value>
+ </data>
+ <data name="ArgumentNull_Key" xml:space="preserve">
+ <value>Key cannot be null.</value>
+ </data>
+ <data name="ArgumentNull_Obj" xml:space="preserve">
+ <value>Object cannot be null.</value>
+ </data>
+ <data name="ArgumentNull_Path" xml:space="preserve">
+ <value>Path cannot be null.</value>
+ </data>
+ <data name="ArgumentNull_SafeHandle" xml:space="preserve">
+ <value>SafeHandle cannot be null.</value>
+ </data>
+ <data name="ArgumentNull_Stream" xml:space="preserve">
+ <value>Stream cannot be null.</value>
+ </data>
+ <data name="ArgumentNull_String" xml:space="preserve">
+ <value>String reference not set to an instance of a String.</value>
+ </data>
+ <data name="ArgumentNull_Type" xml:space="preserve">
+ <value>Type cannot be null.</value>
+ </data>
+ <data name="ArgumentNull_TypedRefType" xml:space="preserve">
+ <value>Type in TypedReference cannot be null.</value>
+ </data>
+ <data name="ArgumentNull_Waithandles" xml:space="preserve">
+ <value>The waitHandles parameter cannot be null.</value>
+ </data>
+ <data name="ArgumentNull_WithParamName" xml:space="preserve">
+ <value>Parameter '{0}' cannot be null.</value>
+ </data>
+ <data name="ArgumentOutOfRange_ActualValue" xml:space="preserve">
+ <value>Actual value was {0}.</value>
+ </data>
+ <data name="ArgumentOutOfRange_AddressSpace" xml:space="preserve">
+ <value>The number of bytes cannot exceed the virtual address space on a 32 bit machine.</value>
+ </data>
+ <data name="ArgumentOutOfRange_AddValue" xml:space="preserve">
+ <value>Value to add was out of range.</value>
+ </data>
+ <data name="ArgumentOutOfRange_ArrayLB" xml:space="preserve">
+ <value>Number was less than the array's lower bound in the first dimension.</value>
+ </data>
+ <data name="ArgumentOutOfRange_ArrayLBAndLength" xml:space="preserve">
+ <value>Higher indices will exceed Int32.MaxValue because of large lower bound and/or length.</value>
+ </data>
+ <data name="ArgumentOutOfRange_ArrayListInsert" xml:space="preserve">
+ <value>Insertion index was out of range. Must be non-negative and less than or equal to size.</value>
+ </data>
+ <data name="ArgumentOutOfRange_BadHourMinuteSecond" xml:space="preserve">
+ <value>Hour, Minute, and Second parameters describe an un-representable DateTime.</value>
+ </data>
+ <data name="ArgumentOutOfRange_BadYearMonthDay" xml:space="preserve">
+ <value>Year, Month, and Day parameters describe an un-representable DateTime.</value>
+ </data>
+ <data name="ArgumentOutOfRange_BiggerThanCollection" xml:space="preserve">
+ <value>Larger than collection size.</value>
+ </data>
+ <data name="ArgumentOutOfRange_BinaryReaderFillBuffer" xml:space="preserve">
+ <value>The number of bytes requested does not fit into BinaryReader's internal buffer.</value>
+ </data>
+ <data name="ArgumentOutOfRange_Bounds_Lower_Upper" xml:space="preserve">
+ <value>Argument must be between {0} and {1}.</value>
+ </data>
+ <data name="ArgumentOutOfRange_CalendarRange" xml:space="preserve">
+ <value>Specified time is not supported in this calendar. It should be between {0} (Gregorian date) and {1} (Gregorian date), inclusive.</value>
+ </data>
+ <data name="ArgumentOutOfRange_Capacity" xml:space="preserve">
+ <value>Capacity exceeds maximum capacity.</value>
+ </data>
+ <data name="ArgumentOutOfRange_Count" xml:space="preserve">
+ <value>Count must be positive and count must refer to a location within the string/array/collection.</value>
+ </data>
+ <data name="ArgumentOutOfRange_DateArithmetic" xml:space="preserve">
+ <value>The added or subtracted value results in an un-representable DateTime.</value>
+ </data>
+ <data name="ArgumentOutOfRange_DateTimeBadMonths" xml:space="preserve">
+ <value>Months value must be between +/-120000.</value>
+ </data>
+ <data name="ArgumentOutOfRange_DateTimeBadTicks" xml:space="preserve">
+ <value>Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.</value>
+ </data>
+ <data name="ArgumentOutOfRange_DateTimeBadYears" xml:space="preserve">
+ <value>Years value must be between +/-10000.</value>
+ </data>
+ <data name="ArgumentOutOfRange_Day" xml:space="preserve">
+ <value>Day must be between 1 and {0} for month {1}.</value>
+ </data>
+ <data name="ArgumentOutOfRange_DayOfWeek" xml:space="preserve">
+ <value>The DayOfWeek enumeration must be in the range 0 through 6.</value>
+ </data>
+ <data name="ArgumentOutOfRange_DayParam" xml:space="preserve">
+ <value>The Day parameter must be in the range 1 through 31.</value>
+ </data>
+ <data name="ArgumentOutOfRange_DecimalRound" xml:space="preserve">
+ <value>Decimal can only round to between 0 and 28 digits of precision.</value>
+ </data>
+ <data name="ArgumentOutOfRange_DecimalScale" xml:space="preserve">
+ <value>Decimal's scale value must be between 0 and 28, inclusive.</value>
+ </data>
+ <data name="ArgumentOutOfRange_EndIndexStartIndex" xml:space="preserve">
+ <value>endIndex cannot be greater than startIndex.</value>
+ </data>
+ <data name="ArgumentOutOfRange_Enum" xml:space="preserve">
+ <value>Enum value was out of legal range.</value>
+ </data>
+ <data name="ArgumentOutOfRange_Era" xml:space="preserve">
+ <value>Time value was out of era range.</value>
+ </data>
+ <data name="ArgumentOutOfRange_FileLengthTooBig" xml:space="preserve">
+ <value>Specified file length was too large for the file system.</value>
+ </data>
+ <data name="ArgumentOutOfRange_FileTimeInvalid" xml:space="preserve">
+ <value>Not a valid Win32 FileTime.</value>
+ </data>
+ <data name="ArgumentOutOfRange_GenericPositive" xml:space="preserve">
+ <value>Value must be positive.</value>
+ </data>
+ <data name="ArgumentOutOfRange_GetByteCountOverflow" xml:space="preserve">
+ <value>Too many characters. The resulting number of bytes is larger than what can be returned as an int.</value>
+ </data>
+ <data name="ArgumentOutOfRange_GetCharCountOverflow" xml:space="preserve">
+ <value>Too many bytes. The resulting number of chars is larger than what can be returned as an int.</value>
+ </data>
+ <data name="ArgumentOutOfRange_HashtableLoadFactor" xml:space="preserve">
+ <value>Load factor needs to be between 0.1 and 1.0.</value>
+ </data>
+ <data name="ArgumentOutOfRange_HugeArrayNotSupported" xml:space="preserve">
+ <value>Arrays larger than 2GB are not supported.</value>
+ </data>
+ <data name="ArgumentOutOfRange_Index" xml:space="preserve">
+ <value>Index was out of range. Must be non-negative and less than the size of the collection.</value>
+ </data>
+ <data name="ArgumentOutOfRange_IndexCount" xml:space="preserve">
+ <value>Index and count must refer to a location within the string.</value>
+ </data>
+ <data name="ArgumentOutOfRange_IndexCountBuffer" xml:space="preserve">
+ <value>Index and count must refer to a location within the buffer.</value>
+ </data>
+ <data name="ArgumentOutOfRange_IndexLargerThanMaxValue" xml:space="preserve">
+ <value>This collection cannot work with indices larger than Int32.MaxValue - 1 (0x7FFFFFFF - 1).</value>
+ </data>
+ <data name="ArgumentOutOfRange_IndexLength" xml:space="preserve">
+ <value>Index and length must refer to a location within the string.</value>
+ </data>
+ <data name="ArgumentOutOfRange_IndexString" xml:space="preserve">
+ <value>Index was out of range. Must be non-negative and less than the length of the string.</value>
+ </data>
+ <data name="ArgumentOutOfRange_InvalidEraValue" xml:space="preserve">
+ <value>Era value was not valid.</value>
+ </data>
+ <data name="ArgumentOutOfRange_InvalidHighSurrogate" xml:space="preserve">
+ <value>A valid high surrogate character is between 0xd800 and 0xdbff, inclusive.</value>
+ </data>
+ <data name="ArgumentOutOfRange_InvalidLowSurrogate" xml:space="preserve">
+ <value>A valid low surrogate character is between 0xdc00 and 0xdfff, inclusive.</value>
+ </data>
+ <data name="ArgumentOutOfRange_InvalidUTF32" xml:space="preserve">
+ <value>A valid UTF32 value is between 0x000000 and 0x10ffff, inclusive, and should not include surrogate codepoint values (0x00d800 ~ 0x00dfff).</value>
+ </data>
+ <data name="ArgumentOutOfRange_Length" xml:space="preserve">
+ <value>The specified length exceeds maximum capacity of SecureString.</value>
+ </data>
+ <data name="ArgumentOutOfRange_LengthGreaterThanCapacity" xml:space="preserve">
+ <value>The length cannot be greater than the capacity.</value>
+ </data>
+ <data name="ArgumentOutOfRange_LengthTooLarge" xml:space="preserve">
+ <value>The specified length exceeds the maximum value of {0}.</value>
+ </data>
+ <data name="ArgumentOutOfRange_LessEqualToIntegerMaxVal" xml:space="preserve">
+ <value>Argument must be less than or equal to 2^31 - 1 milliseconds.</value>
+ </data>
+ <data name="ArgumentOutOfRange_ListInsert" xml:space="preserve">
+ <value>Index must be within the bounds of the List.</value>
+ </data>
+ <data name="ArgumentOutOfRange_Month" xml:space="preserve">
+ <value>Month must be between one and twelve.</value>
+ </data>
+ <data name="ArgumentOutOfRange_MonthParam" xml:space="preserve">
+ <value>The Month parameter must be in the range 1 through 12.</value>
+ </data>
+ <data name="ArgumentOutOfRange_MustBeNonNegInt32" xml:space="preserve">
+ <value>Value must be non-negative and less than or equal to Int32.MaxValue.</value>
+ </data>
+ <data name="ArgumentOutOfRange_MustBeNonNegNum" xml:space="preserve">
+ <value>'{0}' must be non-negative.</value>
+ </data>
+ <data name="ArgumentOutOfRange_MustBePositive" xml:space="preserve">
+ <value>'{0}' must be greater than zero.</value>
+ </data>
+ <data name="ArgumentOutOfRange_NeedNonNegNum" xml:space="preserve">
+ <value>Non-negative number required.</value>
+ </data>
+ <data name="ArgumentOutOfRange_NeedNonNegOrNegative1" xml:space="preserve">
+ <value>Number must be either non-negative and less than or equal to Int32.MaxValue or -1.</value>
+ </data>
+ <data name="ArgumentOutOfRange_NeedPosNum" xml:space="preserve">
+ <value>Positive number required.</value>
+ </data>
+ <data name="ArgumentOutOfRange_NeedValidId" xml:space="preserve">
+ <value>The ID parameter must be in the range {0} through {1}.</value>
+ </data>
+ <data name="ArgumentOutOfRange_NegativeCapacity" xml:space="preserve">
+ <value>Capacity must be positive.</value>
+ </data>
+ <data name="ArgumentOutOfRange_NegativeCount" xml:space="preserve">
+ <value>Count cannot be less than zero.</value>
+ </data>
+ <data name="ArgumentOutOfRange_NegativeLength" xml:space="preserve">
+ <value>Length cannot be less than zero.</value>
+ </data>
+ <data name="ArgumentOutOfRange_OffsetLength" xml:space="preserve">
+ <value>Offset and length must refer to a position in the string.</value>
+ </data>
+ <data name="ArgumentOutOfRange_OffsetOut" xml:space="preserve">
+ <value>Either offset did not refer to a position in the string, or there is an insufficient length of destination character array.</value>
+ </data>
+ <data name="ArgumentOutOfRange_ParamSequence" xml:space="preserve">
+ <value>The specified parameter index is not in range.</value>
+ </data>
+ <data name="ArgumentOutOfRange_PartialWCHAR" xml:space="preserve">
+ <value>Pointer startIndex and length do not refer to a valid string.</value>
+ </data>
+ <data name="ArgumentOutOfRange_PeriodTooLarge" xml:space="preserve">
+ <value>Period must be less than 2^32-2.</value>
+ </data>
+ <data name="ArgumentOutOfRange_PositionLessThanCapacityRequired" xml:space="preserve">
+ <value>The position may not be greater or equal to the capacity of the accessor.</value>
+ </data>
+ <data name="ArgumentOutOfRange_Range" xml:space="preserve">
+ <value>Valid values are between {0} and {1}, inclusive.</value>
+ </data>
+ <data name="ArgumentOutOfRange_RoundingDigits" xml:space="preserve">
+ <value>Rounding digits must be between 0 and 15, inclusive.</value>
+ </data>
+ <data name="ArgumentOutOfRange_SmallCapacity" xml:space="preserve">
+ <value>capacity was less than the current size.</value>
+ </data>
+ <data name="ArgumentOutOfRange_SmallMaxCapacity" xml:space="preserve">
+ <value>MaxCapacity must be one or greater.</value>
+ </data>
+ <data name="ArgumentOutOfRange_StartIndex" xml:space="preserve">
+ <value>StartIndex cannot be less than zero.</value>
+ </data>
+ <data name="ArgumentOutOfRange_StartIndexLargerThanLength" xml:space="preserve">
+ <value>startIndex cannot be larger than length of string.</value>
+ </data>
+ <data name="ArgumentOutOfRange_StartIndexLessThanLength" xml:space="preserve">
+ <value>startIndex must be less than length of string.</value>
+ </data>
+ <data name="ArgumentOutOfRange_StreamLength" xml:space="preserve">
+ <value>Stream length must be non-negative and less than 2^31 - 1 - origin.</value>
+ </data>
+ <data name="ArgumentOutOfRange_TimeoutTooLarge" xml:space="preserve">
+ <value>Time-out interval must be less than 2^32-2.</value>
+ </data>
+ <data name="ArgumentOutOfRange_UIntPtrMax" xml:space="preserve">
+ <value>The length of the buffer must be less than the maximum UIntPtr value for your platform.</value>
+ </data>
+ <data name="ArgumentOutOfRange_UnmanagedMemStreamLength" xml:space="preserve">
+ <value>UnmanagedMemoryStream length must be non-negative and less than 2^63 - 1 - baseAddress.</value>
+ </data>
+ <data name="ArgumentOutOfRange_UnmanagedMemStreamWrapAround" xml:space="preserve">
+ <value>The UnmanagedMemoryStream capacity would wrap around the high end of the address space.</value>
+ </data>
+ <data name="ArgumentOutOfRange_UtcOffset" xml:space="preserve">
+ <value>The TimeSpan parameter must be within plus or minus 14.0 hours.</value>
+ </data>
+ <data name="ArgumentOutOfRange_UtcOffsetAndDaylightDelta" xml:space="preserve">
+ <value>The sum of the BaseUtcOffset and DaylightDelta properties must within plus or minus 14.0 hours.</value>
+ </data>
+ <data name="ArgumentOutOfRange_Version" xml:space="preserve">
+ <value>Version's parameters must be greater than or equal to zero.</value>
+ </data>
+ <data name="ArgumentOutOfRange_Week" xml:space="preserve">
+ <value>The Week parameter must be in the range 1 through 5.</value>
+ </data>
+ <data name="ArgumentOutOfRange_Year" xml:space="preserve">
+ <value>Year must be between 1 and 9999.</value>
+ </data>
+ <data name="Arithmetic_NaN" xml:space="preserve">
+ <value>Function does not accept floating point Not-a-Number values.</value>
+ </data>
+ <data name="ArrayTypeMismatch_CantAssignType" xml:space="preserve">
+ <value>Source array type cannot be assigned to destination array type.</value>
+ </data>
+ <data name="ArrayTypeMismatch_ConstrainedCopy" xml:space="preserve">
+ <value>Array.ConstrainedCopy will only work on array types that are provably compatible, without any form of boxing, unboxing, widening, or casting of each array element. Change the array types (i.e., copy a Derived[] to a Base[]), or use a mitigation strategy in the CER for Array.Copy's less powerful reliability contract, such as cloning the array or throwing away the potentially corrupt destination array.</value>
+ </data>
+ <data name="Arugment_EmitMixedContext1" xml:space="preserve">
+ <value>Type '{0}' was loaded in the ReflectionOnly context but the AssemblyBuilder was not created as AssemblyBuilderAccess.ReflectionOnly.</value>
+ </data>
+ <data name="Arugment_EmitMixedContext2" xml:space="preserve">
+ <value>Type '{0}' was not loaded in the ReflectionOnly context but the AssemblyBuilder was created as AssemblyBuilderAccess.ReflectionOnly.</value>
+ </data>
+ <data name="AssertionFailed" xml:space="preserve">
+ <value>Assertion failed.</value>
+ </data>
+ <data name="AssertionFailed_Cnd" xml:space="preserve">
+ <value>Assertion failed: {0}</value>
+ </data>
+ <data name="AssumptionFailed" xml:space="preserve">
+ <value>Assumption failed.</value>
+ </data>
+ <data name="AssumptionFailed_Cnd" xml:space="preserve">
+ <value>Assumption failed: {0}</value>
+ </data>
+ <data name="AsyncMethodBuilder_InstanceNotInitialized" xml:space="preserve">
+ <value>The builder was not properly initialized.</value>
+ </data>
+ <data name="BadImageFormat_BadILFormat" xml:space="preserve">
+ <value>Bad IL format.</value>
+ </data>
+ <data name="BadImageFormat_InvalidType" xml:space="preserve">
+ <value>Corrupt .resources file. The specified type doesn't exist.</value>
+ </data>
+ <data name="BadImageFormat_NegativeStringLength" xml:space="preserve">
+ <value>Corrupt .resources file. String length must be non-negative.</value>
+ </data>
+ <data name="BadImageFormat_ParameterSignatureMismatch" xml:space="preserve">
+ <value>The parameters and the signature of the method don't match.</value>
+ </data>
+ <data name="BadImageFormat_ResourceDataLengthInvalid" xml:space="preserve">
+ <value>Corrupt .resources file. The specified data length '{0}' is not a valid position in the stream.</value>
+ </data>
+ <data name="BadImageFormat_ResourceNameCorrupted" xml:space="preserve">
+ <value>Corrupt .resources file. A resource name extends past the end of the stream.</value>
+ </data>
+ <data name="BadImageFormat_ResourceNameCorrupted_NameIndex" xml:space="preserve">
+ <value>Corrupt .resources file. The resource name for name index {0} extends past the end of the stream.</value>
+ </data>
+ <data name="BadImageFormat_ResourcesDataInvalidOffset" xml:space="preserve">
+ <value>Corrupt .resources file. Invalid offset '{0}' into data section.</value>
+ </data>
+ <data name="BadImageFormat_ResourcesHeaderCorrupted" xml:space="preserve">
+ <value>Corrupt .resources file. Unable to read resources from this file because of invalid header information. Try regenerating the .resources file.</value>
+ </data>
+ <data name="BadImageFormat_ResourcesIndexTooLong" xml:space="preserve">
+ <value>Corrupt .resources file. String for name index '{0}' extends past the end of the file.</value>
+ </data>
+ <data name="BadImageFormat_ResourcesNameInvalidOffset" xml:space="preserve">
+ <value>Corrupt .resources file. Invalid offset '{0}' into name section.</value>
+ </data>
+ <data name="BadImageFormat_ResourcesNameTooLong" xml:space="preserve">
+ <value>Corrupt .resources file. Resource name extends past the end of the file.</value>
+ </data>
+ <data name="BadImageFormat_TypeMismatch" xml:space="preserve">
+ <value>Corrupt .resources file. The specified type doesn't match the available data in the stream.</value>
+ </data>
+ <data name="CancellationToken_CreateLinkedToken_TokensIsEmpty" xml:space="preserve">
+ <value>No tokens were supplied.</value>
+ </data>
+ <data name="CancellationToken_SourceDisposed" xml:space="preserve">
+ <value>The CancellationTokenSource associated with this CancellationToken has been disposed.</value>
+ </data>
+ <data name="CancellationTokenSource_Disposed" xml:space="preserve">
+ <value>The CancellationTokenSource has been disposed.</value>
+ </data>
+ <data name="ConcurrentCollection_SyncRoot_NotSupported" xml:space="preserve">
+ <value>The SyncRoot property may not be used for the synchronization of concurrent collections.</value>
+ </data>
+ <data name="ConcurrentDictionary_ArrayIncorrectType" xml:space="preserve">
+ <value>The array is multidimensional, or the type parameter for the set cannot be cast automatically to the type of the destination array.</value>
+ </data>
+ <data name="ConcurrentDictionary_ArrayNotLargeEnough" xml:space="preserve">
+ <value>The index is equal to or greater than the length of the array, or the number of elements in the dictionary is greater than the available space from index to the end of the destination array.</value>
+ </data>
+ <data name="ConcurrentDictionary_CapacityMustNotBeNegative" xml:space="preserve">
+ <value>The capacity argument must be greater than or equal to zero.</value>
+ </data>
+ <data name="ConcurrentDictionary_ConcurrencyLevelMustBePositive" xml:space="preserve">
+ <value>The concurrencyLevel argument must be positive.</value>
+ </data>
+ <data name="ConcurrentDictionary_IndexIsNegative" xml:space="preserve">
+ <value>The index argument is less than zero.</value>
+ </data>
+ <data name="ConcurrentDictionary_ItemKeyIsNull" xml:space="preserve">
+ <value>TKey is a reference type and item.Key is null.</value>
+ </data>
+ <data name="ConcurrentDictionary_KeyAlreadyExisted" xml:space="preserve">
+ <value>The key already existed in the dictionary.</value>
+ </data>
+ <data name="ConcurrentDictionary_TypeOfKeyIncorrect" xml:space="preserve">
+ <value>The key was of an incorrect type for this dictionary.</value>
+ </data>
+ <data name="ConcurrentDictionary_TypeOfValueIncorrect" xml:space="preserve">
+ <value>The value was of an incorrect type for this dictionary.</value>
+ </data>
+ <data name="event_Barrier_PhaseFinished" xml:space="preserve">
+ <value>Barrier finishing phase {1}.</value>
+ </data>
+ <data name="event_ConcurrentBag_TryPeekSteals" xml:space="preserve">
+ <value>ConcurrentBag stealing in TryPeek.</value>
+ </data>
+ <data name="event_ConcurrentBag_TryTakeSteals" xml:space="preserve">
+ <value>ConcurrentBag stealing in TryTake.</value>
+ </data>
+ <data name="event_ConcurrentDictionary_AcquiringAllLocks" xml:space="preserve">
+ <value>ConcurrentDictionary acquiring all locks on {0} bucket(s).</value>
+ </data>
+ <data name="event_ConcurrentStack_FastPopFailed" xml:space="preserve">
+ <value>Pop from ConcurrentStack spun {0} time(s).</value>
+ </data>
+ <data name="event_ConcurrentStack_FastPushFailed" xml:space="preserve">
+ <value>Push to ConcurrentStack spun {0} time(s).</value>
+ </data>
+ <data name="event_ParallelFork" xml:space="preserve">
+ <value>Task {1} entering fork/join {2}.</value>
+ </data>
+ <data name="event_ParallelInvokeBegin" xml:space="preserve">
+ <value>Beginning ParallelInvoke {2} from Task {1} for {4} actions.</value>
+ </data>
+ <data name="event_ParallelInvokeEnd" xml:space="preserve">
+ <value>Ending ParallelInvoke {2}.</value>
+ </data>
+ <data name="event_ParallelJoin" xml:space="preserve">
+ <value>Task {1} leaving fork/join {2}.</value>
+ </data>
+ <data name="event_ParallelLoopBegin" xml:space="preserve">
+ <value>Beginning {3} loop {2} from Task {1}.</value>
+ </data>
+ <data name="event_ParallelLoopEnd" xml:space="preserve">
+ <value>Ending loop {2} after {3} iterations.</value>
+ </data>
+ <data name="event_SpinLock_FastPathFailed" xml:space="preserve">
+ <value>SpinLock beginning to spin.</value>
+ </data>
+ <data name="event_SpinWait_NextSpinWillYield" xml:space="preserve">
+ <value>Next spin will yield.</value>
+ </data>
+ <data name="event_TaskCompleted" xml:space="preserve">
+ <value>Task {2} completed.</value>
+ </data>
+ <data name="event_TaskScheduled" xml:space="preserve">
+ <value>Task {2} scheduled to TaskScheduler {0}.</value>
+ </data>
+ <data name="event_TaskStarted" xml:space="preserve">
+ <value>Task {2} executing.</value>
+ </data>
+ <data name="event_TaskWaitBegin" xml:space="preserve">
+ <value>Beginning wait ({3}) on Task {2}.</value>
+ </data>
+ <data name="event_TaskWaitEnd" xml:space="preserve">
+ <value>Ending wait on Task {2}.</value>
+ </data>
+ <data name="EventSource_AbstractMustNotDeclareEventMethods" xml:space="preserve">
+ <value>Abstract event source must not declare event methods ({0} with ID {1}).</value>
+ </data>
+ <data name="EventSource_AbstractMustNotDeclareKTOC" xml:space="preserve">
+ <value>Abstract event source must not declare {0} nested type.</value>
+ </data>
+ <data name="EventSource_AddScalarOutOfRange" xml:space="preserve">
+ <value>Getting out of bounds during scalar addition.</value>
+ </data>
+ <data name="EventSource_ChannelTypeDoesNotMatchEventChannelValue" xml:space="preserve">
+ <value>Channel {0} does not match event channel value {1}.</value>
+ </data>
+ <data name="EventSource_DataDescriptorsOutOfRange" xml:space="preserve">
+ <value>Data descriptors are out of range.</value>
+ </data>
+ <data name="EventSource_DuplicateStringKey" xml:space="preserve">
+ <value>Multiple definitions for string "{0}".</value>
+ </data>
+ <data name="EventSource_EnumKindMismatch" xml:space="preserve">
+ <value>The type of {0} is not expected in {1}.</value>
+ </data>
+ <data name="EventSource_EventChannelOutOfRange" xml:space="preserve">
+ <value>Channel {0} has a value of {1} which is outside the legal range (16-254).</value>
+ </data>
+ <data name="EventSource_EventIdReused" xml:space="preserve">
+ <value>Event {0} has ID {1} which is already in use.</value>
+ </data>
+ <data name="EventSource_EventMustHaveTaskIfNonDefaultOpcode" xml:space="preserve">
+ <value>Event {0} (with ID {1}) has a non-default opcode but not a task.</value>
+ </data>
+ <data name="EventSource_EventMustNotBeExplicitImplementation" xml:space="preserve">
+ <value>Event method {0} (with ID {1}) is an explicit interface method implementation. Re-write method as implicit implementation.</value>
+ </data>
+ <data name="EventSource_EventNameDoesNotEqualTaskPlusOpcode" xml:space="preserve">
+ <value>Event {0} (with ID {1}) has a name that is not the concatenation of its task name and opcode.</value>
+ </data>
+ <data name="EventSource_EventNameReused" xml:space="preserve">
+ <value>Event name {0} used more than once. If you wish to overload a method, the overloaded method should have a NonEvent attribute.</value>
+ </data>
+ <data name="EventSource_EventParametersMismatch" xml:space="preserve">
+ <value>Event {0} was called with {1} argument(s), but it is defined with {2} parameter(s).</value>
+ </data>
+ <data name="EventSource_EventSourceGuidInUse" xml:space="preserve">
+ <value>An instance of EventSource with Guid {0} already exists.</value>
+ </data>
+ <data name="EventSource_EventWithAdminChannelMustHaveMessage" xml:space="preserve">
+ <value>Event {0} specifies an Admin channel {1}. It must specify a Message property.</value>
+ </data>
+ <data name="EventSource_IllegalKeywordsValue" xml:space="preserve">
+ <value>Keyword {0} has a value of {1} which is outside the legal range (0-0x0000080000000000).</value>
+ </data>
+ <data name="EventSource_IllegalOpcodeValue" xml:space="preserve">
+ <value>Opcode {0} has a value of {1} which is outside the legal range (11-238).</value>
+ </data>
+ <data name="EventSource_IllegalTaskValue" xml:space="preserve">
+ <value>Task {0} has a value of {1} which is outside the legal range (1-65535).</value>
+ </data>
+ <data name="EventSource_IncorrentlyAuthoredTypeInfo" xml:space="preserve">
+ <value>Incorrectly-authored TypeInfo - a type should be serialized as one field or as one group</value>
+ </data>
+ <data name="EventSource_InvalidCommand" xml:space="preserve">
+ <value>Invalid command value.</value>
+ </data>
+ <data name="EventSource_InvalidEventFormat" xml:space="preserve">
+ <value>Can't specify both etw event format flags.</value>
+ </data>
+ <data name="EventSource_KeywordCollision" xml:space="preserve">
+ <value>Keywords {0} and {1} are defined with the same value ({2}).</value>
+ </data>
+ <data name="EventSource_KeywordNeedPowerOfTwo" xml:space="preserve">
+ <value>Value {0} for keyword {1} needs to be a power of 2.</value>
+ </data>
+ <data name="EventSource_ListenerCreatedInsideCallback" xml:space="preserve">
+ <value>Creating an EventListener inside a EventListener callback.</value>
+ </data>
+ <data name="EventSource_ListenerNotFound" xml:space="preserve">
+ <value>Listener not found.</value>
+ </data>
+ <data name="EventSource_ListenerWriteFailure" xml:space="preserve">
+ <value>An error occurred when writing to a listener.</value>
+ </data>
+ <data name="EventSource_MaxChannelExceeded" xml:space="preserve">
+ <value>Attempt to define more than the maximum limit of 8 channels for a provider.</value>
+ </data>
+ <data name="EventSource_MismatchIdToWriteEvent" xml:space="preserve">
+ <value>Event {0} is givien event ID {1} but {2} was passed to WriteEvent.</value>
+ </data>
+ <data name="EventSource_NeedGuid" xml:space="preserve">
+ <value>The Guid of an EventSource must be non zero.</value>
+ </data>
+ <data name="EventSource_NeedName" xml:space="preserve">
+ <value>The name of an EventSource must not be null.</value>
+ </data>
+ <data name="EventSource_NeedPositiveId" xml:space="preserve">
+ <value>Event IDs must be positive integers.</value>
+ </data>
+ <data name="EventSource_NoFreeBuffers" xml:space="preserve">
+ <value>No Free Buffers available from the operating system (e.g. event rate too fast).</value>
+ </data>
+ <data name="EventSource_NonCompliantTypeError" xml:space="preserve">
+ <value>The API supports only anonymous types or types decorated with the EventDataAttribute. Non-compliant type: {0} dataType.</value>
+ </data>
+ <data name="EventSource_NoRelatedActivityId" xml:space="preserve">
+ <value>EventSource expects the first parameter of the Event method to be of type Guid and to be named "relatedActivityId" when calling WriteEventWithRelatedActivityId.</value>
+ </data>
+ <data name="EventSource_NotSupportedArrayOfBinary" xml:space="preserve">
+ <value>Arrays of Binary are not supported.</value>
+ </data>
+ <data name="EventSource_NotSupportedArrayOfNil" xml:space="preserve">
+ <value>Arrays of Nil are not supported.</value>
+ </data>
+ <data name="EventSource_NotSupportedArrayOfNullTerminatedString" xml:space="preserve">
+ <value>Arrays of null-terminated string are not supported.</value>
+ </data>
+ <data name="EventSource_NotSupportedCustomSerializedData" xml:space="preserve">
+ <value>Enumerables of custom-serialized data are not supported</value>
+ </data>
+ <data name="EventSource_NotSupportedNestedArraysEnums" xml:space="preserve">
+ <value>Nested arrays/enumerables are not supported.</value>
+ </data>
+ <data name="EventSource_NullInput" xml:space="preserve">
+ <value>Null passed as a event argument.</value>
+ </data>
+ <data name="EventSource_OpcodeCollision" xml:space="preserve">
+ <value>Opcodes {0} and {1} are defined with the same value ({2}).</value>
+ </data>
+ <data name="EventSource_PinArrayOutOfRange" xml:space="preserve">
+ <value>Pins are out of range.</value>
+ </data>
+ <data name="EventSource_RecursiveTypeDefinition" xml:space="preserve">
+ <value>Recursive type definition is not supported.</value>
+ </data>
+ <data name="EventSource_SessionIdError" xml:space="preserve">
+ <value>Bit position in AllKeywords ({0}) must equal the command argument named "EtwSessionKeyword" ({1}).</value>
+ </data>
+ <data name="EventSource_StopsFollowStarts" xml:space="preserve">
+ <value>An event with stop suffix must follow a corresponding event with a start suffix.</value>
+ </data>
+ <data name="EventSource_TaskCollision" xml:space="preserve">
+ <value>Tasks {0} and {1} are defined with the same value ({2}).</value>
+ </data>
+ <data name="EventSource_TaskOpcodePairReused" xml:space="preserve">
+ <value>Event {0} (with ID {1}) has the same task/opcode pair as event {2} (with ID {3}).</value>
+ </data>
+ <data name="EventSource_TooManyArgs" xml:space="preserve">
+ <value>Too many arguments.</value>
+ </data>
+ <data name="EventSource_TooManyFields" xml:space="preserve">
+ <value>Too many fields in structure.</value>
+ </data>
+ <data name="EventSource_ToString" xml:space="preserve">
+ <value>EventSource({0}, {1})</value>
+ </data>
+ <data name="EventSource_TypeMustBeSealedOrAbstract" xml:space="preserve">
+ <value>Event source types must be sealed or abstract.</value>
+ </data>
+ <data name="EventSource_TypeMustDeriveFromEventSource" xml:space="preserve">
+ <value>Event source types must derive from EventSource.</value>
+ </data>
+ <data name="EventSource_UndefinedChannel" xml:space="preserve">
+ <value>Use of undefined channel value {0} for event {1}.</value>
+ </data>
+ <data name="EventSource_UndefinedKeyword" xml:space="preserve">
+ <value>Use of undefined keyword value {0} for event {1}.</value>
+ </data>
+ <data name="EventSource_UndefinedOpcode" xml:space="preserve">
+ <value>Use of undefined opcode value {0} for event {1}.</value>
+ </data>
+ <data name="EventSource_UnsupportedEventTypeInManifest" xml:space="preserve">
+ <value>Unsupported type {0} in event source.</value>
+ </data>
+ <data name="EventSource_UnsupportedMessageProperty" xml:space="preserve">
+ <value>Event {0} specifies an illegal or unsupported formatting message ("{1}").</value>
+ </data>
+ <data name="EventSource_VarArgsParameterMismatch" xml:space="preserve">
+ <value>The parameters to the Event method do not match the parameters to the WriteEvent method. This may cause the event to be displayed incorrectly.</value>
+ </data>
+ <data name="Exception_EndOfInnerExceptionStack" xml:space="preserve">
+ <value>--- End of inner exception stack trace ---</value>
+ </data>
+ <data name="Exception_EndStackTraceFromPreviousThrow" xml:space="preserve">
+ <value>--- End of stack trace from previous location where exception was thrown ---</value>
+ </data>
+ <data name="Exception_WasThrown" xml:space="preserve">
+ <value>Exception of type '{0}' was thrown.</value>
+ </data>
+ <data name="ExecutionContext_ExceptionInAsyncLocalNotification" xml:space="preserve">
+ <value>An exception was not handled in an AsyncLocal&lt;T&gt; notification callback.</value>
+ </data>
+ <data name="FieldAccess_InitOnly" xml:space="preserve">
+ <value>InitOnly (aka ReadOnly) fields can only be initialized in the type/instance constructor.</value>
+ </data>
+ <data name="FileNotFound_ResolveAssembly" xml:space="preserve">
+ <value>Could not resolve assembly '{0}'.</value>
+ </data>
+ <data name="Format_AttributeUsage" xml:space="preserve">
+ <value>Duplicate AttributeUsageAttribute found on attribute type {0}.</value>
+ </data>
+ <data name="Format_Bad7BitInt32" xml:space="preserve">
+ <value>Too many bytes in what should have been a 7 bit encoded Int32.</value>
+ </data>
+ <data name="Format_BadBase" xml:space="preserve">
+ <value>Invalid digits for the specified base.</value>
+ </data>
+ <data name="Format_BadBase64Char" xml:space="preserve">
+ <value>The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.</value>
+ </data>
+ <data name="Format_BadBase64CharArrayLength" xml:space="preserve">
+ <value>Invalid length for a Base-64 char array or string.</value>
+ </data>
+ <data name="Format_BadBoolean" xml:space="preserve">
+ <value>String was not recognized as a valid Boolean.</value>
+ </data>
+ <data name="Format_BadDatePattern" xml:space="preserve">
+ <value>Could not determine the order of year, month, and date from '{0}'.</value>
+ </data>
+ <data name="Format_BadDateTime" xml:space="preserve">
+ <value>String was not recognized as a valid DateTime.</value>
+ </data>
+ <data name="Format_BadDateTimeCalendar" xml:space="preserve">
+ <value>The DateTime represented by the string is not supported in calendar {0}.</value>
+ </data>
+ <data name="Format_BadDayOfWeek" xml:space="preserve">
+ <value>String was not recognized as a valid DateTime because the day of week was incorrect.</value>
+ </data>
+ <data name="Format_BadFormatSpecifier" xml:space="preserve">
+ <value>Format specifier was invalid.</value>
+ </data>
+ <data name="Format_BadQuote" xml:space="preserve">
+ <value>Cannot find a matching quote character for the character '{0}'.</value>
+ </data>
+ <data name="Format_BadTimeSpan" xml:space="preserve">
+ <value>String was not recognized as a valid TimeSpan.</value>
+ </data>
+ <data name="Format_DateOutOfRange" xml:space="preserve">
+ <value>The DateTime represented by the string is out of range.</value>
+ </data>
+ <data name="Format_EmptyInputString" xml:space="preserve">
+ <value>Input string was either empty or contained only whitespace.</value>
+ </data>
+ <data name="Format_ExtraJunkAtEnd" xml:space="preserve">
+ <value>Additional non-parsable characters are at the end of the string.</value>
+ </data>
+ <data name="Format_GuidBrace" xml:space="preserve">
+ <value>Expected {0xdddddddd, etc}.</value>
+ </data>
+ <data name="Format_GuidBraceAfterLastNumber" xml:space="preserve">
+ <value>Could not find a brace, or the length between the previous token and the brace was zero (i.e., '0x,'etc.).</value>
+ </data>
+ <data name="Format_GuidComma" xml:space="preserve">
+ <value>Could not find a comma, or the length between the previous token and the comma was zero (i.e., '0x,'etc.).</value>
+ </data>
+ <data name="Format_GuidDashes" xml:space="preserve">
+ <value>Dashes are in the wrong position for GUID parsing.</value>
+ </data>
+ <data name="Format_GuidEndBrace" xml:space="preserve">
+ <value>Could not find the ending brace.</value>
+ </data>
+ <data name="Format_GuidHexPrefix" xml:space="preserve">
+ <value>Expected hex 0x in '{0}'.</value>
+ </data>
+ <data name="Format_GuidInvalidChar" xml:space="preserve">
+ <value>Guid string should only contain hexadecimal characters.</value>
+ </data>
+ <data name="Format_GuidInvLen" xml:space="preserve">
+ <value>Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).</value>
+ </data>
+ <data name="Format_GuidUnrecognized" xml:space="preserve">
+ <value>Unrecognized Guid format.</value>
+ </data>
+ <data name="Format_IndexOutOfRange" xml:space="preserve">
+ <value>Index (zero based) must be greater than or equal to zero and less than the size of the argument list.</value>
+ </data>
+ <data name="Format_InvalidEnumFormatSpecification" xml:space="preserve">
+ <value>Format String can be only "G", "g", "X", "x", "F", "f", "D" or "d".</value>
+ </data>
+ <data name="Format_InvalidGuidFormatSpecification" xml:space="preserve">
+ <value>Format String can be only "D", "d", "N", "n", "P", "p", "B", "b", "X" or "x".</value>
+ </data>
+ <data name="Format_InvalidString" xml:space="preserve">
+ <value>Input string was not in a correct format.</value>
+ </data>
+ <data name="Format_MissingIncompleteDate" xml:space="preserve">
+ <value>There must be at least a partial date with a year present in the input.</value>
+ </data>
+ <data name="Format_NeedSingleChar" xml:space="preserve">
+ <value>String must be exactly one character long.</value>
+ </data>
+ <data name="Format_NoParsibleDigits" xml:space="preserve">
+ <value>Could not find any recognizable digits.</value>
+ </data>
+ <data name="Format_OffsetOutOfRange" xml:space="preserve">
+ <value>The time zone offset must be within plus or minus 14 hours.</value>
+ </data>
+ <data name="Format_RepeatDateTimePattern" xml:space="preserve">
+ <value>DateTime pattern '{0}' appears more than once with different values.</value>
+ </data>
+ <data name="Format_StringZeroLength" xml:space="preserve">
+ <value>String cannot have zero length.</value>
+ </data>
+ <data name="Format_UnknowDateTimeWord" xml:space="preserve">
+ <value>The string was not recognized as a valid DateTime. There is an unknown word starting at index {0}.</value>
+ </data>
+ <data name="Format_UTCOutOfRange" xml:space="preserve">
+ <value>The UTC representation of the date falls outside the year range 1-9999.</value>
+ </data>
+ <data name="Globalization_cp_1200" xml:space="preserve">
+ <value>Unicode</value>
+ </data>
+ <data name="Globalization_cp_12000" xml:space="preserve">
+ <value>Unicode (UTF-32)</value>
+ </data>
+ <data name="Globalization_cp_12001" xml:space="preserve">
+ <value>Unicode (UTF-32 Big-Endian)</value>
+ </data>
+ <data name="Globalization_cp_1201" xml:space="preserve">
+ <value>Unicode (Big-Endian)</value>
+ </data>
+ <data name="Globalization_cp_20127" xml:space="preserve">
+ <value>US-ASCII</value>
+ </data>
+ <data name="Globalization_cp_28591" xml:space="preserve">
+ <value>Western European (ISO)</value>
+ </data>
+ <data name="Globalization_cp_65000" xml:space="preserve">
+ <value>Unicode (UTF-7)</value>
+ </data>
+ <data name="Globalization_cp_65001" xml:space="preserve">
+ <value>Unicode (UTF-8)</value>
+ </data>
+ <data name="IndexOutOfRange_ArrayRankIndex" xml:space="preserve">
+ <value>Array does not have that many dimensions.</value>
+ </data>
+ <data name="IndexOutOfRange_IORaceCondition" xml:space="preserve">
+ <value>Probable I/O race condition detected while copying memory. The I/O package is not thread safe by default. In multithreaded applications, a stream must be accessed in a thread-safe way, such as a thread-safe wrapper returned by TextReader's or TextWriter's Synchronized methods. This also applies to classes like StreamWriter and StreamReader.</value>
+ </data>
+ <data name="IndexOutOfRange_UMSPosition" xml:space="preserve">
+ <value>Unmanaged memory stream position was beyond the capacity of the stream.</value>
+ </data>
+ <data name="InsufficientMemory_MemFailPoint" xml:space="preserve">
+ <value>Insufficient available memory to meet the expected demands of an operation at this time. Please try again later.</value>
+ </data>
+ <data name="InsufficientMemory_MemFailPoint_TooBig" xml:space="preserve">
+ <value>Insufficient memory to meet the expected demands of an operation, and this system is likely to never satisfy this request. If this is a 32 bit system, consider booting in 3 GB mode.</value>
+ </data>
+ <data name="InsufficientMemory_MemFailPoint_VAFrag" xml:space="preserve">
+ <value>Insufficient available memory to meet the expected demands of an operation at this time, possibly due to virtual address space fragmentation. Please try again later.</value>
+ </data>
+ <data name="Interop_COM_TypeMismatch" xml:space="preserve">
+ <value>Type mismatch between source and destination types.</value>
+ </data>
+ <data name="Interop_Marshal_Unmappable_Char" xml:space="preserve">
+ <value>Cannot marshal: Encountered unmappable character.</value>
+ </data>
+ <data name="InvalidCast_CannotCastNullToValueType" xml:space="preserve">
+ <value>Null object cannot be converted to a value type.</value>
+ </data>
+ <data name="InvalidCast_CannotCoerceByRefVariant" xml:space="preserve">
+ <value>Object cannot be coerced to the original type of the ByRef VARIANT it was obtained from.</value>
+ </data>
+ <data name="InvalidCast_DBNull" xml:space="preserve">
+ <value>Object cannot be cast to DBNull.</value>
+ </data>
+ <data name="InvalidCast_DownCastArrayElement" xml:space="preserve">
+ <value>At least one element in the source array could not be cast down to the destination array type.</value>
+ </data>
+ <data name="InvalidCast_Empty" xml:space="preserve">
+ <value>Object cannot be cast to Empty.</value>
+ </data>
+ <data name="InvalidCast_FromDBNull" xml:space="preserve">
+ <value>Object cannot be cast from DBNull to other types.</value>
+ </data>
+ <data name="InvalidCast_FromTo" xml:space="preserve">
+ <value>Invalid cast from '{0}' to '{1}'.</value>
+ </data>
+ <data name="InvalidCast_IConvertible" xml:space="preserve">
+ <value>Object must implement IConvertible.</value>
+ </data>
+ <data name="InvalidCast_OATypeMismatch" xml:space="preserve">
+ <value>OleAut reported a type mismatch.</value>
+ </data>
+ <data name="InvalidCast_StoreArrayElement" xml:space="preserve">
+ <value>Object cannot be stored in an array of this type.</value>
+ </data>
+ <data name="InvalidCast_WinRTIPropertyValueArrayCoersion" xml:space="preserve">
+ <value>Object in an IPropertyValue is of type '{0}' which cannot be convereted to a '{1}' due to array element '{2}': {3}.</value>
+ </data>
+ <data name="InvalidCast_WinRTIPropertyValueCoersion" xml:space="preserve">
+ <value>Object in an IPropertyValue is of type '{0}' with value '{1}', which cannot be converted to a '{2}'.</value>
+ </data>
+ <data name="InvalidCast_WinRTIPropertyValueElement" xml:space="preserve">
+ <value>Object in an IPropertyValue is of type '{0}', which cannot be converted to a '{1}'.</value>
+ </data>
+ <data name="InvalidOperation_AsyncFlowCtrlCtxMismatch" xml:space="preserve">
+ <value>AsyncFlowControl objects can be used to restore flow only on a Context that had its flow suppressed.</value>
+ </data>
+ <data name="InvalidOperation_AsyncIOInProgress" xml:space="preserve">
+ <value>The stream is currently in use by a previous operation on the stream.</value>
+ </data>
+ <data name="InvalidOperation_BadEmptyMethodBody" xml:space="preserve">
+ <value>Method '{0}' does not have a method body.</value>
+ </data>
+ <data name="InvalidOperation_BadILGeneratorUsage" xml:space="preserve">
+ <value>ILGenerator usage is invalid.</value>
+ </data>
+ <data name="InvalidOperation_BadInstructionOrIndexOutOfBound" xml:space="preserve">
+ <value>MSIL instruction is invalid or index is out of bounds.</value>
+ </data>
+ <data name="InvalidOperation_BadInterfaceNotAbstract" xml:space="preserve">
+ <value>Interface must be declared abstract.</value>
+ </data>
+ <data name="InvalidOperation_BadMethodBody" xml:space="preserve">
+ <value>Method '{0}' cannot have a method body.</value>
+ </data>
+ <data name="InvalidOperation_BadTypeAttributesNotAbstract" xml:space="preserve">
+ <value>Type must be declared abstract if any of its methods are abstract.</value>
+ </data>
+ <data name="InvalidOperation_CalledTwice" xml:space="preserve">
+ <value>The method cannot be called twice on the same instance.</value>
+ </data>
+ <data name="InvalidOperation_CannotImportGlobalFromDifferentModule" xml:space="preserve">
+ <value>Unable to import a global method or field from a different module.</value>
+ </data>
+ <data name="InvalidOperation_CannotRemoveLastFromEmptyCollection" xml:space="preserve">
+ <value>Cannot remove the last element from an empty collection.</value>
+ </data>
+ <data name="InvalidOperation_CannotRestoreUnsupressedFlow" xml:space="preserve">
+ <value>Cannot restore context flow when it is not suppressed.</value>
+ </data>
+ <data name="InvalidOperation_CannotSupressFlowMultipleTimes" xml:space="preserve">
+ <value>Context flow is already suppressed.</value>
+ </data>
+ <data name="InvalidOperation_CannotUseAFCMultiple" xml:space="preserve">
+ <value>AsyncFlowControl object can be used only once to call Undo().</value>
+ </data>
+ <data name="InvalidOperation_CannotUseAFCOtherThread" xml:space="preserve">
+ <value>AsyncFlowControl object must be used on the thread where it was created.</value>
+ </data>
+ <data name="InvalidOperation_CantInstantiateAbstractClass" xml:space="preserve">
+ <value>Instances of abstract classes cannot be created.</value>
+ </data>
+ <data name="InvalidOperation_CantInstantiateFunctionPointer" xml:space="preserve">
+ <value>Instances of function pointers cannot be created.</value>
+ </data>
+ <data name="InvalidOperation_CollectionBackingDictionaryTooLarge" xml:space="preserve">
+ <value>The collection backing this Dictionary contains too many elements.</value>
+ </data>
+ <data name="InvalidOperation_CollectionBackingListTooLarge" xml:space="preserve">
+ <value>The collection backing this List contains too many elements.</value>
+ </data>
+ <data name="InvalidOperation_CollectionCorrupted" xml:space="preserve">
+ <value>A prior operation on this collection was interrupted by an exception. Collection's state is no longer trusted.</value>
+ </data>
+ <data name="InvalidOperation_ConstructorNotAllowedOnInterface" xml:space="preserve">
+ <value>Interface cannot have constructors.</value>
+ </data>
+ <data name="InvalidOperation_CriticalTransparentAreMutuallyExclusive" xml:space="preserve">
+ <value>SecurityTransparent and SecurityCritical attributes cannot be applied to the assembly scope at the same time.</value>
+ </data>
+ <data name="InvalidOperation_DateTimeParsing" xml:space="preserve">
+ <value>Internal Error in DateTime and Calendar operations.</value>
+ </data>
+ <data name="InvalidOperation_DebuggerLaunchFailed" xml:space="preserve">
+ <value>Debugger unable to launch.</value>
+ </data>
+ <data name="InvalidOperation_DefaultConstructorILGen" xml:space="preserve">
+ <value>Unable to access ILGenerator on a constructor created with DefineDefaultConstructor.</value>
+ </data>
+ <data name="InvalidOperation_EndReadCalledMultiple" xml:space="preserve">
+ <value>EndRead can only be called once for each asynchronous operation.</value>
+ </data>
+ <data name="InvalidOperation_EndWriteCalledMultiple" xml:space="preserve">
+ <value>EndWrite can only be called once for each asynchronous operation.</value>
+ </data>
+ <data name="InvalidOperation_EnumEnded" xml:space="preserve">
+ <value>Enumeration already finished.</value>
+ </data>
+ <data name="InvalidOperation_EnumFailedVersion" xml:space="preserve">
+ <value>Collection was modified; enumeration operation may not execute.</value>
+ </data>
+ <data name="InvalidOperation_EnumNotStarted" xml:space="preserve">
+ <value>Enumeration has not started. Call MoveNext.</value>
+ </data>
+ <data name="InvalidOperation_EnumOpCantHappen" xml:space="preserve">
+ <value>Enumeration has either not started or has already finished.</value>
+ </data>
+ <data name="InvalidOperation_EventInfoNotAvailable" xml:space="preserve">
+ <value>This API does not support EventInfo tokens.</value>
+ </data>
+ <data name="InvalidOperation_EventTokenTableRequiresDelegate" xml:space="preserve">
+ <value>Type '{0}' is not a delegate type. EventTokenTable may only be used with delegate types.</value>
+ </data>
+ <data name="InvalidOperation_GenericParametersAlreadySet" xml:space="preserve">
+ <value>The generic parameters are already defined on this MethodBuilder.</value>
+ </data>
+ <data name="InvalidOperation_GetVersion" xml:space="preserve">
+ <value>OSVersion's call to GetVersionEx failed.</value>
+ </data>
+ <data name="InvalidOperation_GlobalsHaveBeenCreated" xml:space="preserve">
+ <value>Type definition of the global function has been completed.</value>
+ </data>
+ <data name="InvalidOperation_HandleIsNotInitialized" xml:space="preserve">
+ <value>Handle is not initialized.</value>
+ </data>
+ <data name="InvalidOperation_HandleIsNotPinned" xml:space="preserve">
+ <value>Handle is not pinned.</value>
+ </data>
+ <data name="InvalidOperation_HashInsertFailed" xml:space="preserve">
+ <value>Hashtable insert failed. Load factor too high. The most common cause is multiple threads writing to the Hashtable simultaneously.</value>
+ </data>
+ <data name="InvalidOperation_IComparerFailed" xml:space="preserve">
+ <value>Failed to compare two elements in the array.</value>
+ </data>
+ <data name="InvalidOperation_MethodBaked" xml:space="preserve">
+ <value>Type definition of the method is complete.</value>
+ </data>
+ <data name="InvalidOperation_MethodBuilderBaked" xml:space="preserve">
+ <value>The signature of the MethodBuilder can no longer be modified because an operation on the MethodBuilder caused the methodDef token to be created. For example, a call to SetCustomAttribute requires the methodDef token to emit the CustomAttribute token.</value>
+ </data>
+ <data name="InvalidOperation_MethodHasBody" xml:space="preserve">
+ <value>Method already has a body.</value>
+ </data>
+ <data name="InvalidOperation_MustCallInitialize" xml:space="preserve">
+ <value>You must call Initialize on this object instance before using it.</value>
+ </data>
+ <data name="InvalidOperation_NativeOverlappedReused" xml:space="preserve">
+ <value>NativeOverlapped cannot be reused for multiple operations.</value>
+ </data>
+ <data name="InvalidOperation_NoMultiModuleAssembly" xml:space="preserve">
+ <value>You cannot have more than one dynamic module in each dynamic assembly in this version of the runtime.</value>
+ </data>
+ <data name="InvalidOperation_NoPublicAddMethod" xml:space="preserve">
+ <value>Cannot add the event handler since no public add method exists for the event.</value>
+ </data>
+ <data name="InvalidOperation_NoPublicRemoveMethod" xml:space="preserve">
+ <value>Cannot remove the event handler since no public remove method exists for the event.</value>
+ </data>
+ <data name="InvalidOperation_NotADebugModule" xml:space="preserve">
+ <value>Not a debug ModuleBuilder.</value>
+ </data>
+ <data name="InvalidOperation_NotAllowedInDynamicMethod" xml:space="preserve">
+ <value>The requested operation is invalid for DynamicMethod.</value>
+ </data>
+ <data name="InvalidOperation_NotAllowedInReflectionOnly" xml:space="preserve">
+ <value>The requested operation is invalid in the ReflectionOnly context.</value>
+ </data>
+ <data name="InvalidOperation_NotAVarArgCallingConvention" xml:space="preserve">
+ <value>Calling convention must be VarArgs.</value>
+ </data>
+ <data name="InvalidOperation_NotGenericType" xml:space="preserve">
+ <value>This operation is only valid on generic types.</value>
+ </data>
+ <data name="InvalidOperation_NotSupportedOnWinRTEvent" xml:space="preserve">
+ <value>Adding or removing event handlers dynamically is not supported on WinRT events.</value>
+ </data>
+ <data name="InvalidOperation_NotWithConcurrentGC" xml:space="preserve">
+ <value>This API is not available when the concurrent GC is enabled.</value>
+ </data>
+ <data name="InvalidOperation_NoUnderlyingTypeOnEnum" xml:space="preserve">
+ <value>Underlying type information on enumeration is not specified.</value>
+ </data>
+ <data name="InvalidOperation_NoValue" xml:space="preserve">
+ <value>Nullable object must have a value.</value>
+ </data>
+ <data name="InvalidOperation_NullArray" xml:space="preserve">
+ <value>The underlying array is null.</value>
+ </data>
+ <data name="InvalidOperation_NullContext" xml:space="preserve">
+ <value>Cannot call Set on a null context</value>
+ </data>
+ <data name="InvalidOperation_NullModuleHandle" xml:space="preserve">
+ <value>The requested operation is invalid when called on a null ModuleHandle.</value>
+ </data>
+ <data name="InvalidOperation_OpenLocalVariableScope" xml:space="preserve">
+ <value>Local variable scope was not properly closed.</value>
+ </data>
+ <data name="InvalidOperation_Overlapped_Pack" xml:space="preserve">
+ <value>Cannot pack a packed Overlapped again.</value>
+ </data>
+ <data name="InvalidOperation_PropertyInfoNotAvailable" xml:space="preserve">
+ <value>This API does not support PropertyInfo tokens.</value>
+ </data>
+ <data name="InvalidOperation_ReadOnly" xml:space="preserve">
+ <value>Instance is read-only.</value>
+ </data>
+ <data name="InvalidOperation_ResMgrBadResSet_Type" xml:space="preserve">
+ <value>'{0}': ResourceSet derived classes must provide a constructor that takes a String file name and a constructor that takes a Stream.</value>
+ </data>
+ <data name="InvalidOperation_ResourceNotStream_Name" xml:space="preserve">
+ <value>Resource '{0}' was not a Stream - call GetObject instead.</value>
+ </data>
+ <data name="InvalidOperation_ResourceNotString_Name" xml:space="preserve">
+ <value>Resource '{0}' was not a String - call GetObject instead.</value>
+ </data>
+ <data name="InvalidOperation_ResourceNotString_Type" xml:space="preserve">
+ <value>Resource was of type '{0}' instead of String - call GetObject instead.</value>
+ </data>
+ <data name="InvalidOperation_SetData_OnlyOnce" xml:space="preserve">
+ <value>SetData can only be used to set the value of a given name once.</value>
+ </data>
+ <data name="InvalidOperation_ShouldNotHaveMethodBody" xml:space="preserve">
+ <value>Method body should not exist.</value>
+ </data>
+ <data name="InvalidOperation_StrongNameKeyPairRequired" xml:space="preserve">
+ <value>A strong name key pair is required to emit a strong-named dynamic assembly.</value>
+ </data>
+ <data name="InvalidOperation_ThreadWrongThreadStart" xml:space="preserve">
+ <value>The thread was created with a ThreadStart delegate that does not accept a parameter.</value>
+ </data>
+ <data name="InvalidOperation_TimeoutsNotSupported" xml:space="preserve">
+ <value>Timeouts are not supported on this stream.</value>
+ </data>
+ <data name="InvalidOperation_TypeCannotBeBoxed" xml:space="preserve">
+ <value>The given type cannot be boxed.</value>
+ </data>
+ <data name="InvalidOperation_TypeHasBeenCreated" xml:space="preserve">
+ <value>Unable to change after type has been created.</value>
+ </data>
+ <data name="InvalidOperation_TypeNotCreated" xml:space="preserve">
+ <value>Type has not been created.</value>
+ </data>
+ <data name="InvalidOperation_UnknownEnumType" xml:space="preserve">
+ <value>Unknown enum type.</value>
+ </data>
+ <data name="InvalidOperation_WriteOnce" xml:space="preserve">
+ <value>This property has already been set and cannot be modified.</value>
+ </data>
+ <data name="InvalidOperation_WrongAsyncResultOrEndCalledMultiple" xml:space="preserve">
+ <value>Either the IAsyncResult object did not come from the corresponding async method on this type, or the End method was called multiple times with the same IAsyncResult.</value>
+ </data>
+ <data name="InvalidOperation_WrongAsyncResultOrEndReadCalledMultiple" xml:space="preserve">
+ <value>Either the IAsyncResult object did not come from the corresponding async method on this type, or EndRead was called multiple times with the same IAsyncResult.</value>
+ </data>
+ <data name="InvalidOperation_WrongAsyncResultOrEndWriteCalledMultiple" xml:space="preserve">
+ <value>Either the IAsyncResult object did not come from the corresponding async method on this type, or EndWrite was called multiple times with the same IAsyncResult.</value>
+ </data>
+ <data name="InvalidProgram_Default" xml:space="preserve">
+ <value>Common Language Runtime detected an invalid program.</value>
+ </data>
+ <data name="InvalidTimeZone_InvalidFileData" xml:space="preserve">
+ <value>The time zone ID '{0}' was found on the local computer, but the file at '{1}' was corrupt.</value>
+ </data>
+ <data name="InvalidTimeZone_InvalidRegistryData" xml:space="preserve">
+ <value>The time zone ID '{0}' was found on the local computer, but the registry information was corrupt.</value>
+ </data>
+ <data name="InvalidTimeZone_JulianDayNotSupported" xml:space="preserve">
+ <value>Julian dates in POSIX strings are unsupported.</value>
+ </data>
+ <data name="InvalidTimeZone_NoTTInfoStructures" xml:space="preserve">
+ <value>There are no ttinfo structures in the tzfile. At least one ttinfo structure is required in order to construct a TimeZoneInfo object.</value>
+ </data>
+ <data name="InvalidTimeZone_UnparseablePosixMDateString" xml:space="preserve">
+ <value>'{0}' is not a valid POSIX-TZ-environment-variable MDate rule. A valid rule has the format 'Mm.w.d'.</value>
+ </data>
+ <data name="InvariantFailed" xml:space="preserve">
+ <value>Invariant failed.</value>
+ </data>
+ <data name="InvariantFailed_Cnd" xml:space="preserve">
+ <value>Invariant failed: {0}</value>
+ </data>
+ <data name="IO_DriveNotFound_Drive" xml:space="preserve">
+ <value>Could not find the drive '{0}'. The drive might not be ready or might not be mapped.</value>
+ </data>
+ <data name="IO_EOF_ReadBeyondEOF" xml:space="preserve">
+ <value>Unable to read beyond the end of the stream.</value>
+ </data>
+ <data name="IO_FileLoad" xml:space="preserve">
+ <value>Could not load the specified file.</value>
+ </data>
+ <data name="IO_FileName_Name" xml:space="preserve">
+ <value>File name: '{0}'</value>
+ </data>
+ <data name="IO_FileNotFound" xml:space="preserve">
+ <value>Unable to find the specified file.</value>
+ </data>
+ <data name="IO_FileNotFound_FileName" xml:space="preserve">
+ <value>Could not find file '{0}'.</value>
+ </data>
+ <data name="IO_AlreadyExists_Name" xml:space="preserve">
+ <value>Cannot create "{0}" because a file or directory with the same name already exists.</value>
+ </data>
+ <data name="IO_BindHandleFailed" xml:space="preserve">
+ <value>BindHandle for ThreadPool failed on this handle.</value>
+ </data>
+ <data name="IO_FileExists_Name" xml:space="preserve">
+ <value>The file '{0}' already exists.</value>
+ </data>
+ <data name="IO_FileStreamHandlePosition" xml:space="preserve">
+ <value>The OS handle's position is not what FileStream expected. Do not use a handle simultaneously in one FileStream and in Win32 code or another FileStream. This may cause data loss.</value>
+ </data>
+ <data name="IO_FileTooLong2GB" xml:space="preserve">
+ <value>The file is too long. This operation is currently limited to supporting files less than 2 gigabytes in size.</value>
+ </data>
+ <data name="IO_FileTooLongOrHandleNotSync" xml:space="preserve">
+ <value>IO operation will not work. Most likely the file will become too long or the handle was not opened to support synchronous IO operations.</value>
+ </data>
+ <data name="IO_FixedCapacity" xml:space="preserve">
+ <value>Unable to expand length of this stream beyond its capacity.</value>
+ </data>
+ <data name="IO_InvalidStringLen_Len" xml:space="preserve">
+ <value>BinaryReader encountered an invalid string length of {0} characters.</value>
+ </data>
+ <data name="IO_NoPermissionToDirectoryName" xml:space="preserve">
+ <value>&lt;Path discovery permission to the specified directory was denied.&gt;</value>
+ </data>
+ <data name="IO_SeekAppendOverwrite" xml:space="preserve">
+ <value>Unable seek backward to overwrite data that previously existed in a file opened in Append mode.</value>
+ </data>
+ <data name="IO_SeekBeforeBegin" xml:space="preserve">
+ <value>An attempt was made to move the position before the beginning of the stream.</value>
+ </data>
+ <data name="IO_SetLengthAppendTruncate" xml:space="preserve">
+ <value>Unable to truncate data that previously existed in a file opened in Append mode.</value>
+ </data>
+ <data name="IO_SharingViolation_File" xml:space="preserve">
+ <value>The process cannot access the file '{0}' because it is being used by another process.</value>
+ </data>
+ <data name="IO_SharingViolation_NoFileName" xml:space="preserve">
+ <value>The process cannot access the file because it is being used by another process.</value>
+ </data>
+ <data name="IO_StreamTooLong" xml:space="preserve">
+ <value>Stream was too long.</value>
+ </data>
+ <data name="IO_PathNotFound_NoPathName" xml:space="preserve">
+ <value>Could not find a part of the path.</value>
+ </data>
+ <data name="IO_PathNotFound_Path" xml:space="preserve">
+ <value>Could not find a part of the path '{0}'.</value>
+ </data>
+ <data name="IO_PathTooLong" xml:space="preserve">
+ <value>The specified file name or path is too long, or a component of the specified path is too long.</value>
+ </data>
+ <data name="IO_UnknownFileName" xml:space="preserve">
+ <value>[Unknown]</value>
+ </data>
+ <data name="Lazy_CreateValue_NoParameterlessCtorForT" xml:space="preserve">
+ <value>The lazily-initialized type does not have a public, parameterless constructor.</value>
+ </data>
+ <data name="Lazy_ctor_ModeInvalid" xml:space="preserve">
+ <value>The mode argument specifies an invalid value.</value>
+ </data>
+ <data name="Lazy_StaticInit_InvalidOperation" xml:space="preserve">
+ <value>ValueFactory returned null.</value>
+ </data>
+ <data name="Lazy_ToString_ValueNotCreated" xml:space="preserve">
+ <value>Value is not created.</value>
+ </data>
+ <data name="Lazy_Value_RecursiveCallsToValue" xml:space="preserve">
+ <value>ValueFactory attempted to access the Value property of this instance.</value>
+ </data>
+ <data name="Loader_ContextPolicies" xml:space="preserve">
+ <value>Context Policies:</value>
+ </data>
+ <data name="Loader_Name" xml:space="preserve">
+ <value>Name:</value>
+ </data>
+ <data name="Loader_NoContextPolicies" xml:space="preserve">
+ <value>There are no context policies.</value>
+ </data>
+ <data name="ManualResetEventSlim_ctor_SpinCountOutOfRange" xml:space="preserve">
+ <value>The spinCount argument must be in the range 0 to {0}, inclusive.</value>
+ </data>
+ <data name="ManualResetEventSlim_ctor_TooManyWaiters" xml:space="preserve">
+ <value>There are too many threads currently waiting on the event. A maximum of {0} waiting threads are supported.</value>
+ </data>
+ <data name="ManualResetEventSlim_Disposed" xml:space="preserve">
+ <value>The event has been disposed.</value>
+ </data>
+ <data name="Marshaler_StringTooLong" xml:space="preserve">
+ <value>Marshaler restriction: Excessively long string.</value>
+ </data>
+ <data name="MissingConstructor_Name" xml:space="preserve">
+ <value>Constructor on type '{0}' not found.</value>
+ </data>
+ <data name="MissingField" xml:space="preserve">
+ <value>Field not found.</value>
+ </data>
+ <data name="MissingField_Name" xml:space="preserve">
+ <value>Field '{0}' not found.</value>
+ </data>
+ <data name="MissingManifestResource_LooselyLinked" xml:space="preserve">
+ <value>Could not find a manifest resource entry called "{0}" in assembly "{1}". Please check spelling, capitalization, and build rules to ensure "{0}" is being linked into the assembly.</value>
+ </data>
+ <data name="MissingManifestResource_MultipleBlobs" xml:space="preserve">
+ <value>A case-insensitive lookup for resource file "{0}" in assembly "{1}" found multiple entries. Remove the duplicates or specify the exact case.</value>
+ </data>
+ <data name="MissingManifestResource_NoNeutralAsm" xml:space="preserve">
+ <value>Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "{0}" was correctly embedded or linked into assembly "{1}" at compile time, or that all the satellite assemblies required are loadable and fully signed.</value>
+ </data>
+ <data name="MissingManifestResource_NoNeutralDisk" xml:space="preserve">
+ <value>Could not find any resources appropriate for the specified culture (or the neutral culture) on disk.</value>
+ </data>
+ <data name="MissingManifestResource_NoPRIresources" xml:space="preserve">
+ <value>Unable to open Package Resource Index.</value>
+ </data>
+ <data name="MissingManifestResource_ResWFileNotLoaded" xml:space="preserve">
+ <value>Unable to load resources for resource file "{0}" in package "{1}".</value>
+ </data>
+ <data name="MissingMember" xml:space="preserve">
+ <value>Member not found.</value>
+ </data>
+ <data name="MissingMember_Name" xml:space="preserve">
+ <value>Member '{0}' not found.</value>
+ </data>
+ <data name="MissingMemberNestErr" xml:space="preserve">
+ <value>TypedReference can only be made on nested value Types.</value>
+ </data>
+ <data name="MissingMemberTypeRef" xml:space="preserve">
+ <value>FieldInfo does not match the target Type.</value>
+ </data>
+ <data name="MissingMethod_Name" xml:space="preserve">
+ <value>Method '{0}' not found.</value>
+ </data>
+ <data name="MissingSatelliteAssembly_Culture_Name" xml:space="preserve">
+ <value>The satellite assembly named "{1}" for fallback culture "{0}" either could not be found or could not be loaded. This is generally a setup problem. Please consider reinstalling or repairing the application.</value>
+ </data>
+ <data name="MissingSatelliteAssembly_Default" xml:space="preserve">
+ <value>Resource lookup fell back to the ultimate fallback resources in a satellite assembly, but that satellite either was not found or could not be loaded. Please consider reinstalling or repairing the application.</value>
+ </data>
+ <data name="Multicast_Combine" xml:space="preserve">
+ <value>Delegates that are not of type MulticastDelegate may not be combined.</value>
+ </data>
+ <data name="MustUseCCRewrite" xml:space="preserve">
+ <value>An assembly (probably "{1}") must be rewritten using the code contracts binary rewriter (CCRewrite) because it is calling Contract.{0} and the CONTRACTS_FULL symbol is defined. Remove any explicit definitions of the CONTRACTS_FULL symbol from your project and rebuild. CCRewrite can be downloaded from http://go.microsoft.com/fwlink/?LinkID=169180. \r\nAfter the rewriter is installed, it can be enabled in Visual Studio from the project's Properties page on the Code Contracts pane. Ensure that "Perform Runtime Contract Checking" is enabled, which will define CONTRACTS_FULL.</value>
+ </data>
+ <data name="NotImplemented_ResourcesLongerThanInt64Max" xml:space="preserve">
+ <value>Resource files longer than 2^63 bytes are not currently implemented.</value>
+ </data>
+ <data name="NotSupported_AbstractNonCLS" xml:space="preserve">
+ <value>This non-CLS method is not implemented.</value>
+ </data>
+ <data name="NotSupported_ActivAttr" xml:space="preserve">
+ <value>Activation Attributes are not supported.</value>
+ </data>
+ <data name="NotSupported_AppX" xml:space="preserve">
+ <value>{0} is not supported in AppX.</value>
+ </data>
+ <data name="NotSupported_AssemblyLoadCodeBase" xml:space="preserve">
+ <value>Assembly.Load with a Codebase is not supported.</value>
+ </data>
+ <data name="NotSupported_AssemblyLoadFromHash" xml:space="preserve">
+ <value>Assembly.LoadFrom with hashValue is not supported.</value>
+ </data>
+ <data name="NotSupported_ByRefLike" xml:space="preserve">
+ <value>Cannot create boxed ByRef-like values.</value>
+ </data>
+ <data name="NotSupported_ByRefLikeArray" xml:space="preserve">
+ <value>Cannot create arrays of ByRef-like values.</value>
+ </data>
+ <data name="NotSupported_ByRefReturn" xml:space="preserve">
+ <value>ByRef return value not supported in reflection invocation.</value>
+ </data>
+ <data name="NotSupported_CallToVarArg" xml:space="preserve">
+ <value>Vararg calling convention not supported.</value>
+ </data>
+ <data name="NotSupported_CannotCallEqualsOnSpan" xml:space="preserve">
+ <value>Equals() on Span and ReadOnlySpan is not supported. Use operator== instead.</value>
+ </data>
+ <data name="NotSupported_CannotCallGetHashCodeOnSpan" xml:space="preserve">
+ <value>GetHashCode() on Span and ReadOnlySpan is not supported.</value>
+ </data>
+ <data name="NotSupported_ChangeType" xml:space="preserve">
+ <value>ChangeType operation is not supported.</value>
+ </data>
+ <data name="NotSupported_CollectibleAssemblyResolve" xml:space="preserve">
+ <value>Resolving to a collectible assembly is not supported.</value>
+ </data>
+ <data name="NotSupported_CollectibleBoundNonCollectible" xml:space="preserve">
+ <value>A non-collectible assembly may not reference a collectible assembly.</value>
+ </data>
+ <data name="NotSupported_CollectibleCOM" xml:space="preserve">
+ <value>COM Interop is not supported for collectible types.</value>
+ </data>
+ <data name="NotSupported_CollectibleDelegateMarshal" xml:space="preserve">
+ <value>Delegate marshaling for types within collectible assemblies is not supported.</value>
+ </data>
+ <data name="NotSupported_Constructor" xml:space="preserve">
+ <value>Object cannot be created through this constructor.</value>
+ </data>
+ <data name="NotSupported_CreateInstanceWithTypeBuilder" xml:space="preserve">
+ <value>CreateInstance cannot be used with an object of type TypeBuilder.</value>
+ </data>
+ <data name="NotSupported_DBNullSerial" xml:space="preserve">
+ <value>Only one DBNull instance may exist, and calls to DBNull deserialization methods are not allowed.</value>
+ </data>
+ <data name="NotSupported_DelegateMarshalToWrongDomain" xml:space="preserve">
+ <value>Delegates cannot be marshaled from native code into a domain other than their home domain.</value>
+ </data>
+ <data name="NotSupported_DelegateSerHolderSerial" xml:space="preserve">
+ <value>DelegateSerializationHolder objects are designed to represent a delegate during serialization and are not serializable themselves.</value>
+ </data>
+ <data name="NotSupported_DynamicAssembly" xml:space="preserve">
+ <value>The invoked member is not supported in a dynamic assembly.</value>
+ </data>
+ <data name="NotSupported_DynamicAssemblyNoRunAccess" xml:space="preserve">
+ <value>Cannot execute code on a dynamic assembly without run access.</value>
+ </data>
+ <data name="NotSupported_DynamicMethodFlags" xml:space="preserve">
+ <value>Wrong MethodAttributes or CallingConventions for DynamicMethod. Only public, static, standard supported</value>
+ </data>
+ <data name="NotSupported_DynamicModule" xml:space="preserve">
+ <value>The invoked member is not supported in a dynamic module.</value>
+ </data>
+ <data name="NotSupported_FileStreamOnNonFiles" xml:space="preserve">
+ <value>FileStream was asked to open a device that was not a file. For support for devices like 'com1:' or 'lpt1:', call CreateFile, then use the FileStream constructors that take an OS handle as an IntPtr.</value>
+ </data>
+ <data name="NotSupported_FixedSizeCollection" xml:space="preserve">
+ <value>Collection was of a fixed size.</value>
+ </data>
+ <data name="NotSupported_GenericMethod" xml:space="preserve">
+ <value>Generic methods with NativeCallableAttribute are not supported.</value>
+ </data>
+ <data name="NotSupported_GlobalMethodSerialization" xml:space="preserve">
+ <value>Serialization of global methods (including implicit serialization via the use of asynchronous delegates) is not supported.</value>
+ </data>
+ <data name="NotSupported_IDispInvokeDefaultMemberWithNamedArgs" xml:space="preserve">
+ <value>Invoking default method with named arguments is not supported.</value>
+ </data>
+ <data name="NotSupported_IllegalOneByteBranch" xml:space="preserve">
+ <value>Illegal one-byte branch at position: {0}. Requested branch was: {1}.</value>
+ </data>
+ <data name="NotSupported_KeyCollectionSet" xml:space="preserve">
+ <value>Mutating a key collection derived from a dictionary is not allowed.</value>
+ </data>
+ <data name="NotSupported_ManagedActivation" xml:space="preserve">
+ <value>Cannot create uninitialized instances of types requiring managed activation.</value>
+ </data>
+ <data name="NotSupported_MaxWaitHandles" xml:space="preserve">
+ <value>The number of WaitHandles must be less than or equal to 64.</value>
+ </data>
+ <data name="NotSupported_MemStreamNotExpandable" xml:space="preserve">
+ <value>Memory stream is not expandable.</value>
+ </data>
+ <data name="NotSupported_MustBeModuleBuilder" xml:space="preserve">
+ <value>Module argument must be a ModuleBuilder.</value>
+ </data>
+ <data name="NotSupported_NativeCallableTarget" xml:space="preserve">
+ <value>Methods with NativeCallableAttribute cannot be used as delegate target.</value>
+ </data>
+ <data name="NotSupported_NoCodepageData" xml:space="preserve">
+ <value>No data is available for encoding {0}. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.</value>
+ </data>
+ <data name="NotSupported_NonBlittableTypes" xml:space="preserve">
+ <value>Non-blittable parameter types are not supported for NativeCallable methods.</value>
+ </data>
+ <data name="NotSupported_NonReflectedType" xml:space="preserve">
+ <value>Not supported in a non-reflected type.</value>
+ </data>
+ <data name="NotSupported_NonStaticMethod" xml:space="preserve">
+ <value>Non-static methods with NativeCallableAttribute are not supported.</value>
+ </data>
+ <data name="NotSupported_NoParentDefaultConstructor" xml:space="preserve">
+ <value>Parent does not have a default constructor. The default constructor must be explicitly defined.</value>
+ </data>
+ <data name="NotSupported_NoTypeInfo" xml:space="preserve">
+ <value>Cannot resolve {0} to a TypeInfo object.</value>
+ </data>
+ <data name="NotSupported_NYI" xml:space="preserve">
+ <value>This feature is not currently implemented.</value>
+ </data>
+ <data name="NotSupported_ObsoleteResourcesFile" xml:space="preserve">
+ <value>Found an obsolete .resources file in assembly '{0}'. Rebuild that .resources file then rebuild that assembly.</value>
+ </data>
+ <data name="NotSupported_OleAutBadVarType" xml:space="preserve">
+ <value>The given Variant type is not supported by this OleAut function.</value>
+ </data>
+ <data name="NotSupported_OpenType" xml:space="preserve">
+ <value>Cannot create arrays of open type.</value>
+ </data>
+ <data name="NotSupported_OutputStreamUsingTypeBuilder" xml:space="preserve">
+ <value>Output streams do not support TypeBuilders.</value>
+ </data>
+ <data name="NotSupported_PIAInAppxProcess" xml:space="preserve">
+ <value>A Primary Interop Assembly is not supported in AppX.</value>
+ </data>
+ <data name="NotSupported_Reading" xml:space="preserve">
+ <value>Accessor does not support reading.</value>
+ </data>
+ <data name="NotSupported_ReadOnlyCollection" xml:space="preserve">
+ <value>Collection is read-only.</value>
+ </data>
+ <data name="NotSupported_ResourceObjectSerialization" xml:space="preserve">
+ <value>Cannot read resources that depend on serialization.</value>
+ </data>
+ <data name="NotSupported_SignalAndWaitSTAThread" xml:space="preserve">
+ <value>SignalAndWait on a STA thread is not supported.</value>
+ </data>
+ <data name="NotSupported_StringComparison" xml:space="preserve">
+ <value>The string comparison type passed in is currently not supported.</value>
+ </data>
+ <data name="NotSupported_SubclassOverride" xml:space="preserve">
+ <value>Derived classes must provide an implementation.</value>
+ </data>
+ <data name="NotSupported_SymbolMethod" xml:space="preserve">
+ <value>Not supported in an array method of a type definition that is not complete.</value>
+ </data>
+ <data name="NotSupported_TooManyArgs" xml:space="preserve">
+ <value>Stack size too deep. Possibly too many arguments.</value>
+ </data>
+ <data name="NotSupported_Type" xml:space="preserve">
+ <value>Type is not supported.</value>
+ </data>
+ <data name="NotSupported_TypeCannotDeserialized" xml:space="preserve">
+ <value>Direct deserialization of type '{0}' is not supported.</value>
+ </data>
+ <data name="NotSupported_TypeNotYetCreated" xml:space="preserve">
+ <value>The invoked member is not supported before the type is created.</value>
+ </data>
+ <data name="NotSupported_UmsSafeBuffer" xml:space="preserve">
+ <value>This operation is not supported for an UnmanagedMemoryStream created from a SafeBuffer.</value>
+ </data>
+ <data name="NotSupported_UnitySerHolder" xml:space="preserve">
+ <value>The UnitySerializationHolder object is designed to transmit information about other types and is not serializable itself.</value>
+ </data>
+ <data name="NotSupported_UnknownTypeCode" xml:space="preserve">
+ <value>TypeCode '{0}' was not valid.</value>
+ </data>
+ <data name="NotSupported_UnreadableStream" xml:space="preserve">
+ <value>Stream does not support reading.</value>
+ </data>
+ <data name="NotSupported_UnseekableStream" xml:space="preserve">
+ <value>Stream does not support seeking.</value>
+ </data>
+ <data name="NotSupported_UnwritableStream" xml:space="preserve">
+ <value>Stream does not support writing.</value>
+ </data>
+ <data name="NotSupported_ValueClassCM" xml:space="preserve">
+ <value>Custom marshalers for value types are not currently supported.</value>
+ </data>
+ <data name="NotSupported_ValueCollectionSet" xml:space="preserve">
+ <value>Mutating a value collection derived from a dictionary is not allowed.</value>
+ </data>
+ <data name="NotSupported_VoidArray" xml:space="preserve">
+ <value>Arrays of System.Void are not supported.</value>
+ </data>
+ <data name="NotSupported_WinRT_PartialTrust" xml:space="preserve">
+ <value>Windows Runtime is not supported in partial trust.</value>
+ </data>
+ <data name="NotSupported_Writing" xml:space="preserve">
+ <value>Accessor does not support writing.</value>
+ </data>
+ <data name="NotSupported_WrongResourceReader_Type" xml:space="preserve">
+ <value>This .resources file should not be read with this reader. The resource reader type is "{0}".</value>
+ </data>
+ <data name="NullReference_This" xml:space="preserve">
+ <value>The pointer for this method was null.</value>
+ </data>
+ <data name="ObjectDisposed_FileClosed" xml:space="preserve">
+ <value>Cannot access a closed file.</value>
+ </data>
+ <data name="ObjectDisposed_Generic" xml:space="preserve">
+ <value>Cannot access a disposed object.</value>
+ </data>
+ <data name="ObjectDisposed_ObjectName_Name" xml:space="preserve">
+ <value>Object name: '{0}'.</value>
+ </data>
+ <data name="ObjectDisposed_ReaderClosed" xml:space="preserve">
+ <value>Cannot read from a closed TextReader.</value>
+ </data>
+ <data name="ObjectDisposed_RegKeyClosed" xml:space="preserve">
+ <value>Cannot access a closed registry key.</value>
+ </data>
+ <data name="ObjectDisposed_ResourceSet" xml:space="preserve">
+ <value>Cannot access a closed resource set.</value>
+ </data>
+ <data name="ObjectDisposed_StreamClosed" xml:space="preserve">
+ <value>Cannot access a closed Stream.</value>
+ </data>
+ <data name="ObjectDisposed_ViewAccessorClosed" xml:space="preserve">
+ <value>Cannot access a closed accessor.</value>
+ </data>
+ <data name="OperationCanceled" xml:space="preserve">
+ <value>The operation was canceled.</value>
+ </data>
+ <data name="OutOfMemory_GCHandleMDA" xml:space="preserve">
+ <value>The GCHandle MDA has run out of available cookies.</value>
+ </data>
+ <data name="Overflow_Byte" xml:space="preserve">
+ <value>Value was either too large or too small for an unsigned byte.</value>
+ </data>
+ <data name="Overflow_Char" xml:space="preserve">
+ <value>Value was either too large or too small for a character.</value>
+ </data>
+ <data name="Overflow_Currency" xml:space="preserve">
+ <value>Value was either too large or too small for a Currency.</value>
+ </data>
+ <data name="Overflow_Decimal" xml:space="preserve">
+ <value>Value was either too large or too small for a Decimal.</value>
+ </data>
+ <data name="Overflow_Double" xml:space="preserve">
+ <value>Value was either too large or too small for a Double.</value>
+ </data>
+ <data name="Overflow_Duration" xml:space="preserve">
+ <value>The duration cannot be returned for TimeSpan.MinValue because the absolute value of TimeSpan.MinValue exceeds the value of TimeSpan.MaxValue.</value>
+ </data>
+ <data name="Overflow_Int16" xml:space="preserve">
+ <value>Value was either too large or too small for an Int16.</value>
+ </data>
+ <data name="Overflow_Int32" xml:space="preserve">
+ <value>Value was either too large or too small for an Int32.</value>
+ </data>
+ <data name="Overflow_Int64" xml:space="preserve">
+ <value>Value was either too large or too small for an Int64.</value>
+ </data>
+ <data name="Overflow_NegateTwosCompNum" xml:space="preserve">
+ <value>Negating the minimum value of a twos complement number is invalid.</value>
+ </data>
+ <data name="Overflow_NegativeUnsigned" xml:space="preserve">
+ <value>The string was being parsed as an unsigned number and could not have a negative sign.</value>
+ </data>
+ <data name="Overflow_SByte" xml:space="preserve">
+ <value>Value was either too large or too small for a signed byte.</value>
+ </data>
+ <data name="Overflow_Single" xml:space="preserve">
+ <value>Value was either too large or too small for a Single.</value>
+ </data>
+ <data name="Overflow_TimeSpanElementTooLarge" xml:space="preserve">
+ <value>The TimeSpan could not be parsed because at least one of the numeric components is out of range or contains too many digits.</value>
+ </data>
+ <data name="Overflow_TimeSpanTooLong" xml:space="preserve">
+ <value>TimeSpan overflowed because the duration is too long.</value>
+ </data>
+ <data name="Overflow_UInt16" xml:space="preserve">
+ <value>Value was either too large or too small for a UInt16.</value>
+ </data>
+ <data name="Overflow_UInt32" xml:space="preserve">
+ <value>Value was either too large or too small for a UInt32.</value>
+ </data>
+ <data name="Overflow_UInt64" xml:space="preserve">
+ <value>Value was either too large or too small for a UInt64.</value>
+ </data>
+ <data name="PlatformNotSupported_ArgIterator" xml:space="preserve">
+ <value>ArgIterator is not supported on this platform.</value>
+ </data>
+ <data name="PlatformNotSupported_ComInterop" xml:space="preserve">
+ <value>COM Interop is not supported on this platform.</value>
+ </data>
+ <data name="PlatformNotSupported_NamedSynchronizationPrimitives" xml:space="preserve">
+ <value>The named version of this synchronization primitive is not supported on this platform.</value>
+ </data>
+ <data name="PlatformNotSupported_NamedSyncObjectWaitAnyWaitAll" xml:space="preserve">
+ <value>Wait operations on multiple wait handles including a named synchronization primitive are not supported on this platform.</value>
+ </data>
+ <data name="PlatformNotSupported_OSXFileLocking" xml:space="preserve">
+ <value>Locking/unlocking file regions is not supported on this platform. Use FileShare on the entire file instead.</value>
+ </data>
+ <data name="PlatformNotSupported_ReflectionOnly" xml:space="preserve">
+ <value>ReflectionOnly loading is not supported on this platform.</value>
+ </data>
+ <data name="PlatformNotSupported_Remoting" xml:space="preserve">
+ <value>Remoting is not supported on this platform.</value>
+ </data>
+ <data name="PlatformNotSupported_SecureBinarySerialization" xml:space="preserve">
+ <value>Secure binary serialization is not supported on this platform.</value>
+ </data>
+ <data name="PlatformNotSupported_StrongNameSigning" xml:space="preserve">
+ <value>Strong-name signing is not supported on this platform.</value>
+ </data>
+ <data name="PlatformNotSupported_WinRT" xml:space="preserve">
+ <value>Windows Runtime is not supported on this operating system.</value>
+ </data>
+ <data name="Policy_CannotLoadSemiTrustAssembliesDuringInit" xml:space="preserve">
+ <value>All assemblies loaded as part of AppDomain initialization must be fully trusted.</value>
+ </data>
+ <data name="PostconditionFailed" xml:space="preserve">
+ <value>Postcondition failed.</value>
+ </data>
+ <data name="PostconditionFailed_Cnd" xml:space="preserve">
+ <value>Postcondition failed: {0}</value>
+ </data>
+ <data name="PostconditionOnExceptionFailed" xml:space="preserve">
+ <value>Postcondition failed after throwing an exception.</value>
+ </data>
+ <data name="PostconditionOnExceptionFailed_Cnd" xml:space="preserve">
+ <value>Postcondition failed after throwing an exception: {0}</value>
+ </data>
+ <data name="PreconditionFailed" xml:space="preserve">
+ <value>Precondition failed.</value>
+ </data>
+ <data name="PreconditionFailed_Cnd" xml:space="preserve">
+ <value>Precondition failed: {0}</value>
+ </data>
+ <data name="Rank_MultiDimNotSupported" xml:space="preserve">
+ <value>Only single dimension arrays are supported here.</value>
+ </data>
+ <data name="Rank_MustMatch" xml:space="preserve">
+ <value>The specified arrays must have the same number of dimensions.</value>
+ </data>
+ <data name="ReflectionTypeLoad_LoadFailed" xml:space="preserve">
+ <value>Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.</value>
+ </data>
+ <data name="Remoting_AppDomainUnloaded_ThreadUnwound" xml:space="preserve">
+ <value>The application domain in which the thread was running has been unloaded.</value>
+ </data>
+ <data name="ResourceReaderIsClosed" xml:space="preserve">
+ <value>ResourceReader is closed.</value>
+ </data>
+ <data name="Resources_StreamNotValid" xml:space="preserve">
+ <value>Stream is not a valid resource file.</value>
+ </data>
+ <data name="RFLCT_AmbigCust" xml:space="preserve">
+ <value>Multiple custom attributes of the same type found.</value>
+ </data>
+ <data name="RFLCT_Ambiguous" xml:space="preserve">
+ <value>Ambiguous match found.</value>
+ </data>
+ <data name="InvalidFilterCriteriaException_CritInt" xml:space="preserve">
+ <value>An Int32 must be provided for the filter criteria.</value>
+ </data>
+ <data name="InvalidFilterCriteriaException_CritString" xml:space="preserve">
+ <value>A String must be provided for the filter criteria.</value>
+ </data>
+ <data name="RFLCT_InvalidFieldFail" xml:space="preserve">
+ <value>'{0}' field specified was not found.</value>
+ </data>
+ <data name="RFLCT_InvalidPropFail" xml:space="preserve">
+ <value>'{0}' property specified was not found.</value>
+ </data>
+ <data name="RFLCT_Targ_ITargMismatch" xml:space="preserve">
+ <value>Object does not match target type.</value>
+ </data>
+ <data name="RFLCT_Targ_StatFldReqTarg" xml:space="preserve">
+ <value>Non-static field requires a target.</value>
+ </data>
+ <data name="RFLCT_Targ_StatMethReqTarg" xml:space="preserve">
+ <value>Non-static method requires a target.</value>
+ </data>
+ <data name="RuntimeWrappedException" xml:space="preserve">
+ <value>An object that does not derive from System.Exception has been wrapped in a RuntimeWrappedException.</value>
+ </data>
+ <data name="Security_CannotReadFileData" xml:space="preserve">
+ <value>The time zone ID '{0}' was found on the local computer, but the application does not have permission to read the file.</value>
+ </data>
+ <data name="Security_CannotReadRegistryData" xml:space="preserve">
+ <value>The time zone ID '{0}' was found on the local computer, but the application does not have permission to read the registry information.</value>
+ </data>
+ <data name="Security_RegistryPermission" xml:space="preserve">
+ <value>Requested registry access is not allowed.</value>
+ </data>
+ <data name="SemaphoreSlim_ctor_InitialCountWrong" xml:space="preserve">
+ <value>The initialCount argument must be non-negative and less than or equal to the maximumCount.</value>
+ </data>
+ <data name="SemaphoreSlim_ctor_MaxCountWrong" xml:space="preserve">
+ <value>The maximumCount argument must be a positive number. If a maximum is not required, use the constructor without a maxCount parameter.</value>
+ </data>
+ <data name="SemaphoreSlim_Disposed" xml:space="preserve">
+ <value>The semaphore has been disposed.</value>
+ </data>
+ <data name="SemaphoreSlim_Release_CountWrong" xml:space="preserve">
+ <value>The releaseCount argument must be greater than zero.</value>
+ </data>
+ <data name="SemaphoreSlim_Wait_TimeoutWrong" xml:space="preserve">
+ <value>The timeout must represent a value between -1 and Int32.MaxValue, inclusive.</value>
+ </data>
+ <data name="Serialization_BadParameterInfo" xml:space="preserve">
+ <value>Non existent ParameterInfo. Position bigger than member's parameters length.</value>
+ </data>
+ <data name="Serialization_CorruptField" xml:space="preserve">
+ <value>The value of the field '{0}' is invalid. The serialized data is corrupt.</value>
+ </data>
+ <data name="Serialization_DateTimeTicksOutOfRange" xml:space="preserve">
+ <value>Invalid serialized DateTime data. Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.</value>
+ </data>
+ <data name="Serialization_InsufficientDeserializationState" xml:space="preserve">
+ <value>Insufficient state to deserialize the object. Missing field '{0}'. More information is needed.</value>
+ </data>
+ <data name="Serialization_InsufficientState" xml:space="preserve">
+ <value>Insufficient state to return the real object.</value>
+ </data>
+ <data name="Serialization_InvalidData" xml:space="preserve">
+ <value>An error occurred while deserializing the object. The serialized data is corrupt.</value>
+ </data>
+ <data name="Serialization_InvalidDelegateType" xml:space="preserve">
+ <value>Cannot serialize delegates over unmanaged function pointers, dynamic methods or methods outside the delegate creator's assembly.</value>
+ </data>
+ <data name="Serialization_InvalidEscapeSequence" xml:space="preserve">
+ <value>The serialized data contained an invalid escape sequence '\\{0}'.</value>
+ </data>
+ <data name="Serialization_InvalidFieldState" xml:space="preserve">
+ <value>Object fields may not be properly initialized.</value>
+ </data>
+ <data name="Serialization_InvalidOnDeser" xml:space="preserve">
+ <value>OnDeserialization method was called while the object was not being deserialized.</value>
+ </data>
+ <data name="Serialization_InvalidPtrValue" xml:space="preserve">
+ <value>An IntPtr or UIntPtr with an eight byte value cannot be deserialized on a machine with a four byte word size.</value>
+ </data>
+ <data name="Serialization_InvalidType" xml:space="preserve">
+ <value>Only system-provided types can be passed to the GetUninitializedObject method. '{0}' is not a valid instance of a type.</value>
+ </data>
+ <data name="Serialization_KeyValueDifferentSizes" xml:space="preserve">
+ <value>The keys and values arrays have different sizes.</value>
+ </data>
+ <data name="Serialization_MemberOutOfRange" xml:space="preserve">
+ <value>The deserialized value of the member "{0}" in the class "{1}" is out of range.</value>
+ </data>
+ <data name="Serialization_MemberTypeNotRecognized" xml:space="preserve">
+ <value>Unknown member type.</value>
+ </data>
+ <data name="Serialization_MissField" xml:space="preserve">
+ <value>Field {0} is missing.</value>
+ </data>
+ <data name="Serialization_MissingDateTimeData" xml:space="preserve">
+ <value>Invalid serialized DateTime data. Unable to find 'ticks' or 'dateData'.</value>
+ </data>
+ <data name="Serialization_MissingKeys" xml:space="preserve">
+ <value>The Keys for this Hashtable are missing.</value>
+ </data>
+ <data name="Serialization_MissingValues" xml:space="preserve">
+ <value>The values for this dictionary are missing.</value>
+ </data>
+ <data name="Serialization_NonSerType" xml:space="preserve">
+ <value>Type '{0}' in Assembly '{1}' is not marked as serializable.</value>
+ </data>
+ <data name="Serialization_NoParameterInfo" xml:space="preserve">
+ <value>Serialized member does not have a ParameterInfo.</value>
+ </data>
+ <data name="Serialization_NotFound" xml:space="preserve">
+ <value>Member '{0}' was not found.</value>
+ </data>
+ <data name="Serialization_NullKey" xml:space="preserve">
+ <value>One of the serialized keys is null.</value>
+ </data>
+ <data name="Serialization_NullSignature" xml:space="preserve">
+ <value>The method signature cannot be null.</value>
+ </data>
+ <data name="Serialization_OptionalFieldVersionValue" xml:space="preserve">
+ <value>Version value must be positive.</value>
+ </data>
+ <data name="Serialization_SameNameTwice" xml:space="preserve">
+ <value>Cannot add the same member twice to a SerializationInfo object.</value>
+ </data>
+ <data name="Serialization_StringBuilderCapacity" xml:space="preserve">
+ <value>The serialized Capacity property of StringBuilder must be positive, less than or equal to MaxCapacity and greater than or equal to the String length.</value>
+ </data>
+ <data name="Serialization_StringBuilderMaxCapacity" xml:space="preserve">
+ <value>The serialized MaxCapacity property of StringBuilder must be positive and greater than or equal to the String length.</value>
+ </data>
+ <data name="Serialization_UnableToFindModule" xml:space="preserve">
+ <value>The given module {0} cannot be found within the assembly {1}.</value>
+ </data>
+ <data name="Serialization_UnknownMember" xml:space="preserve">
+ <value>Cannot get the member '{0}'.</value>
+ </data>
+ <data name="SpinLock_Exit_SynchronizationLockException" xml:space="preserve">
+ <value>The calling thread does not hold the lock.</value>
+ </data>
+ <data name="SpinLock_IsHeldByCurrentThread" xml:space="preserve">
+ <value>Thread tracking is disabled.</value>
+ </data>
+ <data name="SpinLock_TryEnter_ArgumentOutOfRange" xml:space="preserve">
+ <value>The timeout must be a value between -1 and Int32.MaxValue, inclusive.</value>
+ </data>
+ <data name="SpinLock_TryEnter_LockRecursionException" xml:space="preserve">
+ <value>The calling thread already holds the lock.</value>
+ </data>
+ <data name="SpinLock_TryReliableEnter_ArgumentException" xml:space="preserve">
+ <value>The tookLock argument must be set to false before calling this method.</value>
+ </data>
+ <data name="SpinWait_SpinUntil_ArgumentNull" xml:space="preserve">
+ <value>The condition argument is null.</value>
+ </data>
+ <data name="SpinWait_SpinUntil_TimeoutWrong" xml:space="preserve">
+ <value>The timeout must represent a value between -1 and Int32.MaxValue, inclusive.</value>
+ </data>
+ <data name="StackTrace_InFileLineNumber" xml:space="preserve">
+ <value>in {0}:line {1}</value>
+ </data>
+ <data name="Task_ContinueWith_ESandLR" xml:space="preserve">
+ <value>The specified TaskContinuationOptions combined LongRunning and ExecuteSynchronously. Synchronous continuations should not be long running.</value>
+ </data>
+ <data name="Task_ContinueWith_NotOnAnything" xml:space="preserve">
+ <value>The specified TaskContinuationOptions excluded all continuation kinds.</value>
+ </data>
+ <data name="Task_Delay_InvalidDelay" xml:space="preserve">
+ <value>The value needs to translate in milliseconds to -1 (signifying an infinite timeout), 0 or a positive integer less than or equal to Int32.MaxValue.</value>
+ </data>
+ <data name="Task_Delay_InvalidMillisecondsDelay" xml:space="preserve">
+ <value>The value needs to be either -1 (signifying an infinite timeout), 0 or a positive integer.</value>
+ </data>
+ <data name="Task_Dispose_NotCompleted" xml:space="preserve">
+ <value>A task may only be disposed if it is in a completion state (RanToCompletion, Faulted or Canceled).</value>
+ </data>
+ <data name="Task_FromAsync_LongRunning" xml:space="preserve">
+ <value>It is invalid to specify TaskCreationOptions.LongRunning in calls to FromAsync.</value>
+ </data>
+ <data name="Task_FromAsync_PreferFairness" xml:space="preserve">
+ <value>It is invalid to specify TaskCreationOptions.PreferFairness in calls to FromAsync.</value>
+ </data>
+ <data name="Task_MultiTaskContinuation_EmptyTaskList" xml:space="preserve">
+ <value>The tasks argument contains no tasks.</value>
+ </data>
+ <data name="Task_MultiTaskContinuation_FireOptions" xml:space="preserve">
+ <value>It is invalid to exclude specific continuation kinds for continuations off of multiple tasks.</value>
+ </data>
+ <data name="Task_MultiTaskContinuation_NullTask" xml:space="preserve">
+ <value>The tasks argument included a null value.</value>
+ </data>
+ <data name="Task_RunSynchronously_AlreadyStarted" xml:space="preserve">
+ <value>RunSynchronously may not be called on a task that was already started.</value>
+ </data>
+ <data name="Task_RunSynchronously_Continuation" xml:space="preserve">
+ <value>RunSynchronously may not be called on a continuation task.</value>
+ </data>
+ <data name="Task_RunSynchronously_Promise" xml:space="preserve">
+ <value>RunSynchronously may not be called on a task not bound to a delegate, such as the task returned from an asynchronous method.</value>
+ </data>
+ <data name="Task_RunSynchronously_TaskCompleted" xml:space="preserve">
+ <value>RunSynchronously may not be called on a task that has already completed.</value>
+ </data>
+ <data name="Task_Start_AlreadyStarted" xml:space="preserve">
+ <value>Start may not be called on a task that was already started.</value>
+ </data>
+ <data name="Task_Start_ContinuationTask" xml:space="preserve">
+ <value>Start may not be called on a continuation task.</value>
+ </data>
+ <data name="Task_Start_Promise" xml:space="preserve">
+ <value>Start may not be called on a promise-style task.</value>
+ </data>
+ <data name="Task_Start_TaskCompleted" xml:space="preserve">
+ <value>Start may not be called on a task that has completed.</value>
+ </data>
+ <data name="Task_ThrowIfDisposed" xml:space="preserve">
+ <value>The task has been disposed.</value>
+ </data>
+ <data name="Task_WaitMulti_NullTask" xml:space="preserve">
+ <value>The tasks array included at least one null element.</value>
+ </data>
+ <data name="TaskCanceledException_ctor_DefaultMessage" xml:space="preserve">
+ <value>A task was canceled.</value>
+ </data>
+ <data name="TaskCompletionSourceT_TrySetException_NoExceptions" xml:space="preserve">
+ <value>The exceptions collection was empty.</value>
+ </data>
+ <data name="TaskCompletionSourceT_TrySetException_NullException" xml:space="preserve">
+ <value>The exceptions collection included at least one null element.</value>
+ </data>
+ <data name="TaskExceptionHolder_UnhandledException" xml:space="preserve">
+ <value>A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.</value>
+ </data>
+ <data name="TaskExceptionHolder_UnknownExceptionType" xml:space="preserve">
+ <value>(Internal)Expected an Exception or an IEnumerable&lt;Exception&gt;</value>
+ </data>
+ <data name="TaskScheduler_ExecuteTask_WrongTaskScheduler" xml:space="preserve">
+ <value>ExecuteTask may not be called for a task which was previously queued to a different TaskScheduler.</value>
+ </data>
+ <data name="TaskScheduler_FromCurrentSynchronizationContext_NoCurrent" xml:space="preserve">
+ <value>The current SynchronizationContext may not be used as a TaskScheduler.</value>
+ </data>
+ <data name="TaskScheduler_InconsistentStateAfterTryExecuteTaskInline" xml:space="preserve">
+ <value>The TryExecuteTaskInline call to the underlying scheduler succeeded, but the task body was not invoked.</value>
+ </data>
+ <data name="TaskSchedulerException_ctor_DefaultMessage" xml:space="preserve">
+ <value>An exception was thrown by a TaskScheduler.</value>
+ </data>
+ <data name="TaskT_DebuggerNoResult" xml:space="preserve">
+ <value>{Not yet computed}</value>
+ </data>
+ <data name="TaskT_TransitionToFinal_AlreadyCompleted" xml:space="preserve">
+ <value>An attempt was made to transition a task to a final state when it had already completed.</value>
+ </data>
+ <data name="Threading_AbandonedMutexException" xml:space="preserve">
+ <value>The wait completed due to an abandoned mutex.</value>
+ </data>
+ <data name="Threading_WaitHandleCannotBeOpenedException" xml:space="preserve">
+ <value>No handle of the given name exists.</value>
+ </data>
+ <data name="Threading_WaitHandleCannotBeOpenedException_InvalidHandle" xml:space="preserve">
+ <value>A WaitHandle with system-wide name '{0}' cannot be created. A WaitHandle of a different type might have the same name.</value>
+ </data>
+ <data name="Threading_WaitHandleTooManyPosts" xml:space="preserve">
+ <value>The WaitHandle cannot be signaled because it would exceed its maximum count.</value>
+ </data>
+ <data name="Threading_SemaphoreFullException" xml:space="preserve">
+ <value>Adding the specified count to the semaphore would cause it to exceed its maximum count.</value>
+ </data>
+ <data name="ThreadLocal_Disposed" xml:space="preserve">
+ <value>The ThreadLocal object has been disposed.</value>
+ </data>
+ <data name="ThreadLocal_Value_RecursiveCallsToValue" xml:space="preserve">
+ <value>ValueFactory attempted to access the Value property of this instance.</value>
+ </data>
+ <data name="ThreadLocal_ValuesNotAvailable" xml:space="preserve">
+ <value>The ThreadLocal object is not tracking values. To use the Values property, use a ThreadLocal constructor that accepts the trackAllValues parameter and set the parameter to true.</value>
+ </data>
+ <data name="TimeZoneNotFound_MissingData" xml:space="preserve">
+ <value>The time zone ID '{0}' was not found on the local computer.</value>
+ </data>
+ <data name="TypeInitialization_Default" xml:space="preserve">
+ <value>Type constructor threw an exception.</value>
+ </data>
+ <data name="TypeInitialization_Type" xml:space="preserve">
+ <value>The type initializer for '{0}' threw an exception.</value>
+ </data>
+ <data name="TypeLoad_ResolveNestedType" xml:space="preserve">
+ <value>Could not resolve nested type '{0}' in type "{1}'.</value>
+ </data>
+ <data name="TypeLoad_ResolveType" xml:space="preserve">
+ <value>Could not resolve type '{0}'.</value>
+ </data>
+ <data name="TypeLoad_ResolveTypeFromAssembly" xml:space="preserve">
+ <value>Could not resolve type '{0}' in assembly '{1}'.</value>
+ </data>
+ <data name="UnauthorizedAccess_IODenied_NoPathName" xml:space="preserve">
+ <value>Access to the path is denied.</value>
+ </data>
+ <data name="UnauthorizedAccess_IODenied_Path" xml:space="preserve">
+ <value>Access to the path '{0}' is denied.</value>
+ </data>
+ <data name="UnauthorizedAccess_MemStreamBuffer" xml:space="preserve">
+ <value>MemoryStream's internal buffer cannot be accessed.</value>
+ </data>
+ <data name="UnauthorizedAccess_RegistryKeyGeneric_Key" xml:space="preserve">
+ <value>Access to the registry key '{0}' is denied.</value>
+ </data>
+ <data name="UnauthorizedAccess_RegistryNoWrite" xml:space="preserve">
+ <value>Cannot write to the registry key.</value>
+ </data>
+ <data name="UnauthorizedAccess_SystemDomain" xml:space="preserve">
+ <value>Cannot execute an assembly in the system domain.</value>
+ </data>
+ <data name="UnknownError_Num" xml:space="preserve">
+ <value>Unknown error "{0}".</value>
+ </data>
+ <data name="Verification_Exception" xml:space="preserve">
+ <value>Operation could destabilize the runtime.</value>
+ </data>
+ <data name="Word_At" xml:space="preserve">
+ <value>at</value>
+ </data>
+ <data name="DebugAssertBanner" xml:space="preserve">
+ <value>---- DEBUG ASSERTION FAILED ----</value>
+ </data>
+ <data name="DebugAssertLongMessage" xml:space="preserve">
+ <value>---- Assert Long Message ----</value>
+ </data>
+ <data name="DebugAssertShortMessage" xml:space="preserve">
+ <value>---- Assert Short Message ----</value>
+ </data>
+</root>
diff --git a/src/mscorlib/System.Private.CoreLib.csproj b/src/mscorlib/System.Private.CoreLib.csproj
index cf14056cd0..2153d7899c 100644
--- a/src/mscorlib/System.Private.CoreLib.csproj
+++ b/src/mscorlib/System.Private.CoreLib.csproj
@@ -39,6 +39,7 @@
the GenerateReferenceAssemblyPaths task (not target) and to prevent it from outputting a warning (MSB3644). -->
<_TargetFrameworkDirectories>$(MSBuildThisFileDirectory)/Documentation</_TargetFrameworkDirectories>
<_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory)/Documentation</_FullFrameworkReferenceAssemblyPaths>
+ <SkipCommonResourcesIncludes>true</SkipCommonResourcesIncludes>
</PropertyGroup>
<!-- Add Serviceable attribute to the project's metadata -->
<ItemGroup>
@@ -81,10 +82,9 @@
<DebugType>pdbOnly</DebugType>
<DefineConstants>TRACE;$(DefineConstants)</DefineConstants>
</PropertyGroup>
- <!-- Roslyn does not support writing PDBs on Unix -->
+ <!-- Make portable PDBs on Unix -->
<PropertyGroup Condition="'$(OsEnvironment)' == 'Unix'">
- <DebugSymbols>false</DebugSymbols>
- <DebugType>none</DebugType>
+ <DebugType>portable</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetsOSX)' == 'true'">
@@ -97,6 +97,7 @@
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<MajorVersion>4</MajorVersion>
<MinorVersion>6</MinorVersion>
+ <ExcludeAssemblyInfoPartialFile>true</ExcludeAssemblyInfoPartialFile>
</PropertyGroup>
<ItemGroup>
<AssemblyInfoLines Include="[assembly: System.Resources.SatelliteContractVersion(&quot;$(AssemblyVersion)&quot;)]" />
@@ -131,26 +132,19 @@
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\CompilerGeneratedAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\CustomConstantAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\DateTimeConstantAttribute.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\DiscardableAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\DecimalConstantAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\DisablePrivateReflectionAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\CompilationRelaxations.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\CompilerGlobalScopeAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\FixedBufferAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\IndexerNameAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\InternalsVisibleToAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\MethodImplAttribute.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\FixedAddressValueTypeAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\UnsafeValueTypeAttribute.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\AssemblySettingAttributes.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\TypeDependencyAttribute.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\CompilerMarshalOverride.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\jithelpers.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\Unsafe.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\SpecialNameAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\SuppressMergeCheckAttribute.cs" />
<Compile Condition="'$(FeatureICastable)' == 'true'" Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\ICastable.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\SuppressIldasmAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\TypeForwardedToAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\TypeForwardedFromAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\ReferenceAssemblyAttribute.cs" />
@@ -178,7 +172,6 @@
<Compile Include="$(BclSourcesRoot)\System\Runtime\GcSettings.cs" />
</ItemGroup>
<ItemGroup>
- <Compile Include="$(BclSourcesRoot)\System\Collections\CollectionBase.cs" />
<Compile Include="$(BclSourcesRoot)\System\Collections\ArrayList.cs" />
<Compile Include="$(BclSourcesRoot)\System\Collections\Comparer.cs" />
<Compile Include="$(BclSourcesRoot)\System\Collections\CompatibleComparer.cs" />
@@ -186,7 +179,6 @@
<Compile Include="$(BclSourcesRoot)\System\Collections\EmptyReadOnlyDictionaryInternal.cs" />
<Compile Include="$(BclSourcesRoot)\System\Collections\Hashtable.cs" />
<Compile Include="$(BclSourcesRoot)\System\Collections\IHashCodeProvider.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Collections\StructuralComparisons.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\ArrayWithOffset.cs" />
@@ -318,8 +310,7 @@
<Compile Include="$(BclSourcesRoot)\System\AppContext\AppContextDefaultValues.CoreClrOverrides.cs" />
<Compile Include="$(BclSourcesRoot)\System\AppContext\AppContextDefaultValues.Defaults.cs" />
<Compile Include="$(BclSourcesRoot)\System\AppContext\AppContextDefaultValues.Defaults.Central.cs" />
- <Compile Include="$(BclSourcesRoot)\System\CurrentTimeZone.cs" />
- <Compile Include="$(BclSourcesRoot)\System\TimeZone.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\CurrentSystemTimeZone.Cache.cs" />
<Compile Include="$(BclSourcesRoot)\System\Object.cs" />
<Compile Include="$(BclSourcesRoot)\System\ICloneable.cs" />
<Compile Include="$(BclSourcesRoot)\System\Array.cs" />
@@ -330,17 +321,13 @@
<Compile Include="$(BclSourcesRoot)\System\String.Comparison.cs" />
<Compile Include="$(BclSourcesRoot)\System\String.Manipulation.cs" />
<Compile Include="$(BclSourcesRoot)\System\String.Searching.cs" />
- <Compile Include="$(BclSourcesRoot)\System\StringComparer.cs" />
- <Compile Include="$(BclSourcesRoot)\System\StringComparison.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Text\StringBuilder.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Text\StringBuilder.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\Text\StringBuilderCache.cs" />
<Compile Include="$(BclSourcesRoot)\System\Exception.cs" />
- <Compile Include="$(BclSourcesRoot)\System\DateTime.cs" />
- <Compile Include="$(BclSourcesRoot)\System\DateTimeOffset.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\DateTime.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\OutOfMemoryException.cs" />
<Compile Include="$(BclSourcesRoot)\System\Delegate.cs" />
<Compile Include="$(BclSourcesRoot)\System\MulticastDelegate.cs" />
- <Compile Include="$(BclSourcesRoot)\System\__Filters.cs" />
<Compile Include="$(BclSourcesRoot)\System\__HResults.cs" />
<Compile Include="$(BclSourcesRoot)\System\BCLDebug.cs" />
<Compile Include="$(BclSourcesRoot)\System\Activator.cs" />
@@ -360,16 +347,10 @@
<Compile Include="$(BclSourcesRoot)\System\Boolean.cs" />
<Compile Include="$(BclSourcesRoot)\System\Buffer.cs" />
<Compile Include="$(BclSourcesRoot)\System\Byte.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Char.cs" />
- <Compile Include="$(BclSourcesRoot)\System\TypeUnloadedException.cs" />
<Compile Include="$(BclSourcesRoot)\System\CompatibilitySwitches.cs" />
- <Compile Include="$(BclSourcesRoot)\System\LowLevelConsole.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Convert.cs" />
- <Compile Include="$(BclSourcesRoot)\System\StringFreezingAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Currency.cs" />
- <Compile Include="$(BclSourcesRoot)\System\DBNull.cs" />
<Compile Include="$(BclSourcesRoot)\System\Decimal.cs" />
- <Compile Include="$(BclSourcesRoot)\System\DefaultBinder.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\DefaultBinder.CanConvert.cs" />
<Compile Include="$(BclSourcesRoot)\System\DelegateSerializationHolder.cs" />
<Compile Include="$(BclSourcesRoot)\System\Double.cs" />
<Compile Include="$(BclSourcesRoot)\System\Empty.cs" />
@@ -384,7 +365,6 @@
<Compile Include="$(BclSourcesRoot)\System\Int64.cs" />
<Compile Include="$(BclSourcesRoot)\System\IntPtr.cs" />
<Compile Include="$(BclSourcesRoot)\System\Internal.cs" />
- <Compile Include="$(BclSourcesRoot)\System\IServiceObjectProvider.cs" />
<Compile Include="$(BclSourcesRoot)\System\Math.cs" />
<Compile Include="$(BclSourcesRoot)\System\MathF.cs" />
<Compile Include="$(BclSourcesRoot)\System\mda.cs" />
@@ -414,7 +394,7 @@
<Compile Include="$(BclSourcesRoot)\System\TimeZoneInfo.cs" />
<Compile Include="$(BclSourcesRoot)\System\TimeZoneInfo.StringSerializer.cs" />
<Compile Include="$(BclSourcesRoot)\System\TimeZoneInfo.TransitionTime.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Type.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Type.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\TypeNameParser.cs" />
<Compile Include="$(BclSourcesRoot)\System\TypedReference.cs" />
<Compile Include="$(BclSourcesRoot)\System\TypeLoadException.cs" />
@@ -422,7 +402,6 @@
<Compile Include="$(BclSourcesRoot)\System\UInt32.cs" />
<Compile Include="$(BclSourcesRoot)\System\UInt64.cs" />
<Compile Include="$(BclSourcesRoot)\System\UIntPtr.cs" />
- <Compile Include="$(BclSourcesRoot)\System\UnitySerializationHolder.cs" />
<Compile Include="$(BclSourcesRoot)\System\ValueType.cs" />
<Compile Include="$(BclSourcesRoot)\System\Version.cs" />
<Compile Include="$(BclSourcesRoot)\System\WeakReference.cs" />
@@ -445,66 +424,36 @@
<ItemGroup>
<Compile Include="$(BclSourcesRoot)\Internal\Runtime\Augments\EnvironmentAugments.cs" />
<Compile Include="$(BclSourcesRoot)\Internal\Runtime\Augments\RuntimeThread.cs" />
+ <Compile Include="$(BclSourcesRoot)\Internal\Console.cs" />
</ItemGroup>
<ItemGroup>
- <Compile Include="$(BclSourcesRoot)\System\Reflection\__Filters.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\AmbiguousMatchException.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\Assembly.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\AssemblyAttributes.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\Assembly.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\AssemblyName.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\AssemblyNameFlags.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Associates.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\CustomAttributeExtensions.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\CustomAttributeFormatException.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\Binder.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\BindingFlags.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\CallingConventions.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\ConstructorInfo.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\ConstructorInfo.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\CustomAttribute.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\DefaultMemberAttribute.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\EventAttributes.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\EventInfo.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\FieldAttributes.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\FieldInfo.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\GenericParameterAttributes.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\ICustomAttributeProvider.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\IReflectableType.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\IntrospectionExtensions.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeReflectionExtensions.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\InterfaceMapping.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\InvalidFilterCriteriaException.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\IReflect.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\ExceptionHandlingClause.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\FieldInfo.CoreCLR.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\INVOCATION_FLAGS.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\LoaderAllocator.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\ManifestResourceInfo.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\LocalVariableInfo.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\MdConstant.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\MdFieldInfo.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\MdImport.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\MemberFilter.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\MemberInfo.Internal.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\MemberInfoSerializationHolder.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\MemberTypes.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\MethodAttributes.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\MethodBase.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\MethodImplAttributes.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\MethodInfo.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\Missing.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\Module.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\MemberSerializationStringGenerator.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\MethodBase.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\MethodBody.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\ParameterAttributes.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\ParameterInfo.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\ParameterModifier.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\Pointer.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\PropertyAttributes.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\PropertyInfo.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\ReflectionContext.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\ReflectionTypeLoadException.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\ResourceAttributes.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\StrongNameKeyPair.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\TargetException.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\TargetInvocationException.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\TargetParameterCountException.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\TypeAttributes.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\TypeFilter.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Reflection\TypeInfo.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\RtFieldInfo.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeAssembly.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeConstructorInfo.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeEventInfo.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeFieldInfo.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeMethodInfo.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeModule.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeParameterInfo.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimePropertyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(BclSourcesRoot)\System\Reflection\Emit\AssemblyBuilder.cs" />
@@ -557,56 +506,25 @@
<ItemGroup>
<Compile Include="$(BclSourcesRoot)\System\Globalization\BidiCategory.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\Calendar.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\CalendarAlgorithmType.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\CalendarData.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\CalendarWeekRule.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\CalendricalCalculationsHelper.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\CharUnicodeInfo.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\CharUnicodeInfoData.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\ChineseLunisolarCalendar.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\CompareInfo.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Globalization\CompareInfo.Invariant.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\CultureData.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\CultureInfo.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\CultureNotFoundException.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\CultureTypes.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\DaylightTime.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\DateTimeFormat.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\DateTimeFormatInfo.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\DateTimeFormatInfoScanner.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\DateTimeParse.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\DateTimeStyles.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\DigitShapes.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\EastAsianLunisolarCalendar.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Globalization\GlobalizationMode.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\GregorianCalendar.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\GregorianCalendarHelper.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\GregorianCalendarTypes.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\HebrewCalendar.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\HebrewNumber.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\HijriCalendar.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\IdnMapping.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\InternalGlobalizationHelper.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\JapaneseCalendar.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\JapaneseLunisolarCalendar.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\JulianCalendar.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\KoreanCalendar.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\KoreanLunisolarCalendar.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\NumberFormatInfo.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\NumberStyles.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\PersianCalendar.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\RegionInfo.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\SortKey.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\SortVersion.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\StringInfo.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\TaiwanCalendar.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\TaiwanLunisolarCalendar.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\TextElementEnumerator.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\TextInfo.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\ThaiBuddhistCalendar.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\TimeSpanFormat.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\TimeSpanParse.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\UmAlQuraCalendar.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\UnicodeCategory.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\TimeSpanStyles.cs" />
</ItemGroup>
<ItemGroup Condition="'$(FeatureCoreFxGlobalization)' != 'true'">
<Compile Include="$(BclSourcesRoot)\System\Globalization\EncodingDataItem.cs" />
@@ -618,6 +536,7 @@
<Compile Include="$(BclSourcesRoot)\System\Globalization\CompareInfo.Unix.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\CultureData.Unix.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\CultureInfo.Unix.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Globalization\GlobalizationMode.Unix.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\TextInfo.Unix.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetsUnix)' != 'true'">
@@ -625,31 +544,21 @@
<Compile Include="$(BclSourcesRoot)\System\Globalization\CompareInfo.Windows.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\CultureData.Windows.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\CultureInfo.Windows.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Globalization\GlobalizationMode.Windows.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\HijriCalendar.Win32.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\IdnMapping.Windows.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\JapaneseCalendar.Win32.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\TextInfo.Windows.cs" />
</ItemGroup>
- <ItemGroup>
- <Compile Include="$(BclSourcesRoot)\SR.cs" />
- </ItemGroup>
- <ItemGroup Condition="'$(FeatureCoreFxGlobalization)' == 'true' and '$(TargetsUnix)' == 'true'">
+ <ItemGroup Condition="'$(TargetsUnix)' == 'true'">
<Compile Include="$(BclSourcesRoot)\System\Globalization\EncodingTable.Unix.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\EncodingDataItem.Unix.cs" />
<Compile Include="$(BclSourcesRoot)\System\Text\Normalization.Unix.cs" />
- <Compile Include="$(BclSourcesRoot)\Interop\Unix\System.Globalization.Native\Interop.Calendar.cs" />
- <Compile Include="$(BclSourcesRoot)\Interop\Unix\System.Globalization.Native\Interop.Casing.cs" />
<Compile Include="$(BclSourcesRoot)\Interop\Unix\System.Globalization.Native\Interop.Collation.cs" />
- <Compile Include="$(BclSourcesRoot)\Interop\Unix\System.Globalization.Native\Interop.Idna.cs" />
- <Compile Include="$(BclSourcesRoot)\Interop\Unix\System.Globalization.Native\Interop.Locale.cs" />
- <Compile Include="$(BclSourcesRoot)\Interop\Unix\System.Globalization.Native\Interop.Normalization.cs" />
- <Compile Include="$(BclSourcesRoot)\Interop\Unix\System.Globalization.Native\Interop.ResultCode.cs" />
- <Compile Include="$(BclSourcesRoot)\Interop\Unix\System.Globalization.Native\Interop.TimeZoneInfo.cs" />
- <Compile Include="$(BclSourcesRoot)\Interop\Unix\System.Globalization.Native\Interop.Utils.cs" />
+ <Compile Include="$(BclSourcesRoot)\Interop\Unix\System.Globalization.Native\Interop.ICU.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\HijriCalendar.Unix.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\IdnMapping.Unix.cs" />
<Compile Include="$(BclSourcesRoot)\System\Globalization\JapaneseCalendar.Unix.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Globalization\LocaleData.Unix.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(BclSourcesRoot)\System\Threading\AbandonedMutexException.cs" />
@@ -686,7 +595,6 @@
<Compile Include="$(BclSourcesRoot)\System\Threading\ApartmentState.cs" />
<Compile Include="$(BclSourcesRoot)\System\Threading\SpinLock.cs" />
<Compile Include="$(BclSourcesRoot)\System\Threading\SpinWait.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Threading\CountdownEvent.cs" />
<Compile Include="$(BclSourcesRoot)\System\Threading\LazyInitializer.cs" />
<Compile Include="$(BclSourcesRoot)\System\Threading\ThreadLocal.cs" />
<Compile Include="$(BclSourcesRoot)\System\Threading\SemaphoreSlim.cs" />
@@ -698,9 +606,6 @@
<Compile Include="$(BclSourcesRoot)\System\Threading\Tasks\FutureFactory.cs" />
<Compile Include="$(BclSourcesRoot)\System\Threading\Tasks\Task.cs" />
<Compile Include="$(BclSourcesRoot)\System\Threading\Tasks\TaskContinuation.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Threading\Tasks\TaskCanceledException.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Threading\Tasks\TaskExtensions.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Threading\Tasks\TaskSchedulerException.cs" />
<Compile Include="$(BclSourcesRoot)\System\Threading\Tasks\TaskExceptionHolder.cs" />
<Compile Include="$(BclSourcesRoot)\System\Threading\Tasks\TaskFactory.cs" />
<Compile Include="$(BclSourcesRoot)\System\Threading\Tasks\TaskScheduler.cs" />
@@ -744,7 +649,6 @@
<Compile Include="$(BclSourcesRoot)\System\IO\PinnedBufferMemoryStream.cs" />
<Compile Include="$(BclSourcesRoot)\System\IO\SeekOrigin.cs" />
<Compile Include="$(BclSourcesRoot)\System\IO\Stream.cs" />
- <Compile Include="$(BclSourcesRoot)\System\IO\StreamHelpers.CopyValidation.cs" />
<Compile Include="$(BclSourcesRoot)\System\IO\TextReader.cs" Condition="'$(TargetsUnix)' == 'true'" />
<Compile Include="$(BclSourcesRoot)\System\IO\StreamReader.cs" Condition="'$(TargetsUnix)' == 'true'" />
<Compile Include="$(BclSourcesRoot)\System\IO\UnmanagedMemoryAccessor.cs" />
@@ -753,8 +657,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="$(BclSourcesRoot)\System\Security\DynamicSecurityMethodAttribute.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Security\SecurityException.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Security\SecurityState.cs" />
<Compile Include="$(BclSourcesRoot)\System\Security\VerificationException.cs" />
</ItemGroup>
<ItemGroup>
@@ -765,6 +667,10 @@
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\AssertFilter.cs" />
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\AssertFilters.cs" />
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\ConditionalAttribute.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Diagnostics\Debug.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Diagnostics\Debug.Unix.cs" Condition="'$(TargetsUnix)' == 'true'" />
+ <Compile Include="$(BclSourcesRoot)\System\Diagnostics\Debug.Windows.cs" Condition="'$(TargetsUnix)' != 'true'" />
+ <Compile Include="$(BclSourcesRoot)\Interop\Windows\kernel32\Interop.OutputDebugString.cs" Condition="'$(TargetsUnix)' != 'true'" />
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\Debugger.cs" />
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\DebuggerAttributes.cs" />
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\ICustomDebuggerNotification.cs" />
@@ -926,7 +832,6 @@
<Compile Include="$(BclSourcesRoot)\System\Collections\ObjectModel\Collection.cs" />
<Compile Include="$(BclSourcesRoot)\System\Collections\ObjectModel\ReadOnlyCollection.cs" />
<Compile Include="$(BclSourcesRoot)\System\Collections\ObjectModel\ReadOnlyDictionary.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Collections\ObjectModel\KeyedCollection.cs" />
<Compile Include="$(BclSourcesRoot)\System\Collections\Concurrent\ConcurrentStack.cs" />
<Compile Include="$(BclSourcesRoot)\System\Collections\Concurrent\IProducerConsumerCollection.cs" />
<Compile Include="$(BclSourcesRoot)\System\Collections\Concurrent\ConcurrentDictionary.cs" />
@@ -948,28 +853,18 @@
<Compile Include="$(BclSourcesRoot)\Interop\Windows\Normaliz\Interop.Idna.cs" />
<Compile Include="$(BclSourcesRoot)\Interop\Windows\Normaliz\Interop.Normalization.cs" />
</ItemGroup>
- <ItemGroup>
- <Compile Include="$(BclSourcesRoot)\System\Security\SecureString.cs" />
- </ItemGroup>
<ItemGroup Condition="'$(TargetsUnix)' != 'true'">
<Compile Include="$(BclSourcesRoot)\System\Security\SafeBSTRHandle.cs" />
<Compile Include="$(BclSourcesRoot)\System\Security\SecureString.Windows.cs" />
<!-- Interop sources -->
- <Compile Include="$(BclSourcesRoot)\Interop\Windows\Crypt32\Interop.CryptProtectMemory.cs" />
<Compile Include="$(BclSourcesRoot)\Interop\Windows\NtDll\Interop.ZeroMemory.cs" />
- <Compile Include="$(BclSourcesRoot)\Interop\Windows\kernel32\Interop.WideCharToMultiByte.cs" />
<Compile Include="$(BclSourcesRoot)\Interop\Windows\oleaut32\Interop.SysAllocStringLen.cs" />
<Compile Include="$(BclSourcesRoot)\Interop\Windows\oleaut32\Interop.SysStringLen.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetsUnix)' == 'true'">
- <Compile Include="$(BclSourcesRoot)\System\Security\SecureString.Unix.cs" />
- </ItemGroup>
- <ItemGroup Condition="'$(TargetsUnix)' == 'true'">
<Compile Include="$(BclSourcesRoot)\System\HResults.cs" />
<Compile Include="$(BclSourcesRoot)\Interop\Unix\System.Native\Interop.GetRandomBytes.cs" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="$(BclSourcesRoot)\Debug.cs" />
+ <Compile Include="$(BclSourcesRoot)\Interop\Unix\System.Native\Interop.SysLog.cs" />
</ItemGroup>
<!-- Include additional sources shared files in the compilation -->
<ItemGroup>
@@ -978,6 +873,7 @@
<!-- These files are shared with other framework components and don't live the same folder as the rest of them-->
<Compile Include="$(CommonPath)\NotImplemented.cs" />
<Compile Include="$(CommonPath)\PinnableBufferCache.cs" />
+ <Compile Include="$(CommonPath)\System\SR.cs" />
<!-- Include Internals visible to file in the compilation -->
<Compile Include="$(BclSourcesRoot)\mscorlib.Friends.cs" />
<!-- TODO list of types to be cleaned up from CoreLib -->
@@ -987,13 +883,6 @@
<Compile Include="src\System\Runtime\RuntimeImports.cs" />
<Compile Include="src\System\ValueTuple.cs" />
</ItemGroup>
- <!-- Resources -->
- <ItemGroup>
- <SplitTextStringResource Include="$(BclSourcesRoot)\System.Private.CoreLib.txt">
- <ResFile>System.Private.CoreLib</ResFile>
- <ResGenDefines>$(DefineConstants)</ResGenDefines>
- </SplitTextStringResource>
- </ItemGroup>
<Import Project="shared\System.Private.CoreLib.Shared.projitems" Label="Shared" />
<PropertyGroup>
<CheckCDefines Condition="'$(CheckCDefines)'==''">true</CheckCDefines>
@@ -1013,24 +902,20 @@
<UseWin32Apis>true</UseWin32Apis>
<OSGroup>Windows_NT</OSGroup>
</PropertyGroup>
- <Import Project="$(ToolsDir)\codeAnalysis.targets" />
- <Import Project="$(ToolsDir)\Microsoft.CSharp.Targets" />
<PropertyGroup>
<StrongNameSig>Silverlight</StrongNameSig>
</PropertyGroup>
- <!-- Import signing tools -->
- <Import Condition="Exists('$(ToolsDir)\sign.targets')" Project="$(ToolsDir)\sign.targets" />
- <!-- Overwrite the key that we are going to use for signing -->
- <PropertyGroup>
- <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)Tools\Signing\mscorlib.snk</AssemblyOriginatorKeyFile>
- </PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)Tools\Versioning\GenerateVersionInfo.targets" />
- <!-- Override versioning targets -->
- <Import Condition="Exists('$(ToolsDir)versioning.targets')" Project="$(ToolsDir)versioning.targets" />
+ <!--
+ Import common targets: codeAnalysis, Microsoft.CSharp, sign, versioning, codeOptimizations, etc.
+ In doing so, override versioning targets.
+ -->
+ <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
<PropertyGroup>
+ <!-- Overwrite the key that we are going to use for signing -->
+ <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)Tools\Signing\mscorlib.snk</AssemblyOriginatorKeyFile>
<!-- Use a different nativeresource file to avoid conflicts with mscorlib-->
<Win32Resource Condition="'$(GenerateNativeVersionInfo)'=='true'">$(IntermediateOutputPath)\System.Private.CoreLib.res</Win32Resource>
</PropertyGroup>
- <Import Project="GenerateSplitStringResources.targets" />
<Import Project="GenerateCompilerResponseFile.targets" />
</Project>
diff --git a/src/mscorlib/facade/mscorlib.csproj b/src/mscorlib/facade/mscorlib.csproj
deleted file mode 100644
index 33df18304b..0000000000
--- a/src/mscorlib/facade/mscorlib.csproj
+++ /dev/null
@@ -1,115 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
-
- <PropertyGroup>
- <AssemblyName>mscorlib</AssemblyName>
- <ProjectGuid>{263342A6-FC48-4CFC-B16A-2AF964D3536C}</ProjectGuid>
- <ClsCompliant>true</ClsCompliant>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- <IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
- <OutputType>Library</OutputType>
- <ExcludeMscorlibFacade>true</ExcludeMscorlibFacade>
- <HighEntropyVA>true</HighEntropyVA>
-
- <!-- This prevents the default MsBuild targets from referencing System.Core.dll -->
- <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
- <!-- These prevent the default MsBuild targets from referencing System.dll and mscorlib.dll -->
- <NoStdLib>true</NoStdLib>
- <NoCompilerStandardLib>true</NoCompilerStandardLib>
-
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <AvailablePlatforms>amd64,x86,arm,armel,arm64</AvailablePlatforms>
- <Configuration Condition=" '$(Configuration)' == '' ">$(BuildType)</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">$(BuildArch)</Platform>
- <!-- The CLR properties use amd64 as their platform string, we want to keep in sync with those, so set Platform appropriately,
- though still use the 'x64' output path (see use of BuildArch below) -->
- <Platform Condition=" '$(Platform)' == 'x64' ">amd64</Platform>
- <Platform Condition=" '$(Platform)' == 'armel' ">arm</Platform>
-
- <!-- We want to exclude the transitive closure of the packages pulled in via project.json as that introduces ambiguity -->
- <OmitTransitiveCompileReferences>true</OmitTransitiveCompileReferences>
- <NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
-
- <!-- We don't use any of MSBuild's resolution logic for resolving the framework, so just set these two properties to any folder that exists to skip
- the GenerateReferenceAssemblyPaths task (not target) and to prevent it from outputting a warning (MSB3644). -->
- <_TargetFrameworkDirectories>$(MSBuildThisFileDirectory)/Documentation</_TargetFrameworkDirectories>
- <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory)/Documentation</_FullFrameworkReferenceAssemblyPaths>
- </PropertyGroup>
-
- <!-- Default configurations to help VS understand the options -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcore50_Debug|AnyCPU'" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcore50_Release|AnyCPU'" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcore50aot_Debug|AnyCPU'" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcore50aot_Release|AnyCPU'" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'net462_Debug|AnyCPU'" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'net462_Release|AnyCPU'" />
-
- <!-- Roslyn does not support writing PDBs on Unix -->
- <PropertyGroup Condition="'$(OsEnvironment)' == 'Unix'">
- <DebugSymbols>false</DebugSymbols>
- <DebugType>none</DebugType>
- </PropertyGroup>
-
- <!-- Output paths -->
- <PropertyGroup>
- <BaseIntermediateOutputPath>$(RootBinDir)\obj</BaseIntermediateOutputPath>
- <!-- IntermediateOutputPath must have a trailing slash, however GenFacades
- surrounds the value in quotes when passing as the '-facadepath' argument.
- To avoid escaping the trailing quote, use a forward slash. -->
- <IntermediateOutputPath>$(BaseIntermediateOutputPath)\$(BuildOS).$(BuildArch).$(Configuration)\facade/</IntermediateOutputPath>
- <OutputPath>$(BinDir)\facade</OutputPath>
- </PropertyGroup>
-
- <ItemGroup>
- <ProjectReference Include="..\System.Private.CoreLib.csproj" />
- </ItemGroup>
-
- <ItemGroup>
- <None Include="project.json" />
- </ItemGroup>
-
- <PropertyGroup>
- <StrongNameSig>Silverlight</StrongNameSig>
- </PropertyGroup>
-
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-
- <PropertyGroup>
- <!-- Overwrite the key that we are going to use for signing -->
- <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)..\Tools\Signing\mscorlib.snk</AssemblyOriginatorKeyFile>
- </PropertyGroup>
-
- <!-- the signing marker file is incorrectly named mscorlib.dll.requires_signing -->
- <Target Name="RenameSigningMarker" AfterTargets="WriteSigningRequired" Condition="Exists('$(TargetPath).requires_signing')">
- <Move SourceFiles="$(TargetPath).requires_signing" DestinationFiles="$(OutputPath)\System.Private.CoreLib.dll.requires_signing" />
- </Target>
-
- <ItemGroup>
- <SeedTypePreference Include="System.Console">
- <Assembly>System.Console</Assembly>
- </SeedTypePreference>
- <SeedTypePreference Include="System.IO.BinaryReader">
- <Assembly>System.IO</Assembly>
- </SeedTypePreference>
- <SeedTypePreference Include="System.IO.BinaryWriter">
- <Assembly>System.IO</Assembly>
- </SeedTypePreference>
- <SeedTypePreference Include="System.IO.EndOfStreamException">
- <Assembly>System.IO</Assembly>
- </SeedTypePreference>
- <SeedTypePreference Include="System.IO.MemoryStream">
- <Assembly>System.IO</Assembly>
- </SeedTypePreference>
- <SeedTypePreference Include="System.IO.SeekOrigin">
- <Assembly>System.IO</Assembly>
- </SeedTypePreference>
- <SeedTypePreference Include="System.IO.Stream">
- <Assembly>System.IO</Assembly>
- </SeedTypePreference>
- </ItemGroup>
-
-</Project>
diff --git a/src/mscorlib/facade/project.json b/src/mscorlib/facade/project.json
deleted file mode 100644
index b0b39a1264..0000000000
--- a/src/mscorlib/facade/project.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "dependencies": {
- "System.Console": "4.0.0",
- "System.IO": "4.1.0",
- "System.Security.Cryptography.Primitives": "4.0.0",
- "System.Security.Claims": "4.0.0",
- "System.Security.Principal": "4.0.0"
- },
- "frameworks": {
- "netstandard1.3": {
- "imports": [
- "dotnet5.4"
- ]
- }
- }
-} \ No newline at end of file
diff --git a/src/mscorlib/ref/mscorlib.cs b/src/mscorlib/ref/mscorlib.cs
deleted file mode 100644
index efc1e01d3f..0000000000
--- a/src/mscorlib/ref/mscorlib.cs
+++ /dev/null
@@ -1,13783 +0,0 @@
-// 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 Internal.Runtime.Augments
-{
- public static partial class EnvironmentAugments
- {
- public static int CurrentManagedThreadId { get { throw null; } }
- public static int ExitCode { get { throw null; } set { } }
- public static bool HasShutdownStarted { get { throw null; } }
- public static string StackTrace { get { throw null; } }
- public static int TickCount { get { throw null; } }
- public static void Exit(int exitCode) { }
- public static void FailFast(string message, System.Exception error) { }
- public static string[] GetCommandLineArgs() { throw null; }
- }
- public partial class RuntimeThread : System.Runtime.ConstrainedExecution.CriticalFinalizerObject
- {
- public static Internal.Runtime.Augments.RuntimeThread CurrentThread { get { throw null; } }
- public bool IsAlive { get { throw null; } }
- public bool IsBackground { get { throw null; } set { } }
- public bool IsThreadPoolThread { get { throw null; } }
- public int ManagedThreadId { get { throw null; } }
- public string Name { get { throw null; } set { } }
- public System.Threading.ThreadPriority Priority { get { throw null; } set { } }
- public System.Threading.ThreadState ThreadState { get { throw null; } }
- ~RuntimeThread() { }
- public static Internal.Runtime.Augments.RuntimeThread Create(System.Threading.ThreadStart start) { throw null; }
- public static Internal.Runtime.Augments.RuntimeThread Create(System.Threading.ThreadStart start, int maxStackSize) { throw null; }
- public static Internal.Runtime.Augments.RuntimeThread Create(System.Threading.ParameterizedThreadStart start) { throw null; }
- public static Internal.Runtime.Augments.RuntimeThread Create(System.Threading.ParameterizedThreadStart start, int maxStackSize) { throw null; }
- public System.Threading.ApartmentState GetApartmentState() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public void Interrupt() { }
- public void Join() { }
- public bool Join(int millisecondsTimeout) { throw null; }
- public static void Sleep(int millisecondsTimeout) { }
- public static void SpinWait(int iterations) { }
- public void Start() { }
- public void Start(object parameter) { }
- public bool TrySetApartmentState(System.Threading.ApartmentState state) { throw null; }
- }
-}
-namespace Microsoft.Win32.SafeHandles
-{
- [System.Security.SecurityCriticalAttribute]
- public abstract partial class CriticalHandleMinusOneIsInvalid : System.Runtime.InteropServices.CriticalHandle
- {
- protected CriticalHandleMinusOneIsInvalid() : base(default(System.IntPtr)) { }
- public override bool IsInvalid { [System.Security.SecurityCriticalAttribute]get { throw null; } }
- }
- [System.Security.SecurityCriticalAttribute]
- public abstract partial class CriticalHandleZeroOrMinusOneIsInvalid : System.Runtime.InteropServices.CriticalHandle
- {
- protected CriticalHandleZeroOrMinusOneIsInvalid() : base(default(System.IntPtr)) { }
- public override bool IsInvalid { [System.Security.SecurityCriticalAttribute]get { throw null; } }
- }
- [System.Security.SecurityCriticalAttribute]
- public sealed partial class SafeFileHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
- {
- public SafeFileHandle(System.IntPtr preexistingHandle, bool ownsHandle) : base(default(bool)) { }
- public override bool IsInvalid { [System.Security.SecurityCriticalAttribute]get { throw null; } }
- [System.Security.SecurityCriticalAttribute]
- protected override bool ReleaseHandle() { throw null; }
- }
- [System.Security.SecurityCriticalAttribute]
- public abstract partial class SafeHandleMinusOneIsInvalid : System.Runtime.InteropServices.SafeHandle
- {
- protected SafeHandleMinusOneIsInvalid(bool ownsHandle) { }
- public override bool IsInvalid { [System.Security.SecurityCriticalAttribute]get { throw null; } }
- }
- [System.Security.SecurityCriticalAttribute]
- public abstract partial class SafeHandleZeroOrMinusOneIsInvalid : System.Runtime.InteropServices.SafeHandle
- {
- protected SafeHandleZeroOrMinusOneIsInvalid(bool ownsHandle) { }
- public override bool IsInvalid { [System.Security.SecurityCriticalAttribute]get { throw null; } }
- }
- [System.Security.SecurityCriticalAttribute]
- public sealed partial class SafeWaitHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
- {
- public SafeWaitHandle(System.IntPtr existingHandle, bool ownsHandle) : base(ownsHandle) { }
- [System.Security.SecurityCriticalAttribute]
- protected override bool ReleaseHandle() { throw null; }
- }
-}
-namespace System
-{
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class AccessViolationException : System.SystemException
- {
- public AccessViolationException() { }
- public AccessViolationException(string message) { }
- public AccessViolationException(string message, System.Exception innerException) { }
- protected AccessViolationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Core, Version=2.0.5.0, Culture=Neutral, PublicKeyToken=7cec85d7bea7798e")]
- public delegate void Action();
- public delegate void Action<in T>(T obj);
- [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Core, Version=2.0.5.0, Culture=Neutral, PublicKeyToken=7cec85d7bea7798e")]
- public delegate void Action<in T1, in T2>(T1 arg1, T2 arg2);
- [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Core, Version=2.0.5.0, Culture=Neutral, PublicKeyToken=7cec85d7bea7798e")]
- public delegate void Action<in T1, in T2, in T3>(T1 arg1, T2 arg2, T3 arg3);
- [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Core, Version=2.0.5.0, Culture=Neutral, PublicKeyToken=7cec85d7bea7798e")]
- public delegate void Action<in T1, in T2, in T3, in T4>(T1 arg1, T2 arg2, T3 arg3, T4 arg4);
- public delegate void Action<in T1, in T2, in T3, in T4, in T5>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5);
- public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6);
- public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7);
- public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8);
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class Activator
- {
- internal Activator() { }
- public static System.Runtime.Remoting.ObjectHandle CreateComInstanceFrom(string assemblyName, string typeName) { throw null; }
- public static System.Runtime.Remoting.ObjectHandle CreateComInstanceFrom(string assemblyName, string typeName, byte[] hashValue, System.Configuration.Assemblies.AssemblyHashAlgorithm hashAlgorithm) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Runtime.Remoting.ObjectHandle CreateInstance(string assemblyName, string typeName) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Runtime.Remoting.ObjectHandle CreateInstance(string assemblyName, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, object[] args, System.Globalization.CultureInfo culture, object[] activationAttributes) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Runtime.Remoting.ObjectHandle CreateInstance(string assemblyName, string typeName, object[] activationAttributes) { throw null; }
- public static object CreateInstance(System.Type type) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- public static object CreateInstance(System.Type type, bool nonPublic) { throw null; }
- public static object CreateInstance(System.Type type, params object[] args) { throw null; }
- public static object CreateInstance(System.Type type, object[] args, object[] activationAttributes) { throw null; }
- public static object CreateInstance(System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, object[] args, System.Globalization.CultureInfo culture) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static object CreateInstance(System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, object[] args, System.Globalization.CultureInfo culture, object[] activationAttributes) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- public static T CreateInstance<T>() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.Runtime.Remoting.ObjectHandle CreateInstanceFrom(string assemblyFile, string typeName) { throw null; }
- public static System.Runtime.Remoting.ObjectHandle CreateInstanceFrom(string assemblyFile, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, object[] args, System.Globalization.CultureInfo culture, object[] activationAttributes) { throw null; }
- public static System.Runtime.Remoting.ObjectHandle CreateInstanceFrom(string assemblyFile, string typeName, object[] activationAttributes) { throw null; }
- }
- [System.Diagnostics.DebuggerDisplayAttribute("Count = {InnerExceptionCount}")]
- public partial class AggregateException : System.Exception
- {
- public AggregateException() { }
- public AggregateException(System.Collections.Generic.IEnumerable<System.Exception> innerExceptions) { }
- public AggregateException(params System.Exception[] innerExceptions) { }
- public AggregateException(string message) { }
- public AggregateException(string message, System.Collections.Generic.IEnumerable<System.Exception> innerExceptions) { }
- public AggregateException(string message, System.Exception innerException) { }
- public AggregateException(string message, params System.Exception[] innerExceptions) { }
- protected AggregateException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- public System.Collections.ObjectModel.ReadOnlyCollection<System.Exception> InnerExceptions { get { throw null; } }
- public override string Message { get { throw null; } }
- public System.AggregateException Flatten() { throw null; }
- public override System.Exception GetBaseException() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public void Handle(System.Func<System.Exception, bool> predicate) { }
- public override string ToString() { throw null; }
- }
- public static partial class AppContext
- {
- public static string BaseDirectory { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public static string TargetFrameworkName { get { throw null; } }
- [System.Security.SecuritySafeCriticalAttribute]
- public static object GetData(string name) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void SetData(string name, object data) { }
- public static void SetSwitch(string switchName, bool isEnabled) { }
- public static bool TryGetSwitch(string switchName, out bool isEnabled) { isEnabled = default(bool); throw null; }
- public static event UnhandledExceptionEventHandler UnhandledException { add { } remove { } }
- public static event System.EventHandler<System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs> FirstChanceException { add { } remove { } }
- public static event System.EventHandler ProcessExit { add { } remove { } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class ApplicationException : System.Exception
- {
- public ApplicationException() { }
- public ApplicationException(string message) { }
- public ApplicationException(string message, System.Exception innerException) { }
- protected ApplicationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct ArgIterator
- {
- public override bool Equals(object o) { throw null; }
- public override int GetHashCode() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class ArgumentException : System.SystemException, System.Runtime.Serialization.ISerializable
- {
- public ArgumentException() { }
- public ArgumentException(string message) { }
- public ArgumentException(string message, System.Exception innerException) { }
- public ArgumentException(string message, string paramName) { }
- public ArgumentException(string message, string paramName, System.Exception innerException) { }
- protected ArgumentException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- public override string Message { get { throw null; } }
- public virtual string ParamName { get { throw null; } }
- [System.Security.SecurityCriticalAttribute]
- public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class ArgumentNullException : System.ArgumentException
- {
- public ArgumentNullException() { }
- public ArgumentNullException(string paramName) { }
- public ArgumentNullException(string message, System.Exception innerException) { }
- public ArgumentNullException(string paramName, string message) { }
- protected ArgumentNullException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class ArgumentOutOfRangeException : System.ArgumentException, System.Runtime.Serialization.ISerializable
- {
- public ArgumentOutOfRangeException() { }
- public ArgumentOutOfRangeException(string paramName) { }
- public ArgumentOutOfRangeException(string message, System.Exception innerException) { }
- public ArgumentOutOfRangeException(string paramName, object actualValue, string message) { }
- public ArgumentOutOfRangeException(string paramName, string message) { }
- protected ArgumentOutOfRangeException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- public virtual object ActualValue { get { throw null; } }
- public override string Message { get { throw null; } }
- [System.Security.SecurityCriticalAttribute]
- public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class ArithmeticException : System.SystemException
- {
- public ArithmeticException() { }
- public ArithmeticException(string message) { }
- public ArithmeticException(string message, System.Exception innerException) { }
- protected ArithmeticException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class Array : System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.ICloneable
- {
- internal Array() { }
- public bool IsFixedSize { get { throw null; } }
- public bool IsReadOnly { get { throw null; } }
- public bool IsSynchronized { get { throw null; } }
- public int Length { [System.Security.SecuritySafeCriticalAttribute][System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public long LongLength { [System.Security.SecuritySafeCriticalAttribute][System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]get { throw null; } }
- public int Rank { [System.Security.SecuritySafeCriticalAttribute][System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]get { throw null; } }
- public object SyncRoot { get { throw null; } }
- int System.Collections.ICollection.Count { get { throw null; } }
- object System.Collections.IList.this[int index] { get { throw null; } set { } }
- public static System.Collections.ObjectModel.ReadOnlyCollection<T> AsReadOnly<T>(T[] array) { throw null; }
- public static int BinarySearch(System.Array array, int index, int length, object value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static int BinarySearch(System.Array array, int index, int length, object value, System.Collections.IComparer comparer) { throw null; }
- public static int BinarySearch(System.Array array, object value) { throw null; }
- public static int BinarySearch(System.Array array, object value, System.Collections.IComparer comparer) { throw null; }
- public static int BinarySearch<T>(T[] array, T value) { throw null; }
- public static int BinarySearch<T>(T[] array, T value, System.Collections.Generic.IComparer<T> comparer) { throw null; }
- public static int BinarySearch<T>(T[] array, int index, int length, T value) { throw null; }
- public static int BinarySearch<T>(T[] array, int index, int length, T value, System.Collections.Generic.IComparer<T> comparer) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static void Clear(System.Array array, int index, int length) { }
- public object Clone() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void ConstrainedCopy(System.Array sourceArray, int sourceIndex, System.Array destinationArray, int destinationIndex, int length) { }
- public static TOutput[] ConvertAll<TInput, TOutput>(TInput[] array, System.Converter<TInput, TOutput> converter) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void Copy(System.Array sourceArray, System.Array destinationArray, int length) { }
- public static void Copy(System.Array sourceArray, System.Array destinationArray, long length) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void Copy(System.Array sourceArray, int sourceIndex, System.Array destinationArray, int destinationIndex, int length) { }
- public static void Copy(System.Array sourceArray, long sourceIndex, System.Array destinationArray, long destinationIndex, long length) { }
- public void CopyTo(System.Array array, int index) { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public void CopyTo(System.Array array, long index) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Array CreateInstance(System.Type elementType, int length) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Array CreateInstance(System.Type elementType, int length1, int length2) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Array CreateInstance(System.Type elementType, int length1, int length2, int length3) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Array CreateInstance(System.Type elementType, params int[] lengths) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Array CreateInstance(System.Type elementType, int[] lengths, int[] lowerBounds) { throw null; }
- public static System.Array CreateInstance(System.Type elementType, params long[] lengths) { throw null; }
- public static T[] Empty<T>() { throw null; }
- public static bool Exists<T>(T[] array, System.Predicate<T> match) { throw null; }
- public static T Find<T>(T[] array, System.Predicate<T> match) { throw null; }
- public static T[] FindAll<T>(T[] array, System.Predicate<T> match) { throw null; }
- public static int FindIndex<T>(T[] array, int startIndex, int count, System.Predicate<T> match) { throw null; }
- public static int FindIndex<T>(T[] array, int startIndex, System.Predicate<T> match) { throw null; }
- public static int FindIndex<T>(T[] array, System.Predicate<T> match) { throw null; }
- public static T FindLast<T>(T[] array, System.Predicate<T> match) { throw null; }
- public static int FindLastIndex<T>(T[] array, int startIndex, int count, System.Predicate<T> match) { throw null; }
- public static int FindLastIndex<T>(T[] array, int startIndex, System.Predicate<T> match) { throw null; }
- public static int FindLastIndex<T>(T[] array, System.Predicate<T> match) { throw null; }
- public static void ForEach<T>(T[] array, System.Action<T> action) { }
- public System.Collections.IEnumerator GetEnumerator() { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public int GetLength(int dimension) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public long GetLongLength(int dimension) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public int GetLowerBound(int dimension) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public int GetUpperBound(int dimension) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public object GetValue(int index) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public object GetValue(int index1, int index2) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public object GetValue(int index1, int index2, int index3) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public object GetValue(params int[] indices) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public object GetValue(long index) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public object GetValue(long index1, long index2) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public object GetValue(long index1, long index2, long index3) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public object GetValue(params long[] indices) { throw null; }
- public static int IndexOf(System.Array array, object value) { throw null; }
- public static int IndexOf(System.Array array, object value, int startIndex) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static int IndexOf(System.Array array, object value, int startIndex, int count) { throw null; }
- public static int IndexOf<T>(T[] array, T value) { throw null; }
- public static int IndexOf<T>(T[] array, T value, int startIndex) { throw null; }
- public static int IndexOf<T>(T[] array, T value, int startIndex, int count) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public void Initialize() { }
- public static int LastIndexOf(System.Array array, object value) { throw null; }
- public static int LastIndexOf(System.Array array, object value, int startIndex) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static int LastIndexOf(System.Array array, object value, int startIndex, int count) { throw null; }
- public static int LastIndexOf<T>(T[] array, T value) { throw null; }
- public static int LastIndexOf<T>(T[] array, T value, int startIndex) { throw null; }
- public static int LastIndexOf<T>(T[] array, T value, int startIndex, int count) { throw null; }
- public static void Resize<T>(ref T[] array, int newSize) { }
- public static void Reverse(System.Array array) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void Reverse(System.Array array, int index, int length) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void SetValue(object value, int index) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void SetValue(object value, int index1, int index2) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void SetValue(object value, int index1, int index2, int index3) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void SetValue(object value, params int[] indices) { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public void SetValue(object value, long index) { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public void SetValue(object value, long index1, long index2) { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public void SetValue(object value, long index1, long index2, long index3) { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public void SetValue(object value, params long[] indices) { }
- public static void Sort(System.Array array) { }
- public static void Sort(System.Array keys, System.Array items) { }
- public static void Sort(System.Array keys, System.Array items, System.Collections.IComparer comparer) { }
- public static void Sort(System.Array keys, System.Array items, int index, int length) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void Sort(System.Array keys, System.Array items, int index, int length, System.Collections.IComparer comparer) { }
- public static void Sort(System.Array array, System.Collections.IComparer comparer) { }
- public static void Sort(System.Array array, int index, int length) { }
- public static void Sort(System.Array array, int index, int length, System.Collections.IComparer comparer) { }
- public static void Sort<T>(T[] array) { }
- public static void Sort<T>(T[] array, System.Collections.Generic.IComparer<T> comparer) { }
- public static void Sort<T>(T[] array, System.Comparison<T> comparison) { }
- public static void Sort<T>(T[] array, int index, int length) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void Sort<T>(T[] array, int index, int length, System.Collections.Generic.IComparer<T> comparer) { }
- public static void Sort<TKey, TValue>(TKey[] keys, TValue[] items) { }
- public static void Sort<TKey, TValue>(TKey[] keys, TValue[] items, System.Collections.Generic.IComparer<TKey> comparer) { }
- public static void Sort<TKey, TValue>(TKey[] keys, TValue[] items, int index, int length) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void Sort<TKey, TValue>(TKey[] keys, TValue[] items, int index, int length, System.Collections.Generic.IComparer<TKey> comparer) { }
- int System.Collections.IList.Add(object value) { throw null; }
- void System.Collections.IList.Clear() { }
- bool System.Collections.IList.Contains(object value) { throw null; }
- int System.Collections.IList.IndexOf(object value) { throw null; }
- void System.Collections.IList.Insert(int index, object value) { }
- void System.Collections.IList.Remove(object value) { }
- void System.Collections.IList.RemoveAt(int index) { }
- int System.Collections.IStructuralComparable.CompareTo(object other, System.Collections.IComparer comparer) { throw null; }
- bool System.Collections.IStructuralEquatable.Equals(object other, System.Collections.IEqualityComparer comparer) { throw null; }
- int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
- public static bool TrueForAll<T>(T[] array, System.Predicate<T> match) { throw null; }
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct ArraySegment<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IList<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.IReadOnlyList<T>, System.Collections.IEnumerable
- {
- public ArraySegment(T[] array) { throw null;}
- public ArraySegment(T[] array, int offset, int count) { throw null;}
- public T[] Array { get { throw null; } }
- public int Count { get { throw null; } }
- public int Offset { get { throw null; } }
- bool System.Collections.Generic.ICollection<T>.IsReadOnly { get { throw null; } }
- T System.Collections.Generic.IList<T>.this[int index] { get { throw null; } set { } }
- T System.Collections.Generic.IReadOnlyList<T>.this[int index] { get { throw null; } }
- public bool Equals(System.ArraySegment<T> obj) { throw null; }
- public override bool Equals(object obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public static bool operator ==(System.ArraySegment<T> a, System.ArraySegment<T> b) { throw null; }
- public static bool operator !=(System.ArraySegment<T> a, System.ArraySegment<T> b) { throw null; }
- void System.Collections.Generic.ICollection<T>.Add(T item) { }
- void System.Collections.Generic.ICollection<T>.Clear() { }
- bool System.Collections.Generic.ICollection<T>.Contains(T item) { throw null; }
- void System.Collections.Generic.ICollection<T>.CopyTo(T[] array, int arrayIndex) { }
- bool System.Collections.Generic.ICollection<T>.Remove(T item) { throw null; }
- System.Collections.Generic.IEnumerator<T> System.Collections.Generic.IEnumerable<T>.GetEnumerator() { throw null; }
- int System.Collections.Generic.IList<T>.IndexOf(T item) { throw null; }
- void System.Collections.Generic.IList<T>.Insert(int index, T item) { }
- void System.Collections.Generic.IList<T>.RemoveAt(int index) { }
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class ArrayTypeMismatchException : System.SystemException
- {
- public ArrayTypeMismatchException() { }
- public ArrayTypeMismatchException(string message) { }
- public ArrayTypeMismatchException(string message, System.Exception innerException) { }
- protected ArrayTypeMismatchException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class AssemblyLoadEventArgs : System.EventArgs
- {
- public AssemblyLoadEventArgs(System.Reflection.Assembly loadedAssembly) { }
- public System.Reflection.Assembly LoadedAssembly { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public delegate void AssemblyLoadEventHandler(object sender, System.AssemblyLoadEventArgs args);
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public delegate void AsyncCallback(System.IAsyncResult ar);
- [System.AttributeUsageAttribute((System.AttributeTargets)(32767), Inherited = true, AllowMultiple = false)]
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class Attribute
- {
- protected Attribute() { }
- public virtual object TypeId { get { throw null; } }
- [System.Security.SecuritySafeCriticalAttribute]
- public override bool Equals(object obj) { throw null; }
- public static System.Attribute GetCustomAttribute(System.Reflection.Assembly element, System.Type attributeType) { throw null; }
- public static System.Attribute GetCustomAttribute(System.Reflection.Assembly element, System.Type attributeType, bool inherit) { throw null; }
- public static System.Attribute GetCustomAttribute(System.Reflection.MemberInfo element, System.Type attributeType) { throw null; }
- public static System.Attribute GetCustomAttribute(System.Reflection.MemberInfo element, System.Type attributeType, bool inherit) { throw null; }
- public static System.Attribute GetCustomAttribute(System.Reflection.Module element, System.Type attributeType) { throw null; }
- public static System.Attribute GetCustomAttribute(System.Reflection.Module element, System.Type attributeType, bool inherit) { throw null; }
- public static System.Attribute GetCustomAttribute(System.Reflection.ParameterInfo element, System.Type attributeType) { throw null; }
- public static System.Attribute GetCustomAttribute(System.Reflection.ParameterInfo element, System.Type attributeType, bool inherit) { throw null; }
- public static System.Attribute[] GetCustomAttributes(System.Reflection.Assembly element) { throw null; }
- public static System.Attribute[] GetCustomAttributes(System.Reflection.Assembly element, bool inherit) { throw null; }
- public static System.Attribute[] GetCustomAttributes(System.Reflection.Assembly element, System.Type attributeType) { throw null; }
- public static System.Attribute[] GetCustomAttributes(System.Reflection.Assembly element, System.Type attributeType, bool inherit) { throw null; }
- public static System.Attribute[] GetCustomAttributes(System.Reflection.MemberInfo element) { throw null; }
- public static System.Attribute[] GetCustomAttributes(System.Reflection.MemberInfo element, bool inherit) { throw null; }
- public static System.Attribute[] GetCustomAttributes(System.Reflection.MemberInfo element, System.Type type) { throw null; }
- public static System.Attribute[] GetCustomAttributes(System.Reflection.MemberInfo element, System.Type type, bool inherit) { throw null; }
- public static System.Attribute[] GetCustomAttributes(System.Reflection.Module element) { throw null; }
- public static System.Attribute[] GetCustomAttributes(System.Reflection.Module element, bool inherit) { throw null; }
- public static System.Attribute[] GetCustomAttributes(System.Reflection.Module element, System.Type attributeType) { throw null; }
- public static System.Attribute[] GetCustomAttributes(System.Reflection.Module element, System.Type attributeType, bool inherit) { throw null; }
- public static System.Attribute[] GetCustomAttributes(System.Reflection.ParameterInfo element) { throw null; }
- public static System.Attribute[] GetCustomAttributes(System.Reflection.ParameterInfo element, bool inherit) { throw null; }
- public static System.Attribute[] GetCustomAttributes(System.Reflection.ParameterInfo element, System.Type attributeType) { throw null; }
- public static System.Attribute[] GetCustomAttributes(System.Reflection.ParameterInfo element, System.Type attributeType, bool inherit) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override int GetHashCode() { throw null; }
- public virtual bool IsDefaultAttribute() { throw null; }
- public static bool IsDefined(System.Reflection.Assembly element, System.Type attributeType) { throw null; }
- public static bool IsDefined(System.Reflection.Assembly element, System.Type attributeType, bool inherit) { throw null; }
- public static bool IsDefined(System.Reflection.MemberInfo element, System.Type attributeType) { throw null; }
- public static bool IsDefined(System.Reflection.MemberInfo element, System.Type attributeType, bool inherit) { throw null; }
- public static bool IsDefined(System.Reflection.Module element, System.Type attributeType) { throw null; }
- public static bool IsDefined(System.Reflection.Module element, System.Type attributeType, bool inherit) { throw null; }
- public static bool IsDefined(System.Reflection.ParameterInfo element, System.Type attributeType) { throw null; }
- public static bool IsDefined(System.Reflection.ParameterInfo element, System.Type attributeType, bool inherit) { throw null; }
- public virtual bool Match(object obj) { throw null; }
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum AttributeTargets
- {
- All = 32767,
- Assembly = 1,
- Class = 4,
- Constructor = 32,
- Delegate = 4096,
- Enum = 16,
- Event = 512,
- Field = 256,
- GenericParameter = 16384,
- Interface = 1024,
- Method = 64,
- Module = 2,
- Parameter = 2048,
- Property = 128,
- ReturnValue = 8192,
- Struct = 8,
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited=true)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AttributeUsageAttribute : System.Attribute
- {
- public AttributeUsageAttribute(System.AttributeTargets validOn) { }
- public bool AllowMultiple { get { throw null; } set { } }
- public bool Inherited { get { throw null; } set { } }
- public System.AttributeTargets ValidOn { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class BadImageFormatException : System.SystemException
- {
- public BadImageFormatException() { }
- protected BadImageFormatException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public BadImageFormatException(string message) { }
- public BadImageFormatException(string message, System.Exception inner) { }
- public BadImageFormatException(string message, string fileName) { }
- public BadImageFormatException(string message, string fileName, System.Exception inner) { }
- public string FileName { get { throw null; } }
- public string FusionLog { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public override string Message { get { throw null; } }
- [System.Security.SecurityCriticalAttribute]
- public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public override string ToString() { throw null; }
- }
- [System.FlagsAttribute]
- public enum Base64FormattingOptions
- {
- InsertLineBreaks = 1,
- None = 0,
- }
- public static partial class BitConverter
- {
- public static readonly bool IsLittleEndian;
- [System.Security.SecuritySafeCriticalAttribute]
- public static long DoubleToInt64Bits(double value) { throw null; }
- public static byte[] GetBytes(bool value) { throw null; }
- public static byte[] GetBytes(char value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static byte[] GetBytes(double value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static byte[] GetBytes(short value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static byte[] GetBytes(int value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static byte[] GetBytes(long value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static byte[] GetBytes(float value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static byte[] GetBytes(ushort value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static byte[] GetBytes(uint value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static byte[] GetBytes(ulong value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static float Int32BitsToSingle(int value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static double Int64BitsToDouble(long value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static int SingleToInt32Bits(float value) { throw null; }
- public static bool ToBoolean(byte[] value, int startIndex) { throw null; }
- public static char ToChar(byte[] value, int startIndex) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static double ToDouble(byte[] value, int startIndex) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static short ToInt16(byte[] value, int startIndex) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static int ToInt32(byte[] value, int startIndex) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static long ToInt64(byte[] value, int startIndex) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static float ToSingle(byte[] value, int startIndex) { throw null; }
- public static string ToString(byte[] value) { throw null; }
- public static string ToString(byte[] value, int startIndex) { throw null; }
- public static string ToString(byte[] value, int startIndex, int length) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort ToUInt16(byte[] value, int startIndex) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint ToUInt32(byte[] value, int startIndex) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong ToUInt64(byte[] value, int startIndex) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct Boolean : System.IComparable, System.IComparable<bool>, System.IConvertible, System.IEquatable<bool>
- {
- public static readonly string FalseString;
- public static readonly string TrueString;
- public int CompareTo(System.Boolean value) { throw null; }
- public int CompareTo(object obj) { throw null; }
- public System.Boolean Equals(System.Boolean obj) { throw null; }
- public override System.Boolean Equals(object obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public System.TypeCode GetTypeCode() { throw null; }
- public static System.Boolean Parse(string value) { throw null; }
- System.Boolean System.IConvertible.ToBoolean(System.IFormatProvider provider) { throw null; }
- byte System.IConvertible.ToByte(System.IFormatProvider provider) { throw null; }
- char System.IConvertible.ToChar(System.IFormatProvider provider) { throw null; }
- System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider provider) { throw null; }
- decimal System.IConvertible.ToDecimal(System.IFormatProvider provider) { throw null; }
- double System.IConvertible.ToDouble(System.IFormatProvider provider) { throw null; }
- short System.IConvertible.ToInt16(System.IFormatProvider provider) { throw null; }
- int System.IConvertible.ToInt32(System.IFormatProvider provider) { throw null; }
- long System.IConvertible.ToInt64(System.IFormatProvider provider) { throw null; }
- sbyte System.IConvertible.ToSByte(System.IFormatProvider provider) { throw null; }
- float System.IConvertible.ToSingle(System.IFormatProvider provider) { throw null; }
- object System.IConvertible.ToType(System.Type type, System.IFormatProvider provider) { throw null; }
- ushort System.IConvertible.ToUInt16(System.IFormatProvider provider) { throw null; }
- uint System.IConvertible.ToUInt32(System.IFormatProvider provider) { throw null; }
- ulong System.IConvertible.ToUInt64(System.IFormatProvider provider) { throw null; }
- public override string ToString() { throw null; }
- public string ToString(System.IFormatProvider provider) { throw null; }
- public static System.Boolean TryParse(string value, out System.Boolean result) { result = default(bool); throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static partial class Buffer
- {
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static void BlockCopy(System.Array src, int srcOffset, System.Array dst, int dstOffset, int count) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static int ByteLength(System.Array array) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static byte GetByte(System.Array array, int index) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)][System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe static void MemoryCopy(void* source, void* destination, long destinationSizeInBytes, long sourceBytesToCopy) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)][System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe static void MemoryCopy(void* source, void* destination, ulong destinationSizeInBytes, ulong sourceBytesToCopy) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void SetByte(System.Array array, int index, byte value) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct Byte : System.IComparable, System.IComparable<byte>, System.IConvertible, System.IEquatable<byte>, System.IFormattable
- {
- public const byte MaxValue = (byte)255;
- public const byte MinValue = (byte)0;
- public int CompareTo(System.Byte value) { throw null; }
- public int CompareTo(object value) { throw null; }
- public bool Equals(System.Byte obj) { throw null; }
- public override bool Equals(object obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public System.TypeCode GetTypeCode() { throw null; }
- public static System.Byte Parse(string s) { throw null; }
- public static System.Byte Parse(string s, System.Globalization.NumberStyles style) { throw null; }
- public static System.Byte Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider) { throw null; }
- public static System.Byte Parse(string s, System.IFormatProvider provider) { throw null; }
- bool System.IConvertible.ToBoolean(System.IFormatProvider provider) { throw null; }
- System.Byte System.IConvertible.ToByte(System.IFormatProvider provider) { throw null; }
- char System.IConvertible.ToChar(System.IFormatProvider provider) { throw null; }
- System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider provider) { throw null; }
- decimal System.IConvertible.ToDecimal(System.IFormatProvider provider) { throw null; }
- double System.IConvertible.ToDouble(System.IFormatProvider provider) { throw null; }
- short System.IConvertible.ToInt16(System.IFormatProvider provider) { throw null; }
- int System.IConvertible.ToInt32(System.IFormatProvider provider) { throw null; }
- long System.IConvertible.ToInt64(System.IFormatProvider provider) { throw null; }
- sbyte System.IConvertible.ToSByte(System.IFormatProvider provider) { throw null; }
- float System.IConvertible.ToSingle(System.IFormatProvider provider) { throw null; }
- object System.IConvertible.ToType(System.Type type, System.IFormatProvider provider) { throw null; }
- ushort System.IConvertible.ToUInt16(System.IFormatProvider provider) { throw null; }
- uint System.IConvertible.ToUInt32(System.IFormatProvider provider) { throw null; }
- ulong System.IConvertible.ToUInt64(System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override string ToString() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(string format) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(string format, System.IFormatProvider provider) { throw null; }
- public static bool TryParse(string s, out System.Byte result) { result = default(byte); throw null; }
- public static bool TryParse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider, out System.Byte result) { result = default(byte); throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct Char : System.IComparable, System.IComparable<char>, System.IConvertible, System.IEquatable<char>
- {
- public const char MaxValue = '\uFFFF';
- public const char MinValue = '\0';
- public int CompareTo(System.Char value) { throw null; }
- public int CompareTo(object value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static string ConvertFromUtf32(int utf32) { throw null; }
- public static int ConvertToUtf32(System.Char highSurrogate, System.Char lowSurrogate) { throw null; }
- public static int ConvertToUtf32(string s, int index) { throw null; }
- public bool Equals(System.Char obj) { throw null; }
- public override bool Equals(object obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public static double GetNumericValue(System.Char c) { throw null; }
- public static double GetNumericValue(string s, int index) { throw null; }
- public System.TypeCode GetTypeCode() { throw null; }
- public static System.Globalization.UnicodeCategory GetUnicodeCategory(System.Char c) { throw null; }
- public static System.Globalization.UnicodeCategory GetUnicodeCategory(string s, int index) { throw null; }
- public static bool IsControl(System.Char c) { throw null; }
- public static bool IsControl(string s, int index) { throw null; }
- public static bool IsDigit(System.Char c) { throw null; }
- public static bool IsDigit(string s, int index) { throw null; }
- public static bool IsHighSurrogate(System.Char c) { throw null; }
- public static bool IsHighSurrogate(string s, int index) { throw null; }
- public static bool IsLetter(System.Char c) { throw null; }
- public static bool IsLetter(string s, int index) { throw null; }
- public static bool IsLetterOrDigit(System.Char c) { throw null; }
- public static bool IsLetterOrDigit(string s, int index) { throw null; }
- public static bool IsLower(System.Char c) { throw null; }
- public static bool IsLower(string s, int index) { throw null; }
- public static bool IsLowSurrogate(System.Char c) { throw null; }
- public static bool IsLowSurrogate(string s, int index) { throw null; }
- public static bool IsNumber(System.Char c) { throw null; }
- public static bool IsNumber(string s, int index) { throw null; }
- public static bool IsPunctuation(System.Char c) { throw null; }
- public static bool IsPunctuation(string s, int index) { throw null; }
- public static bool IsSeparator(System.Char c) { throw null; }
- public static bool IsSeparator(string s, int index) { throw null; }
- public static bool IsSurrogate(System.Char c) { throw null; }
- public static bool IsSurrogate(string s, int index) { throw null; }
- public static bool IsSurrogatePair(System.Char highSurrogate, System.Char lowSurrogate) { throw null; }
- public static bool IsSurrogatePair(string s, int index) { throw null; }
- public static bool IsSymbol(System.Char c) { throw null; }
- public static bool IsSymbol(string s, int index) { throw null; }
- public static bool IsUpper(System.Char c) { throw null; }
- public static bool IsUpper(string s, int index) { throw null; }
- public static bool IsWhiteSpace(System.Char c) { throw null; }
- public static bool IsWhiteSpace(string s, int index) { throw null; }
- public static System.Char Parse(string s) { throw null; }
- bool System.IConvertible.ToBoolean(System.IFormatProvider provider) { throw null; }
- byte System.IConvertible.ToByte(System.IFormatProvider provider) { throw null; }
- System.Char System.IConvertible.ToChar(System.IFormatProvider provider) { throw null; }
- System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider provider) { throw null; }
- decimal System.IConvertible.ToDecimal(System.IFormatProvider provider) { throw null; }
- double System.IConvertible.ToDouble(System.IFormatProvider provider) { throw null; }
- short System.IConvertible.ToInt16(System.IFormatProvider provider) { throw null; }
- int System.IConvertible.ToInt32(System.IFormatProvider provider) { throw null; }
- long System.IConvertible.ToInt64(System.IFormatProvider provider) { throw null; }
- sbyte System.IConvertible.ToSByte(System.IFormatProvider provider) { throw null; }
- float System.IConvertible.ToSingle(System.IFormatProvider provider) { throw null; }
- object System.IConvertible.ToType(System.Type type, System.IFormatProvider provider) { throw null; }
- ushort System.IConvertible.ToUInt16(System.IFormatProvider provider) { throw null; }
- uint System.IConvertible.ToUInt32(System.IFormatProvider provider) { throw null; }
- ulong System.IConvertible.ToUInt64(System.IFormatProvider provider) { throw null; }
- public static System.Char ToLower(System.Char c) { throw null; }
- public static System.Char ToLower(System.Char c, System.Globalization.CultureInfo culture) { throw null; }
- public static System.Char ToLowerInvariant(System.Char c) { throw null; }
- public override string ToString() { throw null; }
- public static string ToString(System.Char c) { throw null; }
- public string ToString(System.IFormatProvider provider) { throw null; }
- public static System.Char ToUpper(System.Char c) { throw null; }
- public static System.Char ToUpper(System.Char c, System.Globalization.CultureInfo culture) { throw null; }
- public static System.Char ToUpperInvariant(System.Char c) { throw null; }
- public static bool TryParse(string s, out System.Char result) { result = default(char); throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class CharEnumerator : System.Collections.Generic.IEnumerator<char>, System.Collections.IEnumerator, System.ICloneable, System.IDisposable
- {
- internal CharEnumerator() { }
- public char Current { get { throw null; } }
- object System.Collections.IEnumerator.Current { get { throw null; } }
- public object Clone() { throw null; }
- public void Dispose() { }
- public bool MoveNext() { throw null; }
- public void Reset() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(32767), Inherited=true, AllowMultiple=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class CLSCompliantAttribute : System.Attribute
- {
- public CLSCompliantAttribute(bool isCompliant) { }
- public bool IsCompliant { get { throw null; } }
- }
- public delegate int Comparison<in T>(T x, T y);
- public static partial class Console
- {
- [System.Security.SecuritySafeCriticalAttribute]
- public static void Write(string value) { }
- public static void WriteLine() { }
- public static void WriteLine(string value) { }
- }
- public static partial class Convert
- {
- public static readonly object DBNull;
- public static object ChangeType(object value, System.Type conversionType) { throw null; }
- public static object ChangeType(object value, System.Type conversionType, System.IFormatProvider provider) { throw null; }
- public static object ChangeType(object value, System.TypeCode typeCode) { throw null; }
- public static object ChangeType(object value, System.TypeCode typeCode, System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static byte[] FromBase64CharArray(char[] inArray, int offset, int length) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static byte[] FromBase64String(string s) { throw null; }
- public static System.TypeCode GetTypeCode(object value) { throw null; }
- public static bool IsDBNull(object value) { throw null; }
- public static int ToBase64CharArray(byte[] inArray, int offsetIn, int length, char[] outArray, int offsetOut) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static int ToBase64CharArray(byte[] inArray, int offsetIn, int length, char[] outArray, int offsetOut, System.Base64FormattingOptions options) { throw null; }
- public static string ToBase64String(byte[] inArray) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public static string ToBase64String(byte[] inArray, System.Base64FormattingOptions options) { throw null; }
- public static string ToBase64String(byte[] inArray, int offset, int length) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static string ToBase64String(byte[] inArray, int offset, int length, System.Base64FormattingOptions options) { throw null; }
- public static bool ToBoolean(bool value) { throw null; }
- public static bool ToBoolean(byte value) { throw null; }
- public static bool ToBoolean(char value) { throw null; }
- public static bool ToBoolean(System.DateTime value) { throw null; }
- public static bool ToBoolean(decimal value) { throw null; }
- public static bool ToBoolean(double value) { throw null; }
- public static bool ToBoolean(short value) { throw null; }
- public static bool ToBoolean(int value) { throw null; }
- public static bool ToBoolean(long value) { throw null; }
- public static bool ToBoolean(object value) { throw null; }
- public static bool ToBoolean(object value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static bool ToBoolean(sbyte value) { throw null; }
- public static bool ToBoolean(float value) { throw null; }
- public static bool ToBoolean(string value) { throw null; }
- public static bool ToBoolean(string value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static bool ToBoolean(ushort value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static bool ToBoolean(uint value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static bool ToBoolean(ulong value) { throw null; }
- public static byte ToByte(bool value) { throw null; }
- public static byte ToByte(byte value) { throw null; }
- public static byte ToByte(char value) { throw null; }
- public static byte ToByte(System.DateTime value) { throw null; }
- public static byte ToByte(decimal value) { throw null; }
- public static byte ToByte(double value) { throw null; }
- public static byte ToByte(short value) { throw null; }
- public static byte ToByte(int value) { throw null; }
- public static byte ToByte(long value) { throw null; }
- public static byte ToByte(object value) { throw null; }
- public static byte ToByte(object value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static byte ToByte(sbyte value) { throw null; }
- public static byte ToByte(float value) { throw null; }
- public static byte ToByte(string value) { throw null; }
- public static byte ToByte(string value, System.IFormatProvider provider) { throw null; }
- public static byte ToByte(string value, int fromBase) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static byte ToByte(ushort value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static byte ToByte(uint value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static byte ToByte(ulong value) { throw null; }
- public static char ToChar(bool value) { throw null; }
- public static char ToChar(byte value) { throw null; }
- public static char ToChar(char value) { throw null; }
- public static char ToChar(System.DateTime value) { throw null; }
- public static char ToChar(decimal value) { throw null; }
- public static char ToChar(double value) { throw null; }
- public static char ToChar(short value) { throw null; }
- public static char ToChar(int value) { throw null; }
- public static char ToChar(long value) { throw null; }
- public static char ToChar(object value) { throw null; }
- public static char ToChar(object value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static char ToChar(sbyte value) { throw null; }
- public static char ToChar(float value) { throw null; }
- public static char ToChar(string value) { throw null; }
- public static char ToChar(string value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static char ToChar(ushort value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static char ToChar(uint value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static char ToChar(ulong value) { throw null; }
- public static System.DateTime ToDateTime(bool value) { throw null; }
- public static System.DateTime ToDateTime(byte value) { throw null; }
- public static System.DateTime ToDateTime(char value) { throw null; }
- public static System.DateTime ToDateTime(System.DateTime value) { throw null; }
- public static System.DateTime ToDateTime(decimal value) { throw null; }
- public static System.DateTime ToDateTime(double value) { throw null; }
- public static System.DateTime ToDateTime(short value) { throw null; }
- public static System.DateTime ToDateTime(int value) { throw null; }
- public static System.DateTime ToDateTime(long value) { throw null; }
- public static System.DateTime ToDateTime(object value) { throw null; }
- public static System.DateTime ToDateTime(object value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static System.DateTime ToDateTime(sbyte value) { throw null; }
- public static System.DateTime ToDateTime(float value) { throw null; }
- public static System.DateTime ToDateTime(string value) { throw null; }
- public static System.DateTime ToDateTime(string value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static System.DateTime ToDateTime(ushort value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static System.DateTime ToDateTime(uint value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static System.DateTime ToDateTime(ulong value) { throw null; }
- public static decimal ToDecimal(bool value) { throw null; }
- public static decimal ToDecimal(byte value) { throw null; }
- public static decimal ToDecimal(char value) { throw null; }
- public static decimal ToDecimal(System.DateTime value) { throw null; }
- public static decimal ToDecimal(decimal value) { throw null; }
- public static decimal ToDecimal(double value) { throw null; }
- public static decimal ToDecimal(short value) { throw null; }
- public static decimal ToDecimal(int value) { throw null; }
- public static decimal ToDecimal(long value) { throw null; }
- public static decimal ToDecimal(object value) { throw null; }
- public static decimal ToDecimal(object value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static decimal ToDecimal(sbyte value) { throw null; }
- public static decimal ToDecimal(float value) { throw null; }
- public static decimal ToDecimal(string value) { throw null; }
- public static decimal ToDecimal(string value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static decimal ToDecimal(ushort value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static decimal ToDecimal(uint value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static decimal ToDecimal(ulong value) { throw null; }
- public static double ToDouble(bool value) { throw null; }
- public static double ToDouble(byte value) { throw null; }
- public static double ToDouble(char value) { throw null; }
- public static double ToDouble(System.DateTime value) { throw null; }
- public static double ToDouble(decimal value) { throw null; }
- public static double ToDouble(double value) { throw null; }
- public static double ToDouble(short value) { throw null; }
- public static double ToDouble(int value) { throw null; }
- public static double ToDouble(long value) { throw null; }
- public static double ToDouble(object value) { throw null; }
- public static double ToDouble(object value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static double ToDouble(sbyte value) { throw null; }
- public static double ToDouble(float value) { throw null; }
- public static double ToDouble(string value) { throw null; }
- public static double ToDouble(string value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static double ToDouble(ushort value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static double ToDouble(uint value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static double ToDouble(ulong value) { throw null; }
- public static short ToInt16(bool value) { throw null; }
- public static short ToInt16(byte value) { throw null; }
- public static short ToInt16(char value) { throw null; }
- public static short ToInt16(System.DateTime value) { throw null; }
- public static short ToInt16(decimal value) { throw null; }
- public static short ToInt16(double value) { throw null; }
- public static short ToInt16(short value) { throw null; }
- public static short ToInt16(int value) { throw null; }
- public static short ToInt16(long value) { throw null; }
- public static short ToInt16(object value) { throw null; }
- public static short ToInt16(object value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static short ToInt16(sbyte value) { throw null; }
- public static short ToInt16(float value) { throw null; }
- public static short ToInt16(string value) { throw null; }
- public static short ToInt16(string value, System.IFormatProvider provider) { throw null; }
- public static short ToInt16(string value, int fromBase) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static short ToInt16(ushort value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static short ToInt16(uint value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static short ToInt16(ulong value) { throw null; }
- public static int ToInt32(bool value) { throw null; }
- public static int ToInt32(byte value) { throw null; }
- public static int ToInt32(char value) { throw null; }
- public static int ToInt32(System.DateTime value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static int ToInt32(decimal value) { throw null; }
- public static int ToInt32(double value) { throw null; }
- public static int ToInt32(short value) { throw null; }
- public static int ToInt32(int value) { throw null; }
- public static int ToInt32(long value) { throw null; }
- public static int ToInt32(object value) { throw null; }
- public static int ToInt32(object value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static int ToInt32(sbyte value) { throw null; }
- public static int ToInt32(float value) { throw null; }
- public static int ToInt32(string value) { throw null; }
- public static int ToInt32(string value, System.IFormatProvider provider) { throw null; }
- public static int ToInt32(string value, int fromBase) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static int ToInt32(ushort value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static int ToInt32(uint value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static int ToInt32(ulong value) { throw null; }
- public static long ToInt64(bool value) { throw null; }
- public static long ToInt64(byte value) { throw null; }
- public static long ToInt64(char value) { throw null; }
- public static long ToInt64(System.DateTime value) { throw null; }
- public static long ToInt64(decimal value) { throw null; }
- public static long ToInt64(double value) { throw null; }
- public static long ToInt64(short value) { throw null; }
- public static long ToInt64(int value) { throw null; }
- public static long ToInt64(long value) { throw null; }
- public static long ToInt64(object value) { throw null; }
- public static long ToInt64(object value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static long ToInt64(sbyte value) { throw null; }
- public static long ToInt64(float value) { throw null; }
- public static long ToInt64(string value) { throw null; }
- public static long ToInt64(string value, System.IFormatProvider provider) { throw null; }
- public static long ToInt64(string value, int fromBase) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static long ToInt64(ushort value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static long ToInt64(uint value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static long ToInt64(ulong value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte ToSByte(bool value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte ToSByte(byte value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte ToSByte(char value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte ToSByte(System.DateTime value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte ToSByte(decimal value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte ToSByte(double value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte ToSByte(short value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte ToSByte(int value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte ToSByte(long value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte ToSByte(object value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte ToSByte(object value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte ToSByte(sbyte value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte ToSByte(float value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte ToSByte(string value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte ToSByte(string value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte ToSByte(string value, int fromBase) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte ToSByte(ushort value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte ToSByte(uint value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte ToSByte(ulong value) { throw null; }
- public static float ToSingle(bool value) { throw null; }
- public static float ToSingle(byte value) { throw null; }
- public static float ToSingle(char value) { throw null; }
- public static float ToSingle(System.DateTime value) { throw null; }
- public static float ToSingle(decimal value) { throw null; }
- public static float ToSingle(double value) { throw null; }
- public static float ToSingle(short value) { throw null; }
- public static float ToSingle(int value) { throw null; }
- public static float ToSingle(long value) { throw null; }
- public static float ToSingle(object value) { throw null; }
- public static float ToSingle(object value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static float ToSingle(sbyte value) { throw null; }
- public static float ToSingle(float value) { throw null; }
- public static float ToSingle(string value) { throw null; }
- public static float ToSingle(string value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static float ToSingle(ushort value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static float ToSingle(uint value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static float ToSingle(ulong value) { throw null; }
- public static string ToString(bool value) { throw null; }
- public static string ToString(bool value, System.IFormatProvider provider) { throw null; }
- public static string ToString(byte value) { throw null; }
- public static string ToString(byte value, System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static string ToString(byte value, int toBase) { throw null; }
- public static string ToString(char value) { throw null; }
- public static string ToString(char value, System.IFormatProvider provider) { throw null; }
- public static string ToString(System.DateTime value) { throw null; }
- public static string ToString(System.DateTime value, System.IFormatProvider provider) { throw null; }
- public static string ToString(decimal value) { throw null; }
- public static string ToString(decimal value, System.IFormatProvider provider) { throw null; }
- public static string ToString(double value) { throw null; }
- public static string ToString(double value, System.IFormatProvider provider) { throw null; }
- public static string ToString(short value) { throw null; }
- public static string ToString(short value, System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static string ToString(short value, int toBase) { throw null; }
- public static string ToString(int value) { throw null; }
- public static string ToString(int value, System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static string ToString(int value, int toBase) { throw null; }
- public static string ToString(long value) { throw null; }
- public static string ToString(long value, System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static string ToString(long value, int toBase) { throw null; }
- public static string ToString(object value) { throw null; }
- public static string ToString(object value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static string ToString(sbyte value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static string ToString(sbyte value, System.IFormatProvider provider) { throw null; }
- public static string ToString(float value) { throw null; }
- public static string ToString(float value, System.IFormatProvider provider) { throw null; }
- public static string ToString(string value) { throw null; }
- public static string ToString(string value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static string ToString(ushort value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static string ToString(ushort value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static string ToString(uint value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static string ToString(uint value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static string ToString(ulong value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static string ToString(ulong value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort ToUInt16(bool value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort ToUInt16(byte value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort ToUInt16(char value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort ToUInt16(System.DateTime value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort ToUInt16(decimal value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort ToUInt16(double value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort ToUInt16(short value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort ToUInt16(int value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort ToUInt16(long value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort ToUInt16(object value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort ToUInt16(object value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort ToUInt16(sbyte value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort ToUInt16(float value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort ToUInt16(string value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort ToUInt16(string value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort ToUInt16(string value, int fromBase) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort ToUInt16(ushort value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort ToUInt16(uint value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort ToUInt16(ulong value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint ToUInt32(bool value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint ToUInt32(byte value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint ToUInt32(char value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint ToUInt32(System.DateTime value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint ToUInt32(decimal value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint ToUInt32(double value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint ToUInt32(short value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint ToUInt32(int value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint ToUInt32(long value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint ToUInt32(object value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint ToUInt32(object value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint ToUInt32(sbyte value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint ToUInt32(float value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint ToUInt32(string value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint ToUInt32(string value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint ToUInt32(string value, int fromBase) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint ToUInt32(ushort value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint ToUInt32(uint value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint ToUInt32(ulong value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong ToUInt64(bool value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong ToUInt64(byte value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong ToUInt64(char value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong ToUInt64(System.DateTime value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong ToUInt64(decimal value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong ToUInt64(double value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong ToUInt64(short value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong ToUInt64(int value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong ToUInt64(long value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong ToUInt64(object value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong ToUInt64(object value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong ToUInt64(sbyte value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong ToUInt64(float value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong ToUInt64(string value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong ToUInt64(string value, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong ToUInt64(string value, int fromBase) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong ToUInt64(ushort value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong ToUInt64(uint value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong ToUInt64(ulong value) { throw null; }
- }
- public delegate TOutput Converter<in TInput, out TOutput>(TInput input);
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class DataMisalignedException : System.SystemException
- {
- public DataMisalignedException() { }
- public DataMisalignedException(string message) { }
- public DataMisalignedException(string message, System.Exception innerException) { }
- }
- public partial struct DateTime : System.IComparable, System.IComparable<System.DateTime>, System.IConvertible, System.IEquatable<System.DateTime>, System.IFormattable, System.Runtime.Serialization.ISerializable
- {
- public static readonly System.DateTime MaxValue;
- public static readonly System.DateTime MinValue;
- public DateTime(int year, int month, int day) { throw null;}
- public DateTime(int year, int month, int day, System.Globalization.Calendar calendar) { throw null;}
- public DateTime(int year, int month, int day, int hour, int minute, int second) { throw null;}
- public DateTime(int year, int month, int day, int hour, int minute, int second, System.DateTimeKind kind) { throw null;}
- public DateTime(int year, int month, int day, int hour, int minute, int second, System.Globalization.Calendar calendar) { throw null;}
- public DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond) { throw null;}
- public DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, System.DateTimeKind kind) { throw null;}
- public DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, System.Globalization.Calendar calendar) { throw null;}
- public DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, System.Globalization.Calendar calendar, System.DateTimeKind kind) { throw null;}
- public DateTime(long ticks) { throw null;}
- public DateTime(long ticks, System.DateTimeKind kind) { throw null;}
- public System.DateTime Date { get { throw null; } }
- public int Day { get { throw null; } }
- public System.DayOfWeek DayOfWeek { get { throw null; } }
- public int DayOfYear { get { throw null; } }
- public int Hour { get { throw null; } }
- public System.DateTimeKind Kind { get { throw null; } }
- public int Millisecond { get { throw null; } }
- public int Minute { get { throw null; } }
- public int Month { get { throw null; } }
- public static System.DateTime Now { get { throw null; } }
- public int Second { get { throw null; } }
- public long Ticks { get { throw null; } }
- public System.TimeSpan TimeOfDay { get { throw null; } }
- public static System.DateTime Today { get { throw null; } }
- public static System.DateTime UtcNow { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public int Year { get { throw null; } }
- public System.DateTime Add(System.TimeSpan value) { throw null; }
- public System.DateTime AddDays(double value) { throw null; }
- public System.DateTime AddHours(double value) { throw null; }
- public System.DateTime AddMilliseconds(double value) { throw null; }
- public System.DateTime AddMinutes(double value) { throw null; }
- public System.DateTime AddMonths(int months) { throw null; }
- public System.DateTime AddSeconds(double value) { throw null; }
- public System.DateTime AddTicks(long value) { throw null; }
- public System.DateTime AddYears(int value) { throw null; }
- public static int Compare(System.DateTime t1, System.DateTime t2) { throw null; }
- public int CompareTo(System.DateTime value) { throw null; }
- public int CompareTo(object value) { throw null; }
- public static int DaysInMonth(int year, int month) { throw null; }
- public bool Equals(System.DateTime value) { throw null; }
- public static bool Equals(System.DateTime t1, System.DateTime t2) { throw null; }
- public override bool Equals(object value) { throw null; }
- public static System.DateTime FromBinary(long dateData) { throw null; }
- public static System.DateTime FromFileTime(long fileTime) { throw null; }
- public static System.DateTime FromFileTimeUtc(long fileTime) { throw null; }
- public static System.DateTime FromOADate(double d) { throw null; }
- public string[] GetDateTimeFormats() { throw null; }
- public string[] GetDateTimeFormats(char format) { throw null; }
- public string[] GetDateTimeFormats(char format, System.IFormatProvider provider) { throw null; }
- public string[] GetDateTimeFormats(System.IFormatProvider provider) { throw null; }
- public override int GetHashCode() { throw null; }
- public System.TypeCode GetTypeCode() { throw null; }
- public bool IsDaylightSavingTime() { throw null; }
- public static bool IsLeapYear(int year) { throw null; }
- public static System.DateTime operator +(System.DateTime d, System.TimeSpan t) { throw null; }
- public static bool operator ==(System.DateTime d1, System.DateTime d2) { throw null; }
- public static bool operator >(System.DateTime t1, System.DateTime t2) { throw null; }
- public static bool operator >=(System.DateTime t1, System.DateTime t2) { throw null; }
- public static bool operator !=(System.DateTime d1, System.DateTime d2) { throw null; }
- public static bool operator <(System.DateTime t1, System.DateTime t2) { throw null; }
- public static bool operator <=(System.DateTime t1, System.DateTime t2) { throw null; }
- public static System.TimeSpan operator -(System.DateTime d1, System.DateTime d2) { throw null; }
- public static System.DateTime operator -(System.DateTime d, System.TimeSpan t) { throw null; }
- public static System.DateTime Parse(string s) { throw null; }
- public static System.DateTime Parse(string s, System.IFormatProvider provider) { throw null; }
- public static System.DateTime Parse(string s, System.IFormatProvider provider, System.Globalization.DateTimeStyles styles) { throw null; }
- public static System.DateTime ParseExact(string s, string format, System.IFormatProvider provider) { throw null; }
- public static System.DateTime ParseExact(string s, string format, System.IFormatProvider provider, System.Globalization.DateTimeStyles style) { throw null; }
- public static System.DateTime ParseExact(string s, string[] formats, System.IFormatProvider provider, System.Globalization.DateTimeStyles style) { throw null; }
- public static System.DateTime SpecifyKind(System.DateTime value, System.DateTimeKind kind) { throw null; }
- public System.TimeSpan Subtract(System.DateTime value) { throw null; }
- public System.DateTime Subtract(System.TimeSpan value) { throw null; }
- bool System.IConvertible.ToBoolean(System.IFormatProvider provider) { throw null; }
- byte System.IConvertible.ToByte(System.IFormatProvider provider) { throw null; }
- char System.IConvertible.ToChar(System.IFormatProvider provider) { throw null; }
- System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider provider) { throw null; }
- decimal System.IConvertible.ToDecimal(System.IFormatProvider provider) { throw null; }
- double System.IConvertible.ToDouble(System.IFormatProvider provider) { throw null; }
- short System.IConvertible.ToInt16(System.IFormatProvider provider) { throw null; }
- int System.IConvertible.ToInt32(System.IFormatProvider provider) { throw null; }
- long System.IConvertible.ToInt64(System.IFormatProvider provider) { throw null; }
- sbyte System.IConvertible.ToSByte(System.IFormatProvider provider) { throw null; }
- float System.IConvertible.ToSingle(System.IFormatProvider provider) { throw null; }
- object System.IConvertible.ToType(System.Type type, System.IFormatProvider provider) { throw null; }
- ushort System.IConvertible.ToUInt16(System.IFormatProvider provider) { throw null; }
- uint System.IConvertible.ToUInt32(System.IFormatProvider provider) { throw null; }
- ulong System.IConvertible.ToUInt64(System.IFormatProvider provider) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public long ToBinary() { throw null; }
- public long ToFileTime() { throw null; }
- public long ToFileTimeUtc() { throw null; }
- public System.DateTime ToLocalTime() { throw null; }
- public string ToLongDateString() { throw null; }
- public string ToLongTimeString() { throw null; }
- public double ToOADate() { throw null; }
- public string ToShortDateString() { throw null; }
- public string ToShortTimeString() { throw null; }
- public override string ToString() { throw null; }
- public string ToString(System.IFormatProvider provider) { throw null; }
- public string ToString(string format) { throw null; }
- public string ToString(string format, System.IFormatProvider provider) { throw null; }
- public System.DateTime ToUniversalTime() { throw null; }
- public static bool TryParse(string s, out System.DateTime result) { result = default(System.DateTime); throw null; }
- public static bool TryParse(string s, System.IFormatProvider provider, System.Globalization.DateTimeStyles styles, out System.DateTime result) { result = default(System.DateTime); throw null; }
- public static bool TryParseExact(string s, string format, System.IFormatProvider provider, System.Globalization.DateTimeStyles style, out System.DateTime result) { result = default(System.DateTime); throw null; }
- public static bool TryParseExact(string s, string[] formats, System.IFormatProvider provider, System.Globalization.DateTimeStyles style, out System.DateTime result) { result = default(System.DateTime); throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum DateTimeKind
- {
- Local = 2,
- Unspecified = 0,
- Utc = 1,
- }
- public partial struct DateTimeOffset : System.IComparable, System.IComparable<System.DateTimeOffset>, System.IEquatable<System.DateTimeOffset>, System.IFormattable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
- {
- public static readonly System.DateTimeOffset MaxValue;
- public static readonly System.DateTimeOffset MinValue;
- public DateTimeOffset(System.DateTime dateTime) { throw null; }
- public DateTimeOffset(System.DateTime dateTime, System.TimeSpan offset) { throw null; }
- public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, System.Globalization.Calendar calendar, System.TimeSpan offset) { throw null; }
- public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, System.TimeSpan offset) { throw null; }
- public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, System.TimeSpan offset) { throw null; }
- public DateTimeOffset(long ticks, System.TimeSpan offset) { throw null; }
- public System.DateTime Date { get { throw null; } }
- public System.DateTime DateTime { get { throw null; } }
- public int Day { get { throw null; } }
- public System.DayOfWeek DayOfWeek { get { throw null; } }
- public int DayOfYear { get { throw null; } }
- public int Hour { get { throw null; } }
- public System.DateTime LocalDateTime { get { throw null; } }
- public int Millisecond { get { throw null; } }
- public int Minute { get { throw null; } }
- public int Month { get { throw null; } }
- public static System.DateTimeOffset Now { get { throw null; } }
- public System.TimeSpan Offset { get { throw null; } }
- public int Second { get { throw null; } }
- public long Ticks { get { throw null; } }
- public System.TimeSpan TimeOfDay { get { throw null; } }
- public System.DateTime UtcDateTime { get { throw null; } }
- public static System.DateTimeOffset UtcNow { get { throw null; } }
- public long UtcTicks { get { throw null; } }
- public int Year { get { throw null; } }
- public System.DateTimeOffset Add(System.TimeSpan timeSpan) { throw null; }
- public System.DateTimeOffset AddDays(double days) { throw null; }
- public System.DateTimeOffset AddHours(double hours) { throw null; }
- public System.DateTimeOffset AddMilliseconds(double milliseconds) { throw null; }
- public System.DateTimeOffset AddMinutes(double minutes) { throw null; }
- public System.DateTimeOffset AddMonths(int months) { throw null; }
- public System.DateTimeOffset AddSeconds(double seconds) { throw null; }
- public System.DateTimeOffset AddTicks(long ticks) { throw null; }
- public System.DateTimeOffset AddYears(int years) { throw null; }
- public static int Compare(System.DateTimeOffset first, System.DateTimeOffset second) { throw null; }
- public int CompareTo(System.DateTimeOffset other) { throw null; }
- public bool Equals(System.DateTimeOffset other) { throw null; }
- public static bool Equals(System.DateTimeOffset first, System.DateTimeOffset second) { throw null; }
- public override bool Equals(object obj) { throw null; }
- public bool EqualsExact(System.DateTimeOffset other) { throw null; }
- public static System.DateTimeOffset FromFileTime(long fileTime) { throw null; }
- public static System.DateTimeOffset FromUnixTimeMilliseconds(long milliseconds) { throw null; }
- public static System.DateTimeOffset FromUnixTimeSeconds(long seconds) { throw null; }
- public override int GetHashCode() { throw null; }
- public static System.DateTimeOffset operator +(System.DateTimeOffset dateTimeOffset, System.TimeSpan timeSpan) { throw null; }
- public static bool operator ==(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
- public static bool operator >(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
- public static bool operator >=(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
- public static implicit operator System.DateTimeOffset(System.DateTime dateTime) { throw null; }
- public static bool operator !=(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
- public static bool operator <(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
- public static bool operator <=(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
- public static System.TimeSpan operator -(System.DateTimeOffset left, System.DateTimeOffset right) { throw null; }
- public static System.DateTimeOffset operator -(System.DateTimeOffset dateTimeOffset, System.TimeSpan timeSpan) { throw null; }
- public static System.DateTimeOffset Parse(string input) { throw null; }
- public static System.DateTimeOffset Parse(string input, System.IFormatProvider formatProvider) { throw null; }
- public static System.DateTimeOffset Parse(string input, System.IFormatProvider formatProvider, System.Globalization.DateTimeStyles styles) { throw null; }
- public static System.DateTimeOffset ParseExact(string input, string format, System.IFormatProvider formatProvider) { throw null; }
- public static System.DateTimeOffset ParseExact(string input, string format, System.IFormatProvider formatProvider, System.Globalization.DateTimeStyles styles) { throw null; }
- public static System.DateTimeOffset ParseExact(string input, string[] formats, System.IFormatProvider formatProvider, System.Globalization.DateTimeStyles styles) { throw null; }
- public System.TimeSpan Subtract(System.DateTimeOffset value) { throw null; }
- public System.DateTimeOffset Subtract(System.TimeSpan value) { throw null; }
- int System.IComparable.CompareTo(object obj) { throw null; }
- void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object sender) { }
- [System.Security.SecurityCriticalAttribute]
- void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public long ToFileTime() { throw null; }
- public System.DateTimeOffset ToLocalTime() { throw null; }
- public System.DateTimeOffset ToOffset(System.TimeSpan offset) { throw null; }
- public override string ToString() { throw null; }
- public string ToString(System.IFormatProvider formatProvider) { throw null; }
- public string ToString(string format) { throw null; }
- public string ToString(string format, System.IFormatProvider formatProvider) { throw null; }
- public System.DateTimeOffset ToUniversalTime() { throw null; }
- public long ToUnixTimeMilliseconds() { throw null; }
- public long ToUnixTimeSeconds() { throw null; }
- public static bool TryParse(string input, out System.DateTimeOffset result) { result = default(System.DateTimeOffset); throw null; }
- public static bool TryParse(string input, System.IFormatProvider formatProvider, System.Globalization.DateTimeStyles styles, out System.DateTimeOffset result) { result = default(System.DateTimeOffset); throw null; }
- public static bool TryParseExact(string input, string format, System.IFormatProvider formatProvider, System.Globalization.DateTimeStyles styles, out System.DateTimeOffset result) { result = default(System.DateTimeOffset); throw null; }
- public static bool TryParseExact(string input, string[] formats, System.IFormatProvider formatProvider, System.Globalization.DateTimeStyles styles, out System.DateTimeOffset result) { result = default(System.DateTimeOffset); throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum DayOfWeek
- {
- Friday = 5,
- Monday = 1,
- Saturday = 6,
- Sunday = 0,
- Thursday = 4,
- Tuesday = 2,
- Wednesday = 3,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class DBNull : System.IConvertible, System.Runtime.Serialization.ISerializable
- {
- internal DBNull() { }
- public static readonly System.DBNull Value;
- [System.Security.SecurityCriticalAttribute]
- public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public System.TypeCode GetTypeCode() { throw null; }
- bool System.IConvertible.ToBoolean(System.IFormatProvider provider) { throw null; }
- byte System.IConvertible.ToByte(System.IFormatProvider provider) { throw null; }
- char System.IConvertible.ToChar(System.IFormatProvider provider) { throw null; }
- System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider provider) { throw null; }
- decimal System.IConvertible.ToDecimal(System.IFormatProvider provider) { throw null; }
- double System.IConvertible.ToDouble(System.IFormatProvider provider) { throw null; }
- short System.IConvertible.ToInt16(System.IFormatProvider provider) { throw null; }
- int System.IConvertible.ToInt32(System.IFormatProvider provider) { throw null; }
- long System.IConvertible.ToInt64(System.IFormatProvider provider) { throw null; }
- sbyte System.IConvertible.ToSByte(System.IFormatProvider provider) { throw null; }
- float System.IConvertible.ToSingle(System.IFormatProvider provider) { throw null; }
- object System.IConvertible.ToType(System.Type type, System.IFormatProvider provider) { throw null; }
- ushort System.IConvertible.ToUInt16(System.IFormatProvider provider) { throw null; }
- uint System.IConvertible.ToUInt32(System.IFormatProvider provider) { throw null; }
- ulong System.IConvertible.ToUInt64(System.IFormatProvider provider) { throw null; }
- public override string ToString() { throw null; }
- public string ToString(System.IFormatProvider provider) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct Decimal : System.IComparable, System.IComparable<decimal>, System.IConvertible, System.IEquatable<decimal>, System.IFormattable, System.Runtime.Serialization.IDeserializationCallback
- {
- [System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)0, (uint)4294967295, (uint)4294967295, (uint)4294967295)]
- public static readonly decimal MaxValue;
- [System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)128, (uint)0, (uint)0, (uint)1)]
- public static readonly decimal MinusOne;
- [System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)128, (uint)4294967295, (uint)4294967295, (uint)4294967295)]
- public static readonly decimal MinValue;
- [System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)0, (uint)0, (uint)0, (uint)1)]
- public static readonly decimal One;
- [System.Runtime.CompilerServices.DecimalConstantAttribute((byte)0, (byte)0, (uint)0, (uint)0, (uint)0)]
- public static readonly decimal Zero;
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
- [System.Security.SecuritySafeCriticalAttribute]
- public Decimal(double value) { throw null; }
- public Decimal(int value) { throw null; }
- public Decimal(int lo, int mid, int hi, bool isNegative, byte scale) { throw null; }
- public Decimal(int[] bits) { throw null; }
- public Decimal(long value) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
- [System.Security.SecuritySafeCriticalAttribute]
- public Decimal(float value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public Decimal(uint value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public Decimal(ulong value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Decimal Add(System.Decimal d1, System.Decimal d2) { throw null; }
- public static System.Decimal Ceiling(System.Decimal d) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static int Compare(System.Decimal d1, System.Decimal d2) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public int CompareTo(System.Decimal value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public int CompareTo(object value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Decimal Divide(System.Decimal d1, System.Decimal d2) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public bool Equals(System.Decimal value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static bool Equals(System.Decimal d1, System.Decimal d2) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override bool Equals(object value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Decimal Floor(System.Decimal d) { throw null; }
- public static System.Decimal FromOACurrency(long cy) { throw null; }
- public static int[] GetBits(System.Decimal d) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
- [System.Security.SecuritySafeCriticalAttribute]
- public override int GetHashCode() { throw null; }
- public System.TypeCode GetTypeCode() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Decimal Multiply(System.Decimal d1, System.Decimal d2) { throw null; }
- public static System.Decimal Negate(System.Decimal d) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Decimal operator +(System.Decimal d1, System.Decimal d2) { throw null; }
- public static System.Decimal operator --(System.Decimal d) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Decimal operator /(System.Decimal d1, System.Decimal d2) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static bool operator ==(System.Decimal d1, System.Decimal d2) { throw null; }
- public static explicit operator byte(System.Decimal value) { throw null; }
- public static explicit operator char(System.Decimal value) { throw null; }
- public static explicit operator double(System.Decimal value) { throw null; }
- public static explicit operator short(System.Decimal value) { throw null; }
- public static explicit operator int(System.Decimal value) { throw null; }
- public static explicit operator long(System.Decimal value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static explicit operator sbyte(System.Decimal value) { throw null; }
- public static explicit operator float(System.Decimal value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static explicit operator ushort(System.Decimal value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static explicit operator uint(System.Decimal value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static explicit operator ulong(System.Decimal value) { throw null; }
- public static explicit operator System.Decimal(double value) { throw null; }
- public static explicit operator System.Decimal(float value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static bool operator >(System.Decimal d1, System.Decimal d2) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static bool operator >=(System.Decimal d1, System.Decimal d2) { throw null; }
- public static implicit operator System.Decimal(byte value) { throw null; }
- public static implicit operator System.Decimal(char value) { throw null; }
- public static implicit operator System.Decimal(short value) { throw null; }
- public static implicit operator System.Decimal(int value) { throw null; }
- public static implicit operator System.Decimal(long value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static implicit operator System.Decimal(sbyte value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static implicit operator System.Decimal(ushort value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static implicit operator System.Decimal(uint value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static implicit operator System.Decimal(ulong value) { throw null; }
- public static System.Decimal operator ++(System.Decimal d) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static bool operator !=(System.Decimal d1, System.Decimal d2) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static bool operator <(System.Decimal d1, System.Decimal d2) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static bool operator <=(System.Decimal d1, System.Decimal d2) { throw null; }
- public static System.Decimal operator %(System.Decimal d1, System.Decimal d2) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Decimal operator *(System.Decimal d1, System.Decimal d2) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Decimal operator -(System.Decimal d1, System.Decimal d2) { throw null; }
- public static System.Decimal operator -(System.Decimal d) { throw null; }
- public static System.Decimal operator +(System.Decimal d) { throw null; }
- public static System.Decimal Parse(string s) { throw null; }
- public static System.Decimal Parse(string s, System.Globalization.NumberStyles style) { throw null; }
- public static System.Decimal Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider) { throw null; }
- public static System.Decimal Parse(string s, System.IFormatProvider provider) { throw null; }
- public static System.Decimal Remainder(System.Decimal d1, System.Decimal d2) { throw null; }
- public static System.Decimal Round(System.Decimal d) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Decimal Round(System.Decimal d, int decimals) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Decimal Round(System.Decimal d, int decimals, System.MidpointRounding mode) { throw null; }
- public static System.Decimal Round(System.Decimal d, System.MidpointRounding mode) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Decimal Subtract(System.Decimal d1, System.Decimal d2) { throw null; }
- bool System.IConvertible.ToBoolean(System.IFormatProvider provider) { throw null; }
- byte System.IConvertible.ToByte(System.IFormatProvider provider) { throw null; }
- char System.IConvertible.ToChar(System.IFormatProvider provider) { throw null; }
- System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider provider) { throw null; }
- System.Decimal System.IConvertible.ToDecimal(System.IFormatProvider provider) { throw null; }
- double System.IConvertible.ToDouble(System.IFormatProvider provider) { throw null; }
- short System.IConvertible.ToInt16(System.IFormatProvider provider) { throw null; }
- int System.IConvertible.ToInt32(System.IFormatProvider provider) { throw null; }
- long System.IConvertible.ToInt64(System.IFormatProvider provider) { throw null; }
- sbyte System.IConvertible.ToSByte(System.IFormatProvider provider) { throw null; }
- float System.IConvertible.ToSingle(System.IFormatProvider provider) { throw null; }
- object System.IConvertible.ToType(System.Type type, System.IFormatProvider provider) { throw null; }
- ushort System.IConvertible.ToUInt16(System.IFormatProvider provider) { throw null; }
- uint System.IConvertible.ToUInt32(System.IFormatProvider provider) { throw null; }
- ulong System.IConvertible.ToUInt64(System.IFormatProvider provider) { throw null; }
- void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object sender) { }
- public static byte ToByte(System.Decimal value) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static double ToDouble(System.Decimal d) { throw null; }
- public static short ToInt16(System.Decimal value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static int ToInt32(System.Decimal d) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static long ToInt64(System.Decimal d) { throw null; }
- public static long ToOACurrency(System.Decimal value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte ToSByte(System.Decimal value) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static float ToSingle(System.Decimal d) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override string ToString() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(string format) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(string format, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort ToUInt16(System.Decimal value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static uint ToUInt32(System.Decimal d) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static ulong ToUInt64(System.Decimal d) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Decimal Truncate(System.Decimal d) { throw null; }
- public static bool TryParse(string s, out System.Decimal result) { result = default(decimal); throw null; }
- public static bool TryParse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider, out System.Decimal result) { result = default(decimal); throw null; }
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(2))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class Delegate : System.ICloneable, System.Runtime.Serialization.ISerializable
- {
- [System.Security.SecuritySafeCriticalAttribute]
- protected Delegate(object target, string method) { }
- [System.Security.SecuritySafeCriticalAttribute]
- protected Delegate(System.Type target, string method) { }
- public System.Reflection.MethodInfo Method { get { throw null; } }
- public object Target { get { throw null; } }
- public virtual object Clone() { throw null; }
- public static System.Delegate Combine(System.Delegate a, System.Delegate b) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static System.Delegate Combine(params System.Delegate[] delegates) { throw null; }
- protected virtual System.Delegate CombineImpl(System.Delegate d) { throw null; }
- public static System.Delegate CreateDelegate(System.Type type, object firstArgument, System.Reflection.MethodInfo method) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecuritySafeCriticalAttribute]
- public static System.Delegate CreateDelegate(System.Type type, object firstArgument, System.Reflection.MethodInfo method, bool throwOnBindFailure) { throw null; }
- public static System.Delegate CreateDelegate(System.Type type, object target, string method) { throw null; }
- public static System.Delegate CreateDelegate(System.Type type, object target, string method, bool ignoreCase) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Delegate CreateDelegate(System.Type type, object target, string method, bool ignoreCase, bool throwOnBindFailure) { throw null; }
- public static System.Delegate CreateDelegate(System.Type type, System.Reflection.MethodInfo method) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecuritySafeCriticalAttribute]
- public static System.Delegate CreateDelegate(System.Type type, System.Reflection.MethodInfo method, bool throwOnBindFailure) { throw null; }
- public static System.Delegate CreateDelegate(System.Type type, System.Type target, string method) { throw null; }
- public static System.Delegate CreateDelegate(System.Type type, System.Type target, string method, bool ignoreCase) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Delegate CreateDelegate(System.Type type, System.Type target, string method, bool ignoreCase, bool throwOnBindFailure) { throw null; }
- public object DynamicInvoke(params object[] args) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- protected virtual object DynamicInvokeImpl(object[] args) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override bool Equals(object obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public virtual System.Delegate[] GetInvocationList() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- protected virtual System.Reflection.MethodInfo GetMethodImpl() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public static bool operator ==(System.Delegate d1, System.Delegate d2) { throw null; }
- public static bool operator !=(System.Delegate d1, System.Delegate d2) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Delegate Remove(System.Delegate source, System.Delegate value) { throw null; }
- public static System.Delegate RemoveAll(System.Delegate source, System.Delegate value) { throw null; }
- protected virtual System.Delegate RemoveImpl(System.Delegate d) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class DivideByZeroException : System.ArithmeticException
- {
- public DivideByZeroException() { }
- public DivideByZeroException(string message) { }
- public DivideByZeroException(string message, System.Exception innerException) { }
- protected DivideByZeroException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class DllNotFoundException : System.TypeLoadException
- {
- public DllNotFoundException() { }
- public DllNotFoundException(string message) { }
- public DllNotFoundException(string message, System.Exception inner) { }
- protected DllNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct Double : System.IComparable, System.IComparable<double>, System.IConvertible, System.IEquatable<double>, System.IFormattable
- {
- public const double Epsilon = 4.94065645841247E-324;
- public const double MaxValue = 1.7976931348623157E+308;
- public const double MinValue = -1.7976931348623157E+308;
- public const double NaN = 0.0 / 0.0;
- public const double NegativeInfinity = -1.0 / 0.0;
- public const double PositiveInfinity = 1.0 / 0.0;
- public int CompareTo(System.Double value) { throw null; }
- public int CompareTo(object value) { throw null; }
- public bool Equals(System.Double obj) { throw null; }
- public override bool Equals(object obj) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override int GetHashCode() { throw null; }
- public System.TypeCode GetTypeCode() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static bool IsInfinity(System.Double d) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static bool IsNaN(System.Double d) { throw null; }
- public static bool IsNegativeInfinity(System.Double d) { throw null; }
- public static bool IsPositiveInfinity(System.Double d) { throw null; }
- public static bool operator ==(System.Double left, System.Double right) { throw null; }
- public static bool operator >(System.Double left, System.Double right) { throw null; }
- public static bool operator >=(System.Double left, System.Double right) { throw null; }
- public static bool operator !=(System.Double left, System.Double right) { throw null; }
- public static bool operator <(System.Double left, System.Double right) { throw null; }
- public static bool operator <=(System.Double left, System.Double right) { throw null; }
- public static System.Double Parse(string s) { throw null; }
- public static System.Double Parse(string s, System.Globalization.NumberStyles style) { throw null; }
- public static System.Double Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider) { throw null; }
- public static System.Double Parse(string s, System.IFormatProvider provider) { throw null; }
- bool System.IConvertible.ToBoolean(System.IFormatProvider provider) { throw null; }
- byte System.IConvertible.ToByte(System.IFormatProvider provider) { throw null; }
- char System.IConvertible.ToChar(System.IFormatProvider provider) { throw null; }
- System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider provider) { throw null; }
- decimal System.IConvertible.ToDecimal(System.IFormatProvider provider) { throw null; }
- System.Double System.IConvertible.ToDouble(System.IFormatProvider provider) { throw null; }
- short System.IConvertible.ToInt16(System.IFormatProvider provider) { throw null; }
- int System.IConvertible.ToInt32(System.IFormatProvider provider) { throw null; }
- long System.IConvertible.ToInt64(System.IFormatProvider provider) { throw null; }
- sbyte System.IConvertible.ToSByte(System.IFormatProvider provider) { throw null; }
- float System.IConvertible.ToSingle(System.IFormatProvider provider) { throw null; }
- object System.IConvertible.ToType(System.Type type, System.IFormatProvider provider) { throw null; }
- ushort System.IConvertible.ToUInt16(System.IFormatProvider provider) { throw null; }
- uint System.IConvertible.ToUInt32(System.IFormatProvider provider) { throw null; }
- ulong System.IConvertible.ToUInt64(System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override string ToString() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(string format) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(string format, System.IFormatProvider provider) { throw null; }
- public static bool TryParse(string s, out System.Double result) { result = default(double); throw null; }
- public static bool TryParse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider, out System.Double result) { result = default(double); throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class DuplicateWaitObjectException : System.ArgumentException
- {
- public DuplicateWaitObjectException() { }
- public DuplicateWaitObjectException(string parameterName) { }
- public DuplicateWaitObjectException(string message, System.Exception innerException) { }
- public DuplicateWaitObjectException(string parameterName, string message) { }
- protected DuplicateWaitObjectException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class EntryPointNotFoundException : System.TypeLoadException
- {
- public EntryPointNotFoundException() { }
- public EntryPointNotFoundException(string message) { }
- public EntryPointNotFoundException(string message, System.Exception inner) { }
- protected EntryPointNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class Enum : System.ValueType, System.IComparable, System.IConvertible, System.IFormattable
- {
- protected Enum() { }
- [System.Security.SecuritySafeCriticalAttribute]
- public int CompareTo(object target) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public override bool Equals(object obj) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static string Format(System.Type enumType, object value, string format) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override int GetHashCode() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static string GetName(System.Type enumType, object value) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static string[] GetNames(System.Type enumType) { throw null; }
- public System.TypeCode GetTypeCode() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static System.Type GetUnderlyingType(System.Type enumType) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static System.Array GetValues(System.Type enumType) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public bool HasFlag(System.Enum flag) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static bool IsDefined(System.Type enumType, object value) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static object Parse(System.Type enumType, string value) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static object Parse(System.Type enumType, string value, bool ignoreCase) { throw null; }
- bool System.IConvertible.ToBoolean(System.IFormatProvider provider) { throw null; }
- byte System.IConvertible.ToByte(System.IFormatProvider provider) { throw null; }
- char System.IConvertible.ToChar(System.IFormatProvider provider) { throw null; }
- System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider provider) { throw null; }
- decimal System.IConvertible.ToDecimal(System.IFormatProvider provider) { throw null; }
- double System.IConvertible.ToDouble(System.IFormatProvider provider) { throw null; }
- short System.IConvertible.ToInt16(System.IFormatProvider provider) { throw null; }
- int System.IConvertible.ToInt32(System.IFormatProvider provider) { throw null; }
- long System.IConvertible.ToInt64(System.IFormatProvider provider) { throw null; }
- sbyte System.IConvertible.ToSByte(System.IFormatProvider provider) { throw null; }
- float System.IConvertible.ToSingle(System.IFormatProvider provider) { throw null; }
- object System.IConvertible.ToType(System.Type type, System.IFormatProvider provider) { throw null; }
- ushort System.IConvertible.ToUInt16(System.IFormatProvider provider) { throw null; }
- uint System.IConvertible.ToUInt32(System.IFormatProvider provider) { throw null; }
- ulong System.IConvertible.ToUInt64(System.IFormatProvider provider) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static object ToObject(System.Type enumType, byte value) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static object ToObject(System.Type enumType, short value) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static object ToObject(System.Type enumType, int value) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static object ToObject(System.Type enumType, long value) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static object ToObject(System.Type enumType, object value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static object ToObject(System.Type enumType, sbyte value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static object ToObject(System.Type enumType, ushort value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static object ToObject(System.Type enumType, uint value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static object ToObject(System.Type enumType, ulong value) { throw null; }
- public override string ToString() { throw null; }
- [System.ObsoleteAttribute("The provider argument is not used. Please use ToString().")]
- public string ToString(System.IFormatProvider provider) { throw null; }
- public string ToString(string format) { throw null; }
- [System.ObsoleteAttribute("The provider argument is not used. Please use ToString(String).")]
- public string ToString(string format, System.IFormatProvider provider) { throw null; }
- public static bool TryParse<TEnum>(string value, out TEnum result) where TEnum : struct { result = default(TEnum); throw null; }
- public static bool TryParse<TEnum>(string value, bool ignoreCase, out TEnum result) where TEnum : struct { result = default(TEnum); throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static partial class Environment
- {
- public static int CurrentManagedThreadId { get { throw null; } }
- public static int ExitCode { [System.Security.SecuritySafeCriticalAttribute][System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]get { throw null; } [System.Security.SecuritySafeCriticalAttribute][System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]set { } }
- public static bool HasShutdownStarted { [System.Security.SecuritySafeCriticalAttribute][System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]get { throw null; } }
- public static string MachineName { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public static string NewLine { get { throw null; } }
- public static int ProcessorCount { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public static string StackTrace { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public static int TickCount { [System.Security.SecuritySafeCriticalAttribute][System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]get { throw null; } }
- public static System.Version Version { get { throw null; } }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void Exit(int exitCode) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static string ExpandEnvironmentVariables(string name) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public static void FailFast(string message) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public static void FailFast(string message, System.Exception exception) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static string[] GetCommandLineArgs() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static string GetEnvironmentVariable(string variable) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Collections.IDictionary GetEnvironmentVariables() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void SetEnvironmentVariable(string variable, string value) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class EventArgs
- {
- public static readonly System.EventArgs Empty;
- public EventArgs() { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public delegate void EventHandler(object sender, System.EventArgs e);
- public delegate void EventHandler<TEventArgs>(object sender, TEventArgs e);
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class Exception : System.Runtime.Serialization.ISerializable
- {
- public Exception() { }
- [System.Security.SecuritySafeCriticalAttribute]
- protected Exception(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public Exception(string message) { }
- public Exception(string message, System.Exception innerException) { }
- public virtual System.Collections.IDictionary Data { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public virtual string HelpLink { get { throw null; } set { } }
- public int HResult { get { throw null; } protected set { } }
- public System.Exception InnerException { get { throw null; } }
- public virtual string Message { get { throw null; } }
- public virtual string Source { [System.Security.SecurityCriticalAttribute]get { throw null; } [System.Security.SecurityCriticalAttribute]set { } }
- public virtual string StackTrace { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public System.Reflection.MethodBase TargetSite { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- protected event System.EventHandler<System.Runtime.Serialization.SafeSerializationEventArgs> SerializeObjectState { add { } remove { } }
- public virtual System.Exception GetBaseException() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public new System.Type GetType() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override string ToString() { throw null; }
- }
- [System.ObsoleteAttribute("This type previously indicated an unspecified fatal error in the runtime. The runtime no longer raises this exception so this type is obsolete.")]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class ExecutionEngineException : System.SystemException
- {
- public ExecutionEngineException() { }
- public ExecutionEngineException(string message) { }
- public ExecutionEngineException(string message, System.Exception innerException) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class FieldAccessException : System.MemberAccessException
- {
- public FieldAccessException() { }
- public FieldAccessException(string message) { }
- public FieldAccessException(string message, System.Exception inner) { }
- protected FieldAccessException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(16), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class FlagsAttribute : System.Attribute
- {
- public FlagsAttribute() { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class FormatException : System.SystemException
- {
- public FormatException() { }
- public FormatException(string message) { }
- public FormatException(string message, System.Exception innerException) { }
- protected FormatException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- public abstract partial class FormattableString : System.IFormattable
- {
- protected FormattableString() { }
- public abstract int ArgumentCount { get; }
- public abstract string Format { get; }
- public abstract object GetArgument(int index);
- public abstract object[] GetArguments();
- public static string Invariant(System.FormattableString formattable) { throw null; }
- string System.IFormattable.ToString(string ignored, System.IFormatProvider formatProvider) { throw null; }
- public override string ToString() { throw null; }
- public abstract string ToString(System.IFormatProvider formatProvider);
- }
- [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Core, Version=2.0.5.0, Culture=Neutral, PublicKeyToken=7cec85d7bea7798e")]
- public delegate TResult Func<out TResult>();
- [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Core, Version=2.0.5.0, Culture=Neutral, PublicKeyToken=7cec85d7bea7798e")]
- public delegate TResult Func<in T, out TResult>(T arg);
- [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Core, Version=2.0.5.0, Culture=Neutral, PublicKeyToken=7cec85d7bea7798e")]
- public delegate TResult Func<in T1, in T2, out TResult>(T1 arg1, T2 arg2);
- [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Core, Version=2.0.5.0, Culture=Neutral, PublicKeyToken=7cec85d7bea7798e")]
- public delegate TResult Func<in T1, in T2, in T3, out TResult>(T1 arg1, T2 arg2, T3 arg3);
- [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Core, Version=2.0.5.0, Culture=Neutral, PublicKeyToken=7cec85d7bea7798e")]
- public delegate TResult Func<in T1, in T2, in T3, in T4, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4);
- public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5);
- public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6);
- public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7);
- public delegate TResult Func<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, out TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8);
- public static partial class GC
- {
- public static int MaxGeneration { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- [System.Security.SecurityCriticalAttribute]
- public static void AddMemoryPressure(long bytesAllocated) { }
- [System.Security.SecurityCriticalAttribute]
- public static void CancelFullGCNotification() { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void Collect() { }
- public static void Collect(int generation) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void Collect(int generation, System.GCCollectionMode mode) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void Collect(int generation, System.GCCollectionMode mode, bool blocking) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void Collect(int generation, System.GCCollectionMode mode, bool blocking, bool compacting) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static int CollectionCount(int generation) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static int GetGeneration(object obj) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static int GetGeneration(System.WeakReference wo) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static long GetTotalMemory(bool forceFullCollection) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- public static void KeepAlive(object obj) { }
- [System.Security.SecurityCriticalAttribute]
- public static void RegisterForFullGCNotification(int maxGenerationThreshold, int largeObjectHeapThreshold) { }
- [System.Security.SecurityCriticalAttribute]
- public static void RemoveMemoryPressure(long bytesAllocated) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void ReRegisterForFinalize(object obj) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void SuppressFinalize(object obj) { }
- [System.Security.SecurityCriticalAttribute]
- public static System.GCNotificationStatus WaitForFullGCApproach() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.GCNotificationStatus WaitForFullGCApproach(int millisecondsTimeout) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.GCNotificationStatus WaitForFullGCComplete() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.GCNotificationStatus WaitForFullGCComplete(int millisecondsTimeout) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void WaitForPendingFinalizers() { }
- }
- public enum GCNotificationStatus
- {
- Canceled = 2,
- Failed = 1,
- NotApplicable = 4,
- Succeeded = 0,
- Timeout = 3,
- }
- public enum GCCollectionMode
- {
- Default = 0,
- Forced = 1,
- Optimized = 2,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct Guid : System.IComparable, System.IComparable<System.Guid>, System.IEquatable<System.Guid>, System.IFormattable
- {
- public static readonly System.Guid Empty;
- public Guid(byte[] b) { throw null;}
- public Guid(int a, short b, short c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k) { throw null;}
- public Guid(int a, short b, short c, byte[] d) { throw null;}
- public Guid(string g) { throw null;}
- [System.CLSCompliantAttribute(false)]
- public Guid(uint a, ushort b, ushort c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k) { throw null;}
- public int CompareTo(System.Guid value) { throw null; }
- public int CompareTo(object value) { throw null; }
- public bool Equals(System.Guid g) { throw null; }
- public override bool Equals(object o) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override int GetHashCode() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Guid NewGuid() { throw null; }
- public static bool operator ==(System.Guid a, System.Guid b) { throw null; }
- public static bool operator !=(System.Guid a, System.Guid b) { throw null; }
- public static System.Guid Parse(string input) { throw null; }
- public static System.Guid ParseExact(string input, string format) { throw null; }
- public byte[] ToByteArray() { throw null; }
- public override string ToString() { throw null; }
- public string ToString(string format) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(string format, System.IFormatProvider provider) { throw null; }
- public static bool TryParse(string input, out System.Guid result) { result = default(System.Guid); throw null; }
- public static bool TryParseExact(string input, string format, out System.Guid result) { result = default(System.Guid); throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface IAsyncResult
- {
- object AsyncState { get; }
- System.Threading.WaitHandle AsyncWaitHandle { get; }
- bool CompletedSynchronously { get; }
- bool IsCompleted { get; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface ICloneable
- {
- object Clone();
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface IComparable
- {
- int CompareTo(object obj);
- }
- public partial interface IComparable<in T>
- {
- int CompareTo(T other);
- }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface IConvertible
- {
- System.TypeCode GetTypeCode();
- bool ToBoolean(System.IFormatProvider provider);
- byte ToByte(System.IFormatProvider provider);
- char ToChar(System.IFormatProvider provider);
- System.DateTime ToDateTime(System.IFormatProvider provider);
- decimal ToDecimal(System.IFormatProvider provider);
- double ToDouble(System.IFormatProvider provider);
- short ToInt16(System.IFormatProvider provider);
- int ToInt32(System.IFormatProvider provider);
- long ToInt64(System.IFormatProvider provider);
- sbyte ToSByte(System.IFormatProvider provider);
- float ToSingle(System.IFormatProvider provider);
- string ToString(System.IFormatProvider provider);
- object ToType(System.Type conversionType, System.IFormatProvider provider);
- ushort ToUInt16(System.IFormatProvider provider);
- uint ToUInt32(System.IFormatProvider provider);
- ulong ToUInt64(System.IFormatProvider provider);
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface ICustomFormatter
- {
- string Format(string format, object arg, System.IFormatProvider formatProvider);
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface IDisposable
- {
- void Dispose();
- }
- public partial interface IEquatable<T>
- {
- bool Equals(T other);
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface IFormatProvider
- {
- object GetFormat(System.Type formatType);
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface IFormattable
- {
- string ToString(string format, System.IFormatProvider formatProvider);
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class IndexOutOfRangeException : System.SystemException
- {
- public IndexOutOfRangeException() { }
- public IndexOutOfRangeException(string message) { }
- public IndexOutOfRangeException(string message, System.Exception innerException) { }
- }
- public sealed partial class InsufficientExecutionStackException : System.SystemException
- {
- public InsufficientExecutionStackException() { }
- public InsufficientExecutionStackException(string message) { }
- public InsufficientExecutionStackException(string message, System.Exception innerException) { }
- }
- public sealed partial class InsufficientMemoryException : System.OutOfMemoryException
- {
- public InsufficientMemoryException() { }
- public InsufficientMemoryException(string message) { }
- public InsufficientMemoryException(string message, System.Exception innerException) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct Int16 : System.IComparable, System.IComparable<short>, System.IConvertible, System.IEquatable<short>, System.IFormattable
- {
- public const short MaxValue = (short)32767;
- public const short MinValue = (short)-32768;
- public int CompareTo(System.Int16 value) { throw null; }
- public int CompareTo(object value) { throw null; }
- public bool Equals(System.Int16 obj) { throw null; }
- public override bool Equals(object obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public System.TypeCode GetTypeCode() { throw null; }
- public static System.Int16 Parse(string s) { throw null; }
- public static System.Int16 Parse(string s, System.Globalization.NumberStyles style) { throw null; }
- public static System.Int16 Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider) { throw null; }
- public static System.Int16 Parse(string s, System.IFormatProvider provider) { throw null; }
- bool System.IConvertible.ToBoolean(System.IFormatProvider provider) { throw null; }
- byte System.IConvertible.ToByte(System.IFormatProvider provider) { throw null; }
- char System.IConvertible.ToChar(System.IFormatProvider provider) { throw null; }
- System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider provider) { throw null; }
- decimal System.IConvertible.ToDecimal(System.IFormatProvider provider) { throw null; }
- double System.IConvertible.ToDouble(System.IFormatProvider provider) { throw null; }
- System.Int16 System.IConvertible.ToInt16(System.IFormatProvider provider) { throw null; }
- int System.IConvertible.ToInt32(System.IFormatProvider provider) { throw null; }
- long System.IConvertible.ToInt64(System.IFormatProvider provider) { throw null; }
- sbyte System.IConvertible.ToSByte(System.IFormatProvider provider) { throw null; }
- float System.IConvertible.ToSingle(System.IFormatProvider provider) { throw null; }
- object System.IConvertible.ToType(System.Type type, System.IFormatProvider provider) { throw null; }
- ushort System.IConvertible.ToUInt16(System.IFormatProvider provider) { throw null; }
- uint System.IConvertible.ToUInt32(System.IFormatProvider provider) { throw null; }
- ulong System.IConvertible.ToUInt64(System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override string ToString() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(System.IFormatProvider provider) { throw null; }
- public string ToString(string format) { throw null; }
- public string ToString(string format, System.IFormatProvider provider) { throw null; }
- public static bool TryParse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider, out System.Int16 result) { result = default(short); throw null; }
- public static bool TryParse(string s, out System.Int16 result) { result = default(short); throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct Int32 : System.IComparable, System.IComparable<int>, System.IConvertible, System.IEquatable<int>, System.IFormattable
- {
- public const int MaxValue = 2147483647;
- public const int MinValue = -2147483648;
- public System.Int32 CompareTo(System.Int32 value) { throw null; }
- public System.Int32 CompareTo(object value) { throw null; }
- public bool Equals(System.Int32 obj) { throw null; }
- public override bool Equals(object obj) { throw null; }
- public override System.Int32 GetHashCode() { throw null; }
- public System.TypeCode GetTypeCode() { throw null; }
- public static System.Int32 Parse(string s) { throw null; }
- public static System.Int32 Parse(string s, System.Globalization.NumberStyles style) { throw null; }
- public static System.Int32 Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider) { throw null; }
- public static System.Int32 Parse(string s, System.IFormatProvider provider) { throw null; }
- bool System.IConvertible.ToBoolean(System.IFormatProvider provider) { throw null; }
- byte System.IConvertible.ToByte(System.IFormatProvider provider) { throw null; }
- char System.IConvertible.ToChar(System.IFormatProvider provider) { throw null; }
- System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider provider) { throw null; }
- decimal System.IConvertible.ToDecimal(System.IFormatProvider provider) { throw null; }
- double System.IConvertible.ToDouble(System.IFormatProvider provider) { throw null; }
- short System.IConvertible.ToInt16(System.IFormatProvider provider) { throw null; }
- System.Int32 System.IConvertible.ToInt32(System.IFormatProvider provider) { throw null; }
- long System.IConvertible.ToInt64(System.IFormatProvider provider) { throw null; }
- sbyte System.IConvertible.ToSByte(System.IFormatProvider provider) { throw null; }
- float System.IConvertible.ToSingle(System.IFormatProvider provider) { throw null; }
- object System.IConvertible.ToType(System.Type type, System.IFormatProvider provider) { throw null; }
- ushort System.IConvertible.ToUInt16(System.IFormatProvider provider) { throw null; }
- uint System.IConvertible.ToUInt32(System.IFormatProvider provider) { throw null; }
- ulong System.IConvertible.ToUInt64(System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override string ToString() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(string format) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(string format, System.IFormatProvider provider) { throw null; }
- public static bool TryParse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider, out System.Int32 result) { result = default(int); throw null; }
- public static bool TryParse(string s, out System.Int32 result) { result = default(int); throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct Int64 : System.IComparable, System.IComparable<long>, System.IConvertible, System.IEquatable<long>, System.IFormattable
- {
- public const long MaxValue = (long)9223372036854775807;
- public const long MinValue = (long)-9223372036854775808;
- public int CompareTo(System.Int64 value) { throw null; }
- public int CompareTo(object value) { throw null; }
- public bool Equals(System.Int64 obj) { throw null; }
- public override bool Equals(object obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public System.TypeCode GetTypeCode() { throw null; }
- public static System.Int64 Parse(string s) { throw null; }
- public static System.Int64 Parse(string s, System.Globalization.NumberStyles style) { throw null; }
- public static System.Int64 Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider) { throw null; }
- public static System.Int64 Parse(string s, System.IFormatProvider provider) { throw null; }
- bool System.IConvertible.ToBoolean(System.IFormatProvider provider) { throw null; }
- byte System.IConvertible.ToByte(System.IFormatProvider provider) { throw null; }
- char System.IConvertible.ToChar(System.IFormatProvider provider) { throw null; }
- System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider provider) { throw null; }
- decimal System.IConvertible.ToDecimal(System.IFormatProvider provider) { throw null; }
- double System.IConvertible.ToDouble(System.IFormatProvider provider) { throw null; }
- short System.IConvertible.ToInt16(System.IFormatProvider provider) { throw null; }
- int System.IConvertible.ToInt32(System.IFormatProvider provider) { throw null; }
- System.Int64 System.IConvertible.ToInt64(System.IFormatProvider provider) { throw null; }
- sbyte System.IConvertible.ToSByte(System.IFormatProvider provider) { throw null; }
- float System.IConvertible.ToSingle(System.IFormatProvider provider) { throw null; }
- object System.IConvertible.ToType(System.Type type, System.IFormatProvider provider) { throw null; }
- ushort System.IConvertible.ToUInt16(System.IFormatProvider provider) { throw null; }
- uint System.IConvertible.ToUInt32(System.IFormatProvider provider) { throw null; }
- ulong System.IConvertible.ToUInt64(System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override string ToString() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(string format) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(string format, System.IFormatProvider provider) { throw null; }
- public static bool TryParse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider, out System.Int64 result) { result = default(long); throw null; }
- public static bool TryParse(string s, out System.Int64 result) { result = default(long); throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct IntPtr : System.Runtime.Serialization.ISerializable
- {
- public static readonly System.IntPtr Zero;
- [System.Security.SecuritySafeCriticalAttribute]
- public IntPtr(int value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public IntPtr(long value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe IntPtr(void* value) { throw null; }
- public static int Size { get { throw null; } }
- public static System.IntPtr Add(System.IntPtr pointer, int offset) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override bool Equals(object obj) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override int GetHashCode() { throw null; }
- public static System.IntPtr operator +(System.IntPtr pointer, int offset) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static bool operator ==(System.IntPtr value1, System.IntPtr value2) { throw null; }
- public static explicit operator System.IntPtr(int value) { throw null; }
- public static explicit operator System.IntPtr(long value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static explicit operator int(System.IntPtr value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static explicit operator long(System.IntPtr value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public unsafe static explicit operator void* (System.IntPtr value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe static explicit operator System.IntPtr(void* value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static bool operator !=(System.IntPtr value1, System.IntPtr value2) { throw null; }
- public static System.IntPtr operator -(System.IntPtr pointer, int offset) { throw null; }
- public static System.IntPtr Subtract(System.IntPtr pointer, int offset) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public int ToInt32() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public long ToInt64() { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public unsafe void* ToPointer() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override string ToString() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(string format) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class InvalidCastException : System.SystemException
- {
- public InvalidCastException() { }
- public InvalidCastException(string message) { }
- public InvalidCastException(string message, System.Exception innerException) { }
- public InvalidCastException(string message, int errorCode) { }
- protected InvalidCastException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class InvalidOperationException : System.SystemException
- {
- public InvalidOperationException() { }
- public InvalidOperationException(string message) { }
- public InvalidOperationException(string message, System.Exception innerException) { }
- protected InvalidOperationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class InvalidProgramException : System.SystemException
- {
- public InvalidProgramException() { }
- public InvalidProgramException(string message) { }
- public InvalidProgramException(string message, System.Exception inner) { }
- }
- [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
- public partial class InvalidTimeZoneException : System.Exception
- {
- public InvalidTimeZoneException() { }
- public InvalidTimeZoneException(string message) { }
- public InvalidTimeZoneException(string message, System.Exception innerException) { }
- protected InvalidTimeZoneException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- public partial interface IObservable<out T>
- {
- System.IDisposable Subscribe(System.IObserver<T> observer);
- }
- public partial interface IObserver<in T>
- {
- void OnCompleted();
- void OnError(System.Exception error);
- void OnNext(T value);
- }
- public partial interface IProgress<in T>
- {
- void Report(T value);
- }
- public partial interface IServiceProvider
- {
- object GetService(System.Type serviceType);
- }
- [System.Diagnostics.DebuggerDisplayAttribute("ThreadSafetyMode={Mode}, IsValueCreated={IsValueCreated}, IsValueFaulted={IsValueFaulted}, Value={ValueForDebugDisplay}")]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public partial class Lazy<T>
- {
- public Lazy() { }
- public Lazy(T value) { }
- public Lazy(bool isThreadSafe) { }
- public Lazy(System.Func<T> valueFactory) { }
- public Lazy(System.Func<T> valueFactory, bool isThreadSafe) { }
- public Lazy(System.Func<T> valueFactory, System.Threading.LazyThreadSafetyMode mode) { }
- public Lazy(System.Threading.LazyThreadSafetyMode mode) { }
- public bool IsValueCreated { get { throw null; } }
- [System.Diagnostics.DebuggerBrowsableAttribute((System.Diagnostics.DebuggerBrowsableState)(0))]
- public T Value { get { throw null; } }
- public override string ToString() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class MarshalByRefObject
- {
- protected MarshalByRefObject() { }
- public object GetLifetimeService() { throw null; }
- public virtual object InitializeLifetimeService() { throw null; }
- protected System.MarshalByRefObject MemberwiseClone(bool cloneIdentity) { throw null; }
-
- }
- public static partial class Math
- {
- public const double E = 2.7182818284590451;
- public const double PI = 3.1415926535897931;
- public static decimal Abs(decimal value) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static double Abs(double value) { throw null; }
- public static short Abs(short value) { throw null; }
- public static int Abs(int value) { throw null; }
- public static long Abs(long value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte Abs(sbyte value) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static float Abs(float value) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static double Acos(double d) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static double Asin(double d) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static double Atan(double d) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static double Atan2(double y, double x) { throw null; }
- public static long BigMul(int a, int b) { throw null; }
- public static decimal Ceiling(decimal d) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static double Ceiling(double a) { throw null; }
- public static byte Clamp(byte value, byte min, byte max) { throw null; }
- public static decimal Clamp(decimal value, decimal min, decimal max) { throw null; }
- public static double Clamp(double value, double min, double max) { throw null; }
- public static short Clamp(short value, short min, short max) { throw null; }
- public static int Clamp(int value, int min, int max) { throw null; }
- public static long Clamp(long value, long min, long max) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte Clamp(sbyte value, sbyte min, sbyte max) { throw null; }
- public static float Clamp(float value, float min, float max) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort Clamp(ushort value, ushort min, ushort max) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint Clamp(uint value, uint min, uint max) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong Clamp(ulong value, ulong min, ulong max) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static double Cos(double d) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static double Cosh(double value) { throw null; }
- public static int DivRem(int a, int b, out int result) { result = default(int); throw null; }
- public static long DivRem(long a, long b, out long result) { result = default(long); throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static double Exp(double d) { throw null; }
- public static decimal Floor(decimal d) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static double Floor(double d) { throw null; }
- public static double IEEERemainder(double x, double y) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static double Log(double d) { throw null; }
- public static double Log(double a, double newBase) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static double Log10(double d) { throw null; }
- public static byte Max(byte val1, byte val2) { throw null; }
- public static decimal Max(decimal val1, decimal val2) { throw null; }
- public static double Max(double val1, double val2) { throw null; }
- public static short Max(short val1, short val2) { throw null; }
- public static int Max(int val1, int val2) { throw null; }
- public static long Max(long val1, long val2) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte Max(sbyte val1, sbyte val2) { throw null; }
- public static float Max(float val1, float val2) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort Max(ushort val1, ushort val2) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint Max(uint val1, uint val2) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong Max(ulong val1, ulong val2) { throw null; }
- public static byte Min(byte val1, byte val2) { throw null; }
- public static decimal Min(decimal val1, decimal val2) { throw null; }
- public static double Min(double val1, double val2) { throw null; }
- public static short Min(short val1, short val2) { throw null; }
- public static int Min(int val1, int val2) { throw null; }
- public static long Min(long val1, long val2) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte Min(sbyte val1, sbyte val2) { throw null; }
- public static float Min(float val1, float val2) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort Min(ushort val1, ushort val2) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint Min(uint val1, uint val2) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ulong Min(ulong val1, ulong val2) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static double Pow(double x, double y) { throw null; }
- public static decimal Round(decimal d) { throw null; }
- public static decimal Round(decimal d, int decimals) { throw null; }
- public static decimal Round(decimal d, int decimals, System.MidpointRounding mode) { throw null; }
- public static decimal Round(decimal d, System.MidpointRounding mode) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static double Round(double a) { throw null; }
- public static double Round(double value, int digits) { throw null; }
- public static double Round(double value, int digits, System.MidpointRounding mode) { throw null; }
- public static double Round(double value, System.MidpointRounding mode) { throw null; }
- public static int Sign(decimal value) { throw null; }
- public static int Sign(double value) { throw null; }
- public static int Sign(short value) { throw null; }
- public static int Sign(int value) { throw null; }
- public static int Sign(long value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static int Sign(sbyte value) { throw null; }
- public static int Sign(float value) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static double Sin(double a) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static double Sinh(double value) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static double Sqrt(double d) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static double Tan(double a) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static double Tanh(double value) { throw null; }
- public static decimal Truncate(decimal d) { throw null; }
- public static double Truncate(double d) { throw null; }
- }
- public static partial class MathF
- {
- public const float E = 2.71828183f;
- public const float PI = 3.14159265f;
- public static float Abs(float x) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static float Acos(float x) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static float Asin(float x) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static float Atan(float x) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static float Atan2(float y, float x) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static float Ceiling(float x) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static float Cos(float x) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static float Cosh(float x) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static float Exp(float x) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static float Floor(float x) { throw null; }
- public static float IEEERemainder(float x, float y) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static float Log(float x) { throw null; }
- public static float Log(float x, float y) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static float Log10(float x) { throw null; }
- public static float Max(float x, float y) { throw null; }
- public static float Min(float x, float y) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static float Pow(float x, float y) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static float Round(float x) { throw null; }
- public static float Round(float x, int digits) { throw null; }
- public static float Round(float x, int digits, System.MidpointRounding mode) { throw null; }
- public static float Round(float x, System.MidpointRounding mode) { throw null; }
- public static int Sign(float x) { return default(int); }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static float Sin(float x) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static float Sinh(float x) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static float Sqrt(float x) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static float Tan(float x) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static float Tanh(float x) { throw null; }
- public static float Truncate(float x) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class MemberAccessException : System.SystemException
- {
- public MemberAccessException() { }
- public MemberAccessException(string message) { }
- public MemberAccessException(string message, System.Exception inner) { }
- protected MemberAccessException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class MethodAccessException : System.MemberAccessException
- {
- public MethodAccessException() { }
- public MethodAccessException(string message) { }
- public MethodAccessException(string message, System.Exception inner) { }
- protected MethodAccessException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum MidpointRounding
- {
- AwayFromZero = 1,
- ToEven = 0,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class MissingFieldException : System.MissingMemberException, System.Runtime.Serialization.ISerializable
- {
- public MissingFieldException() { }
- protected MissingFieldException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public MissingFieldException(string message) { }
- public MissingFieldException(string message, System.Exception inner) { }
- public MissingFieldException(string className, string fieldName) { }
- public override string Message { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class MissingMemberException : System.MemberAccessException, System.Runtime.Serialization.ISerializable
- {
- protected string ClassName;
- protected string MemberName;
- protected byte[] Signature;
- public MissingMemberException() { }
- protected MissingMemberException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public MissingMemberException(string message) { }
- public MissingMemberException(string message, System.Exception inner) { }
- public MissingMemberException(string className, string memberName) { }
- public override string Message { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- [System.Security.SecurityCriticalAttribute]
- public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class MissingMethodException : System.MissingMemberException, System.Runtime.Serialization.ISerializable
- {
- public MissingMethodException() { }
- protected MissingMethodException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public MissingMethodException(string message) { }
- public MissingMethodException(string message, System.Exception inner) { }
- public MissingMethodException(string className, string methodName) { }
- public override string Message { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public unsafe struct ModuleHandle
- {
- public static readonly System.ModuleHandle EmptyHandle;
- public int MDStreamVersion { get { throw null; } }
- public override int GetHashCode() { throw null; }
- public override bool Equals(object obj) { throw null; }
- public unsafe bool Equals(System.ModuleHandle handle) { throw null; }
- public static bool operator ==(System.ModuleHandle left, System.ModuleHandle right) { throw null; }
- public static bool operator !=(System.ModuleHandle left, System.ModuleHandle right) { throw null; }
- public System.RuntimeTypeHandle GetRuntimeTypeHandleFromMetadataToken(int typeToken) { throw null; }
- public System.RuntimeTypeHandle ResolveTypeHandle(int typeToken) { throw null; }
- public System.RuntimeTypeHandle ResolveTypeHandle(int typeToken, System.RuntimeTypeHandle[] typeInstantiationContext, System.RuntimeTypeHandle[] methodInstantiationContext) { throw null; }
- public System.RuntimeMethodHandle GetRuntimeMethodHandleFromMetadataToken(int methodToken) { throw null; }
- public System.RuntimeMethodHandle ResolveMethodHandle(int methodToken) { throw null; }
- public System.RuntimeMethodHandle ResolveMethodHandle(int methodToken, System.RuntimeTypeHandle[] typeInstantiationContext, System.RuntimeTypeHandle[] methodInstantiationContext) { throw null; }
- public System.RuntimeFieldHandle GetRuntimeFieldHandleFromMetadataToken(int fieldToken) { throw null; }
- public System.RuntimeFieldHandle ResolveFieldHandle(int fieldToken) { throw null; }
- public System.RuntimeFieldHandle ResolveFieldHandle(int fieldToken, System.RuntimeTypeHandle[] typeInstantiationContext, System.RuntimeTypeHandle[] methodInstantiationContext) { throw null; }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(64))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class MTAThreadAttribute : System.Attribute
- {
- public MTAThreadAttribute() { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class MulticastDelegate : System.Delegate
- {
- protected MulticastDelegate(object target, string method) : base (default(object), default(string)) { }
- protected MulticastDelegate(System.Type target, string method) : base (default(object), default(string)) { }
- [System.Security.SecuritySafeCriticalAttribute]
- protected sealed override System.Delegate CombineImpl(System.Delegate follow) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public sealed override bool Equals(object obj) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public sealed override int GetHashCode() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public sealed override System.Delegate[] GetInvocationList() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- protected override System.Reflection.MethodInfo GetMethodImpl() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public static bool operator ==(System.MulticastDelegate d1, System.MulticastDelegate d2) { throw null; }
- public static bool operator !=(System.MulticastDelegate d1, System.MulticastDelegate d2) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- protected sealed override System.Delegate RemoveImpl(System.Delegate value) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class MulticastNotSupportedException : System.SystemException
- {
- public MulticastNotSupportedException() { }
- public MulticastNotSupportedException(string message) { }
- public MulticastNotSupportedException(string message, System.Exception inner) { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(256), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class NonSerializedAttribute : System.Attribute
- {
- public NonSerializedAttribute() { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class NotFiniteNumberException : System.ArithmeticException
- {
- public NotFiniteNumberException() { }
- public NotFiniteNumberException(double offendingNumber) { }
- public NotFiniteNumberException(string message) { }
- public NotFiniteNumberException(string message, double offendingNumber) { }
- public NotFiniteNumberException(string message, double offendingNumber, System.Exception innerException) { }
- public NotFiniteNumberException(string message, System.Exception innerException) { }
- protected NotFiniteNumberException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- public double OffendingNumber { get { throw null; } }
- [System.Security.SecurityCriticalAttribute]
- public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class NotImplementedException : System.SystemException
- {
- public NotImplementedException() { }
- public NotImplementedException(string message) { }
- public NotImplementedException(string message, System.Exception inner) { }
- protected NotImplementedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class NotSupportedException : System.SystemException
- {
- public NotSupportedException() { }
- public NotSupportedException(string message) { }
- public NotSupportedException(string message, System.Exception innerException) { }
- protected NotSupportedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static partial class Nullable
- {
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static int Compare<T>(System.Nullable<T> n1, System.Nullable<T> n2) where T : struct { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static bool Equals<T>(System.Nullable<T> n1, System.Nullable<T> n2) where T : struct { throw null; }
- public static System.Type GetUnderlyingType(System.Type nullableType) { throw null; }
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct Nullable<T> where T : struct
- {
- public Nullable(T value) { throw null;}
- public bool HasValue { get { throw null; } }
- public T Value { get { throw null; } }
- public override bool Equals(object other) { throw null; }
- public override int GetHashCode() { throw null; }
- public T GetValueOrDefault() { throw null; }
- public T GetValueOrDefault(T defaultValue) { throw null; }
- public static explicit operator T (System.Nullable<T> value) { throw null; }
- public static implicit operator System.Nullable<T> (T value) { throw null; }
- public override string ToString() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class NullReferenceException : System.SystemException
- {
- public NullReferenceException() { }
- public NullReferenceException(string message) { }
- public NullReferenceException(string message, System.Exception innerException) { }
- protected NullReferenceException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(2))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class Object
- {
- public Object() { }
- public virtual bool Equals(System.Object obj) { throw null; }
- public static bool Equals(System.Object objA, System.Object objB) { throw null; }
- ~Object() { }
- public virtual int GetHashCode() { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public System.Type GetType() { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- protected System.Object MemberwiseClone() { throw null; }
- public static bool ReferenceEquals(System.Object objA, System.Object objB) { throw null; }
- public virtual string ToString() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class ObjectDisposedException : System.InvalidOperationException
- {
- public ObjectDisposedException(string objectName) { }
- public ObjectDisposedException(string message, System.Exception innerException) { }
- public ObjectDisposedException(string objectName, string message) { }
- protected ObjectDisposedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- public override string Message { get { throw null; } }
- public string ObjectName { get { throw null; } }
- [System.Security.SecurityCriticalAttribute]
- public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(6140), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class ObsoleteAttribute : System.Attribute
- {
- public ObsoleteAttribute() { }
- public ObsoleteAttribute(string message) { }
- public ObsoleteAttribute(string message, bool error) { }
- public bool IsError { get { throw null; } }
- public string Message { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class OperationCanceledException : System.SystemException
- {
- public OperationCanceledException() { }
- public OperationCanceledException(string message) { }
- public OperationCanceledException(string message, System.Exception innerException) { }
- public OperationCanceledException(string message, System.Exception innerException, System.Threading.CancellationToken token) { }
- public OperationCanceledException(string message, System.Threading.CancellationToken token) { }
- public OperationCanceledException(System.Threading.CancellationToken token) { }
- protected OperationCanceledException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- public System.Threading.CancellationToken CancellationToken { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class OutOfMemoryException : System.SystemException
- {
- public OutOfMemoryException() { }
- public OutOfMemoryException(string message) { }
- public OutOfMemoryException(string message, System.Exception innerException) { }
- protected OutOfMemoryException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class OverflowException : System.ArithmeticException
- {
- public OverflowException() { }
- public OverflowException(string message) { }
- public OverflowException(string message, System.Exception innerException) { }
- protected OverflowException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(2048), Inherited=true, AllowMultiple=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class ParamArrayAttribute : System.Attribute
- {
- public ParamArrayAttribute() { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class PlatformNotSupportedException : System.NotSupportedException
- {
- public PlatformNotSupportedException() { }
- public PlatformNotSupportedException(string message) { }
- public PlatformNotSupportedException(string message, System.Exception inner) { }
- protected PlatformNotSupportedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- public delegate bool Predicate<in T>(T obj);
- public partial class Progress<T> : System.IProgress<T>
- {
- public Progress() { }
- public Progress(System.Action<T> handler) { }
- public event System.EventHandler<T> ProgressChanged { add { } remove { } }
- protected virtual void OnReport(T value) { }
- void System.IProgress<T>.Report(T value) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class Random
- {
- public Random() { }
- public Random(int Seed) { }
- public virtual int Next() { throw null; }
- public virtual int Next(int maxValue) { throw null; }
- public virtual int Next(int minValue, int maxValue) { throw null; }
- public virtual void NextBytes(byte[] buffer) { }
- public virtual double NextDouble() { throw null; }
- protected virtual double Sample() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class RankException : System.SystemException
- {
- public RankException() { }
- public RankException(string message) { }
- public RankException(string message, System.Exception innerException) { }
- protected RankException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class ResolveEventArgs : System.EventArgs
- {
- public ResolveEventArgs(string name) { }
- public ResolveEventArgs(string name, System.Reflection.Assembly requestingAssembly) { }
- public string Name { get { throw null; } }
- public System.Reflection.Assembly RequestingAssembly { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecurityCriticalAttribute]
- public delegate System.Reflection.Assembly ResolveEventHandler(object sender, System.ResolveEventArgs args);
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct RuntimeArgumentHandle
- {
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct RuntimeFieldHandle : System.Runtime.Serialization.ISerializable
- {
- public System.IntPtr Value { [System.Security.SecurityCriticalAttribute]get { throw null; } }
- [System.Security.SecuritySafeCriticalAttribute]
- public override bool Equals(object obj) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public bool Equals(System.RuntimeFieldHandle handle) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override int GetHashCode() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public static bool operator ==(System.RuntimeFieldHandle left, System.RuntimeFieldHandle right) { throw null; }
- public static bool operator !=(System.RuntimeFieldHandle left, System.RuntimeFieldHandle right) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct RuntimeMethodHandle : System.Runtime.Serialization.ISerializable
- {
- public System.IntPtr Value { [System.Security.SecurityCriticalAttribute]get { throw null; } }
- [System.Security.SecuritySafeCriticalAttribute]
- public override bool Equals(object obj) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public bool Equals(System.RuntimeMethodHandle handle) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public System.IntPtr GetFunctionPointer() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override int GetHashCode() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public static bool operator ==(System.RuntimeMethodHandle left, System.RuntimeMethodHandle right) { throw null; }
- public static bool operator !=(System.RuntimeMethodHandle left, System.RuntimeMethodHandle right) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct RuntimeTypeHandle : System.Runtime.Serialization.ISerializable
- {
- public System.IntPtr Value { [System.Security.SecurityCriticalAttribute]get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public bool Equals(System.RuntimeTypeHandle handle) { throw null; }
- public override int GetHashCode() { throw null; }
- [System.CLSCompliantAttribute(false)]
- public System.ModuleHandle GetModuleHandle() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public static bool operator ==(object left, System.RuntimeTypeHandle right) { throw null; }
- public static bool operator ==(System.RuntimeTypeHandle left, object right) { throw null; }
- public static bool operator !=(object left, System.RuntimeTypeHandle right) { throw null; }
- public static bool operator !=(System.RuntimeTypeHandle left, object right) { throw null; }
- }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct SByte : System.IComparable, System.IComparable<sbyte>, System.IConvertible, System.IEquatable<sbyte>, System.IFormattable
- {
- public const sbyte MaxValue = (sbyte)127;
- public const sbyte MinValue = (sbyte)-128;
- public int CompareTo(object obj) { throw null; }
- public int CompareTo(System.SByte value) { throw null; }
- public override bool Equals(object obj) { throw null; }
- public bool Equals(System.SByte obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public System.TypeCode GetTypeCode() { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static System.SByte Parse(string s) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static System.SByte Parse(string s, System.Globalization.NumberStyles style) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static System.SByte Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static System.SByte Parse(string s, System.IFormatProvider provider) { throw null; }
- bool System.IConvertible.ToBoolean(System.IFormatProvider provider) { throw null; }
- byte System.IConvertible.ToByte(System.IFormatProvider provider) { throw null; }
- char System.IConvertible.ToChar(System.IFormatProvider provider) { throw null; }
- System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider provider) { throw null; }
- decimal System.IConvertible.ToDecimal(System.IFormatProvider provider) { throw null; }
- double System.IConvertible.ToDouble(System.IFormatProvider provider) { throw null; }
- short System.IConvertible.ToInt16(System.IFormatProvider provider) { throw null; }
- int System.IConvertible.ToInt32(System.IFormatProvider provider) { throw null; }
- long System.IConvertible.ToInt64(System.IFormatProvider provider) { throw null; }
- System.SByte System.IConvertible.ToSByte(System.IFormatProvider provider) { throw null; }
- float System.IConvertible.ToSingle(System.IFormatProvider provider) { throw null; }
- object System.IConvertible.ToType(System.Type type, System.IFormatProvider provider) { throw null; }
- ushort System.IConvertible.ToUInt16(System.IFormatProvider provider) { throw null; }
- uint System.IConvertible.ToUInt32(System.IFormatProvider provider) { throw null; }
- ulong System.IConvertible.ToUInt64(System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override string ToString() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(System.IFormatProvider provider) { throw null; }
- public string ToString(string format) { throw null; }
- public string ToString(string format, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static bool TryParse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider, out System.SByte result) { result = default(sbyte); throw null; }
- [System.CLSCompliantAttribute(false)]
- public static bool TryParse(string s, out System.SByte result) { result = default(sbyte); throw null; }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(4124), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class SerializableAttribute : System.Attribute
- {
- public SerializableAttribute() { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct Single : System.IComparable, System.IComparable<float>, System.IConvertible, System.IEquatable<float>, System.IFormattable
- {
- public const float Epsilon = 1.401298E-45f;
- public const float MaxValue = 3.40282347E+38f;
- public const float MinValue = -3.40282347E+38f;
- public const float NaN = 0.0f / 0.0f;
- public const float NegativeInfinity = -1.0f / 0.0f;
- public const float PositiveInfinity = 1.0f / 0.0f;
- public int CompareTo(object value) { throw null; }
- public int CompareTo(System.Single value) { throw null; }
- public override bool Equals(object obj) { throw null; }
- public bool Equals(System.Single obj) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override int GetHashCode() { throw null; }
- public System.TypeCode GetTypeCode() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static bool IsInfinity(System.Single f) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static bool IsNaN(System.Single f) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static bool IsNegativeInfinity(System.Single f) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static bool IsPositiveInfinity(System.Single f) { throw null; }
- public static bool operator ==(System.Single left, System.Single right) { throw null; }
- public static bool operator >(System.Single left, System.Single right) { throw null; }
- public static bool operator >=(System.Single left, System.Single right) { throw null; }
- public static bool operator !=(System.Single left, System.Single right) { throw null; }
- public static bool operator <(System.Single left, System.Single right) { throw null; }
- public static bool operator <=(System.Single left, System.Single right) { throw null; }
- public static System.Single Parse(string s) { throw null; }
- public static System.Single Parse(string s, System.Globalization.NumberStyles style) { throw null; }
- public static System.Single Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider) { throw null; }
- public static System.Single Parse(string s, System.IFormatProvider provider) { throw null; }
- bool System.IConvertible.ToBoolean(System.IFormatProvider provider) { throw null; }
- byte System.IConvertible.ToByte(System.IFormatProvider provider) { throw null; }
- char System.IConvertible.ToChar(System.IFormatProvider provider) { throw null; }
- System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider provider) { throw null; }
- decimal System.IConvertible.ToDecimal(System.IFormatProvider provider) { throw null; }
- double System.IConvertible.ToDouble(System.IFormatProvider provider) { throw null; }
- short System.IConvertible.ToInt16(System.IFormatProvider provider) { throw null; }
- int System.IConvertible.ToInt32(System.IFormatProvider provider) { throw null; }
- long System.IConvertible.ToInt64(System.IFormatProvider provider) { throw null; }
- sbyte System.IConvertible.ToSByte(System.IFormatProvider provider) { throw null; }
- System.Single System.IConvertible.ToSingle(System.IFormatProvider provider) { throw null; }
- object System.IConvertible.ToType(System.Type type, System.IFormatProvider provider) { throw null; }
- ushort System.IConvertible.ToUInt16(System.IFormatProvider provider) { throw null; }
- uint System.IConvertible.ToUInt32(System.IFormatProvider provider) { throw null; }
- ulong System.IConvertible.ToUInt64(System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override string ToString() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(string format) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(string format, System.IFormatProvider provider) { throw null; }
- public static bool TryParse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider, out System.Single result) { result = default(float); throw null; }
- public static bool TryParse(string s, out System.Single result) { result = default(float); throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class StackOverflowException : System.SystemException
- {
- public StackOverflowException() { }
- public StackOverflowException(string message) { }
- public StackOverflowException(string message, System.Exception innerException) { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(64))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class STAThreadAttribute : System.Attribute
- {
- public STAThreadAttribute() { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class String : System.Collections.Generic.IEnumerable<char>, System.Collections.IEnumerable, System.ICloneable, System.IComparable, System.IComparable<string>, System.IConvertible, System.IEquatable<string>
- {
- public static readonly string Empty;
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe String(char* value) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe String(char* value, int startIndex, int length) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
- [System.Security.SecuritySafeCriticalAttribute]
- public String(char c, int count) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
- [System.Security.SecuritySafeCriticalAttribute]
- public String(char[] value) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
- [System.Security.SecuritySafeCriticalAttribute]
- public String(char[] value, int startIndex, int length) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe String(sbyte* value) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe String(sbyte* value, int startIndex, int length) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe String(sbyte* value, int startIndex, int length, System.Text.Encoding enc) { }
- [System.Runtime.CompilerServices.IndexerName("Chars")]
- public char this[int index] { [System.Security.SecuritySafeCriticalAttribute][System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]get { throw null; } }
- public int Length { [System.Security.SecuritySafeCriticalAttribute][System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]get { throw null; } }
- public object Clone() { throw null; }
- public static int Compare(System.String strA, int indexA, System.String strB, int indexB, int length) { throw null; }
- public static int Compare(System.String strA, int indexA, System.String strB, int indexB, int length, bool ignoreCase) { throw null; }
- public static int Compare(System.String strA, int indexA, System.String strB, int indexB, int length, bool ignoreCase, System.Globalization.CultureInfo culture) { throw null; }
- public static int Compare(System.String strA, int indexA, System.String strB, int indexB, int length, System.Globalization.CultureInfo culture, System.Globalization.CompareOptions options) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static int Compare(System.String strA, int indexA, System.String strB, int indexB, int length, System.StringComparison comparisonType) { throw null; }
- public static int Compare(System.String strA, System.String strB) { throw null; }
- public static int Compare(System.String strA, System.String strB, bool ignoreCase) { throw null; }
- public static int Compare(System.String strA, System.String strB, bool ignoreCase, System.Globalization.CultureInfo culture) { throw null; }
- public static int Compare(System.String strA, System.String strB, System.Globalization.CultureInfo culture, System.Globalization.CompareOptions options) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static int Compare(System.String strA, System.String strB, System.StringComparison comparisonType) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static int CompareOrdinal(System.String strA, int indexA, System.String strB, int indexB, int length) { throw null; }
- public static int CompareOrdinal(System.String strA, System.String strB) { throw null; }
- public int CompareTo(object value) { throw null; }
- public int CompareTo(System.String strB) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public static System.String Concat(System.Collections.Generic.IEnumerable<string> values) { throw null; }
- public static System.String Concat(object arg0) { throw null; }
- public static System.String Concat(object arg0, object arg1) { throw null; }
- public static System.String Concat(object arg0, object arg1, object arg2) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.String Concat(params object[] args) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.String Concat(System.String str0, System.String str1) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.String Concat(System.String str0, System.String str1, System.String str2) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.String Concat(System.String str0, System.String str1, System.String str2, System.String str3) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.String Concat(params string[] values) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public static System.String Concat<T>(System.Collections.Generic.IEnumerable<T> values) { throw null; }
- public bool Contains(System.String value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.String Copy(System.String str) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count) { }
- public bool EndsWith(System.String value) { throw null; }
- public bool EndsWith(System.String value, bool ignoreCase, System.Globalization.CultureInfo culture) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public bool EndsWith(System.String value, System.StringComparison comparisonType) { throw null; }
- public bool EndsWith(System.Char value) { throw null; }
- public override bool Equals(object obj) { throw null; }
- public bool Equals(System.String value) { throw null; }
- public static bool Equals(System.String a, System.String b) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static bool Equals(System.String a, System.String b, System.StringComparison comparisonType) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public bool Equals(System.String value, System.StringComparison comparisonType) { throw null; }
- public static System.String Format(System.IFormatProvider provider, System.String format, object arg0) { throw null; }
- public static System.String Format(System.IFormatProvider provider, System.String format, object arg0, object arg1) { throw null; }
- public static System.String Format(System.IFormatProvider provider, System.String format, object arg0, object arg1, object arg2) { throw null; }
- public static System.String Format(System.IFormatProvider provider, System.String format, params object[] args) { throw null; }
- public static System.String Format(System.String format, object arg0) { throw null; }
- public static System.String Format(System.String format, object arg0, object arg1) { throw null; }
- public static System.String Format(System.String format, object arg0, object arg1, object arg2) { throw null; }
- public static System.String Format(System.String format, params object[] args) { throw null; }
- public System.CharEnumerator GetEnumerator() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override int GetHashCode() { throw null; }
- public System.TypeCode GetTypeCode() { throw null; }
- public int IndexOf(char value) { throw null; }
- public int IndexOf(char value, int startIndex) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public int IndexOf(char value, int startIndex, int count) { throw null; }
- public int IndexOf(System.String value) { throw null; }
- public int IndexOf(System.String value, int startIndex) { throw null; }
- public int IndexOf(System.String value, int startIndex, int count) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public int IndexOf(System.String value, int startIndex, int count, System.StringComparison comparisonType) { throw null; }
- public int IndexOf(System.String value, int startIndex, System.StringComparison comparisonType) { throw null; }
- public int IndexOf(System.String value, System.StringComparison comparisonType) { throw null; }
- public int IndexOfAny(char[] anyOf) { throw null; }
- public int IndexOfAny(char[] anyOf, int startIndex) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
- [System.Security.SecuritySafeCriticalAttribute]
- public int IndexOfAny(char[] anyOf, int startIndex, int count) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.String Insert(int startIndex, System.String value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.String Intern(System.String str) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.String IsInterned(System.String str) { throw null; }
- public bool IsNormalized() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public bool IsNormalized(System.Text.NormalizationForm normalizationForm) { throw null; }
- public static bool IsNullOrEmpty(System.String value) { throw null; }
- public static bool IsNullOrWhiteSpace(System.String value) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public static System.String Join(System.String separator, System.Collections.Generic.IEnumerable<string> values) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public static System.String Join(System.String separator, params object[] values) { throw null; }
- public static System.String Join(System.String separator, params string[] value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.String Join(System.String separator, string[] value, int startIndex, int count) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public static System.String Join<T>(System.String separator, System.Collections.Generic.IEnumerable<T> values) { throw null; }
- public int LastIndexOf(char value) { throw null; }
- public int LastIndexOf(char value, int startIndex) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public int LastIndexOf(char value, int startIndex, int count) { throw null; }
- public int LastIndexOf(System.String value) { throw null; }
- public int LastIndexOf(System.String value, int startIndex) { throw null; }
- public int LastIndexOf(System.String value, int startIndex, int count) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public int LastIndexOf(System.String value, int startIndex, int count, System.StringComparison comparisonType) { throw null; }
- public int LastIndexOf(System.String value, int startIndex, System.StringComparison comparisonType) { throw null; }
- public int LastIndexOf(System.String value, System.StringComparison comparisonType) { throw null; }
- public int LastIndexOfAny(char[] anyOf) { throw null; }
- public int LastIndexOfAny(char[] anyOf, int startIndex) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
- [System.Security.SecuritySafeCriticalAttribute]
- public int LastIndexOfAny(char[] anyOf, int startIndex, int count) { throw null; }
- public System.String Normalize() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.String Normalize(System.Text.NormalizationForm normalizationForm) { throw null; }
- public static bool operator ==(System.String a, System.String b) { throw null; }
- public static bool operator !=(System.String a, System.String b) { throw null; }
- public System.String PadLeft(int totalWidth) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.String PadLeft(int totalWidth, char paddingChar) { throw null; }
- public System.String PadRight(int totalWidth) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.String PadRight(int totalWidth, char paddingChar) { throw null; }
- public System.String Remove(int startIndex) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.String Remove(int startIndex, int count) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.String Replace(char oldChar, char newChar) { throw null; }
- public System.String Replace(System.String oldValue, System.String newValue) { throw null; }
- public System.String Replace(System.String oldValue, System.String newValue, System.StringComparison comparison) { throw null; }
- public System.String Replace(System.String oldValue, System.String newValue, System.Boolean ignoreCase, System.Globalization.CultureInfo cultureInfo) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public string[] Split(char separator, int count, System.StringSplitOptions options = (System.StringSplitOptions)(0)) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public string[] Split(char separator, System.StringSplitOptions options = (System.StringSplitOptions)(0)) { throw null; }
- public string[] Split(params char[] separator) { throw null; }
- public string[] Split(char[] separator, int count) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public string[] Split(char[] separator, int count, System.StringSplitOptions options) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public string[] Split(char[] separator, System.StringSplitOptions options) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public string[] Split(System.String separator, int count, System.StringSplitOptions options = (System.StringSplitOptions)(0)) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public string[] Split(System.String separator, System.StringSplitOptions options = (System.StringSplitOptions)(0)) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public string[] Split(string[] separator, int count, System.StringSplitOptions options) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public string[] Split(string[] separator, System.StringSplitOptions options) { throw null; }
- public bool StartsWith(System.String value) { throw null; }
- public bool StartsWith(System.String value, bool ignoreCase, System.Globalization.CultureInfo culture) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public bool StartsWith(System.String value, System.StringComparison comparisonType) { throw null; }
- public bool StartsWith(System.Char value) { throw null; }
- public System.String Substring(int startIndex) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.String Substring(int startIndex, int length) { throw null; }
- System.Collections.Generic.IEnumerator<char> System.Collections.Generic.IEnumerable<System.Char>.GetEnumerator() { throw null; }
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
- bool System.IConvertible.ToBoolean(System.IFormatProvider provider) { throw null; }
- byte System.IConvertible.ToByte(System.IFormatProvider provider) { throw null; }
- char System.IConvertible.ToChar(System.IFormatProvider provider) { throw null; }
- System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider provider) { throw null; }
- decimal System.IConvertible.ToDecimal(System.IFormatProvider provider) { throw null; }
- double System.IConvertible.ToDouble(System.IFormatProvider provider) { throw null; }
- short System.IConvertible.ToInt16(System.IFormatProvider provider) { throw null; }
- int System.IConvertible.ToInt32(System.IFormatProvider provider) { throw null; }
- long System.IConvertible.ToInt64(System.IFormatProvider provider) { throw null; }
- sbyte System.IConvertible.ToSByte(System.IFormatProvider provider) { throw null; }
- float System.IConvertible.ToSingle(System.IFormatProvider provider) { throw null; }
- object System.IConvertible.ToType(System.Type type, System.IFormatProvider provider) { throw null; }
- ushort System.IConvertible.ToUInt16(System.IFormatProvider provider) { throw null; }
- uint System.IConvertible.ToUInt32(System.IFormatProvider provider) { throw null; }
- ulong System.IConvertible.ToUInt64(System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public char[] ToCharArray() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public char[] ToCharArray(int startIndex, int length) { throw null; }
- public System.String ToLower() { throw null; }
- public System.String ToLower(System.Globalization.CultureInfo culture) { throw null; }
- public System.String ToLowerInvariant() { throw null; }
- public override System.String ToString() { throw null; }
- public System.String ToString(System.IFormatProvider provider) { throw null; }
- public System.String ToUpper() { throw null; }
- public System.String ToUpper(System.Globalization.CultureInfo culture) { throw null; }
- public System.String ToUpperInvariant() { throw null; }
- public System.String Trim() { throw null; }
- public System.String Trim(params char[] trimChars) { throw null; }
- public System.String TrimEnd(params char[] trimChars) { throw null; }
- public System.String TrimEnd() { throw null; }
- public System.String TrimStart(params char[] trimChars) { throw null; }
- public System.String TrimStart() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class StringComparer : System.Collections.Generic.IComparer<string>, System.Collections.Generic.IEqualityComparer<string>, System.Collections.IComparer, System.Collections.IEqualityComparer
- {
- protected StringComparer() { }
- public static System.StringComparer CurrentCulture { get { throw null; } }
- public static System.StringComparer CurrentCultureIgnoreCase { get { throw null; } }
- public static System.StringComparer InvariantCulture { get { throw null; } }
- public static System.StringComparer InvariantCultureIgnoreCase { get { throw null; } }
- public static System.StringComparer Ordinal { get { throw null; } }
- public static System.StringComparer OrdinalIgnoreCase { get { throw null; } }
- public int Compare(object x, object y) { throw null; }
- public abstract int Compare(string x, string y);
- public static System.StringComparer Create(System.Globalization.CultureInfo culture, bool ignoreCase) { throw null; }
- public new bool Equals(object x, object y) { throw null; }
- public abstract bool Equals(string x, string y);
- public int GetHashCode(object obj) { throw null; }
- public abstract int GetHashCode(string obj);
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum StringComparison
- {
- CurrentCulture = 0,
- CurrentCultureIgnoreCase = 1,
- InvariantCulture = 2,
- InvariantCultureIgnoreCase = 3,
- Ordinal = 4,
- OrdinalIgnoreCase = 5,
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public enum StringSplitOptions
- {
- None = 0,
- RemoveEmptyEntries = 1,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class SystemException : System.Exception
- {
- public SystemException() { }
- public SystemException(string message) { }
- public SystemException(string message, System.Exception innerException) { }
- protected SystemException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(256), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class ThreadStaticAttribute : System.Attribute
- {
- public ThreadStaticAttribute() { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class TimeoutException : System.SystemException
- {
- public TimeoutException() { }
- public TimeoutException(string message) { }
- public TimeoutException(string message, System.Exception innerException) { }
- protected TimeoutException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct TimeSpan : System.IComparable, System.IComparable<System.TimeSpan>, System.IEquatable<System.TimeSpan>, System.IFormattable
- {
- public static readonly System.TimeSpan MaxValue;
- public static readonly System.TimeSpan MinValue;
- public const long TicksPerDay = (long)864000000000;
- public const long TicksPerHour = (long)36000000000;
- public const long TicksPerMillisecond = (long)10000;
- public const long TicksPerMinute = (long)600000000;
- public const long TicksPerSecond = (long)10000000;
- public static readonly System.TimeSpan Zero;
- public TimeSpan(int hours, int minutes, int seconds) { throw null;}
- public TimeSpan(int days, int hours, int minutes, int seconds) { throw null;}
- public TimeSpan(int days, int hours, int minutes, int seconds, int milliseconds) { throw null;}
- public TimeSpan(long ticks) { throw null;}
- public int Days { get { throw null; } }
- public int Hours { get { throw null; } }
- public int Milliseconds { get { throw null; } }
- public int Minutes { get { throw null; } }
- public int Seconds { get { throw null; } }
- public long Ticks { get { throw null; } }
- public double TotalDays { get { throw null; } }
- public double TotalHours { get { throw null; } }
- public double TotalMilliseconds { get { throw null; } }
- public double TotalMinutes { get { throw null; } }
- public double TotalSeconds { get { throw null; } }
- public System.TimeSpan Add(System.TimeSpan ts) { throw null; }
- public static int Compare(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
- public int CompareTo(object value) { throw null; }
- public int CompareTo(System.TimeSpan value) { throw null; }
- public System.TimeSpan Duration() { throw null; }
- public override bool Equals(object value) { throw null; }
- public bool Equals(System.TimeSpan obj) { throw null; }
- public static bool Equals(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
- public static System.TimeSpan FromDays(double value) { throw null; }
- public static System.TimeSpan FromHours(double value) { throw null; }
- public static System.TimeSpan FromMilliseconds(double value) { throw null; }
- public static System.TimeSpan FromMinutes(double value) { throw null; }
- public static System.TimeSpan FromSeconds(double value) { throw null; }
- public static System.TimeSpan FromTicks(long value) { throw null; }
- public override int GetHashCode() { throw null; }
- public System.TimeSpan Negate() { throw null; }
- public static System.TimeSpan operator +(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
- public static bool operator ==(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
- public static bool operator >(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
- public static bool operator >=(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
- public static bool operator !=(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
- public static bool operator <(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
- public static bool operator <=(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
- public static System.TimeSpan operator -(System.TimeSpan t1, System.TimeSpan t2) { throw null; }
- public static System.TimeSpan operator -(System.TimeSpan t) { throw null; }
- public static System.TimeSpan operator +(System.TimeSpan t) { throw null; }
- public static System.TimeSpan Parse(string s) { throw null; }
- public static System.TimeSpan Parse(string input, System.IFormatProvider formatProvider) { throw null; }
- public static System.TimeSpan ParseExact(string input, string format, System.IFormatProvider formatProvider) { throw null; }
- public static System.TimeSpan ParseExact(string input, string format, System.IFormatProvider formatProvider, System.Globalization.TimeSpanStyles styles) { throw null; }
- public static System.TimeSpan ParseExact(string input, string[] formats, System.IFormatProvider formatProvider) { throw null; }
- public static System.TimeSpan ParseExact(string input, string[] formats, System.IFormatProvider formatProvider, System.Globalization.TimeSpanStyles styles) { throw null; }
- public System.TimeSpan Subtract(System.TimeSpan ts) { throw null; }
- public override string ToString() { throw null; }
- public string ToString(string format) { throw null; }
- public string ToString(string format, System.IFormatProvider formatProvider) { throw null; }
- public static bool TryParse(string input, System.IFormatProvider formatProvider, out System.TimeSpan result) { result = default(System.TimeSpan); throw null; }
- public static bool TryParse(string s, out System.TimeSpan result) { result = default(System.TimeSpan); throw null; }
- public static bool TryParseExact(string input, string format, System.IFormatProvider formatProvider, System.Globalization.TimeSpanStyles styles, out System.TimeSpan result) { result = default(System.TimeSpan); throw null; }
- public static bool TryParseExact(string input, string format, System.IFormatProvider formatProvider, out System.TimeSpan result) { result = default(System.TimeSpan); throw null; }
- public static bool TryParseExact(string input, string[] formats, System.IFormatProvider formatProvider, System.Globalization.TimeSpanStyles styles, out System.TimeSpan result) { result = default(System.TimeSpan); throw null; }
- public static bool TryParseExact(string input, string[] formats, System.IFormatProvider formatProvider, out System.TimeSpan result) { result = default(System.TimeSpan); throw null; }
- }
- [System.ObsoleteAttribute("System.TimeZone has been deprecated. Please investigate the use of System.TimeZoneInfo instead.")]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class TimeZone
- {
- protected TimeZone() { }
- public abstract string DaylightName { get; }
- public abstract string StandardName { get; }
- public abstract System.Globalization.DaylightTime GetDaylightChanges(int year);
- public abstract System.TimeSpan GetUtcOffset(System.DateTime time);
- public virtual bool IsDaylightSavingTime(System.DateTime time) { throw null; }
- public static bool IsDaylightSavingTime(System.DateTime time, System.Globalization.DaylightTime daylightTimes) { throw null; }
- public virtual System.DateTime ToUniversalTime(System.DateTime time) { throw null; }
- }
- public sealed partial class TimeZoneInfo : System.IEquatable<System.TimeZoneInfo>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
- {
- internal TimeZoneInfo() { }
- public System.TimeSpan BaseUtcOffset { get { throw null; } }
- public string DaylightName { get { throw null; } }
- public string DisplayName { get { throw null; } }
- public string Id { get { throw null; } }
- public static System.TimeZoneInfo Local { get { throw null; } }
- public string StandardName { get { throw null; } }
- public bool SupportsDaylightSavingTime { get { throw null; } }
- public static System.TimeZoneInfo Utc { get { throw null; } }
- public static void ClearCachedData() { }
- public static System.DateTime ConvertTime(System.DateTime dateTime, System.TimeZoneInfo destinationTimeZone) { throw null; }
- public static System.DateTime ConvertTime(System.DateTime dateTime, System.TimeZoneInfo sourceTimeZone, System.TimeZoneInfo destinationTimeZone) { throw null; }
- public static System.DateTimeOffset ConvertTime(System.DateTimeOffset dateTimeOffset, System.TimeZoneInfo destinationTimeZone) { throw null; }
- public static System.DateTime ConvertTimeFromUtc(System.DateTime dateTime, System.TimeZoneInfo destinationTimeZone) { throw null; }
- public static System.DateTime ConvertTimeToUtc(System.DateTime dateTime) { throw null; }
- public static System.DateTime ConvertTimeToUtc(System.DateTime dateTime, System.TimeZoneInfo sourceTimeZone) { throw null; }
- public static System.TimeZoneInfo CreateCustomTimeZone(string id, System.TimeSpan baseUtcOffset, string displayName, string standardDisplayName) { throw null; }
- public static System.TimeZoneInfo CreateCustomTimeZone(string id, System.TimeSpan baseUtcOffset, string displayName, string standardDisplayName, string daylightDisplayName, System.TimeZoneInfo.AdjustmentRule[] adjustmentRules) { throw null; }
- public static System.TimeZoneInfo CreateCustomTimeZone(string id, System.TimeSpan baseUtcOffset, string displayName, string standardDisplayName, string daylightDisplayName, System.TimeZoneInfo.AdjustmentRule[] adjustmentRules, bool disableDaylightSavingTime) { throw null; }
- public override bool Equals(object obj) { throw null; }
- public bool Equals(System.TimeZoneInfo other) { throw null; }
- public static System.TimeZoneInfo FindSystemTimeZoneById(string id) { throw null; }
- public static System.TimeZoneInfo FromSerializedString(string source) { throw null; }
- public System.TimeZoneInfo.AdjustmentRule[] GetAdjustmentRules() { throw null; }
- public System.TimeSpan[] GetAmbiguousTimeOffsets(System.DateTime dateTime) { throw null; }
- public System.TimeSpan[] GetAmbiguousTimeOffsets(System.DateTimeOffset dateTimeOffset) { throw null; }
- public override int GetHashCode() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Collections.ObjectModel.ReadOnlyCollection<System.TimeZoneInfo> GetSystemTimeZones() { throw null; }
- public System.TimeSpan GetUtcOffset(System.DateTime dateTime) { throw null; }
- public System.TimeSpan GetUtcOffset(System.DateTimeOffset dateTimeOffset) { throw null; }
- public bool HasSameRules(System.TimeZoneInfo other) { throw null; }
- public bool IsAmbiguousTime(System.DateTime dateTime) { throw null; }
- public bool IsAmbiguousTime(System.DateTimeOffset dateTimeOffset) { throw null; }
- public bool IsDaylightSavingTime(System.DateTime dateTime) { throw null; }
- public bool IsDaylightSavingTime(System.DateTimeOffset dateTimeOffset) { throw null; }
- public bool IsInvalidTime(System.DateTime dateTime) { throw null; }
- void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object sender) { }
- [System.Security.SecurityCriticalAttribute]
- void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public string ToSerializedString() { throw null; }
- public override string ToString() { throw null; }
- public sealed partial class AdjustmentRule : System.IEquatable<System.TimeZoneInfo.AdjustmentRule>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
- {
- internal AdjustmentRule() { }
- public System.DateTime DateEnd { get { throw null; } }
- public System.DateTime DateStart { get { throw null; } }
- public System.TimeSpan DaylightDelta { get { throw null; } }
- public System.TimeZoneInfo.TransitionTime DaylightTransitionEnd { get { throw null; } }
- public System.TimeZoneInfo.TransitionTime DaylightTransitionStart { get { throw null; } }
- public static System.TimeZoneInfo.AdjustmentRule CreateAdjustmentRule(System.DateTime dateStart, System.DateTime dateEnd, System.TimeSpan daylightDelta, System.TimeZoneInfo.TransitionTime daylightTransitionStart, System.TimeZoneInfo.TransitionTime daylightTransitionEnd) { throw null; }
- public bool Equals(System.TimeZoneInfo.AdjustmentRule other) { throw null; }
- public override int GetHashCode() { throw null; }
- void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object sender) { }
- [System.Security.SecurityCriticalAttribute]
- void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct TransitionTime : System.IEquatable<System.TimeZoneInfo.TransitionTime>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
- {
- public int Day { get { throw null; } }
- public System.DayOfWeek DayOfWeek { get { throw null; } }
- public bool IsFixedDateRule { get { throw null; } }
- public int Month { get { throw null; } }
- public System.DateTime TimeOfDay { get { throw null; } }
- public int Week { get { throw null; } }
- public static System.TimeZoneInfo.TransitionTime CreateFixedDateRule(System.DateTime timeOfDay, int month, int day) { throw null; }
- public static System.TimeZoneInfo.TransitionTime CreateFloatingDateRule(System.DateTime timeOfDay, int month, int week, System.DayOfWeek dayOfWeek) { throw null; }
- public override bool Equals(object obj) { throw null; }
- public bool Equals(System.TimeZoneInfo.TransitionTime other) { throw null; }
- public override int GetHashCode() { throw null; }
- public static bool operator ==(System.TimeZoneInfo.TransitionTime t1, System.TimeZoneInfo.TransitionTime t2) { throw null; }
- public static bool operator !=(System.TimeZoneInfo.TransitionTime t1, System.TimeZoneInfo.TransitionTime t2) { throw null; }
- void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object sender) { }
- [System.Security.SecurityCriticalAttribute]
- void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- }
- }
- [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
- public partial class TimeZoneNotFoundException : System.Exception
- {
- public TimeZoneNotFoundException() { }
- protected TimeZoneNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public TimeZoneNotFoundException(string message) { }
- public TimeZoneNotFoundException(string message, System.Exception innerException) { }
- }
- public static partial class Tuple
- {
- public static System.Tuple<T1> Create<T1>(T1 item1) { throw null; }
- public static System.Tuple<T1, T2> Create<T1, T2>(T1 item1, T2 item2) { throw null; }
- public static System.Tuple<T1, T2, T3> Create<T1, T2, T3>(T1 item1, T2 item2, T3 item3) { throw null; }
- public static System.Tuple<T1, T2, T3, T4> Create<T1, T2, T3, T4>(T1 item1, T2 item2, T3 item3, T4 item4) { throw null; }
- public static System.Tuple<T1, T2, T3, T4, T5> Create<T1, T2, T3, T4, T5>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5) { throw null; }
- public static System.Tuple<T1, T2, T3, T4, T5, T6> Create<T1, T2, T3, T4, T5, T6>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6) { throw null; }
- public static System.Tuple<T1, T2, T3, T4, T5, T6, T7> Create<T1, T2, T3, T4, T5, T6, T7>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7) { throw null; }
- public static System.Tuple<T1, T2, T3, T4, T5, T6, T7, System.Tuple<T8>> Create<T1, T2, T3, T4, T5, T6, T7, T8>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, T8 item8) { throw null; }
- }
- public partial class Tuple<T1> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable
- {
- public Tuple(T1 item1) { }
- public T1 Item1 { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public override int GetHashCode() { throw null; }
- int System.Collections.IStructuralComparable.CompareTo(object other, System.Collections.IComparer comparer) { throw null; }
- bool System.Collections.IStructuralEquatable.Equals(object other, System.Collections.IEqualityComparer comparer) { throw null; }
- int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
- int System.IComparable.CompareTo(object obj) { throw null; }
- public override string ToString() { throw null; }
- }
- public partial class Tuple<T1, T2> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable
- {
- public Tuple(T1 item1, T2 item2) { }
- public T1 Item1 { get { throw null; } }
- public T2 Item2 { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public override int GetHashCode() { throw null; }
- int System.Collections.IStructuralComparable.CompareTo(object other, System.Collections.IComparer comparer) { throw null; }
- bool System.Collections.IStructuralEquatable.Equals(object other, System.Collections.IEqualityComparer comparer) { throw null; }
- int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
- int System.IComparable.CompareTo(object obj) { throw null; }
- public override string ToString() { throw null; }
- }
- public partial class Tuple<T1, T2, T3> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable
- {
- public Tuple(T1 item1, T2 item2, T3 item3) { }
- public T1 Item1 { get { throw null; } }
- public T2 Item2 { get { throw null; } }
- public T3 Item3 { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public override int GetHashCode() { throw null; }
- int System.Collections.IStructuralComparable.CompareTo(object other, System.Collections.IComparer comparer) { throw null; }
- bool System.Collections.IStructuralEquatable.Equals(object other, System.Collections.IEqualityComparer comparer) { throw null; }
- int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
- int System.IComparable.CompareTo(object obj) { throw null; }
- public override string ToString() { throw null; }
- }
- public partial class Tuple<T1, T2, T3, T4> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable
- {
- public Tuple(T1 item1, T2 item2, T3 item3, T4 item4) { }
- public T1 Item1 { get { throw null; } }
- public T2 Item2 { get { throw null; } }
- public T3 Item3 { get { throw null; } }
- public T4 Item4 { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public override int GetHashCode() { throw null; }
- int System.Collections.IStructuralComparable.CompareTo(object other, System.Collections.IComparer comparer) { throw null; }
- bool System.Collections.IStructuralEquatable.Equals(object other, System.Collections.IEqualityComparer comparer) { throw null; }
- int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
- int System.IComparable.CompareTo(object obj) { throw null; }
- public override string ToString() { throw null; }
- }
- public partial class Tuple<T1, T2, T3, T4, T5> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable
- {
- public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5) { }
- public T1 Item1 { get { throw null; } }
- public T2 Item2 { get { throw null; } }
- public T3 Item3 { get { throw null; } }
- public T4 Item4 { get { throw null; } }
- public T5 Item5 { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public override int GetHashCode() { throw null; }
- int System.Collections.IStructuralComparable.CompareTo(object other, System.Collections.IComparer comparer) { throw null; }
- bool System.Collections.IStructuralEquatable.Equals(object other, System.Collections.IEqualityComparer comparer) { throw null; }
- int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
- int System.IComparable.CompareTo(object obj) { throw null; }
- public override string ToString() { throw null; }
- }
- public partial class Tuple<T1, T2, T3, T4, T5, T6> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable
- {
- public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6) { }
- public T1 Item1 { get { throw null; } }
- public T2 Item2 { get { throw null; } }
- public T3 Item3 { get { throw null; } }
- public T4 Item4 { get { throw null; } }
- public T5 Item5 { get { throw null; } }
- public T6 Item6 { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public override int GetHashCode() { throw null; }
- int System.Collections.IStructuralComparable.CompareTo(object other, System.Collections.IComparer comparer) { throw null; }
- bool System.Collections.IStructuralEquatable.Equals(object other, System.Collections.IEqualityComparer comparer) { throw null; }
- int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
- int System.IComparable.CompareTo(object obj) { throw null; }
- public override string ToString() { throw null; }
- }
- public partial class Tuple<T1, T2, T3, T4, T5, T6, T7> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable
- {
- public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7) { }
- public T1 Item1 { get { throw null; } }
- public T2 Item2 { get { throw null; } }
- public T3 Item3 { get { throw null; } }
- public T4 Item4 { get { throw null; } }
- public T5 Item5 { get { throw null; } }
- public T6 Item6 { get { throw null; } }
- public T7 Item7 { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public override int GetHashCode() { throw null; }
- int System.Collections.IStructuralComparable.CompareTo(object other, System.Collections.IComparer comparer) { throw null; }
- bool System.Collections.IStructuralEquatable.Equals(object other, System.Collections.IEqualityComparer comparer) { throw null; }
- int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
- int System.IComparable.CompareTo(object obj) { throw null; }
- public override string ToString() { throw null; }
- }
- public partial class Tuple<T1, T2, T3, T4, T5, T6, T7, TRest> : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable
- {
- public Tuple(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, TRest rest) { }
- public T1 Item1 { get { throw null; } }
- public T2 Item2 { get { throw null; } }
- public T3 Item3 { get { throw null; } }
- public T4 Item4 { get { throw null; } }
- public T5 Item5 { get { throw null; } }
- public T6 Item6 { get { throw null; } }
- public T7 Item7 { get { throw null; } }
- public TRest Rest { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public override int GetHashCode() { throw null; }
- int System.Collections.IStructuralComparable.CompareTo(object other, System.Collections.IComparer comparer) { throw null; }
- bool System.Collections.IStructuralEquatable.Equals(object other, System.Collections.IEqualityComparer comparer) { throw null; }
- int System.Collections.IStructuralEquatable.GetHashCode(System.Collections.IEqualityComparer comparer) { throw null; }
- int System.IComparable.CompareTo(object obj) { throw null; }
- public override string ToString() { throw null; }
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class Type : System.Reflection.MemberInfo, System.Reflection.IReflect
- {
- public static readonly char Delimiter;
- public static readonly System.Type[] EmptyTypes;
- public static readonly System.Reflection.MemberFilter FilterAttribute;
- public static readonly System.Reflection.MemberFilter FilterName;
- public static readonly System.Reflection.MemberFilter FilterNameIgnoreCase;
- public static readonly object Missing;
- protected Type() { }
- [System.Security.SecuritySafeCriticalAttribute][System.Diagnostics.Contracts.PureAttribute][System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
- public static bool operator ==(System.Type left, System.Type right) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute][System.Diagnostics.Contracts.PureAttribute][System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
- public static bool operator !=(System.Type left, System.Type right) { throw null; }
- public abstract System.Reflection.Assembly Assembly { get; }
- public abstract string AssemblyQualifiedName { get; }
- public System.Reflection.TypeAttributes Attributes { get { throw null; } }
- public abstract System.Type BaseType { get; }
- public virtual bool ContainsGenericParameters { get { throw null; } }
- public virtual System.Reflection.MethodBase DeclaringMethod { get { throw null; } }
- public override System.Type DeclaringType { get { throw null; } }
- public static System.Reflection.Binder DefaultBinder { get { throw null; } }
- public abstract string FullName { get; }
- public virtual System.Reflection.GenericParameterAttributes GenericParameterAttributes { get { throw null; } }
- public virtual int GenericParameterPosition { get { throw null; } }
- public virtual System.Type[] GenericTypeArguments { get { throw null; } }
- public abstract System.Guid GUID { get; }
- public bool HasElementType { get { throw null; } }
- public bool IsAbstract { get { throw null; } }
- public bool IsAnsiClass { get { throw null; } }
- public bool IsArray { get { throw null; } }
- public bool IsAutoClass { get { throw null; } }
- public bool IsAutoLayout { get { throw null; } }
- public bool IsByRef { get { throw null; } }
- public bool IsClass { get { throw null; } }
- public bool IsCOMObject { get { throw null; } }
- public virtual bool IsConstructedGenericType { get { throw null; } }
- public bool IsContextful { [System.Diagnostics.Contracts.PureAttribute]get { throw null;} }
- public bool IsEnum { get { throw null; } }
- public bool IsExplicitLayout { get { throw null; } }
- public virtual bool IsGenericParameter { get { throw null; } }
- public virtual bool IsGenericType { get { throw null; } }
- public virtual bool IsGenericTypeDefinition { get { throw null; } }
- public bool IsImport { get { throw null; } }
- public bool IsInterface { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public bool IsLayoutSequential { get { throw null; } }
- public bool IsMarshalByRef { get { throw null; } }
- public bool IsNested { get { throw null; } }
- public bool IsNestedAssembly { get { throw null; } }
- public bool IsNestedFamANDAssem { get { throw null; } }
- public bool IsNestedFamily { get { throw null; } }
- public bool IsNestedFamORAssem { get { throw null; } }
- public bool IsNestedPrivate { get { throw null; } }
- public bool IsNestedPublic { get { throw null; } }
- public bool IsNotPublic { get { throw null; } }
- public bool IsPointer { get { throw null; } }
- public bool IsPrimitive { get { throw null; } }
- public bool IsPublic { get { throw null; } }
- public bool IsSealed { get { throw null; } }
- public virtual bool IsSerializable { get { throw null; } }
- public bool IsSpecialName { get { throw null; } }
- public bool IsUnicodeClass { get { throw null; } }
- public bool IsValueType { get { throw null; } }
- public bool IsVisible { get { throw null; } }
- public override System.Reflection.MemberTypes MemberType { get { throw null; } }
- public abstract new System.Reflection.Module Module { get; }
- public abstract string Namespace { get; }
- public override System.Type ReflectedType { get { throw null; } }
- public virtual System.Runtime.InteropServices.StructLayoutAttribute StructLayoutAttribute { get { throw null; } }
- public virtual System.RuntimeTypeHandle TypeHandle { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public System.Reflection.ConstructorInfo TypeInitializer { get { throw null; } }
- public abstract System.Type UnderlyingSystemType { get; }
- public override bool Equals(object o) { throw null; }
- public bool Equals(System.Type o) { throw null; }
- public virtual System.Type[] FindInterfaces(System.Reflection.TypeFilter filter, object filterCriteria) { throw null; }
- public virtual System.Reflection.MemberInfo[] FindMembers(System.Reflection.MemberTypes memberType, System.Reflection.BindingFlags bindingAttr, System.Reflection.MemberFilter filter, object filterCriteria) { throw null; }
- public virtual int GetArrayRank() { throw null; }
- protected abstract System.Reflection.TypeAttributes GetAttributeFlagsImpl();
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public System.Reflection.ConstructorInfo GetConstructor(System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public System.Reflection.ConstructorInfo GetConstructor(System.Type[] types) { throw null; }
- protected abstract System.Reflection.ConstructorInfo GetConstructorImpl(System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[] modifiers);
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public System.Reflection.ConstructorInfo[] GetConstructors() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract System.Reflection.ConstructorInfo[] GetConstructors(System.Reflection.BindingFlags bindingAttr);
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public System.Reflection.ConstructorInfo GetConstructor(System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw null; }
- public virtual System.Reflection.MemberInfo[] GetDefaultMembers() { throw null; }
- public abstract System.Type GetElementType();
- public virtual string GetEnumName(object value) { throw null; }
- public virtual string[] GetEnumNames() { throw null; }
- public virtual System.Type GetEnumUnderlyingType() { throw null; }
- public virtual System.Array GetEnumValues() { throw null; }
- public System.Reflection.EventInfo GetEvent(string name) { throw null; }
- public abstract System.Reflection.EventInfo GetEvent(string name, System.Reflection.BindingFlags bindingAttr);
- public virtual System.Reflection.EventInfo[] GetEvents() { throw null; }
- public abstract System.Reflection.EventInfo[] GetEvents(System.Reflection.BindingFlags bindingAttr);
- public System.Reflection.FieldInfo GetField(string name) { throw null; }
- public abstract System.Reflection.FieldInfo GetField(string name, System.Reflection.BindingFlags bindingAttr);
- public System.Reflection.FieldInfo[] GetFields() { throw null; }
- public abstract System.Reflection.FieldInfo[] GetFields(System.Reflection.BindingFlags bindingAttr);
- public virtual System.Type[] GetGenericArguments() { throw null; }
- public virtual System.Type[] GetGenericParameterConstraints() { throw null; }
- public virtual System.Type GetGenericTypeDefinition() { throw null; }
- public override int GetHashCode() { throw null; }
- public System.Type GetInterface(string name) { throw null; }
- public abstract System.Type GetInterface(string name, bool ignoreCase);
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public virtual System.Reflection.InterfaceMapping GetInterfaceMap(System.Type interfaceType) { throw null; }
- public abstract System.Type[] GetInterfaces();
- public System.Reflection.MemberInfo[] GetMember(string name) { throw null; }
- public virtual System.Reflection.MemberInfo[] GetMember(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
- public virtual System.Reflection.MemberInfo[] GetMember(string name, System.Reflection.MemberTypes type, System.Reflection.BindingFlags bindingAttr) { throw null; }
- public System.Reflection.MemberInfo[] GetMembers() { throw null; }
- public abstract System.Reflection.MemberInfo[] GetMembers(System.Reflection.BindingFlags bindingAttr);
- public System.Reflection.MethodInfo GetMethod(string name) { throw null; }
- public System.Reflection.MethodInfo GetMethod(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
- public System.Reflection.MethodInfo GetMethod(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw null; }
- public System.Reflection.MethodInfo GetMethod(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw null; }
- public System.Reflection.MethodInfo GetMethod(string name, System.Type[] types) { throw null; }
- public System.Reflection.MethodInfo GetMethod(string name, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw null; }
- protected abstract System.Reflection.MethodInfo GetMethodImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[] modifiers);
- public System.Reflection.MethodInfo[] GetMethods() { throw null; }
- public abstract System.Reflection.MethodInfo[] GetMethods(System.Reflection.BindingFlags bindingAttr);
- public System.Type GetNestedType(string name) { throw null; }
- public abstract System.Type GetNestedType(string name, System.Reflection.BindingFlags bindingAttr);
- public System.Type[] GetNestedTypes() { throw null; }
- public abstract System.Type[] GetNestedTypes(System.Reflection.BindingFlags bindingAttr);
- public System.Reflection.PropertyInfo[] GetProperties() { throw null; }
- public abstract System.Reflection.PropertyInfo[] GetProperties(System.Reflection.BindingFlags bindingAttr);
- public System.Reflection.PropertyInfo GetProperty(string name) { throw null; }
- public System.Reflection.PropertyInfo GetProperty(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
- public System.Reflection.PropertyInfo GetProperty(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Type returnType, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw null; }
- public System.Reflection.PropertyInfo GetProperty(string name, System.Type returnType) { throw null; }
- public System.Reflection.PropertyInfo GetProperty(string name, System.Type returnType, System.Type[] types) { throw null; }
- public System.Reflection.PropertyInfo GetProperty(string name, System.Type returnType, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw null; }
- public System.Reflection.PropertyInfo GetProperty(string name, System.Type[] types) { throw null; }
- protected abstract System.Reflection.PropertyInfo GetPropertyImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Type returnType, System.Type[] types, System.Reflection.ParameterModifier[] modifiers);
- public new System.Type GetType() { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public static System.Type GetType(string typeName) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public static System.Type GetType(string typeName, bool throwOnError) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public static System.Type GetType(string typeName, bool throwOnError, bool ignoreCase) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- public static System.Type GetType(string typeName, System.Func<System.Reflection.AssemblyName, System.Reflection.Assembly> assemblyResolver, System.Func<System.Reflection.Assembly, string, bool, System.Type> typeResolver) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- public static System.Type GetType(string typeName, System.Func<System.Reflection.AssemblyName, System.Reflection.Assembly> assemblyResolver, System.Func<System.Reflection.Assembly, string, bool, System.Type> typeResolver, bool throwOnError) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- public static System.Type GetType(string typeName, System.Func<System.Reflection.AssemblyName, System.Reflection.Assembly> assemblyResolver, System.Func<System.Reflection.Assembly, string, bool, System.Type> typeResolver, bool throwOnError, bool ignoreCase) { throw null; }
- public static System.Type[] GetTypeArray(System.Object[] args) { throw null; }
- public static System.TypeCode GetTypeCode(System.Type type) { throw null; }
- protected virtual System.TypeCode GetTypeCodeImpl() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]public static System.Type GetTypeFromCLSID(System.Guid clsid) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]public static System.Type GetTypeFromCLSID(System.Guid clsid, bool throwOnError) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]public static System.Type GetTypeFromCLSID(System.Guid clsid, string server) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]public static System.Type GetTypeFromCLSID(System.Guid clsid, string server, bool throwOnError) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static System.Type GetTypeFromHandle(System.RuntimeTypeHandle handle) { throw null; }
- [System.Security.SecurityCriticalAttribute]public static System.Type GetTypeFromProgID(string progID) { throw null; }
- [System.Security.SecurityCriticalAttribute]public static System.Type GetTypeFromProgID(string progID, bool throwOnError) { throw null; }
- [System.Security.SecurityCriticalAttribute]public static System.Type GetTypeFromProgID(string progID, string server) { throw null; }
- [System.Security.SecurityCriticalAttribute]public static System.Type GetTypeFromProgID(string progID, string server, bool throwOnError) { throw null; }
- public static System.RuntimeTypeHandle GetTypeHandle(object o) { throw null; }
- protected abstract bool HasElementTypeImpl();
- [System.Diagnostics.DebuggerHiddenAttribute]
- [System.Diagnostics.DebuggerStepThroughAttribute]
- public object InvokeMember(string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object target, object[] args) { throw null; }
- [System.Diagnostics.DebuggerStepThroughAttribute][System.Diagnostics.DebuggerHiddenAttribute]
- public System.Object InvokeMember(System.String name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object target, System.Object[] args, System.Globalization.CultureInfo culture) { throw null; }
- public abstract object InvokeMember(string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object target, object[] args, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, string[] namedParameters);
- protected abstract bool IsArrayImpl();
- public virtual bool IsAssignableFrom(System.Type c) { throw null; }
- protected abstract bool IsByRefImpl();
- protected abstract bool IsCOMObjectImpl();
- protected virtual bool IsContextfulImpl() { throw null; }
- public virtual bool IsEnumDefined(object value) { throw null; }
- public virtual bool IsEquivalentTo(System.Type other) { throw null; }
- public virtual bool IsInstanceOfType(object o) { throw null; }
- protected virtual bool IsMarshalByRefImpl() { throw null; }
- protected abstract bool IsPointerImpl();
- protected abstract bool IsPrimitiveImpl();
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public virtual bool IsSubclassOf(System.Type c) { throw null; }
- protected virtual bool IsValueTypeImpl() { throw null; }
- public virtual System.Type MakeArrayType() { throw null; }
- public virtual System.Type MakeArrayType(int rank) { throw null; }
- public virtual System.Type MakeByRefType() { throw null; }
- public virtual System.Type MakeGenericType(params System.Type[] typeArguments) { throw null; }
- public virtual System.Type MakePointerType() { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- public static System.Type ReflectionOnlyGetType(System.String typeName, bool throwIfNotFound, bool ignoreCase) { throw null; }
- public override string ToString() { throw null; }
- }
- public partial class TypeAccessException : System.TypeLoadException
- {
- public TypeAccessException() { }
- public TypeAccessException(string message) { }
- public TypeAccessException(string message, System.Exception inner) { }
- protected TypeAccessException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum TypeCode
- {
- Boolean = 3,
- Byte = 6,
- Char = 4,
- DateTime = 16,
- DBNull = 2,
- Decimal = 15,
- Double = 14,
- Empty = 0,
- Int16 = 7,
- Int32 = 9,
- Int64 = 11,
- Object = 1,
- SByte = 5,
- Single = 13,
- String = 18,
- UInt16 = 8,
- UInt32 = 10,
- UInt64 = 12,
- }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct TypedReference
- {
- public override bool Equals(object o) { throw null; }
- public override int GetHashCode() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class TypeInitializationException : System.SystemException
- {
- public TypeInitializationException(string fullTypeName, System.Exception innerException) { }
- public string TypeName { get { throw null; } }
- [System.Security.SecurityCriticalAttribute]
- public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class TypeLoadException : System.SystemException, System.Runtime.Serialization.ISerializable
- {
- public TypeLoadException() { }
- public TypeLoadException(string message) { }
- public TypeLoadException(string message, System.Exception inner) { }
- protected TypeLoadException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- public override string Message { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public string TypeName { get { throw null; } }
- [System.Security.SecurityCriticalAttribute]
- public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class TypeUnloadedException : System.SystemException
- {
- public TypeUnloadedException() { }
- protected TypeUnloadedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public TypeUnloadedException(string message) { }
- public TypeUnloadedException(string message, System.Exception innerException) { }
- }
- internal sealed class TypeNameParser : System.IDisposable
- {
- [System.Security.SecuritySafeCriticalAttribute]public void Dispose() { throw null; }
- }
- [System.Security.SecurityCriticalAttribute]
- internal class SafeTypeNameParserHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
- {
- public SafeTypeNameParserHandle(): base(default(bool)) { }
- [System.Security.SecurityCriticalAttribute]
- protected override bool ReleaseHandle() { throw null; }
- }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct UInt16 : System.IComparable, System.IComparable<ushort>, System.IConvertible, System.IEquatable<ushort>, System.IFormattable
- {
- public const ushort MaxValue = (ushort)65535;
- public const ushort MinValue = (ushort)0;
- public int CompareTo(object value) { throw null; }
- public int CompareTo(System.UInt16 value) { throw null; }
- public override bool Equals(object obj) { throw null; }
- public bool Equals(System.UInt16 obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public System.TypeCode GetTypeCode() { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static System.UInt16 Parse(string s) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static System.UInt16 Parse(string s, System.Globalization.NumberStyles style) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static System.UInt16 Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static System.UInt16 Parse(string s, System.IFormatProvider provider) { throw null; }
- bool System.IConvertible.ToBoolean(System.IFormatProvider provider) { throw null; }
- byte System.IConvertible.ToByte(System.IFormatProvider provider) { throw null; }
- char System.IConvertible.ToChar(System.IFormatProvider provider) { throw null; }
- System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider provider) { throw null; }
- decimal System.IConvertible.ToDecimal(System.IFormatProvider provider) { throw null; }
- double System.IConvertible.ToDouble(System.IFormatProvider provider) { throw null; }
- short System.IConvertible.ToInt16(System.IFormatProvider provider) { throw null; }
- int System.IConvertible.ToInt32(System.IFormatProvider provider) { throw null; }
- long System.IConvertible.ToInt64(System.IFormatProvider provider) { throw null; }
- sbyte System.IConvertible.ToSByte(System.IFormatProvider provider) { throw null; }
- float System.IConvertible.ToSingle(System.IFormatProvider provider) { throw null; }
- object System.IConvertible.ToType(System.Type type, System.IFormatProvider provider) { throw null; }
- System.UInt16 System.IConvertible.ToUInt16(System.IFormatProvider provider) { throw null; }
- uint System.IConvertible.ToUInt32(System.IFormatProvider provider) { throw null; }
- ulong System.IConvertible.ToUInt64(System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override string ToString() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(string format) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(string format, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static bool TryParse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider, out System.UInt16 result) { result = default(ushort); throw null; }
- [System.CLSCompliantAttribute(false)]
- public static bool TryParse(string s, out System.UInt16 result) { result = default(ushort); throw null; }
- }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct UInt32 : System.IComparable, System.IComparable<uint>, System.IConvertible, System.IEquatable<uint>, System.IFormattable
- {
- public const uint MaxValue = (uint)4294967295;
- public const uint MinValue = (uint)0;
- public int CompareTo(object value) { throw null; }
- public int CompareTo(System.UInt32 value) { throw null; }
- public override bool Equals(object obj) { throw null; }
- public bool Equals(System.UInt32 obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public System.TypeCode GetTypeCode() { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static System.UInt32 Parse(string s) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static System.UInt32 Parse(string s, System.Globalization.NumberStyles style) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static System.UInt32 Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static System.UInt32 Parse(string s, System.IFormatProvider provider) { throw null; }
- bool System.IConvertible.ToBoolean(System.IFormatProvider provider) { throw null; }
- byte System.IConvertible.ToByte(System.IFormatProvider provider) { throw null; }
- char System.IConvertible.ToChar(System.IFormatProvider provider) { throw null; }
- System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider provider) { throw null; }
- decimal System.IConvertible.ToDecimal(System.IFormatProvider provider) { throw null; }
- double System.IConvertible.ToDouble(System.IFormatProvider provider) { throw null; }
- short System.IConvertible.ToInt16(System.IFormatProvider provider) { throw null; }
- int System.IConvertible.ToInt32(System.IFormatProvider provider) { throw null; }
- long System.IConvertible.ToInt64(System.IFormatProvider provider) { throw null; }
- sbyte System.IConvertible.ToSByte(System.IFormatProvider provider) { throw null; }
- float System.IConvertible.ToSingle(System.IFormatProvider provider) { throw null; }
- object System.IConvertible.ToType(System.Type type, System.IFormatProvider provider) { throw null; }
- ushort System.IConvertible.ToUInt16(System.IFormatProvider provider) { throw null; }
- System.UInt32 System.IConvertible.ToUInt32(System.IFormatProvider provider) { throw null; }
- ulong System.IConvertible.ToUInt64(System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override string ToString() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(string format) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(string format, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static bool TryParse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider, out System.UInt32 result) { result = default(uint); throw null; }
- [System.CLSCompliantAttribute(false)]
- public static bool TryParse(string s, out System.UInt32 result) { result = default(uint); throw null; }
- }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct UInt64 : System.IComparable, System.IComparable<ulong>, System.IConvertible, System.IEquatable<ulong>, System.IFormattable
- {
- public const ulong MaxValue = (ulong)18446744073709551615;
- public const ulong MinValue = (ulong)0;
- public int CompareTo(object value) { throw null; }
- public int CompareTo(System.UInt64 value) { throw null; }
- public override bool Equals(object obj) { throw null; }
- public bool Equals(System.UInt64 obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public System.TypeCode GetTypeCode() { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static System.UInt64 Parse(string s) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static System.UInt64 Parse(string s, System.Globalization.NumberStyles style) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static System.UInt64 Parse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static System.UInt64 Parse(string s, System.IFormatProvider provider) { throw null; }
- bool System.IConvertible.ToBoolean(System.IFormatProvider provider) { throw null; }
- byte System.IConvertible.ToByte(System.IFormatProvider provider) { throw null; }
- char System.IConvertible.ToChar(System.IFormatProvider provider) { throw null; }
- System.DateTime System.IConvertible.ToDateTime(System.IFormatProvider provider) { throw null; }
- decimal System.IConvertible.ToDecimal(System.IFormatProvider provider) { throw null; }
- double System.IConvertible.ToDouble(System.IFormatProvider provider) { throw null; }
- short System.IConvertible.ToInt16(System.IFormatProvider provider) { throw null; }
- int System.IConvertible.ToInt32(System.IFormatProvider provider) { throw null; }
- long System.IConvertible.ToInt64(System.IFormatProvider provider) { throw null; }
- sbyte System.IConvertible.ToSByte(System.IFormatProvider provider) { throw null; }
- float System.IConvertible.ToSingle(System.IFormatProvider provider) { throw null; }
- object System.IConvertible.ToType(System.Type type, System.IFormatProvider provider) { throw null; }
- ushort System.IConvertible.ToUInt16(System.IFormatProvider provider) { throw null; }
- uint System.IConvertible.ToUInt32(System.IFormatProvider provider) { throw null; }
- System.UInt64 System.IConvertible.ToUInt64(System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override string ToString() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(System.IFormatProvider provider) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(string format) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(string format, System.IFormatProvider provider) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static bool TryParse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider, out System.UInt64 result) { result = default(ulong); throw null; }
- [System.CLSCompliantAttribute(false)]
- public static bool TryParse(string s, out System.UInt64 result) { result = default(ulong); throw null; }
- }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct UIntPtr : System.Runtime.Serialization.ISerializable
- {
- public static readonly System.UIntPtr Zero;
- [System.Security.SecuritySafeCriticalAttribute]
- public UIntPtr(uint value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public UIntPtr(ulong value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe UIntPtr(void* value) { throw null; }
- public static int Size { get { throw null; } }
- public static System.UIntPtr Add(System.UIntPtr pointer, int offset) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override bool Equals(object obj) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override int GetHashCode() { throw null; }
- public static System.UIntPtr operator +(System.UIntPtr pointer, int offset) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static bool operator ==(System.UIntPtr value1, System.UIntPtr value2) { throw null; }
- public static explicit operator System.UIntPtr(uint value) { throw null; }
- public static explicit operator System.UIntPtr(ulong value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static explicit operator uint(System.UIntPtr value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static explicit operator ulong(System.UIntPtr value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe static explicit operator void* (System.UIntPtr value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe static explicit operator System.UIntPtr(void* value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static bool operator !=(System.UIntPtr value1, System.UIntPtr value2) { throw null; }
- public static System.UIntPtr operator -(System.UIntPtr pointer, int offset) { throw null; }
- public static System.UIntPtr Subtract(System.UIntPtr pointer, int offset) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public unsafe void* ToPointer() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override string ToString() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public uint ToUInt32() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public ulong ToUInt64() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class UnauthorizedAccessException : System.SystemException
- {
- public UnauthorizedAccessException() { }
- public UnauthorizedAccessException(string message) { }
- public UnauthorizedAccessException(string message, System.Exception inner) { }
- protected UnauthorizedAccessException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class UnhandledExceptionEventArgs : System.EventArgs
- {
- public UnhandledExceptionEventArgs(object exception, bool isTerminating) { }
- public object ExceptionObject { get { throw null; } }
- public bool IsTerminating { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecurityCriticalAttribute]
- public delegate void UnhandledExceptionEventHandler(object sender, System.UnhandledExceptionEventArgs e);
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class ValueType
- {
- protected ValueType() { }
- [System.Security.SecuritySafeCriticalAttribute]
- public override bool Equals(object obj) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public override int GetHashCode() { throw null; }
- public override string ToString() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class Version : System.ICloneable, System.IComparable, System.IComparable<System.Version>, System.IEquatable<System.Version>
- {
- public Version(int major, int minor) { }
- public Version(int major, int minor, int build) { }
- public Version(int major, int minor, int build, int revision) { }
- public Version(string version) { }
- public Version() { }
- public int Build { get { throw null; } }
- public int Major { get { throw null; } }
- public short MajorRevision { get { throw null; } }
- public int Minor { get { throw null; } }
- public short MinorRevision { get { throw null; } }
- public int Revision { get { throw null; } }
- public object Clone() { throw null; }
- public int CompareTo(object version) { throw null; }
- public int CompareTo(System.Version value) { throw null; }
- public override bool Equals(object obj) { throw null; }
- public bool Equals(System.Version obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public static bool operator ==(System.Version v1, System.Version v2) { throw null; }
- public static bool operator >(System.Version v1, System.Version v2) { throw null; }
- public static bool operator >=(System.Version v1, System.Version v2) { throw null; }
- public static bool operator !=(System.Version v1, System.Version v2) { throw null; }
- public static bool operator <(System.Version v1, System.Version v2) { throw null; }
- public static bool operator <=(System.Version v1, System.Version v2) { throw null; }
- public static System.Version Parse(string input) { throw null; }
- public override string ToString() { throw null; }
- public string ToString(int fieldCount) { throw null; }
- public static bool TryParse(string input, out System.Version result) { result = default(System.Version); throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, Size=1)]
- public partial struct Void
- {
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class WeakReference : System.Runtime.Serialization.ISerializable
- {
- [System.Security.SecuritySafeCriticalAttribute]
- protected WeakReference() { }
- public WeakReference(object target) { }
- public WeakReference(object target, bool trackResurrection) { }
- protected WeakReference(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public virtual bool IsAlive { [System.Security.SecuritySafeCriticalAttribute][System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]get { throw null; } }
- public virtual object Target { [System.Security.SecuritySafeCriticalAttribute][System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]get { throw null; } [System.Security.SecuritySafeCriticalAttribute][System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]set { } }
- public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public virtual bool TrackResurrection { get { throw null; } }
- ~WeakReference() { }
- }
- public sealed partial class WeakReference<T> : System.Runtime.Serialization.ISerializable where T : class
- {
- public WeakReference(T target) { }
- public WeakReference(T target, bool trackResurrection) { }
- ~WeakReference() { }
- public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public void SetTarget(T target) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]public bool TryGetTarget(out T target) { target = default(T); throw null; }
- }
-}
-namespace System.Collections
-{
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class CollectionBase : System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList
- {
- protected CollectionBase() { }
- public int Count { get { throw null; } }
- protected System.Collections.IList List { get { throw null; } }
- bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
- object System.Collections.ICollection.SyncRoot { get { throw null; } }
- bool System.Collections.IList.IsFixedSize { get { throw null; } }
- bool System.Collections.IList.IsReadOnly { get { throw null; } }
- object System.Collections.IList.this[int index] { get { throw null; } set { } }
- public void Clear() { }
- public System.Collections.IEnumerator GetEnumerator() { throw null; }
- public void RemoveAt(int index) { }
- void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
- int System.Collections.IList.Add(object value) { throw null; }
- bool System.Collections.IList.Contains(object value) { throw null; }
- int System.Collections.IList.IndexOf(object value) { throw null; }
- void System.Collections.IList.Insert(int index, object value) { }
- void System.Collections.IList.Remove(object value) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct DictionaryEntry
- {
- public DictionaryEntry(object key, object value) { throw null;}
- public object Key { get { throw null; } set { } }
- public object Value { get { throw null; } set { } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface ICollection : System.Collections.IEnumerable
- {
- int Count { get; }
- bool IsSynchronized { get; }
- object SyncRoot { get; }
- void CopyTo(System.Array array, int index);
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface IComparer
- {
- int Compare(object x, object y);
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface IDictionary : System.Collections.ICollection, System.Collections.IEnumerable
- {
- bool IsFixedSize { get; }
- bool IsReadOnly { get; }
- object this[object key] { get; set; }
- System.Collections.ICollection Keys { get; }
- System.Collections.ICollection Values { get; }
- void Add(object key, object value);
- void Clear();
- bool Contains(object key);
- new System.Collections.IDictionaryEnumerator GetEnumerator();
- void Remove(object key);
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface IDictionaryEnumerator : System.Collections.IEnumerator
- {
- System.Collections.DictionaryEntry Entry { get; }
- object Key { get; }
- object Value { get; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.GuidAttribute("496B0ABE-CDEE-11d3-88E8-00902754C43A")]
- public partial interface IEnumerable
- {
- [System.Runtime.InteropServices.DispIdAttribute(-4)]
- System.Collections.IEnumerator GetEnumerator();
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.GuidAttribute("496B0ABF-CDEE-11d3-88E8-00902754C43A")]
- public partial interface IEnumerator
- {
- object Current { get; }
- bool MoveNext();
- void Reset();
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface IEqualityComparer
- {
- bool Equals(object x, object y);
- int GetHashCode(object obj);
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface IList : System.Collections.ICollection, System.Collections.IEnumerable
- {
- bool IsFixedSize { get; }
- bool IsReadOnly { get; }
- object this[int index] { get; set; }
- int Add(object value);
- void Clear();
- bool Contains(object value);
- int IndexOf(object value);
- void Insert(int index, object value);
- void Remove(object value);
- void RemoveAt(int index);
- }
- public partial interface IStructuralComparable
- {
- int CompareTo(object other, System.Collections.IComparer comparer);
- }
- public partial interface IStructuralEquatable
- {
- bool Equals(object other, System.Collections.IEqualityComparer comparer);
- int GetHashCode(System.Collections.IEqualityComparer comparer);
- }
- public static partial class StructuralComparisons
- {
- public static System.Collections.IComparer StructuralComparer { get { throw null; } }
- public static System.Collections.IEqualityComparer StructuralEqualityComparer { get { throw null; } }
- }
-}
-namespace System.Collections.Generic
-{
- public abstract partial class Comparer<T> : System.Collections.Generic.IComparer<T>, System.Collections.IComparer
- {
- protected Comparer() { }
- public static System.Collections.Generic.Comparer<T> Default { get { throw null; } }
- public abstract int Compare(T x, T y);
- public static System.Collections.Generic.Comparer<T> Create(System.Comparison<T> comparison) { throw null; }
- int System.Collections.IComparer.Compare(object x, object y) { throw null; }
- }
- [System.Diagnostics.DebuggerDisplayAttribute("Count = {Count}")]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public partial class Dictionary<TKey, TValue> : System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.Generic.IDictionary<TKey, TValue>, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>, System.Collections.ICollection, System.Collections.IDictionary, System.Collections.IEnumerable, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
- {
- public Dictionary() { }
- public Dictionary(System.Collections.Generic.IDictionary<TKey, TValue> dictionary) { }
- public Dictionary(System.Collections.Generic.IDictionary<TKey, TValue> dictionary, System.Collections.Generic.IEqualityComparer<TKey> comparer) { }
- public Dictionary(System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>> collection) { }
- public Dictionary(System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>> collection, System.Collections.Generic.IEqualityComparer<TKey> comparer) { }
- public Dictionary(System.Collections.Generic.IEqualityComparer<TKey> comparer) { }
- public Dictionary(int capacity) { }
- public Dictionary(int capacity, System.Collections.Generic.IEqualityComparer<TKey> comparer) { }
- protected Dictionary(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public System.Collections.Generic.IEqualityComparer<TKey> Comparer { get { throw null; } }
- public int Count { get { throw null; } }
- public TValue this[TKey key] { get { throw null; } set { } }
- public System.Collections.Generic.Dictionary<TKey, TValue>.KeyCollection Keys { get { throw null; } }
- bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.IsReadOnly { get { throw null; } }
- System.Collections.Generic.ICollection<TKey> System.Collections.Generic.IDictionary<TKey,TValue>.Keys { get { throw null; } }
- System.Collections.Generic.ICollection<TValue> System.Collections.Generic.IDictionary<TKey,TValue>.Values { get { throw null; } }
- System.Collections.Generic.IEnumerable<TKey> System.Collections.Generic.IReadOnlyDictionary<TKey,TValue>.Keys { get { throw null; } }
- System.Collections.Generic.IEnumerable<TValue> System.Collections.Generic.IReadOnlyDictionary<TKey,TValue>.Values { get { throw null; } }
- bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
- object System.Collections.ICollection.SyncRoot { get { throw null; } }
- bool System.Collections.IDictionary.IsFixedSize { get { throw null; } }
- bool System.Collections.IDictionary.IsReadOnly { get { throw null; } }
- object System.Collections.IDictionary.this[object key] { get { throw null; } set { } }
- System.Collections.ICollection System.Collections.IDictionary.Keys { get { throw null; } }
- System.Collections.ICollection System.Collections.IDictionary.Values { get { throw null; } }
- public System.Collections.Generic.Dictionary<TKey, TValue>.ValueCollection Values { get { throw null; } }
- public void Add(TKey key, TValue value) { }
- public void Clear() { }
- public bool ContainsKey(TKey key) { throw null; }
- public bool ContainsValue(TValue value) { throw null; }
- public System.Collections.Generic.Dictionary<TKey, TValue>.Enumerator GetEnumerator() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public virtual void OnDeserialization(object sender) { }
- public bool Remove(TKey key) { throw null; }
- void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Add(System.Collections.Generic.KeyValuePair<TKey, TValue> keyValuePair) { }
- bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Contains(System.Collections.Generic.KeyValuePair<TKey, TValue> keyValuePair) { throw null; }
- void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.CopyTo(System.Collections.Generic.KeyValuePair<TKey, TValue>[] array, int index) { }
- bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Remove(System.Collections.Generic.KeyValuePair<TKey, TValue> keyValuePair) { throw null; }
- System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>> System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey,TValue>>.GetEnumerator() { throw null; }
- void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
- void System.Collections.IDictionary.Add(object key, object value) { }
- bool System.Collections.IDictionary.Contains(object key) { throw null; }
- System.Collections.IDictionaryEnumerator System.Collections.IDictionary.GetEnumerator() { throw null; }
- void System.Collections.IDictionary.Remove(object key) { }
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
- public bool TryGetValue(TKey key, out TValue value) { value = default(TValue); throw null; }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct Enumerator : System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.IDictionaryEnumerator, System.Collections.IEnumerator, System.IDisposable
- {
- public System.Collections.Generic.KeyValuePair<TKey, TValue> Current { get { throw null; } }
- System.Collections.DictionaryEntry System.Collections.IDictionaryEnumerator.Entry { get { throw null; } }
- object System.Collections.IDictionaryEnumerator.Key { get { throw null; } }
- object System.Collections.IDictionaryEnumerator.Value { get { throw null; } }
- object System.Collections.IEnumerator.Current { get { throw null; } }
- public void Dispose() { }
- public bool MoveNext() { throw null; }
- void System.Collections.IEnumerator.Reset() { }
- }
- [System.Diagnostics.DebuggerDisplayAttribute("Count = {Count}")]
- public sealed partial class KeyCollection : System.Collections.Generic.ICollection<TKey>, System.Collections.Generic.IEnumerable<TKey>, System.Collections.Generic.IReadOnlyCollection<TKey>, System.Collections.ICollection, System.Collections.IEnumerable
- {
- public KeyCollection(System.Collections.Generic.Dictionary<TKey, TValue> dictionary) { }
- public int Count { get { throw null; } }
- bool System.Collections.Generic.ICollection<TKey>.IsReadOnly { get { throw null; } }
- bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
- object System.Collections.ICollection.SyncRoot { get { throw null; } }
- public void CopyTo(TKey[] array, int index) { }
- public System.Collections.Generic.Dictionary<TKey, TValue>.KeyCollection.Enumerator GetEnumerator() { throw null; }
- void System.Collections.Generic.ICollection<TKey>.Add(TKey item) { }
- void System.Collections.Generic.ICollection<TKey>.Clear() { }
- bool System.Collections.Generic.ICollection<TKey>.Contains(TKey item) { throw null; }
- bool System.Collections.Generic.ICollection<TKey>.Remove(TKey item) { throw null; }
- System.Collections.Generic.IEnumerator<TKey> System.Collections.Generic.IEnumerable<TKey>.GetEnumerator() { throw null; }
- void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct Enumerator : System.Collections.Generic.IEnumerator<TKey>, System.Collections.IEnumerator, System.IDisposable
- {
- public TKey Current { get { throw null; } }
- object System.Collections.IEnumerator.Current { get { throw null; } }
- public void Dispose() { }
- public bool MoveNext() { throw null; }
- void System.Collections.IEnumerator.Reset() { }
- }
- }
- [System.Diagnostics.DebuggerDisplayAttribute("Count = {Count}")]
- public sealed partial class ValueCollection : System.Collections.Generic.ICollection<TValue>, System.Collections.Generic.IEnumerable<TValue>, System.Collections.Generic.IReadOnlyCollection<TValue>, System.Collections.ICollection, System.Collections.IEnumerable
- {
- public ValueCollection(System.Collections.Generic.Dictionary<TKey, TValue> dictionary) { }
- public int Count { get { throw null; } }
- bool System.Collections.Generic.ICollection<TValue>.IsReadOnly { get { throw null; } }
- bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
- object System.Collections.ICollection.SyncRoot { get { throw null; } }
- public void CopyTo(TValue[] array, int index) { }
- public System.Collections.Generic.Dictionary<TKey, TValue>.ValueCollection.Enumerator GetEnumerator() { throw null; }
- void System.Collections.Generic.ICollection<TValue>.Add(TValue item) { }
- void System.Collections.Generic.ICollection<TValue>.Clear() { }
- bool System.Collections.Generic.ICollection<TValue>.Contains(TValue item) { throw null; }
- bool System.Collections.Generic.ICollection<TValue>.Remove(TValue item) { throw null; }
- System.Collections.Generic.IEnumerator<TValue> System.Collections.Generic.IEnumerable<TValue>.GetEnumerator() { throw null; }
- void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct Enumerator : System.Collections.Generic.IEnumerator<TValue>, System.Collections.IEnumerator, System.IDisposable
- {
- public TValue Current { get { throw null; } }
- object System.Collections.IEnumerator.Current { get { throw null; } }
- public void Dispose() { }
- public bool MoveNext() { throw null; }
- void System.Collections.IEnumerator.Reset() { }
- }
- }
- }
- public abstract partial class EqualityComparer<T> : System.Collections.Generic.IEqualityComparer<T>, System.Collections.IEqualityComparer
- {
- protected EqualityComparer() { }
- public static System.Collections.Generic.EqualityComparer<T> Default { get { throw null; } }
- public abstract bool Equals(T x, T y);
- public abstract int GetHashCode(T obj);
- bool System.Collections.IEqualityComparer.Equals(object x, object y) { throw null; }
- int System.Collections.IEqualityComparer.GetHashCode(object obj) { throw null; }
- }
- public partial interface ICollection<T> : System.Collections.Generic.IEnumerable<T>, System.Collections.IEnumerable
- {
- int Count { get; }
- bool IsReadOnly { get; }
- void Add(T item);
- void Clear();
- bool Contains(T item);
- void CopyTo(T[] array, int arrayIndex);
- bool Remove(T item);
- }
- public partial interface IComparer<in T>
- {
- int Compare(T x, T y);
- }
- public partial interface IDictionary<TKey, TValue> : System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.IEnumerable
- {
- TValue this[TKey key] { get; set; }
- System.Collections.Generic.ICollection<TKey> Keys { get; }
- System.Collections.Generic.ICollection<TValue> Values { get; }
- void Add(TKey key, TValue value);
- bool ContainsKey(TKey key);
- bool Remove(TKey key);
- bool TryGetValue(TKey key, out TValue value);
- }
- public partial interface IEnumerable<out T> : System.Collections.IEnumerable
- {
- new System.Collections.Generic.IEnumerator<T> GetEnumerator();
- }
- public partial interface IEnumerator<out T> : System.Collections.IEnumerator, System.IDisposable
- {
- new T Current { get; }
- }
- public partial interface IEqualityComparer<in T>
- {
- bool Equals(T x, T y);
- int GetHashCode(T obj);
- }
- public partial interface IList<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.IEnumerable
- {
- T this[int index] { get; set; }
- int IndexOf(T item);
- void Insert(int index, T item);
- void RemoveAt(int index);
- }
- public partial interface IReadOnlyCollection<out T> : System.Collections.Generic.IEnumerable<T>, System.Collections.IEnumerable
- {
- int Count { get; }
- }
- public partial interface IReadOnlyDictionary<TKey, TValue> : System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.IEnumerable
- {
- TValue this[TKey key] { get; }
- System.Collections.Generic.IEnumerable<TKey> Keys { get; }
- System.Collections.Generic.IEnumerable<TValue> Values { get; }
- bool ContainsKey(TKey key);
- bool TryGetValue(TKey key, out TValue value);
- }
- public partial interface IReadOnlyList<out T> : System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.IEnumerable
- {
- T this[int index] { get; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class KeyNotFoundException : System.SystemException, System.Runtime.Serialization.ISerializable
- {
- public KeyNotFoundException() { }
- public KeyNotFoundException(string message) { }
- public KeyNotFoundException(string message, System.Exception innerException) { }
- protected KeyNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct KeyValuePair<TKey, TValue>
- {
- public KeyValuePair(TKey key, TValue value) { throw null;}
- public TKey Key { get { throw null; } }
- public TValue Value { get { throw null; } }
- public override string ToString() { throw null; }
- }
- [System.Diagnostics.DebuggerDisplayAttribute("Count = {Count}")]
- public partial class List<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IList<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.IReadOnlyList<T>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList
- {
- public List() { }
- public List(System.Collections.Generic.IEnumerable<T> collection) { }
- public List(int capacity) { }
- public int Capacity { get { throw null; } set { } }
- public int Count { get { throw null; } }
- public T this[int index] { get { throw null; } set { } }
- bool System.Collections.Generic.ICollection<T>.IsReadOnly { get { throw null; } }
- bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
- object System.Collections.ICollection.SyncRoot { get { throw null; } }
- bool System.Collections.IList.IsFixedSize { get { throw null; } }
- bool System.Collections.IList.IsReadOnly { get { throw null; } }
- object System.Collections.IList.this[int index] { get { throw null; } set { } }
- public void Add(T item) { }
- public void AddRange(System.Collections.Generic.IEnumerable<T> collection) { }
- public System.Collections.ObjectModel.ReadOnlyCollection<T> AsReadOnly() { throw null; }
- public int BinarySearch(T item) { throw null; }
- public int BinarySearch(T item, System.Collections.Generic.IComparer<T> comparer) { throw null; }
- public int BinarySearch(int index, int count, T item, System.Collections.Generic.IComparer<T> comparer) { throw null; }
- public void Clear() { }
- public bool Contains(T item) { throw null; }
- public System.Collections.Generic.List<TOutput> ConvertAll<TOutput>(System.Converter<T, TOutput> converter) { throw null; }
- public void CopyTo(T[] array) { }
- public void CopyTo(T[] array, int arrayIndex) { }
- public void CopyTo(int index, T[] array, int arrayIndex, int count) { }
- public bool Exists(System.Predicate<T> match) { throw null; }
- public T Find(System.Predicate<T> match) { throw null; }
- public System.Collections.Generic.List<T> FindAll(System.Predicate<T> match) { throw null; }
- public int FindIndex(int startIndex, int count, System.Predicate<T> match) { throw null; }
- public int FindIndex(int startIndex, System.Predicate<T> match) { throw null; }
- public int FindIndex(System.Predicate<T> match) { throw null; }
- public T FindLast(System.Predicate<T> match) { throw null; }
- public int FindLastIndex(int startIndex, int count, System.Predicate<T> match) { throw null; }
- public int FindLastIndex(int startIndex, System.Predicate<T> match) { throw null; }
- public int FindLastIndex(System.Predicate<T> match) { throw null; }
- public void ForEach(System.Action<T> action) { }
- public System.Collections.Generic.List<T>.Enumerator GetEnumerator() { throw null; }
- public System.Collections.Generic.List<T> GetRange(int index, int count) { throw null; }
- public int IndexOf(T item) { throw null; }
- public int IndexOf(T item, int index) { throw null; }
- public int IndexOf(T item, int index, int count) { throw null; }
- public void Insert(int index, T item) { }
- public void InsertRange(int index, System.Collections.Generic.IEnumerable<T> collection) { }
- public int LastIndexOf(T item) { throw null; }
- public int LastIndexOf(T item, int index) { throw null; }
- public int LastIndexOf(T item, int index, int count) { throw null; }
- public bool Remove(T item) { throw null; }
- public int RemoveAll(System.Predicate<T> match) { throw null; }
- public void RemoveAt(int index) { }
- public void RemoveRange(int index, int count) { }
- public void Reverse() { }
- public void Reverse(int index, int count) { }
- public void Sort() { }
- public void Sort(System.Collections.Generic.IComparer<T> comparer) { }
- public void Sort(System.Comparison<T> comparison) { }
- public void Sort(int index, int count, System.Collections.Generic.IComparer<T> comparer) { }
- System.Collections.Generic.IEnumerator<T> System.Collections.Generic.IEnumerable<T>.GetEnumerator() { throw null; }
- void System.Collections.ICollection.CopyTo(System.Array array, int arrayIndex) { }
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
- int System.Collections.IList.Add(object item) { throw null; }
- bool System.Collections.IList.Contains(object item) { throw null; }
- int System.Collections.IList.IndexOf(object item) { throw null; }
- void System.Collections.IList.Insert(int index, object item) { }
- void System.Collections.IList.Remove(object item) { }
- public T[] ToArray() { throw null; }
- public void TrimExcess() { }
- public bool TrueForAll(System.Predicate<T> match) { throw null; }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct Enumerator : System.Collections.Generic.IEnumerator<T>, System.Collections.IEnumerator, System.IDisposable
- {
- public T Current { get { throw null; } }
- object System.Collections.IEnumerator.Current { get { throw null; } }
- public void Dispose() { }
- public bool MoveNext() { throw null; }
- void System.Collections.IEnumerator.Reset() { }
- }
- }
-}
-namespace System.Collections.ObjectModel
-{
- [System.Diagnostics.DebuggerDisplayAttribute("Count = {Count}")]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public partial class Collection<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IList<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.IReadOnlyList<T>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList
- {
- public Collection() { }
- public Collection(System.Collections.Generic.IList<T> list) { }
- public int Count { get { throw null; } }
- public T this[int index] { get { throw null; } set { } }
- protected System.Collections.Generic.IList<T> Items { get { throw null; } }
- bool System.Collections.Generic.ICollection<T>.IsReadOnly { get { throw null; } }
- bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
- object System.Collections.ICollection.SyncRoot { get { throw null; } }
- bool System.Collections.IList.IsFixedSize { get { throw null; } }
- bool System.Collections.IList.IsReadOnly { get { throw null; } }
- object System.Collections.IList.this[int index] { get { throw null; } set { } }
- public void Add(T item) { }
- public void Clear() { }
- protected virtual void ClearItems() { }
- public bool Contains(T item) { throw null; }
- public void CopyTo(T[] array, int index) { }
- public System.Collections.Generic.IEnumerator<T> GetEnumerator() { throw null; }
- public int IndexOf(T item) { throw null; }
- public void Insert(int index, T item) { }
- protected virtual void InsertItem(int index, T item) { }
- public bool Remove(T item) { throw null; }
- public void RemoveAt(int index) { }
- protected virtual void RemoveItem(int index) { }
- protected virtual void SetItem(int index, T item) { }
- void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
- int System.Collections.IList.Add(object value) { throw null; }
- bool System.Collections.IList.Contains(object value) { throw null; }
- int System.Collections.IList.IndexOf(object value) { throw null; }
- void System.Collections.IList.Insert(int index, object value) { }
- void System.Collections.IList.Remove(object value) { }
- }
- [System.Diagnostics.DebuggerDisplayAttribute("Count = {Count}")]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public abstract partial class KeyedCollection<TKey, TItem> : System.Collections.ObjectModel.Collection<TItem>
- {
- protected KeyedCollection() { }
- protected KeyedCollection(System.Collections.Generic.IEqualityComparer<TKey> comparer) { }
- protected KeyedCollection(System.Collections.Generic.IEqualityComparer<TKey> comparer, int dictionaryCreationThreshold) { }
- public System.Collections.Generic.IEqualityComparer<TKey> Comparer { get { throw null; } }
- protected System.Collections.Generic.IDictionary<TKey, TItem> Dictionary { get { throw null; } }
- public TItem this[TKey key] { get { throw null; } }
- protected void ChangeItemKey(TItem item, TKey newKey) { }
- protected override void ClearItems() { }
- public bool Contains(TKey key) { throw null; }
- protected abstract TKey GetKeyForItem(TItem item);
- protected override void InsertItem(int index, TItem item) { }
- public bool Remove(TKey key) { throw null; }
- protected override void RemoveItem(int index) { }
- protected override void SetItem(int index, TItem item) { }
- }
- [System.Diagnostics.DebuggerDisplayAttribute("Count = {Count}")]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public partial class ReadOnlyCollection<T> : System.Collections.Generic.ICollection<T>, System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IList<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.Generic.IReadOnlyList<T>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList
- {
- public ReadOnlyCollection(System.Collections.Generic.IList<T> list) { }
- public int Count { get { throw null; } }
- public T this[int index] { get { throw null; } }
- protected System.Collections.Generic.IList<T> Items { get { throw null; } }
- bool System.Collections.Generic.ICollection<T>.IsReadOnly { get { throw null; } }
- T System.Collections.Generic.IList<T>.this[int index] { get { throw null; } set { } }
- bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
- object System.Collections.ICollection.SyncRoot { get { throw null; } }
- bool System.Collections.IList.IsFixedSize { get { throw null; } }
- bool System.Collections.IList.IsReadOnly { get { throw null; } }
- object System.Collections.IList.this[int index] { get { throw null; } set { } }
- public bool Contains(T value) { throw null; }
- public void CopyTo(T[] array, int index) { }
- public System.Collections.Generic.IEnumerator<T> GetEnumerator() { throw null; }
- public int IndexOf(T value) { throw null; }
- void System.Collections.Generic.ICollection<T>.Add(T value) { }
- void System.Collections.Generic.ICollection<T>.Clear() { }
- bool System.Collections.Generic.ICollection<T>.Remove(T value) { throw null; }
- void System.Collections.Generic.IList<T>.Insert(int index, T value) { }
- void System.Collections.Generic.IList<T>.RemoveAt(int index) { }
- void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
- int System.Collections.IList.Add(object value) { throw null; }
- void System.Collections.IList.Clear() { }
- bool System.Collections.IList.Contains(object value) { throw null; }
- int System.Collections.IList.IndexOf(object value) { throw null; }
- void System.Collections.IList.Insert(int index, object value) { }
- void System.Collections.IList.Remove(object value) { }
- void System.Collections.IList.RemoveAt(int index) { }
- }
- [System.Diagnostics.DebuggerDisplayAttribute("Count = {Count}")]
- public partial class ReadOnlyDictionary<TKey, TValue> : System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.Generic.IDictionary<TKey, TValue>, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<TKey, TValue>>, System.Collections.Generic.IReadOnlyDictionary<TKey, TValue>, System.Collections.ICollection, System.Collections.IDictionary, System.Collections.IEnumerable
- {
- public ReadOnlyDictionary(System.Collections.Generic.IDictionary<TKey, TValue> dictionary) { }
- public int Count { get { throw null; } }
- protected System.Collections.Generic.IDictionary<TKey, TValue> Dictionary { get { throw null; } }
- public TValue this[TKey key] { get { throw null; } }
- public System.Collections.ObjectModel.ReadOnlyDictionary<TKey, TValue>.KeyCollection Keys { get { throw null; } }
- bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.IsReadOnly { get { throw null; } }
- TValue System.Collections.Generic.IDictionary<TKey,TValue>.this[TKey key] { get { throw null; } set { } }
- System.Collections.Generic.ICollection<TKey> System.Collections.Generic.IDictionary<TKey,TValue>.Keys { get { throw null; } }
- System.Collections.Generic.ICollection<TValue> System.Collections.Generic.IDictionary<TKey,TValue>.Values { get { throw null; } }
- System.Collections.Generic.IEnumerable<TKey> System.Collections.Generic.IReadOnlyDictionary<TKey,TValue>.Keys { get { throw null; } }
- System.Collections.Generic.IEnumerable<TValue> System.Collections.Generic.IReadOnlyDictionary<TKey,TValue>.Values { get { throw null; } }
- bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
- object System.Collections.ICollection.SyncRoot { get { throw null; } }
- bool System.Collections.IDictionary.IsFixedSize { get { throw null; } }
- bool System.Collections.IDictionary.IsReadOnly { get { throw null; } }
- object System.Collections.IDictionary.this[object key] { get { throw null; } set { } }
- System.Collections.ICollection System.Collections.IDictionary.Keys { get { throw null; } }
- System.Collections.ICollection System.Collections.IDictionary.Values { get { throw null; } }
- public System.Collections.ObjectModel.ReadOnlyDictionary<TKey, TValue>.ValueCollection Values { get { throw null; } }
- public bool ContainsKey(TKey key) { throw null; }
- public System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>> GetEnumerator() { throw null; }
- void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Add(System.Collections.Generic.KeyValuePair<TKey, TValue> item) { }
- void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Clear() { }
- bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Contains(System.Collections.Generic.KeyValuePair<TKey, TValue> item) { throw null; }
- void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.CopyTo(System.Collections.Generic.KeyValuePair<TKey, TValue>[] array, int arrayIndex) { }
- bool System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Remove(System.Collections.Generic.KeyValuePair<TKey, TValue> item) { throw null; }
- void System.Collections.Generic.IDictionary<TKey,TValue>.Add(TKey key, TValue value) { }
- bool System.Collections.Generic.IDictionary<TKey,TValue>.Remove(TKey key) { throw null; }
- void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
- void System.Collections.IDictionary.Add(object key, object value) { }
- void System.Collections.IDictionary.Clear() { }
- bool System.Collections.IDictionary.Contains(object key) { throw null; }
- System.Collections.IDictionaryEnumerator System.Collections.IDictionary.GetEnumerator() { throw null; }
- void System.Collections.IDictionary.Remove(object key) { }
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
- public bool TryGetValue(TKey key, out TValue value) { value = default(TValue); throw null; }
- [System.Diagnostics.DebuggerDisplayAttribute("Count = {Count}")]
- public sealed partial class KeyCollection : System.Collections.Generic.ICollection<TKey>, System.Collections.Generic.IEnumerable<TKey>, System.Collections.Generic.IReadOnlyCollection<TKey>, System.Collections.ICollection, System.Collections.IEnumerable
- {
- internal KeyCollection() { }
- public int Count { get { throw null; } }
- bool System.Collections.Generic.ICollection<TKey>.IsReadOnly { get { throw null; } }
- bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
- object System.Collections.ICollection.SyncRoot { get { throw null; } }
- public void CopyTo(TKey[] array, int arrayIndex) { }
- public System.Collections.Generic.IEnumerator<TKey> GetEnumerator() { throw null; }
- void System.Collections.Generic.ICollection<TKey>.Add(TKey item) { }
- void System.Collections.Generic.ICollection<TKey>.Clear() { }
- bool System.Collections.Generic.ICollection<TKey>.Contains(TKey item) { throw null; }
- bool System.Collections.Generic.ICollection<TKey>.Remove(TKey item) { throw null; }
- void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
- }
- [System.Diagnostics.DebuggerDisplayAttribute("Count = {Count}")]
- public sealed partial class ValueCollection : System.Collections.Generic.ICollection<TValue>, System.Collections.Generic.IEnumerable<TValue>, System.Collections.Generic.IReadOnlyCollection<TValue>, System.Collections.ICollection, System.Collections.IEnumerable
- {
- internal ValueCollection() { }
- public int Count { get { throw null; } }
- bool System.Collections.Generic.ICollection<TValue>.IsReadOnly { get { throw null; } }
- bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
- object System.Collections.ICollection.SyncRoot { get { throw null; } }
- public void CopyTo(TValue[] array, int arrayIndex) { }
- public System.Collections.Generic.IEnumerator<TValue> GetEnumerator() { throw null; }
- void System.Collections.Generic.ICollection<TValue>.Add(TValue item) { }
- void System.Collections.Generic.ICollection<TValue>.Clear() { }
- bool System.Collections.Generic.ICollection<TValue>.Contains(TValue item) { throw null; }
- bool System.Collections.Generic.ICollection<TValue>.Remove(TValue item) { throw null; }
- void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
- }
- }
-}
-namespace System.Configuration.Assemblies
-{
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum AssemblyHashAlgorithm
- {
- MD5 = 32771,
- None = 0,
- SHA1 = 32772,
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- SHA256 = 32780,
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- SHA384 = 32781,
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- SHA512 = 32782,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum AssemblyVersionCompatibility
- {
- SameMachine = 1,
- SameProcess = 2,
- SameDomain = 3,
- }
-}
-namespace System.Diagnostics
-{
- [System.AttributeUsageAttribute((System.AttributeTargets)(68), AllowMultiple=true)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class ConditionalAttribute : System.Attribute
- {
- public ConditionalAttribute(string conditionString) { }
- public string ConditionString { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(3), AllowMultiple=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class DebuggableAttribute : System.Attribute
- {
- public DebuggableAttribute(bool isJITTrackingEnabled, bool isJITOptimizerDisabled) { }
- public DebuggableAttribute(System.Diagnostics.DebuggableAttribute.DebuggingModes modes) { }
- public System.Diagnostics.DebuggableAttribute.DebuggingModes DebuggingFlags { get { throw null; } }
- public bool IsJITOptimizerDisabled { get { throw null; } }
- public bool IsJITTrackingEnabled { get { throw null; } }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum DebuggingModes
- {
- Default = 1,
- DisableOptimizations = 256,
- EnableEditAndContinue = 4,
- IgnoreSymbolStoreSequencePoints = 2,
- None = 0,
- }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class Debugger
- {
- public static readonly string DefaultCategory;
- [System.ObsoleteAttribute("Do not create instances of the Debugger class. Call the static methods directly on this type instead", true)]
- public Debugger() { }
- public static bool IsAttached { [System.Security.SecuritySafeCriticalAttribute][System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]get { throw null; } }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void Break() { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static bool IsLogging() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static bool Launch() { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static void Log(int level, string category, string message) { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public static void NotifyOfCrossThreadDependency() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(384), AllowMultiple=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class DebuggerBrowsableAttribute : System.Attribute
- {
- public DebuggerBrowsableAttribute(System.Diagnostics.DebuggerBrowsableState state) { }
- public System.Diagnostics.DebuggerBrowsableState State { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum DebuggerBrowsableState
- {
- Collapsed = 2,
- Never = 0,
- RootHidden = 3,
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(4509), AllowMultiple=true)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class DebuggerDisplayAttribute : System.Attribute
- {
- public DebuggerDisplayAttribute(string value) { }
- public string Name { get { throw null; } set { } }
- public System.Type Target { get { throw null; } set { } }
- public string TargetTypeName { get { throw null; } set { } }
- public string Type { get { throw null; } set { } }
- public string Value { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(224), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class DebuggerHiddenAttribute : System.Attribute
- {
- public DebuggerHiddenAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(236), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class DebuggerNonUserCodeAttribute : System.Attribute
- {
- public DebuggerNonUserCodeAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(108), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class DebuggerStepThroughAttribute : System.Attribute
- {
- public DebuggerStepThroughAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(13), AllowMultiple=true)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class DebuggerTypeProxyAttribute : System.Attribute
- {
- public DebuggerTypeProxyAttribute(string typeName) { }
- public DebuggerTypeProxyAttribute(System.Type type) { }
- public string ProxyTypeName { get { throw null; } }
- public System.Type Target { get { throw null; } set { } }
- public string TargetTypeName { get { throw null; } set { } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class StackFrame
- {
- public const int OFFSET_UNKNOWN = -1;
- [System.Security.SecuritySafeCriticalAttribute]
- public StackFrame() { }
- [System.Security.SecurityCriticalAttribute]
- public StackFrame(bool fNeedFileInfo) { }
- public StackFrame(int skipFrames) { }
- [System.Security.SecurityCriticalAttribute]
- public StackFrame(int skipFrames, bool fNeedFileInfo) { }
- public StackFrame(string fileName, int lineNumber) { }
- public StackFrame(string fileName, int lineNumber, int colNumber) { }
- public virtual int GetFileColumnNumber() { throw null; }
- public virtual int GetFileLineNumber() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public virtual string GetFileName() { throw null; }
- public virtual int GetILOffset() { throw null; }
- public virtual System.Reflection.MethodBase GetMethod() { throw null; }
- public virtual int GetNativeOffset() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override string ToString() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class StackTrace
- {
- public const int METHODS_TO_SKIP = 0;
- [System.Security.SecuritySafeCriticalAttribute]
- public StackTrace() { }
- [System.Security.SecurityCriticalAttribute]
- public StackTrace(bool fNeedFileInfo) { }
- public StackTrace(System.Diagnostics.StackFrame frame) { }
- public StackTrace(System.Exception e) { }
- [System.Security.SecurityCriticalAttribute]
- public StackTrace(System.Exception e, bool fNeedFileInfo) { }
- [System.Security.SecurityCriticalAttribute]
- public StackTrace(System.Exception e, int skipFrames) { }
- [System.Security.SecurityCriticalAttribute]
- public StackTrace(System.Exception e, int skipFrames, bool fNeedFileInfo) { }
- [System.Security.SecurityCriticalAttribute]
- public StackTrace(int skipFrames) { }
- [System.Security.SecurityCriticalAttribute]
- public StackTrace(int skipFrames, bool fNeedFileInfo) { }
- [System.ObsoleteAttribute("This constructor has been deprecated. Please use a constructor that does not require a Thread parameter. http://go.microsoft.com/fwlink/?linkid=14202")]
- [System.Security.SecurityCriticalAttribute]
- public StackTrace(System.Threading.Thread targetThread, bool needFileInfo) { }
- public virtual int FrameCount { get { throw null; } }
- public virtual System.Diagnostics.StackFrame GetFrame(int index) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual System.Diagnostics.StackFrame[] GetFrames() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override string ToString() { throw null; }
- }
-}
-namespace System.Diagnostics.CodeAnalysis
-{
- [System.AttributeUsageAttribute((System.AttributeTargets)(32767), Inherited=false, AllowMultiple=true)]
- [System.Diagnostics.ConditionalAttribute("CODE_ANALYSIS")]
- public sealed partial class SuppressMessageAttribute : System.Attribute
- {
- public SuppressMessageAttribute(string category, string checkId) { }
- public string Category { get { throw null; } }
- public string CheckId { get { throw null; } }
- public string Justification { get { throw null; } set { } }
- public string MessageId { get { throw null; } set { } }
- public string Scope { get { throw null; } set { } }
- public string Target { get { throw null; } set { } }
- }
-}
-namespace System.Diagnostics.Contracts
-{
- public static partial class Contract
- {
- public static event System.EventHandler<System.Diagnostics.Contracts.ContractFailedEventArgs> ContractFailed { add { } remove { } }
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- [System.Diagnostics.ConditionalAttribute("DEBUG")]
- public static void Assert(bool condition) { }
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- [System.Diagnostics.ConditionalAttribute("DEBUG")]
- public static void Assert(bool condition, string userMessage) { }
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- [System.Diagnostics.ConditionalAttribute("DEBUG")]
- public static void Assume(bool condition) { }
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- [System.Diagnostics.ConditionalAttribute("DEBUG")]
- public static void Assume(bool condition, string userMessage) { }
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- public static void EndContractBlock() { }
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- public static void Ensures(bool condition) { }
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- public static void Ensures(bool condition, string userMessage) { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Justification="Exception type used in tools.")]
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- public static void EnsuresOnThrow<TException>(bool condition) where TException : System.Exception { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Justification="Exception type used in tools.")]
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- public static void EnsuresOnThrow<TException>(bool condition, string userMessage) where TException : System.Exception { }
- public static bool Exists(int fromInclusive, int toExclusive, System.Predicate<int> predicate) { throw null; }
- public static bool Exists<T>(System.Collections.Generic.IEnumerable<T> collection, System.Predicate<T> predicate) { throw null; }
- public static bool ForAll(int fromInclusive, int toExclusive, System.Predicate<int> predicate) { throw null; }
- public static bool ForAll<T>(System.Collections.Generic.IEnumerable<T> collection, System.Predicate<T> predicate) { throw null; }
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- public static void Invariant(bool condition) { }
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- public static void Invariant(bool condition, string userMessage) { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId="value")]
- public static T OldValue<T>(T value) { throw null; }
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- public static void Requires(bool condition) { }
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- public static void Requires(bool condition, string userMessage) { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")]
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId="condition")]
- public static void Requires<TException>(bool condition) where TException : System.Exception { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter")]
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId="condition")]
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId="userMessage")]
- public static void Requires<TException>(bool condition, string userMessage) where TException : System.Exception { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1004:GenericMethodsShouldProvideTypeParameter", Justification="Not intended to be called at runtime.")]
- public static T Result<T>() { throw null; }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1021:AvoidOutParameters", MessageId="0#", Justification="Not intended to be called at runtime.")]
- public static T ValueAtReturn<T>(out T value) { value = default(T); throw null; }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(64), AllowMultiple=false)]
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- public sealed partial class ContractAbbreviatorAttribute : System.Attribute
- {
- public ContractAbbreviatorAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(64), AllowMultiple=false)]
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- public sealed partial class ContractArgumentValidatorAttribute : System.Attribute
- {
- public ContractArgumentValidatorAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(5124), AllowMultiple=false, Inherited=false)]
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- [System.Diagnostics.ConditionalAttribute("DEBUG")]
- public sealed partial class ContractClassAttribute : System.Attribute
- {
- public ContractClassAttribute(System.Type typeContainingContracts) { }
- public System.Type TypeContainingContracts { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(4), AllowMultiple=false, Inherited=false)]
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- public sealed partial class ContractClassForAttribute : System.Attribute
- {
- public ContractClassForAttribute(System.Type typeContractsAreFor) { }
- public System.Type TypeContractsAreFor { get { throw null; } }
- }
- public sealed partial class ContractFailedEventArgs : System.EventArgs
- {
- public ContractFailedEventArgs(System.Diagnostics.Contracts.ContractFailureKind failureKind, string message, string condition, System.Exception originalException) { }
- public string Condition { get { throw null; } }
- public System.Diagnostics.Contracts.ContractFailureKind FailureKind { get { throw null; } }
- public bool Handled { get { throw null; } }
- public string Message { get { throw null; } }
- public System.Exception OriginalException { get { throw null; } }
- public bool Unwind { get { throw null; } }
- [System.Security.SecurityCriticalAttribute]
- public void SetHandled() { }
- [System.Security.SecurityCriticalAttribute]
- public void SetUnwind() { }
- }
- public enum ContractFailureKind
- {
- Assert = 4,
- Assume = 5,
- Invariant = 3,
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId="Postcondition")]
- Postcondition = 1,
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId="Postcondition")]
- PostconditionOnException = 2,
- Precondition = 0,
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(64), AllowMultiple=false, Inherited=false)]
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- public sealed partial class ContractInvariantMethodAttribute : System.Attribute
- {
- public ContractInvariantMethodAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(32767), AllowMultiple=true, Inherited=false)]
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- public sealed partial class ContractOptionAttribute : System.Attribute
- {
- public ContractOptionAttribute(string category, string setting, bool enabled) { }
- public ContractOptionAttribute(string category, string setting, string value) { }
- public string Category { get { throw null; } }
- public bool Enabled { get { throw null; } }
- public string Setting { get { throw null; } }
- public string Value { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(256))]
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1019:DefineAccessorsForAttributeArguments", Justification="Thank you very much, but we like the names we've defined for the accessors")]
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- public sealed partial class ContractPublicPropertyNameAttribute : System.Attribute
- {
- public ContractPublicPropertyNameAttribute(string name) { }
- public string Name { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1))]
- public sealed partial class ContractReferenceAssemblyAttribute : System.Attribute
- {
- public ContractReferenceAssemblyAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(192), AllowMultiple=false, Inherited=true)]
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- public sealed partial class ContractRuntimeIgnoredAttribute : System.Attribute
- {
- public ContractRuntimeIgnoredAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(237))]
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- public sealed partial class ContractVerificationAttribute : System.Attribute
- {
- public ContractVerificationAttribute(bool value) { }
- public bool Value { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(6884), AllowMultiple=false, Inherited=true)]
- [System.Diagnostics.ConditionalAttribute("CONTRACTS_FULL")]
- public sealed partial class PureAttribute : System.Attribute
- {
- public PureAttribute() { }
- }
-}
-namespace System.Diagnostics.Contracts.Internal
-{
- [System.ObsoleteAttribute("Use the ContractHelper class in the System.Runtime.CompilerServices namespace instead.")]
- public static partial class ContractHelper
- {
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1030:UseEventsWhereAppropriate")]
- [System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static string RaiseContractFailedEvent(System.Diagnostics.Contracts.ContractFailureKind failureKind, string userMessage, string conditionText, System.Exception innerException) { throw null; }
- [System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static void TriggerFailure(System.Diagnostics.Contracts.ContractFailureKind kind, string displayMessage, string userMessage, string conditionText, System.Exception innerException) { }
- }
-}
-namespace System.Diagnostics.SymbolStore
-{
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface ISymbolDocumentWriter
- {
- void SetCheckSum(System.Guid algorithmId, byte[] checkSum);
- void SetSource(byte[] source);
- }
-}
-namespace System.Diagnostics.Tracing
-{
- [System.FlagsAttribute]
- public enum EventActivityOptions
- {
- Detachable = 8,
- Disable = 2,
- None = 0,
- Recursive = 4,
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(64))]
- public sealed partial class EventAttribute : System.Attribute
- {
- public EventAttribute(int eventId) { }
- public System.Diagnostics.Tracing.EventActivityOptions ActivityOptions { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public System.Diagnostics.Tracing.EventChannel Channel { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public int EventId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public System.Diagnostics.Tracing.EventKeywords Keywords { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public System.Diagnostics.Tracing.EventLevel Level { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string Message { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public System.Diagnostics.Tracing.EventOpcode Opcode { get { throw null; } set { } }
- public System.Diagnostics.Tracing.EventTags Tags { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public System.Diagnostics.Tracing.EventTask Task { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public byte Version { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1028:EnumStorageShouldBeInt32", Justification="Backwards compatibility")]
- public enum EventChannel : byte
- {
- Admin = (byte)16,
- Analytic = (byte)18,
- Debug = (byte)19,
- None = (byte)0,
- Operational = (byte)17,
- }
- public enum EventCommand
- {
- Disable = -3,
- Enable = -2,
- SendManifest = -1,
- Update = 0,
- }
- public partial class EventCommandEventArgs : System.EventArgs
- {
- internal EventCommandEventArgs() { }
- public System.Collections.Generic.IDictionary<string, string> Arguments { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public System.Diagnostics.Tracing.EventCommand Command { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public bool DisableEvent(int eventId) { throw null; }
- public bool EnableEvent(int eventId) { throw null; }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(12), Inherited=false)]
- public partial class EventDataAttribute : System.Attribute
- {
- public EventDataAttribute() { }
- public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(128))]
- public partial class EventFieldAttribute : System.Attribute
- {
- public EventFieldAttribute() { }
- public System.Diagnostics.Tracing.EventFieldFormat Format { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public System.Diagnostics.Tracing.EventFieldTags Tags { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- }
- public enum EventFieldFormat
- {
- Boolean = 3,
- Default = 0,
- Hexadecimal = 4,
- HResult = 15,
- Json = 12,
- String = 2,
- Xml = 11,
- }
- [System.FlagsAttribute]
- public enum EventFieldTags
- {
- None = 0,
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(128))]
- public partial class EventIgnoreAttribute : System.Attribute
- {
- public EventIgnoreAttribute() { }
- }
- [System.FlagsAttribute]
- public enum EventKeywords : long
- {
- All = (long)-1,
- AuditFailure = (long)4503599627370496,
- AuditSuccess = (long)9007199254740992,
- CorrelationHint = (long)4503599627370496,
- EventLogClassic = (long)36028797018963968,
- MicrosoftTelemetry = (long)562949953421312,
- None = (long)0,
- Sqm = (long)2251799813685248,
- WdiContext = (long)562949953421312,
- WdiDiagnostic = (long)1125899906842624,
- }
- public enum EventLevel
- {
- Critical = 1,
- Error = 2,
- Informational = 4,
- LogAlways = 0,
- Verbose = 5,
- Warning = 3,
- }
- public partial class EventListener : System.IDisposable
- {
- public EventListener() { }
- public void DisableEvents(System.Diagnostics.Tracing.EventSource eventSource) { }
- public virtual void Dispose() { }
- public void EnableEvents(System.Diagnostics.Tracing.EventSource eventSource, System.Diagnostics.Tracing.EventLevel level) { }
- public void EnableEvents(System.Diagnostics.Tracing.EventSource eventSource, System.Diagnostics.Tracing.EventLevel level, System.Diagnostics.Tracing.EventKeywords matchAnyKeyword) { }
- public void EnableEvents(System.Diagnostics.Tracing.EventSource eventSource, System.Diagnostics.Tracing.EventLevel level, System.Diagnostics.Tracing.EventKeywords matchAnyKeyword, System.Collections.Generic.IDictionary<string, string> arguments) { }
- public static int EventSourceIndex(System.Diagnostics.Tracing.EventSource eventSource) { throw null; }
- protected internal virtual void OnEventSourceCreated(System.Diagnostics.Tracing.EventSource eventSource) { }
- protected internal virtual void OnEventWritten(System.Diagnostics.Tracing.EventWrittenEventArgs eventData) { }
- }
- [System.FlagsAttribute]
- public enum EventManifestOptions
- {
- AllCultures = 2,
- AllowEventSourceOverride = 8,
- None = 0,
- OnlyIfNeededForRegistration = 4,
- Strict = 1,
- }
- public enum EventOpcode
- {
- DataCollectionStart = 3,
- DataCollectionStop = 4,
- Extension = 5,
- Info = 0,
- Receive = 240,
- Reply = 6,
- Resume = 7,
- Send = 9,
- Start = 1,
- Stop = 2,
- Suspend = 8,
- }
- public partial class EventSource : System.IDisposable
- {
- protected EventSource() { }
- protected EventSource(bool throwOnEventWriteErrors) { }
- protected EventSource(System.Diagnostics.Tracing.EventSourceSettings settings) { }
- protected EventSource(System.Diagnostics.Tracing.EventSourceSettings settings, params string[] traits) { }
- public EventSource(string eventSourceName) { }
- public EventSource(string eventSourceName, System.Diagnostics.Tracing.EventSourceSettings config) { }
- public EventSource(string eventSourceName, System.Diagnostics.Tracing.EventSourceSettings config, params string[] traits) { }
- public System.Exception ConstructionException { get { throw null; } }
- public static System.Guid CurrentThreadActivityId { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public System.Guid Guid { get { throw null; } }
- public string Name { get { throw null; } }
- public System.Diagnostics.Tracing.EventSourceSettings Settings { get { throw null; } }
- public event System.EventHandler<System.Diagnostics.Tracing.EventCommandEventArgs> EventCommandExecuted { add { } remove { } }
- public void Dispose() { }
- protected virtual void Dispose(bool disposing) { }
- ~EventSource() { }
- public static string GenerateManifest(System.Type eventSourceType, string assemblyPathToIncludeInManifest) { throw null; }
- public static string GenerateManifest(System.Type eventSourceType, string assemblyPathToIncludeInManifest, System.Diagnostics.Tracing.EventManifestOptions flags) { throw null; }
- public static System.Guid GetGuid(System.Type eventSourceType) { throw null; }
- public static string GetName(System.Type eventSourceType) { throw null; }
- public static System.Collections.Generic.IEnumerable<System.Diagnostics.Tracing.EventSource> GetSources() { throw null; }
- public string GetTrait(string key) { throw null; }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Concurrency", "CA8001", Justification="This does not need to be correct when racing with other threads")]
- public bool IsEnabled() { throw null; }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Concurrency", "CA8001", Justification="This does not need to be correct when racing with other threads")]
- public bool IsEnabled(System.Diagnostics.Tracing.EventLevel level, System.Diagnostics.Tracing.EventKeywords keywords) { throw null; }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Concurrency", "CA8001", Justification="This does not need to be correct when racing with other threads")]
- public bool IsEnabled(System.Diagnostics.Tracing.EventLevel level, System.Diagnostics.Tracing.EventKeywords keywords, System.Diagnostics.Tracing.EventChannel channel) { throw null; }
- protected virtual void OnEventCommand(System.Diagnostics.Tracing.EventCommandEventArgs command) { }
- public static void SendCommand(System.Diagnostics.Tracing.EventSource eventSource, System.Diagnostics.Tracing.EventCommand command, System.Collections.Generic.IDictionary<string, string> commandArguments) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void SetCurrentThreadActivityId(System.Guid activityId) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void SetCurrentThreadActivityId(System.Guid activityId, out System.Guid oldActivityThatWillContinue) { oldActivityThatWillContinue = default(System.Guid); }
- public override string ToString() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public void Write(string eventName) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void Write(string eventName, System.Diagnostics.Tracing.EventSourceOptions options) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void Write<T>(string eventName, T data) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void Write<T>(string eventName, System.Diagnostics.Tracing.EventSourceOptions options, T data) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void Write<T>(string eventName, ref System.Diagnostics.Tracing.EventSourceOptions options, ref T data) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void Write<T>(string eventName, ref System.Diagnostics.Tracing.EventSourceOptions options, ref System.Guid activityId, ref System.Guid relatedActivityId, ref T data) { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Concurrency", "CA8001", Justification="This does not need to be correct when racing with other threads")]
- [System.Security.SecuritySafeCriticalAttribute]
- protected void WriteEvent(int eventId) { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Concurrency", "CA8001", Justification="This does not need to be correct when racing with other threads")]
- [System.Security.SecuritySafeCriticalAttribute]
- protected void WriteEvent(int eventId, byte[] arg1) { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Concurrency", "CA8001", Justification="This does not need to be correct when racing with other threads")]
- [System.Security.SecuritySafeCriticalAttribute]
- protected void WriteEvent(int eventId, int arg1) { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Concurrency", "CA8001", Justification="This does not need to be correct when racing with other threads")]
- [System.Security.SecuritySafeCriticalAttribute]
- protected void WriteEvent(int eventId, int arg1, int arg2) { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Concurrency", "CA8001", Justification="This does not need to be correct when racing with other threads")]
- [System.Security.SecuritySafeCriticalAttribute]
- protected void WriteEvent(int eventId, int arg1, int arg2, int arg3) { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Concurrency", "CA8001", Justification="This does not need to be correct when racing with other threads")]
- [System.Security.SecuritySafeCriticalAttribute]
- protected void WriteEvent(int eventId, int arg1, string arg2) { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Concurrency", "CA8001", Justification="This does not need to be correct when racing with other threads")]
- [System.Security.SecuritySafeCriticalAttribute]
- protected void WriteEvent(int eventId, long arg1) { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Concurrency", "CA8001", Justification="This does not need to be correct when racing with other threads")]
- [System.Security.SecuritySafeCriticalAttribute]
- protected void WriteEvent(int eventId, long arg1, byte[] arg2) { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Concurrency", "CA8001", Justification="This does not need to be correct when racing with other threads")]
- [System.Security.SecuritySafeCriticalAttribute]
- protected void WriteEvent(int eventId, long arg1, long arg2) { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Concurrency", "CA8001", Justification="This does not need to be correct when racing with other threads")]
- [System.Security.SecuritySafeCriticalAttribute]
- protected void WriteEvent(int eventId, long arg1, long arg2, long arg3) { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Concurrency", "CA8001", Justification="This does not need to be correct when racing with other threads")]
- [System.Security.SecuritySafeCriticalAttribute]
- protected void WriteEvent(int eventId, long arg1, string arg2) { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Concurrency", "CA8001", Justification="This does not need to be correct when racing with other threads")]
- [System.Security.SecuritySafeCriticalAttribute]
- protected void WriteEvent(int eventId, params object[] args) { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Concurrency", "CA8001", Justification="This does not need to be correct when racing with other threads")]
- [System.Security.SecuritySafeCriticalAttribute]
- protected void WriteEvent(int eventId, string arg1) { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Concurrency", "CA8001", Justification="This does not need to be correct when racing with other threads")]
- [System.Security.SecuritySafeCriticalAttribute]
- protected void WriteEvent(int eventId, string arg1, int arg2) { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Concurrency", "CA8001", Justification="This does not need to be correct when racing with other threads")]
- [System.Security.SecuritySafeCriticalAttribute]
- protected void WriteEvent(int eventId, string arg1, int arg2, int arg3) { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Concurrency", "CA8001", Justification="This does not need to be correct when racing with other threads")]
- [System.Security.SecuritySafeCriticalAttribute]
- protected void WriteEvent(int eventId, string arg1, long arg2) { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Concurrency", "CA8001", Justification="This does not need to be correct when racing with other threads")]
- [System.Security.SecuritySafeCriticalAttribute]
- protected void WriteEvent(int eventId, string arg1, string arg2) { }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Concurrency", "CA8001", Justification="This does not need to be correct when racing with other threads")]
- [System.Security.SecuritySafeCriticalAttribute]
- protected void WriteEvent(int eventId, string arg1, string arg2, string arg3) { }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- protected unsafe void WriteEventCore(int eventId, int eventDataCount, System.Diagnostics.Tracing.EventSource.EventData* data) { }
- [System.Security.SecuritySafeCriticalAttribute]
- protected void WriteEventWithRelatedActivityId(int eventId, System.Guid relatedActivityId, params object[] args) { }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- protected unsafe void WriteEventWithRelatedActivityIdCore(int eventId, System.Guid* relatedActivityId, int eventDataCount, System.Diagnostics.Tracing.EventSource.EventData* data) { }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- protected internal partial struct EventData
- {
- public System.IntPtr DataPointer { get { throw null; } set { } }
- public int Size { get { throw null; } set { } }
- }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(4))]
- public sealed partial class EventSourceAttribute : System.Attribute
- {
- public EventSourceAttribute() { }
- public string Guid { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string LocalizationResources { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
- }
- public partial class EventSourceException : System.Exception
- {
- public EventSourceException() { }
- public EventSourceException(string message) { }
- public EventSourceException(string message, System.Exception innerException) { }
- protected EventSourceException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct EventSourceOptions
- {
- public System.Diagnostics.Tracing.EventActivityOptions ActivityOptions { get { throw null; } set { } }
- public System.Diagnostics.Tracing.EventKeywords Keywords { get { throw null; } set { } }
- public System.Diagnostics.Tracing.EventLevel Level { get { throw null; } set { } }
- public System.Diagnostics.Tracing.EventOpcode Opcode { get { throw null; } set { } }
- public System.Diagnostics.Tracing.EventTags Tags { get { throw null; } set { } }
- }
- [System.FlagsAttribute]
- public enum EventSourceSettings
- {
- Default = 0,
- EtwManifestEventFormat = 4,
- EtwSelfDescribingEventFormat = 8,
- ThrowOnEventWriteErrors = 1,
- }
- [System.FlagsAttribute]
- public enum EventTags
- {
- None = 0,
- }
- public enum EventTask
- {
- None = 0,
- }
- public partial class EventWrittenEventArgs : System.EventArgs
- {
- internal EventWrittenEventArgs() { }
- public System.Guid ActivityId { [System.Security.SecurityCriticalAttribute]get { throw null; } }
- public System.Diagnostics.Tracing.EventChannel Channel { get { throw null; } }
- public int EventId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public string EventName { get { throw null; } }
- public System.Diagnostics.Tracing.EventSource EventSource { get { throw null; } }
- public System.Diagnostics.Tracing.EventKeywords Keywords { get { throw null; } }
- public System.Diagnostics.Tracing.EventLevel Level { get { throw null; } }
- public string Message { get { throw null; } }
- public System.Diagnostics.Tracing.EventOpcode Opcode { get { throw null; } }
- public System.Collections.ObjectModel.ReadOnlyCollection<object> Payload { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public System.Collections.ObjectModel.ReadOnlyCollection<string> PayloadNames { get { throw null; } }
- public System.Guid RelatedActivityId { [System.Runtime.CompilerServices.CompilerGeneratedAttribute, System.Security.SecurityCriticalAttribute]get { throw null; } }
- public System.Diagnostics.Tracing.EventTags Tags { get { throw null; } }
- public System.Diagnostics.Tracing.EventTask Task { get { throw null; } }
- public byte Version { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(64))]
- public sealed partial class NonEventAttribute : System.Attribute
- {
- public NonEventAttribute() { }
- }
-}
-namespace System.Globalization
-{
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class Calendar : System.ICloneable
- {
- public const int CurrentEra = 0;
- protected Calendar() { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
- protected virtual int DaysInYearBeforeMinSupportedYear { get { throw null; } }
- public abstract int[] Eras { get; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public bool IsReadOnly { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual System.DateTime MaxSupportedDateTime { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual System.DateTime MinSupportedDateTime { get { throw null; } }
- public virtual int TwoDigitYearMax { get { throw null; } set { } }
- public virtual System.DateTime AddDays(System.DateTime time, int days) { throw null; }
- public virtual System.DateTime AddHours(System.DateTime time, int hours) { throw null; }
- public virtual System.DateTime AddMilliseconds(System.DateTime time, double milliseconds) { throw null; }
- public virtual System.DateTime AddMinutes(System.DateTime time, int minutes) { throw null; }
- public abstract System.DateTime AddMonths(System.DateTime time, int months);
- public virtual System.DateTime AddSeconds(System.DateTime time, int seconds) { throw null; }
- public virtual System.DateTime AddWeeks(System.DateTime time, int weeks) { throw null; }
- public abstract System.DateTime AddYears(System.DateTime time, int years);
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual object Clone() { throw null; }
- public abstract int GetDayOfMonth(System.DateTime time);
- public abstract System.DayOfWeek GetDayOfWeek(System.DateTime time);
- public abstract int GetDayOfYear(System.DateTime time);
- public virtual int GetDaysInMonth(int year, int month) { throw null; }
- public abstract int GetDaysInMonth(int year, int month, int era);
- public virtual int GetDaysInYear(int year) { throw null; }
- public abstract int GetDaysInYear(int year, int era);
- public abstract int GetEra(System.DateTime time);
- public virtual int GetHour(System.DateTime time) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual int GetLeapMonth(int year) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual int GetLeapMonth(int year, int era) { throw null; }
- public virtual double GetMilliseconds(System.DateTime time) { throw null; }
- public virtual int GetMinute(System.DateTime time) { throw null; }
- public abstract int GetMonth(System.DateTime time);
- public virtual int GetMonthsInYear(int year) { throw null; }
- public abstract int GetMonthsInYear(int year, int era);
- public virtual int GetSecond(System.DateTime time) { throw null; }
- public virtual int GetWeekOfYear(System.DateTime time, System.Globalization.CalendarWeekRule rule, System.DayOfWeek firstDayOfWeek) { throw null; }
- public abstract int GetYear(System.DateTime time);
- public virtual bool IsLeapDay(int year, int month, int day) { throw null; }
- public abstract bool IsLeapDay(int year, int month, int day, int era);
- public virtual bool IsLeapMonth(int year, int month) { throw null; }
- public abstract bool IsLeapMonth(int year, int month, int era);
- public virtual bool IsLeapYear(int year) { throw null; }
- public abstract bool IsLeapYear(int year, int era);
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public static System.Globalization.Calendar ReadOnly(System.Globalization.Calendar calendar) { throw null; }
- public virtual System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond) { throw null; }
- public abstract System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era);
- public virtual int ToFourDigitYear(int year) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum CalendarAlgorithmType
- {
- LunarCalendar = 2,
- LunisolarCalendar = 3,
- SolarCalendar = 1,
- Unknown = 0,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum CalendarWeekRule
- {
- FirstDay = 0,
- FirstFourDayWeek = 2,
- FirstFullWeek = 1,
- }
- public static partial class CharUnicodeInfo
- {
- public static int GetDecimalDigitValue(char ch) { throw null; }
- public static int GetDecimalDigitValue(string s, int index) { throw null; }
- public static int GetDigitValue(char ch) { throw null; }
- public static int GetDigitValue(string s, int index) { throw null; }
- public static double GetNumericValue(char ch) { throw null; }
- public static double GetNumericValue(string s, int index) { throw null; }
- public static System.Globalization.UnicodeCategory GetUnicodeCategory(char ch) { throw null; }
- public static System.Globalization.UnicodeCategory GetUnicodeCategory(string s, int index) { throw null; }
- }
- public partial class ChineseLunisolarCalendar : System.Globalization.EastAsianLunisolarCalendar
- {
- public const int ChineseEra = 1;
- public ChineseLunisolarCalendar() { }
- protected override int DaysInYearBeforeMinSupportedYear { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override int[] Eras { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.DateTime MaxSupportedDateTime { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.DateTime MinSupportedDateTime { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override int GetEra(System.DateTime time) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class CompareInfo : System.Runtime.Serialization.IDeserializationCallback
- {
- public int LCID { get { throw null; } }
- internal CompareInfo() { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual string Name { get { throw null; } }
- public virtual int Compare(string string1, int offset1, int length1, string string2, int offset2, int length2) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual int Compare(string string1, int offset1, int length1, string string2, int offset2, int length2, System.Globalization.CompareOptions options) { throw null; }
- public virtual int Compare(string string1, int offset1, string string2, int offset2) { throw null; }
- public virtual int Compare(string string1, int offset1, string string2, int offset2, System.Globalization.CompareOptions options) { throw null; }
- public virtual int Compare(string string1, string string2) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual int Compare(string string1, string string2, System.Globalization.CompareOptions options) { throw null; }
- public override bool Equals(object value) { throw null; }
- public static System.Globalization.CompareInfo GetCompareInfo(int culture) { throw null; }
- public static System.Globalization.CompareInfo GetCompareInfo(int culture, System.Reflection.Assembly assembly) { throw null; }
- public static System.Globalization.CompareInfo GetCompareInfo(string name) { throw null; }
- public static System.Globalization.CompareInfo GetCompareInfo(string name, System.Reflection.Assembly assembly) { throw null; }
- public override int GetHashCode() { throw null; }
- public virtual int GetHashCode(string source, System.Globalization.CompareOptions options) { throw null; }
- public virtual System.Globalization.SortKey GetSortKey(string source) { throw null; }
- public virtual System.Globalization.SortKey GetSortKey(string source, System.Globalization.CompareOptions options) { throw null; }
- public virtual int IndexOf(string source, char value) { throw null; }
- public virtual int IndexOf(string source, char value, System.Globalization.CompareOptions options) { throw null; }
- public virtual int IndexOf(string source, char value, int startIndex) { throw null; }
- public virtual int IndexOf(string source, char value, int startIndex, System.Globalization.CompareOptions options) { throw null; }
- public virtual int IndexOf(string source, char value, int startIndex, int count) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual int IndexOf(string source, char value, int startIndex, int count, System.Globalization.CompareOptions options) { throw null; }
- public virtual int IndexOf(string source, string value) { throw null; }
- public virtual int IndexOf(string source, string value, System.Globalization.CompareOptions options) { throw null; }
- public virtual int IndexOf(string source, string value, int startIndex) { throw null; }
- public virtual int IndexOf(string source, string value, int startIndex, System.Globalization.CompareOptions options) { throw null; }
- public virtual int IndexOf(string source, string value, int startIndex, int count) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual int IndexOf(string source, string value, int startIndex, int count, System.Globalization.CompareOptions options) { throw null; }
- public virtual bool IsPrefix(string source, string prefix) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual bool IsPrefix(string source, string prefix, System.Globalization.CompareOptions options) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public static bool IsSortable(char ch) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static bool IsSortable(string text) { throw null; }
- public virtual bool IsSuffix(string source, string suffix) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual bool IsSuffix(string source, string suffix, System.Globalization.CompareOptions options) { throw null; }
- public virtual int LastIndexOf(string source, char value) { throw null; }
- public virtual int LastIndexOf(string source, char value, System.Globalization.CompareOptions options) { throw null; }
- public virtual int LastIndexOf(string source, char value, int startIndex) { throw null; }
- public virtual int LastIndexOf(string source, char value, int startIndex, System.Globalization.CompareOptions options) { throw null; }
- public virtual int LastIndexOf(string source, char value, int startIndex, int count) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual int LastIndexOf(string source, char value, int startIndex, int count, System.Globalization.CompareOptions options) { throw null; }
- public virtual int LastIndexOf(string source, string value) { throw null; }
- public virtual int LastIndexOf(string source, string value, System.Globalization.CompareOptions options) { throw null; }
- public virtual int LastIndexOf(string source, string value, int startIndex) { throw null; }
- public virtual int LastIndexOf(string source, string value, int startIndex, System.Globalization.CompareOptions options) { throw null; }
- public virtual int LastIndexOf(string source, string value, int startIndex, int count) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual int LastIndexOf(string source, string value, int startIndex, int count, System.Globalization.CompareOptions options) { throw null; }
- void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object sender) { }
- public override string ToString() { throw null; }
- public SortVersion Version { get { throw null; } }
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum CompareOptions
- {
- IgnoreCase = 1,
- IgnoreKanaType = 8,
- IgnoreNonSpace = 2,
- IgnoreSymbols = 4,
- IgnoreWidth = 16,
- None = 0,
- Ordinal = 1073741824,
- OrdinalIgnoreCase = 268435456,
- StringSort = 536870912,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class CultureInfo : System.ICloneable, System.IFormatProvider
- {
- public CultureInfo(int culture) { throw null; }
- public CultureInfo(int culture, bool useUserOverride) { throw null; }
- public CultureInfo(string name) { }
- public CultureInfo(string name, bool useUserOverride) { throw null; }
- public virtual System.Globalization.Calendar Calendar { get { throw null; } }
- public virtual System.Globalization.CompareInfo CompareInfo { get { throw null; } }
- public System.Globalization.CultureTypes CultureTypes { get { throw null; } }
- public static System.Globalization.CultureInfo CurrentCulture { get { throw null; } set { } }
- public static System.Globalization.CultureInfo CurrentUICulture { get { throw null; } set { } }
- public virtual System.Globalization.DateTimeFormatInfo DateTimeFormat { get { throw null; } set { } }
- public static System.Globalization.CultureInfo DefaultThreadCurrentCulture { get { throw null; } [System.Security.SecuritySafeCriticalAttribute]set { } }
- public static System.Globalization.CultureInfo DefaultThreadCurrentUICulture { get { throw null; } [System.Security.SecuritySafeCriticalAttribute]set { } }
- public virtual string DisplayName { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public virtual string EnglishName { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public string IetfLanguageTag { get { throw null; } }
- public static System.Globalization.CultureInfo InstalledUICulture { get { throw null; } }
- public static System.Globalization.CultureInfo InvariantCulture { get { throw null; } }
- public virtual bool IsNeutralCulture { get { throw null; } }
- public bool IsReadOnly { get { throw null; } }
- public virtual int KeyboardLanguageId { get { throw null; } }
- public virtual int LCID { get { throw null; } }
- public virtual string Name { get { throw null; } }
- public virtual string NativeName { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public virtual System.Globalization.NumberFormatInfo NumberFormat { get { throw null; } set { } }
- public virtual System.Globalization.Calendar[] OptionalCalendars { get { throw null; } }
- public virtual System.Globalization.CultureInfo Parent { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public virtual System.Globalization.TextInfo TextInfo { get { throw null; } }
- public virtual string ThreeLetterISOLanguageName { get { throw null; } }
- public virtual string ThreeLetterWindowsLanguageName { get { throw null; } }
- public virtual string TwoLetterISOLanguageName { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public bool UseUserOverride { get { throw null; } }
- public void ClearCachedData() { throw null; }
- public virtual object Clone() { throw null; }
- public static System.Globalization.CultureInfo CreateSpecificCulture(string name) { throw null; }
- public override bool Equals(object value) { throw null; }
- public System.Globalization.CultureInfo GetConsoleFallbackUICulture() { throw null; }
- public static System.Globalization.CultureInfo GetCultureInfo(int culture) { throw null; }
- public static System.Globalization.CultureInfo GetCultureInfo(string name) { throw null; }
- public static System.Globalization.CultureInfo GetCultureInfo(string name, string altName) { throw null; }
- public static System.Globalization.CultureInfo GetCultureInfoByIetfLanguageTag(string name) { throw null; }
- public static System.Globalization.CultureInfo[] GetCultures(System.Globalization.CultureTypes types) { throw null; }
- public virtual object GetFormat(System.Type formatType) { throw null; }
- public override int GetHashCode() { throw null; }
- public static System.Globalization.CultureInfo ReadOnly(System.Globalization.CultureInfo ci) { throw null; }
- public override string ToString() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class CultureNotFoundException : System.ArgumentException, System.Runtime.Serialization.ISerializable
- {
- public CultureNotFoundException() { }
- public CultureNotFoundException(string message) { }
- public CultureNotFoundException(string message, System.Exception innerException) { }
- public CultureNotFoundException(string message, int invalidCultureId, System.Exception innerException) { }
- public CultureNotFoundException(string paramName, int invalidCultureId, string message) { }
- public CultureNotFoundException(string paramName, string message) { }
- public CultureNotFoundException(string message, string invalidCultureName, System.Exception innerException) { }
- public CultureNotFoundException(string paramName, string invalidCultureName, string message) { }
- protected CultureNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- public virtual System.Nullable<int> InvalidCultureId { get { throw null; } }
- public virtual string InvalidCultureName { get { throw null; } }
- public override string Message { get { throw null; } }
- [System.Security.SecurityCriticalAttribute]
- public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class DateTimeFormatInfo : System.ICloneable, System.IFormatProvider
- {
- public DateTimeFormatInfo() { }
- public string[] AbbreviatedDayNames { get { throw null; } set { } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public string[] AbbreviatedMonthGenitiveNames { get { throw null; } set { } }
- public string[] AbbreviatedMonthNames { get { throw null; } set { } }
- public string AMDesignator { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } set { } }
- public System.Globalization.Calendar Calendar { get { throw null; } set { } }
- public System.Globalization.CalendarWeekRule CalendarWeekRule { get { throw null; } set { } }
- public static System.Globalization.DateTimeFormatInfo CurrentInfo { get { throw null; } }
- public string DateSeparator { get { throw null; } set { throw null; } }
- public string[] DayNames { get { throw null; } set { } }
- public System.DayOfWeek FirstDayOfWeek { get { throw null; } set { } }
- public string FullDateTimePattern { get { throw null; } set { } }
- public static System.Globalization.DateTimeFormatInfo InvariantInfo { get { throw null; } }
- public bool IsReadOnly { get { throw null; } }
- public string LongDatePattern { get { throw null; } set { } }
- public string LongTimePattern { get { throw null; } set { } }
- public string MonthDayPattern { get { throw null; } set { } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public string[] MonthGenitiveNames { get { throw null; } set { } }
- public string[] MonthNames { get { throw null; } set { } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public string NativeCalendarName { get { throw null; } }
- public string PMDesignator { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } set { } }
- public string RFC1123Pattern { get { throw null; } }
- public string ShortDatePattern { get { throw null; } set { } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public string[] ShortestDayNames { get { throw null; } set { } }
- public string ShortTimePattern { get { throw null; } set { } }
- public string SortableDateTimePattern { get { throw null; } }
- public string TimeSeparator { get { throw null; } set { throw null; } }
- public string UniversalSortableDateTimePattern { get { throw null; } }
- public string YearMonthPattern { get { throw null; } set { } }
- public object Clone() { throw null; }
- public string GetAbbreviatedDayName(System.DayOfWeek dayofweek) { throw null; }
- public string GetAbbreviatedEraName(int era) { throw null; }
- public string GetAbbreviatedMonthName(int month) { throw null; }
- public string[] GetAllDateTimePatterns() { throw null; }
- public string[] GetAllDateTimePatterns(char format) { throw null; }
- public string GetDayName(System.DayOfWeek dayofweek) { throw null; }
- public int GetEra(string eraName) { throw null; }
- public string GetEraName(int era) { throw null; }
- public object GetFormat(System.Type formatType) { throw null; }
- public static System.Globalization.DateTimeFormatInfo GetInstance(System.IFormatProvider provider) { throw null; }
- public string GetMonthName(int month) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public string GetShortestDayName(System.DayOfWeek dayOfWeek) { throw null; }
- public static System.Globalization.DateTimeFormatInfo ReadOnly(System.Globalization.DateTimeFormatInfo dtfi) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public void SetAllDateTimePatterns(string[] patterns, char format) { throw null; }
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum DateTimeStyles
- {
- AdjustToUniversal = 16,
- AllowInnerWhite = 4,
- AllowLeadingWhite = 1,
- AllowTrailingWhite = 2,
- AllowWhiteSpaces = 7,
- AssumeLocal = 32,
- AssumeUniversal = 64,
- NoCurrentDateDefault = 8,
- None = 0,
- RoundtripKind = 128,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class DaylightTime
- {
- public DaylightTime(System.DateTime start, System.DateTime end, System.TimeSpan delta) { throw null; }
- public System.TimeSpan Delta { get { throw null; } }
- public System.DateTime End { get { throw null; } }
- public System.DateTime Start { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum DigitShapes
- {
- Context = 0,
- NativeNational = 2,
- None = 1,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class EastAsianLunisolarCalendar : System.Globalization.Calendar
- {
- internal EastAsianLunisolarCalendar() { }
-#if FEATURE_COREFX_GLOBALIZATION
- public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
-#endif
- public override int TwoDigitYearMax { get { throw null; } set { } }
- public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
- public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
- public int GetCelestialStem(int sexagenaryYear) { throw null; }
- public override int GetDayOfMonth(System.DateTime time) { throw null; }
- public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
- public override int GetDayOfYear(System.DateTime time) { throw null; }
- public override int GetDaysInMonth(int year, int month, int era) { throw null; }
- public override int GetDaysInYear(int year, int era) { throw null; }
- public override int GetLeapMonth(int year, int era) { throw null; }
- public override int GetMonth(System.DateTime time) { throw null; }
- public override int GetMonthsInYear(int year, int era) { throw null; }
- public virtual int GetSexagenaryYear(System.DateTime time) { throw null; }
- public int GetTerrestrialBranch(int sexagenaryYear) { throw null; }
- public override int GetYear(System.DateTime time) { throw null; }
- public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
- public override bool IsLeapMonth(int year, int month, int era) { throw null; }
- public override bool IsLeapYear(int year, int era) { throw null; }
- public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
- public override int ToFourDigitYear(int year) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class GregorianCalendar : System.Globalization.Calendar
- {
- public const int ADEra = 1;
- public GregorianCalendar() { }
- public GregorianCalendar(System.Globalization.GregorianCalendarTypes type) { }
-#if FEATURE_COREFX_GLOBALIZATION
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
-#endif
- public virtual System.Globalization.GregorianCalendarTypes CalendarType { get { throw null; } set { } }
- public override int[] Eras { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.DateTime MaxSupportedDateTime { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.DateTime MinSupportedDateTime { get { throw null; } }
- public override int TwoDigitYearMax { get { throw null; } set { } }
- public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
- public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
- public override int GetDayOfMonth(System.DateTime time) { throw null; }
- public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
- public override int GetDayOfYear(System.DateTime time) { throw null; }
- public override int GetDaysInMonth(int year, int month, int era) { throw null; }
- public override int GetDaysInYear(int year, int era) { throw null; }
- public override int GetEra(System.DateTime time) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override int GetLeapMonth(int year, int era) { throw null; }
- public override int GetMonth(System.DateTime time) { throw null; }
- public override int GetMonthsInYear(int year, int era) { throw null; }
- public override int GetYear(System.DateTime time) { throw null; }
- public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
- public override bool IsLeapMonth(int year, int month, int era) { throw null; }
- public override bool IsLeapYear(int year, int era) { throw null; }
- public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
- public override int ToFourDigitYear(int year) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum GregorianCalendarTypes
- {
- Arabic = 10,
- Localized = 1,
- MiddleEastFrench = 9,
- TransliteratedEnglish = 11,
- TransliteratedFrench = 12,
- USEnglish = 2,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class HebrewCalendar : System.Globalization.Calendar
- {
- public static readonly int HebrewEra;
- public HebrewCalendar() { }
-#if FEATURE_COREFX_GLOBALIZATION
- public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
-#endif
- public override int[] Eras { get { throw null; } }
- public override System.DateTime MaxSupportedDateTime { get { throw null; } }
- public override System.DateTime MinSupportedDateTime { get { throw null; } }
- public override int TwoDigitYearMax { get { throw null; } set { } }
- public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
- public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
- public override int GetDayOfMonth(System.DateTime time) { throw null; }
- public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
- public override int GetDayOfYear(System.DateTime time) { throw null; }
- public override int GetDaysInMonth(int year, int month, int era) { throw null; }
- public override int GetDaysInYear(int year, int era) { throw null; }
- public override int GetEra(System.DateTime time) { throw null; }
- public override int GetLeapMonth(int year, int era) { throw null; }
- public override int GetMonth(System.DateTime time) { throw null; }
- public override int GetMonthsInYear(int year, int era) { throw null; }
- public override int GetYear(System.DateTime time) { throw null; }
- public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
- public override bool IsLeapMonth(int year, int month, int era) { throw null; }
- public override bool IsLeapYear(int year, int era) { throw null; }
- public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
- public override int ToFourDigitYear(int year) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class HijriCalendar : System.Globalization.Calendar
- {
- public static readonly int HijriEra;
- public HijriCalendar() { }
-#if FEATURE_COREFX_GLOBALIZATION
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
-#endif
- protected override int DaysInYearBeforeMinSupportedYear { get { throw null; } }
- public override int[] Eras { get { throw null; } }
- public int HijriAdjustment { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } set { } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.DateTime MaxSupportedDateTime { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.DateTime MinSupportedDateTime { get { throw null; } }
- public override int TwoDigitYearMax { get { throw null; } set { } }
- public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
- public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
- public override int GetDayOfMonth(System.DateTime time) { throw null; }
- public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
- public override int GetDayOfYear(System.DateTime time) { throw null; }
- public override int GetDaysInMonth(int year, int month, int era) { throw null; }
- public override int GetDaysInYear(int year, int era) { throw null; }
- public override int GetEra(System.DateTime time) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override int GetLeapMonth(int year, int era) { throw null; }
- public override int GetMonth(System.DateTime time) { throw null; }
- public override int GetMonthsInYear(int year, int era) { throw null; }
- public override int GetYear(System.DateTime time) { throw null; }
- public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
- public override bool IsLeapMonth(int year, int month, int era) { throw null; }
- public override bool IsLeapYear(int year, int era) { throw null; }
- public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
- public override int ToFourDigitYear(int year) { throw null; }
- }
- public sealed partial class IdnMapping
- {
- public IdnMapping() { }
- public bool AllowUnassigned { get { throw null; } set { throw null; } }
- public bool UseStd3AsciiRules { get { throw null; } set { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public string GetAscii(string unicode) { throw null; }
- public string GetAscii(string unicode, int index) { throw null; }
- public string GetAscii(string unicode, int index, int count) { throw null; }
- public override int GetHashCode() { throw null; }
- public string GetUnicode(string ascii) { throw null; }
- public string GetUnicode(string ascii, int index) { throw null; }
- public string GetUnicode(string ascii, int index, int count) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class JapaneseCalendar : System.Globalization.Calendar
- {
- public JapaneseCalendar() { }
-#if FEATURE_COREFX_GLOBALIZATION
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
-#endif
- public override int[] Eras { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.DateTime MaxSupportedDateTime { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.DateTime MinSupportedDateTime { get { throw null; } }
- public override int TwoDigitYearMax { get { throw null; } set { } }
- public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
- public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
- public override int GetDayOfMonth(System.DateTime time) { throw null; }
- public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
- public override int GetDayOfYear(System.DateTime time) { throw null; }
- public override int GetDaysInMonth(int year, int month, int era) { throw null; }
- public override int GetDaysInYear(int year, int era) { throw null; }
- public override int GetEra(System.DateTime time) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override int GetLeapMonth(int year, int era) { throw null; }
- public override int GetMonth(System.DateTime time) { throw null; }
- public override int GetMonthsInYear(int year, int era) { throw null; }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Contracts", "CC1055")]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override int GetWeekOfYear(System.DateTime time, System.Globalization.CalendarWeekRule rule, System.DayOfWeek firstDayOfWeek) { throw null; }
- public override int GetYear(System.DateTime time) { throw null; }
- public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
- public override bool IsLeapMonth(int year, int month, int era) { throw null; }
- public override bool IsLeapYear(int year, int era) { throw null; }
- public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
- public override int ToFourDigitYear(int year) { throw null; }
- }
- public partial class JapaneseLunisolarCalendar : System.Globalization.EastAsianLunisolarCalendar
- {
- public const int JapaneseEra = 1;
- public JapaneseLunisolarCalendar() { }
- protected override int DaysInYearBeforeMinSupportedYear { get { throw null; } }
- public override int[] Eras { get { throw null; } }
- public override System.DateTime MaxSupportedDateTime { get { throw null; } }
- public override System.DateTime MinSupportedDateTime { get { throw null; } }
- public override int GetEra(System.DateTime time) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class JulianCalendar : System.Globalization.Calendar
- {
- public static readonly int JulianEra;
- public JulianCalendar() { }
-#if FEATURE_COREFX_GLOBALIZATION
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
-#endif
- public override int[] Eras { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.DateTime MaxSupportedDateTime { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.DateTime MinSupportedDateTime { get { throw null; } }
- public override int TwoDigitYearMax { get { throw null; } set { } }
- public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
- public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
- public override int GetDayOfMonth(System.DateTime time) { throw null; }
- public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
- public override int GetDayOfYear(System.DateTime time) { throw null; }
- public override int GetDaysInMonth(int year, int month, int era) { throw null; }
- public override int GetDaysInYear(int year, int era) { throw null; }
- public override int GetEra(System.DateTime time) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override int GetLeapMonth(int year, int era) { throw null; }
- public override int GetMonth(System.DateTime time) { throw null; }
- public override int GetMonthsInYear(int year, int era) { throw null; }
- public override int GetYear(System.DateTime time) { throw null; }
- public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
- public override bool IsLeapMonth(int year, int month, int era) { throw null; }
- public override bool IsLeapYear(int year, int era) { throw null; }
- public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
- public override int ToFourDigitYear(int year) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class KoreanCalendar : System.Globalization.Calendar
- {
- public const int KoreanEra = 1;
- public KoreanCalendar() { }
-#if FEATURE_COREFX_GLOBALIZATION
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
-#endif
- public override int[] Eras { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.DateTime MaxSupportedDateTime { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.DateTime MinSupportedDateTime { get { throw null; } }
- public override int TwoDigitYearMax { get { throw null; } set { } }
- public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
- public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
- public override int GetDayOfMonth(System.DateTime time) { throw null; }
- public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
- public override int GetDayOfYear(System.DateTime time) { throw null; }
- public override int GetDaysInMonth(int year, int month, int era) { throw null; }
- public override int GetDaysInYear(int year, int era) { throw null; }
- public override int GetEra(System.DateTime time) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override int GetLeapMonth(int year, int era) { throw null; }
- public override int GetMonth(System.DateTime time) { throw null; }
- public override int GetMonthsInYear(int year, int era) { throw null; }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Contracts", "CC1055")]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override int GetWeekOfYear(System.DateTime time, System.Globalization.CalendarWeekRule rule, System.DayOfWeek firstDayOfWeek) { throw null; }
- public override int GetYear(System.DateTime time) { throw null; }
- public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
- public override bool IsLeapMonth(int year, int month, int era) { throw null; }
- public override bool IsLeapYear(int year, int era) { throw null; }
- public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
- public override int ToFourDigitYear(int year) { throw null; }
- }
- public partial class KoreanLunisolarCalendar : System.Globalization.EastAsianLunisolarCalendar
- {
- public const int GregorianEra = 1;
- public KoreanLunisolarCalendar() { }
- protected override int DaysInYearBeforeMinSupportedYear { get { throw null; } }
- public override int[] Eras { get { throw null; } }
- public override System.DateTime MaxSupportedDateTime { get { throw null; } }
- public override System.DateTime MinSupportedDateTime { get { throw null; } }
- public override int GetEra(System.DateTime time) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class NumberFormatInfo : System.ICloneable, System.IFormatProvider
- {
- public NumberFormatInfo() { }
- public int CurrencyDecimalDigits { get { throw null; } set { } }
- public string CurrencyDecimalSeparator { get { throw null; } set { } }
- public string CurrencyGroupSeparator { get { throw null; } set { } }
- public int[] CurrencyGroupSizes { get { throw null; } set { } }
- public int CurrencyNegativePattern { get { throw null; } set { } }
- public int CurrencyPositivePattern { get { throw null; } set { } }
- public string CurrencySymbol { get { throw null; } set { } }
- public static System.Globalization.NumberFormatInfo CurrentInfo { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public System.Globalization.DigitShapes DigitSubstitution { get { throw null; } set { throw null; } }
- public static System.Globalization.NumberFormatInfo InvariantInfo { get { throw null; } }
- public bool IsReadOnly { get { throw null; } }
- public string NaNSymbol { get { throw null; } set { } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public string[] NativeDigits { get { throw null; } set { throw null; } }
- public string NegativeInfinitySymbol { get { throw null; } set { } }
- public string NegativeSign { get { throw null; } set { } }
- public int NumberDecimalDigits { get { throw null; } set { } }
- public string NumberDecimalSeparator { get { throw null; } set { } }
- public string NumberGroupSeparator { get { throw null; } set { } }
- public int[] NumberGroupSizes { get { throw null; } set { } }
- public int NumberNegativePattern { get { throw null; } set { } }
- public int PercentDecimalDigits { get { throw null; } set { } }
- public string PercentDecimalSeparator { get { throw null; } set { } }
- public string PercentGroupSeparator { get { throw null; } set { } }
- public int[] PercentGroupSizes { get { throw null; } set { } }
- public int PercentNegativePattern { get { throw null; } set { } }
- public int PercentPositivePattern { get { throw null; } set { } }
- public string PercentSymbol { get { throw null; } set { } }
- public string PerMilleSymbol { get { throw null; } set { } }
- public string PositiveInfinitySymbol { get { throw null; } set { } }
- public string PositiveSign { get { throw null; } set { } }
- public object Clone() { throw null; }
- public object GetFormat(System.Type formatType) { throw null; }
- public static System.Globalization.NumberFormatInfo GetInstance(System.IFormatProvider formatProvider) { throw null; }
- public static System.Globalization.NumberFormatInfo ReadOnly(System.Globalization.NumberFormatInfo nfi) { throw null; }
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum NumberStyles
- {
- AllowCurrencySymbol = 256,
- AllowDecimalPoint = 32,
- AllowExponent = 128,
- AllowHexSpecifier = 512,
- AllowLeadingSign = 4,
- AllowLeadingWhite = 1,
- AllowParentheses = 16,
- AllowThousands = 64,
- AllowTrailingSign = 8,
- AllowTrailingWhite = 2,
- Any = 511,
- Currency = 383,
- Float = 167,
- HexNumber = 515,
- Integer = 7,
- None = 0,
- Number = 111,
- }
- public partial class PersianCalendar : System.Globalization.Calendar
- {
- public static readonly int PersianEra;
- public PersianCalendar() { }
-#if FEATURE_COREFX_GLOBALIZATION
- public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
-#endif
- public override int[] Eras { get { throw null; } }
- public override System.DateTime MaxSupportedDateTime { get { throw null; } }
- public override System.DateTime MinSupportedDateTime { get { throw null; } }
- public override int TwoDigitYearMax { get { throw null; } set { } }
- public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
- public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
- public override int GetDayOfMonth(System.DateTime time) { throw null; }
- public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
- public override int GetDayOfYear(System.DateTime time) { throw null; }
- public override int GetDaysInMonth(int year, int month, int era) { throw null; }
- public override int GetDaysInYear(int year, int era) { throw null; }
- public override int GetEra(System.DateTime time) { throw null; }
- public override int GetLeapMonth(int year, int era) { throw null; }
- public override int GetMonth(System.DateTime time) { throw null; }
- public override int GetMonthsInYear(int year, int era) { throw null; }
- public override int GetYear(System.DateTime time) { throw null; }
- public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
- public override bool IsLeapMonth(int year, int month, int era) { throw null; }
- public override bool IsLeapYear(int year, int era) { throw null; }
- public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
- public override int ToFourDigitYear(int year) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class RegionInfo
- {
- public RegionInfo(int culture) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public RegionInfo(string name) { }
- public virtual string CurrencySymbol { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual string CurrencyEnglishName { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual string CurrencyNativeName { get { throw null; } }
- public static System.Globalization.RegionInfo CurrentRegion { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public virtual string DisplayName { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public virtual string EnglishName { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual int GeoId { get { throw null; } }
- public virtual bool IsMetric { get { throw null; } }
- public virtual string ISOCurrencySymbol { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public virtual string Name { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual string NativeName { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public virtual string ThreeLetterISORegionName { get { throw null; } }
- public virtual string ThreeLetterWindowsRegionName { get { throw null; } }
- public virtual string TwoLetterISORegionName { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public override bool Equals(object value) { throw null; }
- public override int GetHashCode() { throw null; }
- public override string ToString() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class SortKey
- {
- internal SortKey() { throw null; }
- public virtual byte[] KeyData { get { throw null; } }
- public virtual string OriginalString { get { throw null; } }
- public static int Compare(System.Globalization.SortKey sortkey1, System.Globalization.SortKey sortkey2) { throw null; }
- public override bool Equals(object value) { throw null; }
- public override int GetHashCode() { throw null; }
- public override string ToString() { throw null; }
- }
- public sealed partial class SortVersion : System.IEquatable<System.Globalization.SortVersion>
- {
- public SortVersion(int fullVersion, System.Guid sortId) { throw null; }
- public int FullVersion { get { throw null; } }
- public System.Guid SortId { get { throw null; } }
- public bool Equals(System.Globalization.SortVersion other) { throw null; }
- public override bool Equals(object obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public static bool operator ==(System.Globalization.SortVersion left, System.Globalization.SortVersion right) { throw null; }
- public static bool operator !=(System.Globalization.SortVersion left, System.Globalization.SortVersion right) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class StringInfo
- {
- public StringInfo() { }
- public StringInfo(string value) { }
- public int LengthInTextElements { get { throw null; } }
- public string String { get { throw null; } set { } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override bool Equals(object value) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override int GetHashCode() { throw null; }
- public static string GetNextTextElement(string str) { throw null; }
- public static string GetNextTextElement(string str, int index) { throw null; }
- public static System.Globalization.TextElementEnumerator GetTextElementEnumerator(string str) { throw null; }
- public static System.Globalization.TextElementEnumerator GetTextElementEnumerator(string str, int index) { throw null; }
- public static int[] ParseCombiningCharacters(string str) { throw null; }
- public string SubstringByTextElements(int startingTextElement) { throw null; }
- public string SubstringByTextElements(int startingTextElement, int lengthInTextElements) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class TaiwanCalendar : System.Globalization.Calendar
- {
- public TaiwanCalendar() { }
-#if FEATURE_COREFX_GLOBALIZATION
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
-#endif
- public override int[] Eras { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.DateTime MaxSupportedDateTime { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.DateTime MinSupportedDateTime { get { throw null; } }
- public override int TwoDigitYearMax { get { throw null; } set { } }
- public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
- public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
- public override int GetDayOfMonth(System.DateTime time) { throw null; }
- public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
- public override int GetDayOfYear(System.DateTime time) { throw null; }
- public override int GetDaysInMonth(int year, int month, int era) { throw null; }
- public override int GetDaysInYear(int year, int era) { throw null; }
- public override int GetEra(System.DateTime time) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override int GetLeapMonth(int year, int era) { throw null; }
- public override int GetMonth(System.DateTime time) { throw null; }
- public override int GetMonthsInYear(int year, int era) { throw null; }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Contracts", "CC1055")]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override int GetWeekOfYear(System.DateTime time, System.Globalization.CalendarWeekRule rule, System.DayOfWeek firstDayOfWeek) { throw null; }
- public override int GetYear(System.DateTime time) { throw null; }
- public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
- public override bool IsLeapMonth(int year, int month, int era) { throw null; }
- public override bool IsLeapYear(int year, int era) { throw null; }
- public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
- public override int ToFourDigitYear(int year) { throw null; }
- }
- public partial class TaiwanLunisolarCalendar : System.Globalization.EastAsianLunisolarCalendar
- {
- public TaiwanLunisolarCalendar() { }
- protected override int DaysInYearBeforeMinSupportedYear { get { throw null; } }
- public override int[] Eras { get { throw null; } }
- public override System.DateTime MaxSupportedDateTime { get { throw null; } }
- public override System.DateTime MinSupportedDateTime { get { throw null; } }
- public override int GetEra(System.DateTime time) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class TextElementEnumerator : System.Collections.IEnumerator
- {
- internal TextElementEnumerator() { }
- public object Current { get { throw null; } }
- public int ElementIndex { get { throw null; } }
- public string GetTextElement() { throw null; }
- public bool MoveNext() { throw null; }
- public void Reset() { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class TextInfo : System.ICloneable, System.Runtime.Serialization.IDeserializationCallback
- {
- internal TextInfo() { }
- public virtual int ANSICodePage { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public string CultureName { get { throw null; } }
- public virtual int EBCDICCodePage { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public bool IsReadOnly { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public bool IsRightToLeft { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public int LCID { get { throw null; } }
- public virtual string ListSeparator { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } [System.Runtime.InteropServices.ComVisibleAttribute(false)]set { } }
- public virtual int MacCodePage { get { throw null; } }
- public virtual int OEMCodePage { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual object Clone() { throw null; }
- public override bool Equals(object obj) { throw null; }
- public override int GetHashCode() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public static System.Globalization.TextInfo ReadOnly(System.Globalization.TextInfo textInfo) { throw null; }
- void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object sender) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual char ToLower(char c) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual string ToLower(string str) { throw null; }
- public override string ToString() { throw null; }
- public string ToTitleCase(string str) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual char ToUpper(char c) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual string ToUpper(string str) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class ThaiBuddhistCalendar : System.Globalization.Calendar
- {
- public const int ThaiBuddhistEra = 1;
- public ThaiBuddhistCalendar() { }
-#if FEATURE_COREFX_GLOBALIZATION
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
-#endif
- public override int[] Eras { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.DateTime MaxSupportedDateTime { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.DateTime MinSupportedDateTime { get { throw null; } }
- public override int TwoDigitYearMax { get { throw null; } set { } }
- public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
- public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
- public override int GetDayOfMonth(System.DateTime time) { throw null; }
- public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
- public override int GetDayOfYear(System.DateTime time) { throw null; }
- public override int GetDaysInMonth(int year, int month, int era) { throw null; }
- public override int GetDaysInYear(int year, int era) { throw null; }
- public override int GetEra(System.DateTime time) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override int GetLeapMonth(int year, int era) { throw null; }
- public override int GetMonth(System.DateTime time) { throw null; }
- public override int GetMonthsInYear(int year, int era) { throw null; }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Contracts", "CC1055")]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override int GetWeekOfYear(System.DateTime time, System.Globalization.CalendarWeekRule rule, System.DayOfWeek firstDayOfWeek) { throw null; }
- public override int GetYear(System.DateTime time) { throw null; }
- public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
- public override bool IsLeapMonth(int year, int month, int era) { throw null; }
- public override bool IsLeapYear(int year, int era) { throw null; }
- public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
- public override int ToFourDigitYear(int year) { throw null; }
- }
- [System.FlagsAttribute]
- public enum TimeSpanStyles
- {
- AssumeNegative = 1,
- None = 0,
- }
- public partial class UmAlQuraCalendar : System.Globalization.Calendar
- {
- public const int UmAlQuraEra = 1;
- public UmAlQuraCalendar() { }
-#if FEATURE_COREFX_GLOBALIZATION
- public override System.Globalization.CalendarAlgorithmType AlgorithmType { get { throw null; } }
-#endif
- protected override int DaysInYearBeforeMinSupportedYear { get { throw null; } }
- public override int[] Eras { get { throw null; } }
- public override System.DateTime MaxSupportedDateTime { get { throw null; } }
- public override System.DateTime MinSupportedDateTime { get { throw null; } }
- public override int TwoDigitYearMax { get { throw null; } set { } }
- public override System.DateTime AddMonths(System.DateTime time, int months) { throw null; }
- public override System.DateTime AddYears(System.DateTime time, int years) { throw null; }
- public override int GetDayOfMonth(System.DateTime time) { throw null; }
- public override System.DayOfWeek GetDayOfWeek(System.DateTime time) { throw null; }
- public override int GetDayOfYear(System.DateTime time) { throw null; }
- public override int GetDaysInMonth(int year, int month, int era) { throw null; }
- public override int GetDaysInYear(int year, int era) { throw null; }
- public override int GetEra(System.DateTime time) { throw null; }
- public override int GetLeapMonth(int year, int era) { throw null; }
- public override int GetMonth(System.DateTime time) { throw null; }
- public override int GetMonthsInYear(int year, int era) { throw null; }
- public override int GetYear(System.DateTime time) { throw null; }
- public override bool IsLeapDay(int year, int month, int day, int era) { throw null; }
- public override bool IsLeapMonth(int year, int month, int era) { throw null; }
- public override bool IsLeapYear(int year, int era) { throw null; }
- public override System.DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) { throw null; }
- public override int ToFourDigitYear(int year) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum UnicodeCategory
- {
- ClosePunctuation = 21,
- ConnectorPunctuation = 18,
- Control = 14,
- CurrencySymbol = 26,
- DashPunctuation = 19,
- DecimalDigitNumber = 8,
- EnclosingMark = 7,
- FinalQuotePunctuation = 23,
- Format = 15,
- InitialQuotePunctuation = 22,
- LetterNumber = 9,
- LineSeparator = 12,
- LowercaseLetter = 1,
- MathSymbol = 25,
- ModifierLetter = 3,
- ModifierSymbol = 27,
- NonSpacingMark = 5,
- OpenPunctuation = 20,
- OtherLetter = 4,
- OtherNotAssigned = 29,
- OtherNumber = 10,
- OtherPunctuation = 24,
- OtherSymbol = 28,
- ParagraphSeparator = 13,
- PrivateUse = 17,
- SpaceSeparator = 11,
- SpacingCombiningMark = 6,
- Surrogate = 16,
- TitlecaseLetter = 2,
- UppercaseLetter = 0,
- }
-}
-namespace System.IO
-{
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class BinaryReader : System.IDisposable
- {
- public BinaryReader(System.IO.Stream input) { }
- public BinaryReader(System.IO.Stream input, System.Text.Encoding encoding) { }
- public BinaryReader(System.IO.Stream input, System.Text.Encoding encoding, bool leaveOpen) { }
- public virtual System.IO.Stream BaseStream { get { throw null; } }
- public virtual void Close() { }
- public void Dispose() { }
- protected virtual void Dispose(bool disposing) { }
- protected virtual void FillBuffer(int numBytes) { }
- public virtual int PeekChar() { throw null; }
- public virtual int Read() { throw null; }
- public virtual int Read(byte[] buffer, int index, int count) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual int Read(char[] buffer, int index, int count) { throw null; }
- protected internal int Read7BitEncodedInt() { throw null; }
- public virtual bool ReadBoolean() { throw null; }
- public virtual byte ReadByte() { throw null; }
- public virtual byte[] ReadBytes(int count) { throw null; }
- public virtual char ReadChar() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual char[] ReadChars(int count) { throw null; }
- public virtual decimal ReadDecimal() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual double ReadDouble() { throw null; }
- public virtual short ReadInt16() { throw null; }
- public virtual int ReadInt32() { throw null; }
- public virtual long ReadInt64() { throw null; }
- [System.CLSCompliantAttribute(false)]
- public virtual sbyte ReadSByte() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual float ReadSingle() { throw null; }
- public virtual string ReadString() { throw null; }
- [System.CLSCompliantAttribute(false)]
- public virtual ushort ReadUInt16() { throw null; }
- [System.CLSCompliantAttribute(false)]
- public virtual uint ReadUInt32() { throw null; }
- [System.CLSCompliantAttribute(false)]
- public virtual ulong ReadUInt64() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class BinaryWriter : System.IDisposable
- {
- public static readonly System.IO.BinaryWriter Null;
- protected System.IO.Stream OutStream;
- protected BinaryWriter() { }
- public BinaryWriter(System.IO.Stream output) { }
- public BinaryWriter(System.IO.Stream output, System.Text.Encoding encoding) { }
- public BinaryWriter(System.IO.Stream output, System.Text.Encoding encoding, bool leaveOpen) { }
- public virtual System.IO.Stream BaseStream { get { throw null; } }
- public virtual void Close() { }
- public void Dispose() { }
- protected virtual void Dispose(bool disposing) { }
- public virtual void Flush() { }
- public virtual long Seek(int offset, System.IO.SeekOrigin origin) { throw null; }
- public virtual void Write(bool value) { }
- public virtual void Write(byte value) { }
- public virtual void Write(byte[] buffer) { }
- public virtual void Write(byte[] buffer, int index, int count) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual void Write(char ch) { }
- public virtual void Write(char[] chars) { }
- public virtual void Write(char[] chars, int index, int count) { }
- public virtual void Write(decimal value) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual void Write(double value) { }
- public virtual void Write(short value) { }
- public virtual void Write(int value) { }
- public virtual void Write(long value) { }
- [System.CLSCompliantAttribute(false)]
- public virtual void Write(sbyte value) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual void Write(float value) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual void Write(string value) { }
- [System.CLSCompliantAttribute(false)]
- public virtual void Write(ushort value) { }
- [System.CLSCompliantAttribute(false)]
- public virtual void Write(uint value) { }
- [System.CLSCompliantAttribute(false)]
- public virtual void Write(ulong value) { }
- protected void Write7BitEncodedInt(int value) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class DirectoryNotFoundException : System.IO.IOException
- {
- public DirectoryNotFoundException() { }
- public DirectoryNotFoundException(string message) { }
- public DirectoryNotFoundException(string message, System.Exception innerException) { }
- protected DirectoryNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class EndOfStreamException : System.IO.IOException
- {
- public EndOfStreamException() { }
- public EndOfStreamException(string message) { }
- public EndOfStreamException(string message, System.Exception innerException) { }
- protected EndOfStreamException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum FileAccess
- {
- Read = 1,
- ReadWrite = 3,
- Write = 2,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class FileLoadException : System.IO.IOException
- {
- public FileLoadException() { }
- public FileLoadException(string message) { }
- public FileLoadException(string message, System.Exception inner) { }
- public FileLoadException(string message, string fileName) { }
- public FileLoadException(string message, string fileName, System.Exception inner) { }
- protected FileLoadException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- public string FileName { get { throw null; } }
- public string FusionLog { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public override string Message { get { throw null; } }
- public override string ToString() { throw null; }
- }
- public enum FileMode
- {
- Append = 6,
- Create = 2,
- CreateNew = 1,
- Open = 3,
- OpenOrCreate = 4,
- Truncate = 5,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class FileNotFoundException : System.IO.IOException
- {
- public FileNotFoundException() { }
- public FileNotFoundException(string message) { }
- public FileNotFoundException(string message, System.Exception innerException) { }
- public FileNotFoundException(string message, string fileName) { }
- public FileNotFoundException(string message, string fileName, System.Exception innerException) { }
- protected FileNotFoundException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- public string FileName { get { throw null; } }
- public string FusionLog { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public override string Message { get { throw null; } }
- public override string ToString() { throw null; }
- }
- [System.FlagsAttribute]
- public enum FileOptions
- {
- Asynchronous = 1073741824,
- DeleteOnClose = 67108864,
- Encrypted = 16384,
- None = 0,
- RandomAccess = 268435456,
- SequentialScan = 134217728,
- WriteThrough = -2147483648,
- }
- [System.FlagsAttribute]
- public enum FileShare
- {
- Delete = 4,
- Inheritable = 16,
- None = 0,
- Read = 1,
- ReadWrite = 3,
- Write = 2,
- }
- public partial class FileStream : System.IO.Stream
- {
- public FileStream(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.IO.FileAccess access) { }
- public FileStream(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.IO.FileAccess access, int bufferSize) { }
- public FileStream(Microsoft.Win32.SafeHandles.SafeFileHandle handle, System.IO.FileAccess access, int bufferSize, bool isAsync) { }
- public FileStream(string path, System.IO.FileMode mode) { }
- public FileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access) { }
- public FileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) { }
- public FileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, int bufferSize) { }
- public FileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, int bufferSize, bool useAsync) { }
- public FileStream(string path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, int bufferSize, System.IO.FileOptions options) { }
- public override bool CanRead { get { throw null; } }
- public override bool CanSeek { get { throw null; } }
- public override bool CanWrite { get { throw null; } }
- [Obsolete("This property has been deprecated. Please use FileStream's SafeFileHandle property instead. http://go.microsoft.com/fwlink/?linkid=14202")]
- public virtual System.IntPtr Handle { get { throw null; } }
- public virtual bool IsAsync { get { throw null; } }
- public override long Length { get { throw null; } }
- public string Name { get { throw null; } }
- public override long Position { get { throw null; } set { } }
- public virtual Microsoft.Win32.SafeHandles.SafeFileHandle SafeFileHandle { get { throw null; } }
- protected override void Dispose(bool disposing) { }
- ~FileStream() { }
- public override void Flush() { }
- public virtual void Flush(bool flushToDisk) { }
- public override System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
- public override int Read(byte[] array, int offset, int count) { throw null; }
- public override System.Threading.Tasks.Task<int> ReadAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
- public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) { throw null; }
- public override int EndRead(IAsyncResult asyncResult) { throw null; }
- public virtual void Lock(long position, long length) { }
- public override int ReadByte() { throw null; }
- public override long Seek(long offset, System.IO.SeekOrigin origin) { throw null; }
- public override void SetLength(long value) { }
- public override void Write(byte[] array, int offset, int count) { }
- public override System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
- public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) { throw null; }
- public override void EndWrite(IAsyncResult asyncResult) { }
- public override void WriteByte(byte value) { }
- public virtual void Unlock(long position, long length) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class IOException : System.SystemException
- {
- public IOException() { }
- public IOException(string message) { }
- public IOException(string message, System.Exception innerException) { }
- public IOException(string message, int hresult) { }
- protected IOException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class MemoryStream : System.IO.Stream
- {
- public MemoryStream() { }
- public MemoryStream(byte[] buffer) { }
- public MemoryStream(byte[] buffer, bool writable) { }
- public MemoryStream(byte[] buffer, int index, int count) { }
- public MemoryStream(byte[] buffer, int index, int count, bool writable) { }
- public MemoryStream(byte[] buffer, int index, int count, bool writable, bool publiclyVisible) { }
- public MemoryStream(int capacity) { }
- public override bool CanRead { get { throw null; } }
- public override bool CanSeek { get { throw null; } }
- public override bool CanWrite { get { throw null; } }
- public virtual int Capacity { get { throw null; } set { } }
- public override long Length { get { throw null; } }
- public override long Position { get { throw null; } set { } }
- public override System.Threading.Tasks.Task CopyToAsync(System.IO.Stream destination, int bufferSize, System.Threading.CancellationToken cancellationToken) { throw null; }
- protected override void Dispose(bool disposing) { }
- public override void Flush() { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
- public virtual byte[] GetBuffer() { throw null; }
- public override int Read(byte[] buffer, int offset, int count) { buffer = default(byte[]); throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Threading.Tasks.Task<int> ReadAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
- public override int ReadByte() { throw null; }
- public override long Seek(long offset, System.IO.SeekOrigin loc) { throw null; }
- public override void SetLength(long value) { }
- public virtual byte[] ToArray() { throw null; }
- public virtual bool TryGetBuffer(out System.ArraySegment<byte> buffer) { buffer = default(System.ArraySegment<byte>); throw null; }
- public override void Write(byte[] buffer, int offset, int count) { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
- public override void WriteByte(byte value) { }
- public virtual void WriteTo(System.IO.Stream stream) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static partial class Path
- {
- public static readonly char AltDirectorySeparatorChar;
- public static readonly char DirectorySeparatorChar;
- public static readonly char PathSeparator;
- public static readonly char VolumeSeparatorChar;
- public static string ChangeExtension(string path, string extension) { throw null; }
- public static string Combine(string path1, string path2) { throw null; }
- public static string Combine(string path1, string path2, string path3) { throw null; }
- public static string Combine(params string[] paths) { throw null; }
- public static string GetDirectoryName(string path) { throw null; }
- public static string GetExtension(string path) { throw null; }
- public static string GetFileName(string path) { throw null; }
- public static string GetFileNameWithoutExtension(string path) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static string GetFullPath(string path) { throw null; }
- public static char[] GetInvalidFileNameChars() { throw null; }
- public static char[] GetInvalidPathChars() { throw null; }
- public static string GetPathRoot(string path) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static string GetRandomFileName() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static string GetTempFileName() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static string GetTempPath() { throw null; }
- public static bool HasExtension(string path) { throw null; }
- public static bool IsPathRooted(string path) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class PathTooLongException : System.IO.IOException
- {
- public PathTooLongException() { }
- public PathTooLongException(string message) { }
- public PathTooLongException(string message, System.Exception innerException) { }
- protected PathTooLongException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum SeekOrigin
- {
- Begin = 0,
- Current = 1,
- End = 2,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class Stream : System.IDisposable
- {
- public static readonly System.IO.Stream Null;
- protected Stream() { }
- public abstract bool CanRead { get; }
- public abstract bool CanSeek { get; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual bool CanTimeout { get { throw null; } }
- public abstract bool CanWrite { get; }
- public abstract long Length { get; }
- public abstract long Position { get; set; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual int ReadTimeout { get { throw null; } set { } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual int WriteTimeout { get { throw null; } set { } }
- public virtual System.IAsyncResult BeginRead(byte[] buffer, int offset, int count, System.AsyncCallback callback, object state) { throw null; }
- public virtual System.IAsyncResult BeginWrite(byte[] buffer, int offset, int count, System.AsyncCallback callback, object state) { throw null; }
- public virtual void Close() { }
- public void CopyTo(System.IO.Stream destination) { }
- public void CopyTo(System.IO.Stream destination, int bufferSize) { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public System.Threading.Tasks.Task CopyToAsync(System.IO.Stream destination) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public System.Threading.Tasks.Task CopyToAsync(System.IO.Stream destination, int bufferSize) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual System.Threading.Tasks.Task CopyToAsync(System.IO.Stream destination, int bufferSize, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.ObsoleteAttribute("CreateWaitHandle will be removed eventually. Please use \"new ManualResetEvent(false)\" instead.")]
- protected virtual System.Threading.WaitHandle CreateWaitHandle() { return default(System.Threading.WaitHandle); }
- public void Dispose() { }
- protected virtual void Dispose(bool disposing) { }
- public virtual int EndRead(System.IAsyncResult asyncResult) { throw null; }
- public virtual void EndWrite(System.IAsyncResult asyncResult) { }
- public abstract void Flush();
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public System.Threading.Tasks.Task FlushAsync() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.ObsoleteAttribute("Do not call or override this method.")]
- protected virtual void ObjectInvariant() { }
- public abstract int Read(byte[] buffer, int offset, int count);
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public System.Threading.Tasks.Task<int> ReadAsync(byte[] buffer, int offset, int count) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual System.Threading.Tasks.Task<int> ReadAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
- public virtual int ReadByte() { throw null; }
- public abstract long Seek(long offset, System.IO.SeekOrigin origin);
- public abstract void SetLength(long value);
- public static System.IO.Stream Synchronized(System.IO.Stream stream) { throw null; }
- public abstract void Write(byte[] buffer, int offset, int count);
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
- public virtual void WriteByte(byte value) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class StreamWriter : System.IO.TextWriter
- {
- public static readonly new System.IO.StreamWriter Null;
- public StreamWriter(System.IO.Stream stream) { }
- public StreamWriter(System.IO.Stream stream, System.Text.Encoding encoding) { }
- public StreamWriter(System.IO.Stream stream, System.Text.Encoding encoding, int bufferSize) { }
- public StreamWriter(System.IO.Stream stream, System.Text.Encoding encoding, int bufferSize, bool leaveOpen) { }
- public StreamWriter(string path) { }
- public StreamWriter(string path, bool append) { }
- public StreamWriter(string path, bool append, System.Text.Encoding encoding) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public StreamWriter(string path, bool append, System.Text.Encoding encoding, int bufferSize) { }
- public virtual bool AutoFlush { get { throw null; } set { } }
- public virtual System.IO.Stream BaseStream { get { throw null; } }
- public override System.Text.Encoding Encoding { get { throw null; } }
- public override void Close() { }
- protected override void Dispose(bool disposing) { }
- public override void Flush() { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Threading.Tasks.Task FlushAsync() { throw null; }
- public override void Write(char value) { }
- public override void Write(char[] buffer) { }
- public override void Write(char[] buffer, int index, int count) { }
- public override void Write(string value) { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Threading.Tasks.Task WriteAsync(char value) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Threading.Tasks.Task WriteAsync(char[] buffer, int index, int count) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Threading.Tasks.Task WriteAsync(string value) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Threading.Tasks.Task WriteLineAsync() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Threading.Tasks.Task WriteLineAsync(char value) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Threading.Tasks.Task WriteLineAsync(char[] buffer, int index, int count) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Threading.Tasks.Task WriteLineAsync(string value) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class StringWriter : System.IO.TextWriter
- {
- public StringWriter() { }
- public StringWriter(System.IFormatProvider formatProvider) { }
- public StringWriter(System.Text.StringBuilder sb) { }
- public StringWriter(System.Text.StringBuilder sb, System.IFormatProvider formatProvider) { }
- public override System.Text.Encoding Encoding { get { throw null; } }
- public override void Close() { }
- protected override void Dispose(bool disposing) { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Threading.Tasks.Task FlushAsync() { throw null; }
- public virtual System.Text.StringBuilder GetStringBuilder() { throw null; }
- public override string ToString() { throw null; }
- public override void Write(char value) { }
- public override void Write(char[] buffer, int index, int count) { }
- public override void Write(string value) { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Threading.Tasks.Task WriteAsync(char value) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Threading.Tasks.Task WriteAsync(char[] buffer, int index, int count) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Threading.Tasks.Task WriteAsync(string value) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Threading.Tasks.Task WriteLineAsync(char value) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Threading.Tasks.Task WriteLineAsync(char[] buffer, int index, int count) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Threading.Tasks.Task WriteLineAsync(string value) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class TextWriter : System.IDisposable
- {
- protected char[] CoreNewLine;
- public static readonly System.IO.TextWriter Null;
- protected TextWriter() { }
- protected TextWriter(System.IFormatProvider formatProvider) { }
- public abstract System.Text.Encoding Encoding { get; }
- public virtual System.IFormatProvider FormatProvider { get { throw null; } }
- public virtual string NewLine { get { throw null; } set { } }
- public virtual void Close() { }
- public void Dispose() { }
- protected virtual void Dispose(bool disposing) { }
- public virtual void Flush() { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual System.Threading.Tasks.Task FlushAsync() { throw null; }
- public static System.IO.TextWriter Synchronized(System.IO.TextWriter writer) { throw null; }
- public virtual void Write(bool value) { }
- public virtual void Write(char value) { }
- public virtual void Write(char[] buffer) { }
- public virtual void Write(char[] buffer, int index, int count) { }
- public virtual void Write(decimal value) { }
- public virtual void Write(double value) { }
- public virtual void Write(int value) { }
- public virtual void Write(long value) { }
- public virtual void Write(object value) { }
- public virtual void Write(float value) { }
- public virtual void Write(string value) { }
- public virtual void Write(string format, object arg0) { }
- public virtual void Write(string format, object arg0, object arg1) { }
- public virtual void Write(string format, object arg0, object arg1, object arg2) { }
- public virtual void Write(string format, params object[] arg) { }
- [System.CLSCompliantAttribute(false)]
- public virtual void Write(uint value) { }
- [System.CLSCompliantAttribute(false)]
- public virtual void Write(ulong value) { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual System.Threading.Tasks.Task WriteAsync(char value) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public System.Threading.Tasks.Task WriteAsync(char[] buffer) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual System.Threading.Tasks.Task WriteAsync(char[] buffer, int index, int count) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual System.Threading.Tasks.Task WriteAsync(string value) { throw null; }
- public virtual void WriteLine() { }
- public virtual void WriteLine(bool value) { }
- public virtual void WriteLine(char value) { }
- public virtual void WriteLine(char[] buffer) { }
- public virtual void WriteLine(char[] buffer, int index, int count) { }
- public virtual void WriteLine(decimal value) { }
- public virtual void WriteLine(double value) { }
- public virtual void WriteLine(int value) { }
- public virtual void WriteLine(long value) { }
- public virtual void WriteLine(object value) { }
- public virtual void WriteLine(float value) { }
- public virtual void WriteLine(string value) { }
- public virtual void WriteLine(string format, object arg0) { }
- public virtual void WriteLine(string format, object arg0, object arg1) { }
- public virtual void WriteLine(string format, object arg0, object arg1, object arg2) { }
- public virtual void WriteLine(string format, params object[] arg) { }
- [System.CLSCompliantAttribute(false)]
- public virtual void WriteLine(uint value) { }
- [System.CLSCompliantAttribute(false)]
- public virtual void WriteLine(ulong value) { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual System.Threading.Tasks.Task WriteLineAsync() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual System.Threading.Tasks.Task WriteLineAsync(char value) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public System.Threading.Tasks.Task WriteLineAsync(char[] buffer) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual System.Threading.Tasks.Task WriteLineAsync(char[] buffer, int index, int count) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual System.Threading.Tasks.Task WriteLineAsync(string value) { throw null; }
- }
- public partial class UnmanagedMemoryAccessor : System.IDisposable
- {
- protected UnmanagedMemoryAccessor() { }
- [System.Security.SecuritySafeCriticalAttribute]
- public UnmanagedMemoryAccessor(System.Runtime.InteropServices.SafeBuffer buffer, long offset, long capacity) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public UnmanagedMemoryAccessor(System.Runtime.InteropServices.SafeBuffer buffer, long offset, long capacity, System.IO.FileAccess access) { }
- public bool CanRead { get { throw null; } }
- public bool CanWrite { get { throw null; } }
- public long Capacity { get { throw null; } }
- protected bool IsOpen { get { throw null; } }
- public void Dispose() { }
- protected virtual void Dispose(bool disposing) { }
- [System.Security.SecuritySafeCriticalAttribute]
- protected void Initialize(System.Runtime.InteropServices.SafeBuffer buffer, long offset, long capacity, System.IO.FileAccess access) { }
- [System.Security.SecurityCriticalAttribute]
- public void Read<T>(long position, out T structure) where T : struct { structure = default(T); throw null; }
- [System.Security.SecurityCriticalAttribute]
- public int ReadArray<T>(long position, T[] array, int offset, int count) where T : struct { throw null; }
- public bool ReadBoolean(long position) { throw null; }
- public byte ReadByte(long position) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public char ReadChar(long position) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public decimal ReadDecimal(long position) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public double ReadDouble(long position) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public short ReadInt16(long position) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public int ReadInt32(long position) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public long ReadInt64(long position) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public sbyte ReadSByte(long position) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public float ReadSingle(long position) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public ushort ReadUInt16(long position) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public uint ReadUInt32(long position) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public ulong ReadUInt64(long position) { throw null; }
- public void Write(long position, bool value) { }
- public void Write(long position, byte value) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void Write(long position, char value) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void Write(long position, decimal value) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void Write(long position, double value) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void Write(long position, short value) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void Write(long position, int value) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void Write(long position, long value) { }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public void Write(long position, sbyte value) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void Write(long position, float value) { }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public void Write(long position, ushort value) { }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public void Write(long position, uint value) { }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public void Write(long position, ulong value) { }
- [System.Security.SecurityCriticalAttribute]
- public void Write<T>(long position, ref T structure) where T : struct { }
- [System.Security.SecurityCriticalAttribute]
- public void WriteArray<T>(long position, T[] array, int offset, int count) where T : struct { }
- }
- public partial class UnmanagedMemoryStream : System.IO.Stream
- {
- [System.Security.SecuritySafeCriticalAttribute]
- protected UnmanagedMemoryStream() { }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe UnmanagedMemoryStream(byte* pointer, long length) { }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe UnmanagedMemoryStream(byte* pointer, long length, long capacity, System.IO.FileAccess access) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public UnmanagedMemoryStream(System.Runtime.InteropServices.SafeBuffer buffer, long offset, long length) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public UnmanagedMemoryStream(System.Runtime.InteropServices.SafeBuffer buffer, long offset, long length, System.IO.FileAccess access) { }
- public override bool CanRead { get { throw null; } }
- public override bool CanSeek { get { throw null; } }
- public override bool CanWrite { get { throw null; } }
- public long Capacity { get { throw null; } }
- public override long Length { get { throw null; } }
- public override long Position { get { throw null; } [System.Security.SecuritySafeCriticalAttribute]set { } }
- [System.CLSCompliantAttribute(false)]
- public unsafe byte* PositionPointer { [System.Security.SecurityCriticalAttribute]get { throw null; } [System.Security.SecurityCriticalAttribute]set { } }
- [System.Security.SecuritySafeCriticalAttribute]
- protected override void Dispose(bool disposing) { }
- public override void Flush() { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- protected unsafe void Initialize(byte* pointer, long length, long capacity, System.IO.FileAccess access) { }
- [System.Security.SecuritySafeCriticalAttribute]
- protected void Initialize(System.Runtime.InteropServices.SafeBuffer buffer, long offset, long length, System.IO.FileAccess access) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public override int Read(byte[] buffer, int offset, int count) { buffer = default(byte[]); throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Threading.Tasks.Task<int> ReadAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override int ReadByte() { throw null; }
- public override long Seek(long offset, System.IO.SeekOrigin loc) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override void SetLength(long value) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public override void Write(byte[] buffer, int offset, int count) { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override void WriteByte(byte value) { }
- }
-}
-namespace System.Reflection
-{
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AmbiguousMatchException : System.SystemException
- {
- public AmbiguousMatchException() { }
- public AmbiguousMatchException(string message) { }
- public AmbiguousMatchException(string message, System.Exception inner) { }
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class Assembly : System.Reflection.ICustomAttributeProvider, System.Runtime.Serialization.ISerializable
- {
- protected Assembly() { }
- public virtual string CodeBase { [System.Security.SecurityCriticalAttribute]get { throw null; } }
- public virtual System.Collections.Generic.IEnumerable<System.Reflection.CustomAttributeData> CustomAttributes { get { throw null; } }
- public virtual System.Collections.Generic.IEnumerable<System.Reflection.TypeInfo> DefinedTypes { get { throw null; } }
- public virtual System.Reflection.MethodInfo EntryPoint { get { throw null; } }
- public virtual string EscapedCodeBase { [System.Security.SecurityCriticalAttribute]get { throw null; } }
- public virtual System.Collections.Generic.IEnumerable<System.Type> ExportedTypes { get { throw null; } }
- public virtual string FullName { get { throw null; } }
- public virtual bool GlobalAssemblyCache { get { throw null; } }
- public virtual Int64 HostContext { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual string ImageRuntimeVersion { get { throw null; } }
- public virtual bool IsDynamic { get { throw null; } }
- public bool IsFullyTrusted { get { throw null; } }
- public virtual string Location { [System.Security.SecurityCriticalAttribute]get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual System.Reflection.Module ManifestModule { get { throw null; } }
- public virtual event ModuleResolveEventHandler ModuleResolve { [System.Security.SecurityCriticalAttribute]add { } [System.Security.SecurityCriticalAttribute]remove { } }
- public virtual System.Collections.Generic.IEnumerable<System.Reflection.Module> Modules { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual bool ReflectionOnly { get { throw null; } }
- public virtual System.Security.SecurityRuleSet SecurityRuleSet { get { throw null; } }
- public object CreateInstance(string typeName) { throw null; }
- public object CreateInstance(string typeName, bool ignoreCase) { throw null; }
- public virtual object CreateInstance(String typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, System.Globalization.CultureInfo culture, Object[] activationAttributes) { throw null; }
- public static string CreateQualifiedName(string assemblyName, string typeName) { throw null; }
- public override bool Equals(object o) { throw null; }
- public static Assembly GetAssembly(Type type) { throw null; }
- public static bool operator ==(System.Reflection.Assembly left, System.Reflection.Assembly right) { throw null; }
- public static bool operator !=(System.Reflection.Assembly left, System.Reflection.Assembly right) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecuritySafeCriticalAttribute]
- public static System.Reflection.Assembly GetCallingAssembly() { throw null; }
- public virtual object[] GetCustomAttributes(bool inherit) { throw null; }
- public virtual object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
- public virtual System.Collections.Generic.IList<CustomAttributeData> GetCustomAttributesData() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Reflection.Assembly GetEntryAssembly() { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecuritySafeCriticalAttribute]
- public static System.Reflection.Assembly GetExecutingAssembly() { throw null; }
- public virtual System.Type[] GetExportedTypes() { throw null; }
- public virtual System.IO.FileStream GetFile(string name) { throw null; }
- public virtual System.IO.FileStream[] GetFiles() { throw null; }
- public virtual System.IO.FileStream[] GetFiles(bool getResourceModules) { throw null; }
- public override int GetHashCode() { throw null; }
- public System.Reflection.Module[] GetLoadedModules() { throw null; }
- public virtual System.Reflection.Module[] GetLoadedModules(bool getResourceModules) { throw null; }
- public virtual System.Reflection.ManifestResourceInfo GetManifestResourceInfo(string resourceName) { throw null; }
- public virtual string[] GetManifestResourceNames() { throw null; }
- public virtual System.IO.Stream GetManifestResourceStream(string name) { throw null; }
- public virtual System.IO.Stream GetManifestResourceStream(System.Type type, string name) { throw null; }
- public virtual System.Reflection.Module GetModule(String name) { throw null; }
- public System.Reflection.Module[] GetModules() { throw null; }
- public virtual System.Reflection.Module[] GetModules(bool getResourceModules) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public virtual System.Reflection.AssemblyName GetName(bool copiedName) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public virtual System.Reflection.AssemblyName GetName() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public virtual System.Reflection.AssemblyName[] GetReferencedAssemblies() { throw null; }
- public virtual System.Reflection.Assembly GetSatelliteAssembly(System.Globalization.CultureInfo culture) { throw null; }
- public virtual System.Reflection.Assembly GetSatelliteAssembly(System.Globalization.CultureInfo culture, System.Version version) { throw null; }
- public virtual System.Type GetType(string name) { throw null; }
- public virtual System.Type GetType(string name, bool throwOnError) { throw null; }
- public virtual System.Type GetType(string name, bool throwOnError, bool ignoreCase) { throw null; }
- public virtual System.Type[] GetTypes() { throw null; }
- public virtual bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecurityCriticalAttribute]
- public static System.Reflection.Assembly Load(byte[] rawAssembly) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecurityCriticalAttribute]
- public static System.Reflection.Assembly Load(byte[] rawAssembly, byte[] rawSymbolStore) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecurityCriticalAttribute]
- public static System.Reflection.Assembly Load(System.Reflection.AssemblyName assemblyRef) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecuritySafeCriticalAttribute]
- public static System.Reflection.Assembly Load(string assemblyString) { throw null; }
- public static System.Reflection.Assembly LoadFile(String path) { throw null; }
- public static System.Reflection.Assembly LoadFrom(String path) { throw null; }
- public static Assembly LoadFrom(string assemblyFile, byte[] hashValue, System.Configuration.Assemblies.AssemblyHashAlgorithm hashAlgorithm) { throw null; }
- public System.Reflection.Module LoadModule(String moduleName, byte[] rawModule) { throw null; }
- public System.Reflection.Module LoadModule(String moduleName, byte[] rawModule, byte[] rawSymbolStore) { throw null; }
- [ObsoleteAttribute("This method has been deprecated. Please use Assembly.Load() instead. http://go.microsoft.com/fwlink/?linkid=14202")]
- public static Assembly LoadWithPartialName(string partialName) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute][System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- public static Assembly ReflectionOnlyLoad(byte[] rawAssembly) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute][System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- public static Assembly ReflectionOnlyLoad(String assemblyString) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute][System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- public static Assembly ReflectionOnlyLoadFrom(string assemblyFile) { throw null; }
- public override string ToString() { throw null; }
- public static Assembly UnsafeLoadFrom(string assemblyFile) { throw null; }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AssemblyAlgorithmIdAttribute : System.Attribute
- {
- public AssemblyAlgorithmIdAttribute(System.Configuration.Assemblies.AssemblyHashAlgorithm algorithmId) { }
- [System.CLSCompliantAttribute(false)]
- public AssemblyAlgorithmIdAttribute(uint algorithmId) { }
- [System.CLSCompliantAttribute(false)]
- public uint AlgorithmId { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AssemblyCompanyAttribute : System.Attribute
- {
- public AssemblyCompanyAttribute(string company) { }
- public string Company { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AssemblyConfigurationAttribute : System.Attribute
- {
- public AssemblyConfigurationAttribute(string configuration) { }
- public string Configuration { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public enum AssemblyContentType
- {
- Default = 0,
- WindowsRuntime = 1,
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AssemblyCopyrightAttribute : System.Attribute
- {
- public AssemblyCopyrightAttribute(string copyright) { }
- public string Copyright { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AssemblyCultureAttribute : System.Attribute
- {
- public AssemblyCultureAttribute(string culture) { }
- public string Culture { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AssemblyDefaultAliasAttribute : System.Attribute
- {
- public AssemblyDefaultAliasAttribute(string defaultAlias) { }
- public string DefaultAlias { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AssemblyDelaySignAttribute : System.Attribute
- {
- public AssemblyDelaySignAttribute(bool delaySign) { }
- public bool DelaySign { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AssemblyDescriptionAttribute : System.Attribute
- {
- public AssemblyDescriptionAttribute(string description) { }
- public string Description { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AssemblyFileVersionAttribute : System.Attribute
- {
- public AssemblyFileVersionAttribute(string version) { }
- public string Version { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AssemblyFlagsAttribute : System.Attribute
- {
- [System.CLSCompliantAttribute(false)]
- public AssemblyFlagsAttribute(uint flags) { }
- public AssemblyFlagsAttribute(int assemblyFlags) { }
- public AssemblyFlagsAttribute(System.Reflection.AssemblyNameFlags assemblyFlags) { }
- public int AssemblyFlags { get { throw null; } }
- [System.CLSCompliantAttribute(false)]
- public uint Flags { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AssemblyInformationalVersionAttribute : System.Attribute
- {
- public AssemblyInformationalVersionAttribute(string informationalVersion) { }
- public string InformationalVersion { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AssemblyKeyFileAttribute : System.Attribute
- {
- public AssemblyKeyFileAttribute(string keyFile) { }
- public string KeyFile { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AssemblyKeyNameAttribute : System.Attribute
- {
- public AssemblyKeyNameAttribute(string keyName) { }
- public string KeyName { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), AllowMultiple=true, Inherited=false)]
- public sealed partial class AssemblyMetadataAttribute : System.Attribute
- {
- public AssemblyMetadataAttribute(string key, string value) { }
- public string Key { get { throw null; } }
- public string Value { get { throw null; } }
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AssemblyName : System.ICloneable, System.Runtime.Serialization.ISerializable, System.Runtime.Serialization.IDeserializationCallback
- {
- public AssemblyName() { }
- [System.Security.SecuritySafeCriticalAttribute]
- public AssemblyName(string assemblyName) { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public System.Reflection.AssemblyContentType ContentType { get { throw null; } set { } }
- public System.Globalization.CultureInfo CultureInfo { get { throw null; } set { } }
- public string CultureName { [System.Security.SecurityCriticalAttribute]get { throw null; } [System.Security.SecurityCriticalAttribute]set { } }
- public string CodeBase { get { throw null; } set { } }
- public string EscapedCodeBase { get { throw null; } }
- public System.Reflection.AssemblyNameFlags Flags { get { throw null; } set { } }
- public string FullName { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public System.Configuration.Assemblies.AssemblyHashAlgorithm HashAlgorithm { get { throw null; } set { } }
- public System.Reflection.StrongNameKeyPair KeyPair { get { throw null; } set { } }
- public System.Configuration.Assemblies.AssemblyVersionCompatibility VersionCompatibility { get { throw null; } set { } }
- public string Name { get { throw null; } set { } }
- public System.Reflection.ProcessorArchitecture ProcessorArchitecture { get { throw null; } set { } }
- public System.Version Version { get { throw null; } set { } }
- public object Clone() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Reflection.AssemblyName GetAssemblyName(System.String assemblyFile) { throw null; }
- public byte[] GetPublicKey() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public byte[] GetPublicKeyToken() { throw null; }
- public void SetPublicKey(byte[] publicKey) { }
- public void SetPublicKeyToken(byte[] publicKeyToken) { }
- public override string ToString() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { throw null; }
- public void OnDeserialization(Object sender) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static bool ReferenceMatchesDefinition(System.Reflection.AssemblyName reference, System.Reflection.AssemblyName definition) { throw null; }
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum AssemblyNameFlags
- {
- EnableJITcompileOptimizer = 16384,
- EnableJITcompileTracking = 32768,
- None = 0,
- PublicKey = 1,
- Retargetable = 256,
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AssemblyProductAttribute : System.Attribute
- {
- public AssemblyProductAttribute(string product) { }
- public string Product { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=false, AllowMultiple=false)]
- public sealed partial class AssemblySignatureKeyAttribute : System.Attribute
- {
- public AssemblySignatureKeyAttribute(string publicKey, string countersignature) { }
- public string Countersignature { get { throw null; } }
- public string PublicKey { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AssemblyTitleAttribute : System.Attribute
- {
- public AssemblyTitleAttribute(string title) { }
- public string Title { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AssemblyTrademarkAttribute : System.Attribute
- {
- public AssemblyTrademarkAttribute(string trademark) { }
- public string Trademark { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AssemblyVersionAttribute : System.Attribute
- {
- public AssemblyVersionAttribute(string version) { }
- public string Version { get { throw null; } }
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(2))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class Binder
- {
- protected Binder() { }
- public abstract System.Reflection.FieldInfo BindToField(System.Reflection.BindingFlags bindingAttr, System.Reflection.FieldInfo[] match, object value, System.Globalization.CultureInfo culture);
- public abstract System.Reflection.MethodBase BindToMethod(System.Reflection.BindingFlags bindingAttr, System.Reflection.MethodBase[] match, ref object[] args, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, string[] names, out object state);
- public abstract object ChangeType(object value, System.Type type, System.Globalization.CultureInfo culture);
- public abstract void ReorderArgumentArray(ref object[] args, object state);
- public abstract System.Reflection.MethodBase SelectMethod(System.Reflection.BindingFlags bindingAttr, System.Reflection.MethodBase[] match, System.Type[] types, System.Reflection.ParameterModifier[] modifiers);
- public abstract System.Reflection.PropertyInfo SelectProperty(System.Reflection.BindingFlags bindingAttr, System.Reflection.PropertyInfo[] match, System.Type returnType, System.Type[] indexes, System.Reflection.ParameterModifier[] modifiers);
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum BindingFlags
- {
- CreateInstance = 512,
- DeclaredOnly = 2,
- Default = 0,
- ExactBinding = 65536,
- FlattenHierarchy = 64,
- GetField = 1024,
- GetProperty = 4096,
- IgnoreCase = 1,
- IgnoreReturn = 16777216,
- Instance = 4,
- InvokeMethod = 256,
- NonPublic = 32,
- OptionalParamBinding = 262144,
- Public = 16,
- PutDispProperty = 16384,
- PutRefDispProperty = 32768,
- SetField = 2048,
- SetProperty = 8192,
- Static = 8,
- SuppressChangeType = 131072,
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum CallingConventions
- {
- Any = 3,
- ExplicitThis = 64,
- HasThis = 32,
- Standard = 1,
- VarArgs = 2,
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class ConstructorInfo : System.Reflection.MethodBase
- {
- public static bool operator ==(System.Reflection.ConstructorInfo left, System.Reflection.ConstructorInfo right) { throw null; }
- public static bool operator !=(System.Reflection.ConstructorInfo left, System.Reflection.ConstructorInfo right) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static readonly string ConstructorName;
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static readonly string TypeConstructorName;
- protected ConstructorInfo() { }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public override System.Reflection.MemberTypes MemberType { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public override int GetHashCode() { throw null; }
- [System.Diagnostics.DebuggerHiddenAttribute]
- [System.Diagnostics.DebuggerStepThroughAttribute]
- public object Invoke(object[] parameters) { throw null; }
- public abstract object Invoke(System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object[] parameters, System.Globalization.CultureInfo culture);
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class CustomAttributeData
- {
- protected CustomAttributeData() { }
- public System.Type AttributeType { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public virtual System.Reflection.ConstructorInfo Constructor { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public virtual System.Collections.Generic.IList<System.Reflection.CustomAttributeTypedArgument> ConstructorArguments { get { throw null; } }
- public virtual System.Collections.Generic.IList<System.Reflection.CustomAttributeNamedArgument> NamedArguments { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public static System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributes(System.Reflection.Assembly target) { throw null; }
- public static System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributes(System.Reflection.MemberInfo target) { throw null; }
- public static System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributes(System.Reflection.Module target) { throw null; }
- public static System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributes(System.Reflection.ParameterInfo target) { throw null; }
- public override int GetHashCode() { throw null; }
- public override string ToString() { throw null; }
- }
- public static partial class CustomAttributeExtensions
- {
- public static System.Attribute GetCustomAttribute(this System.Reflection.Assembly element, System.Type attributeType) { throw null; }
- public static System.Attribute GetCustomAttribute(this System.Reflection.MemberInfo element, System.Type attributeType) { throw null; }
- public static System.Attribute GetCustomAttribute(this System.Reflection.MemberInfo element, System.Type attributeType, bool inherit) { throw null; }
- public static System.Attribute GetCustomAttribute(this System.Reflection.Module element, System.Type attributeType) { throw null; }
- public static System.Attribute GetCustomAttribute(this System.Reflection.ParameterInfo element, System.Type attributeType) { throw null; }
- public static System.Attribute GetCustomAttribute(this System.Reflection.ParameterInfo element, System.Type attributeType, bool inherit) { throw null; }
- public static T GetCustomAttribute<T>(this System.Reflection.Assembly element) where T : System.Attribute { throw null; }
- public static T GetCustomAttribute<T>(this System.Reflection.MemberInfo element) where T : System.Attribute { throw null; }
- public static T GetCustomAttribute<T>(this System.Reflection.MemberInfo element, bool inherit) where T : System.Attribute { throw null; }
- public static T GetCustomAttribute<T>(this System.Reflection.Module element) where T : System.Attribute { throw null; }
- public static T GetCustomAttribute<T>(this System.Reflection.ParameterInfo element) where T : System.Attribute { throw null; }
- public static T GetCustomAttribute<T>(this System.Reflection.ParameterInfo element, bool inherit) where T : System.Attribute { throw null; }
- public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.Assembly element) { throw null; }
- public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.Assembly element, System.Type attributeType) { throw null; }
- public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.MemberInfo element) { throw null; }
- public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.MemberInfo element, bool inherit) { throw null; }
- public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.MemberInfo element, System.Type attributeType) { throw null; }
- public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.MemberInfo element, System.Type attributeType, bool inherit) { throw null; }
- public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.Module element) { throw null; }
- public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.Module element, System.Type attributeType) { throw null; }
- public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.ParameterInfo element) { throw null; }
- public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.ParameterInfo element, bool inherit) { throw null; }
- public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.ParameterInfo element, System.Type attributeType) { throw null; }
- public static System.Collections.Generic.IEnumerable<System.Attribute> GetCustomAttributes(this System.Reflection.ParameterInfo element, System.Type attributeType, bool inherit) { throw null; }
- public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T>(this System.Reflection.Assembly element) where T : System.Attribute { throw null; }
- public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T>(this System.Reflection.MemberInfo element) where T : System.Attribute { throw null; }
- public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T>(this System.Reflection.MemberInfo element, bool inherit) where T : System.Attribute { throw null; }
- public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T>(this System.Reflection.Module element) where T : System.Attribute { throw null; }
- public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T>(this System.Reflection.ParameterInfo element) where T : System.Attribute { throw null; }
- public static System.Collections.Generic.IEnumerable<T> GetCustomAttributes<T>(this System.Reflection.ParameterInfo element, bool inherit) where T : System.Attribute { throw null; }
- public static bool IsDefined(this System.Reflection.Assembly element, System.Type attributeType) { throw null; }
- public static bool IsDefined(this System.Reflection.MemberInfo element, System.Type attributeType) { throw null; }
- public static bool IsDefined(this System.Reflection.MemberInfo element, System.Type attributeType, bool inherit) { throw null; }
- public static bool IsDefined(this System.Reflection.Module element, System.Type attributeType) { throw null; }
- public static bool IsDefined(this System.Reflection.ParameterInfo element, System.Type attributeType) { throw null; }
- public static bool IsDefined(this System.Reflection.ParameterInfo element, System.Type attributeType, bool inherit) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class CustomAttributeFormatException : System.FormatException
- {
- public CustomAttributeFormatException() { }
- public CustomAttributeFormatException(string message) { }
- public CustomAttributeFormatException(string message, System.Exception inner) { }
- protected CustomAttributeFormatException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct CustomAttributeNamedArgument
- {
- public CustomAttributeNamedArgument(System.Reflection.MemberInfo memberInfo, object value) { }
- public CustomAttributeNamedArgument(System.Reflection.MemberInfo memberInfo, System.Reflection.CustomAttributeTypedArgument typedArgument) { }
- public bool IsField { get { throw null; } }
- public System.Reflection.MemberInfo MemberInfo { get { throw null; } }
- public string MemberName { get { throw null; } }
- public System.Reflection.CustomAttributeTypedArgument TypedValue { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public static bool operator ==(System.Reflection.CustomAttributeNamedArgument left, System.Reflection.CustomAttributeNamedArgument right) { throw null; }
- public static bool operator !=(System.Reflection.CustomAttributeNamedArgument left, System.Reflection.CustomAttributeNamedArgument right) { throw null; }
- public override string ToString() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct CustomAttributeTypedArgument
- {
- public CustomAttributeTypedArgument(System.Type argumentType, object value) { }
- public CustomAttributeTypedArgument(object value) { }
- public System.Type ArgumentType { get { throw null; } }
- public object Value { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public static bool operator ==(System.Reflection.CustomAttributeTypedArgument left, System.Reflection.CustomAttributeTypedArgument right) { throw null; }
- public static bool operator !=(System.Reflection.CustomAttributeTypedArgument left, System.Reflection.CustomAttributeTypedArgument right) { throw null; }
- public override string ToString() { throw null; }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1036))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class DefaultMemberAttribute : System.Attribute
- {
- public DefaultMemberAttribute(string memberName) { }
- public string MemberName { get { throw null; } }
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum EventAttributes
- {
- None = 0,
- ReservedMask = 1024,
- RTSpecialName = 1024,
- SpecialName = 512,
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class EventInfo : System.Reflection.MemberInfo
- {
- protected EventInfo() { }
- public static bool operator ==(System.Reflection.EventInfo left, System.Reflection.EventInfo right) { throw null; }
- public static bool operator !=(System.Reflection.EventInfo left, System.Reflection.EventInfo right) { throw null; }
- public virtual System.Reflection.MethodInfo AddMethod { get { throw null; } }
- public abstract System.Reflection.EventAttributes Attributes { get; }
- public virtual System.Type EventHandlerType { get { throw null; } }
- public virtual bool IsMulticast { get { throw null; } }
- public bool IsSpecialName { get { throw null; } }
- public override System.Reflection.MemberTypes MemberType { get { throw null; } }
- public virtual System.Reflection.MethodInfo RaiseMethod { get { throw null; } }
- public virtual System.Reflection.MethodInfo RemoveMethod { get { throw null; } }
- [System.Diagnostics.DebuggerHiddenAttribute]
- [System.Diagnostics.DebuggerStepThroughAttribute]
- public virtual void AddEventHandler(object target, System.Delegate handler) { }
- public override bool Equals(object obj) { throw null; }
- public System.Reflection.MethodInfo GetAddMethod() { throw null; }
- public abstract System.Reflection.MethodInfo GetAddMethod(bool nonPublic);
- public override int GetHashCode() { throw null; }
- public System.Reflection.MethodInfo[] GetOtherMethods() { throw null; }
- public virtual System.Reflection.MethodInfo[] GetOtherMethods(bool nonPublic) { throw null; }
- public System.Reflection.MethodInfo GetRaiseMethod() { throw null; }
- public abstract System.Reflection.MethodInfo GetRaiseMethod(bool nonPublic);
- public System.Reflection.MethodInfo GetRemoveMethod() { throw null; }
- public abstract System.Reflection.MethodInfo GetRemoveMethod(bool nonPublic);
- [System.Diagnostics.DebuggerHiddenAttribute]
- [System.Diagnostics.DebuggerStepThroughAttribute]
- public virtual void RemoveEventHandler(object target, System.Delegate handler) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public class ExceptionHandlingClause
- {
- protected ExceptionHandlingClause() { }
- public virtual System.Reflection.ExceptionHandlingClauseOptions Flags { get { throw null; } }
- public virtual int TryOffset { get { throw null; } }
- public virtual int TryLength { get { throw null; } }
- public virtual int HandlerOffset { get { throw null; } }
- public virtual int HandlerLength { get { throw null; } }
- public virtual int FilterOffset { get { throw null; } }
- public virtual System.Type CatchType { get { throw null; } }
- public override string ToString() { throw null; }
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum ExceptionHandlingClauseOptions: int
- {
- Clause = 0,
- Filter = 1,
- Finally = 2,
- Fault = 4,
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum FieldAttributes
- {
- Assembly = 3,
- FamANDAssem = 2,
- Family = 4,
- FamORAssem = 5,
- FieldAccessMask = 7,
- HasDefault = 32768,
- HasFieldMarshal = 4096,
- HasFieldRVA = 256,
- InitOnly = 32,
- Literal = 64,
- NotSerialized = 128,
- PinvokeImpl = 8192,
- Private = 1,
- PrivateScope = 0,
- Public = 6,
- ReservedMask = 38144,
- RTSpecialName = 1024,
- SpecialName = 512,
- Static = 16,
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class FieldInfo : System.Reflection.MemberInfo
- {
- protected FieldInfo() { }
- public static bool operator ==(System.Reflection.FieldInfo left, System.Reflection.FieldInfo right) { throw null; }
- public static bool operator !=(System.Reflection.FieldInfo left, System.Reflection.FieldInfo right) { throw null; }
- public abstract System.Reflection.FieldAttributes Attributes { get; }
- public abstract System.RuntimeFieldHandle FieldHandle { get; }
- public abstract System.Type FieldType { get; }
- public bool IsAssembly { get { throw null; } }
- public bool IsFamily { get { throw null; } }
- public bool IsFamilyAndAssembly { get { throw null; } }
- public bool IsFamilyOrAssembly { get { throw null; } }
- public bool IsInitOnly { get { throw null; } }
- public bool IsLiteral { get { throw null; } }
- public bool IsNotSerialized { get { throw null; } }
- public bool IsPinvokeImpl { get { throw null; } }
- public bool IsPrivate { get { throw null; } }
- public bool IsPublic { get { throw null; } }
- public virtual bool IsSecurityCritical { get { throw null; } }
- public virtual bool IsSecuritySafeCritical { get { throw null; } }
- public virtual bool IsSecurityTransparent { get { throw null; } }
- public bool IsSpecialName { get { throw null; } }
- public bool IsStatic { get { throw null; } }
- public override System.Reflection.MemberTypes MemberType { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public static System.Reflection.FieldInfo GetFieldFromHandle(System.RuntimeFieldHandle handle) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public static System.Reflection.FieldInfo GetFieldFromHandle(System.RuntimeFieldHandle handle, System.RuntimeTypeHandle declaringType) { throw null; }
- public override int GetHashCode() { throw null; }
- public virtual System.Type[] GetOptionalCustomModifiers() { throw null; }
- public virtual object GetRawConstantValue() { throw null; }
- public virtual System.Type[] GetRequiredCustomModifiers() { throw null; }
- public abstract object GetValue(object obj);
- [System.Diagnostics.DebuggerHiddenAttribute]
- [System.Diagnostics.DebuggerStepThroughAttribute]
- public void SetValue(object obj, object value) { }
- public abstract void SetValue(object obj, object value, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Globalization.CultureInfo culture);
- }
- [System.FlagsAttribute]
- public enum GenericParameterAttributes
- {
- Contravariant = 2,
- Covariant = 1,
- DefaultConstructorConstraint = 16,
- None = 0,
- NotNullableValueTypeConstraint = 8,
- ReferenceTypeConstraint = 4,
- SpecialConstraintMask = 28,
- VarianceMask = 3,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface ICustomAttributeProvider
- {
- object[] GetCustomAttributes(bool inherit);
- object[] GetCustomAttributes(System.Type attributeType, bool inherit);
- bool IsDefined(System.Type attributeType, bool inherit);
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum ImageFileMachine
- {
- I386 = 332,
- IA64 = 512,
- AMD64 = 34404,
- ARM = 452,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct InterfaceMapping
- {
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public System.Reflection.MethodInfo[] InterfaceMethods;
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public System.Type InterfaceType;
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public System.Reflection.MethodInfo[] TargetMethods;
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public System.Type TargetType;
- }
- public static partial class IntrospectionExtensions
- {
- public static System.Reflection.TypeInfo GetTypeInfo(this System.Type type) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class InvalidFilterCriteriaException : System.ApplicationException
- {
- public InvalidFilterCriteriaException() { }
- public InvalidFilterCriteriaException(string message) { }
- public InvalidFilterCriteriaException(string message, System.Exception inner) { }
- protected InvalidFilterCriteriaException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.GuidAttribute("AFBF15E5-C37C-11d2-B88E-00A0C9B471B8")]
- public partial interface IReflect
- {
- System.Type UnderlyingSystemType { get; }
- System.Reflection.FieldInfo GetField(string name, System.Reflection.BindingFlags bindingAttr);
- System.Reflection.FieldInfo[] GetFields(System.Reflection.BindingFlags bindingAttr);
- System.Reflection.MemberInfo[] GetMember(string name, System.Reflection.BindingFlags bindingAttr);
- System.Reflection.MemberInfo[] GetMembers(System.Reflection.BindingFlags bindingAttr);
- System.Reflection.MethodInfo GetMethod(string name, System.Reflection.BindingFlags bindingAttr);
- System.Reflection.MethodInfo GetMethod(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Type[] types, System.Reflection.ParameterModifier[] modifiers);
- System.Reflection.MethodInfo[] GetMethods(System.Reflection.BindingFlags bindingAttr);
- System.Reflection.PropertyInfo[] GetProperties(System.Reflection.BindingFlags bindingAttr);
- System.Reflection.PropertyInfo GetProperty(string name, System.Reflection.BindingFlags bindingAttr);
- System.Reflection.PropertyInfo GetProperty(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Type returnType, System.Type[] types, System.Reflection.ParameterModifier[] modifiers);
- object InvokeMember(string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object target, object[] args, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, string[] namedParameters);
- }
- public partial interface IReflectableType
- {
- System.Reflection.TypeInfo GetTypeInfo();
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class LocalVariableInfo
- {
- protected LocalVariableInfo() { }
- public virtual bool IsPinned { get { throw null; } }
- public virtual int LocalIndex { get { throw null; } }
- public virtual System.Type LocalType { get { throw null; } }
- public override string ToString() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class ManifestResourceInfo
- {
- public ManifestResourceInfo(System.Reflection.Assembly containingAssembly, string containingFileName, System.Reflection.ResourceLocation resourceLocation) { }
- public virtual string FileName { get { throw null; } }
- public virtual System.Reflection.Assembly ReferencedAssembly { get { throw null; } }
- public virtual System.Reflection.ResourceLocation ResourceLocation { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public delegate bool MemberFilter(System.Reflection.MemberInfo m, object filterCriteria);
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class MemberInfo : System.Reflection.ICustomAttributeProvider
- {
- protected MemberInfo() { }
- public static bool operator ==(System.Reflection.MemberInfo left, System.Reflection.MemberInfo right) { throw null; }
- public static bool operator !=(System.Reflection.MemberInfo left, System.Reflection.MemberInfo right) { throw null; }
- public virtual System.Collections.Generic.IEnumerable<System.Reflection.CustomAttributeData> CustomAttributes { get { throw null; } }
- public abstract System.Type DeclaringType { get; }
- public abstract System.Reflection.MemberTypes MemberType { get; }
- public virtual int MetadataToken { get { throw null; } }
- public virtual System.Reflection.Module Module { get { throw null; } }
- public abstract string Name { get; }
- public abstract System.Type ReflectedType { get; }
- public override bool Equals(object obj) { throw null; }
- public abstract object[] GetCustomAttributes(bool inherit);
- public abstract object[] GetCustomAttributes(System.Type attributeType, bool inherit);
- public virtual System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributesData() { throw null; }
- public override int GetHashCode() { throw null; }
- public abstract bool IsDefined(System.Type attributeType, bool inherit);
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum MemberTypes
- {
- All = 191,
- Constructor = 1,
- Custom = 64,
- Event = 2,
- Field = 4,
- Method = 8,
- NestedType = 128,
- Property = 16,
- TypeInfo = 32,
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum MethodAttributes
- {
- Abstract = 1024,
- Assembly = 3,
- CheckAccessOnOverride = 512,
- FamANDAssem = 2,
- Family = 4,
- FamORAssem = 5,
- Final = 32,
- HasSecurity = 16384,
- HideBySig = 128,
- MemberAccessMask = 7,
- NewSlot = 256,
- PinvokeImpl = 8192,
- Private = 1,
- PrivateScope = 0,
- Public = 6,
- RequireSecObject = 32768,
- ReservedMask = 53248,
- ReuseSlot = 0,
- RTSpecialName = 4096,
- SpecialName = 2048,
- Static = 16,
- UnmanagedExport = 8,
- Virtual = 64,
- VtableLayoutMask = 256,
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class MethodBase : System.Reflection.MemberInfo
- {
- protected MethodBase() { }
- public abstract System.Reflection.MethodAttributes Attributes { get; }
- public virtual System.Reflection.CallingConventions CallingConvention { get { throw null; } }
- public virtual bool ContainsGenericParameters { get { throw null; } }
- public bool IsAbstract { get { throw null; } }
- public bool IsAssembly { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public bool IsConstructor { get { throw null; } }
- public bool IsFamily { get { throw null; } }
- public bool IsFamilyAndAssembly { get { throw null; } }
- public bool IsFamilyOrAssembly { get { throw null; } }
- public bool IsFinal { get { throw null; } }
- public virtual bool IsGenericMethod { get { throw null; } }
- public virtual bool IsGenericMethodDefinition { get { throw null; } }
- public bool IsHideBySig { get { throw null; } }
- public bool IsPrivate { get { throw null; } }
- public bool IsPublic { get { throw null; } }
- public bool IsSpecialName { get { throw null; } }
- public bool IsStatic { get { throw null; } }
- public bool IsVirtual { get { throw null; } }
- public virtual bool IsSecurityCritical { get { throw null; } }
- public virtual bool IsSecurityTransparent { get { throw null; } }
- public abstract System.RuntimeMethodHandle MethodHandle { get; }
- public virtual System.Reflection.MethodImplAttributes MethodImplementationFlags { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public static bool operator ==(System.Reflection.MethodBase left, System.Reflection.MethodBase right) { throw null; }
- public static bool operator !=(System.Reflection.MethodBase left, System.Reflection.MethodBase right) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- public static System.Reflection.MethodBase GetCurrentMethod() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public virtual System.Type[] GetGenericArguments() { throw null; }
- public override int GetHashCode() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual System.Reflection.MethodBody GetMethodBody() { throw null; }
- public static System.Reflection.MethodBase GetMethodFromHandle(System.RuntimeMethodHandle handle) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public static System.Reflection.MethodBase GetMethodFromHandle(System.RuntimeMethodHandle handle, System.RuntimeTypeHandle declaringType) { throw null; }
- public abstract System.Reflection.MethodImplAttributes GetMethodImplementationFlags();
- public abstract System.Reflection.ParameterInfo[] GetParameters();
- [System.Diagnostics.DebuggerHiddenAttribute]
- [System.Diagnostics.DebuggerStepThroughAttribute]
- public object Invoke(object obj, object[] parameters) { throw null; }
- public abstract object Invoke(object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object[] parameters, System.Globalization.CultureInfo culture);
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public class MethodBody
- {
- protected MethodBody() { }
- public virtual int LocalSignatureMetadataToken { get { throw null; } }
- public virtual System.Collections.Generic.IList<LocalVariableInfo> LocalVariables { get { throw null; } }
- public virtual int MaxStackSize { get { throw null; } }
- public virtual bool InitLocals { get { throw null; } }
- public virtual byte[] GetILAsByteArray() { throw null; }
- public virtual System.Collections.Generic.IList<ExceptionHandlingClause> ExceptionHandlingClauses { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum MethodImplAttributes
- {
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- AggressiveInlining = 256,
- CodeTypeMask = 3,
- ForwardRef = 16,
- IL = 0,
- InternalCall = 4096,
- Managed = 0,
- ManagedMask = 4,
- MaxMethodImplVal = 65535,
- Native = 1,
- NoInlining = 8,
- NoOptimization = 64,
- OPTIL = 2,
- PreserveSig = 128,
- Runtime = 3,
- Synchronized = 32,
- Unmanaged = 4,
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class MethodInfo : System.Reflection.MethodBase
- {
- protected MethodInfo() { }
- public static bool operator ==(System.Reflection.MethodInfo left, System.Reflection.MethodInfo right) { throw null; }
- public static bool operator !=(System.Reflection.MethodInfo left, System.Reflection.MethodInfo right) { throw null; }
- public override System.Reflection.MemberTypes MemberType { get { throw null; } }
- public virtual System.Reflection.ParameterInfo ReturnParameter { get { throw null; } }
- public virtual System.Type ReturnType { get { throw null; } }
- public abstract System.Reflection.ICustomAttributeProvider ReturnTypeCustomAttributes { get; }
- public virtual System.Delegate CreateDelegate(System.Type delegateType) { throw null; }
- public virtual System.Delegate CreateDelegate(System.Type delegateType, object target) { throw null; }
- public override bool Equals(object obj) { throw null; }
- public abstract System.Reflection.MethodInfo GetBaseDefinition();
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public override System.Type[] GetGenericArguments() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public virtual System.Reflection.MethodInfo GetGenericMethodDefinition() { throw null; }
- public override int GetHashCode() { throw null; }
- public virtual System.Reflection.MethodInfo MakeGenericMethod(params System.Type[] typeArguments) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class Missing : System.Runtime.Serialization.ISerializable
- {
- internal Missing() { }
- public static readonly System.Reflection.Missing Value;
- [System.Security.SecurityCriticalAttribute]
- void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class Module : System.Reflection.ICustomAttributeProvider, System.Runtime.Serialization.ISerializable
- {
- public static readonly System.Reflection.TypeFilter FilterTypeName;
- public static readonly System.Reflection.TypeFilter FilterTypeNameIgnoreCase;
- protected Module() { }
- public static bool operator ==(System.Reflection.Module left, System.Reflection.Module right) { throw null; }
- public static bool operator !=(System.Reflection.Module left, System.Reflection.Module right) { throw null; }
- public virtual System.Reflection.Assembly Assembly { get { throw null; } }
- public System.ModuleHandle ModuleHandle { get { throw null; } }
- public virtual System.Collections.Generic.IEnumerable<System.Reflection.CustomAttributeData> CustomAttributes { get { throw null; } }
- public virtual string FullyQualifiedName { [System.Security.SecurityCriticalAttribute]get { throw null; } }
- public virtual int MDStreamVersion { get { throw null; } }
- public virtual int MetadataToken { get { throw null; } }
- public virtual System.Guid ModuleVersionId { get { throw null; } }
- public virtual string Name { get { throw null; } }
- public virtual string ScopeName { get { throw null; } }
- public override bool Equals(object o) { throw null; }
- public virtual System.Type[] FindTypes(System.Reflection.TypeFilter filter, object filterCriteria) { throw null; }
- public virtual object[] GetCustomAttributes(bool inherit) { throw null; }
- public virtual object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
- public System.Reflection.FieldInfo GetField(string name) { throw null; }
- public virtual System.Reflection.FieldInfo GetField(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
- public System.Reflection.FieldInfo[] GetFields() { throw null; }
- public virtual System.Reflection.FieldInfo[] GetFields(System.Reflection.BindingFlags bindingFlags) { throw null; }
- public override int GetHashCode() { throw null; }
- public System.Reflection.MethodInfo GetMethod(string name) { throw null; }
- public System.Reflection.MethodInfo GetMethod(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw null; }
- public System.Reflection.MethodInfo GetMethod(string name, System.Type[] types) { throw null; }
- protected virtual System.Reflection.MethodInfo GetMethodImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw null; }
- public System.Reflection.MethodInfo[] GetMethods() { throw null; }
- public virtual System.Reflection.MethodInfo[] GetMethods(System.Reflection.BindingFlags bindingFlags) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public virtual void GetPEKind(out System.Reflection.PortableExecutableKinds peKind, out System.Reflection.ImageFileMachine machine) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public virtual System.Type GetType(string className) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public virtual System.Type GetType(string className, bool ignoreCase) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public virtual System.Type GetType(string className, bool throwOnError, bool ignoreCase) { throw null; }
- public virtual System.Type[] GetTypes() { throw null; }
- public virtual bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
- public virtual bool IsResource() { throw null; }
- public virtual System.Collections.Generic.IList<CustomAttributeData> GetCustomAttributesData() { throw null; }
- public System.Reflection.FieldInfo ResolveField(int metadataToken) { throw null; }
- public virtual System.Reflection.FieldInfo ResolveField(int metadataToken, System.Type[] genericTypeArguments, System.Type[] genericMethodArguments) { throw null; }
- public System.Reflection.MemberInfo ResolveMember(int metadataToken) { throw null; }
- public virtual System.Reflection.MemberInfo ResolveMember(int metadataToken, System.Type[] genericTypeArguments, System.Type[] genericMethodArguments) { throw null; }
- public System.Reflection.MethodBase ResolveMethod(int metadataToken) { throw null; }
- public virtual System.Reflection.MethodBase ResolveMethod(int metadataToken, System.Type[] genericTypeArguments, System.Type[] genericMethodArguments) { throw null; }
- public virtual byte[] ResolveSignature(int metadataToken) { throw null; }
- public virtual string ResolveString(int metadataToken) { throw null; }
- public System.Type ResolveType(int metadataToken) { throw null; }
- public virtual System.Type ResolveType(int metadataToken, System.Type[] genericTypeArguments, System.Type[] genericMethodArguments) { throw null; }
- public override string ToString() { throw null; }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), AllowMultiple=false, Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed class ObfuscateAssemblyAttribute : System.Attribute
- {
- public ObfuscateAssemblyAttribute(bool assemblyIsPrivate) { throw null; }
- public bool AssemblyIsPrivate { get { throw null; } }
- public bool StripAfterObfuscation { get { throw null; } set { } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1) | (System.AttributeTargets)(4) | (System.AttributeTargets)(8) | (System.AttributeTargets)(64) | (System.AttributeTargets)(2048) | (System.AttributeTargets)(256) | (System.AttributeTargets)(128) | (System.AttributeTargets)(512) | (System.AttributeTargets)(1024) | (System.AttributeTargets)(16) | (System.AttributeTargets)(4096),
- AllowMultiple = true, Inherited = false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed class ObfuscationAttribute: System.Attribute
- {
- public ObfuscationAttribute() { }
- public bool StripAfterObfuscation { get { throw null; } set { } }
- public bool Exclude { get { throw null; } set { } }
- public bool ApplyToMembers { get { throw null; } set { } }
- public string Feature { get { throw null; } set { } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public delegate System.Reflection.Module ModuleResolveEventHandler(object sender, System.ResolveEventArgs e);
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum ParameterAttributes
- {
- HasDefault = 4096,
- HasFieldMarshal = 8192,
- In = 1,
- Lcid = 4,
- None = 0,
- Optional = 16,
- Out = 2,
- Reserved3 = 16384,
- Reserved4 = 32768,
- ReservedMask = 61440,
- Retval = 8,
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class ParameterInfo : System.Reflection.ICustomAttributeProvider, System.Runtime.Serialization.IObjectReference
- {
- protected String NameImpl;
- protected Type ClassImpl;
- protected int PositionImpl;
- protected System.Reflection.ParameterAttributes AttrsImpl;
- protected Object DefaultValueImpl;
- protected MemberInfo MemberImpl;
- protected ParameterInfo() { }
- public virtual System.Reflection.ParameterAttributes Attributes { get { throw null; } }
- public virtual System.Collections.Generic.IEnumerable<System.Reflection.CustomAttributeData> CustomAttributes { get { throw null; } }
- public virtual object DefaultValue { get { throw null; } }
- public virtual bool HasDefaultValue { get { throw null; } }
- public bool IsIn { get { throw null; } }
- public bool IsLcid { get { throw null; } }
- public bool IsOptional { get { throw null; } }
- public bool IsOut { get { throw null; } }
- public bool IsRetval { get { throw null; } }
- public virtual System.Reflection.MemberInfo Member { get { throw null; } }
- public virtual int MetadataToken { get { throw null; } }
- public virtual string Name { get { throw null; } }
- public virtual System.Type ParameterType { get { throw null; } }
- public virtual int Position { get { throw null; } }
- public virtual object RawDefaultValue { get { throw null; } }
- public virtual object[] GetCustomAttributes(bool inherit) { throw null; }
- public virtual object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
- public virtual System.Collections.Generic.IList<System.Reflection.CustomAttributeData> GetCustomAttributesData() { throw null; }
- public virtual System.Type[] GetOptionalCustomModifiers() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public object GetRealObject(System.Runtime.Serialization.StreamingContext context) { throw null; }
- public virtual System.Type[] GetRequiredCustomModifiers() { throw null; }
- public virtual bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
- public override string ToString() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct ParameterModifier
- {
- public ParameterModifier(int parameterCount) { throw null;}
- public bool this[int index] { get { throw null; } set { } }
- }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed class Pointer : System.Runtime.Serialization.ISerializable
- {
- private Pointer() { }
- [System.Security.SecurityCriticalAttribute]
- public static unsafe Object Box(void *ptr, System.Type type) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static unsafe void* Unbox(object ptr) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- unsafe void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum PortableExecutableKinds
- {
- NotAPortableExecutableImage = 0,
- ILOnly = 1,
- Required32Bit = 2,
- PE32Plus = 4,
- Unmanaged32Bit = 8,
- [System.Runtime.InteropServices.ComVisible(false)]
- Preferred32Bit = 16,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum ProcessorArchitecture
- {
- Amd64 = 4,
- Arm = 5,
- IA64 = 3,
- MSIL = 1,
- None = 0,
- X86 = 2,
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum PropertyAttributes
- {
- HasDefault = 4096,
- None = 0,
- Reserved2 = 8192,
- Reserved3 = 16384,
- Reserved4 = 32768,
- ReservedMask = 62464,
- RTSpecialName = 1024,
- SpecialName = 512,
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class PropertyInfo : System.Reflection.MemberInfo
- {
- protected PropertyInfo() { }
- public static bool operator ==(System.Reflection.PropertyInfo left, System.Reflection.PropertyInfo right) { throw null; }
- public static bool operator !=(System.Reflection.PropertyInfo left, System.Reflection.PropertyInfo right) { throw null; }
- public abstract System.Reflection.PropertyAttributes Attributes { get; }
- public abstract bool CanRead { get; }
- public abstract bool CanWrite { get; }
- public virtual System.Reflection.MethodInfo GetMethod { get { throw null; } }
- public bool IsSpecialName { get { throw null; } }
- public override System.Reflection.MemberTypes MemberType { get { throw null; } }
- public abstract System.Type PropertyType { get; }
- public virtual System.Reflection.MethodInfo SetMethod { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public System.Reflection.MethodInfo[] GetAccessors() { throw null; }
- public abstract System.Reflection.MethodInfo[] GetAccessors(bool nonPublic);
- public virtual object GetConstantValue() { throw null; }
- public System.Reflection.MethodInfo GetGetMethod() { throw null; }
- public abstract System.Reflection.MethodInfo GetGetMethod(bool nonPublic);
- public override int GetHashCode() { throw null; }
- public abstract System.Reflection.ParameterInfo[] GetIndexParameters();
- public virtual System.Type[] GetOptionalCustomModifiers() { throw null; }
- public virtual object GetRawConstantValue() { throw null; }
- public virtual System.Type[] GetRequiredCustomModifiers() { throw null; }
- public System.Reflection.MethodInfo GetSetMethod() { throw null; }
- public abstract System.Reflection.MethodInfo GetSetMethod(bool nonPublic);
- [System.Diagnostics.DebuggerHiddenAttribute]
- [System.Diagnostics.DebuggerStepThroughAttribute]
- public object GetValue(object obj) { throw null; }
- [System.Diagnostics.DebuggerHiddenAttribute]
- [System.Diagnostics.DebuggerStepThroughAttribute]
- public virtual object GetValue(object obj, object[] index) { throw null; }
- public abstract object GetValue(object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object[] index, System.Globalization.CultureInfo culture);
- [System.Diagnostics.DebuggerHiddenAttribute]
- [System.Diagnostics.DebuggerStepThroughAttribute]
- public void SetValue(object obj, object value) { }
- [System.Diagnostics.DebuggerHiddenAttribute]
- [System.Diagnostics.DebuggerStepThroughAttribute]
- public virtual void SetValue(object obj, object value, object[] index) { }
- public abstract void SetValue(object obj, object value, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object[] index, System.Globalization.CultureInfo culture);
- }
- public abstract partial class ReflectionContext
- {
- protected ReflectionContext() { }
- public virtual System.Reflection.TypeInfo GetTypeForObject(object value) { throw null; }
- public abstract System.Reflection.Assembly MapAssembly(System.Reflection.Assembly assembly);
- public abstract System.Reflection.TypeInfo MapType(System.Reflection.TypeInfo type);
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class ReflectionTypeLoadException : System.SystemException, System.Runtime.Serialization.ISerializable
- {
- public ReflectionTypeLoadException(System.Type[] classes, System.Exception[] exceptions) { }
- public ReflectionTypeLoadException(System.Type[] classes, System.Exception[] exceptions, string message) { }
- public System.Exception[] LoaderExceptions { get { throw null; } }
- public System.Type[] Types { get { throw null; } }
- [System.Security.SecurityCriticalAttribute]
- public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum ResourceAttributes
- {
- Private = 2,
- Public = 1,
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum ResourceLocation
- {
- ContainedInAnotherAssembly = 2,
- ContainedInManifestFile = 4,
- Embedded = 1,
- }
- public static partial class RuntimeReflectionExtensions
- {
- public static System.Reflection.MethodInfo GetMethodInfo(this System.Delegate del) { throw null; }
- public static System.Reflection.MethodInfo GetRuntimeBaseDefinition(this System.Reflection.MethodInfo method) { throw null; }
- public static System.Reflection.EventInfo GetRuntimeEvent(this System.Type type, string name) { throw null; }
- public static System.Collections.Generic.IEnumerable<System.Reflection.EventInfo> GetRuntimeEvents(this System.Type type) { throw null; }
- public static System.Reflection.FieldInfo GetRuntimeField(this System.Type type, string name) { throw null; }
- public static System.Collections.Generic.IEnumerable<System.Reflection.FieldInfo> GetRuntimeFields(this System.Type type) { throw null; }
- public static System.Reflection.InterfaceMapping GetRuntimeInterfaceMap(this System.Reflection.TypeInfo typeInfo, System.Type interfaceType) { throw null; }
- public static System.Reflection.MethodInfo GetRuntimeMethod(this System.Type type, string name, System.Type[] parameters) { throw null; }
- public static System.Collections.Generic.IEnumerable<System.Reflection.MethodInfo> GetRuntimeMethods(this System.Type type) { throw null; }
- public static System.Collections.Generic.IEnumerable<System.Reflection.PropertyInfo> GetRuntimeProperties(this System.Type type) { throw null; }
- public static System.Reflection.PropertyInfo GetRuntimeProperty(this System.Type type, string name) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class TargetException : System.ApplicationException
- {
- public TargetException() { }
- public TargetException(string message) { }
- public TargetException(string message, System.Exception inner) { }
- protected TargetException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class TargetInvocationException : System.ApplicationException
- {
- public TargetInvocationException(System.Exception inner) { }
- public TargetInvocationException(string message, System.Exception inner) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class TargetParameterCountException : System.ApplicationException
- {
- public TargetParameterCountException() { }
- public TargetParameterCountException(string message) { }
- public TargetParameterCountException(string message, System.Exception inner) { }
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum TypeAttributes
- {
- Abstract = 128,
- AnsiClass = 0,
- AutoClass = 131072,
- AutoLayout = 0,
- BeforeFieldInit = 1048576,
- Class = 0,
- ClassSemanticsMask = 32,
- CustomFormatClass = 196608,
- CustomFormatMask = 12582912,
- ExplicitLayout = 16,
- HasSecurity = 262144,
- Import = 4096,
- Interface = 32,
- LayoutMask = 24,
- NestedAssembly = 5,
- NestedFamANDAssem = 6,
- NestedFamily = 4,
- NestedFamORAssem = 7,
- NestedPrivate = 3,
- NestedPublic = 2,
- NotPublic = 0,
- Public = 1,
- ReservedMask = 264192,
- RTSpecialName = 2048,
- Sealed = 256,
- SequentialLayout = 8,
- Serializable = 8192,
- SpecialName = 1024,
- StringFormatMask = 196608,
- UnicodeClass = 65536,
- VisibilityMask = 7,
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- WindowsRuntime = 16384,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public class TypeDelegator : System.Reflection.TypeInfo
- {
- protected System.Type typeImpl;
- public override bool IsAssignableFrom(System.Reflection.TypeInfo typeInfo) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- protected TypeDelegator() { }
- public TypeDelegator(System.Type delegatingType) { }
- public override System.Guid GUID { get { throw null; } }
- public override int MetadataToken { get { throw null; } }
- public override object InvokeMember(System.String name,System.Reflection.BindingFlags invokeAttr,System.Reflection.Binder binder,System.Object target, System.Object[] args,System.Reflection.ParameterModifier[] modifiers,System.Globalization.CultureInfo culture,System.String[] namedParameters) { throw null; }
- public override System.Reflection.Module Module { get { throw null; } }
- public override System.Reflection.Assembly Assembly { get { throw null; } }
- public override System.RuntimeTypeHandle TypeHandle { get { throw null; } }
- public override System.String Name { get { throw null; } }
- public override System.String FullName { get { throw null; } }
- public override System.String Namespace { get { throw null; } }
- public override System.String AssemblyQualifiedName { get { throw null; } }
- public override System.Type BaseType { get { throw null; } }
- protected override System.Reflection.ConstructorInfo GetConstructorImpl(System.Reflection.BindingFlags bindingAttr,System.Reflection.Binder binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public override System.Reflection.ConstructorInfo[] GetConstructors(System.Reflection.BindingFlags bindingAttr) { throw null; }
- protected override System.Reflection.MethodInfo GetMethodImpl(System.String name,System.Reflection.BindingFlags bindingAttr,System.Reflection.Binder binder, System.Reflection.CallingConventions callConvention, System.Type[] types,System.Reflection.ParameterModifier[] modifiers) { throw null; }
- public override System.Reflection.MethodInfo[] GetMethods(System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Reflection.FieldInfo GetField(System.String name, System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Reflection.FieldInfo[] GetFields(System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Type GetInterface(System.String name, bool ignoreCase) { throw null; }
- public override System.Type[] GetInterfaces() { throw null; }
- public override System.Reflection.EventInfo GetEvent(System.String name,System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Reflection.EventInfo[] GetEvents() { throw null; }
- protected override System.Reflection.PropertyInfo GetPropertyImpl(System.String name,System.Reflection.BindingFlags bindingAttr,System.Reflection.Binder binder, System.Type returnType, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw null; }
- public override System.Reflection.PropertyInfo[] GetProperties(System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Reflection.EventInfo[] GetEvents(System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Type[] GetNestedTypes(System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Type GetNestedType(System.String name, System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Reflection.MemberInfo[] GetMember(System.String name, System.Reflection.MemberTypes type, System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Reflection.MemberInfo[] GetMembers(System.Reflection.BindingFlags bindingAttr) { throw null; }
- protected override TypeAttributes GetAttributeFlagsImpl() { throw null; }
- protected override bool IsArrayImpl() { throw null; }
- protected override bool IsPrimitiveImpl() { throw null; }
- protected override bool IsByRefImpl() { throw null; }
- protected override bool IsPointerImpl() { throw null; }
- protected override bool IsValueTypeImpl() { throw null; }
- protected override bool IsCOMObjectImpl() { throw null; }
- public override bool IsConstructedGenericType { get { throw null; } }
- public override System.Type GetElementType() { throw null; }
- protected override bool HasElementTypeImpl() { throw null; }
- public override System.Type UnderlyingSystemType { get { throw null; } }
- public override System.Object[] GetCustomAttributes(bool inherit) { throw null; }
- public override System.Object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
- public override bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public override System.Reflection.InterfaceMapping GetInterfaceMap(System.Type interfaceType) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public delegate bool TypeFilter(System.Type m, object filterCriteria);
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class TypeInfo : System.Type, System.Reflection.IReflectableType
- {
- internal TypeInfo() { }
- public virtual System.Collections.Generic.IEnumerable<System.Reflection.ConstructorInfo> DeclaredConstructors { get { throw null; } }
- public virtual System.Collections.Generic.IEnumerable<System.Reflection.EventInfo> DeclaredEvents { get { throw null; } }
- public virtual System.Collections.Generic.IEnumerable<System.Reflection.FieldInfo> DeclaredFields { get { throw null; } }
- public virtual System.Collections.Generic.IEnumerable<System.Reflection.MemberInfo> DeclaredMembers { get { throw null; } }
- public virtual System.Collections.Generic.IEnumerable<System.Reflection.MethodInfo> DeclaredMethods { get { throw null; } }
- public virtual System.Collections.Generic.IEnumerable<System.Reflection.TypeInfo> DeclaredNestedTypes { get { throw null; } }
- public virtual System.Collections.Generic.IEnumerable<System.Reflection.PropertyInfo> DeclaredProperties { get { throw null; } }
- public virtual System.Type[] GenericTypeParameters { get { throw null; } }
- public virtual System.Collections.Generic.IEnumerable<System.Type> ImplementedInterfaces { get { throw null; } }
- public virtual System.Type AsType() { throw null; }
- public virtual System.Reflection.EventInfo GetDeclaredEvent(string name) { throw null; }
- public virtual System.Reflection.FieldInfo GetDeclaredField(string name) { throw null; }
- public virtual System.Reflection.MethodInfo GetDeclaredMethod(string name) { throw null; }
- public virtual System.Collections.Generic.IEnumerable<System.Reflection.MethodInfo> GetDeclaredMethods(string name) { throw null; }
- public virtual System.Reflection.TypeInfo GetDeclaredNestedType(string name) { throw null; }
- public virtual System.Reflection.PropertyInfo GetDeclaredProperty(string name) { throw null; }
- public virtual bool IsAssignableFrom(System.Reflection.TypeInfo typeInfo) { throw null; }
- System.Reflection.TypeInfo System.Reflection.IReflectableType.GetTypeInfo() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class StrongNameKeyPair : System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
- {
- public StrongNameKeyPair(byte[] keyPairArray) { }
- protected StrongNameKeyPair(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public StrongNameKeyPair(string keyPairContainer) { }
- public byte[] PublicKey { [System.Security.SecuritySafeCriticalAttribute]get { return default(byte[]); } }
- void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(object sender) { }
- void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- }
-}
-namespace System.Reflection.Emit
-{
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AssemblyBuilder : System.Reflection.Assembly
- {
- internal AssemblyBuilder() { }
- public override string CodeBase { [System.Security.SecurityCriticalAttribute]get { throw null; } }
- public override System.Reflection.MethodInfo EntryPoint { get { throw null; } }
- public override string FullName { get { throw null; } }
- public override string ImageRuntimeVersion { get { throw null; } }
- public override bool IsDynamic { get { throw null; } }
- public override string Location { [System.Security.SecurityCriticalAttribute]get { throw null; } }
- public override System.Reflection.Module ManifestModule { get { throw null; } }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecuritySafeCriticalAttribute]
- public static System.Reflection.Emit.AssemblyBuilder DefineDynamicAssembly(System.Reflection.AssemblyName name, System.Reflection.Emit.AssemblyBuilderAccess access) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecuritySafeCriticalAttribute]
- public static System.Reflection.Emit.AssemblyBuilder DefineDynamicAssembly(System.Reflection.AssemblyName name, System.Reflection.Emit.AssemblyBuilderAccess access, System.Collections.Generic.IEnumerable<System.Reflection.Emit.CustomAttributeBuilder> assemblyAttributes) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.ModuleBuilder DefineDynamicModule(string name) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.ModuleBuilder DefineDynamicModule(string name, bool emitSymbolInfo) { throw null; }
- public override bool Equals(object obj) { throw null; }
- public override object[] GetCustomAttributes(bool inherit) { throw null; }
- public override object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
- public System.Reflection.Emit.ModuleBuilder GetDynamicModule(string name) { throw null; }
- public override System.Type[] GetExportedTypes() { throw null; }
- public override int GetHashCode() { throw null; }
- public override System.Reflection.ManifestResourceInfo GetManifestResourceInfo(string resourceName) { throw null; }
- public override string[] GetManifestResourceNames() { throw null; }
- public override System.IO.Stream GetManifestResourceStream(string name) { throw null; }
- public override System.IO.Stream GetManifestResourceStream(System.Type type, string name) { throw null; }
- public override System.Reflection.AssemblyName[] GetReferencedAssemblies() { throw null; }
- public override System.Type GetType(string name, bool throwOnError, bool ignoreCase) { throw null; }
- public override bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecurityCriticalAttribute]
- public void SetCustomAttribute(System.Reflection.ConstructorInfo con, byte[] binaryAttribute) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder customBuilder) { }
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum AssemblyBuilderAccess
- {
- Run = 1,
- RunAndCollect = 9,
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class ConstructorBuilder : System.Reflection.ConstructorInfo
- {
- internal ConstructorBuilder() { }
- public override System.Reflection.MethodAttributes Attributes { get { throw null; } }
- public override System.Reflection.CallingConventions CallingConvention { get { throw null; } }
- public override System.Type DeclaringType { get { throw null; } }
- public bool InitLocals { get { throw null; } set { } }
- public override System.RuntimeMethodHandle MethodHandle { get { throw null; } }
- public override System.Reflection.Module Module { get { throw null; } }
- public override string Name { get { throw null; } }
- public override System.Type ReflectedType { get { throw null; } }
- public string Signature { get { throw null; } }
- public System.Reflection.Emit.ParameterBuilder DefineParameter(int iSequence, System.Reflection.ParameterAttributes attributes, string strParamName) { throw null; }
- public override object[] GetCustomAttributes(bool inherit) { throw null; }
- public override object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
- public System.Reflection.Emit.ILGenerator GetILGenerator() { throw null; }
- public System.Reflection.Emit.ILGenerator GetILGenerator(int streamSize) { throw null; }
- public override System.Reflection.MethodImplAttributes GetMethodImplementationFlags() { throw null; }
- public System.Reflection.Module GetModule() { throw null; }
- public override System.Reflection.ParameterInfo[] GetParameters() { throw null; }
- public System.Reflection.Emit.MethodToken GetToken() { throw null; }
- public override object Invoke(object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object[] parameters, System.Globalization.CultureInfo culture) { throw null; }
- public override object Invoke(System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object[] parameters, System.Globalization.CultureInfo culture) { throw null; }
- public override bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecurityCriticalAttribute]
- public void SetCustomAttribute(System.Reflection.ConstructorInfo con, byte[] binaryAttribute) { }
- public void SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder customBuilder) { }
- public void SetImplementationFlags(System.Reflection.MethodImplAttributes attributes) { }
- public override string ToString() { throw null; }
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class CustomAttributeBuilder
- {
- public CustomAttributeBuilder(System.Reflection.ConstructorInfo con, object[] constructorArgs) { }
- public CustomAttributeBuilder(System.Reflection.ConstructorInfo con, object[] constructorArgs, System.Reflection.FieldInfo[] namedFields, object[] fieldValues) { }
- public CustomAttributeBuilder(System.Reflection.ConstructorInfo con, object[] constructorArgs, System.Reflection.PropertyInfo[] namedProperties, object[] propertyValues) { }
- public CustomAttributeBuilder(System.Reflection.ConstructorInfo con, object[] constructorArgs, System.Reflection.PropertyInfo[] namedProperties, object[] propertyValues, System.Reflection.FieldInfo[] namedFields, object[] fieldValues) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class DynamicMethod : System.Reflection.MethodInfo
- {
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecurityCriticalAttribute]
- public DynamicMethod(string name, System.Reflection.MethodAttributes attributes, System.Reflection.CallingConventions callingConvention, System.Type returnType, System.Type[] parameterTypes, System.Reflection.Module m, bool skipVisibility) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecurityCriticalAttribute]
- public DynamicMethod(string name, System.Reflection.MethodAttributes attributes, System.Reflection.CallingConventions callingConvention, System.Type returnType, System.Type[] parameterTypes, System.Type owner, bool skipVisibility) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecuritySafeCriticalAttribute]
- public DynamicMethod(string name, System.Type returnType, System.Type[] parameterTypes) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecuritySafeCriticalAttribute]
- public DynamicMethod(string name, System.Type returnType, System.Type[] parameterTypes, bool restrictedSkipVisibility) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecurityCriticalAttribute]
- public DynamicMethod(string name, System.Type returnType, System.Type[] parameterTypes, System.Reflection.Module m) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecurityCriticalAttribute]
- public DynamicMethod(string name, System.Type returnType, System.Type[] parameterTypes, System.Reflection.Module m, bool skipVisibility) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecurityCriticalAttribute]
- public DynamicMethod(string name, System.Type returnType, System.Type[] parameterTypes, System.Type owner) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecurityCriticalAttribute]
- public DynamicMethod(string name, System.Type returnType, System.Type[] parameterTypes, System.Type owner, bool skipVisibility) { }
- public override System.Reflection.MethodAttributes Attributes { get { throw null; } }
- public override System.Reflection.CallingConventions CallingConvention { get { throw null; } }
- public override System.Type DeclaringType { get { throw null; } }
- public bool InitLocals { get { throw null; } set { } }
- public override System.RuntimeMethodHandle MethodHandle { get { throw null; } }
- public override System.Reflection.Module Module { get { throw null; } }
- public override string Name { get { throw null; } }
- public override System.Type ReflectedType { get { throw null; } }
- public override System.Reflection.ParameterInfo ReturnParameter { get { throw null; } }
- public override System.Type ReturnType { get { throw null; } }
- public override System.Reflection.ICustomAttributeProvider ReturnTypeCustomAttributes { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecuritySafeCriticalAttribute]
- public sealed override System.Delegate CreateDelegate(System.Type delegateType) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecuritySafeCriticalAttribute]
- public sealed override System.Delegate CreateDelegate(System.Type delegateType, object target) { throw null; }
- public System.Reflection.Emit.ParameterBuilder DefineParameter(int position, System.Reflection.ParameterAttributes attributes, string parameterName) { throw null; }
- public override System.Reflection.MethodInfo GetBaseDefinition() { throw null; }
- public override object[] GetCustomAttributes(bool inherit) { throw null; }
- public override object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
- public System.Reflection.Emit.ILGenerator GetILGenerator() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.ILGenerator GetILGenerator(int streamSize) { throw null; }
- public override System.Reflection.MethodImplAttributes GetMethodImplementationFlags() { throw null; }
- public override System.Reflection.ParameterInfo[] GetParameters() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override object Invoke(object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object[] parameters, System.Globalization.CultureInfo culture) { throw null; }
- public override bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
- public override string ToString() { throw null; }
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class EnumBuilder : System.Reflection.TypeInfo
- {
- internal EnumBuilder() { }
- public override System.Reflection.Assembly Assembly { get { throw null; } }
- public override string AssemblyQualifiedName { get { throw null; } }
- public override System.Type BaseType { get { throw null; } }
- public override System.Type DeclaringType { get { throw null; } }
- public override string FullName { get { throw null; } }
- public override System.Guid GUID { get { throw null; } }
- public override bool IsConstructedGenericType { get { throw null; } }
- public override System.Reflection.Module Module { get { throw null; } }
- public override string Name { get { throw null; } }
- public override string Namespace { get { throw null; } }
- public override System.Type ReflectedType { get { throw null; } }
- public override System.RuntimeTypeHandle TypeHandle { get { throw null; } }
- public System.Reflection.Emit.TypeToken TypeToken { get { throw null; } }
- public System.Reflection.Emit.FieldBuilder UnderlyingField { get { throw null; } }
- public override System.Type UnderlyingSystemType { get { throw null; } }
- public System.Type CreateType() { throw null; }
- public System.Reflection.TypeInfo CreateTypeInfo() { throw null; }
- public System.Reflection.Emit.FieldBuilder DefineLiteral(string literalName, object literalValue) { throw null; }
- protected override System.Reflection.TypeAttributes GetAttributeFlagsImpl() { throw null; }
- protected override System.Reflection.ConstructorInfo GetConstructorImpl(System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public override System.Reflection.ConstructorInfo[] GetConstructors(System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override object[] GetCustomAttributes(bool inherit) { throw null; }
- public override object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
- public override System.Type GetElementType() { throw null; }
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Contracts", "CC1055")]
- public override System.Type GetEnumUnderlyingType() { throw null; }
- public override System.Reflection.EventInfo GetEvent(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Reflection.EventInfo[] GetEvents() { throw null; }
- public override System.Reflection.EventInfo[] GetEvents(System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Reflection.FieldInfo GetField(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Reflection.FieldInfo[] GetFields(System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Type GetInterface(string name, bool ignoreCase) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public override System.Reflection.InterfaceMapping GetInterfaceMap(System.Type interfaceType) { throw null; }
- public override System.Type[] GetInterfaces() { throw null; }
- public override System.Reflection.MemberInfo[] GetMember(string name, System.Reflection.MemberTypes type, System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Reflection.MemberInfo[] GetMembers(System.Reflection.BindingFlags bindingAttr) { throw null; }
- protected override System.Reflection.MethodInfo GetMethodImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw null; }
- public override System.Reflection.MethodInfo[] GetMethods(System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Type GetNestedType(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Type[] GetNestedTypes(System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Reflection.PropertyInfo[] GetProperties(System.Reflection.BindingFlags bindingAttr) { throw null; }
- protected override System.Reflection.PropertyInfo GetPropertyImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Type returnType, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw null; }
- protected override bool HasElementTypeImpl() { throw null; }
- public override object InvokeMember(string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object target, object[] args, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, string[] namedParameters) { throw null; }
- protected override bool IsArrayImpl() { throw null; }
- public override bool IsAssignableFrom(System.Reflection.TypeInfo typeInfo) { throw null; }
- protected override bool IsByRefImpl() { throw null; }
- protected override bool IsCOMObjectImpl() { throw null; }
- public override bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
- protected override bool IsPointerImpl() { throw null; }
- protected override bool IsPrimitiveImpl() { throw null; }
- protected override bool IsValueTypeImpl() { throw null; }
- public override System.Type MakeArrayType() { throw null; }
- public override System.Type MakeArrayType(int rank) { throw null; }
- public override System.Type MakeByRefType() { throw null; }
- public override System.Type MakePointerType() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecurityCriticalAttribute]
- public void SetCustomAttribute(System.Reflection.ConstructorInfo con, byte[] binaryAttribute) { }
- public void SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder customBuilder) { }
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class EventBuilder
- {
- internal EventBuilder() { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void AddOtherMethod(System.Reflection.Emit.MethodBuilder mdBuilder) { }
- public System.Reflection.Emit.EventToken GetEventToken() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public void SetAddOnMethod(System.Reflection.Emit.MethodBuilder mdBuilder) { }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecurityCriticalAttribute]
- public void SetCustomAttribute(System.Reflection.ConstructorInfo con, byte[] binaryAttribute) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder customBuilder) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void SetRaiseMethod(System.Reflection.Emit.MethodBuilder mdBuilder) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void SetRemoveOnMethod(System.Reflection.Emit.MethodBuilder mdBuilder) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct EventToken
- {
- public static readonly System.Reflection.Emit.EventToken Empty;
- public int Token { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public bool Equals(System.Reflection.Emit.EventToken obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public static bool operator ==(System.Reflection.Emit.EventToken a, System.Reflection.Emit.EventToken b) { throw null; }
- public static bool operator !=(System.Reflection.Emit.EventToken a, System.Reflection.Emit.EventToken b) { throw null; }
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class FieldBuilder : System.Reflection.FieldInfo
- {
- internal FieldBuilder() { }
- public override System.Reflection.FieldAttributes Attributes { get { throw null; } }
- public override System.Type DeclaringType { get { throw null; } }
- public override System.RuntimeFieldHandle FieldHandle { get { throw null; } }
- public override System.Type FieldType { get { throw null; } }
- public override System.Reflection.Module Module { get { throw null; } }
- public override string Name { get { throw null; } }
- public override System.Type ReflectedType { get { throw null; } }
- public override object[] GetCustomAttributes(bool inherit) { throw null; }
- public override object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
- public System.Reflection.Emit.FieldToken GetToken() { throw null; }
- public override object GetValue(object obj) { throw null; }
- public override bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public void SetConstant(object defaultValue) { }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecurityCriticalAttribute]
- public void SetCustomAttribute(System.Reflection.ConstructorInfo con, byte[] binaryAttribute) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder customBuilder) { }
- [System.Security.SecurityCriticalAttribute]
- public void SetOffset(int iOffset) { }
- public override void SetValue(object obj, object val, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Globalization.CultureInfo culture) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct FieldToken
- {
- public static readonly System.Reflection.Emit.FieldToken Empty;
- public int Token { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public bool Equals(System.Reflection.Emit.FieldToken obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public static bool operator ==(System.Reflection.Emit.FieldToken a, System.Reflection.Emit.FieldToken b) { throw null; }
- public static bool operator !=(System.Reflection.Emit.FieldToken a, System.Reflection.Emit.FieldToken b) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum FlowControl
- {
- Branch = 0,
- Break = 1,
- Call = 2,
- Cond_Branch = 3,
- Meta = 4,
- Next = 5,
- [Obsolete("This API has been deprecated. http://go.microsoft.com/fwlink/?linkid=14202")]
- Phi = 6,
- Return = 7,
- Throw = 8,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class GenericTypeParameterBuilder : System.Reflection.TypeInfo
- {
- internal GenericTypeParameterBuilder() { }
- public override System.Reflection.Assembly Assembly { get { throw null; } }
- public override string AssemblyQualifiedName { get { throw null; } }
- public override System.Type BaseType { get { throw null; } }
- public override bool ContainsGenericParameters { get { throw null; } }
- public override System.Reflection.MethodBase DeclaringMethod { get { throw null; } }
- public override System.Type DeclaringType { get { throw null; } }
- public override string FullName { get { throw null; } }
- public override System.Reflection.GenericParameterAttributes GenericParameterAttributes { get { throw null; } }
- public override int GenericParameterPosition { get { throw null; } }
- public override System.Guid GUID { get { throw null; } }
- public override bool IsConstructedGenericType { get { throw null; } }
- public override bool IsGenericParameter { get { throw null; } }
- public override bool IsGenericType { get { throw null; } }
- public override bool IsGenericTypeDefinition { get { throw null; } }
- public override System.Reflection.Module Module { get { throw null; } }
- public override string Name { get { throw null; } }
- public override string Namespace { get { throw null; } }
- public override System.Type ReflectedType { get { throw null; } }
- public override System.RuntimeTypeHandle TypeHandle { get { throw null; } }
- public override System.Type UnderlyingSystemType { get { throw null; } }
- public override bool Equals(object o) { throw null; }
- protected override System.Reflection.TypeAttributes GetAttributeFlagsImpl() { throw null; }
- protected override System.Reflection.ConstructorInfo GetConstructorImpl(System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public override System.Reflection.ConstructorInfo[] GetConstructors(System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override object[] GetCustomAttributes(bool inherit) { throw null; }
- public override object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
- public override System.Type GetElementType() { throw null; }
- public override System.Reflection.EventInfo GetEvent(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Reflection.EventInfo[] GetEvents() { throw null; }
- public override System.Reflection.EventInfo[] GetEvents(System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Reflection.FieldInfo GetField(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Reflection.FieldInfo[] GetFields(System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Type[] GetGenericArguments() { throw null; }
- public override System.Type GetGenericTypeDefinition() { throw null; }
- public override int GetHashCode() { throw null; }
- public override System.Type GetInterface(string name, bool ignoreCase) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public override System.Reflection.InterfaceMapping GetInterfaceMap(System.Type interfaceType) { throw null; }
- public override System.Type[] GetInterfaces() { throw null; }
- public override System.Reflection.MemberInfo[] GetMember(string name, System.Reflection.MemberTypes type, System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Reflection.MemberInfo[] GetMembers(System.Reflection.BindingFlags bindingAttr) { throw null; }
- protected override System.Reflection.MethodInfo GetMethodImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw null; }
- public override System.Reflection.MethodInfo[] GetMethods(System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Type GetNestedType(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Type[] GetNestedTypes(System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Reflection.PropertyInfo[] GetProperties(System.Reflection.BindingFlags bindingAttr) { throw null; }
- protected override System.Reflection.PropertyInfo GetPropertyImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Type returnType, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw null; }
- protected override bool HasElementTypeImpl() { throw null; }
- public override object InvokeMember(string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object target, object[] args, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, string[] namedParameters) { throw null; }
- protected override bool IsArrayImpl() { throw null; }
- public override bool IsAssignableFrom(System.Reflection.TypeInfo typeInfo) { throw null; }
- public override bool IsAssignableFrom(System.Type c) { throw null; }
- protected override bool IsByRefImpl() { throw null; }
- protected override bool IsCOMObjectImpl() { throw null; }
- public override bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
- protected override bool IsPointerImpl() { throw null; }
- protected override bool IsPrimitiveImpl() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public override bool IsSubclassOf(System.Type c) { throw null; }
- protected override bool IsValueTypeImpl() { throw null; }
- public override System.Type MakeArrayType() { throw null; }
- public override System.Type MakeArrayType(int rank) { throw null; }
- public override System.Type MakeByRefType() { throw null; }
- public override System.Type MakeGenericType(params System.Type[] typeArguments) { throw null; }
- public override System.Type MakePointerType() { throw null; }
- public void SetBaseTypeConstraint(System.Type baseTypeConstraint) { }
- [System.Security.SecurityCriticalAttribute]
- public void SetCustomAttribute(System.Reflection.ConstructorInfo con, byte[] binaryAttribute) { }
- public void SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder customBuilder) { }
- public void SetGenericParameterAttributes(System.Reflection.GenericParameterAttributes genericParameterAttributes) { }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public void SetInterfaceConstraints(params System.Type[] interfaceConstraints) { }
- public override string ToString() { throw null; }
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class ILGenerator
- {
- internal ILGenerator() { }
- public virtual int ILOffset { get { throw null; } }
- public virtual void BeginCatchBlock(System.Type exceptionType) { }
- public virtual void BeginExceptFilterBlock() { }
- public virtual System.Reflection.Emit.Label BeginExceptionBlock() { throw null; }
- public virtual void BeginFaultBlock() { }
- public virtual void BeginFinallyBlock() { }
- public virtual void BeginScope() { }
- public virtual System.Reflection.Emit.LocalBuilder DeclareLocal(System.Type localType) { throw null; }
- public virtual System.Reflection.Emit.LocalBuilder DeclareLocal(System.Type localType, bool pinned) { throw null; }
- public virtual System.Reflection.Emit.Label DefineLabel() { throw null; }
- public virtual void Emit(System.Reflection.Emit.OpCode opcode) { }
- public virtual void Emit(System.Reflection.Emit.OpCode opcode, byte arg) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual void Emit(System.Reflection.Emit.OpCode opcode, double arg) { }
- public virtual void Emit(System.Reflection.Emit.OpCode opcode, short arg) { }
- public virtual void Emit(System.Reflection.Emit.OpCode opcode, int arg) { }
- public virtual void Emit(System.Reflection.Emit.OpCode opcode, long arg) { }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual void Emit(System.Reflection.Emit.OpCode opcode, System.Reflection.ConstructorInfo con) { }
- public virtual void Emit(System.Reflection.Emit.OpCode opcode, System.Reflection.Emit.Label label) { }
- public virtual void Emit(System.Reflection.Emit.OpCode opcode, System.Reflection.Emit.Label[] labels) { }
- public virtual void Emit(System.Reflection.Emit.OpCode opcode, System.Reflection.Emit.LocalBuilder local) { }
- public virtual void Emit(System.Reflection.Emit.OpCode opcode, System.Reflection.Emit.SignatureHelper signature) { }
- public virtual void Emit(System.Reflection.Emit.OpCode opcode, System.Reflection.FieldInfo field) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual void Emit(System.Reflection.Emit.OpCode opcode, System.Reflection.MethodInfo meth) { }
- [System.CLSCompliantAttribute(false)]
- public void Emit(System.Reflection.Emit.OpCode opcode, sbyte arg) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual void Emit(System.Reflection.Emit.OpCode opcode, float arg) { }
- public virtual void Emit(System.Reflection.Emit.OpCode opcode, string str) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual void Emit(System.Reflection.Emit.OpCode opcode, System.Type cls) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual void EmitCall(System.Reflection.Emit.OpCode opcode, System.Reflection.MethodInfo methodInfo, System.Type[] optionalParameterTypes) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual void EmitCalli(System.Reflection.Emit.OpCode opcode, System.Reflection.CallingConventions callingConvention, System.Type returnType, System.Type[] parameterTypes, System.Type[] optionalParameterTypes) { }
- public virtual void EmitWriteLine(System.Reflection.Emit.LocalBuilder localBuilder) { }
- public virtual void EmitWriteLine(System.Reflection.FieldInfo fld) { }
- public virtual void EmitWriteLine(string value) { }
- public virtual void EndExceptionBlock() { }
- public virtual void EndScope() { }
- public virtual void MarkLabel(System.Reflection.Emit.Label loc) { }
- public virtual void MarkSequencePoint(System.Diagnostics.SymbolStore.ISymbolDocumentWriter document, int startLine, int startColumn, int endLine, int endColumn) { }
- public virtual void ThrowException(System.Type excType) { }
- public virtual void UsingNamespace(string usingNamespace) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct Label
- {
- public override bool Equals(object obj) { throw null; }
- public bool Equals(System.Reflection.Emit.Label obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public static bool operator ==(System.Reflection.Emit.Label a, System.Reflection.Emit.Label b) { throw null; }
- public static bool operator !=(System.Reflection.Emit.Label a, System.Reflection.Emit.Label b) { throw null; }
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class LocalBuilder : System.Reflection.LocalVariableInfo
- {
- internal LocalBuilder() { }
- public override bool IsPinned { get { throw null; } }
- public override int LocalIndex { get { throw null; } }
- public override System.Type LocalType { get { throw null; } }
- public void SetLocalSymInfo(string name) { }
- public void SetLocalSymInfo(string name, int startOffset, int endOffset) { }
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class MethodBuilder : System.Reflection.MethodInfo
- {
- internal MethodBuilder() { }
- public override System.Reflection.MethodAttributes Attributes { get { throw null; } }
- public override System.Reflection.CallingConventions CallingConvention { get { throw null; } }
- public override bool ContainsGenericParameters { get { throw null; } }
- public override System.Type DeclaringType { get { throw null; } }
- public bool InitLocals { get { throw null; } set { } }
- public override bool IsGenericMethod { get { throw null; } }
- public override bool IsGenericMethodDefinition { get { throw null; } }
- public override System.RuntimeMethodHandle MethodHandle { get { throw null; } }
- public override System.Reflection.Module Module { get { throw null; } }
- public override string Name { get { throw null; } }
- public override System.Type ReflectedType { get { throw null; } }
- public override System.Reflection.ParameterInfo ReturnParameter { get { throw null; } }
- public override System.Type ReturnType { get { throw null; } }
- public override System.Reflection.ICustomAttributeProvider ReturnTypeCustomAttributes { get { throw null; } }
- public string Signature { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public System.Reflection.Emit.GenericTypeParameterBuilder[] DefineGenericParameters(params string[] names) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.ParameterBuilder DefineParameter(int position, System.Reflection.ParameterAttributes attributes, string strParamName) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override bool Equals(object obj) { throw null; }
- public override System.Reflection.MethodInfo GetBaseDefinition() { throw null; }
- public override object[] GetCustomAttributes(bool inherit) { throw null; }
- public override object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
- public override System.Type[] GetGenericArguments() { throw null; }
- public override System.Reflection.MethodInfo GetGenericMethodDefinition() { throw null; }
- public override int GetHashCode() { throw null; }
- public System.Reflection.Emit.ILGenerator GetILGenerator() { throw null; }
- public System.Reflection.Emit.ILGenerator GetILGenerator(int size) { throw null; }
- public override System.Reflection.MethodImplAttributes GetMethodImplementationFlags() { throw null; }
- public System.Reflection.Module GetModule() { throw null; }
- public override System.Reflection.ParameterInfo[] GetParameters() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.MethodToken GetToken() { throw null; }
- public override object Invoke(object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object[] parameters, System.Globalization.CultureInfo culture) { throw null; }
- public override bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
- public override System.Reflection.MethodInfo MakeGenericMethod(params System.Type[] typeArguments) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecurityCriticalAttribute]
- public void SetCustomAttribute(System.Reflection.ConstructorInfo con, byte[] binaryAttribute) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder customBuilder) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void SetImplementationFlags(System.Reflection.MethodImplAttributes attributes) { }
- public void SetParameters(params System.Type[] parameterTypes) { }
- public void SetReturnType(System.Type returnType) { }
- public void SetSignature(System.Type returnType, System.Type[] returnTypeRequiredCustomModifiers, System.Type[] returnTypeOptionalCustomModifiers, System.Type[] parameterTypes, System.Type[][] parameterTypeRequiredCustomModifiers, System.Type[][] parameterTypeOptionalCustomModifiers) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public override string ToString() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct MethodToken
- {
- public static readonly System.Reflection.Emit.MethodToken Empty;
- public int Token { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public bool Equals(System.Reflection.Emit.MethodToken obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public static bool operator ==(System.Reflection.Emit.MethodToken a, System.Reflection.Emit.MethodToken b) { throw null; }
- public static bool operator !=(System.Reflection.Emit.MethodToken a, System.Reflection.Emit.MethodToken b) { throw null; }
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class ModuleBuilder : System.Reflection.Module
- {
- internal ModuleBuilder() { }
- public override System.Reflection.Assembly Assembly { get { throw null; } }
- public override string FullyQualifiedName { [System.Security.SecurityCriticalAttribute]get { throw null; } }
- public override int MetadataToken { get { throw null; } }
- public override System.Guid ModuleVersionId { get { throw null; } }
- public override string Name { get { throw null; } }
- public override string ScopeName { get { throw null; } }
- public void CreateGlobalFunctions() { }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Diagnostics.SymbolStore.ISymbolDocumentWriter DefineDocument(string url, System.Guid language, System.Guid languageVendor, System.Guid documentType) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.EnumBuilder DefineEnum(string name, System.Reflection.TypeAttributes visibility, System.Type underlyingType) { throw null; }
- public System.Reflection.Emit.MethodBuilder DefineGlobalMethod(string name, System.Reflection.MethodAttributes attributes, System.Reflection.CallingConventions callingConvention, System.Type returnType, System.Type[] parameterTypes) { throw null; }
- public System.Reflection.Emit.MethodBuilder DefineGlobalMethod(string name, System.Reflection.MethodAttributes attributes, System.Reflection.CallingConventions callingConvention, System.Type returnType, System.Type[] requiredReturnTypeCustomModifiers, System.Type[] optionalReturnTypeCustomModifiers, System.Type[] parameterTypes, System.Type[][] requiredParameterTypeCustomModifiers, System.Type[][] optionalParameterTypeCustomModifiers) { throw null; }
- public System.Reflection.Emit.MethodBuilder DefineGlobalMethod(string name, System.Reflection.MethodAttributes attributes, System.Type returnType, System.Type[] parameterTypes) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public System.Reflection.Emit.FieldBuilder DefineInitializedData(string name, byte[] data, System.Reflection.FieldAttributes attributes) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.TypeBuilder DefineType(string name) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.TypeBuilder DefineType(string name, System.Reflection.TypeAttributes attr) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.TypeBuilder DefineType(string name, System.Reflection.TypeAttributes attr, System.Type parent) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public System.Reflection.Emit.TypeBuilder DefineType(string name, System.Reflection.TypeAttributes attr, System.Type parent, int typesize) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public System.Reflection.Emit.TypeBuilder DefineType(string name, System.Reflection.TypeAttributes attr, System.Type parent, System.Reflection.Emit.PackingSize packsize) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public System.Reflection.Emit.TypeBuilder DefineType(string name, System.Reflection.TypeAttributes attr, System.Type parent, System.Reflection.Emit.PackingSize packingSize, int typesize) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.TypeBuilder DefineType(string name, System.Reflection.TypeAttributes attr, System.Type parent, System.Type[] interfaces) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public System.Reflection.Emit.FieldBuilder DefineUninitializedData(string name, int size, System.Reflection.FieldAttributes attributes) { throw null; }
- public override bool Equals(object obj) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.MethodInfo GetArrayMethod(System.Type arrayClass, string methodName, System.Reflection.CallingConventions callingConvention, System.Type returnType, System.Type[] parameterTypes) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.MethodToken GetArrayMethodToken(System.Type arrayClass, string methodName, System.Reflection.CallingConventions callingConvention, System.Type returnType, System.Type[] parameterTypes) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.MethodToken GetConstructorToken(System.Reflection.ConstructorInfo con) { throw null; }
- public override object[] GetCustomAttributes(bool inherit) { throw null; }
- public override object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
- public override System.Reflection.FieldInfo GetField(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Reflection.FieldInfo[] GetFields(System.Reflection.BindingFlags bindingFlags) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.FieldToken GetFieldToken(System.Reflection.FieldInfo field) { throw null; }
- public override int GetHashCode() { throw null; }
- protected override System.Reflection.MethodInfo GetMethodImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw null; }
- public override System.Reflection.MethodInfo[] GetMethods(System.Reflection.BindingFlags bindingFlags) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.MethodToken GetMethodToken(System.Reflection.MethodInfo method) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.SignatureToken GetSignatureToken(byte[] sigBytes, int sigLength) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.SignatureToken GetSignatureToken(System.Reflection.Emit.SignatureHelper sigHelper) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.StringToken GetStringConstant(string str) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public override System.Type GetType(string className) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public override System.Type GetType(string className, bool ignoreCase) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public override System.Type GetType(string className, bool throwOnError, bool ignoreCase) { throw null; }
- public override System.Type[] GetTypes() { throw null; }
- public System.Reflection.Emit.TypeToken GetTypeToken(string name) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.TypeToken GetTypeToken(System.Type type) { throw null; }
- public override bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
- public bool IsTransient() { throw null; }
- public override System.Reflection.FieldInfo ResolveField(int metadataToken, System.Type[] genericTypeArguments, System.Type[] genericMethodArguments) { throw null; }
- public override System.Reflection.MethodBase ResolveMethod(int metadataToken, System.Type[] genericTypeArguments, System.Type[] genericMethodArguments) { throw null; }
- public override string ResolveString(int metadataToken) { throw null; }
- public override System.Type ResolveType(int metadataToken, System.Type[] genericTypeArguments, System.Type[] genericMethodArguments) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecurityCriticalAttribute]
- public void SetCustomAttribute(System.Reflection.ConstructorInfo con, byte[] binaryAttribute) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder customBuilder) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct OpCode
- {
- public System.Reflection.Emit.FlowControl FlowControl { get { throw null; } }
- public string Name { get { throw null; } }
- public System.Reflection.Emit.OpCodeType OpCodeType { get { throw null; } }
- public System.Reflection.Emit.OperandType OperandType { get { throw null; } }
- public int Size { get { throw null; } }
- public System.Reflection.Emit.StackBehaviour StackBehaviourPop { get { throw null; } }
- public System.Reflection.Emit.StackBehaviour StackBehaviourPush { get { throw null; } }
- public short Value { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public bool Equals(System.Reflection.Emit.OpCode obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public static bool operator ==(System.Reflection.Emit.OpCode a, System.Reflection.Emit.OpCode b) { throw null; }
- public static bool operator !=(System.Reflection.Emit.OpCode a, System.Reflection.Emit.OpCode b) { throw null; }
- public override string ToString() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class OpCodes
- {
- internal OpCodes() { }
- public static readonly System.Reflection.Emit.OpCode Add;
- public static readonly System.Reflection.Emit.OpCode Add_Ovf;
- public static readonly System.Reflection.Emit.OpCode Add_Ovf_Un;
- public static readonly System.Reflection.Emit.OpCode And;
- public static readonly System.Reflection.Emit.OpCode Arglist;
- public static readonly System.Reflection.Emit.OpCode Beq;
- public static readonly System.Reflection.Emit.OpCode Beq_S;
- public static readonly System.Reflection.Emit.OpCode Bge;
- public static readonly System.Reflection.Emit.OpCode Bge_S;
- public static readonly System.Reflection.Emit.OpCode Bge_Un;
- public static readonly System.Reflection.Emit.OpCode Bge_Un_S;
- public static readonly System.Reflection.Emit.OpCode Bgt;
- public static readonly System.Reflection.Emit.OpCode Bgt_S;
- public static readonly System.Reflection.Emit.OpCode Bgt_Un;
- public static readonly System.Reflection.Emit.OpCode Bgt_Un_S;
- public static readonly System.Reflection.Emit.OpCode Ble;
- public static readonly System.Reflection.Emit.OpCode Ble_S;
- public static readonly System.Reflection.Emit.OpCode Ble_Un;
- public static readonly System.Reflection.Emit.OpCode Ble_Un_S;
- public static readonly System.Reflection.Emit.OpCode Blt;
- public static readonly System.Reflection.Emit.OpCode Blt_S;
- public static readonly System.Reflection.Emit.OpCode Blt_Un;
- public static readonly System.Reflection.Emit.OpCode Blt_Un_S;
- public static readonly System.Reflection.Emit.OpCode Bne_Un;
- public static readonly System.Reflection.Emit.OpCode Bne_Un_S;
- public static readonly System.Reflection.Emit.OpCode Box;
- public static readonly System.Reflection.Emit.OpCode Br;
- public static readonly System.Reflection.Emit.OpCode Br_S;
- public static readonly System.Reflection.Emit.OpCode Break;
- public static readonly System.Reflection.Emit.OpCode Brfalse;
- public static readonly System.Reflection.Emit.OpCode Brfalse_S;
- public static readonly System.Reflection.Emit.OpCode Brtrue;
- public static readonly System.Reflection.Emit.OpCode Brtrue_S;
- public static readonly System.Reflection.Emit.OpCode Call;
- public static readonly System.Reflection.Emit.OpCode Calli;
- public static readonly System.Reflection.Emit.OpCode Callvirt;
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static readonly System.Reflection.Emit.OpCode Castclass;
- public static readonly System.Reflection.Emit.OpCode Ceq;
- public static readonly System.Reflection.Emit.OpCode Cgt;
- public static readonly System.Reflection.Emit.OpCode Cgt_Un;
- public static readonly System.Reflection.Emit.OpCode Ckfinite;
- public static readonly System.Reflection.Emit.OpCode Clt;
- public static readonly System.Reflection.Emit.OpCode Clt_Un;
- public static readonly System.Reflection.Emit.OpCode Constrained;
- public static readonly System.Reflection.Emit.OpCode Conv_I;
- public static readonly System.Reflection.Emit.OpCode Conv_I1;
- public static readonly System.Reflection.Emit.OpCode Conv_I2;
- public static readonly System.Reflection.Emit.OpCode Conv_I4;
- public static readonly System.Reflection.Emit.OpCode Conv_I8;
- public static readonly System.Reflection.Emit.OpCode Conv_Ovf_I;
- public static readonly System.Reflection.Emit.OpCode Conv_Ovf_I_Un;
- public static readonly System.Reflection.Emit.OpCode Conv_Ovf_I1;
- public static readonly System.Reflection.Emit.OpCode Conv_Ovf_I1_Un;
- public static readonly System.Reflection.Emit.OpCode Conv_Ovf_I2;
- public static readonly System.Reflection.Emit.OpCode Conv_Ovf_I2_Un;
- public static readonly System.Reflection.Emit.OpCode Conv_Ovf_I4;
- public static readonly System.Reflection.Emit.OpCode Conv_Ovf_I4_Un;
- public static readonly System.Reflection.Emit.OpCode Conv_Ovf_I8;
- public static readonly System.Reflection.Emit.OpCode Conv_Ovf_I8_Un;
- public static readonly System.Reflection.Emit.OpCode Conv_Ovf_U;
- public static readonly System.Reflection.Emit.OpCode Conv_Ovf_U_Un;
- public static readonly System.Reflection.Emit.OpCode Conv_Ovf_U1;
- public static readonly System.Reflection.Emit.OpCode Conv_Ovf_U1_Un;
- public static readonly System.Reflection.Emit.OpCode Conv_Ovf_U2;
- public static readonly System.Reflection.Emit.OpCode Conv_Ovf_U2_Un;
- public static readonly System.Reflection.Emit.OpCode Conv_Ovf_U4;
- public static readonly System.Reflection.Emit.OpCode Conv_Ovf_U4_Un;
- public static readonly System.Reflection.Emit.OpCode Conv_Ovf_U8;
- public static readonly System.Reflection.Emit.OpCode Conv_Ovf_U8_Un;
- public static readonly System.Reflection.Emit.OpCode Conv_R_Un;
- public static readonly System.Reflection.Emit.OpCode Conv_R4;
- public static readonly System.Reflection.Emit.OpCode Conv_R8;
- public static readonly System.Reflection.Emit.OpCode Conv_U;
- public static readonly System.Reflection.Emit.OpCode Conv_U1;
- public static readonly System.Reflection.Emit.OpCode Conv_U2;
- public static readonly System.Reflection.Emit.OpCode Conv_U4;
- public static readonly System.Reflection.Emit.OpCode Conv_U8;
- public static readonly System.Reflection.Emit.OpCode Cpblk;
- public static readonly System.Reflection.Emit.OpCode Cpobj;
- public static readonly System.Reflection.Emit.OpCode Div;
- public static readonly System.Reflection.Emit.OpCode Div_Un;
- public static readonly System.Reflection.Emit.OpCode Dup;
- public static readonly System.Reflection.Emit.OpCode Endfilter;
- public static readonly System.Reflection.Emit.OpCode Endfinally;
- public static readonly System.Reflection.Emit.OpCode Initblk;
- public static readonly System.Reflection.Emit.OpCode Initobj;
- public static readonly System.Reflection.Emit.OpCode Isinst;
- public static readonly System.Reflection.Emit.OpCode Jmp;
- public static readonly System.Reflection.Emit.OpCode Ldarg;
- public static readonly System.Reflection.Emit.OpCode Ldarg_0;
- public static readonly System.Reflection.Emit.OpCode Ldarg_1;
- public static readonly System.Reflection.Emit.OpCode Ldarg_2;
- public static readonly System.Reflection.Emit.OpCode Ldarg_3;
- public static readonly System.Reflection.Emit.OpCode Ldarg_S;
- public static readonly System.Reflection.Emit.OpCode Ldarga;
- public static readonly System.Reflection.Emit.OpCode Ldarga_S;
- public static readonly System.Reflection.Emit.OpCode Ldc_I4;
- public static readonly System.Reflection.Emit.OpCode Ldc_I4_0;
- public static readonly System.Reflection.Emit.OpCode Ldc_I4_1;
- public static readonly System.Reflection.Emit.OpCode Ldc_I4_2;
- public static readonly System.Reflection.Emit.OpCode Ldc_I4_3;
- public static readonly System.Reflection.Emit.OpCode Ldc_I4_4;
- public static readonly System.Reflection.Emit.OpCode Ldc_I4_5;
- public static readonly System.Reflection.Emit.OpCode Ldc_I4_6;
- public static readonly System.Reflection.Emit.OpCode Ldc_I4_7;
- public static readonly System.Reflection.Emit.OpCode Ldc_I4_8;
- public static readonly System.Reflection.Emit.OpCode Ldc_I4_M1;
- public static readonly System.Reflection.Emit.OpCode Ldc_I4_S;
- public static readonly System.Reflection.Emit.OpCode Ldc_I8;
- public static readonly System.Reflection.Emit.OpCode Ldc_R4;
- public static readonly System.Reflection.Emit.OpCode Ldc_R8;
- public static readonly System.Reflection.Emit.OpCode Ldelem;
- public static readonly System.Reflection.Emit.OpCode Ldelem_I;
- public static readonly System.Reflection.Emit.OpCode Ldelem_I1;
- public static readonly System.Reflection.Emit.OpCode Ldelem_I2;
- public static readonly System.Reflection.Emit.OpCode Ldelem_I4;
- public static readonly System.Reflection.Emit.OpCode Ldelem_I8;
- public static readonly System.Reflection.Emit.OpCode Ldelem_R4;
- public static readonly System.Reflection.Emit.OpCode Ldelem_R8;
- public static readonly System.Reflection.Emit.OpCode Ldelem_Ref;
- public static readonly System.Reflection.Emit.OpCode Ldelem_U1;
- public static readonly System.Reflection.Emit.OpCode Ldelem_U2;
- public static readonly System.Reflection.Emit.OpCode Ldelem_U4;
- public static readonly System.Reflection.Emit.OpCode Ldelema;
- public static readonly System.Reflection.Emit.OpCode Ldfld;
- public static readonly System.Reflection.Emit.OpCode Ldflda;
- public static readonly System.Reflection.Emit.OpCode Ldftn;
- public static readonly System.Reflection.Emit.OpCode Ldind_I;
- public static readonly System.Reflection.Emit.OpCode Ldind_I1;
- public static readonly System.Reflection.Emit.OpCode Ldind_I2;
- public static readonly System.Reflection.Emit.OpCode Ldind_I4;
- public static readonly System.Reflection.Emit.OpCode Ldind_I8;
- public static readonly System.Reflection.Emit.OpCode Ldind_R4;
- public static readonly System.Reflection.Emit.OpCode Ldind_R8;
- public static readonly System.Reflection.Emit.OpCode Ldind_Ref;
- public static readonly System.Reflection.Emit.OpCode Ldind_U1;
- public static readonly System.Reflection.Emit.OpCode Ldind_U2;
- public static readonly System.Reflection.Emit.OpCode Ldind_U4;
- public static readonly System.Reflection.Emit.OpCode Ldlen;
- public static readonly System.Reflection.Emit.OpCode Ldloc;
- public static readonly System.Reflection.Emit.OpCode Ldloc_0;
- public static readonly System.Reflection.Emit.OpCode Ldloc_1;
- public static readonly System.Reflection.Emit.OpCode Ldloc_2;
- public static readonly System.Reflection.Emit.OpCode Ldloc_3;
- public static readonly System.Reflection.Emit.OpCode Ldloc_S;
- public static readonly System.Reflection.Emit.OpCode Ldloca;
- public static readonly System.Reflection.Emit.OpCode Ldloca_S;
- public static readonly System.Reflection.Emit.OpCode Ldnull;
- public static readonly System.Reflection.Emit.OpCode Ldobj;
- public static readonly System.Reflection.Emit.OpCode Ldsfld;
- public static readonly System.Reflection.Emit.OpCode Ldsflda;
- public static readonly System.Reflection.Emit.OpCode Ldstr;
- public static readonly System.Reflection.Emit.OpCode Ldtoken;
- public static readonly System.Reflection.Emit.OpCode Ldvirtftn;
- public static readonly System.Reflection.Emit.OpCode Leave;
- public static readonly System.Reflection.Emit.OpCode Leave_S;
- public static readonly System.Reflection.Emit.OpCode Localloc;
- public static readonly System.Reflection.Emit.OpCode Mkrefany;
- public static readonly System.Reflection.Emit.OpCode Mul;
- public static readonly System.Reflection.Emit.OpCode Mul_Ovf;
- public static readonly System.Reflection.Emit.OpCode Mul_Ovf_Un;
- public static readonly System.Reflection.Emit.OpCode Neg;
- public static readonly System.Reflection.Emit.OpCode Newarr;
- public static readonly System.Reflection.Emit.OpCode Newobj;
- public static readonly System.Reflection.Emit.OpCode Nop;
- public static readonly System.Reflection.Emit.OpCode Not;
- public static readonly System.Reflection.Emit.OpCode Or;
- public static readonly System.Reflection.Emit.OpCode Pop;
- public static readonly System.Reflection.Emit.OpCode Prefix1;
- public static readonly System.Reflection.Emit.OpCode Prefix2;
- public static readonly System.Reflection.Emit.OpCode Prefix3;
- public static readonly System.Reflection.Emit.OpCode Prefix4;
- public static readonly System.Reflection.Emit.OpCode Prefix5;
- public static readonly System.Reflection.Emit.OpCode Prefix6;
- public static readonly System.Reflection.Emit.OpCode Prefix7;
- public static readonly System.Reflection.Emit.OpCode Prefixref;
- public static readonly System.Reflection.Emit.OpCode Readonly;
- public static readonly System.Reflection.Emit.OpCode Refanytype;
- public static readonly System.Reflection.Emit.OpCode Refanyval;
- public static readonly System.Reflection.Emit.OpCode Rem;
- public static readonly System.Reflection.Emit.OpCode Rem_Un;
- public static readonly System.Reflection.Emit.OpCode Ret;
- public static readonly System.Reflection.Emit.OpCode Rethrow;
- public static readonly System.Reflection.Emit.OpCode Shl;
- public static readonly System.Reflection.Emit.OpCode Shr;
- public static readonly System.Reflection.Emit.OpCode Shr_Un;
- public static readonly System.Reflection.Emit.OpCode Sizeof;
- public static readonly System.Reflection.Emit.OpCode Starg;
- public static readonly System.Reflection.Emit.OpCode Starg_S;
- public static readonly System.Reflection.Emit.OpCode Stelem;
- public static readonly System.Reflection.Emit.OpCode Stelem_I;
- public static readonly System.Reflection.Emit.OpCode Stelem_I1;
- public static readonly System.Reflection.Emit.OpCode Stelem_I2;
- public static readonly System.Reflection.Emit.OpCode Stelem_I4;
- public static readonly System.Reflection.Emit.OpCode Stelem_I8;
- public static readonly System.Reflection.Emit.OpCode Stelem_R4;
- public static readonly System.Reflection.Emit.OpCode Stelem_R8;
- public static readonly System.Reflection.Emit.OpCode Stelem_Ref;
- public static readonly System.Reflection.Emit.OpCode Stfld;
- public static readonly System.Reflection.Emit.OpCode Stind_I;
- public static readonly System.Reflection.Emit.OpCode Stind_I1;
- public static readonly System.Reflection.Emit.OpCode Stind_I2;
- public static readonly System.Reflection.Emit.OpCode Stind_I4;
- public static readonly System.Reflection.Emit.OpCode Stind_I8;
- public static readonly System.Reflection.Emit.OpCode Stind_R4;
- public static readonly System.Reflection.Emit.OpCode Stind_R8;
- public static readonly System.Reflection.Emit.OpCode Stind_Ref;
- public static readonly System.Reflection.Emit.OpCode Stloc;
- public static readonly System.Reflection.Emit.OpCode Stloc_0;
- public static readonly System.Reflection.Emit.OpCode Stloc_1;
- public static readonly System.Reflection.Emit.OpCode Stloc_2;
- public static readonly System.Reflection.Emit.OpCode Stloc_3;
- public static readonly System.Reflection.Emit.OpCode Stloc_S;
- public static readonly System.Reflection.Emit.OpCode Stobj;
- public static readonly System.Reflection.Emit.OpCode Stsfld;
- public static readonly System.Reflection.Emit.OpCode Sub;
- public static readonly System.Reflection.Emit.OpCode Sub_Ovf;
- public static readonly System.Reflection.Emit.OpCode Sub_Ovf_Un;
- public static readonly System.Reflection.Emit.OpCode Switch;
- public static readonly System.Reflection.Emit.OpCode Tailcall;
- public static readonly System.Reflection.Emit.OpCode Throw;
- public static readonly System.Reflection.Emit.OpCode Unaligned;
- public static readonly System.Reflection.Emit.OpCode Unbox;
- public static readonly System.Reflection.Emit.OpCode Unbox_Any;
- public static readonly System.Reflection.Emit.OpCode Volatile;
- public static readonly System.Reflection.Emit.OpCode Xor;
- public static bool TakesSingleByteArgument(System.Reflection.Emit.OpCode inst) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum OpCodeType
- {
- [Obsolete("This API has been deprecated. http://go.microsoft.com/fwlink/?linkid=14202")]
- Annotation = 0,
- Macro = 1,
- Nternal = 2,
- Objmodel = 3,
- Prefix = 4,
- Primitive = 5,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum OperandType
- {
- InlineBrTarget = 0,
- InlineField = 1,
- InlineI = 2,
- InlineI8 = 3,
- InlineMethod = 4,
- InlineNone = 5,
- [Obsolete("This API has been deprecated. http://go.microsoft.com/fwlink/?linkid=14202")]
- InlinePhi = 6,
- InlineR = 7,
- InlineSig = 9,
- InlineString = 10,
- InlineSwitch = 11,
- InlineTok = 12,
- InlineType = 13,
- InlineVar = 14,
- ShortInlineBrTarget = 15,
- ShortInlineI = 16,
- ShortInlineR = 17,
- ShortInlineVar = 18,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum PackingSize
- {
- Size1 = 1,
- Size128 = 128,
- Size16 = 16,
- Size2 = 2,
- Size32 = 32,
- Size4 = 4,
- Size64 = 64,
- Size8 = 8,
- Unspecified = 0,
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class ParameterBuilder
- {
- internal ParameterBuilder() { }
- public virtual int Attributes { get { throw null; } }
- public bool IsIn { get { throw null; } }
- public bool IsOptional { get { throw null; } }
- public bool IsOut { get { throw null; } }
- public virtual string Name { get { throw null; } }
- public virtual int Position { get { throw null; } }
- public virtual System.Reflection.Emit.ParameterToken GetToken() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public virtual void SetConstant(object defaultValue) { }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecuritySafeCriticalAttribute]
- public void SetCustomAttribute(System.Reflection.ConstructorInfo con, byte[] binaryAttribute) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder customBuilder) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct ParameterToken
- {
- public static readonly System.Reflection.Emit.ParameterToken Empty;
- public int Token { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public bool Equals(System.Reflection.Emit.ParameterToken obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public static bool operator ==(System.Reflection.Emit.ParameterToken a, System.Reflection.Emit.ParameterToken b) { throw null; }
- public static bool operator !=(System.Reflection.Emit.ParameterToken a, System.Reflection.Emit.ParameterToken b) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum PEFileKinds
- {
- ConsoleApplication = 2,
- Dll = 1,
- WindowApplication = 3,
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class PropertyBuilder : System.Reflection.PropertyInfo
- {
- internal PropertyBuilder() { }
- public override System.Reflection.PropertyAttributes Attributes { get { throw null; } }
- public override bool CanRead { get { throw null; } }
- public override bool CanWrite { get { throw null; } }
- public override System.Type DeclaringType { get { throw null; } }
- public override System.Reflection.Module Module { get { throw null; } }
- public override string Name { get { throw null; } }
- public System.Reflection.Emit.PropertyToken PropertyToken { get { throw null; } }
- public override System.Type PropertyType { get { throw null; } }
- public override System.Type ReflectedType { get { throw null; } }
- [System.Security.SecuritySafeCriticalAttribute]
- public void AddOtherMethod(System.Reflection.Emit.MethodBuilder mdBuilder) { }
- public override System.Reflection.MethodInfo[] GetAccessors(bool nonPublic) { throw null; }
- public override object[] GetCustomAttributes(bool inherit) { throw null; }
- public override object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
- public override System.Reflection.MethodInfo GetGetMethod(bool nonPublic) { throw null; }
- public override System.Reflection.ParameterInfo[] GetIndexParameters() { throw null; }
- public override System.Reflection.MethodInfo GetSetMethod(bool nonPublic) { throw null; }
- public override object GetValue(object obj, object[] index) { throw null; }
- public override object GetValue(object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object[] index, System.Globalization.CultureInfo culture) { throw null; }
- public override bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public void SetConstant(object defaultValue) { }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecurityCriticalAttribute]
- public void SetCustomAttribute(System.Reflection.ConstructorInfo con, byte[] binaryAttribute) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder customBuilder) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void SetGetMethod(System.Reflection.Emit.MethodBuilder mdBuilder) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void SetSetMethod(System.Reflection.Emit.MethodBuilder mdBuilder) { }
- public override void SetValue(object obj, object value, object[] index) { }
- public override void SetValue(object obj, object value, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object[] index, System.Globalization.CultureInfo culture) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct PropertyToken
- {
- public static readonly System.Reflection.Emit.PropertyToken Empty;
- public int Token { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public bool Equals(System.Reflection.Emit.PropertyToken obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public static bool operator ==(System.Reflection.Emit.PropertyToken a, System.Reflection.Emit.PropertyToken b) { throw null; }
- public static bool operator !=(System.Reflection.Emit.PropertyToken a, System.Reflection.Emit.PropertyToken b) { throw null; }
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class SignatureHelper
- {
- internal SignatureHelper() { }
- public void AddArgument(System.Type clsArgument) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void AddArgument(System.Type argument, bool pinned) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void AddArgument(System.Type argument, System.Type[] requiredCustomModifiers, System.Type[] optionalCustomModifiers) { }
- public void AddArguments(System.Type[] arguments, System.Type[][] requiredCustomModifiers, System.Type[][] optionalCustomModifiers) { }
- public void AddSentinel() { }
- public override bool Equals(object obj) { throw null; }
- public static System.Reflection.Emit.SignatureHelper GetFieldSigHelper(System.Reflection.Module mod) { throw null; }
- public override int GetHashCode() { throw null; }
- public static System.Reflection.Emit.SignatureHelper GetLocalVarSigHelper() { throw null; }
- public static System.Reflection.Emit.SignatureHelper GetLocalVarSigHelper(System.Reflection.Module mod) { throw null; }
- public static System.Reflection.Emit.SignatureHelper GetMethodSigHelper(System.Reflection.CallingConventions callingConvention, System.Type returnType) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Reflection.Emit.SignatureHelper GetMethodSigHelper(System.Reflection.Module mod, System.Reflection.CallingConventions callingConvention, System.Type returnType) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Reflection.Emit.SignatureHelper GetMethodSigHelper(System.Reflection.Module mod, System.Runtime.InteropServices.CallingConvention unmanagedCallConv, System.Type returnType) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Reflection.Emit.SignatureHelper GetMethodSigHelper(System.Reflection.Module mod, System.Type returnType, System.Type[] parameterTypes) { throw null; }
- public static System.Reflection.Emit.SignatureHelper GetMethodSigHelper(System.Runtime.InteropServices.CallingConvention unmanagedCallingConvention, System.Type returnType) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Reflection.Emit.SignatureHelper GetPropertySigHelper(System.Reflection.Module mod, System.Reflection.CallingConventions callingConvention, System.Type returnType, System.Type[] requiredReturnTypeCustomModifiers, System.Type[] optionalReturnTypeCustomModifiers, System.Type[] parameterTypes, System.Type[][] requiredParameterTypeCustomModifiers, System.Type[][] optionalParameterTypeCustomModifiers) { throw null; }
- public static System.Reflection.Emit.SignatureHelper GetPropertySigHelper(System.Reflection.Module mod, System.Type returnType, System.Type[] parameterTypes) { throw null; }
- public static System.Reflection.Emit.SignatureHelper GetPropertySigHelper(System.Reflection.Module mod, System.Type returnType, System.Type[] requiredReturnTypeCustomModifiers, System.Type[] optionalReturnTypeCustomModifiers, System.Type[] parameterTypes, System.Type[][] requiredParameterTypeCustomModifiers, System.Type[][] optionalParameterTypeCustomModifiers) { throw null; }
- public byte[] GetSignature() { throw null; }
- public override string ToString() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct SignatureToken
- {
- public static readonly System.Reflection.Emit.SignatureToken Empty;
- public int Token { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public bool Equals(System.Reflection.Emit.SignatureToken obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public static bool operator ==(System.Reflection.Emit.SignatureToken a, System.Reflection.Emit.SignatureToken b) { throw null; }
- public static bool operator !=(System.Reflection.Emit.SignatureToken a, System.Reflection.Emit.SignatureToken b) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum StackBehaviour
- {
- Pop0 = 0,
- Pop1 = 1,
- Pop1_pop1 = 2,
- Popi = 3,
- Popi_pop1 = 4,
- Popi_popi = 5,
- Popi_popi_popi = 7,
- Popi_popi8 = 6,
- Popi_popr4 = 8,
- Popi_popr8 = 9,
- Popref = 10,
- Popref_pop1 = 11,
- Popref_popi = 12,
- Popref_popi_pop1 = 28,
- Popref_popi_popi = 13,
- Popref_popi_popi8 = 14,
- Popref_popi_popr4 = 15,
- Popref_popi_popr8 = 16,
- Popref_popi_popref = 17,
- Push0 = 18,
- Push1 = 19,
- Push1_push1 = 20,
- Pushi = 21,
- Pushi8 = 22,
- Pushr4 = 23,
- Pushr8 = 24,
- Pushref = 25,
- Varpop = 26,
- Varpush = 27,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct StringToken
- {
- public int Token { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public bool Equals(System.Reflection.Emit.StringToken obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public static bool operator ==(System.Reflection.Emit.StringToken a, System.Reflection.Emit.StringToken b) { throw null; }
- public static bool operator !=(System.Reflection.Emit.StringToken a, System.Reflection.Emit.StringToken b) { throw null; }
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class TypeBuilder : System.Reflection.TypeInfo
- {
- internal TypeBuilder() { }
- public const int UnspecifiedTypeSize = 0;
- public override System.Reflection.Assembly Assembly { get { throw null; } }
- public override string AssemblyQualifiedName { get { throw null; } }
- public override System.Type BaseType { get { throw null; } }
- public override System.Reflection.MethodBase DeclaringMethod { get { throw null; } }
- public override System.Type DeclaringType { get { throw null; } }
- public override string FullName { get { throw null; } }
- public override System.Reflection.GenericParameterAttributes GenericParameterAttributes { get { throw null; } }
- public override int GenericParameterPosition { get { throw null; } }
- public override System.Guid GUID { get { throw null; } }
- public override bool IsConstructedGenericType { get { throw null; } }
- public override bool IsGenericParameter { get { throw null; } }
- public override bool IsGenericType { get { throw null; } }
- public override bool IsGenericTypeDefinition { get { throw null; } }
- public override System.Reflection.Module Module { get { throw null; } }
- public override string Name { get { throw null; } }
- public override string Namespace { get { throw null; } }
- public System.Reflection.Emit.PackingSize PackingSize { get { throw null; } }
- public override System.Type ReflectedType { get { throw null; } }
- public int Size { get { throw null; } }
- public override System.RuntimeTypeHandle TypeHandle { get { throw null; } }
- public System.Reflection.Emit.TypeToken TypeToken { get { throw null; } }
- public override System.Type UnderlyingSystemType { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecuritySafeCriticalAttribute]
- public void AddInterfaceImplementation(System.Type interfaceType) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Type CreateType() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.TypeInfo CreateTypeInfo() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public System.Reflection.Emit.ConstructorBuilder DefineConstructor(System.Reflection.MethodAttributes attributes, System.Reflection.CallingConventions callingConvention, System.Type[] parameterTypes) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.ConstructorBuilder DefineConstructor(System.Reflection.MethodAttributes attributes, System.Reflection.CallingConventions callingConvention, System.Type[] parameterTypes, System.Type[][] requiredCustomModifiers, System.Type[][] optionalCustomModifiers) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public System.Reflection.Emit.ConstructorBuilder DefineDefaultConstructor(System.Reflection.MethodAttributes attributes) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.EventBuilder DefineEvent(string name, System.Reflection.EventAttributes attributes, System.Type eventtype) { throw null; }
- public System.Reflection.Emit.FieldBuilder DefineField(string fieldName, System.Type type, System.Reflection.FieldAttributes attributes) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.FieldBuilder DefineField(string fieldName, System.Type type, System.Type[] requiredCustomModifiers, System.Type[] optionalCustomModifiers, System.Reflection.FieldAttributes attributes) { throw null; }
- public System.Reflection.Emit.GenericTypeParameterBuilder[] DefineGenericParameters(params string[] names) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public System.Reflection.Emit.FieldBuilder DefineInitializedData(string name, byte[] data, System.Reflection.FieldAttributes attributes) { throw null; }
- public System.Reflection.Emit.MethodBuilder DefineMethod(string name, System.Reflection.MethodAttributes attributes) { throw null; }
- public System.Reflection.Emit.MethodBuilder DefineMethod(string name, System.Reflection.MethodAttributes attributes, System.Reflection.CallingConventions callingConvention) { throw null; }
- public System.Reflection.Emit.MethodBuilder DefineMethod(string name, System.Reflection.MethodAttributes attributes, System.Reflection.CallingConventions callingConvention, System.Type returnType, System.Type[] parameterTypes) { throw null; }
- public System.Reflection.Emit.MethodBuilder DefineMethod(string name, System.Reflection.MethodAttributes attributes, System.Reflection.CallingConventions callingConvention, System.Type returnType, System.Type[] returnTypeRequiredCustomModifiers, System.Type[] returnTypeOptionalCustomModifiers, System.Type[] parameterTypes, System.Type[][] parameterTypeRequiredCustomModifiers, System.Type[][] parameterTypeOptionalCustomModifiers) { throw null; }
- public System.Reflection.Emit.MethodBuilder DefineMethod(string name, System.Reflection.MethodAttributes attributes, System.Type returnType, System.Type[] parameterTypes) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public void DefineMethodOverride(System.Reflection.MethodInfo methodInfoBody, System.Reflection.MethodInfo methodInfoDeclaration) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.TypeBuilder DefineNestedType(string name) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.TypeBuilder DefineNestedType(string name, System.Reflection.TypeAttributes attr) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.TypeBuilder DefineNestedType(string name, System.Reflection.TypeAttributes attr, System.Type parent) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public System.Reflection.Emit.TypeBuilder DefineNestedType(string name, System.Reflection.TypeAttributes attr, System.Type parent, int typeSize) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public System.Reflection.Emit.TypeBuilder DefineNestedType(string name, System.Reflection.TypeAttributes attr, System.Type parent, System.Reflection.Emit.PackingSize packSize) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public System.Reflection.Emit.TypeBuilder DefineNestedType(string name, System.Reflection.TypeAttributes attr, System.Type parent, System.Reflection.Emit.PackingSize packSize, int typeSize) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.TypeBuilder DefineNestedType(string name, System.Reflection.TypeAttributes attr, System.Type parent, System.Type[] interfaces) { throw null; }
- public System.Reflection.Emit.PropertyBuilder DefineProperty(string name, System.Reflection.PropertyAttributes attributes, System.Reflection.CallingConventions callingConvention, System.Type returnType, System.Type[] parameterTypes) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.PropertyBuilder DefineProperty(string name, System.Reflection.PropertyAttributes attributes, System.Reflection.CallingConventions callingConvention, System.Type returnType, System.Type[] returnTypeRequiredCustomModifiers, System.Type[] returnTypeOptionalCustomModifiers, System.Type[] parameterTypes, System.Type[][] parameterTypeRequiredCustomModifiers, System.Type[][] parameterTypeOptionalCustomModifiers) { throw null; }
- public System.Reflection.Emit.PropertyBuilder DefineProperty(string name, System.Reflection.PropertyAttributes attributes, System.Type returnType, System.Type[] parameterTypes) { throw null; }
- public System.Reflection.Emit.PropertyBuilder DefineProperty(string name, System.Reflection.PropertyAttributes attributes, System.Type returnType, System.Type[] returnTypeRequiredCustomModifiers, System.Type[] returnTypeOptionalCustomModifiers, System.Type[] parameterTypes, System.Type[][] parameterTypeRequiredCustomModifiers, System.Type[][] parameterTypeOptionalCustomModifiers) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Reflection.Emit.ConstructorBuilder DefineTypeInitializer() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public System.Reflection.Emit.FieldBuilder DefineUninitializedData(string name, int size, System.Reflection.FieldAttributes attributes) { throw null; }
- protected override System.Reflection.TypeAttributes GetAttributeFlagsImpl() { throw null; }
- public static System.Reflection.ConstructorInfo GetConstructor(System.Type type, System.Reflection.ConstructorInfo constructor) { throw null; }
- protected override System.Reflection.ConstructorInfo GetConstructorImpl(System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public override System.Reflection.ConstructorInfo[] GetConstructors(System.Reflection.BindingFlags bindingAttr) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override object[] GetCustomAttributes(bool inherit) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override object[] GetCustomAttributes(System.Type attributeType, bool inherit) { throw null; }
- public override System.Type GetElementType() { throw null; }
- public override System.Reflection.EventInfo GetEvent(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Reflection.EventInfo[] GetEvents() { throw null; }
- public override System.Reflection.EventInfo[] GetEvents(System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Reflection.FieldInfo GetField(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
- public static System.Reflection.FieldInfo GetField(System.Type type, System.Reflection.FieldInfo field) { throw null; }
- public override System.Reflection.FieldInfo[] GetFields(System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Type[] GetGenericArguments() { throw null; }
- public override System.Type GetGenericTypeDefinition() { throw null; }
- public override System.Type GetInterface(string name, bool ignoreCase) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public override System.Reflection.InterfaceMapping GetInterfaceMap(System.Type interfaceType) { throw null; }
- public override System.Type[] GetInterfaces() { throw null; }
- public override System.Reflection.MemberInfo[] GetMember(string name, System.Reflection.MemberTypes type, System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Reflection.MemberInfo[] GetMembers(System.Reflection.BindingFlags bindingAttr) { throw null; }
- public static System.Reflection.MethodInfo GetMethod(System.Type type, System.Reflection.MethodInfo method) { throw null; }
- protected override System.Reflection.MethodInfo GetMethodImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw null; }
- public override System.Reflection.MethodInfo[] GetMethods(System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Type GetNestedType(string name, System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Type[] GetNestedTypes(System.Reflection.BindingFlags bindingAttr) { throw null; }
- public override System.Reflection.PropertyInfo[] GetProperties(System.Reflection.BindingFlags bindingAttr) { throw null; }
- protected override System.Reflection.PropertyInfo GetPropertyImpl(string name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Type returnType, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) { throw null; }
- protected override bool HasElementTypeImpl() { throw null; }
- public override object InvokeMember(string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object target, object[] args, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, string[] namedParameters) { throw null; }
- protected override bool IsArrayImpl() { throw null; }
- public override bool IsAssignableFrom(System.Reflection.TypeInfo typeInfo) { throw null; }
- public override bool IsAssignableFrom(System.Type c) { throw null; }
- protected override bool IsByRefImpl() { throw null; }
- protected override bool IsCOMObjectImpl() { throw null; }
- public bool IsCreated() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override bool IsDefined(System.Type attributeType, bool inherit) { throw null; }
- protected override bool IsPointerImpl() { throw null; }
- protected override bool IsPrimitiveImpl() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public override bool IsSubclassOf(System.Type c) { throw null; }
- public override System.Type MakeArrayType() { throw null; }
- public override System.Type MakeArrayType(int rank) { throw null; }
- public override System.Type MakeByRefType() { throw null; }
- public override System.Type MakeGenericType(params System.Type[] typeArguments) { throw null; }
- public override System.Type MakePointerType() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecurityCriticalAttribute]
- public void SetCustomAttribute(System.Reflection.ConstructorInfo con, byte[] binaryAttribute) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void SetCustomAttribute(System.Reflection.Emit.CustomAttributeBuilder customBuilder) { }
- public void SetParent(System.Type parent) { }
- public override string ToString() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct TypeToken
- {
- public static readonly System.Reflection.Emit.TypeToken Empty;
- public int Token { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public bool Equals(System.Reflection.Emit.TypeToken obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public static bool operator ==(System.Reflection.Emit.TypeToken a, System.Reflection.Emit.TypeToken b) { throw null; }
- public static bool operator !=(System.Reflection.Emit.TypeToken a, System.Reflection.Emit.TypeToken b) { throw null; }
- }
-}
-namespace System.Reflection.Metadata
-{
- public static partial class AssemblyExtensions
- {
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe static bool TryGetRawMetadata(this System.Reflection.Assembly assembly, out byte* blob, out int length) { blob = default(byte*); length = default(int); throw null; }
- }
-}
-namespace System.Resources
-{
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface IResourceReader : System.Collections.IEnumerable, System.IDisposable
- {
- void Close();
- new System.Collections.IDictionaryEnumerator GetEnumerator();
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class MissingManifestResourceException : System.SystemException
- {
- public MissingManifestResourceException() { }
- protected MissingManifestResourceException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public MissingManifestResourceException(string message) { }
- public MissingManifestResourceException(string message, System.Exception inner) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class MissingSatelliteAssemblyException : System.SystemException
- {
- public MissingSatelliteAssemblyException() { }
- protected MissingSatelliteAssemblyException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public MissingSatelliteAssemblyException(string message) { }
- public MissingSatelliteAssemblyException(string message, System.Exception inner) { }
- public MissingSatelliteAssemblyException(string message, string cultureName) { }
- public string CultureName { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), AllowMultiple=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class NeutralResourcesLanguageAttribute : System.Attribute
- {
- public NeutralResourcesLanguageAttribute(string cultureName) { }
- public NeutralResourcesLanguageAttribute(string cultureName, System.Resources.UltimateResourceFallbackLocation location) { }
- public string CultureName { get { throw null; } }
- public System.Resources.UltimateResourceFallbackLocation Location { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class ResourceManager
- {
- protected string BaseNameField;
- public static readonly int HeaderVersionNumber;
- public static readonly int MagicNumber;
- protected System.Reflection.Assembly MainAssembly;
- protected ResourceManager() { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public ResourceManager(string baseName, System.Reflection.Assembly assembly) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public ResourceManager(string baseName, System.Reflection.Assembly assembly, System.Type usingResourceSet) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public ResourceManager(System.Type resourceSource) { }
- public virtual string BaseName { get { throw null; } }
- protected System.Resources.UltimateResourceFallbackLocation FallbackLocation { get { throw null; } set { } }
- public virtual bool IgnoreCase { get { throw null; } set { } }
- public virtual System.Type ResourceSetType { get { throw null; } }
- public static System.Resources.ResourceManager CreateFileBasedResourceManager(string baseName, string resourceDir, System.Type usingResourceSet) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- protected static System.Globalization.CultureInfo GetNeutralResourcesLanguage(System.Reflection.Assembly a) { throw null; }
- public virtual object GetObject(string name) { throw null; }
- public virtual object GetObject(string name, System.Globalization.CultureInfo culture) { throw null; }
- protected virtual string GetResourceFileName(System.Globalization.CultureInfo culture) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecuritySafeCriticalAttribute]
- public virtual System.Resources.ResourceSet GetResourceSet(System.Globalization.CultureInfo culture, bool createIfNotExists, bool tryParents) { throw null; }
- protected static System.Version GetSatelliteContractVersion(System.Reflection.Assembly a) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public System.IO.UnmanagedMemoryStream GetStream(string name) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public System.IO.UnmanagedMemoryStream GetStream(string name, System.Globalization.CultureInfo culture) { throw null; }
- public virtual string GetString(string name) { throw null; }
- public virtual string GetString(string name, System.Globalization.CultureInfo culture) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecuritySafeCriticalAttribute]
- protected virtual System.Resources.ResourceSet InternalGetResourceSet(System.Globalization.CultureInfo culture, bool createIfNotExists, bool tryParents) { throw null; }
- public virtual void ReleaseAllResources() { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class ResourceReader : System.Collections.IEnumerable, System.IDisposable, System.Resources.IResourceReader
- {
- [System.Security.SecurityCriticalAttribute]
- public ResourceReader(System.IO.Stream stream) { }
- [System.Security.SecurityCriticalAttribute]
- public ResourceReader(string fileName) { }
- public void Close() { }
- public void Dispose() { }
- public System.Collections.IDictionaryEnumerator GetEnumerator() { throw null; }
- public void GetResourceData(string resourceName, out string resourceType, out byte[] resourceData) { resourceType = default(string); resourceData = default(byte[]); }
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class ResourceSet : System.Collections.IEnumerable, System.IDisposable
- {
- protected System.Resources.IResourceReader Reader;
- protected ResourceSet() { }
- [System.Security.SecurityCriticalAttribute]
- public ResourceSet(System.IO.Stream stream) { }
- public ResourceSet(System.Resources.IResourceReader reader) { }
- [System.Security.SecurityCriticalAttribute]
- public ResourceSet(string fileName) { }
- public virtual void Close() { }
- public void Dispose() { }
- protected virtual void Dispose(bool disposing) { }
- public virtual System.Type GetDefaultReader() { throw null; }
- public virtual System.Type GetDefaultWriter() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual System.Collections.IDictionaryEnumerator GetEnumerator() { throw null; }
- public virtual object GetObject(string name) { throw null; }
- public virtual object GetObject(string name, bool ignoreCase) { throw null; }
- public virtual string GetString(string name) { throw null; }
- public virtual string GetString(string name, bool ignoreCase) { throw null; }
- protected virtual void ReadResources() { }
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), AllowMultiple=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class SatelliteContractVersionAttribute : System.Attribute
- {
- public SatelliteContractVersionAttribute(string version) { }
- public string Version { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum UltimateResourceFallbackLocation
- {
- MainAssembly = 0,
- Satellite = 1,
- }
-}
-namespace System.Runtime
-{
- public enum GCLargeObjectHeapCompactionMode
- {
- CompactOnce = 2,
- Default = 1,
- }
- public enum GCLatencyMode
- {
- Batch = 0,
- Interactive = 1,
- LowLatency = 2,
- NoGCRegion = 4,
- SustainedLowLatency = 3,
- }
- public static partial class GCSettings
- {
- public static bool IsServerGC { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public static System.Runtime.GCLargeObjectHeapCompactionMode LargeObjectHeapCompactionMode { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } [System.Security.SecurityCriticalAttribute]set { } }
- public static System.Runtime.GCLatencyMode LatencyMode { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } [System.Security.SecurityCriticalAttribute]set { } }
- }
-
- public sealed partial class MemoryFailPoint : System.Runtime.ConstrainedExecution.CriticalFinalizerObject, System.IDisposable
- {
- [System.Security.SecurityCriticalAttribute]
- public MemoryFailPoint(int sizeInMegabytes) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void Dispose() { }
- ~MemoryFailPoint() { }
- }
-}
-namespace System.Runtime.CompilerServices
-{
- [System.AttributeUsageAttribute((System.AttributeTargets)(256))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AccessedThroughPropertyAttribute : System.Attribute
- {
- public AccessedThroughPropertyAttribute(string propertyName) { }
- public string PropertyName { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(64), Inherited=false, AllowMultiple=false)]
- public sealed partial class AsyncStateMachineAttribute : System.Runtime.CompilerServices.StateMachineAttribute
- {
- public AsyncStateMachineAttribute(System.Type stateMachineType) : base (default(System.Type)) { }
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct AsyncTaskMethodBuilder
- {
- public System.Threading.Tasks.Task Task { get { throw null; } }
- public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.INotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
- public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
- public static System.Runtime.CompilerServices.AsyncTaskMethodBuilder Create() { throw null; }
- public void SetException(System.Exception exception) { }
- public void SetResult() { }
- public void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) { }
- [System.Diagnostics.DebuggerStepThroughAttribute]
- [System.Security.SecuritySafeCriticalAttribute]
- public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct AsyncTaskMethodBuilder<TResult>
- {
- public System.Threading.Tasks.Task<TResult> Task { get { throw null; } }
- public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.INotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
- public static System.Runtime.CompilerServices.AsyncTaskMethodBuilder<TResult> Create() { throw null; }
- public void SetException(System.Exception exception) { }
- public void SetResult(TResult result) { }
- public void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) { }
- [System.Diagnostics.DebuggerStepThroughAttribute]
- [System.Security.SecuritySafeCriticalAttribute]
- public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct AsyncVoidMethodBuilder
- {
- public void AwaitOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.INotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void AwaitUnsafeOnCompleted<TAwaiter, TStateMachine>(ref TAwaiter awaiter, ref TStateMachine stateMachine) where TAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
- public static System.Runtime.CompilerServices.AsyncVoidMethodBuilder Create() { throw null; }
- public void SetException(System.Exception exception) { }
- public void SetResult() { }
- public void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) { }
- [System.Diagnostics.DebuggerStepThroughAttribute]
- [System.Security.SecuritySafeCriticalAttribute]
- public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(2048), Inherited=false)]
- public sealed partial class CallerFilePathAttribute : System.Attribute
- {
- public CallerFilePathAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(2048), Inherited=false)]
- public sealed partial class CallerLineNumberAttribute : System.Attribute
- {
- public CallerLineNumberAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(2048), Inherited=false)]
- public sealed partial class CallerMemberNameAttribute : System.Attribute
- {
- public CallerMemberNameAttribute() { }
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum CompilationRelaxations
- {
- NoStringInterning = 8,
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(71))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class CompilationRelaxationsAttribute : System.Attribute
- {
- public CompilationRelaxationsAttribute(int relaxations) { }
- public CompilationRelaxationsAttribute(System.Runtime.CompilerServices.CompilationRelaxations relaxations) { }
- public int CompilationRelaxations { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(32767), Inherited=true)]
- public sealed partial class CompilerGeneratedAttribute : System.Attribute
- {
- public CompilerGeneratedAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(4))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class CompilerGlobalScopeAttribute : System.Attribute
- {
- public CompilerGlobalScopeAttribute() { }
- }
- public static partial class CompilerMarshalOverride
- {
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public sealed partial class ConditionalWeakTable<TKey, TValue> where TKey : class where TValue : class
- {
- [System.Security.SecuritySafeCriticalAttribute]
- public ConditionalWeakTable() { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void Add(TKey key, TValue value) { }
- ~ConditionalWeakTable() { }
- public TValue GetOrCreateValue(TKey key) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public TValue GetValue(TKey key, System.Runtime.CompilerServices.ConditionalWeakTable<TKey, TValue>.CreateValueCallback createValueCallback) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public bool Remove(TKey key) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public bool TryGetValue(TKey key, out TValue value) { value = default(TValue); throw null; }
- public delegate TValue CreateValueCallback(TKey key);
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct ConfiguredTaskAwaitable
- {
- public System.Runtime.CompilerServices.ConfiguredTaskAwaitable.ConfiguredTaskAwaiter GetAwaiter() { throw null; }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct ConfiguredTaskAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
- {
- public bool IsCompleted { get { throw null; } }
- public void GetResult() { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void OnCompleted(System.Action continuation) { }
- [System.Security.SecurityCriticalAttribute]
- public void UnsafeOnCompleted(System.Action continuation) { }
- }
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct ConfiguredTaskAwaitable<TResult>
- {
- public System.Runtime.CompilerServices.ConfiguredTaskAwaitable<TResult>.ConfiguredTaskAwaiter GetAwaiter() { throw null; }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct ConfiguredTaskAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
- {
- public bool IsCompleted { get { throw null; } }
- public TResult GetResult() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public void OnCompleted(System.Action continuation) { }
- [System.Security.SecurityCriticalAttribute]
- public void UnsafeOnCompleted(System.Action continuation) { }
- }
- }
- public static partial class ContractHelper
- {
- [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1030:UseEventsWhereAppropriate")]
- [System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static string RaiseContractFailedEvent(System.Diagnostics.Contracts.ContractFailureKind failureKind, string userMessage, string conditionText, System.Exception innerException) { throw null; }
- [System.Diagnostics.DebuggerNonUserCodeAttribute]
- public static void TriggerFailure(System.Diagnostics.Contracts.ContractFailureKind kind, string displayMessage, string userMessage, string conditionText, System.Exception innerException) { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(2304), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class CustomConstantAttribute : System.Attribute
- {
- protected CustomConstantAttribute() { }
- public abstract object Value { get; }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(2304), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class DateTimeConstantAttribute : System.Runtime.CompilerServices.CustomConstantAttribute
- {
- public DateTimeConstantAttribute(long ticks) { }
- public override object Value { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(2304), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class DecimalConstantAttribute : System.Attribute
- {
- public DecimalConstantAttribute(byte scale, byte sign, int hi, int mid, int low) { }
- [System.CLSCompliantAttribute(false)]
- public DecimalConstantAttribute(byte scale, byte sign, uint hi, uint mid, uint low) { }
- public decimal Value { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1))]
- public sealed partial class DefaultDependencyAttribute : System.Attribute
- {
- public DefaultDependencyAttribute(System.Runtime.CompilerServices.LoadHint loadHintArgument) { }
- public System.Runtime.CompilerServices.LoadHint LoadHint { get { return default(System.Runtime.CompilerServices.LoadHint); } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), AllowMultiple=true)]
- public sealed partial class DependencyAttribute : System.Attribute
- {
- public DependencyAttribute(string dependentAssemblyArgument, System.Runtime.CompilerServices.LoadHint loadHintArgument) { }
- public string DependentAssembly { get { return default(string); } }
- public System.Runtime.CompilerServices.LoadHint LoadHint { get { return default(System.Runtime.CompilerServices.LoadHint); } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), AllowMultiple=false, Inherited=false)]
- public sealed partial class DisablePrivateReflectionAttribute : System.Attribute
- {
- public DisablePrivateReflectionAttribute() { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class DiscardableAttribute : System.Attribute
- {
- public DiscardableAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(69))]
- public sealed partial class ExtensionAttribute : System.Attribute
- {
- public ExtensionAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(256))]
- public sealed partial class FixedAddressValueTypeAttribute : System.Attribute
- {
- public FixedAddressValueTypeAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(256), Inherited=false)]
- public sealed partial class FixedBufferAttribute : System.Attribute
- {
- public FixedBufferAttribute(System.Type elementType, int length) { }
- public System.Type ElementType { get { throw null; } }
- public int Length { get { throw null; } }
- }
- public static partial class FormattableStringFactory
- {
- public static System.FormattableString Create(string format, params object[] arguments) { throw null; }
- }
- public partial interface IAsyncStateMachine
- {
- void MoveNext();
- void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine stateMachine);
- }
- public partial interface ICastable
- {
- System.RuntimeTypeHandle GetImplType(System.RuntimeTypeHandle interfaceType);
- bool IsInstanceOfInterface(System.RuntimeTypeHandle interfaceType, out System.Exception castError);
- }
- public partial interface ICriticalNotifyCompletion : System.Runtime.CompilerServices.INotifyCompletion
- {
- [System.Security.SecurityCriticalAttribute]
- void UnsafeOnCompleted(System.Action continuation);
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(128), Inherited=true)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class IndexerNameAttribute : System.Attribute
- {
- public IndexerNameAttribute(string indexerName) { }
- }
- public partial interface INotifyCompletion
- {
- void OnCompleted(System.Action continuation);
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), AllowMultiple=true, Inherited=false)]
- public sealed partial class InternalsVisibleToAttribute : System.Attribute
- {
- public InternalsVisibleToAttribute(string assemblyName) { }
- public bool AllInternalsVisible { get { throw null; } set { } }
- public string AssemblyName { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static partial class IsVolatile
- {
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(64), Inherited=false, AllowMultiple=false)]
- public sealed partial class IteratorStateMachineAttribute : System.Runtime.CompilerServices.StateMachineAttribute
- {
- public IteratorStateMachineAttribute(System.Type stateMachineType) : base (default(System.Type)) { }
- }
- public enum LoadHint {
- Always = 1,
- Default = 0,
- Sometimes = 2,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum MethodCodeType
- {
- IL = 0,
- Native = 1,
- OPTIL = 2,
- Runtime = 3,
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(96), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class MethodImplAttribute : System.Attribute
- {
- public System.Runtime.CompilerServices.MethodCodeType MethodCodeType;
- public MethodImplAttribute() { }
- public MethodImplAttribute(short value) { }
- public MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions methodImplOptions) { }
- public System.Runtime.CompilerServices.MethodImplOptions Value { get { throw null; } }
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum MethodImplOptions
- {
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- AggressiveInlining = 256,
- ForwardRef = 16,
- InternalCall = 4096,
- NoInlining = 8,
- NoOptimization = 64,
- PreserveSig = 128,
- Synchronized = 32,
- Unmanaged = 4,
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), AllowMultiple=false)]
- public sealed partial class ReferenceAssemblyAttribute : System.Attribute
- {
- public ReferenceAssemblyAttribute() { }
- public ReferenceAssemblyAttribute(string description) { }
- public string Description { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=false, AllowMultiple=false)]
- public sealed partial class RuntimeCompatibilityAttribute : System.Attribute
- {
- public RuntimeCompatibilityAttribute() { }
- public bool WrapNonExceptionThrows { get { throw null; } set { } }
- }
- public static partial class RuntimeHelpers
- {
- public static new bool Equals(object o1, object o2) { throw null; }
- public static int OffsetToStringData { get { throw null; } }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static void EnsureSufficientExecutionStack() { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static int GetHashCode(object o) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static object GetObjectValue(object obj) { throw null; }
- public static object GetUninitializedObject(System.Type type) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static void InitializeArray(System.Array array, System.RuntimeFieldHandle fldHandle) { }
- public static void RunClassConstructor(System.RuntimeTypeHandle type) { }
- public static void RunModuleConstructor(System.ModuleHandle module) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public static void ExecuteCodeWithGuaranteedCleanup(System.Runtime.CompilerServices.RuntimeHelpers.TryCode code, System.Runtime.CompilerServices.RuntimeHelpers.CleanupCode backoutCode, object userData) { }
- [System.Security.SecurityCriticalAttribute]
- public delegate void CleanupCode(object userData, bool exceptionThrown);
- [System.Security.SecurityCriticalAttribute]
- public delegate void TryCode(object userData);
- [System.Runtime.ConstrainedExecution.ReliabilityContractAttribute((System.Runtime.ConstrainedExecution.Consistency)(3), (System.Runtime.ConstrainedExecution.Cer)(1))]
- [System.Security.SecurityCriticalAttribute]
- public static void PrepareConstrainedRegions() { }
- [System.Runtime.ConstrainedExecution.ReliabilityContractAttribute((System.Runtime.ConstrainedExecution.Consistency)(3), (System.Runtime.ConstrainedExecution.Cer)(1))]
- [System.Security.SecurityCriticalAttribute]
- public static void PrepareConstrainedRegionsNoOP() { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public static void PrepareContractedDelegate(System.Delegate d) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public static void PrepareDelegate(System.Delegate d) { }
- [System.Security.SecurityCriticalAttribute]
- public static void PrepareMethod(System.RuntimeMethodHandle method) { }
- [System.Security.SecurityCriticalAttribute]
- public static void PrepareMethod(System.RuntimeMethodHandle method, System.RuntimeTypeHandle[] instantiation) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Runtime.ConstrainedExecution.ReliabilityContractAttribute((System.Runtime.ConstrainedExecution.Consistency)(3), (System.Runtime.ConstrainedExecution.Cer)(1))]
- [System.Security.SecurityCriticalAttribute]
- public static void ProbeForSufficientStack() { }
- }
- public sealed partial class RuntimeWrappedException : System.Exception
- {
- internal RuntimeWrappedException() { }
- public object WrappedException { get { return default(object); } }
- [System.Security.SecurityCriticalAttribute]
- public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(972))]
- public sealed partial class SpecialNameAttribute : System.Attribute
- {
- public SpecialNameAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), Inherited=false)]
- public sealed partial class StringFreezingAttribute : System.Attribute
- {
- public StringFreezingAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(64), Inherited=false, AllowMultiple=false)]
- public partial class StateMachineAttribute : System.Attribute
- {
- public StateMachineAttribute(System.Type stateMachineType) { }
- public System.Type StateMachineType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- }
- [System.AttributeUsage((System.AttributeTargets)(1) | (System.AttributeTargets)(2))]
- public sealed partial class SuppressIldasmAttribute : System.Attribute
- {
- public SuppressIldasmAttribute() { }
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct TaskAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
- {
- public bool IsCompleted { get { throw null; } }
- public void GetResult() { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void OnCompleted(System.Action continuation) { }
- [System.Security.SecurityCriticalAttribute]
- public void UnsafeOnCompleted(System.Action continuation) { }
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct TaskAwaiter<TResult> : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
- {
- public bool IsCompleted { get { throw null; } }
- public TResult GetResult() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public void OnCompleted(System.Action continuation) { }
- [System.Security.SecurityCriticalAttribute]
- public void UnsafeOnCompleted(System.Action continuation) { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(5148), Inherited=false, AllowMultiple=false)]
- public sealed partial class TypeForwardedFromAttribute : System.Attribute
- {
- public TypeForwardedFromAttribute(string assemblyFullName) { }
- public string AssemblyFullName { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), AllowMultiple=true, Inherited=false)]
- public sealed partial class TypeForwardedToAttribute : System.Attribute
- {
- public TypeForwardedToAttribute(System.Type destination) { }
- public System.Type Destination { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(8))]
- public sealed partial class UnsafeValueTypeAttribute : System.Attribute
- {
- public UnsafeValueTypeAttribute() { }
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, Size=1)]
- public partial struct YieldAwaitable
- {
- public System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter GetAwaiter() { throw null; }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, Size=1)]
- public partial struct YieldAwaiter : System.Runtime.CompilerServices.ICriticalNotifyCompletion, System.Runtime.CompilerServices.INotifyCompletion
- {
- public bool IsCompleted { get { throw null; } }
- public void GetResult() { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void OnCompleted(System.Action continuation) { }
- [System.Security.SecurityCriticalAttribute]
- public void UnsafeOnCompleted(System.Action continuation) { }
- }
- }
-}
-namespace System.Runtime.ConstrainedExecution
-{
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class CriticalFinalizerObject
- {
- [System.Security.SecuritySafeCriticalAttribute]
- protected CriticalFinalizerObject() { }
- ~CriticalFinalizerObject() { }
- }
-
- public enum Cer
- {
- MayFail = 1,
- None = 0,
- Success = 2,
- }
- public enum Consistency
- {
- MayCorruptAppDomain = 1,
- MayCorruptInstance = 2,
- MayCorruptProcess = 0,
- WillNotCorruptState = 3,
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1133), Inherited=false)]
- public sealed partial class ReliabilityContractAttribute : System.Attribute
- {
- public ReliabilityContractAttribute(System.Runtime.ConstrainedExecution.Consistency consistencyGuarantee, System.Runtime.ConstrainedExecution.Cer cer) { }
- public System.Runtime.ConstrainedExecution.Cer Cer { get { return default(System.Runtime.ConstrainedExecution.Cer); } }
- public System.Runtime.ConstrainedExecution.Consistency ConsistencyGuarantee { get { return default(System.Runtime.ConstrainedExecution.Consistency); } }
- }
-}
-namespace System.Runtime.ExceptionServices
-{
- public sealed partial class ExceptionDispatchInfo
- {
- internal ExceptionDispatchInfo() { }
- public System.Exception SourceException { get { throw null; } }
- public static System.Runtime.ExceptionServices.ExceptionDispatchInfo Capture(System.Exception source) { throw null; }
- public void Throw() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(64), AllowMultiple=false, Inherited=false)]
- public sealed partial class HandleProcessCorruptedStateExceptionsAttribute : System.Attribute
- {
- public HandleProcessCorruptedStateExceptionsAttribute() { }
- }
- public sealed partial class FirstChanceExceptionEventArgs : EventArgs
- {
- public FirstChanceExceptionEventArgs(Exception exception) { }
- public Exception Exception { get { throw null; } }
- }
-}
-namespace System.Runtime.InteropServices
-{
- [System.AttributeUsageAttribute((System.AttributeTargets)(64), AllowMultiple=false, Inherited=false)]
- public sealed partial class AllowReversePInvokeCallsAttribute : System.Attribute
- {
- public AllowReversePInvokeCallsAttribute() { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct ArrayWithOffset
- {
- [System.Security.SecuritySafeCriticalAttribute]
- public ArrayWithOffset(object array, int offset) { throw null;}
- public override bool Equals(object obj) { throw null; }
- public bool Equals(System.Runtime.InteropServices.ArrayWithOffset obj) { throw null; }
- public object GetArray() { throw null; }
- public override int GetHashCode() { throw null; }
- public int GetOffset() { throw null; }
- public static bool operator ==(System.Runtime.InteropServices.ArrayWithOffset a, System.Runtime.InteropServices.ArrayWithOffset b) { throw null; }
- public static bool operator !=(System.Runtime.InteropServices.ArrayWithOffset a, System.Runtime.InteropServices.ArrayWithOffset b) { throw null; }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1037), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class BestFitMappingAttribute : System.Attribute
- {
- public bool ThrowOnUnmappableChar;
- public BestFitMappingAttribute(bool BestFitMapping) { }
- public bool BestFitMapping { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class BStrWrapper
- {
- [System.Security.SecuritySafeCriticalAttribute]
- public BStrWrapper(object value) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public BStrWrapper(string value) { }
- public string WrappedObject { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum CallingConvention
- {
- Cdecl = 2,
- FastCall = 5,
- StdCall = 3,
- ThisCall = 4,
- Winapi = 1,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum CharSet
- {
- Ansi = 2,
- Auto = 4,
- None = 1,
- Unicode = 3,
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(5), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class ClassInterfaceAttribute : System.Attribute
- {
- public ClassInterfaceAttribute(short classInterfaceType) { }
- public ClassInterfaceAttribute(System.Runtime.InteropServices.ClassInterfaceType classInterfaceType) { }
- public System.Runtime.InteropServices.ClassInterfaceType Value { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum ClassInterfaceType
- {
- AutoDispatch = 1,
- AutoDual = 2,
- None = 0,
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1024), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class CoClassAttribute : System.Attribute
- {
- public CoClassAttribute(System.Type coClass) { }
- public System.Type CoClass { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class ComDefaultInterfaceAttribute : System.Attribute
- {
- public ComDefaultInterfaceAttribute(System.Type defaultInterface) { }
- public System.Type Value { get { throw null; } }
- }
- public static partial class ComEventsHelper
- {
- [System.Security.SecurityCriticalAttribute]
- public static void Combine(object rcw, System.Guid iid, int dispid, System.Delegate d) { }
- [System.Security.SecurityCriticalAttribute]
- public static System.Delegate Remove(object rcw, System.Guid iid, int dispid, System.Delegate d) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class COMException : System.Runtime.InteropServices.ExternalException
- {
- public COMException() { }
- public COMException(string message) { }
- public COMException(string message, System.Exception inner) { }
- public COMException(string message, int errorCode) { }
- protected COMException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- public override string ToString() { throw null; }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1028), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class ComImportAttribute : System.Attribute
- {
- public ComImportAttribute() { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum ComInterfaceType
- {
- InterfaceIsDual = 0,
- InterfaceIsIDispatch = 2,
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- InterfaceIsIInspectable = 3,
- InterfaceIsIUnknown = 1,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum ComMemberType
- {
- Method = 0,
- PropGet = 1,
- PropSet = 2,
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited=true)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class ComSourceInterfacesAttribute : System.Attribute
- {
- public ComSourceInterfacesAttribute(string sourceInterfaces) { }
- public ComSourceInterfacesAttribute(System.Type sourceInterface) { }
- public ComSourceInterfacesAttribute(System.Type sourceInterface1, System.Type sourceInterface2) { }
- public ComSourceInterfacesAttribute(System.Type sourceInterface1, System.Type sourceInterface2, System.Type sourceInterface3) { }
- public ComSourceInterfacesAttribute(System.Type sourceInterface1, System.Type sourceInterface2, System.Type sourceInterface3, System.Type sourceInterface4) { }
- public string Value { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(5597), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class ComVisibleAttribute : System.Attribute
- {
- public ComVisibleAttribute(bool visibility) { }
- public bool Value { get { throw null; } }
- }
- [System.Security.SecurityCriticalAttribute]
- public abstract partial class CriticalHandle : System.Runtime.ConstrainedExecution.CriticalFinalizerObject, System.IDisposable
- {
- protected System.IntPtr handle;
- protected CriticalHandle(System.IntPtr invalidHandleValue) { }
- public bool IsClosed { get { throw null; } }
- public abstract bool IsInvalid { get; }
- [System.Security.SecurityCriticalAttribute]
- public void Close() { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void Dispose() { }
- [System.Security.SecurityCriticalAttribute]
- protected virtual void Dispose(bool disposing) { }
- ~CriticalHandle() { }
- protected abstract bool ReleaseHandle();
- protected void SetHandle(System.IntPtr handle) { }
- public void SetHandleAsInvalid() { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class CurrencyWrapper
- {
- public CurrencyWrapper(decimal obj) { }
- public CurrencyWrapper(object obj) { }
- public decimal WrappedObject { get { throw null; } }
- }
- public enum CustomQueryInterfaceMode
- {
- Allow = 1,
- Ignore = 0,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public enum CustomQueryInterfaceResult
- {
- Failed = 2,
- Handled = 0,
- NotHandled = 1,
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(2), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class DefaultCharSetAttribute : System.Attribute
- {
- public DefaultCharSetAttribute(System.Runtime.InteropServices.CharSet charSet) { }
- public System.Runtime.InteropServices.CharSet CharSet { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(65), AllowMultiple=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public sealed partial class DefaultDllImportSearchPathsAttribute : System.Attribute
- {
- public DefaultDllImportSearchPathsAttribute(System.Runtime.InteropServices.DllImportSearchPath paths) { }
- public System.Runtime.InteropServices.DllImportSearchPath Paths { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class DispatchWrapper
- {
- [System.Security.SecuritySafeCriticalAttribute]
- public DispatchWrapper(object obj) { }
- public object WrappedObject { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(960), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class DispIdAttribute : System.Attribute
- {
- public DispIdAttribute(int dispId) { }
- public int Value { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(64), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class DllImportAttribute : System.Attribute
- {
- public bool BestFitMapping;
- public System.Runtime.InteropServices.CallingConvention CallingConvention;
- public System.Runtime.InteropServices.CharSet CharSet;
- public string EntryPoint;
- public bool ExactSpelling;
- public bool PreserveSig;
- public bool SetLastError;
- public bool ThrowOnUnmappableChar;
- public DllImportAttribute(string dllName) { }
- public string Value { get { throw null; } }
- }
- [System.FlagsAttribute]
- public enum DllImportSearchPath
- {
- ApplicationDirectory = 512,
- AssemblyDirectory = 2,
- LegacyBehavior = 0,
- SafeDirectories = 4096,
- System32 = 2048,
- UseDllDirectoryForDependencies = 256,
- UserDirectories = 1024,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class ErrorWrapper
- {
- [System.Security.SecuritySafeCriticalAttribute]
- public ErrorWrapper(System.Exception e) { }
- public ErrorWrapper(int errorCode) { }
- public ErrorWrapper(object errorCode) { }
- public int ErrorCode { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class ExternalException : System.SystemException
- {
- public ExternalException() { }
- protected ExternalException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public ExternalException(string message) { }
- public ExternalException(string message, System.Exception inner) { }
- public ExternalException(string message, int errorCode) { }
- public virtual int ErrorCode { get { throw null; } }
- public override string ToString() { throw null; }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(256), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class FieldOffsetAttribute : System.Attribute
- {
- public FieldOffsetAttribute(int offset) { }
- public int Value { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct GCHandle
- {
- public bool IsAllocated { get { throw null; } }
- public object Target { [System.Security.SecurityCriticalAttribute]get { throw null; } [System.Security.SecurityCriticalAttribute]set { } }
- [System.Security.SecurityCriticalAttribute]
- public System.IntPtr AddrOfPinnedObject() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.Runtime.InteropServices.GCHandle Alloc(object value) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.Runtime.InteropServices.GCHandle Alloc(object value, System.Runtime.InteropServices.GCHandleType type) { throw null; }
- public override bool Equals(object o) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public void Free() { }
- [System.Security.SecurityCriticalAttribute]
- public static System.Runtime.InteropServices.GCHandle FromIntPtr(System.IntPtr value) { throw null; }
- public override int GetHashCode() { throw null; }
- public static bool operator ==(System.Runtime.InteropServices.GCHandle a, System.Runtime.InteropServices.GCHandle b) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static explicit operator System.Runtime.InteropServices.GCHandle (System.IntPtr value) { throw null; }
- public static explicit operator System.IntPtr (System.Runtime.InteropServices.GCHandle value) { throw null; }
- public static bool operator !=(System.Runtime.InteropServices.GCHandle a, System.Runtime.InteropServices.GCHandle b) { throw null; }
- public static System.IntPtr ToIntPtr(System.Runtime.InteropServices.GCHandle value) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum GCHandleType
- {
- Normal = 2,
- Pinned = 3,
- Weak = 0,
- WeakTrackResurrection = 1,
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(5149), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class GuidAttribute : System.Attribute
- {
- public GuidAttribute(string guid) { }
- public string Value { get { throw null; } }
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial struct HandleRef
- {
- public HandleRef(object wrapper, System.IntPtr handle) { throw null;}
- public System.IntPtr Handle { get { throw null; } }
- public object Wrapper { get { throw null; } }
- public static explicit operator System.IntPtr (System.Runtime.InteropServices.HandleRef value) { throw null; }
- public static System.IntPtr ToIntPtr(System.Runtime.InteropServices.HandleRef value) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface ICustomAdapter
- {
- object GetUnderlyingObject();
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface ICustomFactory
- {
- MarshalByRefObject CreateInstance(Type serverType);
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface ICustomMarshaler
- {
- object MarshalNativeToManaged(System.IntPtr pNativeData);
- System.IntPtr MarshalManagedToNative(object ManagedObj);
- void CleanUpNativeData(System.IntPtr pNativeData);
- void CleanUpManagedData(object ManagedObj);
- int GetNativeDataSize();
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public partial interface ICustomQueryInterface
- {
- [System.Security.SecurityCriticalAttribute]
- System.Runtime.InteropServices.CustomQueryInterfaceResult GetInterface(ref System.Guid iid, out System.IntPtr ppv);
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(2048), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class InAttribute : System.Attribute
- {
- public InAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1024), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class InterfaceTypeAttribute : System.Attribute
- {
- public InterfaceTypeAttribute(short interfaceType) { }
- public InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType interfaceType) { }
- public System.Runtime.InteropServices.ComInterfaceType Value { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class InvalidComObjectException : System.SystemException
- {
- public InvalidComObjectException() { }
- public InvalidComObjectException(string message) { }
- public InvalidComObjectException(string message, System.Exception inner) { }
- protected InvalidComObjectException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class InvalidOleVariantTypeException : System.SystemException
- {
- public InvalidOleVariantTypeException() { }
- public InvalidOleVariantTypeException(string message) { }
- public InvalidOleVariantTypeException(string message, System.Exception inner) { }
- protected InvalidOleVariantTypeException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum LayoutKind
- {
- Auto = 3,
- Explicit = 2,
- Sequential = 0,
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(64), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class LCIDConversionAttribute : System.Attribute
- {
- public LCIDConversionAttribute(System.Int32 val) { }
- public System.Int32 Value { get { throw null; } }
- }
- [System.Security.SecurityCriticalAttribute]
- public static partial class Marshal
- {
- public static readonly int SystemDefaultCharSize;
- public static readonly int SystemMaxDBCSCharSize;
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public static int AddRef(System.IntPtr pUnk) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr AllocCoTaskMem(int cb) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr AllocHGlobal(int cb) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr AllocHGlobal(System.IntPtr cb) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public static bool AreComObjectsAvailableForCleanup() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static object BindToMoniker(string monikerName) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCritical]
- public static void ChangeWrapperHandleStrength(object otp, bool fIsWeak) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static void CleanupUnusedObjectsInCurrentContext() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static void Copy(byte[] source, int startIndex, System.IntPtr destination, int length) { }
- [System.Security.SecurityCriticalAttribute]
- public static void Copy(char[] source, int startIndex, System.IntPtr destination, int length) { }
- [System.Security.SecurityCriticalAttribute]
- public static void Copy(double[] source, int startIndex, System.IntPtr destination, int length) { }
- [System.Security.SecurityCriticalAttribute]
- public static void Copy(short[] source, int startIndex, System.IntPtr destination, int length) { }
- [System.Security.SecurityCriticalAttribute]
- public static void Copy(int[] source, int startIndex, System.IntPtr destination, int length) { }
- [System.Security.SecurityCriticalAttribute]
- public static void Copy(long[] source, int startIndex, System.IntPtr destination, int length) { }
- [System.Security.SecurityCriticalAttribute]
- public static void Copy(System.IntPtr source, byte[] destination, int startIndex, int length) { }
- [System.Security.SecurityCriticalAttribute]
- public static void Copy(System.IntPtr source, char[] destination, int startIndex, int length) { }
- [System.Security.SecurityCriticalAttribute]
- public static void Copy(System.IntPtr source, double[] destination, int startIndex, int length) { }
- [System.Security.SecurityCriticalAttribute]
- public static void Copy(System.IntPtr source, short[] destination, int startIndex, int length) { }
- [System.Security.SecurityCriticalAttribute]
- public static void Copy(System.IntPtr source, int[] destination, int startIndex, int length) { }
- [System.Security.SecurityCriticalAttribute]
- public static void Copy(System.IntPtr source, long[] destination, int startIndex, int length) { }
- [System.Security.SecurityCriticalAttribute]
- public static void Copy(System.IntPtr source, System.IntPtr[] destination, int startIndex, int length) { }
- [System.Security.SecurityCriticalAttribute]
- public static void Copy(System.IntPtr source, float[] destination, int startIndex, int length) { }
- [System.Security.SecurityCriticalAttribute]
- public static void Copy(System.IntPtr[] source, int startIndex, System.IntPtr destination, int length) { }
- [System.Security.SecurityCriticalAttribute]
- public static void Copy(float[] source, int startIndex, System.IntPtr destination, int length) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public static System.IntPtr CreateAggregatedObject(System.IntPtr pOuter, object o) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr CreateAggregatedObject<T>(System.IntPtr pOuter, T o) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static object CreateWrapperOfType(object o, System.Type t) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static TWrapper CreateWrapperOfType<T, TWrapper>(T o) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecurityCriticalAttribute]
- public static void DestroyStructure(System.IntPtr ptr, System.Type structuretype) { }
- [System.Security.SecurityCriticalAttribute]
- public static void DestroyStructure<T>(System.IntPtr ptr) { }
- [System.Security.SecurityCriticalAttribute]
- public static int FinalReleaseComObject(object o) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static void FreeBSTR(System.IntPtr ptr) { }
- [System.Security.SecurityCriticalAttribute]
- public static void FreeCoTaskMem(System.IntPtr ptr) { }
- [System.Security.SecurityCriticalAttribute]
- public static void FreeHGlobal(System.IntPtr hglobal) { }
- [System.Security.SecurityCriticalAttribute]
- public static Guid GenerateGuidForType(System.Type type) { throw null; }
- [System.Security.SecurityCritical]
- public static string GenerateProgIdForType(System.Type type) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr GetComInterfaceForObject(object o, System.Type T) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr GetComInterfaceForObject(object o, System.Type T, System.Runtime.InteropServices.CustomQueryInterfaceMode mode) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr GetComInterfaceForObject<T, TInterface>(T o) { throw null; }
- [System.Security.SecurityCritical]
- public static object GetComObjectData(object obj, object key) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.Delegate GetDelegateForFunctionPointer(System.IntPtr ptr, System.Type t) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static TDelegate GetDelegateForFunctionPointer<TDelegate>(System.IntPtr ptr) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public static int GetExceptionCode() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.Exception GetExceptionForHR(int errorCode) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.Exception GetExceptionForHR(int errorCode, System.IntPtr errorInfo) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr GetFunctionPointerForDelegate(System.Delegate d) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr GetFunctionPointerForDelegate<TDelegate>(TDelegate d) { throw null; }
- [System.Security.SecurityCritical]
- public static System.IntPtr GetHINSTANCE(System.Reflection.Module m) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public static int GetHRForException(System.Exception e) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static int GetHRForLastWin32Error() { throw null; }
- [System.Security.SecurityCritical]
- public static System.IntPtr GetIDispatchForObject(object o) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr GetIUnknownForObject(object o) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public static int GetLastWin32Error() { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public static void GetNativeVariantForObject(object obj, System.IntPtr pDstNativeVariant) { }
- [System.Security.SecurityCriticalAttribute]
- public static void GetNativeVariantForObject<T>(T obj, System.IntPtr pDstNativeVariant) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public static object GetObjectForIUnknown(System.IntPtr pUnk) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public static object GetObjectForNativeVariant(System.IntPtr pSrcNativeVariant) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static T GetObjectForNativeVariant<T>(System.IntPtr pSrcNativeVariant) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public static object[] GetObjectsForNativeVariants(System.IntPtr aSrcNativeVariant, int cVars) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static T[] GetObjectsForNativeVariants<T>(System.IntPtr aSrcNativeVariant, int cVars) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public static int GetStartComSlot(System.Type t) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCritical]
- public static object GetTypedObjectForIUnknown(System.IntPtr pUnk, System.Type t) { throw null; }
- public static System.Type GetTypeFromCLSID(System.Guid clsid) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static string GetTypeInfoName(System.Runtime.InteropServices.ComTypes.ITypeInfo typeInfo) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public static object GetUniqueObjectForIUnknown(System.IntPtr unknown) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]public static bool IsComObject(object o) { throw null; }
- public static System.IntPtr OffsetOf(System.Type t, string fieldName) { throw null; }
- public static System.IntPtr OffsetOf<T>(string fieldName) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static void Prelink(System.Reflection.MethodInfo m) { }
- [System.Security.SecurityCriticalAttribute]
- public static void PrelinkAll(System.Type c) { }
- [System.Security.SecurityCriticalAttribute]
- public static string PtrToStringAnsi(System.IntPtr ptr) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static string PtrToStringAnsi(System.IntPtr ptr, int len) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static string PtrToStringAuto(System.IntPtr ptr) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static string PtrToStringAuto(System.IntPtr ptr, int len) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static string PtrToStringBSTR(System.IntPtr ptr) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static string PtrToStringUni(System.IntPtr ptr) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static string PtrToStringUni(System.IntPtr ptr, int len) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static string PtrToStringUTF8(System.IntPtr ptr) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static string PtrToStringUTF8(System.IntPtr ptr, int byteLen) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecurityCriticalAttribute]
- public static void PtrToStructure(System.IntPtr ptr, object structure) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecurityCriticalAttribute]
- public static object PtrToStructure(System.IntPtr ptr, System.Type structureType) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static T PtrToStructure<T>(System.IntPtr ptr) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static void PtrToStructure<T>(System.IntPtr ptr, T structure) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public static int QueryInterface(System.IntPtr pUnk, ref System.Guid iid, out System.IntPtr ppv) { ppv = default(System.IntPtr); throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static byte ReadByte(System.IntPtr ptr) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static byte ReadByte(System.IntPtr ptr, int ofs) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static byte ReadByte(object ptr, int ofs) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static short ReadInt16(System.IntPtr ptr) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static short ReadInt16(System.IntPtr ptr, int ofs) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static short ReadInt16(object ptr, int ofs) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static int ReadInt32(System.IntPtr ptr) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static int ReadInt32(System.IntPtr ptr, int ofs) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static int ReadInt32(object ptr, int ofs) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static long ReadInt64(System.IntPtr ptr) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static long ReadInt64(System.IntPtr ptr, int ofs) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static long ReadInt64(object ptr, int ofs) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr ReadIntPtr(System.IntPtr ptr) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr ReadIntPtr(System.IntPtr ptr, int ofs) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr ReadIntPtr(object ptr, int ofs) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr ReAllocCoTaskMem(System.IntPtr pv, int cb) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr ReAllocHGlobal(System.IntPtr pv, System.IntPtr cb) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public static int Release(System.IntPtr pUnk) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static int ReleaseComObject(object o) { throw null; }
- [System.Security.SecurityCritical]
- public static bool SetComObjectData(object obj, object key, object data) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static int SizeOf(object structure) { throw null; }
- public static int SizeOf(System.Type t) { throw null; }
- public static int SizeOf<T>() { throw null; }
- public static int SizeOf<T>(T structure) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr StringToBSTR(string s) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr StringToCoTaskMemAnsi(string s) { throw null; }
- [System.Security.SecurityCritical]
- public static System.IntPtr StringToCoTaskMemAuto(string s) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr StringToCoTaskMemUni(string s) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr StringToCoTaskMemUTF8(string s) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr StringToHGlobalAnsi(string s) { throw null; }
- [System.Security.SecurityCritical]
- public static System.IntPtr StringToHGlobalAuto(string s) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr StringToHGlobalUni(string s) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecurityCriticalAttribute]
- public static void StructureToPtr(object structure, System.IntPtr ptr, bool fDeleteOld) { }
- [System.Security.SecurityCriticalAttribute]
- public static void StructureToPtr<T>(T structure, System.IntPtr ptr, bool fDeleteOld) { }
- [System.Security.SecurityCriticalAttribute]
- public static void ThrowExceptionForHR(int errorCode) { }
- [System.Security.SecurityCriticalAttribute]
- public static void ThrowExceptionForHR(int errorCode, System.IntPtr errorInfo) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public static System.IntPtr UnsafeAddrOfPinnedArrayElement(System.Array arr, int index) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr UnsafeAddrOfPinnedArrayElement<T>(T[] arr, int index) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static void WriteByte(System.IntPtr ptr, byte val) { }
- [System.Security.SecurityCriticalAttribute]
- public static void WriteByte(System.IntPtr ptr, int ofs, byte val) { }
- [System.Security.SecurityCriticalAttribute]
- public static void WriteByte(object ptr, int ofs, byte val) { ptr = default(object); }
- [System.Security.SecurityCriticalAttribute]
- public static void WriteInt16(System.IntPtr ptr, char val) { }
- [System.Security.SecurityCriticalAttribute]
- public static void WriteInt16(System.IntPtr ptr, short val) { }
- [System.Security.SecurityCriticalAttribute]
- public static void WriteInt16(System.IntPtr ptr, int ofs, char val) { }
- [System.Security.SecurityCriticalAttribute]
- public static void WriteInt16(System.IntPtr ptr, int ofs, short val) { }
- [System.Security.SecurityCriticalAttribute]
- public static void WriteInt16(object ptr, int ofs, char val) { ptr = default(object); }
- [System.Security.SecurityCriticalAttribute]
- public static void WriteInt16(object ptr, int ofs, short val) { ptr = default(object); }
- [System.Security.SecurityCriticalAttribute]
- public static void WriteInt32(System.IntPtr ptr, int val) { }
- [System.Security.SecurityCriticalAttribute]
- public static void WriteInt32(System.IntPtr ptr, int ofs, int val) { }
- [System.Security.SecurityCriticalAttribute]
- public static void WriteInt32(object ptr, int ofs, int val) { ptr = default(object); }
- [System.Security.SecurityCriticalAttribute]
- public static void WriteInt64(System.IntPtr ptr, int ofs, long val) { }
- [System.Security.SecurityCriticalAttribute]
- public static void WriteInt64(System.IntPtr ptr, long val) { }
- [System.Security.SecurityCriticalAttribute]
- public static void WriteInt64(object ptr, int ofs, long val) { ptr = default(object); }
- [System.Security.SecurityCriticalAttribute]
- public static void WriteIntPtr(System.IntPtr ptr, int ofs, System.IntPtr val) { }
- [System.Security.SecurityCriticalAttribute]
- public static void WriteIntPtr(System.IntPtr ptr, System.IntPtr val) { }
- [System.Security.SecurityCriticalAttribute]
- public static void WriteIntPtr(object ptr, int ofs, System.IntPtr val) { ptr = default(object); }
- [System.Security.SecurityCriticalAttribute]
- public static void ZeroFreeBSTR(System.IntPtr s) { }
- [System.Security.SecurityCriticalAttribute]
- public static void ZeroFreeCoTaskMemAnsi(System.IntPtr s) { }
- [System.Security.SecurityCriticalAttribute]
- public static void ZeroFreeCoTaskMemUnicode(System.IntPtr s) { }
- [System.Security.SecurityCriticalAttribute]
- public static void ZeroFreeCoTaskMemUTF8(System.IntPtr s) { }
- [System.Security.SecurityCriticalAttribute]
- public static void ZeroFreeGlobalAllocAnsi(System.IntPtr s) { }
- [System.Security.SecurityCriticalAttribute]
- public static void ZeroFreeGlobalAllocUnicode(System.IntPtr s) { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(10496), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class MarshalAsAttribute : System.Attribute
- {
- public System.Runtime.InteropServices.UnmanagedType ArraySubType;
- public int IidParameterIndex;
- public string MarshalCookie;
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public string MarshalType;
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public System.Type MarshalTypeRef;
- public System.Runtime.InteropServices.VarEnum SafeArraySubType;
- public System.Type SafeArrayUserDefinedSubType;
- public int SizeConst;
- public short SizeParamIndex;
- public MarshalAsAttribute(short unmanagedType) { }
- public MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType unmanagedType) { }
- public System.Runtime.InteropServices.UnmanagedType Value { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class MarshalDirectiveException : System.SystemException
- {
- public MarshalDirectiveException() { }
- public MarshalDirectiveException(string message) { }
- public MarshalDirectiveException(string message, System.Exception inner) { }
- protected MarshalDirectiveException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(64))]
- public sealed partial class NativeCallableAttribute : System.Attribute
- {
- public System.Runtime.InteropServices.CallingConvention CallingConvention;
- public string EntryPoint;
- public NativeCallableAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(2048), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class OptionalAttribute : System.Attribute
- {
- public OptionalAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(2048), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class OutAttribute : System.Attribute
- {
- public OutAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(64), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class PreserveSigAttribute : System.Attribute
- {
- public PreserveSigAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(4), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class ProgIdAttribute : System.Attribute
- {
- public ProgIdAttribute(String val) { }
- public String Value { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class SafeArrayRankMismatchException : System.SystemException
- {
- public SafeArrayRankMismatchException() { }
- public SafeArrayRankMismatchException(string message) { }
- public SafeArrayRankMismatchException(string message, System.Exception inner) { }
- protected SafeArrayRankMismatchException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class SafeArrayTypeMismatchException : System.SystemException
- {
- public SafeArrayTypeMismatchException() { }
- public SafeArrayTypeMismatchException(string message) { }
- public SafeArrayTypeMismatchException(string message, System.Exception inner) { }
- protected SafeArrayTypeMismatchException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Security.SecurityCriticalAttribute]
- public abstract partial class SafeBuffer : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
- {
- protected SafeBuffer(bool ownsHandle) : base(ownsHandle) { }
- [System.CLSCompliantAttribute(false)]
- public ulong ByteLength { get { throw null; } }
- [System.CLSCompliantAttribute(false)]
- public unsafe void AcquirePointer(ref byte* pointer) { }
- [System.CLSCompliantAttribute(false)]
- public void Initialize(uint numElements, uint sizeOfEachElement) { }
- [System.CLSCompliantAttribute(false)]
- public void Initialize(ulong numBytes) { }
- [System.CLSCompliantAttribute(false)]
- public void Initialize<T>(uint numElements) where T : struct { }
- [System.CLSCompliantAttribute(false)]
- public T Read<T>(ulong byteOffset) where T : struct { throw null; }
- [System.CLSCompliantAttribute(false)]
- public void ReadArray<T>(ulong byteOffset, T[] array, int index, int count) where T : struct { }
- public void ReleasePointer() { }
- [System.CLSCompliantAttribute(false)]
- public void Write<T>(ulong byteOffset, T value) where T : struct { }
- [System.CLSCompliantAttribute(false)]
- public void WriteArray<T>(ulong byteOffset, T[] array, int index, int count) where T : struct { }
- }
- [System.Security.SecurityCriticalAttribute]
- public abstract partial class SafeHandle : System.Runtime.ConstrainedExecution.CriticalFinalizerObject, System.IDisposable
- {
- protected System.IntPtr handle;
- protected SafeHandle() { }
- protected SafeHandle(System.IntPtr invalidHandleValue, bool ownsHandle) { }
- public bool IsClosed { get { throw null; } }
- public abstract bool IsInvalid { get; }
- [System.Security.SecurityCriticalAttribute]
- public void Close() { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public void DangerousAddRef(ref bool success) { }
- public System.IntPtr DangerousGetHandle() { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public void DangerousRelease() { }
- [System.Security.SecuritySafeCriticalAttribute]
- public void Dispose() { }
- [System.Security.SecurityCriticalAttribute]
- protected virtual void Dispose(bool disposing) { }
- ~SafeHandle() { }
- protected abstract bool ReleaseHandle();
- protected void SetHandle(System.IntPtr handle) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCriticalAttribute]
- public void SetHandleAsInvalid() { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class SEHException : System.Runtime.InteropServices.ExternalException
- {
- public SEHException() { }
- public SEHException(string message) { }
- public SEHException(string message, System.Exception inner) { }
- protected SEHException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- public virtual bool CanResume() { throw null; }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(12), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class StructLayoutAttribute : System.Attribute
- {
- public System.Runtime.InteropServices.CharSet CharSet;
- public int Pack;
- public int Size;
- public StructLayoutAttribute(short layoutKind) { }
- public StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind layoutKind) { }
- public System.Runtime.InteropServices.LayoutKind Value { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(5144), AllowMultiple=false, Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public sealed partial class TypeIdentifierAttribute : System.Attribute
- {
- public TypeIdentifierAttribute() { }
- public TypeIdentifierAttribute(string scope, string identifier) { }
- public string Identifier { get { throw null; } }
- public string Scope { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class UnknownWrapper
- {
- public UnknownWrapper(object obj) { }
- public object WrappedObject { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(4096), AllowMultiple=false, Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class UnmanagedFunctionPointerAttribute : System.Attribute
- {
- public bool BestFitMapping;
- public System.Runtime.InteropServices.CharSet CharSet;
- public bool SetLastError;
- public bool ThrowOnUnmappableChar;
- public UnmanagedFunctionPointerAttribute(System.Runtime.InteropServices.CallingConvention callingConvention) { }
- public System.Runtime.InteropServices.CallingConvention CallingConvention { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum UnmanagedType
- {
- AnsiBStr = 35,
- AsAny = 40,
- Bool = 2,
- BStr = 19,
- ByValArray = 30,
- ByValTStr = 23,
- Currency = 15,
- CustomMarshaler = 44,
- Error = 45,
- FunctionPtr = 38,
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- HString = 47,
- I1 = 3,
- I2 = 5,
- I4 = 7,
- I8 = 9,
- IDispatch = 26,
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- IInspectable = 46,
- Interface = 28,
- IUnknown = 25,
- LPArray = 42,
- LPStr = 20,
- LPStruct = 43,
- LPTStr = 22,
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- LPUTF8Str = 48,
- LPWStr = 21,
- R4 = 11,
- R8 = 12,
- SafeArray = 29,
- Struct = 27,
- SysInt = 31,
- SysUInt = 32,
- TBStr = 36,
- U1 = 4,
- U2 = 6,
- U4 = 8,
- U8 = 10,
- VariantBool = 37,
- VBByRefStr = 34,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum VarEnum
- {
- VT_ARRAY = 8192,
- VT_BLOB = 65,
- VT_BLOB_OBJECT = 70,
- VT_BOOL = 11,
- VT_BSTR = 8,
- VT_BYREF = 16384,
- VT_CARRAY = 28,
- VT_CF = 71,
- VT_CLSID = 72,
- VT_CY = 6,
- VT_DATE = 7,
- VT_DECIMAL = 14,
- VT_DISPATCH = 9,
- VT_EMPTY = 0,
- VT_ERROR = 10,
- VT_FILETIME = 64,
- VT_HRESULT = 25,
- VT_I1 = 16,
- VT_I2 = 2,
- VT_I4 = 3,
- VT_I8 = 20,
- VT_INT = 22,
- VT_LPSTR = 30,
- VT_LPWSTR = 31,
- VT_NULL = 1,
- VT_PTR = 26,
- VT_R4 = 4,
- VT_R8 = 5,
- VT_RECORD = 36,
- VT_SAFEARRAY = 27,
- VT_STORAGE = 67,
- VT_STORED_OBJECT = 69,
- VT_STREAM = 66,
- VT_STREAMED_OBJECT = 68,
- VT_UI1 = 17,
- VT_UI2 = 18,
- VT_UI4 = 19,
- VT_UI8 = 21,
- VT_UINT = 23,
- VT_UNKNOWN = 13,
- VT_USERDEFINED = 29,
- VT_VARIANT = 12,
- VT_VECTOR = 4096,
- VT_VOID = 24,
- }
- public sealed partial class VariantWrapper
- {
- public VariantWrapper(object obj) { }
- public object WrappedObject { get { throw null; } }
- }
-}
-namespace System.Runtime.InteropServices.ComTypes
-{
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct BIND_OPTS
- {
- public int cbStruct;
- public int dwTickCountDeadline;
- public int grfFlags;
- public int grfMode;
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Explicit)]
- public partial struct BINDPTR
- {
- [System.Runtime.InteropServices.FieldOffsetAttribute(0)]
- public System.IntPtr lpfuncdesc;
- [System.Runtime.InteropServices.FieldOffsetAttribute(0)]
- public System.IntPtr lptcomp;
- [System.Runtime.InteropServices.FieldOffsetAttribute(0)]
- public System.IntPtr lpvardesc;
- }
- public enum CALLCONV
- {
- CC_CDECL = 1,
- CC_MACPASCAL = 3,
- CC_MAX = 9,
- CC_MPWCDECL = 7,
- CC_MPWPASCAL = 8,
- CC_MSCPASCAL = 2,
- CC_PASCAL = 2,
- CC_RESERVED = 5,
- CC_STDCALL = 4,
- CC_SYSCALL = 6,
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct CONNECTDATA
- {
- public int dwCookie;
- public object pUnk;
- }
- public enum DESCKIND
- {
- DESCKIND_FUNCDESC = 1,
- DESCKIND_IMPLICITAPPOBJ = 4,
- DESCKIND_MAX = 5,
- DESCKIND_NONE = 0,
- DESCKIND_TYPECOMP = 3,
- DESCKIND_VARDESC = 2,
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct DISPPARAMS
- {
- public int cArgs;
- public int cNamedArgs;
- public System.IntPtr rgdispidNamedArgs;
- public System.IntPtr rgvarg;
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct ELEMDESC
- {
- public System.Runtime.InteropServices.ComTypes.ELEMDESC.DESCUNION desc;
- public System.Runtime.InteropServices.ComTypes.TYPEDESC tdesc;
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Explicit)]
- public partial struct DESCUNION
- {
- [System.Runtime.InteropServices.FieldOffsetAttribute(0)]
- public System.Runtime.InteropServices.ComTypes.IDLDESC idldesc;
- [System.Runtime.InteropServices.FieldOffsetAttribute(0)]
- public System.Runtime.InteropServices.ComTypes.PARAMDESC paramdesc;
- }
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct EXCEPINFO
- {
- public string bstrDescription;
- public string bstrHelpFile;
- public string bstrSource;
- public int dwHelpContext;
- public System.IntPtr pfnDeferredFillIn;
- public System.IntPtr pvReserved;
- public int scode;
- public short wCode;
- public short wReserved;
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct FILETIME
- {
- public int dwHighDateTime;
- public int dwLowDateTime;
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct FUNCDESC
- {
- public System.Runtime.InteropServices.ComTypes.CALLCONV callconv;
- public short cParams;
- public short cParamsOpt;
- public short cScodes;
- public System.Runtime.InteropServices.ComTypes.ELEMDESC elemdescFunc;
- public System.Runtime.InteropServices.ComTypes.FUNCKIND funckind;
- public System.Runtime.InteropServices.ComTypes.INVOKEKIND invkind;
- public System.IntPtr lprgelemdescParam;
- public System.IntPtr lprgscode;
- public int memid;
- public short oVft;
- public short wFuncFlags;
- }
- [System.FlagsAttribute]
- public enum FUNCFLAGS : short
- {
- FUNCFLAG_FBINDABLE = (short)4,
- FUNCFLAG_FDEFAULTBIND = (short)32,
- FUNCFLAG_FDEFAULTCOLLELEM = (short)256,
- FUNCFLAG_FDISPLAYBIND = (short)16,
- FUNCFLAG_FHIDDEN = (short)64,
- FUNCFLAG_FIMMEDIATEBIND = (short)4096,
- FUNCFLAG_FNONBROWSABLE = (short)1024,
- FUNCFLAG_FREPLACEABLE = (short)2048,
- FUNCFLAG_FREQUESTEDIT = (short)8,
- FUNCFLAG_FRESTRICTED = (short)1,
- FUNCFLAG_FSOURCE = (short)2,
- FUNCFLAG_FUIDEFAULT = (short)512,
- FUNCFLAG_FUSESGETLASTERROR = (short)128,
- }
- public enum FUNCKIND
- {
- FUNC_DISPATCH = 4,
- FUNC_NONVIRTUAL = 2,
- FUNC_PUREVIRTUAL = 1,
- FUNC_STATIC = 3,
- FUNC_VIRTUAL = 0,
- }
- [System.Runtime.InteropServices.GuidAttribute("0000000e-0000-0000-C000-000000000046")]
- [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))]
- public partial interface IBindCtx
- {
- void EnumObjectParam(out System.Runtime.InteropServices.ComTypes.IEnumString ppenum);
- void GetBindOptions(ref System.Runtime.InteropServices.ComTypes.BIND_OPTS pbindopts);
- void GetObjectParam(string pszKey, out object ppunk);
- void GetRunningObjectTable(out System.Runtime.InteropServices.ComTypes.IRunningObjectTable pprot);
- void RegisterObjectBound(object punk);
- void RegisterObjectParam(string pszKey, object punk);
- void ReleaseBoundObjects();
- void RevokeObjectBound(object punk);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]int RevokeObjectParam(string pszKey);
- void SetBindOptions(ref System.Runtime.InteropServices.ComTypes.BIND_OPTS pbindopts);
- }
- [System.Runtime.InteropServices.GuidAttribute("B196B286-BAB4-101A-B69C-00AA00341D07")]
- [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))]
- public partial interface IConnectionPoint
- {
- void Advise(object pUnkSink, out int pdwCookie);
- void EnumConnections(out System.Runtime.InteropServices.ComTypes.IEnumConnections ppEnum);
- void GetConnectionInterface(out System.Guid pIID);
- void GetConnectionPointContainer(out System.Runtime.InteropServices.ComTypes.IConnectionPointContainer ppCPC);
- void Unadvise(int dwCookie);
- }
- [System.Runtime.InteropServices.GuidAttribute("B196B284-BAB4-101A-B69C-00AA00341D07")]
- [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))]
- public partial interface IConnectionPointContainer
- {
- void EnumConnectionPoints(out System.Runtime.InteropServices.ComTypes.IEnumConnectionPoints ppEnum);
- void FindConnectionPoint(ref System.Guid riid, out System.Runtime.InteropServices.ComTypes.IConnectionPoint ppCP);
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct IDLDESC
- {
- public System.IntPtr dwReserved;
- public System.Runtime.InteropServices.ComTypes.IDLFLAG wIDLFlags;
- }
- [System.FlagsAttribute]
- public enum IDLFLAG : short
- {
- IDLFLAG_FIN = (short)1,
- IDLFLAG_FLCID = (short)4,
- IDLFLAG_FOUT = (short)2,
- IDLFLAG_FRETVAL = (short)8,
- IDLFLAG_NONE = (short)0,
- }
- [System.Runtime.InteropServices.GuidAttribute("B196B285-BAB4-101A-B69C-00AA00341D07")]
- [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))]
- public partial interface IEnumConnectionPoints
- {
- void Clone(out System.Runtime.InteropServices.ComTypes.IEnumConnectionPoints ppenum);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]int Next(int celt, System.Runtime.InteropServices.ComTypes.IConnectionPoint[] rgelt, System.IntPtr pceltFetched);
- void Reset();
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]int Skip(int celt);
- }
- [System.Runtime.InteropServices.GuidAttribute("B196B287-BAB4-101A-B69C-00AA00341D07")]
- [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))]
- public partial interface IEnumConnections
- {
- void Clone(out System.Runtime.InteropServices.ComTypes.IEnumConnections ppenum);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]int Next(int celt, System.Runtime.InteropServices.ComTypes.CONNECTDATA[] rgelt, System.IntPtr pceltFetched);
- void Reset();
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]int Skip(int celt);
- }
- [System.Runtime.InteropServices.GuidAttribute("00000102-0000-0000-C000-000000000046")]
- [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))]
- public partial interface IEnumMoniker
- {
- void Clone(out System.Runtime.InteropServices.ComTypes.IEnumMoniker ppenum);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]int Next(int celt, System.Runtime.InteropServices.ComTypes.IMoniker[] rgelt, System.IntPtr pceltFetched);
- void Reset();
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]int Skip(int celt);
- }
- [System.Runtime.InteropServices.GuidAttribute("00000101-0000-0000-C000-000000000046")]
- [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))]
- public partial interface IEnumString
- {
- void Clone(out System.Runtime.InteropServices.ComTypes.IEnumString ppenum);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]int Next(int celt, string[] rgelt, System.IntPtr pceltFetched);
- void Reset();
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]int Skip(int celt);
- }
- [System.Runtime.InteropServices.GuidAttribute("00020404-0000-0000-C000-000000000046")]
- [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))]
- public partial interface IEnumVARIANT
- {
- System.Runtime.InteropServices.ComTypes.IEnumVARIANT Clone();
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]int Next(int celt, object[] rgVar, System.IntPtr pceltFetched);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]int Reset();
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]int Skip(int celt);
- }
- [System.Runtime.InteropServices.GuidAttribute("0000000f-0000-0000-C000-000000000046")]
- [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))]
- public partial interface IMoniker
- {
- void BindToObject(System.Runtime.InteropServices.ComTypes.IBindCtx pbc, System.Runtime.InteropServices.ComTypes.IMoniker pmkToLeft, ref System.Guid riidResult, out object ppvResult);
- void BindToStorage(System.Runtime.InteropServices.ComTypes.IBindCtx pbc, System.Runtime.InteropServices.ComTypes.IMoniker pmkToLeft, ref System.Guid riid, out object ppvObj);
- void CommonPrefixWith(System.Runtime.InteropServices.ComTypes.IMoniker pmkOther, out System.Runtime.InteropServices.ComTypes.IMoniker ppmkPrefix);
- void ComposeWith(System.Runtime.InteropServices.ComTypes.IMoniker pmkRight, bool fOnlyIfNotGeneric, out System.Runtime.InteropServices.ComTypes.IMoniker ppmkComposite);
- void Enum(bool fForward, out System.Runtime.InteropServices.ComTypes.IEnumMoniker ppenumMoniker);
- void GetClassID(out System.Guid pClassID);
- void GetDisplayName(System.Runtime.InteropServices.ComTypes.IBindCtx pbc, System.Runtime.InteropServices.ComTypes.IMoniker pmkToLeft, out string ppszDisplayName);
- void GetSizeMax(out long pcbSize);
- void GetTimeOfLastChange(System.Runtime.InteropServices.ComTypes.IBindCtx pbc, System.Runtime.InteropServices.ComTypes.IMoniker pmkToLeft, out System.Runtime.InteropServices.ComTypes.FILETIME pFileTime);
- void Hash(out int pdwHash);
- void Inverse(out System.Runtime.InteropServices.ComTypes.IMoniker ppmk);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]int IsDirty();
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]int IsEqual(System.Runtime.InteropServices.ComTypes.IMoniker pmkOtherMoniker);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]int IsRunning(System.Runtime.InteropServices.ComTypes.IBindCtx pbc, System.Runtime.InteropServices.ComTypes.IMoniker pmkToLeft, System.Runtime.InteropServices.ComTypes.IMoniker pmkNewlyRunning);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]int IsSystemMoniker(out int pdwMksys);
- void Load(System.Runtime.InteropServices.ComTypes.IStream pStm);
- void ParseDisplayName(System.Runtime.InteropServices.ComTypes.IBindCtx pbc, System.Runtime.InteropServices.ComTypes.IMoniker pmkToLeft, string pszDisplayName, out int pchEaten, out System.Runtime.InteropServices.ComTypes.IMoniker ppmkOut);
- void Reduce(System.Runtime.InteropServices.ComTypes.IBindCtx pbc, int dwReduceHowFar, ref System.Runtime.InteropServices.ComTypes.IMoniker ppmkToLeft, out System.Runtime.InteropServices.ComTypes.IMoniker ppmkReduced);
- void RelativePathTo(System.Runtime.InteropServices.ComTypes.IMoniker pmkOther, out System.Runtime.InteropServices.ComTypes.IMoniker ppmkRelPath);
- void Save(System.Runtime.InteropServices.ComTypes.IStream pStm, bool fClearDirty);
- }
- [System.FlagsAttribute]
- public enum IMPLTYPEFLAGS
- {
- IMPLTYPEFLAG_FDEFAULT = 1,
- IMPLTYPEFLAG_FDEFAULTVTABLE = 8,
- IMPLTYPEFLAG_FRESTRICTED = 4,
- IMPLTYPEFLAG_FSOURCE = 2,
- }
- [System.FlagsAttribute]
- public enum INVOKEKIND
- {
- INVOKE_FUNC = 1,
- INVOKE_PROPERTYGET = 2,
- INVOKE_PROPERTYPUT = 4,
- INVOKE_PROPERTYPUTREF = 8,
- }
- [System.Runtime.InteropServices.GuidAttribute("0000010b-0000-0000-C000-000000000046")]
- [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))]
- public partial interface IPersistFile
- {
- void GetClassID(out System.Guid pClassID);
- void GetCurFile(out string ppszFileName);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]int IsDirty();
- void Load(string pszFileName, int dwMode);
- void Save(string pszFileName, bool fRemember);
- void SaveCompleted(string pszFileName);
- }
- [System.Runtime.InteropServices.GuidAttribute("00000010-0000-0000-C000-000000000046")]
- [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))]
- public partial interface IRunningObjectTable
- {
- void EnumRunning(out System.Runtime.InteropServices.ComTypes.IEnumMoniker ppenumMoniker);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]int GetObject(System.Runtime.InteropServices.ComTypes.IMoniker pmkObjectName, out object ppunkObject);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]int GetTimeOfLastChange(System.Runtime.InteropServices.ComTypes.IMoniker pmkObjectName, out System.Runtime.InteropServices.ComTypes.FILETIME pfiletime);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]int IsRunning(System.Runtime.InteropServices.ComTypes.IMoniker pmkObjectName);
- void NoteChangeTime(int dwRegister, ref System.Runtime.InteropServices.ComTypes.FILETIME pfiletime);
- int Register(int grfFlags, object punkObject, System.Runtime.InteropServices.ComTypes.IMoniker pmkObjectName);
- void Revoke(int dwRegister);
- }
- [System.Runtime.InteropServices.GuidAttribute("0000000c-0000-0000-C000-000000000046")]
- [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))]
- public partial interface IStream
- {
- void Clone(out System.Runtime.InteropServices.ComTypes.IStream ppstm);
- void Commit(int grfCommitFlags);
- void CopyTo(System.Runtime.InteropServices.ComTypes.IStream pstm, long cb, System.IntPtr pcbRead, System.IntPtr pcbWritten);
- void LockRegion(long libOffset, long cb, int dwLockType);
- void Read(byte[] pv, int cb, System.IntPtr pcbRead);
- void Revert();
- void Seek(long dlibMove, int dwOrigin, System.IntPtr plibNewPosition);
- void SetSize(long libNewSize);
- void Stat(out System.Runtime.InteropServices.ComTypes.STATSTG pstatstg, int grfStatFlag);
- void UnlockRegion(long libOffset, long cb, int dwLockType);
- void Write(byte[] pv, int cb, System.IntPtr pcbWritten);
- }
- [System.Runtime.InteropServices.GuidAttribute("00020403-0000-0000-C000-000000000046")]
- [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))]
- public partial interface ITypeComp
- {
- void Bind(string szName, int lHashVal, short wFlags, out System.Runtime.InteropServices.ComTypes.ITypeInfo ppTInfo, out System.Runtime.InteropServices.ComTypes.DESCKIND pDescKind, out System.Runtime.InteropServices.ComTypes.BINDPTR pBindPtr);
- void BindType(string szName, int lHashVal, out System.Runtime.InteropServices.ComTypes.ITypeInfo ppTInfo, out System.Runtime.InteropServices.ComTypes.ITypeComp ppTComp);
- }
- [System.Runtime.InteropServices.GuidAttribute("00020401-0000-0000-C000-000000000046")]
- [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))]
- public partial interface ITypeInfo
- {
- void AddressOfMember(int memid, System.Runtime.InteropServices.ComTypes.INVOKEKIND invKind, out System.IntPtr ppv);
- void CreateInstance(object pUnkOuter, ref System.Guid riid, out object ppvObj);
- void GetContainingTypeLib(out System.Runtime.InteropServices.ComTypes.ITypeLib ppTLB, out int pIndex);
- void GetDllEntry(int memid, System.Runtime.InteropServices.ComTypes.INVOKEKIND invKind, System.IntPtr pBstrDllName, System.IntPtr pBstrName, System.IntPtr pwOrdinal);
- void GetDocumentation(int index, out string strName, out string strDocString, out int dwHelpContext, out string strHelpFile);
- void GetFuncDesc(int index, out System.IntPtr ppFuncDesc);
- void GetIDsOfNames(string[] rgszNames, int cNames, int[] pMemId);
- void GetImplTypeFlags(int index, out System.Runtime.InteropServices.ComTypes.IMPLTYPEFLAGS pImplTypeFlags);
- void GetMops(int memid, out string pBstrMops);
- void GetNames(int memid, string[] rgBstrNames, int cMaxNames, out int pcNames);
- void GetRefTypeInfo(int hRef, out System.Runtime.InteropServices.ComTypes.ITypeInfo ppTI);
- void GetRefTypeOfImplType(int index, out int href);
- void GetTypeAttr(out System.IntPtr ppTypeAttr);
- void GetTypeComp(out System.Runtime.InteropServices.ComTypes.ITypeComp ppTComp);
- void GetVarDesc(int index, out System.IntPtr ppVarDesc);
- void Invoke(object pvInstance, int memid, short wFlags, ref System.Runtime.InteropServices.ComTypes.DISPPARAMS pDispParams, System.IntPtr pVarResult, System.IntPtr pExcepInfo, out int puArgErr);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]void ReleaseFuncDesc(System.IntPtr pFuncDesc);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]void ReleaseTypeAttr(System.IntPtr pTypeAttr);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]void ReleaseVarDesc(System.IntPtr pVarDesc);
- }
- [System.Runtime.InteropServices.GuidAttribute("00020412-0000-0000-C000-000000000046")]
- [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))]
- public partial interface ITypeInfo2 : System.Runtime.InteropServices.ComTypes.ITypeInfo
- {
- new void AddressOfMember(int memid, System.Runtime.InteropServices.ComTypes.INVOKEKIND invKind, out System.IntPtr ppv);
- new void CreateInstance(object pUnkOuter, ref System.Guid riid, out object ppvObj);
- void GetAllCustData(System.IntPtr pCustData);
- void GetAllFuncCustData(int index, System.IntPtr pCustData);
- void GetAllImplTypeCustData(int index, System.IntPtr pCustData);
- void GetAllParamCustData(int indexFunc, int indexParam, System.IntPtr pCustData);
- void GetAllVarCustData(int index, System.IntPtr pCustData);
- new void GetContainingTypeLib(out System.Runtime.InteropServices.ComTypes.ITypeLib ppTLB, out int pIndex);
- void GetCustData(ref System.Guid guid, out object pVarVal);
- new void GetDllEntry(int memid, System.Runtime.InteropServices.ComTypes.INVOKEKIND invKind, System.IntPtr pBstrDllName, System.IntPtr pBstrName, System.IntPtr pwOrdinal);
- new void GetDocumentation(int index, out string strName, out string strDocString, out int dwHelpContext, out string strHelpFile);
- void GetDocumentation2(int memid, out string pbstrHelpString, out int pdwHelpStringContext, out string pbstrHelpStringDll);
- void GetFuncCustData(int index, ref System.Guid guid, out object pVarVal);
- new void GetFuncDesc(int index, out System.IntPtr ppFuncDesc);
- void GetFuncIndexOfMemId(int memid, System.Runtime.InteropServices.ComTypes.INVOKEKIND invKind, out int pFuncIndex);
- new void GetIDsOfNames(string[] rgszNames, int cNames, int[] pMemId);
- void GetImplTypeCustData(int index, ref System.Guid guid, out object pVarVal);
- new void GetImplTypeFlags(int index, out System.Runtime.InteropServices.ComTypes.IMPLTYPEFLAGS pImplTypeFlags);
- new void GetMops(int memid, out string pBstrMops);
- new void GetNames(int memid, string[] rgBstrNames, int cMaxNames, out int pcNames);
- void GetParamCustData(int indexFunc, int indexParam, ref System.Guid guid, out object pVarVal);
- new void GetRefTypeInfo(int hRef, out System.Runtime.InteropServices.ComTypes.ITypeInfo ppTI);
- new void GetRefTypeOfImplType(int index, out int href);
- new void GetTypeAttr(out System.IntPtr ppTypeAttr);
- new void GetTypeComp(out System.Runtime.InteropServices.ComTypes.ITypeComp ppTComp);
- void GetTypeFlags(out int pTypeFlags);
- void GetTypeKind(out System.Runtime.InteropServices.ComTypes.TYPEKIND pTypeKind);
- void GetVarCustData(int index, ref System.Guid guid, out object pVarVal);
- new void GetVarDesc(int index, out System.IntPtr ppVarDesc);
- void GetVarIndexOfMemId(int memid, out int pVarIndex);
- new void Invoke(object pvInstance, int memid, short wFlags, ref System.Runtime.InteropServices.ComTypes.DISPPARAMS pDispParams, System.IntPtr pVarResult, System.IntPtr pExcepInfo, out int puArgErr);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]new void ReleaseFuncDesc(System.IntPtr pFuncDesc);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]new void ReleaseTypeAttr(System.IntPtr pTypeAttr);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]new void ReleaseVarDesc(System.IntPtr pVarDesc);
- }
- [System.Runtime.InteropServices.GuidAttribute("00020402-0000-0000-C000-000000000046")]
- [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))]
- public partial interface ITypeLib
- {
- void FindName(string szNameBuf, int lHashVal, System.Runtime.InteropServices.ComTypes.ITypeInfo[] ppTInfo, int[] rgMemId, ref short pcFound);
- void GetDocumentation(int index, out string strName, out string strDocString, out int dwHelpContext, out string strHelpFile);
- void GetLibAttr(out System.IntPtr ppTLibAttr);
- void GetTypeComp(out System.Runtime.InteropServices.ComTypes.ITypeComp ppTComp);
- void GetTypeInfo(int index, out System.Runtime.InteropServices.ComTypes.ITypeInfo ppTI);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]int GetTypeInfoCount();
- void GetTypeInfoOfGuid(ref System.Guid guid, out System.Runtime.InteropServices.ComTypes.ITypeInfo ppTInfo);
- void GetTypeInfoType(int index, out System.Runtime.InteropServices.ComTypes.TYPEKIND pTKind);
- bool IsName(string szNameBuf, int lHashVal);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]void ReleaseTLibAttr(System.IntPtr pTLibAttr);
- }
- [System.Runtime.InteropServices.GuidAttribute("00020411-0000-0000-C000-000000000046")]
- [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))]
- public partial interface ITypeLib2 : System.Runtime.InteropServices.ComTypes.ITypeLib
- {
- new void FindName(string szNameBuf, int lHashVal, System.Runtime.InteropServices.ComTypes.ITypeInfo[] ppTInfo, int[] rgMemId, ref short pcFound);
- void GetAllCustData(System.IntPtr pCustData);
- void GetCustData(ref System.Guid guid, out object pVarVal);
- new void GetDocumentation(int index, out string strName, out string strDocString, out int dwHelpContext, out string strHelpFile);
- void GetDocumentation2(int index, out string pbstrHelpString, out int pdwHelpStringContext, out string pbstrHelpStringDll);
- new void GetLibAttr(out System.IntPtr ppTLibAttr);
- void GetLibStatistics(System.IntPtr pcUniqueNames, out int pcchUniqueNames);
- new void GetTypeComp(out System.Runtime.InteropServices.ComTypes.ITypeComp ppTComp);
- new void GetTypeInfo(int index, out System.Runtime.InteropServices.ComTypes.ITypeInfo ppTI);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]new int GetTypeInfoCount();
- new void GetTypeInfoOfGuid(ref System.Guid guid, out System.Runtime.InteropServices.ComTypes.ITypeInfo ppTInfo);
- new void GetTypeInfoType(int index, out System.Runtime.InteropServices.ComTypes.TYPEKIND pTKind);
- new bool IsName(string szNameBuf, int lHashVal);
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]new void ReleaseTLibAttr(System.IntPtr pTLibAttr);
- }
- [System.FlagsAttribute]
- public enum LIBFLAGS : short
- {
- LIBFLAG_FCONTROL = (short)2,
- LIBFLAG_FHASDISKIMAGE = (short)8,
- LIBFLAG_FHIDDEN = (short)4,
- LIBFLAG_FRESTRICTED = (short)1,
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct PARAMDESC
- {
- public System.IntPtr lpVarValue;
- public System.Runtime.InteropServices.ComTypes.PARAMFLAG wParamFlags;
- }
- [System.FlagsAttribute]
- public enum PARAMFLAG : short
- {
- PARAMFLAG_FHASCUSTDATA = (short)64,
- PARAMFLAG_FHASDEFAULT = (short)32,
- PARAMFLAG_FIN = (short)1,
- PARAMFLAG_FLCID = (short)4,
- PARAMFLAG_FOPT = (short)16,
- PARAMFLAG_FOUT = (short)2,
- PARAMFLAG_FRETVAL = (short)8,
- PARAMFLAG_NONE = (short)0,
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct STATSTG
- {
- public System.Runtime.InteropServices.ComTypes.FILETIME atime;
- public long cbSize;
- public System.Guid clsid;
- public System.Runtime.InteropServices.ComTypes.FILETIME ctime;
- public int grfLocksSupported;
- public int grfMode;
- public int grfStateBits;
- public System.Runtime.InteropServices.ComTypes.FILETIME mtime;
- public string pwcsName;
- public int reserved;
- public int type;
- }
- public enum SYSKIND
- {
- SYS_MAC = 2,
- SYS_WIN16 = 0,
- SYS_WIN32 = 1,
- SYS_WIN64 = 3,
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct TYPEATTR
- {
- public short cbAlignment;
- public int cbSizeInstance;
- public short cbSizeVft;
- public short cFuncs;
- public short cImplTypes;
- public short cVars;
- public int dwReserved;
- public System.Guid guid;
- public System.Runtime.InteropServices.ComTypes.IDLDESC idldescType;
- public int lcid;
- public System.IntPtr lpstrSchema;
- public const int MEMBER_ID_NIL = -1;
- public int memidConstructor;
- public int memidDestructor;
- public System.Runtime.InteropServices.ComTypes.TYPEDESC tdescAlias;
- public System.Runtime.InteropServices.ComTypes.TYPEKIND typekind;
- public short wMajorVerNum;
- public short wMinorVerNum;
- public System.Runtime.InteropServices.ComTypes.TYPEFLAGS wTypeFlags;
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct TYPEDESC
- {
- public System.IntPtr lpValue;
- public short vt;
- }
- [System.FlagsAttribute]
- public enum TYPEFLAGS : short
- {
- TYPEFLAG_FAGGREGATABLE = (short)1024,
- TYPEFLAG_FAPPOBJECT = (short)1,
- TYPEFLAG_FCANCREATE = (short)2,
- TYPEFLAG_FCONTROL = (short)32,
- TYPEFLAG_FDISPATCHABLE = (short)4096,
- TYPEFLAG_FDUAL = (short)64,
- TYPEFLAG_FHIDDEN = (short)16,
- TYPEFLAG_FLICENSED = (short)4,
- TYPEFLAG_FNONEXTENSIBLE = (short)128,
- TYPEFLAG_FOLEAUTOMATION = (short)256,
- TYPEFLAG_FPREDECLID = (short)8,
- TYPEFLAG_FPROXY = (short)16384,
- TYPEFLAG_FREPLACEABLE = (short)2048,
- TYPEFLAG_FRESTRICTED = (short)512,
- TYPEFLAG_FREVERSEBIND = (short)8192,
- }
- public enum TYPEKIND
- {
- TKIND_ALIAS = 6,
- TKIND_COCLASS = 5,
- TKIND_DISPATCH = 4,
- TKIND_ENUM = 0,
- TKIND_INTERFACE = 3,
- TKIND_MAX = 8,
- TKIND_MODULE = 2,
- TKIND_RECORD = 1,
- TKIND_UNION = 7,
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct TYPELIBATTR
- {
- public System.Guid guid;
- public int lcid;
- public System.Runtime.InteropServices.ComTypes.SYSKIND syskind;
- public System.Runtime.InteropServices.ComTypes.LIBFLAGS wLibFlags;
- public short wMajorVerNum;
- public short wMinorVerNum;
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct VARDESC
- {
- public System.Runtime.InteropServices.ComTypes.VARDESC.DESCUNION desc;
- public System.Runtime.InteropServices.ComTypes.ELEMDESC elemdescVar;
- public string lpstrSchema;
- public int memid;
- public System.Runtime.InteropServices.ComTypes.VARKIND varkind;
- public short wVarFlags;
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Explicit)]
- public partial struct DESCUNION
- {
- [System.Runtime.InteropServices.FieldOffsetAttribute(0)]
- public System.IntPtr lpvarValue;
- [System.Runtime.InteropServices.FieldOffsetAttribute(0)]
- public int oInst;
- }
- }
- [System.FlagsAttribute]
- public enum VARFLAGS : short
- {
- VARFLAG_FBINDABLE = (short)4,
- VARFLAG_FDEFAULTBIND = (short)32,
- VARFLAG_FDEFAULTCOLLELEM = (short)256,
- VARFLAG_FDISPLAYBIND = (short)16,
- VARFLAG_FHIDDEN = (short)64,
- VARFLAG_FIMMEDIATEBIND = (short)4096,
- VARFLAG_FNONBROWSABLE = (short)1024,
- VARFLAG_FREADONLY = (short)1,
- VARFLAG_FREPLACEABLE = (short)2048,
- VARFLAG_FREQUESTEDIT = (short)8,
- VARFLAG_FRESTRICTED = (short)128,
- VARFLAG_FSOURCE = (short)2,
- VARFLAG_FUIDEFAULT = (short)512,
- }
- public enum VARKIND
- {
- VAR_CONST = 2,
- VAR_DISPATCH = 3,
- VAR_PERINSTANCE = 0,
- VAR_STATIC = 1,
- }
-}
-namespace System.Runtime.Loader
-{
- [System.Security.SecuritySafeCriticalAttribute]
- public abstract partial class AssemblyLoadContext
- {
- protected AssemblyLoadContext() { }
- public static System.Runtime.Loader.AssemblyLoadContext Default { get { throw null; } }
- public event System.Func<System.Runtime.Loader.AssemblyLoadContext, System.Reflection.AssemblyName, System.Reflection.Assembly> Resolving { add { } remove { } }
- public event System.Action<System.Runtime.Loader.AssemblyLoadContext> Unloading { add { } remove { } }
- public static event AssemblyLoadEventHandler AssemblyLoad { add { } remove { } }
- public static event ResolveEventHandler AssemblyResolve { add { } remove { } }
- public static event ResolveEventHandler TypeResolve { add { } remove { } }
- public static event ResolveEventHandler ResourceResolve { add { } remove { } }
- public static System.Reflection.AssemblyName GetAssemblyName(string assemblyPath) { throw null; }
- public static System.Runtime.Loader.AssemblyLoadContext GetLoadContext(System.Reflection.Assembly assembly) { throw null; }
- public static System.Reflection.Assembly[] GetLoadedAssemblies() { throw null; }
- protected abstract System.Reflection.Assembly Load(System.Reflection.AssemblyName assemblyName);
- public System.Reflection.Assembly LoadFromAssemblyName(System.Reflection.AssemblyName assemblyName) { throw null; }
- public System.Reflection.Assembly LoadFromAssemblyPath(string assemblyPath) { throw null; }
- public System.Reflection.Assembly LoadFromNativeImagePath(string nativeImagePath, string assemblyPath) { throw null; }
- public System.Reflection.Assembly LoadFromStream(System.IO.Stream assembly) { throw null; }
- public System.Reflection.Assembly LoadFromStream(System.IO.Stream assembly, System.IO.Stream assemblySymbols) { throw null; }
- protected virtual System.IntPtr LoadUnmanagedDll(string unmanagedDllName) { throw null; }
- protected System.IntPtr LoadUnmanagedDllFromPath(string unmanagedDllPath) { throw null; }
- public void SetProfileOptimizationRoot(string directoryPath) { }
- public void StartProfileOptimization(string profile) { }
- }
-}
-namespace System.Runtime.Remoting
-{
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(2))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class ObjectHandle
- {
- internal ObjectHandle() { }
- }
-}
-namespace System.Runtime.Serialization
-{
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static partial class FormatterServices
- {
- [System.Security.SecurityCriticalAttribute]
- public static object GetUninitializedObject(System.Type type) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface IDeserializationCallback
- {
- void OnDeserialization(object sender);
- }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface IFormatterConverter
- {
- object Convert(object value, System.Type type);
- object Convert(object value, System.TypeCode typeCode);
- bool ToBoolean(object value);
- byte ToByte(object value);
- char ToChar(object value);
- System.DateTime ToDateTime(object value);
- decimal ToDecimal(object value);
- double ToDouble(object value);
- short ToInt16(object value);
- int ToInt32(object value);
- long ToInt64(object value);
- sbyte ToSByte(object value);
- float ToSingle(object value);
- string ToString(object value);
- ushort ToUInt16(object value);
- uint ToUInt32(object value);
- ulong ToUInt64(object value);
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface IObjectReference
- {
- [System.Security.SecurityCriticalAttribute]
- object GetRealObject(System.Runtime.Serialization.StreamingContext context);
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface ISerializable
- {
- [System.Security.SecurityCriticalAttribute]
- void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context);
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(64), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class OnDeserializedAttribute : System.Attribute
- {
- public OnDeserializedAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(64), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class OnDeserializingAttribute : System.Attribute
- {
- public OnDeserializingAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(64), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class OnSerializedAttribute : System.Attribute
- {
- public OnSerializedAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(64), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class OnSerializingAttribute : System.Attribute
- {
- public OnSerializingAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(256), Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class OptionalFieldAttribute : System.Attribute
- {
- public OptionalFieldAttribute() { }
- public int VersionAdded { get { throw null; } set { } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct SerializationEntry
- {
- public string Name { get { throw null; } }
- public System.Type ObjectType { get { throw null; } }
- public object Value { get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class SerializationException : System.SystemException
- {
- public SerializationException() { }
- public SerializationException(string message) { }
- public SerializationException(string message, System.Exception innerException) { }
- protected SerializationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class SerializationInfo
- {
- [System.CLSCompliantAttribute(false)]
- public SerializationInfo(System.Type type, System.Runtime.Serialization.IFormatterConverter converter) { }
- [System.CLSCompliantAttribute(false)]
- public SerializationInfo(System.Type type, System.Runtime.Serialization.IFormatterConverter converter, bool requireSameTokenInPartialTrust) { }
- public string AssemblyName { get { throw null; } [System.Security.SecuritySafeCriticalAttribute]set { } }
- public string FullTypeName { get { throw null; } set { } }
- public bool IsAssemblyNameSetExplicit { get { throw null; } }
- public bool IsFullTypeNameSetExplicit { get { throw null; } }
- public int MemberCount { get { throw null; } }
- public System.Type ObjectType { get { throw null; } }
- public void AddValue(string name, bool value) { }
- public void AddValue(string name, byte value) { }
- public void AddValue(string name, char value) { }
- public void AddValue(string name, System.DateTime value) { }
- public void AddValue(string name, decimal value) { }
- public void AddValue(string name, double value) { }
- public void AddValue(string name, short value) { }
- public void AddValue(string name, int value) { }
- public void AddValue(string name, long value) { }
- public void AddValue(string name, object value) { }
- public void AddValue(string name, object value, System.Type type) { }
- [System.CLSCompliantAttribute(false)]
- public void AddValue(string name, sbyte value) { }
- public void AddValue(string name, float value) { }
- [System.CLSCompliantAttribute(false)]
- public void AddValue(string name, ushort value) { }
- [System.CLSCompliantAttribute(false)]
- public void AddValue(string name, uint value) { }
- [System.CLSCompliantAttribute(false)]
- public void AddValue(string name, ulong value) { }
- public bool GetBoolean(string name) { throw null; }
- public byte GetByte(string name) { throw null; }
- public char GetChar(string name) { throw null; }
- public System.DateTime GetDateTime(string name) { throw null; }
- public decimal GetDecimal(string name) { throw null; }
- public double GetDouble(string name) { throw null; }
- public System.Runtime.Serialization.SerializationInfoEnumerator GetEnumerator() { throw null; }
- public short GetInt16(string name) { throw null; }
- public int GetInt32(string name) { throw null; }
- public long GetInt64(string name) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public sbyte GetSByte(string name) { throw null; }
- public float GetSingle(string name) { throw null; }
- public string GetString(string name) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public ushort GetUInt16(string name) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public uint GetUInt32(string name) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public ulong GetUInt64(string name) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public object GetValue(string name, System.Type type) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public void SetType(System.Type type) { }
- public void UpdateValue(string name, object value, System.Type type) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class SerializationInfoEnumerator : System.Collections.IEnumerator
- {
- internal SerializationInfoEnumerator() { }
- public System.Runtime.Serialization.SerializationEntry Current { get { throw null; } }
- public string Name { get { throw null; } }
- public System.Type ObjectType { get { throw null; } }
- object System.Collections.IEnumerator.Current { get { throw null; } }
- public object Value { get { throw null; } }
- public bool MoveNext() { throw null; }
- public void Reset() { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct StreamingContext
- {
- public StreamingContext(System.Runtime.Serialization.StreamingContextStates state) { throw null;}
- public StreamingContext(System.Runtime.Serialization.StreamingContextStates state, object additional) { throw null;}
- public object Context { get { throw null; } }
- public System.Runtime.Serialization.StreamingContextStates State { get { throw null; } }
- public override bool Equals(object obj) { throw null; }
- public override int GetHashCode() { throw null; }
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum StreamingContextStates
- {
- All = 255,
- Clone = 64,
- CrossAppDomain = 128,
- CrossMachine = 2,
- CrossProcess = 1,
- File = 4,
- Other = 32,
- Persistence = 8,
- Remoting = 16,
- }
- public sealed partial class SafeSerializationEventArgs : System.EventArgs
- {
- internal SafeSerializationEventArgs() { }
- public System.Runtime.Serialization.StreamingContext StreamingContext { get { throw null; } }
- public void AddSerializedState(System.Runtime.Serialization.ISafeSerializationData serializedState) { }
- }
- public partial interface ISafeSerializationData
- {
- void CompleteDeserialization(object deserialized);
- }
-}
-namespace System.Runtime.Versioning
-{
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), AllowMultiple=false, Inherited=false)]
- public sealed partial class TargetFrameworkAttribute : System.Attribute
- {
- public TargetFrameworkAttribute(string frameworkName) { }
- public string FrameworkDisplayName { get { throw null; } set { } }
- public string FrameworkName { get { throw null; } }
- }
-}
-namespace System.Security
-{
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), AllowMultiple=false, Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AllowPartiallyTrustedCallersAttribute : System.Attribute
- {
- public AllowPartiallyTrustedCallersAttribute() { }
- public System.Security.PartialTrustVisibilityLevel PartialTrustVisibilityLevel { get { throw null; } set { } }
- }
- public enum PartialTrustVisibilityLevel
- {
- NotVisibleByDefault = 1,
- VisibleToAllHosts = 0,
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(5501), AllowMultiple=false, Inherited=false)]
- public sealed partial class SecurityCriticalAttribute : System.Attribute
- {
- public SecurityCriticalAttribute() { }
-#pragma warning disable 0618
- public SecurityCriticalAttribute(System.Security.SecurityCriticalScope scope) { }
-#pragma warning restore 0618
- [System.ObsoleteAttribute("SecurityCriticalScope is only used for .NET 2.0 transparency compatibility.")]
- public System.Security.SecurityCriticalScope Scope { get { throw null; } }
- }
- [System.ObsoleteAttribute("SecurityCriticalScope is only used for .NET 2.0 transparency compatibility.")]
- public enum SecurityCriticalScope
- {
- Everything = 1,
- Explicit = 0,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class SecurityException : System.SystemException
- {
- public SecurityException() { }
- protected SecurityException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public SecurityException(string message) { }
- public SecurityException(string message, System.Exception inner) { }
- public SecurityException(string message, System.Type type) { }
- public SecurityException(string message, System.Type type, string state) { }
- public object Demanded { get { throw null; } set { } }
- public object DenySetInstance { get { throw null; } set { } }
- public System.Reflection.AssemblyName FailedAssemblyInfo { get { throw null; } set { } }
- public string GrantedSet { get { throw null; } set { } }
- public System.Reflection.MethodInfo Method { get { throw null; } set { } }
- public string PermissionState { get { throw null; } set { } }
- public System.Type PermissionType { get { throw null; } set { } }
- public object PermitOnlySetInstance { get { throw null; } set { } }
- public string RefusedSet { get { throw null; } set { } }
- public string Url { get { throw null; } set { } }
- public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- public override string ToString() { throw null; }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), AllowMultiple=false)]
- public sealed partial class SecurityRulesAttribute : System.Attribute
- {
- public SecurityRulesAttribute(System.Security.SecurityRuleSet ruleSet) { }
- public System.Security.SecurityRuleSet RuleSet { get { throw null; } }
- public bool SkipVerificationInFullTrust { get { throw null; } set { } }
- }
- public enum SecurityRuleSet : byte
- {
- Level1 = (byte)1,
- Level2 = (byte)2,
- None = (byte)0,
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(5500), AllowMultiple=false, Inherited=false)]
- public sealed partial class SecuritySafeCriticalAttribute : System.Attribute
- {
- public SecuritySafeCriticalAttribute() { }
- }
- [System.Security.SecurityCriticalAttribute]
- public abstract partial class SecurityState
- {
- protected SecurityState() { }
- public abstract void EnsureState();
- [System.Security.SecurityCriticalAttribute]
- public bool IsStateAvailable() { throw null; }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1), AllowMultiple=false, Inherited=false)]
- public sealed partial class SecurityTransparentAttribute : System.Attribute
- {
- public SecurityTransparentAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(5501), AllowMultiple=false, Inherited=false)]
- [System.ObsoleteAttribute("SecurityTreatAsSafe is only used for .NET 2.0 transparency compatibility. Please use the SecuritySafeCriticalAttribute instead.")]
- public sealed partial class SecurityTreatAsSafeAttribute : System.Attribute
- {
- public SecurityTreatAsSafeAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(5188), AllowMultiple=true, Inherited=false)]
- public sealed partial class SuppressUnmanagedCodeSecurityAttribute : System.Attribute
- {
- public SuppressUnmanagedCodeSecurityAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(2), AllowMultiple=true, Inherited=false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class UnverifiableCodeAttribute : System.Attribute
- {
- public UnverifiableCodeAttribute() { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class VerificationException : System.SystemException
- {
- public VerificationException() { }
- public VerificationException(string message) { }
- public VerificationException(string message, System.Exception innerException) { }
- protected VerificationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
-}
-namespace System.Security.Principal
-{
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface IIdentity
- {
- string AuthenticationType { get; }
- bool IsAuthenticated { get; }
- string Name { get; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial interface IPrincipal
- {
- System.Security.Principal.IIdentity Identity { get; }
- bool IsInRole(string role);
- }
- public enum TokenImpersonationLevel
- {
- Anonymous = 1,
- Delegation = 4,
- Identification = 2,
- Impersonation = 3,
- None = 0,
- }
-}
-namespace System.Text
-{
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class ASCIIEncoding : System.Text.Encoding
- {
- public ASCIIEncoding() { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override bool IsSingleByte { get { throw null; } }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe override int GetByteCount(char* chars, int count) { throw null; }
- public override int GetByteCount(char[] chars, int index, int count) { throw null; }
- public override int GetByteCount(string chars) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount) { throw null; }
- public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex) { throw null; }
- public override int GetBytes(string chars, int charIndex, int charCount, byte[] bytes, int byteIndex) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe override int GetCharCount(byte* bytes, int count) { throw null; }
- public override int GetCharCount(byte[] bytes, int index, int count) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe override int GetChars(byte* bytes, int byteCount, char* chars, int charCount) { throw null; }
- public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Text.Decoder GetDecoder() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Text.Encoder GetEncoder() { throw null; }
- public override int GetMaxByteCount(int charCount) { throw null; }
- public override int GetMaxCharCount(int byteCount) { throw null; }
- public override string GetString(byte[] bytes, int byteIndex, int byteCount) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class Decoder
- {
- protected Decoder() { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public System.Text.DecoderFallback Fallback { get { throw null; } set { } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public System.Text.DecoderFallbackBuffer FallbackBuffer { get { throw null; } }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe virtual void Convert(byte* bytes, int byteCount, char* chars, int charCount, bool flush, out int bytesUsed, out int charsUsed, out bool completed) { bytesUsed = default(int); charsUsed = default(int); completed = default(bool); }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual void Convert(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex, int charCount, bool flush, out int bytesUsed, out int charsUsed, out bool completed) { bytesUsed = default(int); charsUsed = default(int); completed = default(bool); }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe virtual int GetCharCount(byte* bytes, int count, bool flush) { throw null; }
- public abstract int GetCharCount(byte[] bytes, int index, int count);
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual int GetCharCount(byte[] bytes, int index, int count, bool flush) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe virtual int GetChars(byte* bytes, int byteCount, char* chars, int charCount, bool flush) { throw null; }
- public abstract int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex);
- public virtual int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex, bool flush) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual void Reset() { }
- }
- public sealed partial class DecoderExceptionFallback : System.Text.DecoderFallback
- {
- public DecoderExceptionFallback() { }
- public override int MaxCharCount { get { throw null; } }
- public override System.Text.DecoderFallbackBuffer CreateFallbackBuffer() { throw null; }
- public override bool Equals(object value) { throw null; }
- public override int GetHashCode() { throw null; }
- }
- public sealed partial class DecoderExceptionFallbackBuffer : System.Text.DecoderFallbackBuffer
- {
- public DecoderExceptionFallbackBuffer() { }
- public override int Remaining { get { throw null; } }
- public override bool Fallback(byte[] bytesUnknown, int index) { throw null; }
- public override char GetNextChar() { throw null; }
- public override bool MovePrevious() { throw null; }
- }
- public abstract partial class DecoderFallback
- {
- protected DecoderFallback() { }
- public static System.Text.DecoderFallback ExceptionFallback { get { throw null; } }
- public abstract int MaxCharCount { get; }
- public static System.Text.DecoderFallback ReplacementFallback { get { throw null; } }
- public abstract System.Text.DecoderFallbackBuffer CreateFallbackBuffer();
- }
- public abstract partial class DecoderFallbackBuffer
- {
- protected DecoderFallbackBuffer() { }
- public abstract int Remaining { get; }
- public abstract bool Fallback(byte[] bytesUnknown, int index);
- public abstract char GetNextChar();
- public abstract bool MovePrevious();
- public virtual void Reset() { }
- }
- public sealed partial class DecoderFallbackException : System.ArgumentException
- {
- public DecoderFallbackException() { }
- public DecoderFallbackException(string message) { }
- public DecoderFallbackException(string message, byte[] bytesUnknown, int index) { }
- public DecoderFallbackException(string message, System.Exception innerException) { }
- public byte[] BytesUnknown { get { throw null; } }
- public int Index { get { throw null; } }
- }
- public sealed partial class DecoderReplacementFallback : System.Text.DecoderFallback
- {
- public DecoderReplacementFallback() { }
- public DecoderReplacementFallback(string replacement) { }
- public string DefaultString { get { throw null; } }
- public override int MaxCharCount { get { throw null; } }
- public override System.Text.DecoderFallbackBuffer CreateFallbackBuffer() { throw null; }
- public override bool Equals(object value) { throw null; }
- public override int GetHashCode() { throw null; }
- }
- public sealed partial class DecoderReplacementFallbackBuffer : System.Text.DecoderFallbackBuffer
- {
- public DecoderReplacementFallbackBuffer(System.Text.DecoderReplacementFallback fallback) { }
- public override int Remaining { get { throw null; } }
- public override bool Fallback(byte[] bytesUnknown, int index) { throw null; }
- public override char GetNextChar() { throw null; }
- public override bool MovePrevious() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override void Reset() { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class Encoder
- {
- protected Encoder() { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public System.Text.EncoderFallback Fallback { get { throw null; } set { } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public System.Text.EncoderFallbackBuffer FallbackBuffer { get { throw null; } }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe virtual void Convert(char* chars, int charCount, byte* bytes, int byteCount, bool flush, out int charsUsed, out int bytesUsed, out bool completed) { charsUsed = default(int); bytesUsed = default(int); completed = default(bool); }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual void Convert(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, int byteCount, bool flush, out int charsUsed, out int bytesUsed, out bool completed) { charsUsed = default(int); bytesUsed = default(int); completed = default(bool); }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe virtual int GetByteCount(char* chars, int count, bool flush) { throw null; }
- public abstract int GetByteCount(char[] chars, int index, int count, bool flush);
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe virtual int GetBytes(char* chars, int charCount, byte* bytes, int byteCount, bool flush) { throw null; }
- public abstract int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex, bool flush);
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual void Reset() { }
- }
- public sealed partial class EncoderExceptionFallback : System.Text.EncoderFallback
- {
- public EncoderExceptionFallback() { }
- public override int MaxCharCount { get { throw null; } }
- public override System.Text.EncoderFallbackBuffer CreateFallbackBuffer() { throw null; }
- public override bool Equals(object value) { throw null; }
- public override int GetHashCode() { throw null; }
- }
- public sealed partial class EncoderExceptionFallbackBuffer : System.Text.EncoderFallbackBuffer
- {
- public EncoderExceptionFallbackBuffer() { }
- public override int Remaining { get { throw null; } }
- public override bool Fallback(char charUnknownHigh, char charUnknownLow, int index) { throw null; }
- public override bool Fallback(char charUnknown, int index) { throw null; }
- public override char GetNextChar() { throw null; }
- public override bool MovePrevious() { throw null; }
- }
- public abstract partial class EncoderFallback
- {
- protected EncoderFallback() { }
- public static System.Text.EncoderFallback ExceptionFallback { get { throw null; } }
- public abstract int MaxCharCount { get; }
- public static System.Text.EncoderFallback ReplacementFallback { get { throw null; } }
- public abstract System.Text.EncoderFallbackBuffer CreateFallbackBuffer();
- }
- public abstract partial class EncoderFallbackBuffer
- {
- protected EncoderFallbackBuffer() { }
- public abstract int Remaining { get; }
- public abstract bool Fallback(char charUnknownHigh, char charUnknownLow, int index);
- public abstract bool Fallback(char charUnknown, int index);
- public abstract char GetNextChar();
- public abstract bool MovePrevious();
- public virtual void Reset() { }
- }
- public sealed partial class EncoderFallbackException : System.ArgumentException
- {
- public EncoderFallbackException() { }
- public EncoderFallbackException(string message) { }
- public EncoderFallbackException(string message, System.Exception innerException) { }
- public char CharUnknown { get { throw null; } }
- public char CharUnknownHigh { get { throw null; } }
- public char CharUnknownLow { get { throw null; } }
- public int Index { get { throw null; } }
- public bool IsUnknownSurrogate() { throw null; }
- }
- public sealed partial class EncoderReplacementFallback : System.Text.EncoderFallback
- {
- public EncoderReplacementFallback() { }
- public EncoderReplacementFallback(string replacement) { }
- public string DefaultString { get { throw null; } }
- public override int MaxCharCount { get { throw null; } }
- public override System.Text.EncoderFallbackBuffer CreateFallbackBuffer() { throw null; }
- public override bool Equals(object value) { throw null; }
- public override int GetHashCode() { throw null; }
- }
- public sealed partial class EncoderReplacementFallbackBuffer : System.Text.EncoderFallbackBuffer
- {
- public EncoderReplacementFallbackBuffer(System.Text.EncoderReplacementFallback fallback) { }
- public override int Remaining { get { throw null; } }
- public override bool Fallback(char charUnknownHigh, char charUnknownLow, int index) { throw null; }
- public override bool Fallback(char charUnknown, int index) { throw null; }
- public override char GetNextChar() { throw null; }
- public override bool MovePrevious() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override void Reset() { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class Encoding : System.ICloneable
- {
- protected Encoding() { }
- protected Encoding(int codePage) { }
- protected Encoding(int codePage, System.Text.EncoderFallback encoderFallback, System.Text.DecoderFallback decoderFallback) { }
- public static System.Text.Encoding ASCII { get { throw null; } }
- public static System.Text.Encoding BigEndianUnicode { get { throw null; } }
- public virtual string BodyName { get { throw null; } }
- public virtual int CodePage { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public System.Text.DecoderFallback DecoderFallback { get { throw null; } set { } }
- public static System.Text.Encoding Default { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public System.Text.EncoderFallback EncoderFallback { get { throw null; } set { } }
- public virtual string EncodingName { get { throw null; } }
- public virtual string HeaderName { get { throw null; } }
- public virtual bool IsBrowserDisplay { get { throw null; } }
- public virtual bool IsBrowserSave { get { throw null; } }
- public virtual bool IsMailNewsDisplay { get { throw null; } }
- public virtual bool IsMailNewsSave { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public bool IsReadOnly { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual bool IsSingleByte { get { throw null; } }
- public static System.Text.Encoding Unicode { get { throw null; } }
- public static System.Text.Encoding UTF32 { get { throw null; } }
- public static System.Text.Encoding UTF7 { get { throw null; } }
- public static System.Text.Encoding UTF8 { get { throw null; } }
- public virtual string WebName { get { throw null; } }
- public virtual int WindowsCodePage { get { throw null; } }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual object Clone() { throw null; }
- public static byte[] Convert(System.Text.Encoding srcEncoding, System.Text.Encoding dstEncoding, byte[] bytes) { throw null; }
- public static byte[] Convert(System.Text.Encoding srcEncoding, System.Text.Encoding dstEncoding, byte[] bytes, int index, int count) { throw null; }
- public override bool Equals(object value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe virtual int GetByteCount(char* chars, int count) { throw null; }
- public virtual int GetByteCount(char[] chars) { throw null; }
- public abstract int GetByteCount(char[] chars, int index, int count);
- public virtual int GetByteCount(string s) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe virtual int GetBytes(char* chars, int charCount, byte* bytes, int byteCount) { throw null; }
- public virtual byte[] GetBytes(char[] chars) { throw null; }
- public virtual byte[] GetBytes(char[] chars, int index, int count) { throw null; }
- public abstract int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex);
- public virtual byte[] GetBytes(string s) { throw null; }
- public virtual int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe virtual int GetCharCount(byte* bytes, int count) { throw null; }
- public virtual int GetCharCount(byte[] bytes) { throw null; }
- public abstract int GetCharCount(byte[] bytes, int index, int count);
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe virtual int GetChars(byte* bytes, int byteCount, char* chars, int charCount) { throw null; }
- public virtual char[] GetChars(byte[] bytes) { throw null; }
- public virtual char[] GetChars(byte[] bytes, int index, int count) { throw null; }
- public abstract int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex);
- public virtual System.Text.Decoder GetDecoder() { throw null; }
- public virtual System.Text.Encoder GetEncoder() { throw null; }
- public static System.Text.Encoding GetEncoding(int codepage) { throw null; }
- public static System.Text.Encoding GetEncoding(int codepage, System.Text.EncoderFallback encoderFallback, System.Text.DecoderFallback decoderFallback) { throw null; }
- public static System.Text.Encoding GetEncoding(string name) { throw null; }
- public static System.Text.Encoding GetEncoding(string name, System.Text.EncoderFallback encoderFallback, System.Text.DecoderFallback decoderFallback) { throw null; }
- public static System.Text.EncodingInfo[] GetEncodings() { throw null; }
- public override int GetHashCode() { throw null; }
- public abstract int GetMaxByteCount(int charCount);
- public abstract int GetMaxCharCount(int byteCount);
- public virtual byte[] GetPreamble() { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe string GetString(byte* bytes, int byteCount) { throw null; }
- public virtual string GetString(byte[] bytes) { throw null; }
- public virtual string GetString(byte[] bytes, int index, int count) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public bool IsAlwaysNormalized() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public virtual bool IsAlwaysNormalized(System.Text.NormalizationForm form) { throw null; }
- public static void RegisterProvider(System.Text.EncodingProvider provider) { }
- }
- public sealed partial class EncodingInfo
- {
- internal EncodingInfo() { }
- public int CodePage { get { throw null; } }
- public string DisplayName { get { throw null; } }
- public string Name { get { throw null; } }
- public override bool Equals(object value) { throw null; }
- public System.Text.Encoding GetEncoding() { throw null; }
- public override int GetHashCode() { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class EncodingProvider
- {
- public EncodingProvider() { }
- public abstract System.Text.Encoding GetEncoding(int codepage);
- public virtual System.Text.Encoding GetEncoding(int codepage, System.Text.EncoderFallback encoderFallback, System.Text.DecoderFallback decoderFallback) { throw null; }
- public abstract System.Text.Encoding GetEncoding(string name);
- public virtual System.Text.Encoding GetEncoding(string name, System.Text.EncoderFallback encoderFallback, System.Text.DecoderFallback decoderFallback) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum NormalizationForm
- {
- FormC = 1,
- FormD = 2,
- FormKC = 5,
- FormKD = 6,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class StringBuilder
- {
- public StringBuilder() { }
- public StringBuilder(int capacity) { }
- public StringBuilder(int capacity, int maxCapacity) { }
- public StringBuilder(string value) { }
- public StringBuilder(string value, int capacity) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public StringBuilder(string value, int startIndex, int length, int capacity) { }
- public int Capacity { get { throw null; } set { } }
- [System.Runtime.CompilerServices.IndexerName("Chars")]
- public char this[int index] { get { throw null; } set { } }
- public int Length { get { throw null; } set { } }
- public int MaxCapacity { get { throw null; } }
- public System.Text.StringBuilder Append(bool value) { throw null; }
- public System.Text.StringBuilder Append(byte value) { throw null; }
- public System.Text.StringBuilder Append(char value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe System.Text.StringBuilder Append(char* value, int valueCount) { throw null; }
- public System.Text.StringBuilder Append(char value, int repeatCount) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Text.StringBuilder Append(char[] value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Text.StringBuilder Append(char[] value, int startIndex, int charCount) { throw null; }
- public System.Text.StringBuilder Append(decimal value) { throw null; }
- public System.Text.StringBuilder Append(double value) { throw null; }
- public System.Text.StringBuilder Append(short value) { throw null; }
- public System.Text.StringBuilder Append(int value) { throw null; }
- public System.Text.StringBuilder Append(long value) { throw null; }
- public System.Text.StringBuilder Append(object value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public System.Text.StringBuilder Append(sbyte value) { throw null; }
- public System.Text.StringBuilder Append(float value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Text.StringBuilder Append(string value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Text.StringBuilder Append(string value, int startIndex, int count) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public System.Text.StringBuilder Append(ushort value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public System.Text.StringBuilder Append(uint value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public System.Text.StringBuilder Append(ulong value) { throw null; }
- public System.Text.StringBuilder AppendFormat(System.IFormatProvider provider, string format, object arg0) { throw null; }
- public System.Text.StringBuilder AppendFormat(System.IFormatProvider provider, string format, object arg0, object arg1) { throw null; }
- public System.Text.StringBuilder AppendFormat(System.IFormatProvider provider, string format, object arg0, object arg1, object arg2) { throw null; }
- public System.Text.StringBuilder AppendFormat(System.IFormatProvider provider, string format, params object[] args) { throw null; }
- public System.Text.StringBuilder AppendFormat(string format, object arg0) { throw null; }
- public System.Text.StringBuilder AppendFormat(string format, object arg0, object arg1) { throw null; }
- public System.Text.StringBuilder AppendFormat(string format, object arg0, object arg1, object arg2) { throw null; }
- public System.Text.StringBuilder AppendFormat(string format, params object[] args) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public System.Text.StringBuilder AppendLine() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public System.Text.StringBuilder AppendLine(string value) { throw null; }
- public System.Text.StringBuilder Clear() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count) { }
- public int EnsureCapacity(int capacity) { throw null; }
- public bool Equals(System.Text.StringBuilder sb) { throw null; }
- public System.Text.StringBuilder Insert(int index, bool value) { throw null; }
- public System.Text.StringBuilder Insert(int index, byte value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Text.StringBuilder Insert(int index, char value) { throw null; }
- public System.Text.StringBuilder Insert(int index, char[] value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Text.StringBuilder Insert(int index, char[] value, int startIndex, int charCount) { throw null; }
- public System.Text.StringBuilder Insert(int index, decimal value) { throw null; }
- public System.Text.StringBuilder Insert(int index, double value) { throw null; }
- public System.Text.StringBuilder Insert(int index, short value) { throw null; }
- public System.Text.StringBuilder Insert(int index, int value) { throw null; }
- public System.Text.StringBuilder Insert(int index, long value) { throw null; }
- public System.Text.StringBuilder Insert(int index, object value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public System.Text.StringBuilder Insert(int index, sbyte value) { throw null; }
- public System.Text.StringBuilder Insert(int index, float value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Text.StringBuilder Insert(int index, string value) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public System.Text.StringBuilder Insert(int index, string value, int count) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public System.Text.StringBuilder Insert(int index, ushort value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public System.Text.StringBuilder Insert(int index, uint value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public System.Text.StringBuilder Insert(int index, ulong value) { throw null; }
- public System.Text.StringBuilder Remove(int startIndex, int length) { throw null; }
- public System.Text.StringBuilder Replace(char oldChar, char newChar) { throw null; }
- public System.Text.StringBuilder Replace(char oldChar, char newChar, int startIndex, int count) { throw null; }
- public System.Text.StringBuilder Replace(string oldValue, string newValue) { throw null; }
- public System.Text.StringBuilder Replace(string oldValue, string newValue, int startIndex, int count) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public override string ToString() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public string ToString(int startIndex, int length) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class UnicodeEncoding : System.Text.Encoding
- {
- public const int CharSize = 2;
- public UnicodeEncoding() { }
- public UnicodeEncoding(bool bigEndian, bool byteOrderMark) { }
- public UnicodeEncoding(bool bigEndian, bool byteOrderMark, bool throwOnInvalidBytes) { }
- public override bool Equals(object value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe override int GetByteCount(char* chars, int count) { throw null; }
- public override int GetByteCount(char[] chars, int index, int count) { throw null; }
- public override int GetByteCount(string s) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount) { throw null; }
- public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex) { throw null; }
- public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe override int GetCharCount(byte* bytes, int count) { throw null; }
- public override int GetCharCount(byte[] bytes, int index, int count) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe override int GetChars(byte* bytes, int byteCount, char* chars, int charCount) { throw null; }
- public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex) { throw null; }
- public override System.Text.Decoder GetDecoder() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override System.Text.Encoder GetEncoder() { throw null; }
- public override int GetHashCode() { throw null; }
- public override int GetMaxByteCount(int charCount) { throw null; }
- public override int GetMaxCharCount(int byteCount) { throw null; }
- public override byte[] GetPreamble() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override string GetString(byte[] bytes, int index, int count) { throw null; }
- }
- public sealed partial class UTF32Encoding : System.Text.Encoding
- {
- public UTF32Encoding() { }
- public UTF32Encoding(bool bigEndian, bool byteOrderMark) { }
- public UTF32Encoding(bool bigEndian, bool byteOrderMark, bool throwOnInvalidCharacters) { }
- public override bool Equals(object value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe override int GetByteCount(char* chars, int count) { throw null; }
- public override int GetByteCount(char[] chars, int index, int count) { throw null; }
- public override int GetByteCount(string s) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount) { throw null; }
- public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex) { throw null; }
- public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe override int GetCharCount(byte* bytes, int count) { throw null; }
- public override int GetCharCount(byte[] bytes, int index, int count) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe override int GetChars(byte* bytes, int byteCount, char* chars, int charCount) { throw null; }
- public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex) { throw null; }
- public override System.Text.Decoder GetDecoder() { throw null; }
- public override System.Text.Encoder GetEncoder() { throw null; }
- public override int GetHashCode() { throw null; }
- public override int GetMaxByteCount(int charCount) { throw null; }
- public override int GetMaxCharCount(int byteCount) { throw null; }
- public override byte[] GetPreamble() { throw null; }
- public override string GetString(byte[] bytes, int index, int count) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class UTF7Encoding : System.Text.Encoding
- {
- public UTF7Encoding() { }
- public UTF7Encoding(bool allowOptionals) { }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override bool Equals(object value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe override int GetByteCount(char* chars, int count) { throw null; }
- public override int GetByteCount(char[] chars, int index, int count) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override int GetByteCount(string s) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount) { throw null; }
- public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe override int GetCharCount(byte* bytes, int count) { throw null; }
- public override int GetCharCount(byte[] bytes, int index, int count) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe override int GetChars(byte* bytes, int byteCount, char* chars, int charCount) { throw null; }
- public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex) { throw null; }
- public override System.Text.Decoder GetDecoder() { throw null; }
- public override System.Text.Encoder GetEncoder() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override int GetHashCode() { throw null; }
- public override int GetMaxByteCount(int charCount) { throw null; }
- public override int GetMaxCharCount(int byteCount) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override string GetString(byte[] bytes, int index, int count) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class UTF8Encoding : System.Text.Encoding
- {
- public UTF8Encoding() { }
- public UTF8Encoding(bool encoderShouldEmitUTF8Identifier) { }
- public UTF8Encoding(bool encoderShouldEmitUTF8Identifier, bool throwOnInvalidBytes) { }
- public override bool Equals(object value) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe override int GetByteCount(char* chars, int count) { throw null; }
- public override int GetByteCount(char[] chars, int index, int count) { throw null; }
- public override int GetByteCount(string chars) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount) { throw null; }
- public override int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex) { throw null; }
- public override int GetBytes(string s, int charIndex, int charCount, byte[] bytes, int byteIndex) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe override int GetCharCount(byte* bytes, int count) { throw null; }
- public override int GetCharCount(byte[] bytes, int index, int count) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe override int GetChars(byte* bytes, int byteCount, char* chars, int charCount) { throw null; }
- public override int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex) { throw null; }
- public override System.Text.Decoder GetDecoder() { throw null; }
- public override System.Text.Encoder GetEncoder() { throw null; }
- public override int GetHashCode() { throw null; }
- public override int GetMaxByteCount(int charCount) { throw null; }
- public override int GetMaxCharCount(int byteCount) { throw null; }
- public override byte[] GetPreamble() { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override string GetString(byte[] bytes, int index, int count) { throw null; }
- }
-}
-namespace System.Threading
-{
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public partial class AbandonedMutexException : System.SystemException
- {
- public AbandonedMutexException() { }
- public AbandonedMutexException(int location, System.Threading.WaitHandle handle) { }
- public AbandonedMutexException(string message) { }
- public AbandonedMutexException(string message, System.Exception inner) { }
- public AbandonedMutexException(string message, System.Exception inner, int location, System.Threading.WaitHandle handle) { }
- public AbandonedMutexException(string message, int location, System.Threading.WaitHandle handle) { }
- protected AbandonedMutexException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- public System.Threading.Mutex Mutex { get { throw null; } }
- public int MutexIndex { get { throw null; } }
- }
- public enum ApartmentState
- {
- MTA = 1,
- STA = 0,
- Unknown = 2,
- }
- public sealed partial class AsyncLocal<T>
- {
- public AsyncLocal() { }
- [System.Security.SecurityCriticalAttribute]
- public AsyncLocal(System.Action<System.Threading.AsyncLocalValueChangedArgs<T>> valueChangedHandler) { }
- public T Value { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } [System.Security.SecuritySafeCriticalAttribute]set { } }
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct AsyncLocalValueChangedArgs<T>
- {
- public T CurrentValue { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public T PreviousValue { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- public bool ThreadContextChanged { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class AutoResetEvent : System.Threading.EventWaitHandle
- {
- public AutoResetEvent(bool initialState) : base (default(bool), default(System.Threading.EventResetMode)) { }
- }
- [System.Diagnostics.DebuggerDisplayAttribute("IsCancellationRequested = {IsCancellationRequested}")]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct CancellationToken
- {
- public CancellationToken(bool canceled) { throw null;}
- public bool CanBeCanceled { get { throw null; } }
- public bool IsCancellationRequested { get { throw null; } }
- public static System.Threading.CancellationToken None { get { throw null; } }
- public System.Threading.WaitHandle WaitHandle { get { throw null; } }
- public override bool Equals(object other) { throw null; }
- public bool Equals(System.Threading.CancellationToken other) { throw null; }
- public override int GetHashCode() { throw null; }
- public static bool operator ==(System.Threading.CancellationToken left, System.Threading.CancellationToken right) { throw null; }
- public static bool operator !=(System.Threading.CancellationToken left, System.Threading.CancellationToken right) { throw null; }
- public System.Threading.CancellationTokenRegistration Register(System.Action callback) { throw null; }
- public System.Threading.CancellationTokenRegistration Register(System.Action callback, bool useSynchronizationContext) { throw null; }
- public System.Threading.CancellationTokenRegistration Register(System.Action<object> callback, object state) { throw null; }
- public System.Threading.CancellationTokenRegistration Register(System.Action<object> callback, object state, bool useSynchronizationContext) { throw null; }
- public void ThrowIfCancellationRequested() { }
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct CancellationTokenRegistration : System.IDisposable, System.IEquatable<System.Threading.CancellationTokenRegistration>
- {
- public void Dispose() { }
- public override bool Equals(object obj) { throw null; }
- public bool Equals(System.Threading.CancellationTokenRegistration other) { throw null; }
- public override int GetHashCode() { throw null; }
- public static bool operator ==(System.Threading.CancellationTokenRegistration left, System.Threading.CancellationTokenRegistration right) { throw null; }
- public static bool operator !=(System.Threading.CancellationTokenRegistration left, System.Threading.CancellationTokenRegistration right) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public partial class CancellationTokenSource : System.IDisposable
- {
- public CancellationTokenSource() { }
- public CancellationTokenSource(int millisecondsDelay) { }
- public CancellationTokenSource(System.TimeSpan delay) { }
- public bool IsCancellationRequested { get { throw null; } }
- public System.Threading.CancellationToken Token { get { throw null; } }
- public void Cancel() { }
- public void Cancel(bool throwOnFirstException) { }
- public void CancelAfter(int millisecondsDelay) { }
- public void CancelAfter(System.TimeSpan delay) { }
- public static System.Threading.CancellationTokenSource CreateLinkedTokenSource(System.Threading.CancellationToken token1, System.Threading.CancellationToken token2) { throw null; }
- public static System.Threading.CancellationTokenSource CreateLinkedTokenSource(params System.Threading.CancellationToken[] tokens) { throw null; }
- public void Dispose() { }
- protected virtual void Dispose(bool disposing) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecurityCriticalAttribute]
- public delegate void ContextCallback(object state);
- [System.Diagnostics.DebuggerDisplayAttribute("Initial Count={InitialCount}, Current Count={CurrentCount}")]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public partial class CountdownEvent : System.IDisposable
- {
- public CountdownEvent(int initialCount) { }
- public int CurrentCount { get { throw null; } }
- public int InitialCount { get { throw null; } }
- public bool IsSet { get { throw null; } }
- public System.Threading.WaitHandle WaitHandle { get { throw null; } }
- public void AddCount() { }
- public void AddCount(int signalCount) { }
- public void Dispose() { }
- protected virtual void Dispose(bool disposing) { }
- public void Reset() { }
- public void Reset(int count) { }
- public bool Signal() { throw null; }
- public bool Signal(int signalCount) { throw null; }
- public bool TryAddCount() { throw null; }
- public bool TryAddCount(int signalCount) { throw null; }
- public void Wait() { }
- public bool Wait(int millisecondsTimeout) { throw null; }
- public bool Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; }
- public void Wait(System.Threading.CancellationToken cancellationToken) { }
- public bool Wait(System.TimeSpan timeout) { throw null; }
- public bool Wait(System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public enum EventResetMode
- {
- AutoReset = 0,
- ManualReset = 1,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class EventWaitHandle : System.Threading.WaitHandle
- {
- [System.Security.SecuritySafeCriticalAttribute]
- public EventWaitHandle(bool initialState, System.Threading.EventResetMode mode) { }
- [System.Security.SecurityCriticalAttribute]
- public EventWaitHandle(bool initialState, System.Threading.EventResetMode mode, string name) { }
- [System.Security.SecurityCriticalAttribute]
- public EventWaitHandle(bool initialState, System.Threading.EventResetMode mode, string name, out bool createdNew) { createdNew = default(bool); }
- [System.Security.SecurityCriticalAttribute]
- public static System.Threading.EventWaitHandle OpenExisting(string name) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public bool Reset() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public bool Set() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static bool TryOpenExisting(string name, out System.Threading.EventWaitHandle result) { result = default(System.Threading.EventWaitHandle); throw null; }
- }
- public sealed partial class ExecutionContext : System.IDisposable
- {
- internal ExecutionContext() { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Threading.ExecutionContext Capture() { throw null; }
- public void Dispose() { }
- [System.Runtime.ExceptionServices.HandleProcessCorruptedStateExceptionsAttribute]
- [System.Security.SecurityCriticalAttribute]
- public static void Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) { }
- }
- public static partial class Interlocked
- {
- public static int Add(ref int location1, int value) { throw null; }
- public static long Add(ref long location1, long value) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static double CompareExchange(ref double location1, double value, double comparand) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static int CompareExchange(ref int location1, int value, int comparand) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static long CompareExchange(ref long location1, long value, long comparand) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static System.IntPtr CompareExchange(ref System.IntPtr location1, System.IntPtr value, System.IntPtr comparand) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static object CompareExchange(ref object location1, object value, object comparand) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static float CompareExchange(ref float location1, float value, float comparand) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static T CompareExchange<T>(ref T location1, T value, T comparand) where T : class { throw null; }
- public static int Decrement(ref int location) { throw null; }
- public static long Decrement(ref long location) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static double Exchange(ref double location1, double value) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static int Exchange(ref int location1, int value) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static long Exchange(ref long location1, long value) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static System.IntPtr Exchange(ref System.IntPtr location1, System.IntPtr value) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static object Exchange(ref object location1, object value) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static float Exchange(ref float location1, float value) { throw null; }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static T Exchange<T>(ref T location1, T value) where T : class { throw null; }
- public static int Increment(ref int location) { throw null; }
- public static long Increment(ref long location) { throw null; }
- public static void MemoryBarrier() { }
- public static long Read(ref long location) { throw null; }
- }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe delegate void IOCompletionCallback(uint errorCode, uint numBytes, System.Threading.NativeOverlapped* pOVERLAP);
- public static partial class LazyInitializer
- {
- public static T EnsureInitialized<T>(ref T target) where T : class { throw null; }
- public static T EnsureInitialized<T>(ref T target, ref bool initialized, ref object syncLock) { throw null; }
- public static T EnsureInitialized<T>(ref T target, ref bool initialized, ref object syncLock, System.Func<T> valueFactory) { throw null; }
- public static T EnsureInitialized<T>(ref T target, System.Func<T> valueFactory) where T : class { throw null; }
- }
- public enum LazyThreadSafetyMode
- {
- ExecutionAndPublication = 2,
- None = 0,
- PublicationOnly = 1,
- }
- [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
- public partial class LockRecursionException : System.Exception
- {
- public LockRecursionException() { }
- public LockRecursionException(string message) { }
- public LockRecursionException(string message, System.Exception innerException) { }
- protected LockRecursionException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class ManualResetEvent : System.Threading.EventWaitHandle
- {
- public ManualResetEvent(bool initialState) : base (default(bool), default(System.Threading.EventResetMode)) { }
- }
- [System.Diagnostics.DebuggerDisplayAttribute("Set = {IsSet}")]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public partial class ManualResetEventSlim : System.IDisposable
- {
- public ManualResetEventSlim() { }
- public ManualResetEventSlim(bool initialState) { }
- public ManualResetEventSlim(bool initialState, int spinCount) { }
- public bool IsSet { get { throw null; } }
- public int SpinCount { get { throw null; } }
- public System.Threading.WaitHandle WaitHandle { get { throw null; } }
- public void Dispose() { }
- protected virtual void Dispose(bool disposing) { }
- public void Reset() { }
- public void Set() { }
- public void Wait() { }
- public bool Wait(int millisecondsTimeout) { throw null; }
- public bool Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; }
- public void Wait(System.Threading.CancellationToken cancellationToken) { }
- public bool Wait(System.TimeSpan timeout) { throw null; }
- public bool Wait(System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static partial class Monitor
- {
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static void Enter(object obj) { }
- public static void Enter(object obj, ref bool lockTaken) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static void Exit(object obj) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static bool IsEntered(object obj) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void Pulse(object obj) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void PulseAll(object obj) { }
- public static bool TryEnter(object obj) { throw null; }
- public static void TryEnter(object obj, ref bool lockTaken) { }
- public static bool TryEnter(object obj, int millisecondsTimeout) { throw null; }
- public static void TryEnter(object obj, int millisecondsTimeout, ref bool lockTaken) { }
- public static bool TryEnter(object obj, System.TimeSpan timeout) { throw null; }
- public static void TryEnter(object obj, System.TimeSpan timeout, ref bool lockTaken) { }
- public static bool Wait(object obj) { throw null; }
- public static bool Wait(object obj, int millisecondsTimeout) { throw null; }
- public static bool Wait(object obj, int millisecondsTimeout, bool exitContext) { throw null; }
- public static bool Wait(object obj, System.TimeSpan timeout) { throw null; }
- public static bool Wait(object obj, System.TimeSpan timeout, bool exitContext) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class Mutex : System.Threading.WaitHandle
- {
- [System.Security.SecuritySafeCriticalAttribute]
- public Mutex() { }
- [System.Security.SecuritySafeCriticalAttribute]
- public Mutex(bool initiallyOwned) { }
- [System.Security.SecurityCriticalAttribute]
- public Mutex(bool initiallyOwned, string name) { }
- [System.Security.SecurityCriticalAttribute]
- public Mutex(bool initiallyOwned, string name, out bool createdNew) { createdNew = default(bool); }
- [System.Security.SecurityCriticalAttribute]
- public static System.Threading.Mutex OpenExisting(string name) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public void ReleaseMutex() { }
- [System.Security.SecurityCriticalAttribute]
- public static bool TryOpenExisting(string name, out System.Threading.Mutex result) { result = default(System.Threading.Mutex); throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct NativeOverlapped
- {
- public System.IntPtr EventHandle;
- public System.IntPtr InternalHigh;
- public System.IntPtr InternalLow;
- public int OffsetHigh;
- public int OffsetLow;
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class Overlapped
- {
- [System.Security.SecuritySafeCriticalAttribute]
- public Overlapped() { }
- public System.IAsyncResult AsyncResult { get { throw null; } set { } }
- public int OffsetHigh { get { throw null; } set { } }
- public int OffsetLow { get { throw null; } set { } }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe static void Free(System.Threading.NativeOverlapped* nativeOverlappedPtr) { }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe System.Threading.NativeOverlapped* Pack(System.Threading.IOCompletionCallback iocb, object userData) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe static System.Threading.Overlapped Unpack(System.Threading.NativeOverlapped* nativeOverlappedPtr) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Security.SecurityCriticalAttribute]
- public unsafe System.Threading.NativeOverlapped* UnsafePack(System.Threading.IOCompletionCallback iocb, object userData) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public delegate void ParameterizedThreadStart(object obj);
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class RegisteredWaitHandle
- {
- internal RegisteredWaitHandle() { }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- [System.Security.SecuritySafeCriticalAttribute]
- public bool Unregister(System.Threading.WaitHandle waitObject) { throw null; }
- }
- public sealed partial class Semaphore : System.Threading.WaitHandle
- {
- [System.Security.SecuritySafeCriticalAttribute]
- public Semaphore(int initialCount, int maximumCount) { }
- [System.Security.SecurityCriticalAttribute]
- public Semaphore(int initialCount, int maximumCount, string name) { }
- [System.Security.SecurityCriticalAttribute]
- public Semaphore(int initialCount, int maximumCount, string name, out bool createdNew) { createdNew = default(bool); }
- [System.Security.SecurityCriticalAttribute]
- public static System.Threading.Semaphore OpenExisting(string name) { throw null; }
- public int Release() { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public int Release(int releaseCount) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static bool TryOpenExisting(string name, out System.Threading.Semaphore result) { result = default(System.Threading.Semaphore); throw null; }
- }
- [System.Runtime.CompilerServices.TypeForwardedFromAttribute("System, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public partial class SemaphoreFullException : System.SystemException
- {
- public SemaphoreFullException() { }
- public SemaphoreFullException(string message) { }
- public SemaphoreFullException(string message, System.Exception innerException) { }
- protected SemaphoreFullException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Diagnostics.DebuggerDisplayAttribute("Current Count = {m_currentCount}")]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public partial class SemaphoreSlim : System.IDisposable
- {
- public SemaphoreSlim(int initialCount) { }
- public SemaphoreSlim(int initialCount, int maxCount) { }
- public System.Threading.WaitHandle AvailableWaitHandle { get { throw null; } }
- public int CurrentCount { get { throw null; } }
- public void Dispose() { }
- protected virtual void Dispose(bool disposing) { }
- public int Release() { throw null; }
- public int Release(int releaseCount) { throw null; }
- public void Wait() { }
- public bool Wait(int millisecondsTimeout) { throw null; }
- public bool Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; }
- public void Wait(System.Threading.CancellationToken cancellationToken) { }
- public bool Wait(System.TimeSpan timeout) { throw null; }
- public bool Wait(System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; }
- public System.Threading.Tasks.Task WaitAsync() { throw null; }
- public System.Threading.Tasks.Task<bool> WaitAsync(int millisecondsTimeout) { throw null; }
- public System.Threading.Tasks.Task<bool> WaitAsync(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; }
- public System.Threading.Tasks.Task WaitAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
- public System.Threading.Tasks.Task<bool> WaitAsync(System.TimeSpan timeout) { throw null; }
- public System.Threading.Tasks.Task<bool> WaitAsync(System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; }
- }
- public delegate void SendOrPostCallback(object state);
- [System.Diagnostics.DebuggerDisplayAttribute("IsHeld = {IsHeld}")]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct SpinLock
- {
- public SpinLock(bool enableThreadOwnerTracking) { throw null;}
- public bool IsHeld { get { throw null; } }
- public bool IsHeldByCurrentThread { get { throw null; } }
- public bool IsThreadOwnerTrackingEnabled { get { throw null; } }
- public void Enter(ref bool lockTaken) { }
- public void Exit() { }
- public void Exit(bool useMemoryBarrier) { }
- public void TryEnter(ref bool lockTaken) { }
- public void TryEnter(int millisecondsTimeout, ref bool lockTaken) { }
- public void TryEnter(System.TimeSpan timeout, ref bool lockTaken) { }
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct SpinWait
- {
- public int Count { get { throw null; } }
- public bool NextSpinWillYield { get { throw null; } }
- public void Reset() { }
- public void SpinOnce() { }
- public static void SpinUntil(System.Func<bool> condition) { }
- public static bool SpinUntil(System.Func<bool> condition, int millisecondsTimeout) { throw null; }
- public static bool SpinUntil(System.Func<bool> condition, System.TimeSpan timeout) { throw null; }
- }
- public partial class SynchronizationContext
- {
- public SynchronizationContext() { }
- public static System.Threading.SynchronizationContext Current { get { throw null; } }
- public virtual System.Threading.SynchronizationContext CreateCopy() { throw null; }
- public virtual void OperationCompleted() { }
- public virtual void OperationStarted() { }
- public virtual void Post(System.Threading.SendOrPostCallback d, object state) { }
- public virtual void Send(System.Threading.SendOrPostCallback d, object state) { }
- [System.Security.SecurityCriticalAttribute]
- public static void SetSynchronizationContext(System.Threading.SynchronizationContext syncContext) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class SynchronizationLockException : System.SystemException
- {
- public SynchronizationLockException() { }
- public SynchronizationLockException(string message) { }
- public SynchronizationLockException(string message, System.Exception innerException) { }
- protected SynchronizationLockException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ClassInterfaceAttribute((System.Runtime.InteropServices.ClassInterfaceType)(0))]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class Thread : Internal.Runtime.Augments.RuntimeThread
- {
- [System.Security.SecuritySafeCriticalAttribute]
- public Thread(System.Threading.ParameterizedThreadStart start) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public Thread(System.Threading.ThreadStart start) { }
- public System.Globalization.CultureInfo CurrentCulture { get { throw null; } [System.Security.SecuritySafeCriticalAttribute]set { } }
- public static new System.Threading.Thread CurrentThread { [System.Security.SecuritySafeCriticalAttribute]get { throw null; } }
- public System.Globalization.CultureInfo CurrentUICulture { get { throw null; } [System.Security.SecuritySafeCriticalAttribute]set { } }
- public new int ManagedThreadId { [System.Security.SecuritySafeCriticalAttribute][System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]get { throw null; } }
- public new string Name { get { throw null; } [System.Security.SecuritySafeCriticalAttribute]set { } }
- ~Thread() { }
- [System.Security.SecuritySafeCriticalAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public override int GetHashCode() { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecuritySafeCriticalAttribute]
- public static void MemoryBarrier() { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static new void Sleep(int millisecondsTimeout) { }
- public static void Sleep(System.TimeSpan timeout) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static new void SpinWait(int iterations) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- public new void Start() { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- public new void Start(object parameter) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class ThreadAbortException : System.SystemException
- {
- internal ThreadAbortException() { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class ThreadInterruptedException : System.SystemException
- {
- public ThreadInterruptedException() { }
- public ThreadInterruptedException(string message) { }
- public ThreadInterruptedException(string message, System.Exception innerException) { }
- protected ThreadInterruptedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
- }
- [System.Diagnostics.DebuggerDisplayAttribute("IsValueCreated={IsValueCreated}, Value={ValueForDebugDisplay}, Count={ValuesCountForDebugDisplay}")]
- public partial class ThreadLocal<T> : System.IDisposable
- {
- public ThreadLocal() { }
- public ThreadLocal(bool trackAllValues) { }
- public ThreadLocal(System.Func<T> valueFactory) { }
- public ThreadLocal(System.Func<T> valueFactory, bool trackAllValues) { }
- public bool IsValueCreated { get { throw null; } }
- [System.Diagnostics.DebuggerBrowsableAttribute((System.Diagnostics.DebuggerBrowsableState)(0))]
- public T Value { get { throw null; } set { } }
- public System.Collections.Generic.IList<T> Values { get { throw null; } }
- public void Dispose() { }
- protected virtual void Dispose(bool disposing) { }
- ~ThreadLocal() { }
- public override string ToString() { throw null; }
- }
- public static partial class ThreadPool
- {
- [System.Security.SecurityCriticalAttribute]
- public static bool BindHandle(System.Runtime.InteropServices.SafeHandle osHandle) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void GetMaxThreads(out int workerThreads, out int completionPortThreads) { workerThreads = default(int); completionPortThreads = default(int); }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void GetMinThreads(out int workerThreads, out int completionPortThreads) { workerThreads = default(int); completionPortThreads = default(int); }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecuritySafeCriticalAttribute]
- public static bool QueueUserWorkItem(System.Threading.WaitCallback callBack) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecuritySafeCriticalAttribute]
- public static bool QueueUserWorkItem(System.Threading.WaitCallback callBack, object state) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecuritySafeCriticalAttribute]
- public static System.Threading.RegisteredWaitHandle RegisterWaitForSingleObject(System.Threading.WaitHandle waitObject, System.Threading.WaitOrTimerCallback callBack, object state, int millisecondsTimeOutInterval, bool executeOnlyOnce) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecuritySafeCriticalAttribute]
- public static System.Threading.RegisteredWaitHandle RegisterWaitForSingleObject(System.Threading.WaitHandle waitObject, System.Threading.WaitOrTimerCallback callBack, object state, long millisecondsTimeOutInterval, bool executeOnlyOnce) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecuritySafeCriticalAttribute]
- public static System.Threading.RegisteredWaitHandle RegisterWaitForSingleObject(System.Threading.WaitHandle waitObject, System.Threading.WaitOrTimerCallback callBack, object state, System.TimeSpan timeout, bool executeOnlyOnce) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.CLSCompliantAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static System.Threading.RegisteredWaitHandle RegisterWaitForSingleObject(System.Threading.WaitHandle waitObject, System.Threading.WaitOrTimerCallback callBack, object state, uint millisecondsTimeOutInterval, bool executeOnlyOnce) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static bool SetMaxThreads(int workerThreads, int completionPortThreads) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static bool SetMinThreads(int workerThreads, int completionPortThreads) { throw null; }
- }
- public enum ThreadPriority
- {
- AboveNormal = 3,
- BelowNormal = 1,
- Highest = 4,
- Lowest = 0,
- Normal = 2,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public delegate void ThreadStart();
- public sealed partial class ThreadStartException : System.SystemException
- {
- internal ThreadStartException() { }
- }
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum ThreadState
- {
- Aborted = 256,
- AbortRequested = 128,
- Background = 4,
- Running = 0,
- Stopped = 16,
- StopRequested = 1,
- Suspended = 64,
- SuspendRequested = 2,
- Unstarted = 8,
- WaitSleepJoin = 32,
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public partial class ThreadStateException : System.SystemException
- {
- public ThreadStateException() { }
- public ThreadStateException(string message) { }
- public ThreadStateException(string message, System.Exception innerException) { }
- protected ThreadStateException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public static partial class Timeout
- {
- public const int Infinite = -1;
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public static readonly System.TimeSpan InfiniteTimeSpan;
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public sealed partial class Timer : System.IDisposable
- {
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecuritySafeCriticalAttribute]
- public Timer(System.Threading.TimerCallback callback) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecuritySafeCriticalAttribute]
- public Timer(System.Threading.TimerCallback callback, object state, int dueTime, int period) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecuritySafeCriticalAttribute]
- public Timer(System.Threading.TimerCallback callback, object state, long dueTime, long period) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.Security.SecuritySafeCriticalAttribute]
- public Timer(System.Threading.TimerCallback callback, object state, System.TimeSpan dueTime, System.TimeSpan period) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)][System.CLSCompliantAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public Timer(System.Threading.TimerCallback callback, object state, uint dueTime, uint period) { }
- public bool Change(int dueTime, int period) { throw null; }
- public bool Change(long dueTime, long period) { throw null; }
- public bool Change(System.TimeSpan dueTime, System.TimeSpan period) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public bool Change(uint dueTime, uint period) { throw null; }
- public void Dispose() { }
- public bool Dispose(System.Threading.WaitHandle notifyObject) { throw null; }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public delegate void TimerCallback(object state);
- public static partial class Volatile
- {
- public static bool Read(ref bool location) { throw null; }
- public static byte Read(ref byte location) { throw null; }
- public static double Read(ref double location) { throw null; }
- public static short Read(ref short location) { throw null; }
- public static int Read(ref int location) { throw null; }
- public static long Read(ref long location) { throw null; }
- public static System.IntPtr Read(ref System.IntPtr location) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static sbyte Read(ref sbyte location) { throw null; }
- public static float Read(ref float location) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static ushort Read(ref ushort location) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static uint Read(ref uint location) { throw null; }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static ulong Read(ref ulong location) { throw null; }
- [System.CLSCompliantAttribute(false)]
- public static System.UIntPtr Read(ref System.UIntPtr location) { throw null; }
- [System.Security.SecuritySafeCriticalAttribute]
- public static T Read<T>(ref T location) where T : class { throw null; }
- public static void Write(ref bool location, bool value) { }
- public static void Write(ref byte location, byte value) { }
- public static void Write(ref double location, double value) { }
- public static void Write(ref short location, short value) { }
- public static void Write(ref int location, int value) { }
- public static void Write(ref long location, long value) { }
- public static void Write(ref System.IntPtr location, System.IntPtr value) { }
- [System.CLSCompliantAttribute(false)]
- public static void Write(ref sbyte location, sbyte value) { }
- public static void Write(ref float location, float value) { }
- [System.CLSCompliantAttribute(false)]
- public static void Write(ref ushort location, ushort value) { }
- [System.CLSCompliantAttribute(false)]
- public static void Write(ref uint location, uint value) { }
- [System.CLSCompliantAttribute(false)]
- [System.Security.SecuritySafeCriticalAttribute]
- public static void Write(ref ulong location, ulong value) { }
- [System.CLSCompliantAttribute(false)]
- public static void Write(ref System.UIntPtr location, System.UIntPtr value) { }
- [System.Security.SecuritySafeCriticalAttribute]
- public static void Write<T>(ref T location, T value) where T : class { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public delegate void WaitCallback(object state);
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public abstract partial class WaitHandle : System.IDisposable
- {
- protected static readonly System.IntPtr InvalidHandle;
- public const int WaitTimeout = 258;
- protected WaitHandle() { }
- [System.ObsoleteAttribute("Use the SafeWaitHandle property instead.")]
- public virtual System.IntPtr Handle { [System.Security.SecuritySafeCriticalAttribute]get { return default(System.IntPtr); } [System.Security.SecurityCriticalAttribute]set { } }
- public Microsoft.Win32.SafeHandles.SafeWaitHandle SafeWaitHandle { [System.Security.SecurityCriticalAttribute]get { throw null; } [System.Security.SecurityCriticalAttribute]set { } }
- public virtual void Close() { }
- public void Dispose() { }
- [System.Security.SecuritySafeCriticalAttribute]
- protected virtual void Dispose(bool explicitDisposing) { }
- public static bool SignalAndWait(System.Threading.WaitHandle toSignal, System.Threading.WaitHandle toWaitOn) { return default(bool); }
- public static bool SignalAndWait(System.Threading.WaitHandle toSignal, System.Threading.WaitHandle toWaitOn, int millisecondsTimeout, bool exitContext) { return default(bool); }
- public static bool SignalAndWait(System.Threading.WaitHandle toSignal, System.Threading.WaitHandle toWaitOn, System.TimeSpan timeout, bool exitContext) { return default(bool); }
- public static bool WaitAll(System.Threading.WaitHandle[] waitHandles) { throw null; }
- public static bool WaitAll(System.Threading.WaitHandle[] waitHandles, int millisecondsTimeout) { throw null; }
- public static bool WaitAll(System.Threading.WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext) { return default(bool); }
- public static bool WaitAll(System.Threading.WaitHandle[] waitHandles, System.TimeSpan timeout) { throw null; }
- public static bool WaitAll(System.Threading.WaitHandle[] waitHandles, System.TimeSpan timeout, bool exitContext) { return default(bool); }
- public static int WaitAny(System.Threading.WaitHandle[] waitHandles) { throw null; }
- public static int WaitAny(System.Threading.WaitHandle[] waitHandles, int millisecondsTimeout) { throw null; }
- public static int WaitAny(System.Threading.WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext) { return default(int); }
- public static int WaitAny(System.Threading.WaitHandle[] waitHandles, System.TimeSpan timeout) { throw null; }
- public static int WaitAny(System.Threading.WaitHandle[] waitHandles, System.TimeSpan timeout, bool exitContext) { return default(int); }
- public virtual bool WaitOne() { throw null; }
- public virtual bool WaitOne(int millisecondsTimeout) { throw null; }
- public virtual bool WaitOne(int millisecondsTimeout, bool exitContext) { return default(bool); }
- public virtual bool WaitOne(System.TimeSpan timeout) { throw null; }
- public virtual bool WaitOne(System.TimeSpan timeout, bool exitContext) { return default(bool); }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(false)]
- public partial class WaitHandleCannotBeOpenedException : System.ApplicationException
- {
- public WaitHandleCannotBeOpenedException() { }
- public WaitHandleCannotBeOpenedException(string message) { }
- public WaitHandleCannotBeOpenedException(string message, System.Exception innerException) { }
- protected WaitHandleCannotBeOpenedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public delegate void WaitOrTimerCallback(object state, bool timedOut);
-}
-namespace System.Threading.Tasks
-{
- [System.Diagnostics.DebuggerDisplayAttribute("Concurrent={ConcurrentTaskCountForDebugger}, Exclusive={ExclusiveTaskCountForDebugger}, Mode={ModeForDebugger}")]
- public partial class ConcurrentExclusiveSchedulerPair
- {
- public ConcurrentExclusiveSchedulerPair() { }
- public ConcurrentExclusiveSchedulerPair(System.Threading.Tasks.TaskScheduler taskScheduler) { }
- public ConcurrentExclusiveSchedulerPair(System.Threading.Tasks.TaskScheduler taskScheduler, int maxConcurrencyLevel) { }
- public ConcurrentExclusiveSchedulerPair(System.Threading.Tasks.TaskScheduler taskScheduler, int maxConcurrencyLevel, int maxItemsPerTask) { }
- public System.Threading.Tasks.Task Completion { get { throw null; } }
- public System.Threading.Tasks.TaskScheduler ConcurrentScheduler { get { throw null; } }
- public System.Threading.Tasks.TaskScheduler ExclusiveScheduler { get { throw null; } }
- public void Complete() { }
- }
- [System.Diagnostics.DebuggerDisplayAttribute("Id = {Id}, Status = {Status}, Method = {DebuggerDisplayMethodDescription}")]
- public partial class Task : System.IAsyncResult, System.IDisposable
- {
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public Task(System.Action action) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public Task(System.Action action, System.Threading.CancellationToken cancellationToken) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public Task(System.Action action, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public Task(System.Action action, System.Threading.Tasks.TaskCreationOptions creationOptions) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public Task(System.Action<object> action, object state) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public Task(System.Action<object> action, object state, System.Threading.CancellationToken cancellationToken) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public Task(System.Action<object> action, object state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public Task(System.Action<object> action, object state, System.Threading.Tasks.TaskCreationOptions creationOptions) { }
- public object AsyncState { get { throw null; } }
- public static System.Threading.Tasks.Task CompletedTask { get { throw null; } }
- public System.Threading.Tasks.TaskCreationOptions CreationOptions { get { throw null; } }
- public static System.Nullable<int> CurrentId { get { throw null; } }
- public System.AggregateException Exception { get { throw null; } }
- public static System.Threading.Tasks.TaskFactory Factory { get { throw null; } }
- public int Id { get { throw null; } }
- public bool IsCanceled { get { throw null; } }
- public bool IsCompleted { get { throw null; } }
- public bool IsFaulted { get { throw null; } }
- public System.Threading.Tasks.TaskStatus Status { get { throw null; } }
- System.Threading.WaitHandle System.IAsyncResult.AsyncWaitHandle { get { throw null; } }
- bool System.IAsyncResult.CompletedSynchronously { get { throw null; } }
- public System.Runtime.CompilerServices.ConfiguredTaskAwaitable ConfigureAwait(bool continueOnCapturedContext) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task, object> continuationAction, object state) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task, object> continuationAction, object state, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task, object> continuationAction, object state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task, object> continuationAction, object state, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task, object> continuationAction, object state, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task> continuationAction) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task> continuationAction, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task> continuationAction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task> continuationAction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task> continuationAction, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, TResult> continuationFunction) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, object, TResult> continuationFunction, object state) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, object, TResult> continuationFunction, object state, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, object, TResult> continuationFunction, object state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, object, TResult> continuationFunction, object state, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWith<TResult>(System.Func<System.Threading.Tasks.Task, object, TResult> continuationFunction, object state, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- public static System.Threading.Tasks.Task Delay(int millisecondsDelay) { throw null; }
- public static System.Threading.Tasks.Task Delay(int millisecondsDelay, System.Threading.CancellationToken cancellationToken) { throw null; }
- public static System.Threading.Tasks.Task Delay(System.TimeSpan delay) { throw null; }
- public static System.Threading.Tasks.Task Delay(System.TimeSpan delay, System.Threading.CancellationToken cancellationToken) { throw null; }
- public void Dispose() { }
- protected virtual void Dispose(bool disposing) { }
- public static System.Threading.Tasks.Task FromCanceled(System.Threading.CancellationToken cancellationToken) { throw null; }
- public static System.Threading.Tasks.Task<TResult> FromCanceled<TResult>(System.Threading.CancellationToken cancellationToken) { throw null; }
- public static System.Threading.Tasks.Task FromException(System.Exception exception) { throw null; }
- public static System.Threading.Tasks.Task<TResult> FromException<TResult>(System.Exception exception) { throw null; }
- public static System.Threading.Tasks.Task<TResult> FromResult<TResult>(TResult result) { throw null; }
- public System.Runtime.CompilerServices.TaskAwaiter GetAwaiter() { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public static System.Threading.Tasks.Task Run(System.Action action) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public static System.Threading.Tasks.Task Run(System.Action action, System.Threading.CancellationToken cancellationToken) { throw null; }
- public static System.Threading.Tasks.Task Run(System.Func<System.Threading.Tasks.Task> function) { throw null; }
- public static System.Threading.Tasks.Task Run(System.Func<System.Threading.Tasks.Task> function, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public static System.Threading.Tasks.Task<TResult> Run<TResult>(System.Func<TResult> function) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public static System.Threading.Tasks.Task<TResult> Run<TResult>(System.Func<TResult> function, System.Threading.CancellationToken cancellationToken) { throw null; }
- public static System.Threading.Tasks.Task<TResult> Run<TResult>(System.Func<System.Threading.Tasks.Task<TResult>> function) { throw null; }
- public static System.Threading.Tasks.Task<TResult> Run<TResult>(System.Func<System.Threading.Tasks.Task<TResult>> function, System.Threading.CancellationToken cancellationToken) { throw null; }
- public void RunSynchronously() { }
- public void RunSynchronously(System.Threading.Tasks.TaskScheduler scheduler) { }
- public void Start() { }
- public void Start(System.Threading.Tasks.TaskScheduler scheduler) { }
- public void Wait() { }
- public bool Wait(int millisecondsTimeout) { throw null; }
- public bool Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; }
- public void Wait(System.Threading.CancellationToken cancellationToken) { }
- public bool Wait(System.TimeSpan timeout) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoOptimization)]public static void WaitAll(params System.Threading.Tasks.Task[] tasks) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoOptimization)]public static bool WaitAll(System.Threading.Tasks.Task[] tasks, int millisecondsTimeout) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoOptimization)]public static bool WaitAll(System.Threading.Tasks.Task[] tasks, int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoOptimization)]public static void WaitAll(System.Threading.Tasks.Task[] tasks, System.Threading.CancellationToken cancellationToken) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoOptimization)]public static bool WaitAll(System.Threading.Tasks.Task[] tasks, System.TimeSpan timeout) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoOptimization)]public static int WaitAny(params System.Threading.Tasks.Task[] tasks) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoOptimization)]public static int WaitAny(System.Threading.Tasks.Task[] tasks, int millisecondsTimeout) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoOptimization)]public static int WaitAny(System.Threading.Tasks.Task[] tasks, int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoOptimization)]public static int WaitAny(System.Threading.Tasks.Task[] tasks, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoOptimization)]public static int WaitAny(System.Threading.Tasks.Task[] tasks, System.TimeSpan timeout) { throw null; }
- public static System.Threading.Tasks.Task WhenAll(System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task> tasks) { throw null; }
- public static System.Threading.Tasks.Task WhenAll(params System.Threading.Tasks.Task[] tasks) { throw null; }
- public static System.Threading.Tasks.Task<TResult[]> WhenAll<TResult>(System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task<TResult>> tasks) { throw null; }
- public static System.Threading.Tasks.Task<TResult[]> WhenAll<TResult>(params System.Threading.Tasks.Task<TResult>[] tasks) { throw null; }
- public static System.Threading.Tasks.Task<System.Threading.Tasks.Task> WhenAny(System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task> tasks) { throw null; }
- public static System.Threading.Tasks.Task<System.Threading.Tasks.Task> WhenAny(params System.Threading.Tasks.Task[] tasks) { throw null; }
- public static System.Threading.Tasks.Task<System.Threading.Tasks.Task<TResult>> WhenAny<TResult>(System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task<TResult>> tasks) { throw null; }
- public static System.Threading.Tasks.Task<System.Threading.Tasks.Task<TResult>> WhenAny<TResult>(params System.Threading.Tasks.Task<TResult>[] tasks) { throw null; }
- public static System.Runtime.CompilerServices.YieldAwaitable Yield() { throw null; }
- }
- [System.Diagnostics.DebuggerDisplayAttribute("Id = {Id}, Status = {Status}, Method = {DebuggerDisplayMethodDescription}, Result = {DebuggerDisplayResultDescription}")]
- public partial class Task<TResult> : System.Threading.Tasks.Task
- {
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public Task(System.Func<TResult> function) : base (default(System.Action)) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public Task(System.Func<TResult> function, System.Threading.CancellationToken cancellationToken) : base (default(System.Action)) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public Task(System.Func<TResult> function, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions) : base (default(System.Action)) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public Task(System.Func<TResult> function, System.Threading.Tasks.TaskCreationOptions creationOptions) : base (default(System.Action)) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public Task(System.Func<object, TResult> function, object state) : base (default(System.Action)) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public Task(System.Func<object, TResult> function, object state, System.Threading.CancellationToken cancellationToken) : base (default(System.Action)) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public Task(System.Func<object, TResult> function, object state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions) : base (default(System.Action)) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public Task(System.Func<object, TResult> function, object state, System.Threading.Tasks.TaskCreationOptions creationOptions) : base (default(System.Action)) { }
- public static new System.Threading.Tasks.TaskFactory<TResult> Factory { get { throw null; } }
- [System.Diagnostics.DebuggerBrowsableAttribute((System.Diagnostics.DebuggerBrowsableState)(0))]
- public TResult Result { get { throw null; } }
- public new System.Runtime.CompilerServices.ConfiguredTaskAwaitable<TResult> ConfigureAwait(bool continueOnCapturedContext) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>, object> continuationAction, object state) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>, object> continuationAction, object state, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>, object> continuationAction, object state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>, object> continuationAction, object state, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>, object> continuationAction, object state, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>> continuationAction) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>> continuationAction, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>> continuationAction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>> continuationAction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWith(System.Action<System.Threading.Tasks.Task<TResult>> continuationAction, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, TNewResult> continuationFunction) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, TNewResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, TNewResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, TNewResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, TNewResult> continuationFunction, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, object, TNewResult> continuationFunction, object state) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, object, TNewResult> continuationFunction, object state, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, object, TNewResult> continuationFunction, object state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, object, TNewResult> continuationFunction, object state, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TNewResult> ContinueWith<TNewResult>(System.Func<System.Threading.Tasks.Task<TResult>, object, TNewResult> continuationFunction, object state, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- public new System.Runtime.CompilerServices.TaskAwaiter<TResult> GetAwaiter() { throw null; }
- }
- public partial class TaskCanceledException : System.OperationCanceledException
- {
- public TaskCanceledException() { }
- public TaskCanceledException(string message) { }
- public TaskCanceledException(string message, System.Exception innerException) { }
- public TaskCanceledException(System.Threading.Tasks.Task task) { }
- protected TaskCanceledException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- public System.Threading.Tasks.Task Task { get { throw null; } }
- }
- public partial class TaskCompletionSource<TResult>
- {
- public TaskCompletionSource() { }
- public TaskCompletionSource(object state) { }
- public TaskCompletionSource(object state, System.Threading.Tasks.TaskCreationOptions creationOptions) { }
- public TaskCompletionSource(System.Threading.Tasks.TaskCreationOptions creationOptions) { }
- public System.Threading.Tasks.Task<TResult> Task { get { throw null; } }
- public void SetCanceled() { }
- public void SetException(System.Collections.Generic.IEnumerable<System.Exception> exceptions) { }
- public void SetException(System.Exception exception) { }
- public void SetResult(TResult result) { }
- public bool TrySetCanceled() { throw null; }
- public bool TrySetCanceled(System.Threading.CancellationToken cancellationToken) { throw null; }
- public bool TrySetException(System.Collections.Generic.IEnumerable<System.Exception> exceptions) { throw null; }
- public bool TrySetException(System.Exception exception) { throw null; }
- public bool TrySetResult(TResult result) { throw null; }
- }
- [System.FlagsAttribute]
- public enum TaskContinuationOptions
- {
- AttachedToParent = 4,
- DenyChildAttach = 8,
- ExecuteSynchronously = 524288,
- HideScheduler = 16,
- LazyCancellation = 32,
- LongRunning = 2,
- None = 0,
- NotOnCanceled = 262144,
- NotOnFaulted = 131072,
- NotOnRanToCompletion = 65536,
- OnlyOnCanceled = 196608,
- OnlyOnFaulted = 327680,
- OnlyOnRanToCompletion = 393216,
- PreferFairness = 1,
- RunContinuationsAsynchronously = 64,
- }
- [System.FlagsAttribute]
- public enum TaskCreationOptions
- {
- AttachedToParent = 4,
- DenyChildAttach = 8,
- HideScheduler = 16,
- LongRunning = 2,
- None = 0,
- PreferFairness = 1,
- RunContinuationsAsynchronously = 64,
- }
- public partial class TaskFactory
- {
- public TaskFactory() { }
- public TaskFactory(System.Threading.CancellationToken cancellationToken) { }
- public TaskFactory(System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { }
- public TaskFactory(System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { }
- public TaskFactory(System.Threading.Tasks.TaskScheduler scheduler) { }
- public System.Threading.CancellationToken CancellationToken { get { throw null; } }
- public System.Threading.Tasks.TaskContinuationOptions ContinuationOptions { get { throw null; } }
- public System.Threading.Tasks.TaskCreationOptions CreationOptions { get { throw null; } }
- public System.Threading.Tasks.TaskScheduler Scheduler { get { throw null; } }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task[]> continuationAction) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task[]> continuationAction, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task[]> continuationAction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task[]> continuationAction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>[]> continuationAction) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>[]> continuationAction, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>[]> continuationAction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>[]> continuationAction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task> continuationAction) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task> continuationAction, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task> continuationAction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Action<System.Threading.Tasks.Task> continuationAction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TResult>(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>> continuationAction) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>> continuationAction, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>> continuationAction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Action<System.Threading.Tasks.Task<TAntecedentResult>> continuationAction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult, TResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
- public System.Threading.Tasks.Task FromAsync(System.Func<System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, object state) { throw null; }
- public System.Threading.Tasks.Task FromAsync(System.Func<System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, object state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task FromAsync(System.IAsyncResult asyncResult, System.Action<System.IAsyncResult> endMethod) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task FromAsync(System.IAsyncResult asyncResult, System.Action<System.IAsyncResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task FromAsync(System.IAsyncResult asyncResult, System.Action<System.IAsyncResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- public System.Threading.Tasks.Task FromAsync<TArg1>(System.Func<TArg1, System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, TArg1 arg1, object state) { throw null; }
- public System.Threading.Tasks.Task FromAsync<TArg1>(System.Func<TArg1, System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, TArg1 arg1, object state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
- public System.Threading.Tasks.Task<TResult> FromAsync<TResult>(System.Func<System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, object state) { throw null; }
- public System.Threading.Tasks.Task<TResult> FromAsync<TResult>(System.Func<System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, object state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> FromAsync<TResult>(System.IAsyncResult asyncResult, System.Func<System.IAsyncResult, TResult> endMethod) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> FromAsync<TResult>(System.IAsyncResult asyncResult, System.Func<System.IAsyncResult, TResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> FromAsync<TResult>(System.IAsyncResult asyncResult, System.Func<System.IAsyncResult, TResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- public System.Threading.Tasks.Task FromAsync<TArg1, TArg2>(System.Func<TArg1, TArg2, System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, object state) { throw null; }
- public System.Threading.Tasks.Task FromAsync<TArg1, TArg2>(System.Func<TArg1, TArg2, System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, object state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
- public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TResult>(System.Func<TArg1, System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, object state) { throw null; }
- public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TResult>(System.Func<TArg1, System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, object state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
- public System.Threading.Tasks.Task FromAsync<TArg1, TArg2, TArg3>(System.Func<TArg1, TArg2, TArg3, System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object state) { throw null; }
- public System.Threading.Tasks.Task FromAsync<TArg1, TArg2, TArg3>(System.Func<TArg1, TArg2, TArg3, System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Action<System.IAsyncResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
- public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2, TResult>(System.Func<TArg1, TArg2, System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, object state) { throw null; }
- public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2, TResult>(System.Func<TArg1, TArg2, System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, object state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
- public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2, TArg3, TResult>(System.Func<TArg1, TArg2, TArg3, System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object state) { throw null; }
- public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2, TArg3, TResult>(System.Func<TArg1, TArg2, TArg3, System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task StartNew(System.Action action) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task StartNew(System.Action action, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task StartNew(System.Action action, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task StartNew(System.Action action, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task StartNew(System.Action<object> action, object state) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task StartNew(System.Action<object> action, object state, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task StartNew(System.Action<object> action, object state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task StartNew(System.Action<object> action, object state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<TResult> function) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<TResult> function, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<TResult> function, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<TResult> function, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<object, TResult> function, object state) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<object, TResult> function, object state, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<object, TResult> function, object state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> StartNew<TResult>(System.Func<object, TResult> function, object state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
- }
- public partial class TaskFactory<TResult>
- {
- public TaskFactory() { }
- public TaskFactory(System.Threading.CancellationToken cancellationToken) { }
- public TaskFactory(System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { }
- public TaskFactory(System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { }
- public TaskFactory(System.Threading.Tasks.TaskScheduler scheduler) { }
- public System.Threading.CancellationToken CancellationToken { get { throw null; } }
- public System.Threading.Tasks.TaskContinuationOptions ContinuationOptions { get { throw null; } }
- public System.Threading.Tasks.TaskCreationOptions CreationOptions { get { throw null; } }
- public System.Threading.Tasks.TaskScheduler Scheduler { get { throw null; } }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAll(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task[], TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAll<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>[], TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAny(System.Threading.Tasks.Task[] tasks, System.Func<System.Threading.Tasks.Task, TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskContinuationOptions continuationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> ContinueWhenAny<TAntecedentResult>(System.Threading.Tasks.Task<TAntecedentResult>[] tasks, System.Func<System.Threading.Tasks.Task<TAntecedentResult>, TResult> continuationFunction, System.Threading.Tasks.TaskContinuationOptions continuationOptions) { throw null; }
- public System.Threading.Tasks.Task<TResult> FromAsync(System.Func<System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, object state) { throw null; }
- public System.Threading.Tasks.Task<TResult> FromAsync(System.Func<System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, object state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> FromAsync(System.IAsyncResult asyncResult, System.Func<System.IAsyncResult, TResult> endMethod) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> FromAsync(System.IAsyncResult asyncResult, System.Func<System.IAsyncResult, TResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> FromAsync(System.IAsyncResult asyncResult, System.Func<System.IAsyncResult, TResult> endMethod, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- public System.Threading.Tasks.Task<TResult> FromAsync<TArg1>(System.Func<TArg1, System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, object state) { throw null; }
- public System.Threading.Tasks.Task<TResult> FromAsync<TArg1>(System.Func<TArg1, System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, object state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
- public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2>(System.Func<TArg1, TArg2, System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, object state) { throw null; }
- public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2>(System.Func<TArg1, TArg2, System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, object state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
- public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2, TArg3>(System.Func<TArg1, TArg2, TArg3, System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object state) { throw null; }
- public System.Threading.Tasks.Task<TResult> FromAsync<TArg1, TArg2, TArg3>(System.Func<TArg1, TArg2, TArg3, System.AsyncCallback, object, System.IAsyncResult> beginMethod, System.Func<System.IAsyncResult, TResult> endMethod, TArg1 arg1, TArg2 arg2, TArg3 arg3, object state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> StartNew(System.Func<TResult> function) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> StartNew(System.Func<TResult> function, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> StartNew(System.Func<TResult> function, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> StartNew(System.Func<TResult> function, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> StartNew(System.Func<object, TResult> function, object state) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> StartNew(System.Func<object, TResult> function, object state, System.Threading.CancellationToken cancellationToken) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> StartNew(System.Func<object, TResult> function, object state, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.TaskCreationOptions creationOptions, System.Threading.Tasks.TaskScheduler scheduler) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]public System.Threading.Tasks.Task<TResult> StartNew(System.Func<object, TResult> function, object state, System.Threading.Tasks.TaskCreationOptions creationOptions) { throw null; }
- }
- [System.Diagnostics.DebuggerDisplayAttribute("Id={Id}")]
- public abstract partial class TaskScheduler
- {
- protected TaskScheduler() { }
- public static System.Threading.Tasks.TaskScheduler Current { get { throw null; } }
- public static System.Threading.Tasks.TaskScheduler Default { get { throw null; } }
- public int Id { get { throw null; } }
- public virtual int MaximumConcurrencyLevel { get { throw null; } }
- public static event System.EventHandler<System.Threading.Tasks.UnobservedTaskExceptionEventArgs> UnobservedTaskException { add { } remove { } }
- public static System.Threading.Tasks.TaskScheduler FromCurrentSynchronizationContext() { throw null; }
- [System.Security.SecurityCriticalAttribute]
- protected abstract System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task> GetScheduledTasks();
- [System.Security.SecurityCriticalAttribute]
- protected internal abstract void QueueTask(System.Threading.Tasks.Task task);
- [System.Security.SecurityCriticalAttribute]
- protected internal virtual bool TryDequeue(System.Threading.Tasks.Task task) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- protected bool TryExecuteTask(System.Threading.Tasks.Task task) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- protected abstract bool TryExecuteTaskInline(System.Threading.Tasks.Task task, bool taskWasPreviouslyQueued);
- }
- public partial class TaskSchedulerException : System.Exception
- {
- public TaskSchedulerException() { }
- public TaskSchedulerException(System.Exception innerException) { }
- public TaskSchedulerException(string message) { }
- public TaskSchedulerException(string message, System.Exception innerException) { }
- protected TaskSchedulerException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : base(info, context) { }
- }
- public enum TaskStatus
- {
- Canceled = 6,
- Created = 0,
- Faulted = 7,
- RanToCompletion = 5,
- Running = 3,
- WaitingForActivation = 1,
- WaitingForChildrenToComplete = 4,
- WaitingToRun = 2,
- }
- public partial class UnobservedTaskExceptionEventArgs : System.EventArgs
- {
- public UnobservedTaskExceptionEventArgs(System.AggregateException exception) { }
- public System.AggregateException Exception { get { throw null; } }
- public bool Observed { get { throw null; } }
- public void SetObserved() { }
- }
-}
diff --git a/src/mscorlib/ref/mscorlib.csproj b/src/mscorlib/ref/mscorlib.csproj
deleted file mode 100644
index 335630e37b..0000000000
--- a/src/mscorlib/ref/mscorlib.csproj
+++ /dev/null
@@ -1,93 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
-
- <!-- Include common build properties -->
- <Import Project="..\..\..\dir.props" />
-
- <!-- Compilation options -->
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">$(BuildType)</Configuration>
- <PlatformTarget>AnyCPU</PlatformTarget>
-
- <ProjectGuid>{B8ADD332-40B6-4916-B418-FBB79E5898B3}</ProjectGuid>
-
- <OutputType>Library</OutputType>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-
- <!-- This prevents the default MsBuild targets from referencing System.Core.dll -->
- <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
- <!-- These prevent the default MsBuild targets from referencing System.dll and mscorlib.dll -->
- <NoStdLib>true</NoStdLib>
- <NoCompilerStandardLib>true</NoCompilerStandardLib>
-
- <ErrorReport>prompt</ErrorReport>
- <Optimize Condition="'$(Optimize)' == ''">true</Optimize>
- <CLSCompliant>true</CLSCompliant>
- <WarningLevel>4</WarningLevel>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <WarningsNotAsErrors>$(WarningsNotAsErrors);618</WarningsNotAsErrors>
- <NoWarn>618,649,3019,414,169,3015,3021</NoWarn>
- <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
-
- <SignAssembly>true</SignAssembly>
- <DelaySign>true</DelaySign>
- </PropertyGroup>
-
- <!-- On Windows we support FEATURE_COMINTEROP and FEATURE_COREFX_GLOBALIZATION -->
- <PropertyGroup Condition="'$(TargetsUnix)'!='true'">
- <DefineConstants>$(DefineConstants);FEATURE_COREFX_GLOBALIZATION;FEATURE_COMINTEROP</DefineConstants>
- </PropertyGroup>
-
- <!-- Roslyn does not support writing PDBs on Unix -->
- <PropertyGroup Condition="'$(OsEnvironment)' == 'Unix'">
- <DebugSymbols>false</DebugSymbols>
- <DebugType>none</DebugType>
- </PropertyGroup>
-
- <!-- Assembly attributes -->
- <PropertyGroup>
- <AssemblyName>mscorlib</AssemblyName>
- <AssemblyVersion>4.0.0.0</AssemblyVersion>
- <MajorVersion>4</MajorVersion>
- <MinorVersion>6</MinorVersion>
- </PropertyGroup>
-
- <!-- Output paths -->
- <PropertyGroup>
- <BaseIntermediateOutputPath>$(RootBinDir)\obj</BaseIntermediateOutputPath>
- <IntermediateOutputPath>$(BaseIntermediateOutputPath)\$(BuildOS).$(BuildArch).$(Configuration)\ref</IntermediateOutputPath>
- <OutputPath>$(BinDir)\ref</OutputPath>
- </PropertyGroup>
-
- <PropertyGroup>
- <!-- We don't use any of MSBuild's resolution logic for resolving the framework, so just set these two properties to any folder that exists to skip
- the GenerateReferenceAssemblyPaths task (not target) and to prevent it from outputting a warning (MSB3644). -->
- <_TargetFrameworkDirectories>$(MSBuildThisFileDirectory)/Documentation</_TargetFrameworkDirectories>
- <_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory)/Documentation</_FullFrameworkReferenceAssemblyPaths>
- </PropertyGroup>
-
- <ItemGroup>
- <Compile Include="$(MSBuildThisFileDirectory)\mscorlib.cs" />
- <Compile Include="$(MSBuildThisFileDirectory)\mscorlib.manual.cs" />
- </ItemGroup>
-
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.Targets" />
-
- <PropertyGroup>
- <StrongNameSig>Silverlight</StrongNameSig>
- </PropertyGroup>
-
- <!-- Import signing tools -->
- <Import Condition="Exists('$(ToolsDir)\sign.targets')" Project="$(ToolsDir)\sign.targets" />
-
- <!-- Overwrite the key that we are going to use for signing -->
- <PropertyGroup>
- <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)..\Tools\Signing\mscorlib.snk</AssemblyOriginatorKeyFile>
- </PropertyGroup>
-
- <Import Project="$(MSBuildThisFileDirectory)..\Tools\Versioning\GenerateVersionInfo.targets"/>
- <!-- Override versioning targets -->
- <Import Condition="Exists('$(ToolsDir)versioning.targets')" Project="$(ToolsDir)versioning.targets" />
- <Import Project="..\GenerateCompilerResponseFile.targets"/>
-</Project>
diff --git a/src/mscorlib/ref/mscorlib.manual.cs b/src/mscorlib/ref/mscorlib.manual.cs
deleted file mode 100644
index d7c1f5e274..0000000000
--- a/src/mscorlib/ref/mscorlib.manual.cs
+++ /dev/null
@@ -1,785 +0,0 @@
-// 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.
-
-[assembly:System.Runtime.CompilerServices.InternalsVisibleTo("System.Runtime.WindowsRuntime, PublicKey=00000000000000000400000000000000")]
-
-namespace System
-{
- partial class Exception
- {
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- internal void AddExceptionDataForRestrictedErrorInfo(string restrictedError, string restrictedErrorReference, string restrictedCapabilitySid, object restrictedErrorObject, bool hasrestrictedLanguageErrorObject = false) { }
- }
-}
-
-namespace System.Diagnostics.Tracing
-{
- [System.Diagnostics.Tracing.EventSourceAttribute(Guid = "8E9F5090-2D75-4d03-8A81-E5AFBF85DAF1", Name = "System.Diagnostics.Eventing.FrameworkEventSource")]
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- internal sealed partial class FrameworkEventSource : System.Diagnostics.Tracing.EventSource
- {
- internal static readonly System.Diagnostics.Tracing.FrameworkEventSource Log;
- private FrameworkEventSource() { }
- internal static bool IsInitialized { get { throw null; } }
- [System.Diagnostics.Tracing.EventAttribute(31, Level = (System.Diagnostics.Tracing.EventLevel)(5), Keywords = (System.Diagnostics.Tracing.EventKeywords)(18))]
- internal void ThreadPoolDequeueWork(long workID) { }
- [System.Diagnostics.Tracing.NonEventAttribute]
- [System.Security.SecuritySafeCriticalAttribute]
- internal void ThreadPoolDequeueWorkObject(object workID) { }
- [System.Diagnostics.Tracing.EventAttribute(30, Level = (System.Diagnostics.Tracing.EventLevel)(5), Keywords = (System.Diagnostics.Tracing.EventKeywords)(18))]
- internal void ThreadPoolEnqueueWork(long workID) { }
- [System.Diagnostics.Tracing.NonEventAttribute]
- [System.Security.SecuritySafeCriticalAttribute]
- internal void ThreadPoolEnqueueWorkObject(object workID) { }
- [System.Diagnostics.Tracing.EventAttribute(151, Level = (System.Diagnostics.Tracing.EventLevel)(4), Keywords = (System.Diagnostics.Tracing.EventKeywords)(16), Task = (System.Diagnostics.Tracing.EventTask)(3), Opcode = (System.Diagnostics.Tracing.EventOpcode)(240))]
- internal void ThreadTransferReceive(long id, int kind, string info) { }
- [System.Diagnostics.Tracing.NonEventAttribute]
- [System.Security.SecuritySafeCriticalAttribute]
- internal void ThreadTransferReceiveObj(object id, int kind, string info) { }
- [System.Diagnostics.Tracing.EventAttribute(150, Level = (System.Diagnostics.Tracing.EventLevel)(4), Keywords = (System.Diagnostics.Tracing.EventKeywords)(16), Task = (System.Diagnostics.Tracing.EventTask)(3), Opcode = (System.Diagnostics.Tracing.EventOpcode)(9))]
- internal void ThreadTransferSend(long id, int kind, string info, bool multiDequeues) { }
- [System.Diagnostics.Tracing.NonEventAttribute]
- [System.Security.SecuritySafeCriticalAttribute]
- internal void ThreadTransferSendObj(object id, int kind, string info, bool multiDequeues) { }
- [System.Diagnostics.Tracing.NonEventAttribute]
- [System.Security.SecuritySafeCriticalAttribute]
- private void WriteEvent(int eventId, long arg1, int arg2, string arg3) { }
- [System.Diagnostics.Tracing.NonEventAttribute]
- [System.Security.SecuritySafeCriticalAttribute]
- private void WriteEvent(int eventId, long arg1, int arg2, string arg3, bool arg4) { }
- public static partial class Keywords
- {
- public const System.Diagnostics.Tracing.EventKeywords DynamicTypeUsage = (System.Diagnostics.Tracing.EventKeywords)8;
- public const System.Diagnostics.Tracing.EventKeywords Loader = (System.Diagnostics.Tracing.EventKeywords)1;
- public const System.Diagnostics.Tracing.EventKeywords NetClient = (System.Diagnostics.Tracing.EventKeywords)4;
- public const System.Diagnostics.Tracing.EventKeywords ThreadPool = (System.Diagnostics.Tracing.EventKeywords)2;
- public const System.Diagnostics.Tracing.EventKeywords ThreadTransfer = (System.Diagnostics.Tracing.EventKeywords)16;
- }
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- public static partial class Opcodes
- {
- public const System.Diagnostics.Tracing.EventOpcode ReceiveHandled = (System.Diagnostics.Tracing.EventOpcode)11;
- }
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- public static partial class Tasks
- {
- public const System.Diagnostics.Tracing.EventTask GetRequestStream = (System.Diagnostics.Tracing.EventTask) 2;
- public const System.Diagnostics.Tracing.EventTask GetResponse = (System.Diagnostics.Tracing.EventTask)1;
- public const System.Diagnostics.Tracing.EventTask ThreadTransfer = (System.Diagnostics.Tracing.EventTask)3;
- }
- }
-}
-
-namespace System.Globalization
-{
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- internal partial class CultureData
- {
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- internal static System.Globalization.CultureData GetCultureData(string cultureName, bool useUserOverride) { throw null; }
- }
-
- [System.FlagsAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- public enum CultureTypes
- {
- AllCultures = 7,
- [System.ObsoleteAttribute("This value has been deprecated. Please use other values in CultureTypes.")]
- FrameworkCultures = 64,
- InstalledWin32Cultures = 4,
- NeutralCultures = 1,
- ReplacementCultures = 16,
- SpecificCultures = 2,
- UserCustomCulture = 8,
- [System.ObsoleteAttribute("This value has been deprecated. Please use other values in CultureTypes.")]
- WindowsOnlyCultures = 32,
- }
-}
-
-namespace System.IO
-{
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- [System.Runtime.InteropServices.ComVisibleAttribute(true)]
- internal sealed partial class BufferedStream : System.IO.Stream
- {
- private byte[] _buffer;
- private readonly int _bufferSize;
- private const int _DefaultBufferSize = 4096;
- private System.Threading.Tasks.Task<int> _lastSyncCompletedReadTask;
- private int _readLen;
- private int _readPos;
- private System.IO.Stream _stream;
- private int _writePos;
- private const int MaxShadowBufferSize = 81920;
- private BufferedStream() { }
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- internal BufferedStream(System.IO.Stream stream, int bufferSize) { }
- internal int BufferSize { [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]get { throw null; } }
- public override bool CanRead { get { throw null; } }
- public override bool CanSeek { get { throw null; } }
- public override bool CanWrite { get { throw null; } }
- public override long Length { get { throw null; } }
- public override long Position { get { throw null; } set { } }
- internal System.IO.Stream UnderlyingStream { [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]get { throw null; } }
- public override System.IAsyncResult BeginRead(byte[] buffer, int offset, int count, System.AsyncCallback callback, object state) { throw null; }
- private System.IAsyncResult BeginReadFromUnderlyingStream(byte[] buffer, int offset, int count, System.AsyncCallback callback, object state, int bytesAlreadySatisfied, System.Threading.Tasks.Task semaphoreLockTask) { throw null; }
- public override System.IAsyncResult BeginWrite(byte[] buffer, int offset, int count, System.AsyncCallback callback, object state) { throw null; }
- private System.IAsyncResult BeginWriteToUnderlyingStream(byte[] buffer, int offset, int count, System.AsyncCallback callback, object state, System.Threading.Tasks.Task semaphoreLockTask) { throw null; }
- private void ClearReadBufferBeforeWrite() { }
- protected override void Dispose(bool disposing) { }
- public override int EndRead(System.IAsyncResult asyncResult) { throw null; }
- public override void EndWrite(System.IAsyncResult asyncResult) { }
- private void EnsureBeginEndAwaitableAllocated() { }
- private void EnsureBufferAllocated() { }
- private void EnsureCanRead() { }
- private void EnsureCanSeek() { }
- private void EnsureCanWrite() { }
- private void EnsureNotClosed() { }
- private void EnsureShadowBufferAllocated() { }
- public override void Flush() { }
- public override System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
- private static System.Threading.Tasks.Task FlushAsyncInternal(System.Threading.CancellationToken cancellationToken, System.IO.BufferedStream _this, System.IO.Stream stream, int writePos, int readPos, int readLen) { throw null; }
- private void FlushRead() { }
- private void FlushWrite() { }
- private System.Threading.Tasks.Task FlushWriteAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
- private System.Threading.Tasks.Task<int> LastSyncCompletedReadTask(int val) { throw null; }
- public override int Read(byte[] array, int offset, int count) { array = default(byte[]); throw null; }
- public override System.Threading.Tasks.Task<int> ReadAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
- public override int ReadByte() { throw null; }
- private int ReadFromBuffer(byte[] array, int offset, int count) { throw null; }
- private int ReadFromBuffer(byte[] array, int offset, int count, out System.Exception error) { error = default(System.Exception); throw null; }
- private System.Threading.Tasks.Task<int> ReadFromUnderlyingStreamAsync(byte[] array, int offset, int count, System.Threading.CancellationToken cancellationToken, int bytesAlreadySatisfied, System.Threading.Tasks.Task semaphoreLockTask, bool useApmPattern) { throw null; }
- public override long Seek(long offset, System.IO.SeekOrigin origin) { throw null; }
- public override void SetLength(long value) { }
- public override void Write(byte[] array, int offset, int count) { }
- public override System.Threading.Tasks.Task WriteAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
- public override void WriteByte(byte value) { }
- private void WriteToBuffer(byte[] array, ref int offset, ref int count) { }
- private void WriteToBuffer(byte[] array, ref int offset, ref int count, out System.Exception error) { error = default(System.Exception); }
- private System.Threading.Tasks.Task WriteToUnderlyingStreamAsync(byte[] array, int offset, int count, System.Threading.CancellationToken cancellationToken, System.Threading.Tasks.Task semaphoreLockTask, bool useApmPattern) { throw null; }
- }
-}
-
-namespace System.Resources
-{
- [System.Security.SecurityCriticalAttribute]
- internal partial class WindowsRuntimeResourceManagerBase
- {
- public WindowsRuntimeResourceManagerBase() { }
- public virtual System.Globalization.CultureInfo GlobalResourceContextBestFitCultureInfo { [System.Security.SecurityCriticalAttribute]get { throw null; } }
- [System.Security.SecurityCriticalAttribute]
- public virtual string GetString(string stringName, string startingCulture, string neutralResourcesCulture) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public virtual bool Initialize(string libpath, string reswFilename, out System.Resources.PRIExceptionInfo exceptionInfo) { exceptionInfo = default(System.Resources.PRIExceptionInfo); throw null; }
- [System.Security.SecurityCriticalAttribute]
- public virtual bool SetGlobalResourceContextDefaultCulture(System.Globalization.CultureInfo ci) { throw null; }
- }
-
- internal partial class PRIExceptionInfo
- {
- [System.CLSCompliantAttribute(false)]
- public string _PackageSimpleName;
- [System.CLSCompliantAttribute(false)]
- public string _ResWFile;
- public PRIExceptionInfo() { }
- }
-}
-
-namespace System.Runtime.CompilerServices
-{
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- internal static partial class JitHelpers
- {
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- [System.Security.SecurityCriticalAttribute]
- internal static T UnsafeCast<T>(object o) where T : class { throw null; }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(2044), AllowMultiple = false, Inherited = false)]
- internal sealed partial class FriendAccessAllowedAttribute : System.Attribute
- {
- public FriendAccessAllowedAttribute() { }
- }
- partial class ConditionalWeakTable<TKey, TValue>
- {
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- [System.Security.SecuritySafeCriticalAttribute]
- internal TKey FindEquivalentKeyUnsafe(TKey key, out TValue value) { value = default(TValue); throw null; }
- }
-}
-
-namespace System.Runtime.InteropServices.WindowsRuntime
-{
- [System.AttributeUsageAttribute((System.AttributeTargets)(5148), Inherited = false)]
- internal sealed partial class WindowsRuntimeImportAttribute : System.Attribute
- {
- internal WindowsRuntimeImportAttribute() { }
- }
-
- [System.Runtime.InteropServices.GuidAttribute("82BA7092-4C88-427D-A7BC-16DD93FEB67E")]
- [System.Runtime.InteropServices.InterfaceTypeAttribute((System.Runtime.InteropServices.ComInterfaceType)(1))]
- internal partial interface IRestrictedErrorInfo
- {
- void GetErrorDetails(out string description, out int error, out string restrictedDescription, out string capabilitySid);
- void GetReference(out string reference);
- }
-
-#if FEATURE_COMINTEROP
- [System.AttributeUsageAttribute((System.AttributeTargets)(1028), AllowMultiple=false, Inherited=false)]
- public sealed partial class DefaultInterfaceAttribute : System.Attribute
- {
- public DefaultInterfaceAttribute(System.Type defaultInterface) { }
- public System.Type DefaultInterface { get { throw null; } }
- }
- [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
- public partial struct EventRegistrationToken
- {
- public override bool Equals(object obj) { throw null; }
- public override int GetHashCode() { throw null; }
- public static bool operator ==(System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken left, System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken right) { throw null; }
- public static bool operator !=(System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken left, System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken right) { throw null; }
- }
- public sealed partial class EventRegistrationTokenTable<T> where T : class
- {
- public EventRegistrationTokenTable() { }
- public T InvocationList { get { throw null; } set { } }
- public System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken AddEventHandler(T handler) { throw null; }
- public static System.Runtime.InteropServices.WindowsRuntime.EventRegistrationTokenTable<T> GetOrCreateEventRegistrationTokenTable(ref System.Runtime.InteropServices.WindowsRuntime.EventRegistrationTokenTable<T> refEventTable) { throw null; }
- public void RemoveEventHandler(T handler) { }
- public void RemoveEventHandler(System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken token) { }
-
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- internal T ExtractHandler(System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken token) { throw null; }
- }
- [System.Runtime.InteropServices.GuidAttribute("00000035-0000-0000-C000-000000000046")]
- public partial interface IActivationFactory
- {
- object ActivateInstance();
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(1028), Inherited=false, AllowMultiple=true)]
- public sealed partial class InterfaceImplementedInVersionAttribute : System.Attribute
- {
- public InterfaceImplementedInVersionAttribute(System.Type interfaceType, byte majorVersion, byte minorVersion, byte buildVersion, byte revisionVersion) { }
- public byte BuildVersion { get { throw null; } }
- public System.Type InterfaceType { get { throw null; } }
- public byte MajorVersion { get { throw null; } }
- public byte MinorVersion { get { throw null; } }
- public byte RevisionVersion { get { throw null; } }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(2048), Inherited=false, AllowMultiple=false)]
- public sealed partial class ReadOnlyArrayAttribute : System.Attribute
- {
- public ReadOnlyArrayAttribute() { }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(12288), AllowMultiple=false, Inherited=false)]
- public sealed partial class ReturnValueNameAttribute : System.Attribute
- {
- public ReturnValueNameAttribute(string name) { }
- public string Name { get { throw null; } }
- }
- public static partial class WindowsRuntimeMarshal
- {
- [System.Security.SecurityCriticalAttribute]
- public static void AddEventHandler<T>(System.Func<T, System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken> addMethod, System.Action<System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken> removeMethod, T handler) { }
- [System.Security.SecurityCriticalAttribute]
- public static void FreeHString(System.IntPtr ptr) { }
- [System.Security.SecurityCriticalAttribute]
- public static System.Runtime.InteropServices.WindowsRuntime.IActivationFactory GetActivationFactory(System.Type type) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static string PtrToStringHString(System.IntPtr ptr) { throw null; }
- [System.Security.SecurityCriticalAttribute]
- public static void RemoveAllEventHandlers(System.Action<System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken> removeMethod) { }
- [System.Security.SecurityCriticalAttribute]
- public static void RemoveEventHandler<T>(System.Action<System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken> removeMethod, T handler) { }
- [System.Security.SecurityCriticalAttribute]
- public static System.IntPtr StringToHString(string s) { throw null; }
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- [System.Security.SecuritySafeCriticalAttribute]
- internal static bool ReportUnhandledError(System.Exception e) { throw null; }
- }
- [System.AttributeUsageAttribute((System.AttributeTargets)(2048), Inherited=false, AllowMultiple=false)]
- public sealed partial class WriteOnlyArrayAttribute : System.Attribute
- {
- public WriteOnlyArrayAttribute() { }
- }
-#endif //FEATURE_COMINTEROP
-}
-
-namespace System.StubHelpers
-{
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- internal static partial class EventArgsMarshaler
- {
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- [System.Security.SecurityCriticalAttribute]
- internal static System.IntPtr CreateNativeNCCEventArgsInstance(int action, object newItems, object oldItems, int newIndex, int oldIndex) { throw null; }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.PreserveSig)]
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- [System.Security.SecurityCriticalAttribute]
- internal static System.IntPtr CreateNativePCEventArgsInstance(string name) { throw null; }
- }
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- internal static partial class InterfaceMarshaler
- {
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- internal static object ConvertToManagedWithoutUnboxing(System.IntPtr pNative) { throw null; }
- }
-}
-
-namespace System.Threading
-{
- internal enum StackCrawlMark
- {
- LookForMe = 0,
- LookForMyCaller = 1,
- LookForMyCallersCaller = 2,
- LookForThread = 3,
- }
- [System.Security.SecurityCriticalAttribute]
- internal partial class WinRTSynchronizationContextFactoryBase
- {
- public WinRTSynchronizationContextFactoryBase() { }
- [System.Security.SecurityCriticalAttribute]
- public virtual System.Threading.SynchronizationContext Create(object coreDispatcher) { throw null; }
- }
- partial struct CancellationTokenRegistration
- {
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- internal bool TryDeregister() { throw null; }
- }
- partial class ExecutionContext
- {
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- [System.Security.SecurityCriticalAttribute]
- internal static void Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) { }
- internal static System.Threading.ExecutionContext FastCapture() { return default(System.Threading.ExecutionContext); }
- }
-}
-
-namespace System.Threading.Tasks
-{
-#if FEATURE_COMINTEROP
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- internal enum AsyncCausalityStatus
- {
- Canceled = 2,
- Completed = 1,
- Error = 3,
- Started = 0,
- }
- internal enum CausalityRelation
- {
- AssignDelegate = 0,
- Cancel = 3,
- Choice = 2,
- Error = 4,
- Join = 1,
- }
- internal enum CausalitySynchronousWork
- {
- CompletionNotification = 0,
- Execution = 2,
- ProgressNotification = 1,
- }
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- internal static partial class AsyncCausalityTracer
- {
- private static System.Threading.Tasks.AsyncCausalityTracer.Loggers f_LoggingOn;
- //private const Windows.Foundation.Diagnostics.CausalitySource s_CausalitySource = 1;
- private static readonly System.Guid s_PlatformId;
- private static Windows.Foundation.Diagnostics.IAsyncCausalityTracerStatics s_TracerFactory;
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- internal static bool LoggingOn { [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]get { throw null; } }
- internal static void EnableToETW(bool enabled) { }
- private static ulong GetOperationId(uint taskId) { throw null; }
- private static void LogAndDisable(System.Exception ex) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- internal static void TraceOperationCompletion(System.Threading.Tasks.CausalityTraceLevel traceLevel, int taskId, System.Threading.Tasks.AsyncCausalityStatus status) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- internal static void TraceOperationCreation(System.Threading.Tasks.CausalityTraceLevel traceLevel, int taskId, string operationName, ulong relatedContext) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- internal static void TraceOperationRelation(System.Threading.Tasks.CausalityTraceLevel traceLevel, int taskId, System.Threading.Tasks.CausalityRelation relation) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- internal static void TraceSynchronousWorkCompletion(System.Threading.Tasks.CausalityTraceLevel traceLevel, System.Threading.Tasks.CausalitySynchronousWork work) { }
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
- internal static void TraceSynchronousWorkStart(System.Threading.Tasks.CausalityTraceLevel traceLevel, int taskId, System.Threading.Tasks.CausalitySynchronousWork work) { }
- [System.Security.SecuritySafeCriticalAttribute]
- private static void TracingStatusChangedHandler(object sender, Windows.Foundation.Diagnostics.TracingStatusChangedEventArgs args) { }
- [System.FlagsAttribute]
- private enum Loggers : byte
- {
- CausalityTracer = (byte)1,
- ETW = (byte)2,
- }
- }
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- internal enum CausalityTraceLevel
- {
- Important = 1,
- Required = 0,
- Verbose = 2,
- }
-#endif
-
- partial class Task
- {
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- internal static bool s_asyncDebuggingEnabled;
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- internal static bool AddToActiveTasks(System.Threading.Tasks.Task task) { throw null; }
- [System.Runtime.CompilerServices.FriendAccessAllowedAttribute]
- internal static void RemoveFromActiveTasks(int taskId) { }
- }
-}
-
-namespace System.Security.Cryptography
-{
- public abstract class HashAlgorithm : System.IDisposable, System.Security.Cryptography.ICryptoTransform
- {
- protected internal byte[] HashValue;
- protected int HashSizeValue;
- protected int State;
- protected HashAlgorithm() { }
- public virtual bool CanReuseTransform { get { throw null; } }
- public virtual bool CanTransformMultipleBlocks { get { throw null; } }
- public virtual byte[] Hash { get { throw null; } }
- public virtual int HashSize { get { throw null; } }
- public virtual int InputBlockSize { get { throw null; } }
- public virtual int OutputBlockSize { get { throw null; } }
- public void Clear() { }
- public byte[] ComputeHash(byte[] buffer) { throw null; }
- public byte[] ComputeHash(byte[] buffer, int offset, int count) { throw null; }
- public byte[] ComputeHash(System.IO.Stream inputStream) { throw null; }
- public static HashAlgorithm Create() { throw null; }
- public static HashAlgorithm Create(string hashName) { throw null; }
- public void Dispose() { }
- protected virtual void Dispose(bool disposing) { }
- protected abstract void HashCore(byte[] array, int ibStart, int cbSize);
- protected abstract byte[] HashFinal();
- public abstract void Initialize();
- public int TransformBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset) { throw null; }
- public byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount) { throw null; }
- }
-
- public abstract class SymmetricAlgorithm : System.IDisposable
- {
- protected byte[] IVValue;
- protected byte[] KeyValue;
- protected int BlockSizeValue;
- protected int FeedbackSizeValue;
- protected int KeySizeValue;
- protected CipherMode ModeValue;
- protected KeySizes[] LegalBlockSizesValue;
- protected KeySizes[] LegalKeySizesValue;
- protected PaddingMode PaddingValue;
- protected SymmetricAlgorithm() { }
- public virtual int BlockSize { get; set; }
- public virtual int FeedbackSize { get; set; }
- public virtual byte[] IV { get; set; }
- public virtual byte[] Key { get; set; }
- public virtual int KeySize { get; set; }
- public virtual KeySizes[] LegalBlockSizes { get; }
- public virtual KeySizes[] LegalKeySizes { get; }
- public virtual CipherMode Mode { get; set; }
- public virtual PaddingMode Padding { get; set; }
- public void Clear() { }
- public static SymmetricAlgorithm Create() { throw null; }
- public static SymmetricAlgorithm Create(string algName) { throw null; }
- public virtual ICryptoTransform CreateDecryptor() { throw null; }
- public abstract ICryptoTransform CreateDecryptor(byte[] rgbKey, byte[] rgbIV);
- public virtual ICryptoTransform CreateEncryptor() { throw null; }
- public abstract ICryptoTransform CreateEncryptor(byte[] rgbKey, byte[] rgbIV);
- public void Dispose() { }
- protected virtual void Dispose(bool disposing) { }
- public abstract void GenerateIV();
- public abstract void GenerateKey();
- public bool ValidKeySize(int bitLength) { throw null; }
- }
-
- public interface ICryptoTransform : System.IDisposable
- {
- int InputBlockSize { get; }
- int OutputBlockSize { get; }
- bool CanTransformMultipleBlocks { get; }
- bool CanReuseTransform { get; }
- int TransformBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset);
- byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount);
- }
-
- public sealed class KeySizes
- {
- public KeySizes(int minSize, int maxSize, int skipSize) { }
- public int MaxSize { get; }
- public int MinSize { get; }
- public int SkipSize { get; }
- }
-
- public enum PaddingMode
- {
- ANSIX923 = 4,
- ISO10126 = 5,
- None = 1,
- PKCS7 = 2,
- Zeros = 3,
- }
-
- public enum CipherMode
- {
- CBC = 1,
- CFB = 4,
- CTS = 5,
- ECB = 2,
- OFB = 3,
- }
-}
-
-#if FEATURE_COMINTEROP
-namespace Windows.Foundation.Diagnostics
-{
- internal enum AsyncCausalityStatus
- {
- Canceled = 2,
- Completed = 1,
- Error = 3,
- Started = 0,
- }
- internal enum CausalityRelation
- {
- AssignDelegate = 0,
- Cancel = 3,
- Choice = 2,
- Error = 4,
- Join = 1,
- }
- internal enum CausalitySource
- {
- Application = 0,
- Library = 1,
- System = 2,
- }
- internal enum CausalitySynchronousWork
- {
- CompletionNotification = 0,
- Execution = 2,
- ProgressNotification = 1,
- }
- internal enum CausalityTraceLevel
- {
- Important = 1,
- Required = 0,
- Verbose = 2,
- }
- [System.Runtime.InteropServices.GuidAttribute("50850B26-267E-451B-A890-AB6A370245EE")]
- internal partial interface IAsyncCausalityTracerStatics
- {
- System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken add_TracingStatusChanged(System.EventHandler<Windows.Foundation.Diagnostics.TracingStatusChangedEventArgs> eventHandler);
- void TraceOperationCompletion(Windows.Foundation.Diagnostics.CausalityTraceLevel traceLevel, Windows.Foundation.Diagnostics.CausalitySource source, System.Guid platformId, ulong operationId, Windows.Foundation.Diagnostics.AsyncCausalityStatus status);
- void TraceOperationCreation(Windows.Foundation.Diagnostics.CausalityTraceLevel traceLevel, Windows.Foundation.Diagnostics.CausalitySource source, System.Guid platformId, ulong operationId, string operationName, ulong relatedContext);
- void TraceOperationRelation(Windows.Foundation.Diagnostics.CausalityTraceLevel traceLevel, Windows.Foundation.Diagnostics.CausalitySource source, System.Guid platformId, ulong operationId, Windows.Foundation.Diagnostics.CausalityRelation relation);
- void TraceSynchronousWorkCompletion(Windows.Foundation.Diagnostics.CausalityTraceLevel traceLevel, Windows.Foundation.Diagnostics.CausalitySource source, Windows.Foundation.Diagnostics.CausalitySynchronousWork work);
- void TraceSynchronousWorkStart(Windows.Foundation.Diagnostics.CausalityTraceLevel traceLevel, Windows.Foundation.Diagnostics.CausalitySource source, System.Guid platformId, ulong operationId, Windows.Foundation.Diagnostics.CausalitySynchronousWork work);
- }
- [System.Runtime.InteropServices.GuidAttribute("410B7711-FF3B-477F-9C9A-D2EFDA302DC3")]
- internal partial interface ITracingStatusChangedEventArgs
- {
- bool Enabled { get; }
- Windows.Foundation.Diagnostics.CausalityTraceLevel TraceLevel { get; }
- }
- [System.Runtime.InteropServices.GuidAttribute("410B7711-FF3B-477F-9C9A-D2EFDA302DC3")]
- internal sealed partial class TracingStatusChangedEventArgs : Windows.Foundation.Diagnostics.ITracingStatusChangedEventArgs
- {
- [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]
- public TracingStatusChangedEventArgs() { }
- public bool Enabled { [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]get { throw null; } }
- public Windows.Foundation.Diagnostics.CausalityTraceLevel TraceLevel { [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)]get { throw null; } }
- }
-}
-#endif
-
-namespace System.Security.Claims
-{
- public partial class Claim
- {
- public Claim(System.IO.BinaryReader reader) { }
- public Claim(System.IO.BinaryReader reader, System.Security.Claims.ClaimsIdentity subject) { }
- protected Claim(System.Security.Claims.Claim other) { }
- protected Claim(System.Security.Claims.Claim other, System.Security.Claims.ClaimsIdentity subject) { }
- public Claim(string type, string value) { }
- public Claim(string type, string value, string valueType) { }
- public Claim(string type, string value, string valueType, string issuer) { }
- public Claim(string type, string value, string valueType, string issuer, string originalIssuer) { }
- public Claim(string type, string value, string valueType, string issuer, string originalIssuer, System.Security.Claims.ClaimsIdentity subject) { }
- protected virtual byte[] CustomSerializationData { get { throw null; } }
- public string Issuer { get { throw null; } }
- public string OriginalIssuer { get { throw null; } }
- public System.Collections.Generic.IDictionary<string, string> Properties { get { throw null; } }
- public System.Security.Claims.ClaimsIdentity Subject { get { throw null; } }
- public string Type { get { throw null; } }
- public string Value { get { throw null; } }
- public string ValueType { get { throw null; } }
- public virtual System.Security.Claims.Claim Clone() { throw null; }
- public virtual System.Security.Claims.Claim Clone(System.Security.Claims.ClaimsIdentity identity) { throw null; }
- public override string ToString() { throw null; }
- public virtual void WriteTo(System.IO.BinaryWriter writer) { }
- protected virtual void WriteTo(System.IO.BinaryWriter writer, byte[] userData) { }
- }
- public partial class ClaimsIdentity : System.Security.Principal.IIdentity
- {
- public const string DefaultIssuer = "LOCAL AUTHORITY";
- public const string DefaultNameClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name";
- public const string DefaultRoleClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role";
- public ClaimsIdentity() { }
- public ClaimsIdentity(System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> claims) { }
- public ClaimsIdentity(System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> claims, string authenticationType) { }
- public ClaimsIdentity(System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> claims, string authenticationType, string nameType, string roleType) { }
- public ClaimsIdentity(System.IO.BinaryReader reader) { }
- protected ClaimsIdentity(System.Security.Claims.ClaimsIdentity other) { }
- public ClaimsIdentity(System.Security.Principal.IIdentity identity) { }
- public ClaimsIdentity(System.Security.Principal.IIdentity identity, System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> claims) { }
- public ClaimsIdentity(System.Security.Principal.IIdentity identity, System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> claims, string authenticationType, string nameType, string roleType) { }
- public ClaimsIdentity(string authenticationType) { }
- public ClaimsIdentity(string authenticationType, string nameType, string roleType) { }
- public System.Security.Claims.ClaimsIdentity Actor { get { throw null; } set { } }
- public virtual string AuthenticationType { get { throw null; } }
- public object BootstrapContext { get { throw null; } set { } }
- public virtual System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> Claims { get { throw null; } }
- protected virtual byte[] CustomSerializationData { get { throw null; } }
- public virtual bool IsAuthenticated { get { throw null; } }
- public string Label { get { throw null; } set { } }
- public virtual string Name { get { throw null; } }
- public string NameClaimType { get { throw null; } }
- public string RoleClaimType { get { throw null; } }
- public virtual void AddClaim(System.Security.Claims.Claim claim) { }
- public virtual void AddClaims(System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> claims) { }
- public virtual System.Security.Claims.ClaimsIdentity Clone() { throw null; }
- protected virtual System.Security.Claims.Claim CreateClaim(System.IO.BinaryReader reader) { throw null; }
- public virtual System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> FindAll(System.Predicate<System.Security.Claims.Claim> match) { throw null; }
- public virtual System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> FindAll(string type) { throw null; }
- public virtual System.Security.Claims.Claim FindFirst(System.Predicate<System.Security.Claims.Claim> match) { throw null; }
- public virtual System.Security.Claims.Claim FindFirst(string type) { throw null; }
- public virtual bool HasClaim(System.Predicate<System.Security.Claims.Claim> match) { throw null; }
- public virtual bool HasClaim(string type, string value) { throw null; }
- public virtual void RemoveClaim(System.Security.Claims.Claim claim) { }
- public virtual bool TryRemoveClaim(System.Security.Claims.Claim claim) { throw null; }
- public virtual void WriteTo(System.IO.BinaryWriter writer) { }
- protected virtual void WriteTo(System.IO.BinaryWriter writer, byte[] userData) { }
- }
- public partial class ClaimsPrincipal : System.Security.Principal.IPrincipal
- {
- public ClaimsPrincipal() { }
- public ClaimsPrincipal(System.Collections.Generic.IEnumerable<System.Security.Claims.ClaimsIdentity> identities) { }
- public ClaimsPrincipal(System.IO.BinaryReader reader) { }
- public ClaimsPrincipal(System.Security.Principal.IIdentity identity) { }
- public ClaimsPrincipal(System.Security.Principal.IPrincipal principal) { }
- public virtual System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> Claims { get { throw null; } }
- public static System.Func<System.Security.Claims.ClaimsPrincipal> ClaimsPrincipalSelector { get { throw null; } set { } }
- public static System.Security.Claims.ClaimsPrincipal Current { get { throw null; } }
- protected virtual byte[] CustomSerializationData { get { throw null; } }
- public virtual System.Collections.Generic.IEnumerable<System.Security.Claims.ClaimsIdentity> Identities { get { throw null; } }
- public virtual System.Security.Principal.IIdentity Identity { get { throw null; } }
- public static System.Func<System.Collections.Generic.IEnumerable<System.Security.Claims.ClaimsIdentity>, System.Security.Claims.ClaimsIdentity> PrimaryIdentitySelector { get { throw null; } set { } }
- public virtual void AddIdentities(System.Collections.Generic.IEnumerable<System.Security.Claims.ClaimsIdentity> identities) { }
- public virtual void AddIdentity(System.Security.Claims.ClaimsIdentity identity) { }
- public virtual System.Security.Claims.ClaimsPrincipal Clone() { throw null; }
- protected virtual System.Security.Claims.ClaimsIdentity CreateClaimsIdentity(System.IO.BinaryReader reader) { throw null; }
- public virtual System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> FindAll(System.Predicate<System.Security.Claims.Claim> match) { throw null; }
- public virtual System.Collections.Generic.IEnumerable<System.Security.Claims.Claim> FindAll(string type) { throw null; }
- public virtual System.Security.Claims.Claim FindFirst(System.Predicate<System.Security.Claims.Claim> match) { throw null; }
- public virtual System.Security.Claims.Claim FindFirst(string type) { throw null; }
- public virtual bool HasClaim(System.Predicate<System.Security.Claims.Claim> match) { throw null; }
- public virtual bool HasClaim(string type, string value) { throw null; }
- public virtual bool IsInRole(string role) { throw null; }
- public virtual void WriteTo(System.IO.BinaryWriter writer) { }
- protected virtual void WriteTo(System.IO.BinaryWriter writer, byte[] userData) { }
- }
- public static partial class ClaimTypes
- {
- public const string Actor = "http://schemas.xmlsoap.org/ws/2009/09/identity/claims/actor";
- public const string Anonymous = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/anonymous";
- public const string Authentication = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/authentication";
- public const string AuthenticationInstant = "http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationinstant";
- public const string AuthenticationMethod = "http://schemas.microsoft.com/ws/2008/06/identity/claims/authenticationmethod";
- public const string AuthorizationDecision = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/authorizationdecision";
- public const string CookiePath = "http://schemas.microsoft.com/ws/2008/06/identity/claims/cookiepath";
- public const string Country = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/country";
- public const string DateOfBirth = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/dateofbirth";
- public const string DenyOnlyPrimaryGroupSid = "http://schemas.microsoft.com/ws/2008/06/identity/claims/denyonlyprimarygroupsid";
- public const string DenyOnlyPrimarySid = "http://schemas.microsoft.com/ws/2008/06/identity/claims/denyonlyprimarysid";
- public const string DenyOnlySid = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/denyonlysid";
- public const string DenyOnlyWindowsDeviceGroup = "http://schemas.microsoft.com/ws/2008/06/identity/claims/denyonlywindowsdevicegroup";
- public const string Dns = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/dns";
- public const string Dsa = "http://schemas.microsoft.com/ws/2008/06/identity/claims/dsa";
- public const string Email = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress";
- public const string Expiration = "http://schemas.microsoft.com/ws/2008/06/identity/claims/expiration";
- public const string Expired = "http://schemas.microsoft.com/ws/2008/06/identity/claims/expired";
- public const string Gender = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/gender";
- public const string GivenName = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname";
- public const string GroupSid = "http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid";
- public const string Hash = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/hash";
- public const string HomePhone = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/homephone";
- public const string IsPersistent = "http://schemas.microsoft.com/ws/2008/06/identity/claims/ispersistent";
- public const string Locality = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/locality";
- public const string MobilePhone = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/mobilephone";
- public const string Name = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name";
- public const string NameIdentifier = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier";
- public const string OtherPhone = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/otherphone";
- public const string PostalCode = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/postalcode";
- public const string PrimaryGroupSid = "http://schemas.microsoft.com/ws/2008/06/identity/claims/primarygroupsid";
- public const string PrimarySid = "http://schemas.microsoft.com/ws/2008/06/identity/claims/primarysid";
- public const string Role = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role";
- public const string Rsa = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/rsa";
- public const string SerialNumber = "http://schemas.microsoft.com/ws/2008/06/identity/claims/serialnumber";
- public const string Sid = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/sid";
- public const string Spn = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/spn";
- public const string StateOrProvince = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/stateorprovince";
- public const string StreetAddress = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/streetaddress";
- public const string Surname = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname";
- public const string System = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/system";
- public const string Thumbprint = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/thumbprint";
- public const string Upn = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn";
- public const string Uri = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/uri";
- public const string UserData = "http://schemas.microsoft.com/ws/2008/06/identity/claims/userdata";
- public const string Version = "http://schemas.microsoft.com/ws/2008/06/identity/claims/version";
- public const string Webpage = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/webpage";
- public const string WindowsAccountName = "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname";
- public const string WindowsDeviceClaim = "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsdeviceclaim";
- public const string WindowsDeviceGroup = "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsdevicegroup";
- public const string WindowsFqbnVersion = "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsfqbnversion";
- public const string WindowsSubAuthority = "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowssubauthority";
- public const string WindowsUserClaim = "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsuserclaim";
- public const string X500DistinguishedName = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/x500distinguishedname";
- }
- public static partial class ClaimValueTypes
- {
- public const string Base64Binary = "http://www.w3.org/2001/XMLSchema#base64Binary";
- public const string Base64Octet = "http://www.w3.org/2001/XMLSchema#base64Octet";
- public const string Boolean = "http://www.w3.org/2001/XMLSchema#boolean";
- public const string Date = "http://www.w3.org/2001/XMLSchema#date";
- public const string DateTime = "http://www.w3.org/2001/XMLSchema#dateTime";
- public const string DaytimeDuration = "http://www.w3.org/TR/2002/WD-xquery-operators-20020816#dayTimeDuration";
- public const string DnsName = "http://schemas.xmlsoap.org/claims/dns";
- public const string Double = "http://www.w3.org/2001/XMLSchema#double";
- public const string DsaKeyValue = "http://www.w3.org/2000/09/xmldsig#DSAKeyValue";
- public const string Email = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress";
- public const string Fqbn = "http://www.w3.org/2001/XMLSchema#fqbn";
- public const string HexBinary = "http://www.w3.org/2001/XMLSchema#hexBinary";
- public const string Integer = "http://www.w3.org/2001/XMLSchema#integer";
- public const string Integer32 = "http://www.w3.org/2001/XMLSchema#integer32";
- public const string Integer64 = "http://www.w3.org/2001/XMLSchema#integer64";
- public const string KeyInfo = "http://www.w3.org/2000/09/xmldsig#KeyInfo";
- public const string Rfc822Name = "urn:oasis:names:tc:xacml:1.0:data-type:rfc822Name";
- public const string Rsa = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/rsa";
- public const string RsaKeyValue = "http://www.w3.org/2000/09/xmldsig#RSAKeyValue";
- public const string Sid = "http://www.w3.org/2001/XMLSchema#sid";
- public const string String = "http://www.w3.org/2001/XMLSchema#string";
- public const string Time = "http://www.w3.org/2001/XMLSchema#time";
- public const string UInteger32 = "http://www.w3.org/2001/XMLSchema#uinteger32";
- public const string UInteger64 = "http://www.w3.org/2001/XMLSchema#uinteger64";
- public const string UpnName = "http://schemas.xmlsoap.org/claims/UPN";
- public const string X500Name = "urn:oasis:names:tc:xacml:1.0:data-type:x500Name";
- public const string YearMonthDuration = "http://www.w3.org/TR/2002/WD-xquery-operators-20020816#yearMonthDuration";
- }
-} \ No newline at end of file
diff --git a/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Calendar.cs b/src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.Calendar.cs
index 7b3caeabdd..7b3caeabdd 100644
--- a/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Calendar.cs
+++ b/src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.Calendar.cs
diff --git a/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Casing.cs b/src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.Casing.cs
index 769506b8f6..769506b8f6 100644
--- a/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Casing.cs
+++ b/src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.Casing.cs
diff --git a/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Idna.cs b/src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.Idna.cs
index 43c72281ae..43c72281ae 100644
--- a/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Idna.cs
+++ b/src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.Idna.cs
diff --git a/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Locale.cs b/src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.Locale.cs
index fcea708ee8..fcea708ee8 100644
--- a/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Locale.cs
+++ b/src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.Locale.cs
diff --git a/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Normalization.cs b/src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.Normalization.cs
index c4cb9fb851..c4cb9fb851 100644
--- a/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Normalization.cs
+++ b/src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.Normalization.cs
diff --git a/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.ResultCode.cs b/src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.ResultCode.cs
index cca6ae4dcb..cca6ae4dcb 100644
--- a/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.ResultCode.cs
+++ b/src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.ResultCode.cs
diff --git a/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.TimeZoneInfo.cs b/src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.TimeZoneInfo.cs
index 26a9fe0579..26a9fe0579 100644
--- a/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.TimeZoneInfo.cs
+++ b/src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.TimeZoneInfo.cs
diff --git a/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Utils.cs b/src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.Utils.cs
index 33b10c0d74..33b10c0d74 100644
--- a/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Utils.cs
+++ b/src/mscorlib/shared/Interop/Unix/System.Globalization.Native/Interop.Utils.cs
diff --git a/src/mscorlib/src/Interop/Windows/Crypt32/Interop.CryptProtectMemory.cs b/src/mscorlib/shared/Interop/Windows/Crypt32/Interop.CryptProtectMemory.cs
index b10cb6a041..b10cb6a041 100644
--- a/src/mscorlib/src/Interop/Windows/Crypt32/Interop.CryptProtectMemory.cs
+++ b/src/mscorlib/shared/Interop/Windows/Crypt32/Interop.CryptProtectMemory.cs
diff --git a/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs b/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs
new file mode 100644
index 0000000000..0909d3a6c8
--- /dev/null
+++ b/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs
@@ -0,0 +1,31 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using Microsoft.Win32.SafeHandles;
+using System;
+using System.Runtime.InteropServices;
+
+internal partial class Interop
+{
+ internal partial class Kernel32
+ {
+ [DllImport(Libraries.Kernel32, EntryPoint = "CreateFile2", SetLastError = true, CharSet = CharSet.Unicode, BestFitMapping = false)]
+ internal static extern unsafe SafeFileHandle CreateFile2(
+ string lpFileName,
+ int dwDesiredAccess,
+ System.IO.FileShare dwShareMode,
+ System.IO.FileMode dwCreationDisposition,
+ CREATEFILE2_EXTENDED_PARAMETERS* pCreateExParams);
+
+ internal unsafe struct CREATEFILE2_EXTENDED_PARAMETERS
+ {
+ internal uint dwSize;
+ internal uint dwFileAttributes;
+ internal uint dwFileFlags;
+ internal uint dwSecurityQosFlags;
+ internal SECURITY_ATTRIBUTES* lpSecurityAttributes;
+ internal IntPtr hTemplateFile;
+ }
+ }
+} \ No newline at end of file
diff --git a/src/mscorlib/src/Interop/Windows/kernel32/Interop.WideCharToMultiByte.cs b/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.WideCharToMultiByte.cs
index a06c9153f4..a06c9153f4 100644
--- a/src/mscorlib/src/Interop/Windows/kernel32/Interop.WideCharToMultiByte.cs
+++ b/src/mscorlib/shared/Interop/Windows/Kernel32/Interop.WideCharToMultiByte.cs
diff --git a/src/mscorlib/shared/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs b/src/mscorlib/shared/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs
index 4eabe8f08c..a1abdd0ef1 100644
--- a/src/mscorlib/shared/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs
+++ b/src/mscorlib/shared/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs
@@ -10,6 +10,9 @@ using Microsoft.Win32;
namespace Microsoft.Win32.SafeHandles
{
+#if PROJECTN
+ [Internal.Runtime.CompilerServices.RelocatedTypeAttribute("System.IO.FileSystem")]
+#endif
public sealed class SafeFileHandle : SafeHandleZeroOrMinusOneIsInvalid
{
private bool? _isAsync;
diff --git a/src/mscorlib/shared/README.md b/src/mscorlib/shared/README.md
new file mode 100644
index 0000000000..d55f32576d
--- /dev/null
+++ b/src/mscorlib/shared/README.md
@@ -0,0 +1,19 @@
+# System.Private.CoreLib Shared Sources
+
+This directory contains the shared sources for System.Private.CoreLib. These are shared between [dotnet/corert](https://github.com/dotnet/corert/tree/master/src/System.Private.CoreLib/shared) and [dotnet/coreclr](https://github.com/dotnet/coreclr/tree/master/src/mscorlib/shared).
+
+The sources are synchronized with a mirroring tool that watches for new commits on either side and creates new pull requests (as @dotnet-bot) in the other repository.
+
+## Conventions
+
+Code in the shared directory should have no code specific to CoreCLR or CoreRT. Parts of classes that need to have different implementations on different runtimes should use partial classes and &#42;.CoreRT.cs/&#42;.CoreCLR.cs files in the non shared portion. Code that is different based on platform (Windows/Unix) is fine to leave in the shared portion. Remember to follow the [style guidelines](https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/coding-style.md).
+
+## Getting clean CI and merging the mirror PRs
+
+Once the mirror PR is created there is a chance that the new code will require changes to get a clean CI. Any changes can be added to the PR by checking out the PR branch and adding new commits. Please follow the following guidelines for modifying these PRs.
+
+ - **DO NOT** modify the commits made by @dotnet-bot in any way.
+ - **TRY** to only make changes outside of shared.
+ - Changes made in the shared folder in additional commits will get mirrored properly if the mirror PR is merged with a **REBASE**
+ - **ALWAYS** Merge the mirror PR with the **REBASE** option.
+ - Using one of the other options will cause the mirror to miss commits
diff --git a/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems b/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems
index 5955180d43..7c6d039f77 100644
--- a/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems
+++ b/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems
@@ -14,17 +14,20 @@
<TargetsOSX Condition="'$(TargetsOSX)' != 'true'">false</TargetsOSX>
</PropertyGroup>
<ItemGroup Condition="$(TargetsWindows)">
+ <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\BCrypt\Interop.BCryptGenRandom.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Crypt32\Interop.CryptProtectMemory.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Interop.BOOL.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Interop.Errors.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Interop.Libraries.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\BCrypt\Interop.BCryptGenRandom.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.CancelIoEx.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.CloseHandle.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.CreateFile.cs" Condition="'$(IsProjectNLibrary)' != 'true'"/>
+ <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.CreateFile.cs" Condition="'$(IsProjectNLibrary)' != 'true'" />
+ <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.CreateFile2.cs" Condition="'$(IsProjectNLibrary)' == 'true'" />
+ <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.FILE_INFO_BY_HANDLE_CLASS.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.FileTypes.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.FlushFileBuffers.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.FormatMessage.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.GetFileInformationByHandleEx.cs" Condition="'$(IsProjectNLibrary)' != 'true'"/>
+ <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.GetFileInformationByHandleEx.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.GetFileType_SafeHandle.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.GetFullPathNameW.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.GetLongPathNameW.cs"/>
@@ -33,12 +36,12 @@
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.LockFile.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.ReadFile_SafeHandle_IntPtr.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.ReadFile_SafeHandle_NativeOverlapped.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.SecurityOptions.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.SECURITY_ATTRIBUTES.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.SecurityOptions.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.SetEndOfFile.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.SetErrorMode.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.FILE_INFO_BY_HANDLE_CLASS.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.SetFilePointerEx.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.WideCharToMultiByte.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.WriteFile_SafeHandle_IntPtr.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.WriteFile_SafeHandle_NativeOverlapped.cs"/>
</ItemGroup>
@@ -46,6 +49,14 @@
<Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\Interop.Errors.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\Interop.IOErrors.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\Interop.Libraries.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Globalization.Native\Interop.Calendar.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'"/>
+ <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Globalization.Native\Interop.Casing.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'"/>
+ <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Globalization.Native\Interop.Idna.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'"/>
+ <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Globalization.Native\Interop.Locale.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'"/>
+ <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Globalization.Native\Interop.Normalization.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'"/>
+ <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Globalization.Native\Interop.ResultCode.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'"/>
+ <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Globalization.Native\Interop.TimeZoneInfo.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'"/>
+ <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Globalization.Native\Interop.Utils.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.Close.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.FLock.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.FSync.cs"/>
@@ -65,6 +76,25 @@
<Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.Write.cs"/>
</ItemGroup>
<ItemGroup>
+ <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\CriticalHandleMinusOneIsInvalid.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\CriticalHandleZeroOrMinusOneIsInvalid.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Action.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\ApplicationException.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\ArgumentNullException.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\ArithmeticException.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\ArrayTypeMismatchException.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\AssemblyLoadEventArgs.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\AssemblyLoadEventHandler.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\AsyncCallback.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\AttributeTargets.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\AttributeUsageAttribute.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Buffers\ArrayPool.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Buffers\ConfigurableArrayPool.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Buffers\TlsOverPerCoreLockedStacksArrayPool.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Utilities.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Char.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\CharEnumerator.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\CLSCompliantAttribute.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Collections\DictionaryEntry.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Collections\Generic\ICollection.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Collections\Generic\IComparer.cs"/>
@@ -86,26 +116,18 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Collections\IEnumerator.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Collections\IEqualityComparer.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Collections\IList.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\Action.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\ApplicationException.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\ArgumentNullException.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\ArithmeticException.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\ArrayTypeMismatchException.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\AsyncCallback.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\AttributeTargets.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\AttributeUsageAttribute.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\Buffers\ArrayPool.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\Buffers\ConfigurableArrayPool.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\Buffers\TlsOverPerCoreLockedStacksArrayPool.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\Buffers\Utilities.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\CharEnumerator.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\CLSCompliantAttribute.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Collections\IStructuralComparable.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Collections\IStructuralEquatable.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\ComponentModel\EditorBrowsableAttribute.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Convert.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\CurrentSystemTimeZone.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\DataMisalignedException.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\DateTime.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\DateTimeKind.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\DateTimeOffset.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\DayOfWeek.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\DBNull.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\DefaultBinder.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\DivideByZeroException.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\DuplicateWaitObjectException.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\EntryPointNotFoundException.cs"/>
@@ -116,6 +138,39 @@
<Compile Include="$(MSBuildThisFileDirectory)System\FlagsAttribute.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\FormatException.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\FormattableString.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CalendarAlgorithmType.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CalendarWeekRule.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CalendricalCalculationsHelper.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\ChineseLunisolarCalendar.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CultureNotFoundException.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\CultureTypes.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\DateTimeFormat.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\DateTimeFormatInfo.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\DateTimeFormatInfoScanner.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\DateTimeParse.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\DateTimeStyles.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\DaylightTime.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\DigitShapes.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\EastAsianLunisolarCalendar.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\GregorianCalendarTypes.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\HebrewCalendar.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\HebrewNumber.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\HijriCalendar.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\InternalGlobalizationHelper.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\JapaneseCalendar.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\JapaneseLunisolarCalendar.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\JulianCalendar.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\KoreanCalendar.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\KoreanLunisolarCalendar.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\NumberStyles.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\PersianCalendar.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\SortVersion.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\TaiwanCalendar.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\TaiwanLunisolarCalendar.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\ThaiBuddhistCalendar.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\TimeSpanStyles.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\UmAlQuraCalendar.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\UnicodeCategory.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\IAsyncResult.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\IComparable.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\IConvertible.cs"/>
@@ -131,9 +186,10 @@
<Compile Include="$(MSBuildThisFileDirectory)System\InvalidProgramException.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\InvalidTimeZoneException.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\IO\Error.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\IO\FileStream.cs" Condition="'$(IsProjectNLibrary)' != 'true'"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\IO\Path.cs" Condition="'$(IsProjectNLibrary)' != 'true'"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\IO\PathInternal.cs" Condition="'$(IsProjectNLibrary)' != 'true'"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\IO\FileStream.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\IO\Path.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\IO\PathInternal.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\IO\StreamHelpers.CopyValidation.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\IObservable.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\IObserver.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\IProgress.cs"/>
@@ -153,14 +209,99 @@
<Compile Include="$(MSBuildThisFileDirectory)System\ParamArrayAttribute.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\PlatformNotSupportedException.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\RankException.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AmbiguousMatchException.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Assembly.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AssemblyAlgorithmIdAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AssemblyCompanyAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AssemblyConfigurationAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AssemblyContentType.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AssemblyCopyrightAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AssemblyCultureAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AssemblyDefaultAliasAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AssemblyDelaySignAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AssemblyDescriptionAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AssemblyFileVersionAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AssemblyFlagsAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AssemblyInformationalVersionAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AssemblyKeyFileAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AssemblyKeyNameAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AssemblyMetadataAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AssemblyNameFlags.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AssemblyProductAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AssemblySignatureKeyAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AssemblyTitleAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AssemblyTrademarkAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\AssemblyVersionAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Binder.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\BindingFlags.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\CallingConventions.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\ConstructorInfo.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\CustomAttributeFormatException.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\DefaultMemberAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\EventAttributes.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\EventInfo.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\ExceptionHandlingClauseOptions.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\FieldAttributes.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\FieldInfo.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\GenericParameterAttributes.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\ICustomAttributeProvider.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\ImageFileMachine.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\InterfaceMapping.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\IntrospectionExtensions.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\InvalidFilterCriteriaException.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\IReflect.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\IReflectableType.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\ManifestResourceInfo.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\MemberFilter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\MemberInfo.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\MemberInfoSerializationHolder.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\MemberTypes.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\MethodAttributes.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\MethodBase.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\MethodImplAttributes.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\MethodInfo.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Missing.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Module.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\ModuleResolveEventHandler.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\ObfuscateAssemblyAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\ObfuscationAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\ParameterAttributes.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\ParameterInfo.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\ParameterModifier.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\Pointer.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\PortableExecutableKinds.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\ProcessorArchitecture.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\PropertyAttributes.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\PropertyInfo.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\ReflectionContext.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\ReflectionTypeLoadException.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\ResourceAttributes.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\ResourceLocation.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\StrongNameKeyPair.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\TargetException.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\TargetInvocationException.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\TargetParameterCountException.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\TypeAttributes.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Reflection\TypeDelegator.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\TypeFilter.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Reflection\TypeInfo.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\ResolveEventArgs.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\ResolveEventHandler.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\CompilationRelaxations.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\CompilerGlobalScopeAttribute.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\DefaultDependencyAttribute.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\DependencyAttribute.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\DiscardableAttribute.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\ExtensionAttribute.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\FixedAddressValueTypeAttribute.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\FormattableStringFactory.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\IsVolatile.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\ITuple.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\LoadHint.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\MethodCodeType.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\MethodImplOptions.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\StringFreezingAttribute.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\SuppressIldasmAttribute.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\TupleElementNamesAttribute.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\ConstrainedExecution\Cer.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\ConstrainedExecution\Consistency.cs"/>
@@ -171,8 +312,10 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Security\AllowPartiallyTrustedCallersAttribute.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Security\CryptographicException.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Security\PartialTrustVisibilityLevel.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Security\SecureString.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Security\SecurityCriticalAttribute.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Security\SecurityCriticalScope.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Security\SecurityException.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Security\SecurityRulesAttribute.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Security\SecurityRuleSet.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Security\SecuritySafeCriticalAttribute.cs"/>
@@ -181,41 +324,55 @@
<Compile Include="$(MSBuildThisFileDirectory)System\Security\SuppressUnmanagedCodeSecurityAttribute.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Security\UnverifiableCodeAttribute.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\StackOverflowException.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\StringComparer.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\StringComparison.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\StringSplitOptions.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\SystemException.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\TimeZone.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Text\Normalization.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Text\StringBuilder.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\ThreadAttributes.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\DeferredDisposableLifetime.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\TaskCanceledException.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\TaskExtensions.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\TaskSchedulerException.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Timeout.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\ThreadStaticAttribute.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\TimeoutException.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\TimeZoneNotFoundException.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\TupleExtensions.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Type.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Type.Enum.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Type.Helpers.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\TypeAccessException.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\TypeCode.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\TypeInitializationException.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\TypeUnloadedException.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\UnauthorizedAccessException.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\UnhandledExceptionEventArgs.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\UnhandledExceptionEventHandler.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\UnitySerializationHolder.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\Void.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\CriticalHandleMinusOneIsInvalid.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\CriticalHandleZeroOrMinusOneIsInvalid.cs"/>
</ItemGroup>
<ItemGroup Condition="$(TargetsWindows)">
- <Compile Include="$(MSBuildThisFileDirectory)System\IO\FileStream.Win32.cs" Condition="'$(IsProjectNLibrary)' != 'true'"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\IO\FileStreamCompletionSource.Win32.cs" Condition="'$(IsProjectNLibrary)' != 'true'"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\IO\Path.Windows.cs" Condition="'$(IsProjectNLibrary)' != 'true'"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\IO\PathHelper.Windows.cs" Condition="'$(IsProjectNLibrary)' != 'true'"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\IO\PathInternal.Windows.cs" Condition="'$(IsProjectNLibrary)' != 'true'"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\IO\PathInternal.Windows.StringBuffer.cs" Condition="'$(IsProjectNLibrary)' != 'true'"/>
- <Compile Include="$(MSBuildThisFileDirectory)System\IO\Win32Marshal.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\SafeFileHandle.Windows.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\SafeFileHandle.Windows.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\IO\FileStream.Win32.cs" Condition="'$(IsProjectNLibrary)' != 'true'" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\IO\FileStream.Windows.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\IO\FileStream.WinRT.cs" Condition="'$(IsProjectNLibrary)' == 'true'" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\IO\FileStreamCompletionSource.Win32.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\IO\Path.Windows.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\IO\PathHelper.Windows.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\IO\PathInternal.Windows.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\IO\PathInternal.Windows.StringBuffer.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\IO\Win32Marshal.cs" />
</ItemGroup>
<ItemGroup Condition="$(TargetsUnix)">
+ <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\SafeFileHandle.Unix.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Globalization\LocaleData.Unix.cs" Condition="'$(EnableDummyGlobalizationImplementation)' != 'true'"/>
<Compile Include="$(MSBuildThisFileDirectory)System\IO\FileStream.Unix.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\IO\Path.Unix.cs"/>
<Compile Include="$(MSBuildThisFileDirectory)System\IO\PathInternal.Unix.cs"/>
- <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\SafeFileHandle.Unix.cs"/>
+ <Compile Include="$(MSBuildThisFileDirectory)System\Security\SecureString.Unix.cs"/>
</ItemGroup>
<ItemGroup Condition="$(TargetsUnix) and $(TargetsOSX)">
<Compile Include="$(MSBuildThisFileDirectory)System\IO\FileStream.OSX.cs"/>
diff --git a/src/mscorlib/shared/System/AssemblyLoadEventArgs.cs b/src/mscorlib/shared/System/AssemblyLoadEventArgs.cs
new file mode 100644
index 0000000000..d7e5249693
--- /dev/null
+++ b/src/mscorlib/shared/System/AssemblyLoadEventArgs.cs
@@ -0,0 +1,18 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Reflection;
+
+namespace System
+{
+ public class AssemblyLoadEventArgs : EventArgs
+ {
+ public AssemblyLoadEventArgs(Assembly loadedAssembly)
+ {
+ LoadedAssembly = loadedAssembly;
+ }
+
+ public Assembly LoadedAssembly { get; }
+ }
+}
diff --git a/src/mscorlib/shared/System/AssemblyLoadEventHandler.cs b/src/mscorlib/shared/System/AssemblyLoadEventHandler.cs
new file mode 100644
index 0000000000..752379fdc7
--- /dev/null
+++ b/src/mscorlib/shared/System/AssemblyLoadEventHandler.cs
@@ -0,0 +1,8 @@
+// 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 System
+{
+ public delegate void AssemblyLoadEventHandler(object sender, AssemblyLoadEventArgs args);
+}
diff --git a/src/mscorlib/shared/System/AttributeUsageAttribute.cs b/src/mscorlib/shared/System/AttributeUsageAttribute.cs
index 22cc54864c..6f9aeb20f3 100644
--- a/src/mscorlib/shared/System/AttributeUsageAttribute.cs
+++ b/src/mscorlib/shared/System/AttributeUsageAttribute.cs
@@ -20,41 +20,39 @@ namespace System
[AttributeUsage(AttributeTargets.Class, Inherited = true)]
public sealed class AttributeUsageAttribute : Attribute
{
- internal AttributeTargets m_attributeTarget = AttributeTargets.All; // Defaults to all
- internal bool m_allowMultiple = false; // Defaults to false
- internal bool m_inherited = true; // Defaults to true
+ private AttributeTargets _attributeTarget = AttributeTargets.All; // Defaults to all
+ private bool _allowMultiple = false; // Defaults to false
+ private bool _inherited = true; // Defaults to true
internal static AttributeUsageAttribute Default = new AttributeUsageAttribute(AttributeTargets.All);
//Constructors
public AttributeUsageAttribute(AttributeTargets validOn)
{
- m_attributeTarget = validOn;
+ _attributeTarget = validOn;
}
internal AttributeUsageAttribute(AttributeTargets validOn, bool allowMultiple, bool inherited)
{
- m_attributeTarget = validOn;
- m_allowMultiple = allowMultiple;
- m_inherited = inherited;
+ _attributeTarget = validOn;
+ _allowMultiple = allowMultiple;
+ _inherited = inherited;
}
-
- //Properties
public AttributeTargets ValidOn
{
- get { return m_attributeTarget; }
+ get { return _attributeTarget; }
}
public bool AllowMultiple
{
- get { return m_allowMultiple; }
- set { m_allowMultiple = value; }
+ get { return _allowMultiple; }
+ set { _allowMultiple = value; }
}
public bool Inherited
{
- get { return m_inherited; }
- set { m_inherited = value; }
+ get { return _inherited; }
+ set { _inherited = value; }
}
}
}
diff --git a/src/mscorlib/src/System/Char.cs b/src/mscorlib/shared/System/Char.cs
index bf3818f985..2b3133a669 100644
--- a/src/mscorlib/src/System/Char.cs
+++ b/src/mscorlib/shared/System/Char.cs
@@ -12,20 +12,16 @@
**
===========================================================*/
-using System;
-using System.Globalization;
-using System.Runtime;
-using System.Runtime.InteropServices;
-using System.Runtime.CompilerServices;
using System.Diagnostics;
using System.Diagnostics.Contracts;
+using System.Globalization;
+using System.Runtime.InteropServices;
namespace System
{
[Serializable]
- [System.Runtime.InteropServices.StructLayout(LayoutKind.Sequential)]
- public struct Char : IComparable, IConvertible
- , IComparable<Char>, IEquatable<Char>
+ [StructLayout(LayoutKind.Sequential)]
+ public struct Char : IComparable, IComparable<Char>, IEquatable<Char>, IConvertible
{
//
// Member Variables
@@ -41,7 +37,7 @@ namespace System
public const char MinValue = (char)0x00;
// Unicode category values from Unicode U+0000 ~ U+00FF. Store them in byte[] array to save space.
- private readonly static byte[] categoryForLatin1 = {
+ private static readonly byte[] s_categoryForLatin1 = {
(byte)UnicodeCategory.Control, (byte)UnicodeCategory.Control, (byte)UnicodeCategory.Control, (byte)UnicodeCategory.Control, (byte)UnicodeCategory.Control, (byte)UnicodeCategory.Control, (byte)UnicodeCategory.Control, (byte)UnicodeCategory.Control, // 0000 - 0007
(byte)UnicodeCategory.Control, (byte)UnicodeCategory.Control, (byte)UnicodeCategory.Control, (byte)UnicodeCategory.Control, (byte)UnicodeCategory.Control, (byte)UnicodeCategory.Control, (byte)UnicodeCategory.Control, (byte)UnicodeCategory.Control, // 0008 - 000F
(byte)UnicodeCategory.Control, (byte)UnicodeCategory.Control, (byte)UnicodeCategory.Control, (byte)UnicodeCategory.Control, (byte)UnicodeCategory.Control, (byte)UnicodeCategory.Control, (byte)UnicodeCategory.Control, (byte)UnicodeCategory.Control, // 0010 - 0017
@@ -92,7 +88,7 @@ namespace System
private static UnicodeCategory GetLatin1UnicodeCategory(char ch)
{
Debug.Assert(IsLatin1(ch), "Char.GetLatin1UnicodeCategory(): ch should be <= 007f");
- return (UnicodeCategory)(categoryForLatin1[(int)ch]);
+ return (UnicodeCategory)(s_categoryForLatin1[(int)ch]);
}
//
@@ -141,7 +137,7 @@ namespace System
}
if (!(value is Char))
{
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeChar"));
+ throw new ArgumentException(SR.Arg_MustBeChar);
}
return (m_value - ((Char)value).m_value);
@@ -189,7 +185,7 @@ namespace System
if (s.Length != 1)
{
- throw new FormatException(Environment.GetResourceString("Format_NeedSingleChar"));
+ throw new FormatException(SR.Format_NeedSingleChar);
}
return s[0];
}
@@ -431,6 +427,7 @@ namespace System
return ToUpper(c, CultureInfo.InvariantCulture);
}
+
/*===================================ToLower====================================
**
==============================================================================*/
@@ -462,6 +459,7 @@ namespace System
return ToLower(c, CultureInfo.InvariantCulture);
}
+
//
// IConvertible implementation
//
@@ -472,96 +470,80 @@ namespace System
}
- /// <internalonly/>
bool IConvertible.ToBoolean(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "Char", "Boolean"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Char", "Boolean"));
}
- /// <internalonly/>
char IConvertible.ToChar(IFormatProvider provider)
{
return m_value;
}
- /// <internalonly/>
sbyte IConvertible.ToSByte(IFormatProvider provider)
{
return Convert.ToSByte(m_value);
}
- /// <internalonly/>
byte IConvertible.ToByte(IFormatProvider provider)
{
return Convert.ToByte(m_value);
}
- /// <internalonly/>
short IConvertible.ToInt16(IFormatProvider provider)
{
return Convert.ToInt16(m_value);
}
- /// <internalonly/>
ushort IConvertible.ToUInt16(IFormatProvider provider)
{
return Convert.ToUInt16(m_value);
}
- /// <internalonly/>
int IConvertible.ToInt32(IFormatProvider provider)
{
return Convert.ToInt32(m_value);
}
- /// <internalonly/>
uint IConvertible.ToUInt32(IFormatProvider provider)
{
return Convert.ToUInt32(m_value);
}
- /// <internalonly/>
long IConvertible.ToInt64(IFormatProvider provider)
{
return Convert.ToInt64(m_value);
}
- /// <internalonly/>
ulong IConvertible.ToUInt64(IFormatProvider provider)
{
return Convert.ToUInt64(m_value);
}
- /// <internalonly/>
float IConvertible.ToSingle(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "Char", "Single"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Char", "Single"));
}
- /// <internalonly/>
double IConvertible.ToDouble(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "Char", "Double"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Char", "Double"));
}
- /// <internalonly/>
Decimal IConvertible.ToDecimal(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "Char", "Decimal"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Char", "Decimal"));
}
- /// <internalonly/>
DateTime IConvertible.ToDateTime(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "Char", "DateTime"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Char", "DateTime"));
}
- /// <internalonly/>
Object IConvertible.ToType(Type type, IFormatProvider provider)
{
return Convert.DefaultToType((IConvertible)this, type, provider);
}
-
public static bool IsControl(char c)
{
if (IsLatin1(c))
@@ -848,9 +830,10 @@ namespace System
throw new ArgumentOutOfRangeException(nameof(index));
}
Contract.EndContractBlock();
- if (IsLatin1(s[index]))
+ char c = s[index];
+ if (IsLatin1(c))
{
- return (CheckSymbol(GetLatin1UnicodeCategory(s[index])));
+ return (CheckSymbol(GetLatin1UnicodeCategory(c)));
}
return (CheckSymbol(CharUnicodeInfo.GetUnicodeCategory(s, index)));
}
@@ -1038,7 +1021,7 @@ namespace System
// are considered as irregular code unit sequence, but they are not illegal.
if ((utf32 < 0 || utf32 > UNICODE_PLANE16_END) || (utf32 >= HIGH_SURROGATE_START && utf32 <= LOW_SURROGATE_END))
{
- throw new ArgumentOutOfRangeException(nameof(utf32), Environment.GetResourceString("ArgumentOutOfRange_InvalidUTF32"));
+ throw new ArgumentOutOfRangeException(nameof(utf32), SR.ArgumentOutOfRange_InvalidUTF32);
}
Contract.EndContractBlock();
@@ -1069,11 +1052,11 @@ namespace System
{
if (!IsHighSurrogate(highSurrogate))
{
- throw new ArgumentOutOfRangeException(nameof(highSurrogate), Environment.GetResourceString("ArgumentOutOfRange_InvalidHighSurrogate"));
+ throw new ArgumentOutOfRangeException(nameof(highSurrogate), SR.ArgumentOutOfRange_InvalidHighSurrogate);
}
if (!IsLowSurrogate(lowSurrogate))
{
- throw new ArgumentOutOfRangeException(nameof(lowSurrogate), Environment.GetResourceString("ArgumentOutOfRange_InvalidLowSurrogate"));
+ throw new ArgumentOutOfRangeException(nameof(lowSurrogate), SR.ArgumentOutOfRange_InvalidLowSurrogate);
}
Contract.EndContractBlock();
return (((highSurrogate - CharUnicodeInfo.HIGH_SURROGATE_START) * 0x400) + (lowSurrogate - CharUnicodeInfo.LOW_SURROGATE_START) + UNICODE_PLANE01_START);
@@ -1096,7 +1079,7 @@ namespace System
if (index < 0 || index >= s.Length)
{
- throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
}
Contract.EndContractBlock();
// Check if the character at index is a high surrogate.
@@ -1117,19 +1100,19 @@ namespace System
}
else
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHighSurrogate", index), nameof(s));
+ throw new ArgumentException(SR.Format(SR.Argument_InvalidHighSurrogate, index), nameof(s));
}
}
else
{
// Found a high surrogate at the end of the string.
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHighSurrogate", index), nameof(s));
+ throw new ArgumentException(SR.Format(SR.Argument_InvalidHighSurrogate, index), nameof(s));
}
}
else
{
// Find a low surrogate at the character pointed by index.
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidLowSurrogate", index), nameof(s));
+ throw new ArgumentException(SR.Format(SR.Argument_InvalidLowSurrogate, index), nameof(s));
}
}
// Not a high-surrogate or low-surrogate. Genereate the UTF32 value for the BMP characters.
diff --git a/src/mscorlib/shared/System/CharEnumerator.cs b/src/mscorlib/shared/System/CharEnumerator.cs
index 689ed7e488..ea9915a7c4 100644
--- a/src/mscorlib/shared/System/CharEnumerator.cs
+++ b/src/mscorlib/shared/System/CharEnumerator.cs
@@ -54,7 +54,6 @@ namespace System
_str = null;
}
- /// <internalonly/>
Object IEnumerator.Current
{
get { return Current; }
diff --git a/src/mscorlib/src/System/Convert.cs b/src/mscorlib/shared/System/Convert.cs
index 7228e229d7..576f78f1f1 100644
--- a/src/mscorlib/src/System/Convert.cs
+++ b/src/mscorlib/shared/System/Convert.cs
@@ -2,15 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*============================================================
-**
-**
-**
-** Purpose: Home for static conversion methods.
-**
-**
-===========================================================*/
-
using System;
using System.Globalization;
using System.Threading;
@@ -22,7 +13,6 @@ using System.Security;
using System.Diagnostics;
using System.Diagnostics.Contracts;
-
namespace System
{
[Flags]
@@ -112,30 +102,30 @@ namespace System
//A typeof operation is fairly expensive (does a system call), so we'll cache these here
//statically. These are exactly lined up with the TypeCode, eg. ConvertType[TypeCode.Int16]
//will give you the type of an Int16.
- internal static readonly RuntimeType[] ConvertTypes = {
- (RuntimeType)typeof(System.Empty),
- (RuntimeType)typeof(Object),
- (RuntimeType)typeof(System.DBNull),
- (RuntimeType)typeof(Boolean),
- (RuntimeType)typeof(Char),
- (RuntimeType)typeof(SByte),
- (RuntimeType)typeof(Byte),
- (RuntimeType)typeof(Int16),
- (RuntimeType)typeof(UInt16),
- (RuntimeType)typeof(Int32),
- (RuntimeType)typeof(UInt32),
- (RuntimeType)typeof(Int64),
- (RuntimeType)typeof(UInt64),
- (RuntimeType)typeof(Single),
- (RuntimeType)typeof(Double),
- (RuntimeType)typeof(Decimal),
- (RuntimeType)typeof(DateTime),
- (RuntimeType)typeof(Object), //TypeCode is discontinuous so we need a placeholder.
- (RuntimeType)typeof(String)
+ internal static readonly Type[] ConvertTypes = {
+ typeof(System.Empty),
+ typeof(Object),
+ typeof(System.DBNull),
+ typeof(Boolean),
+ typeof(Char),
+ typeof(SByte),
+ typeof(Byte),
+ typeof(Int16),
+ typeof(UInt16),
+ typeof(Int32),
+ typeof(UInt32),
+ typeof(Int64),
+ typeof(UInt64),
+ typeof(Single),
+ typeof(Double),
+ typeof(Decimal),
+ typeof(DateTime),
+ typeof(Object), //TypeCode is discontinuous so we need a placeholder.
+ typeof(String)
};
// Need to special case Enum because typecode will be underlying type, e.g. Int32
- private static readonly RuntimeType EnumType = (RuntimeType)typeof(Enum);
+ private static readonly Type EnumType = typeof(Enum);
internal static readonly char[] base64Table = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O',
'P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d',
@@ -204,7 +194,7 @@ namespace System
// object's implementation of IConvertible.
public static Object ChangeType(Object value, TypeCode typeCode)
{
- return ChangeType(value, typeCode, Thread.CurrentThread.CurrentCulture);
+ return ChangeType(value, typeCode, CultureInfo.CurrentCulture);
}
public static Object ChangeType(Object value, TypeCode typeCode, IFormatProvider provider)
@@ -217,7 +207,7 @@ namespace System
IConvertible v = value as IConvertible;
if (v == null)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_IConvertible"));
+ throw new InvalidCastException(SR.InvalidCast_IConvertible);
}
// This line is invalid for things like Enums that return a TypeCode
@@ -258,84 +248,79 @@ namespace System
case TypeCode.Object:
return value;
case TypeCode.DBNull:
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_DBNull"));
+ throw new InvalidCastException(SR.InvalidCast_DBNull);
case TypeCode.Empty:
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_Empty"));
+ throw new InvalidCastException(SR.InvalidCast_Empty);
default:
- throw new ArgumentException(Environment.GetResourceString("Arg_UnknownTypeCode"));
+ throw new ArgumentException(SR.Arg_UnknownTypeCode);
}
}
internal static Object DefaultToType(IConvertible value, Type targetType, IFormatProvider provider)
{
- Contract.Requires(value != null, "[Convert.DefaultToType]value!=null");
+ Debug.Assert(value != null, "[Convert.DefaultToType]value!=null");
if (targetType == null)
{
throw new ArgumentNullException(nameof(targetType));
}
Contract.EndContractBlock();
- RuntimeType rtTargetType = targetType as RuntimeType;
-
- if (rtTargetType != null)
+ if (ReferenceEquals(value.GetType(), targetType))
{
- if (value.GetType() == targetType)
- {
- return value;
- }
-
- if (rtTargetType == ConvertTypes[(int)TypeCode.Boolean])
- return value.ToBoolean(provider);
- if (rtTargetType == ConvertTypes[(int)TypeCode.Char])
- return value.ToChar(provider);
- if (rtTargetType == ConvertTypes[(int)TypeCode.SByte])
- return value.ToSByte(provider);
- if (rtTargetType == ConvertTypes[(int)TypeCode.Byte])
- return value.ToByte(provider);
- if (rtTargetType == ConvertTypes[(int)TypeCode.Int16])
- return value.ToInt16(provider);
- if (rtTargetType == ConvertTypes[(int)TypeCode.UInt16])
- return value.ToUInt16(provider);
- if (rtTargetType == ConvertTypes[(int)TypeCode.Int32])
- return value.ToInt32(provider);
- if (rtTargetType == ConvertTypes[(int)TypeCode.UInt32])
- return value.ToUInt32(provider);
- if (rtTargetType == ConvertTypes[(int)TypeCode.Int64])
- return value.ToInt64(provider);
- if (rtTargetType == ConvertTypes[(int)TypeCode.UInt64])
- return value.ToUInt64(provider);
- if (rtTargetType == ConvertTypes[(int)TypeCode.Single])
- return value.ToSingle(provider);
- if (rtTargetType == ConvertTypes[(int)TypeCode.Double])
- return value.ToDouble(provider);
- if (rtTargetType == ConvertTypes[(int)TypeCode.Decimal])
- return value.ToDecimal(provider);
- if (rtTargetType == ConvertTypes[(int)TypeCode.DateTime])
- return value.ToDateTime(provider);
- if (rtTargetType == ConvertTypes[(int)TypeCode.String])
- return value.ToString(provider);
- if (rtTargetType == ConvertTypes[(int)TypeCode.Object])
- return (Object)value;
- // Need to special case Enum because typecode will be underlying type, e.g. Int32
- if (rtTargetType == EnumType)
- return (Enum)value;
- if (rtTargetType == ConvertTypes[(int)TypeCode.DBNull])
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_DBNull"));
- if (rtTargetType == ConvertTypes[(int)TypeCode.Empty])
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_Empty"));
+ return value;
}
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", value.GetType().FullName, targetType.FullName));
+ if (ReferenceEquals(targetType, ConvertTypes[(int)TypeCode.Boolean]))
+ return value.ToBoolean(provider);
+ if (ReferenceEquals(targetType, ConvertTypes[(int)TypeCode.Char]))
+ return value.ToChar(provider);
+ if (ReferenceEquals(targetType, ConvertTypes[(int)TypeCode.SByte]))
+ return value.ToSByte(provider);
+ if (ReferenceEquals(targetType, ConvertTypes[(int)TypeCode.Byte]))
+ return value.ToByte(provider);
+ if (ReferenceEquals(targetType, ConvertTypes[(int)TypeCode.Int16]))
+ return value.ToInt16(provider);
+ if (ReferenceEquals(targetType, ConvertTypes[(int)TypeCode.UInt16]))
+ return value.ToUInt16(provider);
+ if (ReferenceEquals(targetType, ConvertTypes[(int)TypeCode.Int32]))
+ return value.ToInt32(provider);
+ if (ReferenceEquals(targetType, ConvertTypes[(int)TypeCode.UInt32]))
+ return value.ToUInt32(provider);
+ if (ReferenceEquals(targetType, ConvertTypes[(int)TypeCode.Int64]))
+ return value.ToInt64(provider);
+ if (ReferenceEquals(targetType, ConvertTypes[(int)TypeCode.UInt64]))
+ return value.ToUInt64(provider);
+ if (ReferenceEquals(targetType, ConvertTypes[(int)TypeCode.Single]))
+ return value.ToSingle(provider);
+ if (ReferenceEquals(targetType, ConvertTypes[(int)TypeCode.Double]))
+ return value.ToDouble(provider);
+ if (ReferenceEquals(targetType, ConvertTypes[(int)TypeCode.Decimal]))
+ return value.ToDecimal(provider);
+ if (ReferenceEquals(targetType, ConvertTypes[(int)TypeCode.DateTime]))
+ return value.ToDateTime(provider);
+ if (ReferenceEquals(targetType, ConvertTypes[(int)TypeCode.String]))
+ return value.ToString(provider);
+ if (ReferenceEquals(targetType, ConvertTypes[(int)TypeCode.Object]))
+ return (Object)value;
+ // Need to special case Enum because typecode will be underlying type, e.g. Int32
+ if (ReferenceEquals(targetType, EnumType))
+ return (Enum)value;
+ if (ReferenceEquals(targetType, ConvertTypes[(int)TypeCode.DBNull]))
+ throw new InvalidCastException(SR.InvalidCast_DBNull);
+ if (ReferenceEquals(targetType, ConvertTypes[(int)TypeCode.Empty]))
+ throw new InvalidCastException(SR.InvalidCast_Empty);
+
+ throw new InvalidCastException(string.Format(SR.InvalidCast_FromTo, value.GetType().FullName, targetType.FullName));
}
public static Object ChangeType(Object value, Type conversionType)
{
- return ChangeType(value, conversionType, Thread.CurrentThread.CurrentCulture);
+ return ChangeType(value, conversionType, CultureInfo.CurrentCulture);
}
public static Object ChangeType(Object value, Type conversionType, IFormatProvider provider)
{
- if (conversionType == null)
+ if (ReferenceEquals(conversionType, null))
{
throw new ArgumentNullException(nameof(conversionType));
}
@@ -345,7 +330,7 @@ namespace System
{
if (conversionType.IsValueType)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_CannotCastNullToValueType"));
+ throw new InvalidCastException(SR.InvalidCast_CannotCastNullToValueType);
}
return null;
}
@@ -357,73 +342,71 @@ namespace System
{
return value;
}
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_IConvertible"));
+ throw new InvalidCastException(SR.InvalidCast_IConvertible);
}
- RuntimeType rtConversionType = conversionType as RuntimeType;
-
- if (rtConversionType == ConvertTypes[(int)TypeCode.Boolean])
+ if (ReferenceEquals(conversionType, ConvertTypes[(int)TypeCode.Boolean]))
return ic.ToBoolean(provider);
- if (rtConversionType == ConvertTypes[(int)TypeCode.Char])
+ if (ReferenceEquals(conversionType, ConvertTypes[(int)TypeCode.Char]))
return ic.ToChar(provider);
- if (rtConversionType == ConvertTypes[(int)TypeCode.SByte])
+ if (ReferenceEquals(conversionType, ConvertTypes[(int)TypeCode.SByte]))
return ic.ToSByte(provider);
- if (rtConversionType == ConvertTypes[(int)TypeCode.Byte])
+ if (ReferenceEquals(conversionType, ConvertTypes[(int)TypeCode.Byte]))
return ic.ToByte(provider);
- if (rtConversionType == ConvertTypes[(int)TypeCode.Int16])
+ if (ReferenceEquals(conversionType, ConvertTypes[(int)TypeCode.Int16]))
return ic.ToInt16(provider);
- if (rtConversionType == ConvertTypes[(int)TypeCode.UInt16])
+ if (ReferenceEquals(conversionType, ConvertTypes[(int)TypeCode.UInt16]))
return ic.ToUInt16(provider);
- if (rtConversionType == ConvertTypes[(int)TypeCode.Int32])
+ if (ReferenceEquals(conversionType, ConvertTypes[(int)TypeCode.Int32]))
return ic.ToInt32(provider);
- if (rtConversionType == ConvertTypes[(int)TypeCode.UInt32])
+ if (ReferenceEquals(conversionType, ConvertTypes[(int)TypeCode.UInt32]))
return ic.ToUInt32(provider);
- if (rtConversionType == ConvertTypes[(int)TypeCode.Int64])
+ if (ReferenceEquals(conversionType, ConvertTypes[(int)TypeCode.Int64]))
return ic.ToInt64(provider);
- if (rtConversionType == ConvertTypes[(int)TypeCode.UInt64])
+ if (ReferenceEquals(conversionType, ConvertTypes[(int)TypeCode.UInt64]))
return ic.ToUInt64(provider);
- if (rtConversionType == ConvertTypes[(int)TypeCode.Single])
+ if (ReferenceEquals(conversionType, ConvertTypes[(int)TypeCode.Single]))
return ic.ToSingle(provider);
- if (rtConversionType == ConvertTypes[(int)TypeCode.Double])
+ if (ReferenceEquals(conversionType, ConvertTypes[(int)TypeCode.Double]))
return ic.ToDouble(provider);
- if (rtConversionType == ConvertTypes[(int)TypeCode.Decimal])
+ if (ReferenceEquals(conversionType, ConvertTypes[(int)TypeCode.Decimal]))
return ic.ToDecimal(provider);
- if (rtConversionType == ConvertTypes[(int)TypeCode.DateTime])
+ if (ReferenceEquals(conversionType, ConvertTypes[(int)TypeCode.DateTime]))
return ic.ToDateTime(provider);
- if (rtConversionType == ConvertTypes[(int)TypeCode.String])
+ if (ReferenceEquals(conversionType, ConvertTypes[(int)TypeCode.String]))
return ic.ToString(provider);
- if (rtConversionType == ConvertTypes[(int)TypeCode.Object])
+ if (ReferenceEquals(conversionType, ConvertTypes[(int)TypeCode.Object]))
return (Object)value;
return ic.ToType(conversionType, provider);
}
[MethodImpl(MethodImplOptions.NoInlining)]
- private static void ThrowCharOverflowException() { throw new OverflowException(Environment.GetResourceString("Overflow_Char")); }
+ private static void ThrowCharOverflowException() { throw new OverflowException(SR.Overflow_Char); }
[MethodImpl(MethodImplOptions.NoInlining)]
- private static void ThrowByteOverflowException() { throw new OverflowException(Environment.GetResourceString("Overflow_Byte")); }
+ private static void ThrowByteOverflowException() { throw new OverflowException(SR.Overflow_Byte); }
[MethodImpl(MethodImplOptions.NoInlining)]
- private static void ThrowSByteOverflowException() { throw new OverflowException(Environment.GetResourceString("Overflow_SByte")); }
+ private static void ThrowSByteOverflowException() { throw new OverflowException(SR.Overflow_SByte); }
[MethodImpl(MethodImplOptions.NoInlining)]
- private static void ThrowInt16OverflowException() { throw new OverflowException(Environment.GetResourceString("Overflow_Int16")); }
+ private static void ThrowInt16OverflowException() { throw new OverflowException(SR.Overflow_Int16); }
[MethodImpl(MethodImplOptions.NoInlining)]
- private static void ThrowUInt16OverflowException() { throw new OverflowException(Environment.GetResourceString("Overflow_UInt16")); }
+ private static void ThrowUInt16OverflowException() { throw new OverflowException(SR.Overflow_UInt16); }
[MethodImpl(MethodImplOptions.NoInlining)]
- private static void ThrowInt32OverflowException() { throw new OverflowException(Environment.GetResourceString("Overflow_Int32")); }
+ private static void ThrowInt32OverflowException() { throw new OverflowException(SR.Overflow_Int32); }
[MethodImpl(MethodImplOptions.NoInlining)]
- private static void ThrowUInt32OverflowException() { throw new OverflowException(Environment.GetResourceString("Overflow_UInt32")); }
+ private static void ThrowUInt32OverflowException() { throw new OverflowException(SR.Overflow_UInt32); }
[MethodImpl(MethodImplOptions.NoInlining)]
- private static void ThrowInt64OverflowException() { throw new OverflowException(Environment.GetResourceString("Overflow_Int64")); }
+ private static void ThrowInt64OverflowException() { throw new OverflowException(SR.Overflow_Int64); }
[MethodImpl(MethodImplOptions.NoInlining)]
- private static void ThrowUInt64OverflowException() { throw new OverflowException(Environment.GetResourceString("Overflow_UInt64")); }
+ private static void ThrowUInt64OverflowException() { throw new OverflowException(SR.Overflow_UInt64); }
// Conversions to Boolean
public static bool ToBoolean(Object value)
@@ -626,7 +609,7 @@ namespace System
Contract.EndContractBlock();
if (value.Length != 1)
- throw new FormatException(Environment.GetResourceString(ResId.Format_NeedSingleChar));
+ throw new FormatException(SR.Format_NeedSingleChar);
return value[0];
}
@@ -1259,12 +1242,12 @@ namespace System
return result;
}
}
- throw new OverflowException(Environment.GetResourceString("Overflow_Int32"));
+ throw new OverflowException(SR.Overflow_Int32);
}
public static int ToInt32(decimal value)
{
- return Decimal.FCallToInt32(value);
+ return Decimal.ToInt32(Decimal.Round(value, 0));
}
public static int ToInt32(String value)
@@ -1391,7 +1374,7 @@ namespace System
if (dif > 0.5 || dif == 0.5 && (result & 1) != 0) result++;
return result;
}
- throw new OverflowException(Environment.GetResourceString("Overflow_UInt32"));
+ throw new OverflowException(SR.Overflow_UInt32);
}
[CLSCompliant(false)]
@@ -2099,7 +2082,7 @@ namespace System
public static string ToString(bool value, IFormatProvider provider)
{
Contract.Ensures(Contract.Result<string>() != null);
- return value.ToString(provider);
+ return value.ToString();
}
public static string ToString(char value)
@@ -2111,7 +2094,7 @@ namespace System
public static string ToString(char value, IFormatProvider provider)
{
Contract.Ensures(Contract.Result<string>() != null);
- return value.ToString(provider);
+ return value.ToString();
}
[CLSCompliant(false)]
@@ -2290,7 +2273,7 @@ namespace System
{
if (fromBase != 2 && fromBase != 8 && fromBase != 10 && fromBase != 16)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_InvalidBase"));
+ throw new ArgumentException(SR.Arg_InvalidBase);
}
Contract.EndContractBlock();
int r = ParseNumbers.StringToInt(value, fromBase, ParseNumbers.IsTight | ParseNumbers.TreatAsUnsigned);
@@ -2308,7 +2291,7 @@ namespace System
{
if (fromBase != 2 && fromBase != 8 && fromBase != 10 && fromBase != 16)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_InvalidBase"));
+ throw new ArgumentException(SR.Arg_InvalidBase);
}
Contract.EndContractBlock();
int r = ParseNumbers.StringToInt(value, fromBase, ParseNumbers.IsTight | ParseNumbers.TreatAsI1);
@@ -2328,7 +2311,7 @@ namespace System
{
if (fromBase != 2 && fromBase != 8 && fromBase != 10 && fromBase != 16)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_InvalidBase"));
+ throw new ArgumentException(SR.Arg_InvalidBase);
}
Contract.EndContractBlock();
int r = ParseNumbers.StringToInt(value, fromBase, ParseNumbers.IsTight | ParseNumbers.TreatAsI2);
@@ -2349,7 +2332,7 @@ namespace System
{
if (fromBase != 2 && fromBase != 8 && fromBase != 10 && fromBase != 16)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_InvalidBase"));
+ throw new ArgumentException(SR.Arg_InvalidBase);
}
Contract.EndContractBlock();
int r = ParseNumbers.StringToInt(value, fromBase, ParseNumbers.IsTight | ParseNumbers.TreatAsUnsigned);
@@ -2366,7 +2349,7 @@ namespace System
{
if (fromBase != 2 && fromBase != 8 && fromBase != 10 && fromBase != 16)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_InvalidBase"));
+ throw new ArgumentException(SR.Arg_InvalidBase);
}
Contract.EndContractBlock();
return ParseNumbers.StringToInt(value, fromBase, ParseNumbers.IsTight);
@@ -2381,7 +2364,7 @@ namespace System
{
if (fromBase != 2 && fromBase != 8 && fromBase != 10 && fromBase != 16)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_InvalidBase"));
+ throw new ArgumentException(SR.Arg_InvalidBase);
}
Contract.EndContractBlock();
return (uint)ParseNumbers.StringToInt(value, fromBase, ParseNumbers.TreatAsUnsigned | ParseNumbers.IsTight);
@@ -2395,7 +2378,7 @@ namespace System
{
if (fromBase != 2 && fromBase != 8 && fromBase != 10 && fromBase != 16)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_InvalidBase"));
+ throw new ArgumentException(SR.Arg_InvalidBase);
}
Contract.EndContractBlock();
return ParseNumbers.StringToLong(value, fromBase, ParseNumbers.IsTight);
@@ -2410,7 +2393,7 @@ namespace System
{
if (fromBase != 2 && fromBase != 8 && fromBase != 10 && fromBase != 16)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_InvalidBase"));
+ throw new ArgumentException(SR.Arg_InvalidBase);
}
Contract.EndContractBlock();
return (ulong)ParseNumbers.StringToLong(value, fromBase, ParseNumbers.TreatAsUnsigned | ParseNumbers.IsTight);
@@ -2421,7 +2404,7 @@ namespace System
{
if (toBase != 2 && toBase != 8 && toBase != 10 && toBase != 16)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_InvalidBase"));
+ throw new ArgumentException(SR.Arg_InvalidBase);
}
Contract.EndContractBlock();
return ParseNumbers.IntToString((int)value, toBase, -1, ' ', ParseNumbers.PrintAsI1);
@@ -2432,7 +2415,7 @@ namespace System
{
if (toBase != 2 && toBase != 8 && toBase != 10 && toBase != 16)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_InvalidBase"));
+ throw new ArgumentException(SR.Arg_InvalidBase);
}
Contract.EndContractBlock();
return ParseNumbers.IntToString((int)value, toBase, -1, ' ', ParseNumbers.PrintAsI2);
@@ -2443,7 +2426,7 @@ namespace System
{
if (toBase != 2 && toBase != 8 && toBase != 10 && toBase != 16)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_InvalidBase"));
+ throw new ArgumentException(SR.Arg_InvalidBase);
}
Contract.EndContractBlock();
return ParseNumbers.IntToString(value, toBase, -1, ' ', 0);
@@ -2454,7 +2437,7 @@ namespace System
{
if (toBase != 2 && toBase != 8 && toBase != 10 && toBase != 16)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_InvalidBase"));
+ throw new ArgumentException(SR.Arg_InvalidBase);
}
Contract.EndContractBlock();
return ParseNumbers.LongToString(value, toBase, -1, ' ', 0);
@@ -2493,11 +2476,11 @@ namespace System
if (inArray == null)
throw new ArgumentNullException(nameof(inArray));
if (length < 0)
- throw new ArgumentOutOfRangeException(nameof(length), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_Index);
if (offset < 0)
- throw new ArgumentOutOfRangeException(nameof(offset), Environment.GetResourceString("ArgumentOutOfRange_GenericPositive"));
+ throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_GenericPositive);
if (options < Base64FormattingOptions.None || options > Base64FormattingOptions.InsertLineBreaks)
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)options));
+ throw new ArgumentException(string.Format(SR.Arg_EnumIllegalVal, (int)options));
Contract.Ensures(Contract.Result<string>() != null);
Contract.EndContractBlock();
@@ -2506,7 +2489,7 @@ namespace System
inArrayLength = inArray.Length;
if (offset > (inArrayLength - length))
- throw new ArgumentOutOfRangeException(nameof(offset), Environment.GetResourceString("ArgumentOutOfRange_OffsetLength"));
+ throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_OffsetLength);
if (inArrayLength == 0)
return String.Empty;
@@ -2521,7 +2504,7 @@ namespace System
fixed (byte* inData = &inArray[0])
{
int j = ConvertToBase64Array(outChars, inData, offset, length, insertLineBreaks);
- BCLDebug.Assert(returnString.Length == j, "returnString.Length == j");
+ Debug.Assert(returnString.Length == j, "returnString.Length == j");
return returnString;
}
}
@@ -2544,15 +2527,15 @@ namespace System
if (outArray == null)
throw new ArgumentNullException(nameof(outArray));
if (length < 0)
- throw new ArgumentOutOfRangeException(nameof(length), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_Index);
if (offsetIn < 0)
- throw new ArgumentOutOfRangeException(nameof(offsetIn), Environment.GetResourceString("ArgumentOutOfRange_GenericPositive"));
+ throw new ArgumentOutOfRangeException(nameof(offsetIn), SR.ArgumentOutOfRange_GenericPositive);
if (offsetOut < 0)
- throw new ArgumentOutOfRangeException(nameof(offsetOut), Environment.GetResourceString("ArgumentOutOfRange_GenericPositive"));
+ throw new ArgumentOutOfRangeException(nameof(offsetOut), SR.ArgumentOutOfRange_GenericPositive);
if (options < Base64FormattingOptions.None || options > Base64FormattingOptions.InsertLineBreaks)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)options));
+ throw new ArgumentException(string.Format(SR.Arg_EnumIllegalVal, (int)options));
}
Contract.Ensures(Contract.Result<int>() >= 0);
Contract.Ensures(Contract.Result<int>() <= outArray.Length);
@@ -2568,7 +2551,7 @@ namespace System
inArrayLength = inArray.Length;
if (offsetIn > (int)(inArrayLength - length))
- throw new ArgumentOutOfRangeException(nameof(offsetIn), Environment.GetResourceString("ArgumentOutOfRange_OffsetLength"));
+ throw new ArgumentOutOfRangeException(nameof(offsetIn), SR.ArgumentOutOfRange_OffsetLength);
if (inArrayLength == 0)
return 0;
@@ -2581,7 +2564,7 @@ namespace System
numElementsToCopy = ToBase64_CalculateAndValidateOutputLength(length, insertLineBreaks);
if (offsetOut > (int)(outArrayLength - numElementsToCopy))
- throw new ArgumentOutOfRangeException(nameof(offsetOut), Environment.GetResourceString("ArgumentOutOfRange_OffsetOut"));
+ throw new ArgumentOutOfRangeException(nameof(offsetOut), SR.ArgumentOutOfRange_OffsetOut);
fixed (char* outChars = &outArray[offsetOut])
{
@@ -2720,19 +2703,24 @@ namespace System
throw new ArgumentNullException(nameof(inArray));
if (length < 0)
- throw new ArgumentOutOfRangeException(nameof(length), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_Index);
if (offset < 0)
- throw new ArgumentOutOfRangeException(nameof(offset), Environment.GetResourceString("ArgumentOutOfRange_GenericPositive"));
+ throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_GenericPositive);
if (offset > inArray.Length - length)
- throw new ArgumentOutOfRangeException(nameof(offset), Environment.GetResourceString("ArgumentOutOfRange_OffsetLength"));
+ throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_OffsetLength);
Contract.EndContractBlock();
+ if (inArray.Length == 0)
+ {
+ return Array.Empty<byte>();
+ }
+
unsafe
{
- fixed (Char* inArrayPtr = inArray)
+ fixed (Char* inArrayPtr = &inArray[0])
{
return FromBase64CharPtr(inArrayPtr + offset, length);
}
@@ -2805,7 +2793,7 @@ namespace System
/// Otherwise return the number of result bytes actually produced.</returns>
private static unsafe Int32 FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength)
{
- // You may find this method weird to look at. It’s written for performance, not aesthetics.
+ // You may find this method weird to look at. It's written for performance, not aesthetics.
// You will find unrolled loops label jumps and bit manipulations.
const UInt32 intA = (UInt32)'A';
@@ -2887,7 +2875,7 @@ namespace System
// Other chars are illegal:
default:
- throw new FormatException(Environment.GetResourceString("Format_BadBase64Char"));
+ throw new FormatException(SR.Format_BadBase64Char);
}
}
@@ -2927,7 +2915,7 @@ namespace System
// The '=' did not complete a 4-group. The input must be bad:
if ((currBlockCodes & 0x80000000u) == 0u)
- throw new FormatException(Environment.GetResourceString("Format_BadBase64CharArrayLength"));
+ throw new FormatException(SR.Format_BadBase64CharArrayLength);
if ((int)(endDestPtr - destPtr) < 2) // Autch! We underestimated the output length!
return -1;
@@ -2957,7 +2945,7 @@ namespace System
// The '=' did not complete a 4-group. The input must be bad:
if ((currBlockCodes & 0x80000000u) == 0u)
- throw new FormatException(Environment.GetResourceString("Format_BadBase64CharArrayLength"));
+ throw new FormatException(SR.Format_BadBase64CharArrayLength);
if ((Int32)(endDestPtr - destPtr) < 1) // Autch! We underestimated the output length!
return -1;
@@ -2968,7 +2956,7 @@ namespace System
currBlockCodes = 0x000000FFu;
}
else // '=' is not ok at places other than the end:
- throw new FormatException(Environment.GetResourceString("Format_BadBase64Char"));
+ throw new FormatException(SR.Format_BadBase64Char);
}
// We get here either from above or by jumping out of the loop:
@@ -2976,7 +2964,7 @@ namespace System
// The last block of chars has less than 4 items
if (currBlockCodes != 0x000000FFu)
- throw new FormatException(Environment.GetResourceString("Format_BadBase64CharArrayLength"));
+ throw new FormatException(SR.Format_BadBase64CharArrayLength);
// Return how many bytes were actually recovered:
return (Int32)(destPtr - startDestPtr);
@@ -3032,7 +3020,7 @@ namespace System
else if (padding == 2)
padding = 1;
else
- throw new FormatException(Environment.GetResourceString("Format_BadBase64Char"));
+ throw new FormatException(SR.Format_BadBase64Char);
}
// Done:
diff --git a/src/mscorlib/src/System/CurrentTimeZone.cs b/src/mscorlib/shared/System/CurrentSystemTimeZone.cs
index d55df27a12..2d848397a9 100644
--- a/src/mscorlib/src/System/CurrentTimeZone.cs
+++ b/src/mscorlib/shared/System/CurrentSystemTimeZone.cs
@@ -29,12 +29,8 @@ namespace System
{
[Obsolete("System.CurrentSystemTimeZone has been deprecated. Please investigate the use of System.TimeZoneInfo.Local instead.")]
[Serializable]
- internal class CurrentSystemTimeZone : TimeZone
+ internal partial class CurrentSystemTimeZone : TimeZone
{
- // The per-year information is cached in in this instance value. As a result it can
- // be cleaned up by CultureInfo.ClearCachedData, which will clear the instance of this object
- private readonly Hashtable m_CachedDaylightChanges = new Hashtable();
-
// Standard offset in ticks to the Universal time if
// no daylight saving is in used.
// E.g. the offset for PST (Pacific Standard time) should be -8 * 60 * 60 * 1000 * 10000.
@@ -150,53 +146,42 @@ namespace System
{
if (year < 1 || year > 9999)
{
- throw new ArgumentOutOfRangeException(nameof(year), Environment.GetResourceString("ArgumentOutOfRange_Range", 1, 9999));
+ throw new ArgumentOutOfRangeException(nameof(year), SR.Format(SR.ArgumentOutOfRange_Range, 1, 9999));
}
- Contract.EndContractBlock();
- Object objYear = (Object)year;
+ return GetCachedDaylightChanges(year);
+ }
+
+ private static DaylightTime CreateDaylightChanges(int year)
+ {
+ DaylightTime currentDaylightChanges = null;
- if (!m_CachedDaylightChanges.Contains(objYear))
+ if (TimeZoneInfo.Local.SupportsDaylightSavingTime)
{
- DaylightTime currentDaylightChanges = null;
+ DateTime start;
+ DateTime end;
+ TimeSpan delta;
- if (TimeZoneInfo.Local.SupportsDaylightSavingTime)
+ foreach (var rule in TimeZoneInfo.Local.GetAdjustmentRules())
{
- DateTime start;
- DateTime end;
- TimeSpan delta;
-
- foreach (var rule in TimeZoneInfo.Local.GetAdjustmentRules())
+ if (rule.DateStart.Year <= year && rule.DateEnd.Year >= year && rule.DaylightDelta != TimeSpan.Zero)
{
- if (rule.DateStart.Year <= year && rule.DateEnd.Year >= year && rule.DaylightDelta != TimeSpan.Zero)
- {
- start = TimeZoneInfo.TransitionTimeToDateTime(year, rule.DaylightTransitionStart);
- end = TimeZoneInfo.TransitionTimeToDateTime(year, rule.DaylightTransitionEnd);
- delta = rule.DaylightDelta;
-
- currentDaylightChanges = new DaylightTime(start, end, delta);
- break;
- }
- }
- }
+ start = TimeZoneInfo.TransitionTimeToDateTime(year, rule.DaylightTransitionStart);
+ end = TimeZoneInfo.TransitionTimeToDateTime(year, rule.DaylightTransitionEnd);
+ delta = rule.DaylightDelta;
- if (currentDaylightChanges == null)
- {
- currentDaylightChanges = new DaylightTime(DateTime.MinValue, DateTime.MinValue, TimeSpan.Zero);
- }
-
- lock (m_CachedDaylightChanges)
- {
- if (!m_CachedDaylightChanges.Contains(objYear))
- {
- m_CachedDaylightChanges.Add(objYear, currentDaylightChanges);
+ currentDaylightChanges = new DaylightTime(start, end, delta);
+ break;
}
}
}
- DaylightTime result = (DaylightTime)m_CachedDaylightChanges[objYear];
+ if (currentDaylightChanges == null)
+ {
+ currentDaylightChanges = new DaylightTime(DateTime.MinValue, DateTime.MinValue, TimeSpan.Zero);
+ }
- return result;
+ return currentDaylightChanges;
}
public override TimeSpan GetUtcOffset(DateTime time)
diff --git a/src/mscorlib/shared/System/DBNull.cs b/src/mscorlib/shared/System/DBNull.cs
new file mode 100644
index 0000000000..486eb72f2a
--- /dev/null
+++ b/src/mscorlib/shared/System/DBNull.cs
@@ -0,0 +1,119 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.Serialization;
+
+namespace System
+{
+ [Serializable]
+ public sealed class DBNull : ISerializable, IConvertible
+ {
+ private DBNull()
+ {
+ }
+
+ private DBNull(SerializationInfo info, StreamingContext context)
+ {
+ throw new NotSupportedException(SR.NotSupported_DBNullSerial);
+ }
+
+ public static readonly DBNull Value = new DBNull();
+
+ public void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ UnitySerializationHolder.GetUnitySerializationInfo(info, UnitySerializationHolder.NullUnity, null, null);
+ }
+
+ public override string ToString()
+ {
+ return string.Empty;
+ }
+
+ public string ToString(IFormatProvider provider)
+ {
+ return string.Empty;
+ }
+
+ public TypeCode GetTypeCode()
+ {
+ return TypeCode.DBNull;
+ }
+
+ bool IConvertible.ToBoolean(IFormatProvider provider)
+ {
+ throw new InvalidCastException(SR.InvalidCast_FromDBNull);
+ }
+
+ char IConvertible.ToChar(IFormatProvider provider)
+ {
+ throw new InvalidCastException(SR.InvalidCast_FromDBNull);
+ }
+
+ sbyte IConvertible.ToSByte(IFormatProvider provider)
+ {
+ throw new InvalidCastException(SR.InvalidCast_FromDBNull);
+ }
+
+ byte IConvertible.ToByte(IFormatProvider provider)
+ {
+ throw new InvalidCastException(SR.InvalidCast_FromDBNull);
+ }
+
+ short IConvertible.ToInt16(IFormatProvider provider)
+ {
+ throw new InvalidCastException(SR.InvalidCast_FromDBNull);
+ }
+
+ ushort IConvertible.ToUInt16(IFormatProvider provider)
+ {
+ throw new InvalidCastException(SR.InvalidCast_FromDBNull);
+ }
+
+ int IConvertible.ToInt32(IFormatProvider provider)
+ {
+ throw new InvalidCastException(SR.InvalidCast_FromDBNull);
+ }
+
+ uint IConvertible.ToUInt32(IFormatProvider provider)
+ {
+ throw new InvalidCastException(SR.InvalidCast_FromDBNull);
+ }
+
+ long IConvertible.ToInt64(IFormatProvider provider)
+ {
+ throw new InvalidCastException(SR.InvalidCast_FromDBNull);
+ }
+
+ ulong IConvertible.ToUInt64(IFormatProvider provider)
+ {
+ throw new InvalidCastException(SR.InvalidCast_FromDBNull);
+ }
+
+ float IConvertible.ToSingle(IFormatProvider provider)
+ {
+ throw new InvalidCastException(SR.InvalidCast_FromDBNull);
+ }
+
+ double IConvertible.ToDouble(IFormatProvider provider)
+ {
+ throw new InvalidCastException(SR.InvalidCast_FromDBNull);
+ }
+
+ decimal IConvertible.ToDecimal(IFormatProvider provider)
+ {
+ throw new InvalidCastException(SR.InvalidCast_FromDBNull);
+ }
+
+ DateTime IConvertible.ToDateTime(IFormatProvider provider)
+ {
+ throw new InvalidCastException(SR.InvalidCast_FromDBNull);
+ }
+
+ object IConvertible.ToType(Type type, IFormatProvider provider)
+ {
+ return Convert.DefaultToType((IConvertible)this, type, provider);
+ }
+ }
+}
+
diff --git a/src/mscorlib/src/System/DateTime.cs b/src/mscorlib/shared/System/DateTime.cs
index 360aceee90..ddb72da77d 100644
--- a/src/mscorlib/src/System/DateTime.cs
+++ b/src/mscorlib/shared/System/DateTime.cs
@@ -2,20 +2,22 @@
// 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.Diagnostics;
+using System.Diagnostics.Contracts;
+using System.Threading;
+using System.Globalization;
+using System.Runtime;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+using System.Runtime.Serialization;
+using System.Runtime.Versioning;
+using System.Security;
+using CultureInfo = System.Globalization.CultureInfo;
+using Calendar = System.Globalization.Calendar;
+
namespace System
{
- using System;
- using System.Threading;
- using System.Globalization;
- using System.Runtime;
- using System.Runtime.InteropServices;
- using System.Runtime.CompilerServices;
- using System.Runtime.Serialization;
- using System.Runtime.Versioning;
- using System.Security;
- using System.Diagnostics.Contracts;
- using CultureInfo = System.Globalization.CultureInfo;
- using Calendar = System.Globalization.Calendar;
// This value type represents a date and time. Every DateTime
// object has a private field (Ticks) of type Int64 that stores the
@@ -52,7 +54,7 @@ namespace System
//
[StructLayout(LayoutKind.Auto)]
[Serializable]
- public struct DateTime : IComparable, IFormattable, IConvertible, IComparable<DateTime>, IEquatable<DateTime>, ISerializable
+ public partial struct DateTime : IComparable, IFormattable, IConvertible, IComparable<DateTime>, IEquatable<DateTime>, ISerializable
{
// Number of 100ns ticks per time unit
private const long TicksPerMillisecond = 10000;
@@ -89,6 +91,7 @@ namespace System
internal const long MaxTicks = DaysTo10000 * TicksPerDay - 1;
private const long MaxMillis = (long)DaysTo10000 * MillisPerDay;
+ private const long TicksTo1970 = DaysTo1970 * TicksPerDay;
private const long FileTimeOffset = DaysTo1601 * TicksPerDay;
private const long DoubleDateOffset = DaysTo1899 * TicksPerDay;
// The minimum OA date is 0100/01/01 (Note it's year 100).
@@ -104,9 +107,9 @@ namespace System
private const int DatePartMonth = 2;
private const int DatePartDay = 3;
- private static readonly int[] DaysToMonth365 = {
+ private static readonly int[] s_daysToMonth365 = {
0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365};
- private static readonly int[] DaysToMonth366 = {
+ private static readonly int[] s_daysToMonth366 = {
0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366};
public static readonly DateTime MinValue = new DateTime(MinTicks, DateTimeKind.Unspecified);
@@ -123,7 +126,7 @@ namespace System
private const Int32 KindShift = 62;
private const String TicksField = "ticks";
- private const String DateDataField = "dateData";
+ private const String DateDataField = "_dateData";
// The data is stored as an unsigned 64-bit integeter
// Bits 01-62: The value of 100-nanosecond ticks where 0 represents 1/1/0001 12:00am, up until the value
@@ -133,7 +136,7 @@ namespace System
// savings time hour and it is in daylight savings time. This allows distinction of these
// otherwise ambiguous local times and prevents data loss when round tripping from Local to
// UTC time.
- private UInt64 dateData;
+ private UInt64 _dateData;
// Constructs a DateTime from a tick count. The ticks
// argument specifies the date as the number of 100-nanosecond intervals
@@ -142,39 +145,39 @@ namespace System
public DateTime(long ticks)
{
if (ticks < MinTicks || ticks > MaxTicks)
- throw new ArgumentOutOfRangeException(nameof(ticks), Environment.GetResourceString("ArgumentOutOfRange_DateTimeBadTicks"));
+ throw new ArgumentOutOfRangeException(nameof(ticks), SR.ArgumentOutOfRange_DateTimeBadTicks);
Contract.EndContractBlock();
- dateData = (UInt64)ticks;
+ _dateData = (UInt64)ticks;
}
private DateTime(UInt64 dateData)
{
- this.dateData = dateData;
+ this._dateData = dateData;
}
public DateTime(long ticks, DateTimeKind kind)
{
if (ticks < MinTicks || ticks > MaxTicks)
{
- throw new ArgumentOutOfRangeException(nameof(ticks), Environment.GetResourceString("ArgumentOutOfRange_DateTimeBadTicks"));
+ throw new ArgumentOutOfRangeException(nameof(ticks), SR.ArgumentOutOfRange_DateTimeBadTicks);
}
if (kind < DateTimeKind.Unspecified || kind > DateTimeKind.Local)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidDateTimeKind"), nameof(kind));
+ throw new ArgumentException(SR.Argument_InvalidDateTimeKind, nameof(kind));
}
Contract.EndContractBlock();
- dateData = ((UInt64)ticks | ((UInt64)kind << KindShift));
+ _dateData = ((UInt64)ticks | ((UInt64)kind << KindShift));
}
internal DateTime(long ticks, DateTimeKind kind, Boolean isAmbiguousDst)
{
if (ticks < MinTicks || ticks > MaxTicks)
{
- throw new ArgumentOutOfRangeException(nameof(ticks), Environment.GetResourceString("ArgumentOutOfRange_DateTimeBadTicks"));
+ throw new ArgumentOutOfRangeException(nameof(ticks), SR.ArgumentOutOfRange_DateTimeBadTicks);
}
- Contract.Requires(kind == DateTimeKind.Local, "Internal Constructor is for local times only");
+ Debug.Assert(kind == DateTimeKind.Local, "Internal Constructor is for local times only");
Contract.EndContractBlock();
- dateData = ((UInt64)ticks | (isAmbiguousDst ? KindLocalAmbiguousDst : KindLocal));
+ _dateData = ((UInt64)ticks | (isAmbiguousDst ? KindLocalAmbiguousDst : KindLocal));
}
// Constructs a DateTime from a given year, month, and day. The
@@ -182,7 +185,7 @@ namespace System
//
public DateTime(int year, int month, int day)
{
- dateData = (UInt64)DateToTicks(year, month, day);
+ _dateData = (UInt64)DateToTicks(year, month, day);
}
// Constructs a DateTime from a given year, month, and day for
@@ -199,18 +202,18 @@ namespace System
//
public DateTime(int year, int month, int day, int hour, int minute, int second)
{
- dateData = (UInt64)(DateToTicks(year, month, day) + TimeToTicks(hour, minute, second));
+ _dateData = (UInt64)(DateToTicks(year, month, day) + TimeToTicks(hour, minute, second));
}
public DateTime(int year, int month, int day, int hour, int minute, int second, DateTimeKind kind)
{
if (kind < DateTimeKind.Unspecified || kind > DateTimeKind.Local)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidDateTimeKind"), nameof(kind));
+ throw new ArgumentException(SR.Argument_InvalidDateTimeKind, nameof(kind));
}
Contract.EndContractBlock();
Int64 ticks = DateToTicks(year, month, day) + TimeToTicks(hour, minute, second);
- dateData = ((UInt64)ticks | ((UInt64)kind << KindShift));
+ _dateData = ((UInt64)ticks | ((UInt64)kind << KindShift));
}
// Constructs a DateTime from a given year, month, day, hour,
@@ -221,7 +224,7 @@ namespace System
if (calendar == null)
throw new ArgumentNullException(nameof(calendar));
Contract.EndContractBlock();
- dateData = (UInt64)calendar.ToDateTime(year, month, day, hour, minute, second, 0).Ticks;
+ _dateData = (UInt64)calendar.ToDateTime(year, month, day, hour, minute, second, 0).Ticks;
}
// Constructs a DateTime from a given year, month, day, hour,
@@ -231,32 +234,32 @@ namespace System
{
if (millisecond < 0 || millisecond >= MillisPerSecond)
{
- throw new ArgumentOutOfRangeException(nameof(millisecond), Environment.GetResourceString("ArgumentOutOfRange_Range", 0, MillisPerSecond - 1));
+ throw new ArgumentOutOfRangeException(nameof(millisecond), SR.Format(SR.ArgumentOutOfRange_Range, 0, MillisPerSecond - 1));
}
Contract.EndContractBlock();
Int64 ticks = DateToTicks(year, month, day) + TimeToTicks(hour, minute, second);
ticks += millisecond * TicksPerMillisecond;
if (ticks < MinTicks || ticks > MaxTicks)
- throw new ArgumentException(Environment.GetResourceString("Arg_DateTimeRange"));
- dateData = (UInt64)ticks;
+ throw new ArgumentException(SR.Arg_DateTimeRange);
+ _dateData = (UInt64)ticks;
}
public DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, DateTimeKind kind)
{
if (millisecond < 0 || millisecond >= MillisPerSecond)
{
- throw new ArgumentOutOfRangeException(nameof(millisecond), Environment.GetResourceString("ArgumentOutOfRange_Range", 0, MillisPerSecond - 1));
+ throw new ArgumentOutOfRangeException(nameof(millisecond), SR.Format(SR.ArgumentOutOfRange_Range, 0, MillisPerSecond - 1));
}
if (kind < DateTimeKind.Unspecified || kind > DateTimeKind.Local)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidDateTimeKind"), nameof(kind));
+ throw new ArgumentException(SR.Argument_InvalidDateTimeKind, nameof(kind));
}
Contract.EndContractBlock();
Int64 ticks = DateToTicks(year, month, day) + TimeToTicks(hour, minute, second);
ticks += millisecond * TicksPerMillisecond;
if (ticks < MinTicks || ticks > MaxTicks)
- throw new ArgumentException(Environment.GetResourceString("Arg_DateTimeRange"));
- dateData = ((UInt64)ticks | ((UInt64)kind << KindShift));
+ throw new ArgumentException(SR.Arg_DateTimeRange);
+ _dateData = ((UInt64)ticks | ((UInt64)kind << KindShift));
}
// Constructs a DateTime from a given year, month, day, hour,
@@ -268,14 +271,14 @@ namespace System
throw new ArgumentNullException(nameof(calendar));
if (millisecond < 0 || millisecond >= MillisPerSecond)
{
- throw new ArgumentOutOfRangeException(nameof(millisecond), Environment.GetResourceString("ArgumentOutOfRange_Range", 0, MillisPerSecond - 1));
+ throw new ArgumentOutOfRangeException(nameof(millisecond), SR.Format(SR.ArgumentOutOfRange_Range, 0, MillisPerSecond - 1));
}
Contract.EndContractBlock();
Int64 ticks = calendar.ToDateTime(year, month, day, hour, minute, second, 0).Ticks;
ticks += millisecond * TicksPerMillisecond;
if (ticks < MinTicks || ticks > MaxTicks)
- throw new ArgumentException(Environment.GetResourceString("Arg_DateTimeRange"));
- dateData = (UInt64)ticks;
+ throw new ArgumentException(SR.Arg_DateTimeRange);
+ _dateData = (UInt64)ticks;
}
public DateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, Calendar calendar, DateTimeKind kind)
@@ -284,18 +287,18 @@ namespace System
throw new ArgumentNullException(nameof(calendar));
if (millisecond < 0 || millisecond >= MillisPerSecond)
{
- throw new ArgumentOutOfRangeException(nameof(millisecond), Environment.GetResourceString("ArgumentOutOfRange_Range", 0, MillisPerSecond - 1));
+ throw new ArgumentOutOfRangeException(nameof(millisecond), SR.Format(SR.ArgumentOutOfRange_Range, 0, MillisPerSecond - 1));
}
if (kind < DateTimeKind.Unspecified || kind > DateTimeKind.Local)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidDateTimeKind"), nameof(kind));
+ throw new ArgumentException(SR.Argument_InvalidDateTimeKind, nameof(kind));
}
Contract.EndContractBlock();
Int64 ticks = calendar.ToDateTime(year, month, day, hour, minute, second, 0).Ticks;
ticks += millisecond * TicksPerMillisecond;
if (ticks < MinTicks || ticks > MaxTicks)
- throw new ArgumentException(Environment.GetResourceString("Arg_DateTimeRange"));
- dateData = ((UInt64)ticks | ((UInt64)kind << KindShift));
+ throw new ArgumentException(SR.Arg_DateTimeRange);
+ _dateData = ((UInt64)ticks | ((UInt64)kind << KindShift));
}
private DateTime(SerializationInfo info, StreamingContext context)
@@ -331,20 +334,20 @@ namespace System
}
if (foundDateData)
{
- dateData = serializedDateData;
+ _dateData = serializedDateData;
}
else if (foundTicks)
{
- dateData = (UInt64)serializedTicks;
+ _dateData = (UInt64)serializedTicks;
}
else
{
- throw new SerializationException(Environment.GetResourceString("Serialization_MissingDateTimeData"));
+ throw new SerializationException(SR.Serialization_MissingDateTimeData);
}
Int64 ticks = InternalTicks;
if (ticks < MinTicks || ticks > MaxTicks)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_DateTimeTicksOutOfRange"));
+ throw new SerializationException(SR.Serialization_DateTimeTicksOutOfRange);
}
}
@@ -354,7 +357,7 @@ namespace System
{
get
{
- return (Int64)(dateData & TicksMask);
+ return (Int64)(_dateData & TicksMask);
}
}
@@ -362,7 +365,7 @@ namespace System
{
get
{
- return (dateData & FlagsMask);
+ return (_dateData & FlagsMask);
}
}
@@ -380,7 +383,7 @@ namespace System
{
long millis = (long)(value * scale + (value >= 0 ? 0.5 : -0.5));
if (millis <= -MaxMillis || millis >= MaxMillis)
- throw new ArgumentOutOfRangeException(nameof(value), Environment.GetResourceString("ArgumentOutOfRange_AddValue"));
+ throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_AddValue);
return AddTicks(millis * TicksPerMillisecond);
}
@@ -447,7 +450,7 @@ namespace System
//
public DateTime AddMonths(int months)
{
- if (months < -120000 || months > 120000) throw new ArgumentOutOfRangeException(nameof(months), Environment.GetResourceString("ArgumentOutOfRange_DateTimeBadMonths"));
+ if (months < -120000 || months > 120000) throw new ArgumentOutOfRangeException(nameof(months), SR.ArgumentOutOfRange_DateTimeBadMonths);
Contract.EndContractBlock();
int y = GetDatePart(DatePartYear);
int m = GetDatePart(DatePartMonth);
@@ -465,7 +468,7 @@ namespace System
}
if (y < 1 || y > 9999)
{
- throw new ArgumentOutOfRangeException(nameof(months), Environment.GetResourceString("ArgumentOutOfRange_DateArithmetic"));
+ throw new ArgumentOutOfRangeException(nameof(months), SR.ArgumentOutOfRange_DateArithmetic);
}
int days = DaysInMonth(y, m);
if (d > days) d = days;
@@ -492,7 +495,7 @@ namespace System
long ticks = InternalTicks;
if (value > MaxTicks - ticks || value < MinTicks - ticks)
{
- throw new ArgumentOutOfRangeException(nameof(value), Environment.GetResourceString("ArgumentOutOfRange_DateArithmetic"));
+ throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_DateArithmetic);
}
return new DateTime((UInt64)(ticks + value) | InternalKind);
}
@@ -511,7 +514,7 @@ namespace System
{
// DateTimeOffset.AddYears(int years) is implemented on top of DateTime.AddYears(int value). Use the more appropriate
// parameter name out of the two for the exception.
- throw new ArgumentOutOfRangeException("years", Environment.GetResourceString("ArgumentOutOfRange_DateTimeBadYears"));
+ throw new ArgumentOutOfRangeException("years", SR.ArgumentOutOfRange_DateTimeBadYears);
}
Contract.EndContractBlock();
return AddMonths(value * 12);
@@ -540,7 +543,7 @@ namespace System
if (value == null) return 1;
if (!(value is DateTime))
{
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeDateTime"));
+ throw new ArgumentException(SR.Arg_MustBeDateTime);
}
return Compare(this, (DateTime)value);
@@ -557,7 +560,7 @@ namespace System
{
if (year >= 1 && year <= 9999 && month >= 1 && month <= 12)
{
- int[] days = IsLeapYear(year) ? DaysToMonth366 : DaysToMonth365;
+ int[] days = IsLeapYear(year) ? s_daysToMonth366 : s_daysToMonth365;
if (day >= 1 && day <= days[month] - days[month - 1])
{
int y = year - 1;
@@ -565,7 +568,7 @@ namespace System
return n * TicksPerDay;
}
}
- throw new ArgumentOutOfRangeException(null, Environment.GetResourceString("ArgumentOutOfRange_BadYearMonthDay"));
+ throw new ArgumentOutOfRangeException(null, SR.ArgumentOutOfRange_BadYearMonthDay);
}
// Return the tick count corresponding to the given hour, minute, second.
@@ -578,7 +581,7 @@ namespace System
{
return (TimeSpan.TimeToTicks(hour, minute, second));
}
- throw new ArgumentOutOfRangeException(null, Environment.GetResourceString("ArgumentOutOfRange_BadHourMinuteSecond"));
+ throw new ArgumentOutOfRangeException(null, SR.ArgumentOutOfRange_BadHourMinuteSecond);
}
// Returns the number of days in the month given by the year and
@@ -586,10 +589,10 @@ namespace System
//
public static int DaysInMonth(int year, int month)
{
- if (month < 1 || month > 12) throw new ArgumentOutOfRangeException(nameof(month), Environment.GetResourceString("ArgumentOutOfRange_Month"));
+ if (month < 1 || month > 12) throw new ArgumentOutOfRangeException(nameof(month), SR.ArgumentOutOfRange_Month);
Contract.EndContractBlock();
// IsLeapYear checks the year argument
- int[] days = IsLeapYear(year) ? DaysToMonth366 : DaysToMonth365;
+ int[] days = IsLeapYear(year) ? s_daysToMonth366 : s_daysToMonth365;
return days[month] - days[month - 1];
}
@@ -599,7 +602,7 @@ namespace System
{
// The check done this way will take care of NaN
if (!(value < OADateMaxAsDouble) || !(value > OADateMinAsDouble))
- throw new ArgumentException(Environment.GetResourceString("Arg_OleAutDateInvalid"));
+ throw new ArgumentException(SR.Arg_OleAutDateInvalid);
// Conversion to long will not cause an overflow here, as at this point the "value" is in between OADateMinAsDouble and OADateMaxAsDouble
long millis = (long)(value * MillisPerDay + (value >= 0 ? 0.5 : -0.5));
@@ -613,7 +616,7 @@ namespace System
millis += DoubleDateOffset / TicksPerMillisecond;
- if (millis < 0 || millis >= MaxMillis) throw new ArgumentException(Environment.GetResourceString("Arg_OleAutDateScale"));
+ if (millis < 0 || millis >= MaxMillis) throw new ArgumentException(SR.Arg_OleAutDateScale);
return millis * TicksPerMillisecond;
}
@@ -688,7 +691,7 @@ namespace System
}
if (ticks < MinTicks || ticks > MaxTicks)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_DateTimeBadBinaryData"), nameof(dateData));
+ throw new ArgumentException(SR.Argument_DateTimeBadBinaryData, nameof(dateData));
}
return new DateTime(ticks, DateTimeKind.Local, isAmbiguousLocalDst);
}
@@ -704,7 +707,7 @@ namespace System
{
Int64 ticks = dateData & (Int64)TicksMask;
if (ticks < MinTicks || ticks > MaxTicks)
- throw new ArgumentException(Environment.GetResourceString("Argument_DateTimeBadBinaryData"), nameof(dateData));
+ throw new ArgumentException(SR.Argument_DateTimeBadBinaryData, nameof(dateData));
return new DateTime((UInt64)dateData);
}
@@ -721,7 +724,7 @@ namespace System
{
if (fileTime < 0 || fileTime > MaxTicks - FileTimeOffset)
{
- throw new ArgumentOutOfRangeException(nameof(fileTime), Environment.GetResourceString("ArgumentOutOfRange_FileTimeInvalid"));
+ throw new ArgumentOutOfRangeException(nameof(fileTime), SR.ArgumentOutOfRange_FileTimeInvalid);
}
Contract.EndContractBlock();
@@ -747,7 +750,7 @@ namespace System
// Serialize both the old and the new format
info.AddValue(TicksField, InternalTicks);
- info.AddValue(DateDataField, dateData);
+ info.AddValue(DateDataField, _dateData);
}
public Boolean IsDaylightSavingTime()
@@ -789,7 +792,7 @@ namespace System
}
else
{
- return (Int64)dateData;
+ return (Int64)_dateData;
}
}
@@ -843,7 +846,7 @@ namespace System
// Leap year calculation looks different from IsLeapYear since y1, y4,
// and y100 are relative to year 1, not year 0
bool leapYear = y1 == 3 && (y4 != 24 || y100 == 3);
- int[] days = leapYear ? DaysToMonth366 : DaysToMonth365;
+ int[] days = leapYear ? s_daysToMonth366 : s_daysToMonth365;
// All months have less than 32 days, so n >> 5 is a good conservative
// estimate for the month
int m = (n >> 5) + 1;
@@ -1005,25 +1008,6 @@ namespace System
}
}
- public static DateTime UtcNow
- {
- get
- {
- Contract.Ensures(Contract.Result<DateTime>().Kind == DateTimeKind.Utc);
- // following code is tuned for speed. Don't change it without running benchmark.
- long ticks = 0;
- ticks = GetSystemTimeAsFileTime();
-
- return new DateTime(((UInt64)(ticks + FileTimeOffset)) | KindUtc);
- }
- }
-
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern long GetSystemTimeAsFileTime();
-
-
-
// Returns the second part of this DateTime. The returned value is
// an integer between 0 and 59.
//
@@ -1091,7 +1075,7 @@ namespace System
{
if (year < 1 || year > 9999)
{
- throw new ArgumentOutOfRangeException(nameof(year), Environment.GetResourceString("ArgumentOutOfRange_Year"));
+ throw new ArgumentOutOfRangeException(nameof(year), SR.ArgumentOutOfRange_Year);
}
Contract.EndContractBlock();
return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
@@ -1157,7 +1141,7 @@ namespace System
long valueTicks = value._ticks;
if (ticks - MinTicks < valueTicks || ticks - MaxTicks > valueTicks)
{
- throw new ArgumentOutOfRangeException(nameof(value), Environment.GetResourceString("ArgumentOutOfRange_DateArithmetic"));
+ throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_DateArithmetic);
}
return new DateTime((UInt64)(ticks - valueTicks) | InternalKind);
}
@@ -1170,7 +1154,7 @@ namespace System
if (value < TicksPerDay) // This is a fix for VB. They want the default day to be 1/1/0001 rathar then 12/30/1899.
value += DoubleDateOffset; // We could have moved this fix down but we would like to keep the bounds check.
if (value < OADateMinAsTicks)
- throw new OverflowException(Environment.GetResourceString("Arg_OleAutDateInvalid"));
+ throw new OverflowException(SR.Arg_OleAutDateInvalid);
// Currently, our max date == OA's max date (12/31/9999), so we don't
// need an overflow check in that direction.
long millis = (value - DoubleDateOffset) / TicksPerMillisecond;
@@ -1202,7 +1186,7 @@ namespace System
ticks -= FileTimeOffset;
if (ticks < 0)
{
- throw new ArgumentOutOfRangeException(null, Environment.GetResourceString("ArgumentOutOfRange_FileTimeInvalid"));
+ throw new ArgumentOutOfRangeException(null, SR.ArgumentOutOfRange_FileTimeInvalid);
}
return ticks;
}
@@ -1225,14 +1209,14 @@ namespace System
if (tick > DateTime.MaxTicks)
{
if (throwOnOverflow)
- throw new ArgumentException(Environment.GetResourceString("Arg_ArgumentOutOfRangeException"));
+ throw new ArgumentException(SR.Arg_ArgumentOutOfRangeException);
else
return new DateTime(DateTime.MaxTicks, DateTimeKind.Local);
}
if (tick < DateTime.MinTicks)
{
if (throwOnOverflow)
- throw new ArgumentException(Environment.GetResourceString("Arg_ArgumentOutOfRangeException"));
+ throw new ArgumentException(SR.Arg_ArgumentOutOfRangeException);
else
return new DateTime(DateTime.MinTicks, DateTimeKind.Local);
}
@@ -1321,7 +1305,7 @@ namespace System
long valueTicks = t._ticks;
if (valueTicks > MaxTicks - ticks || valueTicks < MinTicks - ticks)
{
- throw new ArgumentOutOfRangeException(nameof(t), Environment.GetResourceString("ArgumentOutOfRange_DateArithmetic"));
+ throw new ArgumentOutOfRangeException(nameof(t), SR.ArgumentOutOfRange_DateArithmetic);
}
return new DateTime((UInt64)(ticks + valueTicks) | d.InternalKind);
}
@@ -1332,7 +1316,7 @@ namespace System
long valueTicks = t._ticks;
if (ticks - MinTicks < valueTicks || ticks - MaxTicks > valueTicks)
{
- throw new ArgumentOutOfRangeException(nameof(t), Environment.GetResourceString("ArgumentOutOfRange_DateArithmetic"));
+ throw new ArgumentOutOfRangeException(nameof(t), SR.ArgumentOutOfRange_DateArithmetic);
}
return new DateTime((UInt64)(ticks - valueTicks) | d.InternalKind);
}
@@ -1420,91 +1404,76 @@ namespace System
}
- /// <internalonly/>
bool IConvertible.ToBoolean(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "DateTime", "Boolean"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "DateTime", "Boolean"));
}
- /// <internalonly/>
char IConvertible.ToChar(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "DateTime", "Char"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "DateTime", "Char"));
}
- /// <internalonly/>
sbyte IConvertible.ToSByte(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "DateTime", "SByte"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "DateTime", "SByte"));
}
- /// <internalonly/>
byte IConvertible.ToByte(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "DateTime", "Byte"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "DateTime", "Byte"));
}
- /// <internalonly/>
short IConvertible.ToInt16(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "DateTime", "Int16"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "DateTime", "Int16"));
}
- /// <internalonly/>
ushort IConvertible.ToUInt16(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "DateTime", "UInt16"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "DateTime", "UInt16"));
}
- /// <internalonly/>
int IConvertible.ToInt32(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "DateTime", "Int32"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "DateTime", "Int32"));
}
- /// <internalonly/>
uint IConvertible.ToUInt32(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "DateTime", "UInt32"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "DateTime", "UInt32"));
}
- /// <internalonly/>
long IConvertible.ToInt64(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "DateTime", "Int64"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "DateTime", "Int64"));
}
- /// <internalonly/>
ulong IConvertible.ToUInt64(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "DateTime", "UInt64"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "DateTime", "UInt64"));
}
- /// <internalonly/>
float IConvertible.ToSingle(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "DateTime", "Single"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "DateTime", "Single"));
}
- /// <internalonly/>
double IConvertible.ToDouble(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "DateTime", "Double"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "DateTime", "Double"));
}
- /// <internalonly/>
Decimal IConvertible.ToDecimal(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "DateTime", "Decimal"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "DateTime", "Decimal"));
}
- /// <internalonly/>
DateTime IConvertible.ToDateTime(IFormatProvider provider)
{
return this;
}
- /// <internalonly/>
Object IConvertible.ToType(Type type, IFormatProvider provider)
{
return Convert.DefaultToType((IConvertible)this, type, provider);
@@ -1520,7 +1489,7 @@ namespace System
{
return false;
}
- int[] days = IsLeapYear(year) ? DaysToMonth366 : DaysToMonth365;
+ int[] days = IsLeapYear(year) ? s_daysToMonth366 : s_daysToMonth365;
if (day < 1 || day > days[month] - days[month - 1])
{
return false;
diff --git a/src/mscorlib/src/System/DateTimeOffset.cs b/src/mscorlib/shared/System/DateTimeOffset.cs
index 9f85edfe75..d5ccbd9195 100644
--- a/src/mscorlib/src/System/DateTimeOffset.cs
+++ b/src/mscorlib/shared/System/DateTimeOffset.cs
@@ -2,15 +2,10 @@
// 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.Threading;
+using System.Diagnostics;
using System.Globalization;
using System.Runtime.InteropServices;
-using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
namespace System
{
@@ -35,8 +30,7 @@ namespace System
[StructLayout(LayoutKind.Auto)]
[Serializable]
- public struct DateTimeOffset : IComparable, IFormattable,
- IComparable<DateTimeOffset>, IEquatable<DateTimeOffset>, ISerializable, IDeserializationCallback
+ public struct DateTimeOffset : IComparable, IFormattable, IComparable<DateTimeOffset>, IEquatable<DateTimeOffset>, ISerializable, IDeserializationCallback
{
// Constants
internal const Int64 MaxOffset = TimeSpan.TicksPerHour * 14;
@@ -54,18 +48,18 @@ namespace System
public static readonly DateTimeOffset MaxValue = new DateTimeOffset(DateTime.MaxTicks, TimeSpan.Zero);
// Instance Fields
- private DateTime m_dateTime;
- private Int16 m_offsetMinutes;
+ private DateTime _dateTime;
+ private Int16 _offsetMinutes;
// Constructors
// Constructs a DateTimeOffset from a tick count and offset
public DateTimeOffset(long ticks, TimeSpan offset)
{
- m_offsetMinutes = ValidateOffset(offset);
+ _offsetMinutes = ValidateOffset(offset);
// Let the DateTime constructor do the range checks
DateTime dateTime = new DateTime(ticks);
- m_dateTime = ValidateDate(dateTime, offset);
+ _dateTime = ValidateDate(dateTime, offset);
}
// Constructs a DateTimeOffset from a DateTime. For Local and Unspecified kinds,
@@ -82,8 +76,8 @@ namespace System
{
offset = new TimeSpan(0);
}
- m_offsetMinutes = ValidateOffset(offset);
- m_dateTime = ValidateDate(dateTime, offset);
+ _offsetMinutes = ValidateOffset(offset);
+ _dateTime = ValidateDate(dateTime, offset);
}
// Constructs a DateTimeOffset from a DateTime. And an offset. Always makes the clock time
@@ -95,43 +89,42 @@ namespace System
{
if (offset != TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime))
{
- throw new ArgumentException(Environment.GetResourceString("Argument_OffsetLocalMismatch"), nameof(offset));
+ throw new ArgumentException(SR.Argument_OffsetLocalMismatch, nameof(offset));
}
}
else if (dateTime.Kind == DateTimeKind.Utc)
{
if (offset != TimeSpan.Zero)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_OffsetUtcMismatch"), nameof(offset));
+ throw new ArgumentException(SR.Argument_OffsetUtcMismatch, nameof(offset));
}
}
- m_offsetMinutes = ValidateOffset(offset);
- m_dateTime = ValidateDate(dateTime, offset);
+ _offsetMinutes = ValidateOffset(offset);
+ _dateTime = ValidateDate(dateTime, offset);
}
// Constructs a DateTimeOffset from a given year, month, day, hour,
// minute, second and offset.
public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, TimeSpan offset)
{
- m_offsetMinutes = ValidateOffset(offset);
- m_dateTime = ValidateDate(new DateTime(year, month, day, hour, minute, second), offset);
+ _offsetMinutes = ValidateOffset(offset);
+ _dateTime = ValidateDate(new DateTime(year, month, day, hour, minute, second), offset);
}
// Constructs a DateTimeOffset from a given year, month, day, hour,
// minute, second, millsecond and offset
public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, TimeSpan offset)
{
- m_offsetMinutes = ValidateOffset(offset);
- m_dateTime = ValidateDate(new DateTime(year, month, day, hour, minute, second, millisecond), offset);
+ _offsetMinutes = ValidateOffset(offset);
+ _dateTime = ValidateDate(new DateTime(year, month, day, hour, minute, second, millisecond), offset);
}
-
// Constructs a DateTimeOffset from a given year, month, day, hour,
// minute, second, millsecond, Calendar and offset.
public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, Calendar calendar, TimeSpan offset)
{
- m_offsetMinutes = ValidateOffset(offset);
- m_dateTime = ValidateDate(new DateTime(year, month, day, hour, minute, second, millisecond, calendar), offset);
+ _offsetMinutes = ValidateOffset(offset);
+ _dateTime = ValidateDate(new DateTime(year, month, day, hour, minute, second, millisecond, calendar), offset);
}
// Returns a DateTimeOffset representing the current date and time. The
@@ -166,20 +159,16 @@ namespace System
public DateTime UtcDateTime
{
- [Pure]
get
{
- Contract.Ensures(Contract.Result<DateTime>().Kind == DateTimeKind.Utc);
- return DateTime.SpecifyKind(m_dateTime, DateTimeKind.Utc);
+ return DateTime.SpecifyKind(_dateTime, DateTimeKind.Utc);
}
}
public DateTime LocalDateTime
{
- [Pure]
get
{
- Contract.Ensures(Contract.Result<DateTime>().Kind == DateTimeKind.Local);
return UtcDateTime.ToLocalTime();
}
}
@@ -188,7 +177,7 @@ namespace System
//
public DateTimeOffset ToOffset(TimeSpan offset)
{
- return new DateTimeOffset((m_dateTime + offset).Ticks, offset);
+ return new DateTimeOffset((_dateTime + offset).Ticks, offset);
}
@@ -201,7 +190,7 @@ namespace System
{
get
{
- return new DateTime((m_dateTime + Offset).Ticks, DateTimeKind.Unspecified);
+ return new DateTime((_dateTime + Offset).Ticks, DateTimeKind.Unspecified);
}
}
@@ -224,8 +213,6 @@ namespace System
{
get
{
- Contract.Ensures(Contract.Result<int>() >= 1);
- Contract.Ensures(Contract.Result<int>() <= 31);
return ClockDateTime.Day;
}
}
@@ -239,8 +226,6 @@ namespace System
{
get
{
- Contract.Ensures(Contract.Result<DayOfWeek>() >= DayOfWeek.Sunday);
- Contract.Ensures(Contract.Result<DayOfWeek>() <= DayOfWeek.Saturday);
return ClockDateTime.DayOfWeek;
}
}
@@ -252,8 +237,6 @@ namespace System
{
get
{
- Contract.Ensures(Contract.Result<int>() >= 1);
- Contract.Ensures(Contract.Result<int>() <= 366); // leap year
return ClockDateTime.DayOfYear;
}
}
@@ -265,8 +248,6 @@ namespace System
{
get
{
- Contract.Ensures(Contract.Result<int>() >= 0);
- Contract.Ensures(Contract.Result<int>() < 24);
return ClockDateTime.Hour;
}
}
@@ -279,8 +260,6 @@ namespace System
{
get
{
- Contract.Ensures(Contract.Result<int>() >= 0);
- Contract.Ensures(Contract.Result<int>() < 1000);
return ClockDateTime.Millisecond;
}
}
@@ -292,8 +271,6 @@ namespace System
{
get
{
- Contract.Ensures(Contract.Result<int>() >= 0);
- Contract.Ensures(Contract.Result<int>() < 60);
return ClockDateTime.Minute;
}
}
@@ -305,7 +282,6 @@ namespace System
{
get
{
- Contract.Ensures(Contract.Result<int>() >= 1);
return ClockDateTime.Month;
}
}
@@ -314,7 +290,7 @@ namespace System
{
get
{
- return new TimeSpan(0, m_offsetMinutes, 0);
+ return new TimeSpan(0, _offsetMinutes, 0);
}
}
@@ -325,8 +301,6 @@ namespace System
{
get
{
- Contract.Ensures(Contract.Result<int>() >= 0);
- Contract.Ensures(Contract.Result<int>() < 60);
return ClockDateTime.Second;
}
}
@@ -369,7 +343,6 @@ namespace System
{
get
{
- Contract.Ensures(Contract.Result<int>() >= 1 && Contract.Result<int>() <= 9999);
return ClockDateTime.Year;
}
}
@@ -482,7 +455,7 @@ namespace System
if (obj == null) return 1;
if (!(obj is DateTimeOffset))
{
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeDateTimeOffset"));
+ throw new ArgumentException(SR.Arg_MustBeDateTimeOffset);
}
DateTime objUtc = ((DateTimeOffset)obj).UtcDateTime;
@@ -555,7 +528,7 @@ namespace System
if (seconds < UnixMinSeconds || seconds > UnixMaxSeconds)
{
throw new ArgumentOutOfRangeException(nameof(seconds),
- string.Format(Environment.GetResourceString("ArgumentOutOfRange_Range"), UnixMinSeconds, UnixMaxSeconds));
+ SR.Format(SR.ArgumentOutOfRange_Range, UnixMinSeconds, UnixMaxSeconds));
}
long ticks = seconds * TimeSpan.TicksPerSecond + UnixEpochTicks;
@@ -570,7 +543,7 @@ namespace System
if (milliseconds < MinMilliseconds || milliseconds > MaxMilliseconds)
{
throw new ArgumentOutOfRangeException(nameof(milliseconds),
- string.Format(Environment.GetResourceString("ArgumentOutOfRange_Range"), MinMilliseconds, MaxMilliseconds));
+ SR.Format(SR.ArgumentOutOfRange_Range, MinMilliseconds, MaxMilliseconds));
}
long ticks = milliseconds * TimeSpan.TicksPerMillisecond + UnixEpochTicks;
@@ -583,12 +556,12 @@ namespace System
{
try
{
- m_offsetMinutes = ValidateOffset(Offset);
- m_dateTime = ValidateDate(ClockDateTime, Offset);
+ _offsetMinutes = ValidateOffset(Offset);
+ _dateTime = ValidateDate(ClockDateTime, Offset);
}
catch (ArgumentException e)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"), e);
+ throw new SerializationException(SR.Serialization_InvalidData, e);
}
}
@@ -600,10 +573,8 @@ namespace System
throw new ArgumentNullException(nameof(info));
}
- Contract.EndContractBlock();
-
- info.AddValue("DateTime", m_dateTime);
- info.AddValue("OffsetMinutes", m_offsetMinutes);
+ info.AddValue("DateTime", _dateTime);
+ info.AddValue("OffsetMinutes", _offsetMinutes);
}
@@ -614,8 +585,8 @@ namespace System
throw new ArgumentNullException(nameof(info));
}
- m_dateTime = (DateTime)info.GetValue("DateTime", typeof(DateTime));
- m_offsetMinutes = (Int16)info.GetValue("OffsetMinutes", typeof(Int16));
+ _dateTime = (DateTime)info.GetValue("DateTime", typeof(DateTime));
+ _offsetMinutes = (Int16)info.GetValue("OffsetMinutes", typeof(Int16));
}
// Returns the hash code for this DateTimeOffset.
@@ -754,25 +725,21 @@ namespace System
public override String ToString()
{
- Contract.Ensures(Contract.Result<String>() != null);
return DateTimeFormat.Format(ClockDateTime, null, DateTimeFormatInfo.CurrentInfo, Offset);
}
public String ToString(String format)
{
- Contract.Ensures(Contract.Result<String>() != null);
return DateTimeFormat.Format(ClockDateTime, format, DateTimeFormatInfo.CurrentInfo, Offset);
}
public String ToString(IFormatProvider formatProvider)
{
- Contract.Ensures(Contract.Result<String>() != null);
return DateTimeFormat.Format(ClockDateTime, null, DateTimeFormatInfo.GetInstance(formatProvider), Offset);
}
public String ToString(String format, IFormatProvider formatProvider)
{
- Contract.Ensures(Contract.Result<String>() != null);
return DateTimeFormat.Format(ClockDateTime, format, DateTimeFormatInfo.GetInstance(formatProvider), Offset);
}
@@ -846,11 +813,11 @@ namespace System
Int64 ticks = offset.Ticks;
if (ticks % TimeSpan.TicksPerMinute != 0)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_OffsetPrecision"), nameof(offset));
+ throw new ArgumentException(SR.Argument_OffsetPrecision, nameof(offset));
}
if (ticks < MinOffset || ticks > MaxOffset)
{
- throw new ArgumentOutOfRangeException(nameof(offset), Environment.GetResourceString("Argument_OffsetOutOfRange"));
+ throw new ArgumentOutOfRangeException(nameof(offset), SR.Argument_OffsetOutOfRange);
}
return (Int16)(offset.Ticks / TimeSpan.TicksPerMinute);
}
@@ -861,12 +828,13 @@ namespace System
// The key validation is that both the UTC and clock times fit. The clock time is validated
// by the DateTime constructor.
Debug.Assert(offset.Ticks >= MinOffset && offset.Ticks <= MaxOffset, "Offset not validated.");
+
// This operation cannot overflow because offset should have already been validated to be within
// 14 hours and the DateTime instance is more than that distance from the boundaries of Int64.
Int64 utcTicks = dateTime.Ticks - offset.Ticks;
if (utcTicks < DateTime.MinTicks || utcTicks > DateTime.MaxTicks)
{
- throw new ArgumentOutOfRangeException(nameof(offset), Environment.GetResourceString("Argument_UTCOutOfRange"));
+ throw new ArgumentOutOfRangeException(nameof(offset), SR.Argument_UTCOutOfRange);
}
// make sure the Kind is set to Unspecified
//
@@ -877,18 +845,17 @@ namespace System
{
if ((style & DateTimeFormatInfo.InvalidDateTimeStyles) != 0)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidDateTimeStyles"), parameterName);
+ throw new ArgumentException(SR.Argument_InvalidDateTimeStyles, parameterName);
}
if (((style & (DateTimeStyles.AssumeLocal)) != 0) && ((style & (DateTimeStyles.AssumeUniversal)) != 0))
{
- throw new ArgumentException(Environment.GetResourceString("Argument_ConflictingDateTimeStyles"), parameterName);
+ throw new ArgumentException(SR.Argument_ConflictingDateTimeStyles, parameterName);
}
if ((style & DateTimeStyles.NoCurrentDateDefault) != 0)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_DateTimeOffsetInvalidDateTimeStyles"), parameterName);
+ throw new ArgumentException(SR.Argument_DateTimeOffsetInvalidDateTimeStyles, parameterName);
}
- Contract.EndContractBlock();
// RoundtripKind does not make sense for DateTimeOffset; ignore this flag for backward compatibility with DateTime
style &= ~DateTimeStyles.RoundtripKind;
diff --git a/src/mscorlib/src/System/DefaultBinder.cs b/src/mscorlib/shared/System/DefaultBinder.cs
index 789698f77e..3b46d5f4d3 100644
--- a/src/mscorlib/src/System/DefaultBinder.cs
+++ b/src/mscorlib/shared/System/DefaultBinder.cs
@@ -2,25 +2,20 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// This class represents the Default COM+ binder.
-//
-//
+using System.Reflection;
+using System.Diagnostics;
+using CultureInfo = System.Globalization.CultureInfo;
namespace System
{
- using System;
- using System.Reflection;
- using System.Runtime.CompilerServices;
- using System.Runtime.Versioning;
- using System.Diagnostics;
- using System.Diagnostics.Contracts;
- using CultureInfo = System.Globalization.CultureInfo;
//Marked serializable even though it has no state.
[Serializable]
- internal class DefaultBinder : Binder
+#if CORECLR
+ internal
+#else
+ public sealed
+#endif
+ partial class DefaultBinder : Binder
{
// This method is passed a set of methods and must choose the best
// fit. The methods all have the same number of arguments and the object
@@ -35,13 +30,12 @@ namespace System
//
// The most specific match will be selected.
//
- public override MethodBase BindToMethod(
- BindingFlags bindingAttr, MethodBase[] match, ref Object[] args,
- ParameterModifier[] modifiers, CultureInfo cultureInfo, String[] names, out Object state)
+ public sealed override MethodBase BindToMethod(
+ BindingFlags bindingAttr, MethodBase[] match, ref object[] args,
+ ParameterModifier[] modifiers, CultureInfo cultureInfo, string[] names, out object state)
{
if (match == null || match.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Arg_EmptyArray"), nameof(match));
- Contract.EndContractBlock();
+ throw new ArgumentException(SR.Arg_EmptyArray, nameof(match));
MethodBase[] candidates = (MethodBase[])match.Clone();
@@ -50,7 +44,7 @@ namespace System
state = null;
- #region Map named parameters to candidate parameter postions
+#region Map named parameters to candidate parameter postions
// We are creating an paramOrder array to act as a mapping
// between the order of the args and the actual order of the
// parameters in the method. This order may differ because
@@ -79,13 +73,13 @@ namespace System
candidates[i] = null;
}
}
- #endregion
+#endregion
Type[] paramArrayTypes = new Type[candidates.Length];
Type[] argTypes = new Type[args.Length];
- #region Cache the type of the provided arguments
+#region Cache the type of the provided arguments
// object that contain a null are treated as if they were typeless (but match either object
// references or value classes). We mark this condition by placing a null in the argTypes array.
for (i = 0; i < args.Length; i++)
@@ -95,7 +89,7 @@ namespace System
argTypes[i] = args[i].GetType();
}
}
- #endregion
+#endregion
// Find the method that matches...
@@ -104,7 +98,7 @@ namespace System
Type paramArrayType = null;
- #region Filter methods by parameter count and type
+#region Filter methods by parameter count and type
for (i = 0; i < candidates.Length; i++)
{
paramArrayType = null;
@@ -116,10 +110,10 @@ namespace System
// Validate the parameters.
ParameterInfo[] par = candidates[i].GetParametersNoCopy();
- #region Match method by parameter count
+#region Match method by parameter count
if (par.Length == 0)
{
- #region No formal parameters
+#region No formal parameters
if (args.Length != 0)
{
if ((candidates[i].CallingConvention & CallingConventions.VarArgs) == 0)
@@ -131,11 +125,11 @@ namespace System
candidates[CurIdx++] = candidates[i];
continue;
- #endregion
+#endregion
}
else if (par.Length > args.Length)
{
- #region Shortage of provided parameters
+#region Shortage of provided parameters
// If the number of parameters is greater than the number of args then
// we are in the situation were we may be using default values.
for (j = args.Length; j < par.Length - 1; j++)
@@ -157,11 +151,11 @@ namespace System
paramArrayType = par[j].ParameterType.GetElementType();
}
- #endregion
+#endregion
}
else if (par.Length < args.Length)
{
- #region Excess provided parameters
+#region Excess provided parameters
// test for the ParamArray case
int lastArgPos = par.Length - 1;
@@ -175,11 +169,11 @@ namespace System
continue;
paramArrayType = par[lastArgPos].ParameterType.GetElementType();
- #endregion
+#endregion
}
else
{
- #region Test for paramArray, save paramArray type
+#region Test for paramArray, save paramArray type
int lastArgPos = par.Length - 1;
if (par[lastArgPos].ParameterType.IsArray
@@ -189,17 +183,17 @@ namespace System
if (!par[lastArgPos].ParameterType.IsAssignableFrom(argTypes[lastArgPos]))
paramArrayType = par[lastArgPos].ParameterType.GetElementType();
}
- #endregion
+#endregion
}
- #endregion
+#endregion
Type pCls = null;
int argsToCheck = (paramArrayType != null) ? par.Length - 1 : args.Length;
- #region Match method by parameter type
+#region Match method by parameter type
for (j = 0; j < argsToCheck; j++)
{
- #region Classic argument coersion checks
+#region Classic argument coersion checks
// get the formal type
pCls = par[j].ParameterType;
@@ -219,13 +213,13 @@ namespace System
continue;
// the type is Object, so it will match everything
- if (pCls == typeof(Object))
+ if (pCls == typeof(object))
continue;
// now do a "classic" type check
if (pCls.IsPrimitive)
{
- if (argTypes[paramOrder[i][j]] == null || !CanConvertPrimitiveObjectToType(args[paramOrder[i][j]], (RuntimeType)pCls))
+ if (argTypes[paramOrder[i][j]] == null || !CanChangePrimitiveObjectToType(args[paramOrder[i][j]], pCls))
{
break;
}
@@ -245,17 +239,17 @@ namespace System
break;
}
}
- #endregion
+#endregion
}
if (paramArrayType != null && j == par.Length - 1)
{
- #region Check that excess arguments can be placed in the param array
+#region Check that excess arguments can be placed in the param array
for (; j < args.Length; j++)
{
if (paramArrayType.IsPrimitive)
{
- if (argTypes[j] == null || !CanConvertPrimitiveObjectToType(args[j], (RuntimeType)paramArrayType))
+ if (argTypes[j] == null || !CanChangePrimitiveObjectToType(args[j], paramArrayType))
break;
}
else
@@ -275,28 +269,28 @@ namespace System
}
}
}
- #endregion
+#endregion
}
- #endregion
+#endregion
if (j == args.Length)
{
- #region This is a valid routine so we move it up the candidates list
+#region This is a valid routine so we move it up the candidates list
paramOrder[CurIdx] = paramOrder[i];
paramArrayTypes[CurIdx] = paramArrayType;
candidates[CurIdx++] = candidates[i];
- #endregion
+#endregion
}
}
- #endregion
+#endregion
// If we didn't find a method
if (CurIdx == 0)
- throw new MissingMethodException(Environment.GetResourceString("MissingMember"));
+ throw new MissingMethodException(SR.MissingMember);
if (CurIdx == 1)
{
- #region Found only one method
+#region Found only one method
if (names != null)
{
state = new BinderState((int[])paramOrder[0].Clone(), args.Length, paramArrayTypes[0] != null);
@@ -311,17 +305,17 @@ namespace System
{
if (paramArrayTypes[0] != null)
{
- Object[] objs = new Object[parms.Length];
+ object[] objs = new object[parms.Length];
int lastPos = parms.Length - 1;
Array.Copy(args, 0, objs, 0, lastPos);
- objs[lastPos] = Array.UnsafeCreateInstance(paramArrayTypes[0], 1);
+ objs[lastPos] = Array.CreateInstance(paramArrayTypes[0], 1);
((Array)objs[lastPos]).SetValue(args[lastPos], 0);
args = objs;
}
}
else if (parms.Length > args.Length)
{
- Object[] objs = new Object[parms.Length];
+ object[] objs = new object[parms.Length];
for (i = 0; i < args.Length; i++)
objs[i] = args[i];
@@ -330,7 +324,7 @@ namespace System
objs[i] = parms[i].DefaultValue;
if (paramArrayTypes[0] != null)
- objs[i] = Array.UnsafeCreateInstance(paramArrayTypes[0], 0); // create an empty array for the
+ objs[i] = Array.CreateInstance(paramArrayTypes[0], 0); // create an empty array for the
else
objs[i] = parms[i].DefaultValue;
@@ -341,15 +335,15 @@ namespace System
{
if ((candidates[0].CallingConvention & CallingConventions.VarArgs) == 0)
{
- Object[] objs = new Object[parms.Length];
+ object[] objs = new object[parms.Length];
int paramArrayPos = parms.Length - 1;
Array.Copy(args, 0, objs, 0, paramArrayPos);
- objs[paramArrayPos] = Array.UnsafeCreateInstance(paramArrayTypes[0], args.Length - paramArrayPos);
+ objs[paramArrayPos] = Array.CreateInstance(paramArrayTypes[0], args.Length - paramArrayPos);
Array.Copy(args, paramArrayPos, (System.Array)objs[paramArrayPos], 0, args.Length - paramArrayPos);
args = objs;
}
}
- #endregion
+#endregion
return candidates[0];
}
@@ -358,7 +352,7 @@ namespace System
bool ambig = false;
for (i = 1; i < CurIdx; i++)
{
- #region Walk all of the methods looking the most specific method to invoke
+#region Walk all of the methods looking the most specific method to invoke
int newMin = FindMostSpecificMethod(candidates[currentMin], paramOrder[currentMin], paramArrayTypes[currentMin],
candidates[i], paramOrder[i], paramArrayTypes[i], argTypes, args);
@@ -371,11 +365,11 @@ namespace System
currentMin = i;
ambig = false;
}
- #endregion
+#endregion
}
if (ambig)
- throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException"));
+ throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException);
// Reorder (if needed)
if (names != null)
@@ -391,17 +385,17 @@ namespace System
{
if (paramArrayTypes[currentMin] != null)
{
- Object[] objs = new Object[parameters.Length];
+ object[] objs = new object[parameters.Length];
int lastPos = parameters.Length - 1;
Array.Copy(args, 0, objs, 0, lastPos);
- objs[lastPos] = Array.UnsafeCreateInstance(paramArrayTypes[currentMin], 1);
+ objs[lastPos] = Array.CreateInstance(paramArrayTypes[currentMin], 1);
((Array)objs[lastPos]).SetValue(args[lastPos], 0);
args = objs;
}
}
else if (parameters.Length > args.Length)
{
- Object[] objs = new Object[parameters.Length];
+ object[] objs = new object[parameters.Length];
for (i = 0; i < args.Length; i++)
objs[i] = args[i];
@@ -411,7 +405,7 @@ namespace System
if (paramArrayTypes[currentMin] != null)
{
- objs[i] = Array.UnsafeCreateInstance(paramArrayTypes[currentMin], 0);
+ objs[i] = Array.CreateInstance(paramArrayTypes[currentMin], 0);
}
else
{
@@ -424,10 +418,10 @@ namespace System
{
if ((candidates[currentMin].CallingConvention & CallingConventions.VarArgs) == 0)
{
- Object[] objs = new Object[parameters.Length];
+ object[] objs = new object[parameters.Length];
int paramArrayPos = parameters.Length - 1;
Array.Copy(args, 0, objs, 0, paramArrayPos);
- objs[paramArrayPos] = Array.UnsafeCreateInstance(paramArrayTypes[currentMin], args.Length - paramArrayPos);
+ objs[paramArrayPos] = Array.CreateInstance(paramArrayTypes[currentMin], args.Length - paramArrayPos);
Array.Copy(args, paramArrayPos, (System.Array)objs[paramArrayPos], 0, args.Length - paramArrayPos);
args = objs;
}
@@ -439,7 +433,7 @@ namespace System
// Given a set of fields that match the base criteria, select a field.
// if value is null then we have no way to select a field
- public override FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo[] match, Object value, CultureInfo cultureInfo)
+ public sealed override FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo[] match, object value, CultureInfo cultureInfo)
{
if (match == null)
{
@@ -476,14 +470,14 @@ namespace System
continue;
}
}
- if (pCls == typeof(Object))
+ if (pCls == typeof(object))
{
candidates[CurIdx++] = candidates[i];
continue;
}
if (pCls.IsPrimitive)
{
- if (CanConvertPrimitiveObjectToType(value, (RuntimeType)pCls))
+ if (CanChangePrimitiveObjectToType(value, pCls))
{
candidates[CurIdx++] = candidates[i];
continue;
@@ -499,7 +493,7 @@ namespace System
}
}
if (CurIdx == 0)
- throw new MissingFieldException(Environment.GetResourceString("MissingField"));
+ throw new MissingFieldException(SR.MissingField);
if (CurIdx == 1)
return candidates[0];
}
@@ -522,14 +516,14 @@ namespace System
}
}
if (ambig)
- throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException"));
+ throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException);
return candidates[currentMin];
}
// Given a set of methods that match the base criteria, select a method based
// upon an array of types. This method should return null if no method matchs
// the criteria.
- public override MethodBase SelectMethod(BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[] modifiers)
+ public sealed override MethodBase SelectMethod(BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[] modifiers)
{
int i;
int j;
@@ -538,14 +532,14 @@ namespace System
for (i = 0; i < types.Length; i++)
{
realTypes[i] = types[i].UnderlyingSystemType;
- if (!(realTypes[i] is RuntimeType))
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(types));
+ if (!(realTypes[i].IsRuntimeImplemented()))
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(types));
}
types = realTypes;
// We don't automatically jump out on exact match.
if (match == null || match.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Arg_EmptyArray"), nameof(match));
+ throw new ArgumentException(SR.Arg_EmptyArray, nameof(match));
MethodBase[] candidates = (MethodBase[])match.Clone();
@@ -562,12 +556,12 @@ namespace System
Type pCls = par[j].ParameterType;
if (pCls == types[j])
continue;
- if (pCls == typeof(Object))
+ if (pCls == typeof(object))
continue;
if (pCls.IsPrimitive)
{
- if (!(types[j].UnderlyingSystemType is RuntimeType) ||
- !CanConvertPrimitive((RuntimeType)types[j].UnderlyingSystemType, (RuntimeType)pCls.UnderlyingSystemType))
+ if (!(types[j].UnderlyingSystemType.IsRuntimeImplemented()) ||
+ !CanChangePrimitive(types[j].UnderlyingSystemType, pCls.UnderlyingSystemType))
break;
}
else
@@ -606,22 +600,26 @@ namespace System
}
}
if (ambig)
- throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException"));
+ throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException);
return candidates[currentMin];
}
// Given a set of properties that match the base criteria, select one.
- public override PropertyInfo SelectProperty(BindingFlags bindingAttr, PropertyInfo[] match, Type returnType,
+ public sealed override PropertyInfo SelectProperty(BindingFlags bindingAttr, PropertyInfo[] match, Type returnType,
Type[] indexes, ParameterModifier[] modifiers)
{
// Allow a null indexes array. But if it is not null, every element must be non-null as well.
- if (indexes != null && !Contract.ForAll(indexes, delegate (Type t) { return t != null; }))
+ if (indexes != null)
{
- throw new ArgumentNullException(nameof(indexes));
+ foreach (Type index in indexes)
+ {
+ if (index == null)
+ throw new ArgumentNullException(nameof(indexes));
+ }
}
+
if (match == null || match.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Arg_EmptyArray"), nameof(match));
- Contract.EndContractBlock();
+ throw new ArgumentException(SR.Arg_EmptyArray, nameof(match));
PropertyInfo[] candidates = (PropertyInfo[])match.Clone();
@@ -645,13 +643,13 @@ namespace System
// If the classes exactly match continue
if (pCls == indexes[j])
continue;
- if (pCls == typeof(Object))
+ if (pCls == typeof(object))
continue;
if (pCls.IsPrimitive)
{
- if (!(indexes[j].UnderlyingSystemType is RuntimeType) ||
- !CanConvertPrimitive((RuntimeType)indexes[j].UnderlyingSystemType, (RuntimeType)pCls.UnderlyingSystemType))
+ if (!(indexes[j].UnderlyingSystemType.IsRuntimeImplemented()) ||
+ !CanChangePrimitive(indexes[j].UnderlyingSystemType, pCls.UnderlyingSystemType))
break;
}
else
@@ -668,8 +666,8 @@ namespace System
{
if (candidates[i].PropertyType.IsPrimitive)
{
- if (!(returnType.UnderlyingSystemType is RuntimeType) ||
- !CanConvertPrimitive((RuntimeType)returnType.UnderlyingSystemType, (RuntimeType)candidates[i].PropertyType.UnderlyingSystemType))
+ if (!(returnType.UnderlyingSystemType.IsRuntimeImplemented()) ||
+ !CanChangePrimitive(returnType.UnderlyingSystemType, candidates[i].PropertyType.UnderlyingSystemType))
continue;
}
else
@@ -718,45 +716,45 @@ namespace System
}
if (ambig)
- throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException"));
+ throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException);
return candidates[currentMin];
}
// ChangeType
// The default binder doesn't support any change type functionality.
// This is because the default is built into the low level invoke code.
- public override Object ChangeType(Object value, Type type, CultureInfo cultureInfo)
+ public override object ChangeType(object value, Type type, CultureInfo cultureInfo)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_ChangeType"));
+ throw new NotSupportedException(SR.NotSupported_ChangeType);
}
- public override void ReorderArgumentArray(ref Object[] args, Object state)
+ public sealed override void ReorderArgumentArray(ref object[] args, object state)
{
BinderState binderState = (BinderState)state;
- ReorderParams(binderState.m_argsMap, args);
- if (binderState.m_isParamArray)
+ ReorderParams(binderState._argsMap, args);
+ if (binderState._isParamArray)
{
int paramArrayPos = args.Length - 1;
- if (args.Length == binderState.m_originalSize)
- args[paramArrayPos] = ((Object[])args[paramArrayPos])[0];
+ if (args.Length == binderState._originalSize)
+ args[paramArrayPos] = ((object[])args[paramArrayPos])[0];
else
{
// must be args.Length < state.originalSize
- Object[] newArgs = new Object[args.Length];
+ object[] newArgs = new object[args.Length];
Array.Copy(args, 0, newArgs, 0, paramArrayPos);
for (int i = paramArrayPos, j = 0; i < newArgs.Length; i++, j++)
{
- newArgs[i] = ((Object[])args[paramArrayPos])[j];
+ newArgs[i] = ((object[])args[paramArrayPos])[j];
}
args = newArgs;
}
}
else
{
- if (args.Length > binderState.m_originalSize)
+ if (args.Length > binderState._originalSize)
{
- Object[] newArgs = new Object[binderState.m_originalSize];
- Array.Copy(args, 0, newArgs, 0, binderState.m_originalSize);
+ object[] newArgs = new object[binderState._originalSize];
+ Array.Copy(args, 0, newArgs, 0, binderState._originalSize);
args = newArgs;
}
}
@@ -768,7 +766,7 @@ namespace System
{
if (match == null)
throw new ArgumentNullException(nameof(match));
- Contract.EndContractBlock();
+
MethodBase[] aExactMatches = new MethodBase[match.Length];
int cExactMatches = 0;
@@ -811,7 +809,6 @@ namespace System
{
if (match == null)
throw new ArgumentNullException(nameof(match));
- Contract.EndContractBlock();
PropertyInfo bestMatch = null;
int typesLength = (types != null) ? types.Length : 0;
@@ -833,7 +830,7 @@ namespace System
continue;
if (bestMatch != null)
- throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException"));
+ throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException);
bestMatch = match[i];
}
@@ -842,7 +839,7 @@ namespace System
private static int FindMostSpecific(ParameterInfo[] p1, int[] paramOrder1, Type paramArrayType1,
ParameterInfo[] p2, int[] paramOrder2, Type paramArrayType2,
- Type[] types, Object[] args)
+ Type[] types, object[] args)
{
// A method using params is always less specific than one not using params
if (paramArrayType1 != null && paramArrayType2 == null) return 2;
@@ -958,8 +955,8 @@ namespace System
if (c1.IsPrimitive && c2.IsPrimitive)
{
- c1FromC2 = CanConvertPrimitive((RuntimeType)c2, (RuntimeType)c1);
- c2FromC1 = CanConvertPrimitive((RuntimeType)c1, (RuntimeType)c2);
+ c1FromC2 = CanChangePrimitive(c2, c1);
+ c2FromC1 = CanChangePrimitive(c1, c2);
}
else
{
@@ -982,7 +979,7 @@ namespace System
private static int FindMostSpecificMethod(MethodBase m1, int[] paramOrder1, Type paramArrayType1,
MethodBase m2, int[] paramOrder2, Type paramArrayType2,
- Type[] types, Object[] args)
+ Type[] types, object[] args)
{
// Find the most specific method based on the parameters.
int res = FindMostSpecific(m1.GetParametersNoCopy(), paramOrder1, paramArrayType1,
@@ -993,7 +990,7 @@ namespace System
return res;
// Check to see if the methods have the exact same name and signature.
- if (CompareMethodSigAndName(m1, m2))
+ if (CompareMethodSig(m1, m2))
{
// Determine the depth of the declaring types for both methods.
int hierarchyDepth1 = GetHierarchyDepth(m1.DeclaringType);
@@ -1063,7 +1060,7 @@ namespace System
return 0;
}
- internal static bool CompareMethodSigAndName(MethodBase m1, MethodBase m2)
+ public static bool CompareMethodSig(MethodBase m1, MethodBase m2)
{
ParameterInfo[] params1 = m1.GetParametersNoCopy();
ParameterInfo[] params2 = m2.GetParametersNoCopy();
@@ -1081,7 +1078,7 @@ namespace System
return true;
}
- internal static int GetHierarchyDepth(Type t)
+ private static int GetHierarchyDepth(Type t)
{
int depth = 0;
@@ -1110,7 +1107,7 @@ namespace System
// This can only happen if at least one is vararg or generic.
if (currentHierarchyDepth == deepestHierarchy)
{
- throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException"));
+ throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException);
}
// Check to see if this method is on the most derived class.
@@ -1124,20 +1121,9 @@ namespace System
return methWithDeepestHierarchy;
}
- // CanConvertPrimitive
- // This will determine if the source can be converted to the target type
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static extern bool CanConvertPrimitive(RuntimeType source, RuntimeType target);
-
- // CanConvertPrimitiveObjectToType
- // This method will determine if the primitive object can be converted
- // to a type.
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- static internal extern bool CanConvertPrimitiveObjectToType(Object source, RuntimeType type);
-
// This method will sort the vars array into the mapping order stored
// in the paramOrder array.
- private static void ReorderParams(int[] paramOrder, Object[] vars)
+ private static void ReorderParams(int[] paramOrder, object[] vars)
{
object[] varsCopy = new object[vars.Length];
for (int i = 0; i < vars.Length; i++)
@@ -1152,7 +1138,7 @@ namespace System
// as the values and maps to the parameters of the method. We store the mapping
// from the parameters to the names in the paramOrder array. All parameters that
// don't have matching names are then stored in the array in order.
- private static bool CreateParamOrder(int[] paramOrder, ParameterInfo[] pars, String[] names)
+ private static bool CreateParamOrder(int[] paramOrder, ParameterInfo[] pars, string[] names)
{
bool[] used = new bool[pars.Length];
@@ -1200,15 +1186,15 @@ namespace System
internal class BinderState
{
- internal int[] m_argsMap;
- internal int m_originalSize;
- internal bool m_isParamArray;
+ internal readonly int[] _argsMap;
+ internal readonly int _originalSize;
+ internal readonly bool _isParamArray;
internal BinderState(int[] argsMap, int originalSize, bool isParamArray)
{
- m_argsMap = argsMap;
- m_originalSize = originalSize;
- m_isParamArray = isParamArray;
+ _argsMap = argsMap;
+ _originalSize = originalSize;
+ _isParamArray = isParamArray;
}
}
}
diff --git a/src/mscorlib/src/System/Globalization/CalendarAlgorithmType.cs b/src/mscorlib/shared/System/Globalization/CalendarAlgorithmType.cs
index 159b0e6f77..4ddc307abf 100644
--- a/src/mscorlib/src/System/Globalization/CalendarAlgorithmType.cs
+++ b/src/mscorlib/shared/System/Globalization/CalendarAlgorithmType.cs
@@ -2,8 +2,6 @@
// 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;
-
namespace System.Globalization
{
public enum CalendarAlgorithmType
diff --git a/src/mscorlib/src/System/Globalization/CalendarWeekRule.cs b/src/mscorlib/shared/System/Globalization/CalendarWeekRule.cs
index 4013ce7237..b381b5c544 100644
--- a/src/mscorlib/src/System/Globalization/CalendarWeekRule.cs
+++ b/src/mscorlib/shared/System/Globalization/CalendarWeekRule.cs
@@ -2,8 +2,6 @@
// 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;
-
namespace System.Globalization
{
[Serializable]
diff --git a/src/mscorlib/src/System/Globalization/CalendricalCalculationsHelper.cs b/src/mscorlib/shared/System/Globalization/CalendricalCalculationsHelper.cs
index 7de75d6aee..7de75d6aee 100644
--- a/src/mscorlib/src/System/Globalization/CalendricalCalculationsHelper.cs
+++ b/src/mscorlib/shared/System/Globalization/CalendricalCalculationsHelper.cs
diff --git a/src/mscorlib/src/System/Globalization/ChineseLunisolarCalendar.cs b/src/mscorlib/shared/System/Globalization/ChineseLunisolarCalendar.cs
index dc9e5fd13d..404add0936 100644
--- a/src/mscorlib/src/System/Globalization/ChineseLunisolarCalendar.cs
+++ b/src/mscorlib/shared/System/Globalization/ChineseLunisolarCalendar.cs
@@ -2,16 +2,10 @@
// 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.Diagnostics.Contracts;
namespace System.Globalization
{
- ////////////////////////////////////////////////////////////////////////////
- //
- // Notes about ChineseLunisolarCalendar
- //
- ////////////////////////////////////////////////////////////////////////////
/*
** Calendar support range:
** Calendar Minimum Maximum
diff --git a/src/mscorlib/src/System/Globalization/CultureNotFoundException.cs b/src/mscorlib/shared/System/Globalization/CultureNotFoundException.cs
index d296ad88e5..929f4bb000 100644
--- a/src/mscorlib/src/System/Globalization/CultureNotFoundException.cs
+++ b/src/mscorlib/shared/System/Globalization/CultureNotFoundException.cs
@@ -2,14 +2,12 @@
// 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.Runtime.Serialization;
-using System.Threading;
namespace System.Globalization
{
[Serializable]
- public class CultureNotFoundException : ArgumentException, ISerializable
+ public class CultureNotFoundException : ArgumentException
{
private string _invalidCultureName; // unrecognized culture name
private int? _invalidCultureId; // unrecognized culture Lcid
diff --git a/src/mscorlib/shared/System/Globalization/CultureTypes.cs b/src/mscorlib/shared/System/Globalization/CultureTypes.cs
new file mode 100644
index 0000000000..f52ac82a83
--- /dev/null
+++ b/src/mscorlib/shared/System/Globalization/CultureTypes.cs
@@ -0,0 +1,27 @@
+// 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.
+
+// The enumeration constants used in CultureInfo.GetCultures().
+// On Linux platforms, the only enum values used there is NeutralCultures and SpecificCultures
+// the rest are obsolete or not valid on Linux
+
+namespace System.Globalization
+{
+ [Flags]
+ public enum CultureTypes
+ {
+ NeutralCultures = 0x0001, // Neutral cultures are cultures like "en", "de", "zh", etc, for enumeration this includes ALL neutrals regardless of other flags
+ SpecificCultures = 0x0002, // Non-netural cultuers. Examples are "en-us", "zh-tw", etc., for enumeration this includes ALL specifics regardless of other flags
+ InstalledWin32Cultures = 0x0004, // Win32 installed cultures in the system and exists in the framework too., this is effectively all cultures
+
+ AllCultures = NeutralCultures | SpecificCultures | InstalledWin32Cultures,
+
+ UserCustomCulture = 0x0008, // User defined custom culture
+ ReplacementCultures = 0x0010, // User defined replacement custom culture.
+ [Obsolete("This value has been deprecated. Please use other values in CultureTypes.")]
+ WindowsOnlyCultures = 0x0020, // this will always return empty list.
+ [Obsolete("This value has been deprecated. Please use other values in CultureTypes.")]
+ FrameworkCultures = 0x0040, // will return only the v2 cultures marked as Framework culture.
+ }
+}
diff --git a/src/mscorlib/src/System/Globalization/DateTimeFormat.cs b/src/mscorlib/shared/System/Globalization/DateTimeFormat.cs
index b87731ad74..840409f55a 100644
--- a/src/mscorlib/src/System/Globalization/DateTimeFormat.cs
+++ b/src/mscorlib/shared/System/Globalization/DateTimeFormat.cs
@@ -2,16 +2,11 @@
// 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.Text;
-using System.Threading;
-using System.Globalization;
using System.Collections.Generic;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Runtime.Versioning;
-using System.Security;
using System.Diagnostics;
using System.Diagnostics.Contracts;
+using System.Globalization;
+using System.Text;
namespace System
{
@@ -338,7 +333,7 @@ namespace System
//
// This means that '\' is at the end of the formatting string.
//
- throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ throw new FormatException(SR.Format_InvalidString);
}
}
else
@@ -353,7 +348,7 @@ namespace System
throw new FormatException(
String.Format(
CultureInfo.CurrentCulture,
- Environment.GetResourceString("Format_BadQuote"), quoteChar));
+ SR.Format_BadQuote, quoteChar));
}
//
@@ -458,7 +453,7 @@ namespace System
StringBuilder result = StringBuilderCache.Acquire();
// This is a flag to indicate if we are format the dates using Hebrew calendar.
- bool isHebrewCalendar = (cal.ID == Calendar.CAL_HEBREW);
+ bool isHebrewCalendar = (cal.ID == CalendarId.HEBREW);
// This is a flag to indicate if we are formating hour/minute/second only.
bool bTimeOnly = true;
@@ -538,7 +533,7 @@ namespace System
}
else
{
- throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ throw new FormatException(SR.Format_InvalidString);
}
break;
case 't':
@@ -650,7 +645,7 @@ namespace System
{
FormatDigits(result, year, tokenLen <= 2 ? tokenLen : 2);
}
- else if (cal.ID == Calendar.CAL_HEBREW)
+ else if (cal.ID == CalendarId.HEBREW)
{
HebrewFormatDigits(result, year);
}
@@ -706,7 +701,7 @@ namespace System
// This means that '%' is at the end of the format string or
// "%%" appears in the format string.
//
- throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ throw new FormatException(SR.Format_InvalidString);
}
break;
case '\\':
@@ -729,7 +724,7 @@ namespace System
//
// This means that '\' is at the end of the formatting string.
//
- throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ throw new FormatException(SR.Format_InvalidString);
}
break;
default:
@@ -898,7 +893,7 @@ namespace System
realFormat = dtfi.YearMonthPattern;
break;
default:
- throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ throw new FormatException(SR.Format_InvalidString);
}
return (realFormat);
}
@@ -949,7 +944,7 @@ namespace System
if (offset != NullOffset)
{
// This format is not supported by DateTimeOffset
- throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ throw new FormatException(SR.Format_InvalidString);
}
// Universal time is always in Greogrian calendar.
//
@@ -996,13 +991,13 @@ namespace System
// formatting as ISO 8601 format.
switch (dtfi.Calendar.ID)
{
- case Calendar.CAL_JAPAN:
- case Calendar.CAL_TAIWAN:
- case Calendar.CAL_HIJRI:
- case Calendar.CAL_HEBREW:
- case Calendar.CAL_JULIAN:
- case Calendar.CAL_UMALQURA:
- case Calendar.CAL_PERSIAN:
+ case CalendarId.JAPAN:
+ case CalendarId.TAIWAN:
+ case CalendarId.HIJRI:
+ case CalendarId.HEBREW:
+ case CalendarId.JULIAN:
+ case CalendarId.UMALQURA:
+ case CalendarId.PERSIAN:
timeOnlySpecialCase = true;
dtfi = DateTimeFormatInfo.InvariantInfo;
break;
@@ -1180,7 +1175,7 @@ namespace System
results = new String[] { Format(dateTime, new String(format, 1), dtfi) };
break;
default:
- throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ throw new FormatException(SR.Format_InvalidString);
}
return (results);
}
diff --git a/src/mscorlib/src/System/Globalization/DateTimeFormatInfo.cs b/src/mscorlib/shared/System/Globalization/DateTimeFormatInfo.cs
index 90e243b2c7..d3f1ea9a45 100644
--- a/src/mscorlib/src/System/Globalization/DateTimeFormatInfo.cs
+++ b/src/mscorlib/shared/System/Globalization/DateTimeFormatInfo.cs
@@ -2723,11 +2723,7 @@ namespace System.Globalization
////////////////////////////////////////////////////////////////////////
private static bool TryParseHebrewNumber(
-#if CORECLR
ref __DTString str,
-#else
- ref FormatProvider.__DTString str,
-#endif
out Boolean badFormat,
out int number)
{
@@ -2782,11 +2778,7 @@ namespace System.Globalization
}
internal bool Tokenize(TokenType TokenMask, out TokenType tokenType, out int tokenValue,
-#if CORECLR
ref __DTString str)
-#else
- ref FormatProvider.__DTString str)
-#endif
{
tokenType = TokenType.UnknownToken;
tokenValue = 0;
@@ -3033,53 +3025,4 @@ namespace System.Globalization
}
}
}
-
-#if !CORECLR
- //
- // The type of token that will be returned by DateTimeFormatInfo.Tokenize().
- //
- internal enum TokenType
- {
- // The valid token should start from 1.
-
- // Regular tokens. The range is from 0x00 ~ 0xff.
- NumberToken = 1, // The number. E.g. "12"
- YearNumberToken = 2, // The number which is considered as year number, which has 3 or more digits. E.g. "2003"
- Am = 3, // AM timemark. E.g. "AM"
- Pm = 4, // PM timemark. E.g. "PM"
- MonthToken = 5, // A word (or words) that represents a month name. E.g. "March"
- EndOfString = 6, // End of string
- DayOfWeekToken = 7, // A word (or words) that represents a day of week name. E.g. "Monday" or "Mon"
- TimeZoneToken = 8, // A word that represents a timezone name. E.g. "GMT"
- EraToken = 9, // A word that represents a era name. E.g. "A.D."
- DateWordToken = 10, // A word that can appear in a DateTime string, but serves no parsing semantics. E.g. "de" in Spanish culture.
- UnknownToken = 11, // An unknown word, which signals an error in parsing.
- HebrewNumber = 12, // A number that is composed of Hebrew text. Hebrew calendar uses Hebrew digits for year values, month values, and day values.
- JapaneseEraToken = 13, // Era name for JapaneseCalendar
- TEraToken = 14, // Era name for TaiwanCalendar
- IgnorableSymbol = 15, // A separator like "," that is equivalent to whitespace
-
-
- // Separator tokens.
- SEP_Unk = 0x100, // Unknown separator.
- SEP_End = 0x200, // The end of the parsing string.
- SEP_Space = 0x300, // Whitespace (including comma).
- SEP_Am = 0x400, // AM timemark. E.g. "AM"
- SEP_Pm = 0x500, // PM timemark. E.g. "PM"
- SEP_Date = 0x600, // date separator. E.g. "/"
- SEP_Time = 0x700, // time separator. E.g. ":"
- SEP_YearSuff = 0x800, // Chinese/Japanese/Korean year suffix.
- SEP_MonthSuff = 0x900, // Chinese/Japanese/Korean month suffix.
- SEP_DaySuff = 0xa00, // Chinese/Japanese/Korean day suffix.
- SEP_HourSuff = 0xb00, // Chinese/Japanese/Korean hour suffix.
- SEP_MinuteSuff = 0xc00, // Chinese/Japanese/Korean minute suffix.
- SEP_SecondSuff = 0xd00, // Chinese/Japanese/Korean second suffix.
- SEP_LocalTimeMark = 0xe00, // 'T', used in ISO 8601 format.
- SEP_DateOrOffset = 0xf00, // '-' which could be a date separator or start of a time zone offset
-
- RegularTokenMask = 0x00ff,
- SeparatorTokenMask = 0xff00,
- }
-#endif
-
}
diff --git a/src/mscorlib/src/System/Globalization/DateTimeFormatInfoScanner.cs b/src/mscorlib/shared/System/Globalization/DateTimeFormatInfoScanner.cs
index ddf7d7e640..15af1b7d84 100644
--- a/src/mscorlib/src/System/Globalization/DateTimeFormatInfoScanner.cs
+++ b/src/mscorlib/shared/System/Globalization/DateTimeFormatInfoScanner.cs
@@ -19,9 +19,6 @@
//
////////////////////////////////////////////////////////////////////////////
-using System;
-using System.Globalization;
-using System.Collections;
using System.Collections.Generic;
using System.Text;
diff --git a/src/mscorlib/src/System/Globalization/DateTimeParse.cs b/src/mscorlib/shared/System/Globalization/DateTimeParse.cs
index cddfc29092..910fbf2ff0 100644
--- a/src/mscorlib/src/System/Globalization/DateTimeParse.cs
+++ b/src/mscorlib/shared/System/Globalization/DateTimeParse.cs
@@ -2,33 +2,14 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////
-//
-//
-// Purpose: This class is called by DateTime to parse a date/time string.
-//
-////////////////////////////////////////////////////////////////////////////
+using System.Diagnostics;
+using System.Diagnostics.Contracts;
+using System.Globalization;
+using System.Text;
namespace System
{
- using System;
- using System.Text;
- using System.Globalization;
- using System.Threading;
- using System.Collections;
- using System.Runtime.CompilerServices;
- using System.Runtime.InteropServices;
- using System.Runtime.Versioning;
- using System.Security;
- using System.Diagnostics;
- using System.Diagnostics.Contracts;
-
- ////////////////////////////////////////////////////////////////////////
-
- //This class contains only static members
-
- internal static
- class DateTimeParse
+ internal static class DateTimeParse
{
internal const Int32 MaxDateTimeNumberDigits = 8;
@@ -4489,7 +4470,7 @@ new DS[] { DS.ERROR, DS.TX_NNN, DS.TX_NNN, DS.TX_NNN, DS.ERROR, DS.ERROR,
bool bTimeOnly = false;
result.calendar = parseInfo.calendar;
- if (parseInfo.calendar.ID == Calendar.CAL_HEBREW)
+ if (parseInfo.calendar.ID == CalendarId.HEBREW)
{
parseInfo.parseNumberDelegate = m_hebrewNumberParser;
parseInfo.fCustomNumberParser = true;
@@ -4660,13 +4641,13 @@ new DS[] { DS.ERROR, DS.TX_NNN, DS.TX_NNN, DS.TX_NNN, DS.ERROR, DS.ERROR,
switch (result.failure)
{
case ParseFailureKind.ArgumentNull:
- return new ArgumentNullException(result.failureArgumentName, Environment.GetResourceString(result.failureMessageID));
+ return new ArgumentNullException(result.failureArgumentName, SR.GetResourceString(result.failureMessageID));
case ParseFailureKind.Format:
- return new FormatException(Environment.GetResourceString(result.failureMessageID));
+ return new FormatException(SR.GetResourceString(result.failureMessageID));
case ParseFailureKind.FormatWithParameter:
- return new FormatException(Environment.GetResourceString(result.failureMessageID, result.failureMessageFormatArgument));
+ return new FormatException(SR.Format(SR.GetResourceString(result.failureMessageID), result.failureMessageFormatArgument));
case ParseFailureKind.FormatBadDateTimeCalendar:
- return new FormatException(Environment.GetResourceString(result.failureMessageID, result.calendar));
+ return new FormatException(SR.Format(SR.GetResourceString(result.failureMessageID), result.calendar));
default:
Debug.Assert(false, "Unkown DateTimeParseFailure: " + result);
return null;
@@ -4868,7 +4849,7 @@ new DS[] { DS.ERROR, DS.TX_NNN, DS.TX_NNN, DS.TX_NNN, DS.ERROR, DS.ERROR,
}
else
{
- m_info = Thread.CurrentThread.CurrentCulture.CompareInfo;
+ m_info = CultureInfo.CurrentCulture.CompareInfo;
m_checkDigitToken = false;
}
}
@@ -5508,9 +5489,6 @@ new DS[] { DS.ERROR, DS.TX_NNN, DS.TX_NNN, DS.TX_NNN, DS.ERROR, DS.ERROR,
internal DateTimeParse.TM timeMark;
internal double fraction;
internal bool hasSameDateAndTimeSeparators;
- //
-
- internal bool timeZone;
internal void Init(int* numberBuffer)
{
diff --git a/src/mscorlib/src/System/Globalization/DateTimeStyles.cs b/src/mscorlib/shared/System/Globalization/DateTimeStyles.cs
index cd551cb08e..79232ff199 100644
--- a/src/mscorlib/src/System/Globalization/DateTimeStyles.cs
+++ b/src/mscorlib/shared/System/Globalization/DateTimeStyles.cs
@@ -14,7 +14,6 @@
namespace System.Globalization
{
- [Serializable]
[Flags]
public enum DateTimeStyles
{
diff --git a/src/mscorlib/src/System/Globalization/DaylightTime.cs b/src/mscorlib/shared/System/Globalization/DaylightTime.cs
index f066e4b1e7..b3c70e1d10 100644
--- a/src/mscorlib/src/System/Globalization/DaylightTime.cs
+++ b/src/mscorlib/shared/System/Globalization/DaylightTime.cs
@@ -2,8 +2,6 @@
// 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;
-
namespace System.Globalization
{
// This class represents a starting/ending time for a period of daylight saving time.
diff --git a/src/mscorlib/src/System/Globalization/DigitShapes.cs b/src/mscorlib/shared/System/Globalization/DigitShapes.cs
index 0e4dcc87c3..1ce45dbeb6 100644
--- a/src/mscorlib/src/System/Globalization/DigitShapes.cs
+++ b/src/mscorlib/shared/System/Globalization/DigitShapes.cs
@@ -2,17 +2,12 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-//
-// The enumeration constants used in NumberFormatInfo.DigitSubstitution.
-//
-
namespace System.Globalization
{
- [Serializable]
public enum DigitShapes : int
{
Context = 0x0000, // The shape depends on the previous text in the same output.
None = 0x0001, // Gives full Unicode compatibility.
NativeNational = 0x0002 // National shapes
}
-} \ No newline at end of file
+}
diff --git a/src/mscorlib/src/System/Globalization/EastAsianLunisolarCalendar.cs b/src/mscorlib/shared/System/Globalization/EastAsianLunisolarCalendar.cs
index f82fad8e5b..d06b13cd7d 100644
--- a/src/mscorlib/src/System/Globalization/EastAsianLunisolarCalendar.cs
+++ b/src/mscorlib/shared/System/Globalization/EastAsianLunisolarCalendar.cs
@@ -2,17 +2,10 @@
// 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.Diagnostics.Contracts;
namespace System.Globalization
{
- ////////////////////////////////////////////////////////////////////////////
- //
- // Notes about EastAsianLunisolarCalendar
- //
- ////////////////////////////////////////////////////////////////////////////
-
[Serializable]
public abstract class EastAsianLunisolarCalendar : Calendar
{
diff --git a/src/mscorlib/src/System/Globalization/GregorianCalendarTypes.cs b/src/mscorlib/shared/System/Globalization/GregorianCalendarTypes.cs
index a14010fe60..1b61e5256e 100644
--- a/src/mscorlib/src/System/Globalization/GregorianCalendarTypes.cs
+++ b/src/mscorlib/shared/System/Globalization/GregorianCalendarTypes.cs
@@ -2,8 +2,6 @@
// 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;
-
namespace System.Globalization
{
// Note: The values of the members of this enum must match the coresponding values
diff --git a/src/mscorlib/src/System/Globalization/HebrewCalendar.cs b/src/mscorlib/shared/System/Globalization/HebrewCalendar.cs
index b4f54f8fbb..b4f54f8fbb 100644
--- a/src/mscorlib/src/System/Globalization/HebrewCalendar.cs
+++ b/src/mscorlib/shared/System/Globalization/HebrewCalendar.cs
diff --git a/src/mscorlib/src/System/Globalization/HebrewNumber.cs b/src/mscorlib/shared/System/Globalization/HebrewNumber.cs
index 1e8fff2bcb..1e8fff2bcb 100644
--- a/src/mscorlib/src/System/Globalization/HebrewNumber.cs
+++ b/src/mscorlib/shared/System/Globalization/HebrewNumber.cs
diff --git a/src/mscorlib/src/System/Globalization/HijriCalendar.cs b/src/mscorlib/shared/System/Globalization/HijriCalendar.cs
index 0c72d9eaf5..cafde5fbb8 100644
--- a/src/mscorlib/src/System/Globalization/HijriCalendar.cs
+++ b/src/mscorlib/shared/System/Globalization/HijriCalendar.cs
@@ -2,8 +2,6 @@
// 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.Runtime.Versioning;
using System.Diagnostics.Contracts;
namespace System.Globalization
diff --git a/src/mscorlib/src/System/Globalization/InternalGlobalizationHelper.cs b/src/mscorlib/shared/System/Globalization/InternalGlobalizationHelper.cs
index 0a4e6f0600..f5eea1b629 100644
--- a/src/mscorlib/src/System/Globalization/InternalGlobalizationHelper.cs
+++ b/src/mscorlib/shared/System/Globalization/InternalGlobalizationHelper.cs
@@ -2,11 +2,9 @@
// 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;
-
namespace System.Globalization
{
- internal class InternalGloablizationHelper
+ internal class InternalGlobalizationHelper
{
// Copied from the TimeSpan to be used inside the globalization code and avoid internal dependancy on TimeSpan class
internal static long TimeToTicks(int hour, int minute, int second)
diff --git a/src/mscorlib/src/System/Globalization/JapaneseCalendar.cs b/src/mscorlib/shared/System/Globalization/JapaneseCalendar.cs
index f0216c8f51..4655e08a4e 100644
--- a/src/mscorlib/src/System/Globalization/JapaneseCalendar.cs
+++ b/src/mscorlib/shared/System/Globalization/JapaneseCalendar.cs
@@ -2,8 +2,6 @@
// 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.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
diff --git a/src/mscorlib/src/System/Globalization/JapaneseLunisolarCalendar.cs b/src/mscorlib/shared/System/Globalization/JapaneseLunisolarCalendar.cs
index cc3d34954d..95e87f85d7 100644
--- a/src/mscorlib/src/System/Globalization/JapaneseLunisolarCalendar.cs
+++ b/src/mscorlib/shared/System/Globalization/JapaneseLunisolarCalendar.cs
@@ -2,16 +2,10 @@
// 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.Diagnostics.Contracts;
namespace System.Globalization
{
- ////////////////////////////////////////////////////////////////////////////
- //
- // Notes about JapaneseLunisolarCalendar
- //
- ////////////////////////////////////////////////////////////////////////////
/*
** Calendar support range:
** Calendar Minimum Maximum
diff --git a/src/mscorlib/src/System/Globalization/JulianCalendar.cs b/src/mscorlib/shared/System/Globalization/JulianCalendar.cs
index 43e6ad07a2..f4678c1a85 100644
--- a/src/mscorlib/src/System/Globalization/JulianCalendar.cs
+++ b/src/mscorlib/shared/System/Globalization/JulianCalendar.cs
@@ -2,7 +2,6 @@
// 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.Diagnostics.Contracts;
namespace System.Globalization
diff --git a/src/mscorlib/src/System/Globalization/KoreanCalendar.cs b/src/mscorlib/shared/System/Globalization/KoreanCalendar.cs
index b015aa0716..b962b1c427 100644
--- a/src/mscorlib/src/System/Globalization/KoreanCalendar.cs
+++ b/src/mscorlib/shared/System/Globalization/KoreanCalendar.cs
@@ -2,7 +2,6 @@
// 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.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
diff --git a/src/mscorlib/src/System/Globalization/KoreanLunisolarCalendar.cs b/src/mscorlib/shared/System/Globalization/KoreanLunisolarCalendar.cs
index 6d091285b2..d4c71632aa 100644
--- a/src/mscorlib/src/System/Globalization/KoreanLunisolarCalendar.cs
+++ b/src/mscorlib/shared/System/Globalization/KoreanLunisolarCalendar.cs
@@ -2,16 +2,10 @@
// 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.Diagnostics.Contracts;
namespace System.Globalization
{
- ////////////////////////////////////////////////////////////////////////////
- //
- // Notes about KoreanLunisolarCalendar
- //
- ////////////////////////////////////////////////////////////////////////////
/*
** Calendar support range:
** Calendar Minimum Maximum
diff --git a/src/mscorlib/src/System/Globalization/LocaleData.Unix.cs b/src/mscorlib/shared/System/Globalization/LocaleData.Unix.cs
index d4c58d8a3d..d4c58d8a3d 100644
--- a/src/mscorlib/src/System/Globalization/LocaleData.Unix.cs
+++ b/src/mscorlib/shared/System/Globalization/LocaleData.Unix.cs
diff --git a/src/mscorlib/src/System/Globalization/NumberStyles.cs b/src/mscorlib/shared/System/Globalization/NumberStyles.cs
index 31eafc9299..5909d65a2c 100644
--- a/src/mscorlib/src/System/Globalization/NumberStyles.cs
+++ b/src/mscorlib/shared/System/Globalization/NumberStyles.cs
@@ -12,11 +12,8 @@
**
===========================================================*/
-using System;
-
namespace System.Globalization
{
- [Serializable]
[Flags]
public enum NumberStyles
{
diff --git a/src/mscorlib/src/System/Globalization/PersianCalendar.cs b/src/mscorlib/shared/System/Globalization/PersianCalendar.cs
index b8b3da6911..445bbd6d0c 100644
--- a/src/mscorlib/src/System/Globalization/PersianCalendar.cs
+++ b/src/mscorlib/shared/System/Globalization/PersianCalendar.cs
@@ -7,11 +7,6 @@ using System.Diagnostics.Contracts;
namespace System.Globalization
{
- ////////////////////////////////////////////////////////////////////////////
- //
- // Notes about PersianCalendar
- //
- ////////////////////////////////////////////////////////////////////////////
// Modern Persian calendar is a solar observation based calendar. Each new year begins on the day when the vernal equinox occurs before noon.
// The epoch is the date of the vernal equinox prior to the epoch of the Islamic calendar (March 19, 622 Julian or March 22, 622 Gregorian)
diff --git a/src/mscorlib/src/System/Globalization/SortVersion.cs b/src/mscorlib/shared/System/Globalization/SortVersion.cs
index 983179c149..a7aef6d84b 100644
--- a/src/mscorlib/src/System/Globalization/SortVersion.cs
+++ b/src/mscorlib/shared/System/Globalization/SortVersion.cs
@@ -2,9 +2,6 @@
// 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.Diagnostics.Contracts;
-
namespace System.Globalization
{
[Serializable]
@@ -98,4 +95,4 @@ namespace System.Globalization
return !(left == right);
}
}
-} \ No newline at end of file
+}
diff --git a/src/mscorlib/src/System/Globalization/TaiwanCalendar.cs b/src/mscorlib/shared/System/Globalization/TaiwanCalendar.cs
index 2e735e0cb9..2e735e0cb9 100644
--- a/src/mscorlib/src/System/Globalization/TaiwanCalendar.cs
+++ b/src/mscorlib/shared/System/Globalization/TaiwanCalendar.cs
diff --git a/src/mscorlib/src/System/Globalization/TaiwanLunisolarCalendar.cs b/src/mscorlib/shared/System/Globalization/TaiwanLunisolarCalendar.cs
index 1f75ac9a04..8ba1f278e7 100644
--- a/src/mscorlib/src/System/Globalization/TaiwanLunisolarCalendar.cs
+++ b/src/mscorlib/shared/System/Globalization/TaiwanLunisolarCalendar.cs
@@ -7,17 +7,12 @@ using System.Diagnostics.Contracts;
namespace System.Globalization
{
- ////////////////////////////////////////////////////////////////////////////
- //
- // Notes about TaiwanLunisolarCalendar
- //
- ////////////////////////////////////////////////////////////////////////////
/*
** Calendar support range:
- ** Calendar Minimum Maximum
- ** ========== ========== ==========
- ** Gregorian 1912/02/18 2051/02/10
- ** TaiwanLunisolar 1912/01/01 2050/13/29
+ ** Calendar Minimum Maximum
+ ** ========== ========== ==========
+ ** Gregorian 1912/02/18 2051/02/10
+ ** TaiwanLunisolar 1912/01/01 2050/13/29
*/
[Serializable]
diff --git a/src/mscorlib/src/System/Globalization/ThaiBuddhistCalendar.cs b/src/mscorlib/shared/System/Globalization/ThaiBuddhistCalendar.cs
index 9e6e30406c..9e6e30406c 100644
--- a/src/mscorlib/src/System/Globalization/ThaiBuddhistCalendar.cs
+++ b/src/mscorlib/shared/System/Globalization/ThaiBuddhistCalendar.cs
diff --git a/src/mscorlib/src/System/Globalization/TimeSpanStyles.cs b/src/mscorlib/shared/System/Globalization/TimeSpanStyles.cs
index 68a47bcbe6..68a47bcbe6 100644
--- a/src/mscorlib/src/System/Globalization/TimeSpanStyles.cs
+++ b/src/mscorlib/shared/System/Globalization/TimeSpanStyles.cs
diff --git a/src/mscorlib/src/System/Globalization/UmAlQuraCalendar.cs b/src/mscorlib/shared/System/Globalization/UmAlQuraCalendar.cs
index 7b47d9c02b..b7ba6d0112 100644
--- a/src/mscorlib/src/System/Globalization/UmAlQuraCalendar.cs
+++ b/src/mscorlib/shared/System/Globalization/UmAlQuraCalendar.cs
@@ -7,11 +7,6 @@ using System.Diagnostics.Contracts;
namespace System.Globalization
{
- ////////////////////////////////////////////////////////////////////////////
- //
- // Notes about UmAlQuraCalendar
- //
- ////////////////////////////////////////////////////////////////////////////
/*
** Calendar support range:
** Calendar Minimum Maximum
diff --git a/src/mscorlib/src/System/Globalization/UnicodeCategory.cs b/src/mscorlib/shared/System/Globalization/UnicodeCategory.cs
index 1c5e6bca56..f0ae1fdfd9 100644
--- a/src/mscorlib/src/System/Globalization/UnicodeCategory.cs
+++ b/src/mscorlib/shared/System/Globalization/UnicodeCategory.cs
@@ -4,67 +4,37 @@
namespace System.Globalization
{
- [Serializable]
public enum UnicodeCategory
{
UppercaseLetter = 0,
-
LowercaseLetter = 1,
-
TitlecaseLetter = 2,
-
ModifierLetter = 3,
-
OtherLetter = 4,
-
NonSpacingMark = 5,
-
SpacingCombiningMark = 6,
-
EnclosingMark = 7,
-
DecimalDigitNumber = 8,
-
LetterNumber = 9,
-
OtherNumber = 10,
-
SpaceSeparator = 11,
-
LineSeparator = 12,
-
ParagraphSeparator = 13,
-
Control = 14,
-
Format = 15,
-
Surrogate = 16,
-
PrivateUse = 17,
-
ConnectorPunctuation = 18,
-
DashPunctuation = 19,
-
OpenPunctuation = 20,
-
ClosePunctuation = 21,
-
InitialQuotePunctuation = 22,
-
FinalQuotePunctuation = 23,
-
OtherPunctuation = 24,
-
MathSymbol = 25,
-
CurrencySymbol = 26,
-
ModifierSymbol = 27,
-
OtherSymbol = 28,
-
OtherNotAssigned = 29,
}
}
diff --git a/src/mscorlib/shared/System/IO/Error.cs b/src/mscorlib/shared/System/IO/Error.cs
index acf5b35cdc..2aef895181 100644
--- a/src/mscorlib/shared/System/IO/Error.cs
+++ b/src/mscorlib/shared/System/IO/Error.cs
@@ -18,7 +18,7 @@ namespace System.IO
{
internal static Exception GetStreamIsClosed()
{
- return new ObjectDisposedException(null, SR.ObjectDisposed_StreamIsClosed);
+ return new ObjectDisposedException(null, SR.ObjectDisposed_StreamClosed);
}
internal static Exception GetEndOfFile()
diff --git a/src/mscorlib/shared/System/IO/FileStream.Unix.cs b/src/mscorlib/shared/System/IO/FileStream.Unix.cs
index 87bcc6c15e..7d860ac2fe 100644
--- a/src/mscorlib/shared/System/IO/FileStream.Unix.cs
+++ b/src/mscorlib/shared/System/IO/FileStream.Unix.cs
@@ -45,7 +45,7 @@ namespace System.IO
_asyncState = new AsyncState();
// Translate the arguments into arguments for an open call.
- Interop.Sys.OpenFlags openFlags = PreOpenConfigurationFromOptions(mode, _access, options); // FileShare currently ignored
+ Interop.Sys.OpenFlags openFlags = PreOpenConfigurationFromOptions(mode, _access, share, options);
// If the file gets created a new, we'll select the permissions for it. Most Unix utilities by default use 666 (read and
// write for all), so we do the same (even though this doesn't match Windows, where by default it's possible to write out
@@ -120,9 +120,10 @@ namespace System.IO
/// <summary>Translates the FileMode, FileAccess, and FileOptions values into flags to be passed when opening the file.</summary>
/// <param name="mode">The FileMode provided to the stream's constructor.</param>
/// <param name="access">The FileAccess provided to the stream's constructor</param>
+ /// <param name="share">The FileShare provided to the stream's constructor</param>
/// <param name="options">The FileOptions provided to the stream's constructor</param>
/// <returns>The flags value to be passed to the open system call.</returns>
- private static Interop.Sys.OpenFlags PreOpenConfigurationFromOptions(FileMode mode, FileAccess access, FileOptions options)
+ private static Interop.Sys.OpenFlags PreOpenConfigurationFromOptions(FileMode mode, FileAccess access, FileShare share, FileOptions options)
{
// Translate FileMode. Most of the values map cleanly to one or more options for open.
Interop.Sys.OpenFlags flags = default(Interop.Sys.OpenFlags);
@@ -166,6 +167,12 @@ namespace System.IO
break;
}
+ // Handle Inheritable, other FileShare flags are handled by Init
+ if ((share & FileShare.Inheritable) == 0)
+ {
+ flags |= Interop.Sys.OpenFlags.O_CLOEXEC;
+ }
+
// Translate some FileOptions; some just aren't supported, and others will be handled after calling open.
// - Asynchronous: Handled in ctor, setting _useAsync and SafeFileHandle.IsAsync to true
// - DeleteOnClose: Doesn't have a Unix equivalent, but we approximate it in Dispose
@@ -230,7 +237,15 @@ namespace System.IO
if (_fileHandle != null && !_fileHandle.IsClosed)
{
// Flush any remaining data in the file
- FlushWriteBuffer();
+ try
+ {
+ FlushWriteBuffer();
+ }
+ catch (IOException) when (!disposing)
+ {
+ // On finalization, ignore failures from trying to flush the write buffer,
+ // e.g. if this stream is wrapping a pipe and the pipe is now broken.
+ }
// If DeleteOnClose was requested when constructed, delete the file now.
// (Unix doesn't directly support DeleteOnClose, so we mimic it here.)
diff --git a/src/mscorlib/shared/System/IO/FileStream.Win32.cs b/src/mscorlib/shared/System/IO/FileStream.Win32.cs
index d7873207e3..0045ebeaf8 100644
--- a/src/mscorlib/shared/System/IO/FileStream.Win32.cs
+++ b/src/mscorlib/shared/System/IO/FileStream.Win32.cs
@@ -10,49 +10,10 @@ using System.Threading.Tasks;
using Microsoft.Win32.SafeHandles;
using System.Runtime.CompilerServices;
-/*
- * Win32FileStream supports different modes of accessing the disk - async mode
- * and sync mode. They are two completely different codepaths in the
- * sync & async methods (i.e. Read/Write vs. ReadAsync/WriteAsync). File
- * handles in NT can be opened in only sync or overlapped (async) mode,
- * and we have to deal with this pain. Stream has implementations of
- * the sync methods in terms of the async ones, so we'll
- * call through to our base class to get those methods when necessary.
- *
- * Also buffering is added into Win32FileStream as well. Folded in the
- * code from BufferedStream, so all the comments about it being mostly
- * aggressive (and the possible perf improvement) apply to Win32FileStream as
- * well. Also added some buffering to the async code paths.
- *
- * Class Invariants:
- * The class has one buffer, shared for reading & writing. It can only be
- * used for one or the other at any point in time - not both. The following
- * should be true:
- * 0 <= _readPos <= _readLen < _bufferSize
- * 0 <= _writePos < _bufferSize
- * _readPos == _readLen && _readPos > 0 implies the read buffer is valid,
- * but we're at the end of the buffer.
- * _readPos == _readLen == 0 means the read buffer contains garbage.
- * Either _writePos can be greater than 0, or _readLen & _readPos can be
- * greater than zero, but neither can be greater than zero at the same time.
- *
- */
-
namespace System.IO
{
public partial class FileStream : Stream
{
- private bool _canSeek;
- private bool _isPipe; // Whether to disable async buffering code.
- private long _appendStart; // When appending, prevent overwriting file.
-
- private static unsafe IOCompletionCallback s_ioCallback = FileStreamCompletionSource.IOCallback;
-
- private Task<int> _lastSynchronouslyCompletedTask = null; // cached task for read ops that complete synchronously
- private Task _activeBufferOperation = null; // tracks in-progress async ops using the buffer
- private PreAllocatedOverlapped _preallocatedOverlapped; // optimization for async ops to avoid per-op allocations
- private FileStreamCompletionSource _currentOverlappedOwner; // async op currently using the preallocated overlapped
-
private SafeFileHandle OpenHandle(FileMode mode, FileShare share, FileOptions options)
{
Interop.Kernel32.SECURITY_ATTRIBUTES secAttrs = GetSecAttrs(share);
@@ -112,1666 +73,5 @@ namespace System.IO
Interop.Kernel32.SetErrorMode(oldMode);
}
}
-
- private void Init(FileMode mode, FileShare share)
- {
- // Disallow access to all non-file devices from the Win32FileStream
- // constructors that take a String. Everyone else can call
- // CreateFile themselves then use the constructor that takes an
- // IntPtr. Disallows "con:", "com1:", "lpt1:", etc.
- int fileType = Interop.Kernel32.GetFileType(_fileHandle);
- if (fileType != Interop.Kernel32.FileTypes.FILE_TYPE_DISK)
- {
- _fileHandle.Dispose();
- throw new NotSupportedException(SR.NotSupported_FileStreamOnNonFiles);
- }
-
- // This is necessary for async IO using IO Completion ports via our
- // managed Threadpool API's. This (theoretically) calls the OS's
- // BindIoCompletionCallback method, and passes in a stub for the
- // LPOVERLAPPED_COMPLETION_ROUTINE. This stub looks at the Overlapped
- // struct for this request and gets a delegate to a managed callback
- // from there, which it then calls on a threadpool thread. (We allocate
- // our native OVERLAPPED structs 2 pointers too large and store EE state
- // & GC handles there, one to an IAsyncResult, the other to a delegate.)
- if (_useAsyncIO)
- {
- try
- {
- _fileHandle.ThreadPoolBinding = ThreadPoolBoundHandle.BindHandle(_fileHandle);
- }
- catch (ArgumentException ex)
- {
- throw new IOException(SR.IO_BindHandleFailed, ex);
- }
- finally
- {
- if (_fileHandle.ThreadPoolBinding == null)
- {
- // We should close the handle so that the handle is not open until SafeFileHandle GC
- Debug.Assert(!_exposedHandle, "Are we closing handle that we exposed/not own, how?");
- _fileHandle.Dispose();
- }
- }
- }
-
- _canSeek = true;
-
- // For Append mode...
- if (mode == FileMode.Append)
- {
- _appendStart = SeekCore(0, SeekOrigin.End);
- }
- else
- {
- _appendStart = -1;
- }
- }
-
- private void InitFromHandle(SafeFileHandle handle)
- {
- int handleType = Interop.Kernel32.GetFileType(_fileHandle);
- Debug.Assert(handleType == Interop.Kernel32.FileTypes.FILE_TYPE_DISK || handleType == Interop.Kernel32.FileTypes.FILE_TYPE_PIPE || handleType == Interop.Kernel32.FileTypes.FILE_TYPE_CHAR, "FileStream was passed an unknown file type!");
-
- _canSeek = handleType == Interop.Kernel32.FileTypes.FILE_TYPE_DISK;
- _isPipe = handleType == Interop.Kernel32.FileTypes.FILE_TYPE_PIPE;
-
- // This is necessary for async IO using IO Completion ports via our
- // managed Threadpool API's. This calls the OS's
- // BindIoCompletionCallback method, and passes in a stub for the
- // LPOVERLAPPED_COMPLETION_ROUTINE. This stub looks at the Overlapped
- // struct for this request and gets a delegate to a managed callback
- // from there, which it then calls on a threadpool thread. (We allocate
- // our native OVERLAPPED structs 2 pointers too large and store EE
- // state & a handle to a delegate there.)
- //
- // If, however, we've already bound this file handle to our completion port,
- // don't try to bind it again because it will fail. A handle can only be
- // bound to a single completion port at a time.
- if (_useAsyncIO && !GetSuppressBindHandle(handle))
- {
- try
- {
- _fileHandle.ThreadPoolBinding = ThreadPoolBoundHandle.BindHandle(_fileHandle);
- }
- catch (Exception ex)
- {
- // If you passed in a synchronous handle and told us to use
- // it asynchronously, throw here.
- throw new ArgumentException(SR.Arg_HandleNotAsync, nameof(handle), ex);
- }
- }
- else if (!_useAsyncIO)
- {
- if (handleType != Interop.Kernel32.FileTypes.FILE_TYPE_PIPE)
- VerifyHandleIsSync();
- }
-
- if (_canSeek)
- SeekCore(0, SeekOrigin.Current);
- else
- _filePosition = 0;
- }
-
- private static bool GetSuppressBindHandle(SafeFileHandle handle)
- {
- return handle.IsAsync.HasValue ? handle.IsAsync.Value : false;
- }
-
- private unsafe static Interop.Kernel32.SECURITY_ATTRIBUTES GetSecAttrs(FileShare share)
- {
- Interop.Kernel32.SECURITY_ATTRIBUTES secAttrs = default(Interop.Kernel32.SECURITY_ATTRIBUTES);
- if ((share & FileShare.Inheritable) != 0)
- {
- secAttrs = new Interop.Kernel32.SECURITY_ATTRIBUTES();
- secAttrs.nLength = (uint)sizeof(Interop.Kernel32.SECURITY_ATTRIBUTES);
-
- secAttrs.bInheritHandle = Interop.BOOL.TRUE;
- }
- return secAttrs;
- }
-
- // Verifies that this handle supports synchronous IO operations (unless you
- // didn't open it for either reading or writing).
- private unsafe void VerifyHandleIsSync()
- {
- Debug.Assert(!_useAsyncIO);
-
- // Do NOT use this method on pipes. Reading or writing to a pipe may
- // cause an app to block incorrectly, introducing a deadlock (depending
- // on whether a write will wake up an already-blocked thread or this
- // Win32FileStream's thread).
- Debug.Assert(Interop.Kernel32.GetFileType(_fileHandle) != Interop.Kernel32.FileTypes.FILE_TYPE_PIPE);
-
- byte* bytes = stackalloc byte[1];
- int numBytesReadWritten;
- int r = -1;
-
- // If the handle is a pipe, ReadFile will block until there
- // has been a write on the other end. We'll just have to deal with it,
- // For the read end of a pipe, you can mess up and
- // accidentally read synchronously from an async pipe.
- if ((_access & FileAccess.Read) != 0) // don't use the virtual CanRead or CanWrite, as this may be used in the ctor
- {
- r = Interop.Kernel32.ReadFile(_fileHandle, bytes, 0, out numBytesReadWritten, IntPtr.Zero);
- }
- else if ((_access & FileAccess.Write) != 0) // don't use the virtual CanRead or CanWrite, as this may be used in the ctor
- {
- r = Interop.Kernel32.WriteFile(_fileHandle, bytes, 0, out numBytesReadWritten, IntPtr.Zero);
- }
-
- if (r == 0)
- {
- int errorCode = GetLastWin32ErrorAndDisposeHandleIfInvalid(throwIfInvalidHandle: true);
- if (errorCode == ERROR_INVALID_PARAMETER)
- throw new ArgumentException(SR.Arg_HandleNotSync, "handle");
- }
- }
-
- private bool HasActiveBufferOperation
- {
- get { return _activeBufferOperation != null && !_activeBufferOperation.IsCompleted; }
- }
-
- public override bool CanSeek
- {
- get { return _canSeek; }
- }
-
- private unsafe long GetLengthInternal()
- {
- Interop.Kernel32.FILE_STANDARD_INFO info = new Interop.Kernel32.FILE_STANDARD_INFO();
-
- if (!Interop.Kernel32.GetFileInformationByHandleEx(_fileHandle, Interop.Kernel32.FILE_INFO_BY_HANDLE_CLASS.FileStandardInfo, out info, (uint)sizeof(Interop.Kernel32.FILE_STANDARD_INFO)))
- throw Win32Marshal.GetExceptionForLastWin32Error();
- long len = info.EndOfFile;
- // If we're writing near the end of the file, we must include our
- // internal buffer in our Length calculation. Don't flush because
- // we use the length of the file in our async write method.
- if (_writePos > 0 && _filePosition + _writePos > len)
- len = _writePos + _filePosition;
- return len;
- }
-
- protected override void Dispose(bool disposing)
- {
- // Nothing will be done differently based on whether we are
- // disposing vs. finalizing. This is taking advantage of the
- // weak ordering between normal finalizable objects & critical
- // finalizable objects, which I included in the SafeHandle
- // design for Win32FileStream, which would often "just work" when
- // finalized.
- try
- {
- if (_fileHandle != null && !_fileHandle.IsClosed)
- {
- // Flush data to disk iff we were writing. After
- // thinking about this, we also don't need to flush
- // our read position, regardless of whether the handle
- // was exposed to the user. They probably would NOT
- // want us to do this.
- if (_writePos > 0)
- {
- FlushWriteBuffer(!disposing);
- }
- }
- }
- finally
- {
- if (_fileHandle != null && !_fileHandle.IsClosed)
- {
- if (_fileHandle.ThreadPoolBinding != null)
- _fileHandle.ThreadPoolBinding.Dispose();
-
- _fileHandle.Dispose();
- }
-
- if (_preallocatedOverlapped != null)
- _preallocatedOverlapped.Dispose();
-
- _canSeek = false;
-
- // Don't set the buffer to null, to avoid a NullReferenceException
- // when users have a race condition in their code (i.e. they call
- // Close when calling another method on Stream like Read).
- //_buffer = null;
- base.Dispose(disposing);
- }
- }
-
- private void FlushOSBuffer()
- {
- if (!Interop.Kernel32.FlushFileBuffers(_fileHandle))
- {
- throw Win32Marshal.GetExceptionForLastWin32Error();
- }
- }
-
- // Returns a task that flushes the internal write buffer
- private Task FlushWriteAsync(CancellationToken cancellationToken)
- {
- Debug.Assert(_useAsyncIO);
- Debug.Assert(_readPos == 0 && _readLength == 0, "FileStream: Read buffer must be empty in FlushWriteAsync!");
-
- // If the buffer is already flushed, don't spin up the OS write
- if (_writePos == 0) return Task.CompletedTask;
-
- Task flushTask = WriteInternalCoreAsync(GetBuffer(), 0, _writePos, cancellationToken);
- _writePos = 0;
-
- // Update the active buffer operation
- _activeBufferOperation = HasActiveBufferOperation ?
- Task.WhenAll(_activeBufferOperation, flushTask) :
- flushTask;
-
- return flushTask;
- }
-
- // Writes are buffered. Anytime the buffer fills up
- // (_writePos + delta > _bufferSize) or the buffer switches to reading
- // and there is left over data (_writePos > 0), this function must be called.
- private void FlushWriteBuffer(bool calledFromFinalizer = false)
- {
- if (_writePos == 0) return;
- Debug.Assert(_readPos == 0 && _readLength == 0, "FileStream: Read buffer must be empty in FlushWrite!");
-
- if (_useAsyncIO)
- {
- Task writeTask = FlushWriteAsync(CancellationToken.None);
- // With our Whidbey async IO & overlapped support for AD unloads,
- // we don't strictly need to block here to release resources
- // since that support takes care of the pinning & freeing the
- // overlapped struct. We need to do this when called from
- // Close so that the handle is closed when Close returns, but
- // we don't need to call EndWrite from the finalizer.
- // Additionally, if we do call EndWrite, we block forever
- // because AD unloads prevent us from running the managed
- // callback from the IO completion port. Blocking here when
- // called from the finalizer during AD unload is clearly wrong,
- // but we can't use any sort of test for whether the AD is
- // unloading because if we weren't unloading, an AD unload
- // could happen on a separate thread before we call EndWrite.
- if (!calledFromFinalizer)
- {
- writeTask.GetAwaiter().GetResult();
- }
- }
- else
- {
- WriteCore(GetBuffer(), 0, _writePos);
- }
-
- _writePos = 0;
- }
-
- private void SetLengthInternal(long value)
- {
- // Handle buffering updates.
- if (_writePos > 0)
- {
- FlushWriteBuffer();
- }
- else if (_readPos < _readLength)
- {
- FlushReadBuffer();
- }
- _readPos = 0;
- _readLength = 0;
-
- if (_appendStart != -1 && value < _appendStart)
- throw new IOException(SR.IO_SetLengthAppendTruncate);
- SetLengthCore(value);
- }
-
- // We absolutely need this method broken out so that WriteInternalCoreAsync can call
- // a method without having to go through buffering code that might call FlushWrite.
- private void SetLengthCore(long value)
- {
- Debug.Assert(value >= 0, "value >= 0");
- long origPos = _filePosition;
-
- VerifyOSHandlePosition();
- if (_filePosition != value)
- SeekCore(value, SeekOrigin.Begin);
- if (!Interop.Kernel32.SetEndOfFile(_fileHandle))
- {
- int errorCode = Marshal.GetLastWin32Error();
- if (errorCode == Interop.Errors.ERROR_INVALID_PARAMETER)
- throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_FileLengthTooBig);
- throw Win32Marshal.GetExceptionForWin32Error(errorCode);
- }
- // Return file pointer to where it was before setting length
- if (origPos != value)
- {
- if (origPos < value)
- SeekCore(origPos, SeekOrigin.Begin);
- else
- SeekCore(0, SeekOrigin.End);
- }
- }
-
- // Instance method to help code external to this MarshalByRefObject avoid
- // accessing its fields by ref. This avoids a compiler warning.
- private FileStreamCompletionSource CompareExchangeCurrentOverlappedOwner(FileStreamCompletionSource newSource, FileStreamCompletionSource existingSource) => Interlocked.CompareExchange(ref _currentOverlappedOwner, newSource, existingSource);
-
- public override int Read(byte[] array, int offset, int count)
- {
- ValidateReadWriteArgs(array, offset, count);
- return ReadCore(array, offset, count);
- }
-
- private int ReadCore(byte[] array, int offset, int count)
- {
- Debug.Assert((_readPos == 0 && _readLength == 0 && _writePos >= 0) || (_writePos == 0 && _readPos <= _readLength),
- "We're either reading or writing, but not both.");
-
- bool isBlocked = false;
- int n = _readLength - _readPos;
- // if the read buffer is empty, read into either user's array or our
- // buffer, depending on number of bytes user asked for and buffer size.
- if (n == 0)
- {
- if (!CanRead) throw Error.GetReadNotSupported();
- if (_writePos > 0) FlushWriteBuffer();
- if (!CanSeek || (count >= _bufferLength))
- {
- n = ReadNative(array, offset, count);
- // Throw away read buffer.
- _readPos = 0;
- _readLength = 0;
- return n;
- }
- n = ReadNative(GetBuffer(), 0, _bufferLength);
- if (n == 0) return 0;
- isBlocked = n < _bufferLength;
- _readPos = 0;
- _readLength = n;
- }
- // Now copy min of count or numBytesAvailable (i.e. near EOF) to array.
- if (n > count) n = count;
- Buffer.BlockCopy(GetBuffer(), _readPos, array, offset, n);
- _readPos += n;
-
- // We may have read less than the number of bytes the user asked
- // for, but that is part of the Stream contract. Reading again for
- // more data may cause us to block if we're using a device with
- // no clear end of file, such as a serial port or pipe. If we
- // blocked here & this code was used with redirected pipes for a
- // process's standard output, this can lead to deadlocks involving
- // two processes. But leave this here for files to avoid what would
- // probably be a breaking change. --
-
- // If we are reading from a device with no clear EOF like a
- // serial port or a pipe, this will cause us to block incorrectly.
- if (!_isPipe)
- {
- // If we hit the end of the buffer and didn't have enough bytes, we must
- // read some more from the underlying stream. However, if we got
- // fewer bytes from the underlying stream than we asked for (i.e. we're
- // probably blocked), don't ask for more bytes.
- if (n < count && !isBlocked)
- {
- Debug.Assert(_readPos == _readLength, "Read buffer should be empty!");
- int moreBytesRead = ReadNative(array, offset + n, count - n);
- n += moreBytesRead;
- // We've just made our buffer inconsistent with our position
- // pointer. We must throw away the read buffer.
- _readPos = 0;
- _readLength = 0;
- }
- }
-
- return n;
- }
-
- [Conditional("DEBUG")]
- private void AssertCanRead(byte[] buffer, int offset, int count)
- {
- Debug.Assert(!_fileHandle.IsClosed, "!_fileHandle.IsClosed");
- Debug.Assert(CanRead, "CanRead");
- Debug.Assert(buffer != null, "buffer != null");
- Debug.Assert(_writePos == 0, "_writePos == 0");
- Debug.Assert(offset >= 0, "offset is negative");
- Debug.Assert(count >= 0, "count is negative");
- }
-
- private unsafe int ReadNative(byte[] buffer, int offset, int count)
- {
- AssertCanRead(buffer, offset, count);
-
- if (_useAsyncIO)
- return ReadNativeAsync(buffer, offset, count, 0, CancellationToken.None).GetAwaiter().GetResult();
-
- // Make sure we are reading from the right spot
- VerifyOSHandlePosition();
-
- int errorCode = 0;
- int r = ReadFileNative(_fileHandle, buffer, offset, count, null, out errorCode);
-
- if (r == -1)
- {
- // For pipes, ERROR_BROKEN_PIPE is the normal end of the pipe.
- if (errorCode == ERROR_BROKEN_PIPE)
- {
- r = 0;
- }
- else
- {
- if (errorCode == ERROR_INVALID_PARAMETER)
- throw new ArgumentException(SR.Arg_HandleNotSync, "_fileHandle");
-
- throw Win32Marshal.GetExceptionForWin32Error(errorCode);
- }
- }
- Debug.Assert(r >= 0, "FileStream's ReadNative is likely broken.");
- _filePosition += r;
-
- return r;
- }
-
- public override long Seek(long offset, SeekOrigin origin)
- {
- if (origin < SeekOrigin.Begin || origin > SeekOrigin.End)
- throw new ArgumentException(SR.Argument_InvalidSeekOrigin, nameof(origin));
- if (_fileHandle.IsClosed) throw Error.GetFileNotOpen();
- if (!CanSeek) throw Error.GetSeekNotSupported();
-
- Debug.Assert((_readPos == 0 && _readLength == 0 && _writePos >= 0) || (_writePos == 0 && _readPos <= _readLength), "We're either reading or writing, but not both.");
-
- // If we've got bytes in our buffer to write, write them out.
- // If we've read in and consumed some bytes, we'll have to adjust
- // our seek positions ONLY IF we're seeking relative to the current
- // position in the stream. This simulates doing a seek to the new
- // position, then a read for the number of bytes we have in our buffer.
- if (_writePos > 0)
- {
- FlushWriteBuffer();
- }
- else if (origin == SeekOrigin.Current)
- {
- // Don't call FlushRead here, which would have caused an infinite
- // loop. Simply adjust the seek origin. This isn't necessary
- // if we're seeking relative to the beginning or end of the stream.
- offset -= (_readLength - _readPos);
- }
- _readPos = _readLength = 0;
-
- // Verify that internal position is in sync with the handle
- VerifyOSHandlePosition();
-
- long oldPos = _filePosition + (_readPos - _readLength);
- long pos = SeekCore(offset, origin);
-
- // Prevent users from overwriting data in a file that was opened in
- // append mode.
- if (_appendStart != -1 && pos < _appendStart)
- {
- SeekCore(oldPos, SeekOrigin.Begin);
- throw new IOException(SR.IO_SeekAppendOverwrite);
- }
-
- // We now must update the read buffer. We can in some cases simply
- // update _readPos within the buffer, copy around the buffer so our
- // Position property is still correct, and avoid having to do more
- // reads from the disk. Otherwise, discard the buffer's contents.
- if (_readLength > 0)
- {
- // We can optimize the following condition:
- // oldPos - _readPos <= pos < oldPos + _readLen - _readPos
- if (oldPos == pos)
- {
- if (_readPos > 0)
- {
- //Console.WriteLine("Seek: seeked for 0, adjusting buffer back by: "+_readPos+" _readLen: "+_readLen);
- Buffer.BlockCopy(GetBuffer(), _readPos, GetBuffer(), 0, _readLength - _readPos);
- _readLength -= _readPos;
- _readPos = 0;
- }
- // If we still have buffered data, we must update the stream's
- // position so our Position property is correct.
- if (_readLength > 0)
- SeekCore(_readLength, SeekOrigin.Current);
- }
- else if (oldPos - _readPos < pos && pos < oldPos + _readLength - _readPos)
- {
- int diff = (int)(pos - oldPos);
- //Console.WriteLine("Seek: diff was "+diff+", readpos was "+_readPos+" adjusting buffer - shrinking by "+ (_readPos + diff));
- Buffer.BlockCopy(GetBuffer(), _readPos + diff, GetBuffer(), 0, _readLength - (_readPos + diff));
- _readLength -= (_readPos + diff);
- _readPos = 0;
- if (_readLength > 0)
- SeekCore(_readLength, SeekOrigin.Current);
- }
- else
- {
- // Lose the read buffer.
- _readPos = 0;
- _readLength = 0;
- }
- Debug.Assert(_readLength >= 0 && _readPos <= _readLength, "_readLen should be nonnegative, and _readPos should be less than or equal _readLen");
- Debug.Assert(pos == Position, "Seek optimization: pos != Position! Buffer math was mangled.");
- }
- return pos;
- }
-
- // This doesn't do argument checking. Necessary for SetLength, which must
- // set the file pointer beyond the end of the file. This will update the
- // internal position
- // This is called during construction so it should avoid any virtual
- // calls
- private long SeekCore(long offset, SeekOrigin origin)
- {
- Debug.Assert(!_fileHandle.IsClosed && _canSeek, "!_handle.IsClosed && _parent.CanSeek");
- Debug.Assert(origin >= SeekOrigin.Begin && origin <= SeekOrigin.End, "origin>=SeekOrigin.Begin && origin<=SeekOrigin.End");
- long ret = 0;
-
- if (!Interop.Kernel32.SetFilePointerEx(_fileHandle, offset, out ret, (uint)origin))
- {
- int errorCode = GetLastWin32ErrorAndDisposeHandleIfInvalid();
- throw Win32Marshal.GetExceptionForWin32Error(errorCode);
- }
-
- _filePosition = ret;
- return ret;
- }
-
- partial void OnBufferAllocated()
- {
- Debug.Assert(_buffer != null);
- Debug.Assert(_preallocatedOverlapped == null);
-
- if (_useAsyncIO)
- _preallocatedOverlapped = new PreAllocatedOverlapped(s_ioCallback, this, _buffer);
- }
-
- public override void Write(byte[] array, int offset, int count)
- {
- ValidateReadWriteArgs(array, offset, count);
-
- if (_writePos == 0)
- {
- // Ensure we can write to the stream, and ready buffer for writing.
- if (!CanWrite) throw Error.GetWriteNotSupported();
- if (_readPos < _readLength) FlushReadBuffer();
- _readPos = 0;
- _readLength = 0;
- }
-
- // If our buffer has data in it, copy data from the user's array into
- // the buffer, and if we can fit it all there, return. Otherwise, write
- // the buffer to disk and copy any remaining data into our buffer.
- // The assumption here is memcpy is cheaper than disk (or net) IO.
- // (10 milliseconds to disk vs. ~20-30 microseconds for a 4K memcpy)
- // So the extra copying will reduce the total number of writes, in
- // non-pathological cases (i.e. write 1 byte, then write for the buffer
- // size repeatedly)
- if (_writePos > 0)
- {
- int numBytes = _bufferLength - _writePos; // space left in buffer
- if (numBytes > 0)
- {
- if (numBytes > count)
- numBytes = count;
- Buffer.BlockCopy(array, offset, GetBuffer(), _writePos, numBytes);
- _writePos += numBytes;
- if (count == numBytes) return;
- offset += numBytes;
- count -= numBytes;
- }
- // Reset our buffer. We essentially want to call FlushWrite
- // without calling Flush on the underlying Stream.
-
- if (_useAsyncIO)
- {
- WriteInternalCoreAsync(GetBuffer(), 0, _writePos, CancellationToken.None).GetAwaiter().GetResult();
- }
- else
- {
- WriteCore(GetBuffer(), 0, _writePos);
- }
- _writePos = 0;
- }
- // If the buffer would slow writes down, avoid buffer completely.
- if (count >= _bufferLength)
- {
- Debug.Assert(_writePos == 0, "FileStream cannot have buffered data to write here! Your stream will be corrupted.");
- WriteCore(array, offset, count);
- return;
- }
- else if (count == 0)
- {
- return; // Don't allocate a buffer then call memcpy for 0 bytes.
- }
-
- // Copy remaining bytes into buffer, to write at a later date.
- Buffer.BlockCopy(array, offset, GetBuffer(), _writePos, count);
- _writePos = count;
- return;
- }
-
- private unsafe void WriteCore(byte[] buffer, int offset, int count)
- {
- Debug.Assert(!_fileHandle.IsClosed, "!_handle.IsClosed");
- Debug.Assert(CanWrite, "_parent.CanWrite");
-
- Debug.Assert(buffer != null, "buffer != null");
- Debug.Assert(_readPos == _readLength, "_readPos == _readLen");
- Debug.Assert(offset >= 0, "offset is negative");
- Debug.Assert(count >= 0, "count is negative");
- if (_useAsyncIO)
- {
- WriteInternalCoreAsync(buffer, offset, count, CancellationToken.None).GetAwaiter().GetResult();
- return;
- }
-
- // Make sure we are writing to the position that we think we are
- VerifyOSHandlePosition();
-
- int errorCode = 0;
- int r = WriteFileNative(_fileHandle, buffer, offset, count, null, out errorCode);
-
- if (r == -1)
- {
- // For pipes, ERROR_NO_DATA is not an error, but the pipe is closing.
- if (errorCode == ERROR_NO_DATA)
- {
- r = 0;
- }
- else
- {
- // ERROR_INVALID_PARAMETER may be returned for writes
- // where the position is too large (i.e. writing at Int64.MaxValue
- // on Win9x) OR for synchronous writes to a handle opened
- // asynchronously.
- if (errorCode == ERROR_INVALID_PARAMETER)
- throw new IOException(SR.IO_FileTooLongOrHandleNotSync);
- throw Win32Marshal.GetExceptionForWin32Error(errorCode);
- }
- }
- Debug.Assert(r >= 0, "FileStream's WriteCore is likely broken.");
- _filePosition += r;
- return;
- }
-
- private Task<int> ReadAsyncInternal(byte[] array, int offset, int numBytes, CancellationToken cancellationToken)
- {
- // If async IO is not supported on this platform or
- // if this Win32FileStream was not opened with FileOptions.Asynchronous.
- if (!_useAsyncIO)
- {
- return base.ReadAsync(array, offset, numBytes, cancellationToken);
- }
-
- if (!CanRead) throw Error.GetReadNotSupported();
-
- Debug.Assert((_readPos == 0 && _readLength == 0 && _writePos >= 0) || (_writePos == 0 && _readPos <= _readLength), "We're either reading or writing, but not both.");
-
- if (_isPipe)
- {
- // Pipes are tricky, at least when you have 2 different pipes
- // that you want to use simultaneously. When redirecting stdout
- // & stderr with the Process class, it's easy to deadlock your
- // parent & child processes when doing writes 4K at a time. The
- // OS appears to use a 4K buffer internally. If you write to a
- // pipe that is full, you will block until someone read from
- // that pipe. If you try reading from an empty pipe and
- // Win32FileStream's ReadAsync blocks waiting for data to fill it's
- // internal buffer, you will be blocked. In a case where a child
- // process writes to stdout & stderr while a parent process tries
- // reading from both, you can easily get into a deadlock here.
- // To avoid this deadlock, don't buffer when doing async IO on
- // pipes. But don't completely ignore buffered data either.
- if (_readPos < _readLength)
- {
- int n = _readLength - _readPos;
- if (n > numBytes) n = numBytes;
- Buffer.BlockCopy(GetBuffer(), _readPos, array, offset, n);
- _readPos += n;
-
- // Return a completed task
- return TaskFromResultOrCache(n);
- }
- else
- {
- Debug.Assert(_writePos == 0, "Win32FileStream must not have buffered write data here! Pipes should be unidirectional.");
- return ReadNativeAsync(array, offset, numBytes, 0, cancellationToken);
- }
- }
-
- Debug.Assert(!_isPipe, "Should not be a pipe.");
-
- // Handle buffering.
- if (_writePos > 0) FlushWriteBuffer();
- if (_readPos == _readLength)
- {
- // I can't see how to handle buffering of async requests when
- // filling the buffer asynchronously, without a lot of complexity.
- // The problems I see are issuing an async read, we do an async
- // read to fill the buffer, then someone issues another read
- // (either synchronously or asynchronously) before the first one
- // returns. This would involve some sort of complex buffer locking
- // that we probably don't want to get into, at least not in V1.
- // If we did a sync read to fill the buffer, we could avoid the
- // problem, and any async read less than 64K gets turned into a
- // synchronous read by NT anyways... --
-
- if (numBytes < _bufferLength)
- {
- Task<int> readTask = ReadNativeAsync(GetBuffer(), 0, _bufferLength, 0, cancellationToken);
- _readLength = readTask.GetAwaiter().GetResult();
- int n = _readLength;
- if (n > numBytes) n = numBytes;
- Buffer.BlockCopy(GetBuffer(), 0, array, offset, n);
- _readPos = n;
-
- // Return a completed task (recycling the one above if possible)
- return (_readLength == n ? readTask : TaskFromResultOrCache(n));
- }
- else
- {
- // Here we're making our position pointer inconsistent
- // with our read buffer. Throw away the read buffer's contents.
- _readPos = 0;
- _readLength = 0;
- return ReadNativeAsync(array, offset, numBytes, 0, cancellationToken);
- }
- }
- else
- {
- int n = _readLength - _readPos;
- if (n > numBytes) n = numBytes;
- Buffer.BlockCopy(GetBuffer(), _readPos, array, offset, n);
- _readPos += n;
-
- if (n >= numBytes)
- {
- // Return a completed task
- return TaskFromResultOrCache(n);
- }
- else
- {
- // For streams with no clear EOF like serial ports or pipes
- // we cannot read more data without causing an app to block
- // incorrectly. Pipes don't go down this path
- // though. This code needs to be fixed.
- // Throw away read buffer.
- _readPos = 0;
- _readLength = 0;
- return ReadNativeAsync(array, offset + n, numBytes - n, n, cancellationToken);
- }
- }
- }
-
- unsafe private Task<int> ReadNativeAsync(byte[] bytes, int offset, int numBytes, int numBufferedBytesRead, CancellationToken cancellationToken)
- {
- AssertCanRead(bytes, offset, numBytes);
- Debug.Assert(_useAsyncIO, "ReadNativeAsync doesn't work on synchronous file streams!");
-
- // Create and store async stream class library specific data in the async result
-
- FileStreamCompletionSource completionSource = new FileStreamCompletionSource(this, numBufferedBytesRead, bytes, cancellationToken);
- NativeOverlapped* intOverlapped = completionSource.Overlapped;
-
- // Calculate position in the file we should be at after the read is done
- if (CanSeek)
- {
- long len = Length;
-
- // Make sure we are reading from the position that we think we are
- VerifyOSHandlePosition();
-
- if (_filePosition + numBytes > len)
- {
- if (_filePosition <= len)
- numBytes = (int)(len - _filePosition);
- else
- numBytes = 0;
- }
-
- // Now set the position to read from in the NativeOverlapped struct
- // For pipes, we should leave the offset fields set to 0.
- intOverlapped->OffsetLow = unchecked((int)_filePosition);
- intOverlapped->OffsetHigh = (int)(_filePosition >> 32);
-
- // When using overlapped IO, the OS is not supposed to
- // touch the file pointer location at all. We will adjust it
- // ourselves. This isn't threadsafe.
-
- // WriteFile should not update the file pointer when writing
- // in overlapped mode, according to MSDN. But it does update
- // the file pointer when writing to a UNC path!
- // So changed the code below to seek to an absolute
- // location, not a relative one. ReadFile seems consistent though.
- SeekCore(numBytes, SeekOrigin.Current);
- }
-
- // queue an async ReadFile operation and pass in a packed overlapped
- int errorCode = 0;
- int r = ReadFileNative(_fileHandle, bytes, offset, numBytes, intOverlapped, out errorCode);
- // ReadFile, the OS version, will return 0 on failure. But
- // my ReadFileNative wrapper returns -1. My wrapper will return
- // the following:
- // On error, r==-1.
- // On async requests that are still pending, r==-1 w/ errorCode==ERROR_IO_PENDING
- // on async requests that completed sequentially, r==0
- // You will NEVER RELIABLY be able to get the number of bytes
- // read back from this call when using overlapped structures! You must
- // not pass in a non-null lpNumBytesRead to ReadFile when using
- // overlapped structures! This is by design NT behavior.
- if (r == -1 && numBytes != -1)
- {
- // For pipes, when they hit EOF, they will come here.
- if (errorCode == ERROR_BROKEN_PIPE)
- {
- // Not an error, but EOF. AsyncFSCallback will NOT be
- // called. Call the user callback here.
-
- // We clear the overlapped status bit for this special case.
- // Failure to do so looks like we are freeing a pending overlapped later.
- intOverlapped->InternalLow = IntPtr.Zero;
- completionSource.SetCompletedSynchronously(0);
- }
- else if (errorCode != ERROR_IO_PENDING)
- {
- if (!_fileHandle.IsClosed && CanSeek) // Update Position - It could be anywhere.
- {
- SeekCore(0, SeekOrigin.Current);
- }
-
- completionSource.ReleaseNativeResource();
-
- if (errorCode == ERROR_HANDLE_EOF)
- {
- throw Error.GetEndOfFile();
- }
- else
- {
- throw Win32Marshal.GetExceptionForWin32Error(errorCode);
- }
- }
- else
- {
- // Only once the IO is pending do we register for cancellation
- completionSource.RegisterForCancellation();
- }
- }
- else
- {
- // Due to a workaround for a race condition in NT's ReadFile &
- // WriteFile routines, we will always be returning 0 from ReadFileNative
- // when we do async IO instead of the number of bytes read,
- // irregardless of whether the operation completed
- // synchronously or asynchronously. We absolutely must not
- // set asyncResult._numBytes here, since will never have correct
- // results.
- //Console.WriteLine("ReadFile returned: "+r+" (0x"+Int32.Format(r, "x")+") The IO completed synchronously, but the user callback was called on a separate thread");
- }
-
- return completionSource.Task;
- }
-
- // Reads a byte from the file stream. Returns the byte cast to an int
- // or -1 if reading from the end of the stream.
- public override int ReadByte()
- {
- return ReadByteCore();
- }
-
- private Task WriteAsyncInternal(byte[] array, int offset, int numBytes, CancellationToken cancellationToken)
- {
- // If async IO is not supported on this platform or
- // if this Win32FileStream was not opened with FileOptions.Asynchronous.
- if (!_useAsyncIO)
- {
- return base.WriteAsync(array, offset, numBytes, cancellationToken);
- }
-
- if (!CanWrite) throw Error.GetWriteNotSupported();
-
- Debug.Assert((_readPos == 0 && _readLength == 0 && _writePos >= 0) || (_writePos == 0 && _readPos <= _readLength), "We're either reading or writing, but not both.");
- Debug.Assert(!_isPipe || (_readPos == 0 && _readLength == 0), "Win32FileStream must not have buffered data here! Pipes should be unidirectional.");
-
- bool writeDataStoredInBuffer = false;
- if (!_isPipe) // avoid async buffering with pipes, as doing so can lead to deadlocks (see comments in ReadInternalAsyncCore)
- {
- // Ensure the buffer is clear for writing
- if (_writePos == 0)
- {
- if (_readPos < _readLength)
- {
- FlushReadBuffer();
- }
- _readPos = 0;
- _readLength = 0;
- }
-
- // Determine how much space remains in the buffer
- int remainingBuffer = _bufferLength - _writePos;
- Debug.Assert(remainingBuffer >= 0);
-
- // Simple/common case:
- // - The write is smaller than our buffer, such that it's worth considering buffering it.
- // - There's no active flush operation, such that we don't have to worry about the existing buffer being in use.
- // - And the data we're trying to write fits in the buffer, meaning it wasn't already filled by previous writes.
- // In that case, just store it in the buffer.
- if (numBytes < _bufferLength && !HasActiveBufferOperation && numBytes <= remainingBuffer)
- {
- Buffer.BlockCopy(array, offset, GetBuffer(), _writePos, numBytes);
- _writePos += numBytes;
- writeDataStoredInBuffer = true;
-
- // There is one special-but-common case, common because devs often use
- // byte[] sizes that are powers of 2 and thus fit nicely into our buffer, which is
- // also a power of 2. If after our write the buffer still has remaining space,
- // then we're done and can return a completed task now. But if we filled the buffer
- // completely, we want to do the asynchronous flush/write as part of this operation
- // rather than waiting until the next write that fills the buffer.
- if (numBytes != remainingBuffer)
- return Task.CompletedTask;
-
- Debug.Assert(_writePos == _bufferLength);
- }
- }
-
- // At this point, at least one of the following is true:
- // 1. There was an active flush operation (it could have completed by now, though).
- // 2. The data doesn't fit in the remaining buffer (or it's a pipe and we chose not to try).
- // 3. We wrote all of the data to the buffer, filling it.
- //
- // If there's an active operation, we can't touch the current buffer because it's in use.
- // That gives us a choice: we can either allocate a new buffer, or we can skip the buffer
- // entirely (even if the data would otherwise fit in it). For now, for simplicity, we do
- // the latter; it could also have performance wins due to OS-level optimizations, and we could
- // potentially add support for PreAllocatedOverlapped due to having a single buffer. (We can
- // switch to allocating a new buffer, potentially experimenting with buffer pooling, should
- // performance data suggest it's appropriate.)
- //
- // If the data doesn't fit in the remaining buffer, it could be because it's so large
- // it's greater than the entire buffer size, in which case we'd always skip the buffer,
- // or it could be because there's more data than just the space remaining. For the latter
- // case, we need to issue an asynchronous write to flush that data, which then turns this into
- // the first case above with an active operation.
- //
- // If we already stored the data, then we have nothing additional to write beyond what
- // we need to flush.
- //
- // In any of these cases, we have the same outcome:
- // - If there's data in the buffer, flush it by writing it out asynchronously.
- // - Then, if there's any data to be written, issue a write for it concurrently.
- // We return a Task that represents one or both.
-
- // Flush the buffer asynchronously if there's anything to flush
- Task flushTask = null;
- if (_writePos > 0)
- {
- flushTask = FlushWriteAsync(cancellationToken);
-
- // If we already copied all of the data into the buffer,
- // simply return the flush task here. Same goes for if the task has
- // already completed and was unsuccessful.
- if (writeDataStoredInBuffer ||
- flushTask.IsFaulted ||
- flushTask.IsCanceled)
- {
- return flushTask;
- }
- }
-
- Debug.Assert(!writeDataStoredInBuffer);
- Debug.Assert(_writePos == 0);
-
- // Finally, issue the write asynchronously, and return a Task that logically
- // represents the write operation, including any flushing done.
- Task writeTask = WriteInternalCoreAsync(array, offset, numBytes, cancellationToken);
- return
- (flushTask == null || flushTask.Status == TaskStatus.RanToCompletion) ? writeTask :
- (writeTask.Status == TaskStatus.RanToCompletion) ? flushTask :
- Task.WhenAll(flushTask, writeTask);
- }
-
- private unsafe Task WriteInternalCoreAsync(byte[] bytes, int offset, int numBytes, CancellationToken cancellationToken)
- {
- Debug.Assert(!_fileHandle.IsClosed, "!_handle.IsClosed");
- Debug.Assert(CanWrite, "_parent.CanWrite");
- Debug.Assert(bytes != null, "bytes != null");
- Debug.Assert(_readPos == _readLength, "_readPos == _readLen");
- Debug.Assert(_useAsyncIO, "WriteInternalCoreAsync doesn't work on synchronous file streams!");
- Debug.Assert(offset >= 0, "offset is negative");
- Debug.Assert(numBytes >= 0, "numBytes is negative");
-
- // Create and store async stream class library specific data in the async result
- FileStreamCompletionSource completionSource = new FileStreamCompletionSource(this, 0, bytes, cancellationToken);
- NativeOverlapped* intOverlapped = completionSource.Overlapped;
-
- if (CanSeek)
- {
- // Make sure we set the length of the file appropriately.
- long len = Length;
- //Console.WriteLine("WriteInternalCoreAsync - Calculating end pos. pos: "+pos+" len: "+len+" numBytes: "+numBytes);
-
- // Make sure we are writing to the position that we think we are
- VerifyOSHandlePosition();
-
- if (_filePosition + numBytes > len)
- {
- //Console.WriteLine("WriteInternalCoreAsync - Setting length to: "+(pos + numBytes));
- SetLengthCore(_filePosition + numBytes);
- }
-
- // Now set the position to read from in the NativeOverlapped struct
- // For pipes, we should leave the offset fields set to 0.
- intOverlapped->OffsetLow = (int)_filePosition;
- intOverlapped->OffsetHigh = (int)(_filePosition >> 32);
-
- // When using overlapped IO, the OS is not supposed to
- // touch the file pointer location at all. We will adjust it
- // ourselves. This isn't threadsafe.
- SeekCore(numBytes, SeekOrigin.Current);
- }
-
- //Console.WriteLine("WriteInternalCoreAsync finishing. pos: "+pos+" numBytes: "+numBytes+" _pos: "+_pos+" Position: "+Position);
-
- int errorCode = 0;
- // queue an async WriteFile operation and pass in a packed overlapped
- int r = WriteFileNative(_fileHandle, bytes, offset, numBytes, intOverlapped, out errorCode);
-
- // WriteFile, the OS version, will return 0 on failure. But
- // my WriteFileNative wrapper returns -1. My wrapper will return
- // the following:
- // On error, r==-1.
- // On async requests that are still pending, r==-1 w/ errorCode==ERROR_IO_PENDING
- // On async requests that completed sequentially, r==0
- // You will NEVER RELIABLY be able to get the number of bytes
- // written back from this call when using overlapped IO! You must
- // not pass in a non-null lpNumBytesWritten to WriteFile when using
- // overlapped structures! This is ByDesign NT behavior.
- if (r == -1 && numBytes != -1)
- {
- //Console.WriteLine("WriteFile returned 0; Write will complete asynchronously (if errorCode==3e5) errorCode: 0x{0:x}", errorCode);
-
- // For pipes, when they are closed on the other side, they will come here.
- if (errorCode == ERROR_NO_DATA)
- {
- // Not an error, but EOF. AsyncFSCallback will NOT be called.
- // Completing TCS and return cached task allowing the GC to collect TCS.
- completionSource.SetCompletedSynchronously(0);
- return Task.CompletedTask;
- }
- else if (errorCode != ERROR_IO_PENDING)
- {
- if (!_fileHandle.IsClosed && CanSeek) // Update Position - It could be anywhere.
- {
- SeekCore(0, SeekOrigin.Current);
- }
-
- completionSource.ReleaseNativeResource();
-
- if (errorCode == ERROR_HANDLE_EOF)
- {
- throw Error.GetEndOfFile();
- }
- else
- {
- throw Win32Marshal.GetExceptionForWin32Error(errorCode);
- }
- }
- else // ERROR_IO_PENDING
- {
- // Only once the IO is pending do we register for cancellation
- completionSource.RegisterForCancellation();
- }
- }
- else
- {
- // Due to a workaround for a race condition in NT's ReadFile &
- // WriteFile routines, we will always be returning 0 from WriteFileNative
- // when we do async IO instead of the number of bytes written,
- // irregardless of whether the operation completed
- // synchronously or asynchronously. We absolutely must not
- // set asyncResult._numBytes here, since will never have correct
- // results.
- //Console.WriteLine("WriteFile returned: "+r+" (0x"+Int32.Format(r, "x")+") The IO completed synchronously, but the user callback was called on another thread.");
- }
-
- return completionSource.Task;
- }
-
- public override void WriteByte(byte value)
- {
- WriteByteCore(value);
- }
-
- // Windows API definitions, from winbase.h and others
-
- private const int FILE_ATTRIBUTE_NORMAL = 0x00000080;
- private const int FILE_ATTRIBUTE_ENCRYPTED = 0x00004000;
- private const int FILE_FLAG_OVERLAPPED = 0x40000000;
- internal const int GENERIC_READ = unchecked((int)0x80000000);
- private const int GENERIC_WRITE = 0x40000000;
-
- private const int FILE_BEGIN = 0;
- private const int FILE_CURRENT = 1;
- private const int FILE_END = 2;
-
- // Error codes (not HRESULTS), from winerror.h
- internal const int ERROR_BROKEN_PIPE = 109;
- internal const int ERROR_NO_DATA = 232;
- private const int ERROR_HANDLE_EOF = 38;
- private const int ERROR_INVALID_PARAMETER = 87;
- private const int ERROR_IO_PENDING = 997;
-
- // __ConsoleStream also uses this code.
- private unsafe int ReadFileNative(SafeFileHandle handle, byte[] bytes, int offset, int count, NativeOverlapped* overlapped, out int errorCode)
- {
- Debug.Assert(handle != null, "handle != null");
- Debug.Assert(offset >= 0, "offset >= 0");
- Debug.Assert(count >= 0, "count >= 0");
- Debug.Assert(bytes != null, "bytes != null");
- // Don't corrupt memory when multiple threads are erroneously writing
- // to this stream simultaneously.
- if (bytes.Length - offset < count)
- throw new IndexOutOfRangeException(SR.IndexOutOfRange_IORaceCondition);
-
- Debug.Assert((_useAsyncIO && overlapped != null) || (!_useAsyncIO && overlapped == null), "Async IO and overlapped parameters inconsistent in call to ReadFileNative.");
-
- // You can't use the fixed statement on an array of length 0.
- if (bytes.Length == 0)
- {
- errorCode = 0;
- return 0;
- }
-
- int r = 0;
- int numBytesRead = 0;
-
- fixed (byte* p = &bytes[0])
- {
- if (_useAsyncIO)
- r = Interop.Kernel32.ReadFile(handle, p + offset, count, IntPtr.Zero, overlapped);
- else
- r = Interop.Kernel32.ReadFile(handle, p + offset, count, out numBytesRead, IntPtr.Zero);
- }
-
- if (r == 0)
- {
- errorCode = GetLastWin32ErrorAndDisposeHandleIfInvalid();
- return -1;
- }
- else
- {
- errorCode = 0;
- return numBytesRead;
- }
- }
-
- private unsafe int WriteFileNative(SafeFileHandle handle, byte[] bytes, int offset, int count, NativeOverlapped* overlapped, out int errorCode)
- {
- Debug.Assert(handle != null, "handle != null");
- Debug.Assert(offset >= 0, "offset >= 0");
- Debug.Assert(count >= 0, "count >= 0");
- Debug.Assert(bytes != null, "bytes != null");
- // Don't corrupt memory when multiple threads are erroneously writing
- // to this stream simultaneously. (the OS is reading from
- // the array we pass to WriteFile, but if we read beyond the end and
- // that memory isn't allocated, we could get an AV.)
- if (bytes.Length - offset < count)
- throw new IndexOutOfRangeException(SR.IndexOutOfRange_IORaceCondition);
-
- Debug.Assert((_useAsyncIO && overlapped != null) || (!_useAsyncIO && overlapped == null), "Async IO and overlapped parameters inconsistent in call to WriteFileNative.");
-
- // You can't use the fixed statement on an array of length 0.
- if (bytes.Length == 0)
- {
- errorCode = 0;
- return 0;
- }
-
- int numBytesWritten = 0;
- int r = 0;
-
- fixed (byte* p = &bytes[0])
- {
- if (_useAsyncIO)
- r = Interop.Kernel32.WriteFile(handle, p + offset, count, IntPtr.Zero, overlapped);
- else
- r = Interop.Kernel32.WriteFile(handle, p + offset, count, out numBytesWritten, IntPtr.Zero);
- }
-
- if (r == 0)
- {
- errorCode = GetLastWin32ErrorAndDisposeHandleIfInvalid();
- return -1;
- }
- else
- {
- errorCode = 0;
- return numBytesWritten;
- }
- }
-
- private int GetLastWin32ErrorAndDisposeHandleIfInvalid(bool throwIfInvalidHandle = false)
- {
- int errorCode = Marshal.GetLastWin32Error();
-
- // If ERROR_INVALID_HANDLE is returned, it doesn't suffice to set
- // the handle as invalid; the handle must also be closed.
- //
- // Marking the handle as invalid but not closing the handle
- // resulted in exceptions during finalization and locked column
- // values (due to invalid but unclosed handle) in SQL Win32FileStream
- // scenarios.
- //
- // A more mainstream scenario involves accessing a file on a
- // network share. ERROR_INVALID_HANDLE may occur because the network
- // connection was dropped and the server closed the handle. However,
- // the client side handle is still open and even valid for certain
- // operations.
- //
- // Note that _parent.Dispose doesn't throw so we don't need to special case.
- // SetHandleAsInvalid only sets _closed field to true (without
- // actually closing handle) so we don't need to call that as well.
- if (errorCode == Interop.Errors.ERROR_INVALID_HANDLE)
- {
- _fileHandle.Dispose();
-
- if (throwIfInvalidHandle)
- throw Win32Marshal.GetExceptionForWin32Error(errorCode);
- }
-
- return errorCode;
- }
-
- public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
- {
- // If we're in sync mode, just use the shared CopyToAsync implementation that does
- // typical read/write looping. We also need to take this path if this is a derived
- // instance from FileStream, as a derived type could have overridden ReadAsync, in which
- // case our custom CopyToAsync implementation isn't necessarily correct.
- if (!_useAsyncIO || GetType() != typeof(FileStream))
- {
- return base.CopyToAsync(destination, bufferSize, cancellationToken);
- }
-
- StreamHelpers.ValidateCopyToArgs(this, destination, bufferSize);
-
- // Bail early for cancellation if cancellation has been requested
- if (cancellationToken.IsCancellationRequested)
- {
- return Task.FromCanceled<int>(cancellationToken);
- }
-
- // Fail if the file was closed
- if (_fileHandle.IsClosed)
- {
- throw Error.GetFileNotOpen();
- }
-
- // Do the async copy, with differing implementations based on whether the FileStream was opened as async or sync
- Debug.Assert((_readPos == 0 && _readLength == 0 && _writePos >= 0) || (_writePos == 0 && _readPos <= _readLength), "We're either reading or writing, but not both.");
- return AsyncModeCopyToAsync(destination, bufferSize, cancellationToken);
- }
-
- private async Task AsyncModeCopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
- {
- Debug.Assert(_useAsyncIO, "This implementation is for async mode only");
- Debug.Assert(!_fileHandle.IsClosed, "!_handle.IsClosed");
- Debug.Assert(CanRead, "_parent.CanRead");
-
- // Make sure any pending writes have been flushed before we do a read.
- if (_writePos > 0)
- {
- await FlushWriteAsync(cancellationToken).ConfigureAwait(false);
- }
-
- // Typically CopyToAsync would be invoked as the only "read" on the stream, but it's possible some reading is
- // done and then the CopyToAsync is issued. For that case, see if we have any data available in the buffer.
- if (GetBuffer() != null)
- {
- int bufferedBytes = _readLength - _readPos;
- if (bufferedBytes > 0)
- {
- await destination.WriteAsync(GetBuffer(), _readPos, bufferedBytes, cancellationToken).ConfigureAwait(false);
- _readPos = _readLength = 0;
- }
- }
-
- // For efficiency, we avoid creating a new task and associated state for each asynchronous read.
- // Instead, we create a single reusable awaitable object that will be triggered when an await completes
- // and reset before going again.
- var readAwaitable = new AsyncCopyToAwaitable(this);
-
- // Make sure we are reading from the position that we think we are.
- // Only set the position in the awaitable if we can seek (e.g. not for pipes).
- bool canSeek = CanSeek;
- if (canSeek)
- {
- VerifyOSHandlePosition();
- readAwaitable._position = _filePosition;
- }
-
- // Get the buffer to use for the copy operation, as the base CopyToAsync does. We don't try to use
- // _buffer here, even if it's not null, as concurrent operations are allowed, and another operation may
- // actually be using the buffer already. Plus, it'll be rare for _buffer to be non-null, as typically
- // CopyToAsync is used as the only operation performed on the stream, and the buffer is lazily initialized.
- // Further, typically the CopyToAsync buffer size will be larger than that used by the FileStream, such that
- // we'd likely be unable to use it anyway. Instead, we rent the buffer from a pool.
- byte[] copyBuffer = ArrayPool<byte>.Shared.Rent(bufferSize);
- bufferSize = 0; // repurpose bufferSize to be the high water mark for the buffer, to avoid an extra field in the state machine
-
- // Allocate an Overlapped we can use repeatedly for all operations
- var awaitableOverlapped = new PreAllocatedOverlapped(AsyncCopyToAwaitable.s_callback, readAwaitable, copyBuffer);
- var cancellationReg = default(CancellationTokenRegistration);
- try
- {
- // Register for cancellation. We do this once for the whole copy operation, and just try to cancel
- // whatever read operation may currently be in progress, if there is one. It's possible the cancellation
- // request could come in between operations, in which case we flag that with explicit calls to ThrowIfCancellationRequested
- // in the read/write copy loop.
- if (cancellationToken.CanBeCanceled)
- {
- cancellationReg = cancellationToken.Register(s =>
- {
- var innerAwaitable = (AsyncCopyToAwaitable)s;
- unsafe
- {
- lock (innerAwaitable.CancellationLock) // synchronize with cleanup of the overlapped
- {
- if (innerAwaitable._nativeOverlapped != null)
- {
- // Try to cancel the I/O. We ignore the return value, as cancellation is opportunistic and we
- // don't want to fail the operation because we couldn't cancel it.
- Interop.Kernel32.CancelIoEx(innerAwaitable._fileStream._fileHandle, innerAwaitable._nativeOverlapped);
- }
- }
- }
- }, readAwaitable);
- }
-
- // Repeatedly read from this FileStream and write the results to the destination stream.
- while (true)
- {
- cancellationToken.ThrowIfCancellationRequested();
- readAwaitable.ResetForNextOperation();
-
- try
- {
- bool synchronousSuccess;
- int errorCode;
- unsafe
- {
- // Allocate a native overlapped for our reusable overlapped, and set position to read based on the next
- // desired address stored in the awaitable. (This position may be 0, if either we're at the beginning or
- // if the stream isn't seekable.)
- readAwaitable._nativeOverlapped = _fileHandle.ThreadPoolBinding.AllocateNativeOverlapped(awaitableOverlapped);
- if (canSeek)
- {
- readAwaitable._nativeOverlapped->OffsetLow = unchecked((int)readAwaitable._position);
- readAwaitable._nativeOverlapped->OffsetHigh = (int)(readAwaitable._position >> 32);
- }
-
- // Kick off the read.
- synchronousSuccess = ReadFileNative(_fileHandle, copyBuffer, 0, copyBuffer.Length, readAwaitable._nativeOverlapped, out errorCode) >= 0;
- }
-
- // If the operation did not synchronously succeed, it either failed or initiated the asynchronous operation.
- if (!synchronousSuccess)
- {
- switch (errorCode)
- {
- case ERROR_IO_PENDING:
- // Async operation in progress.
- break;
- case ERROR_BROKEN_PIPE:
- case ERROR_HANDLE_EOF:
- // We're at or past the end of the file, and the overlapped callback
- // won't be raised in these cases. Mark it as completed so that the await
- // below will see it as such.
- readAwaitable.MarkCompleted();
- break;
- default:
- // Everything else is an error (and there won't be a callback).
- throw Win32Marshal.GetExceptionForWin32Error(errorCode);
- }
- }
-
- // Wait for the async operation (which may or may not have already completed), then throw if it failed.
- await readAwaitable;
- switch (readAwaitable._errorCode)
- {
- case 0: // success
- Debug.Assert(readAwaitable._numBytes >= 0, $"Expected non-negative numBytes, got {readAwaitable._numBytes}");
- break;
- case ERROR_BROKEN_PIPE: // logically success with 0 bytes read (write end of pipe closed)
- case ERROR_HANDLE_EOF: // logically success with 0 bytes read (read at end of file)
- Debug.Assert(readAwaitable._numBytes == 0, $"Expected 0 bytes read, got {readAwaitable._numBytes}");
- break;
- case Interop.Errors.ERROR_OPERATION_ABORTED: // canceled
- throw new OperationCanceledException(cancellationToken.IsCancellationRequested ? cancellationToken : new CancellationToken(true));
- default: // error
- throw Win32Marshal.GetExceptionForWin32Error((int)readAwaitable._errorCode);
- }
-
- // Successful operation. If we got zero bytes, we're done: exit the read/write loop.
- int numBytesRead = (int)readAwaitable._numBytes;
- if (numBytesRead == 0)
- {
- break;
- }
-
- // Otherwise, update the read position for next time accordingly.
- if (canSeek)
- {
- readAwaitable._position += numBytesRead;
- }
-
- // (and keep track of the maximum number of bytes in the buffer we used, to avoid excessive and unnecessary
- // clearing of the buffer before we return it to the pool)
- if (numBytesRead > bufferSize)
- {
- bufferSize = numBytesRead;
- }
- }
- finally
- {
- // Free the resources for this read operation
- unsafe
- {
- NativeOverlapped* overlapped;
- lock (readAwaitable.CancellationLock) // just an Exchange, but we need this to be synchronized with cancellation, so using the same lock
- {
- overlapped = readAwaitable._nativeOverlapped;
- readAwaitable._nativeOverlapped = null;
- }
- if (overlapped != null)
- {
- _fileHandle.ThreadPoolBinding.FreeNativeOverlapped(overlapped);
- }
- }
- }
-
- // Write out the read data.
- await destination.WriteAsync(copyBuffer, 0, (int)readAwaitable._numBytes, cancellationToken).ConfigureAwait(false);
- }
- }
- finally
- {
- // Cleanup from the whole copy operation
- cancellationReg.Dispose();
- awaitableOverlapped.Dispose();
-
- Array.Clear(copyBuffer, 0, bufferSize);
- ArrayPool<byte>.Shared.Return(copyBuffer, clearArray: false);
-
- // Make sure the stream's current position reflects where we ended up
- if (!_fileHandle.IsClosed && CanSeek)
- {
- SeekCore(0, SeekOrigin.End);
- }
- }
- }
-
- /// <summary>Used by CopyToAsync to enable awaiting the result of an overlapped I/O operation with minimal overhead.</summary>
- private sealed unsafe class AsyncCopyToAwaitable : ICriticalNotifyCompletion
- {
- /// <summary>Sentinel object used to indicate that the I/O operation has completed before being awaited.</summary>
- private readonly static Action s_sentinel = () => { };
- /// <summary>Cached delegate to IOCallback.</summary>
- internal static readonly IOCompletionCallback s_callback = IOCallback;
-
- /// <summary>The FileStream that owns this instance.</summary>
- internal readonly FileStream _fileStream;
-
- /// <summary>Tracked position representing the next location from which to read.</summary>
- internal long _position;
- /// <summary>The current native overlapped pointer. This changes for each operation.</summary>
- internal NativeOverlapped* _nativeOverlapped;
- /// <summary>
- /// null if the operation is still in progress,
- /// s_sentinel if the I/O operation completed before the await,
- /// s_callback if it completed after the await yielded.
- /// </summary>
- internal Action _continuation;
- /// <summary>Last error code from completed operation.</summary>
- internal uint _errorCode;
- /// <summary>Last number of read bytes from completed operation.</summary>
- internal uint _numBytes;
-
- /// <summary>Lock object used to protect cancellation-related access to _nativeOverlapped.</summary>
- internal object CancellationLock => this;
-
- /// <summary>Initialize the awaitable.</summary>
- internal unsafe AsyncCopyToAwaitable(FileStream fileStream)
- {
- _fileStream = fileStream;
- }
-
- /// <summary>Reset state to prepare for the next read operation.</summary>
- internal void ResetForNextOperation()
- {
- Debug.Assert(_position >= 0, $"Expected non-negative position, got {_position}");
- _continuation = null;
- _errorCode = 0;
- _numBytes = 0;
- }
-
- /// <summary>Overlapped callback: store the results, then invoke the continuation delegate.</summary>
- internal unsafe static void IOCallback(uint errorCode, uint numBytes, NativeOverlapped* pOVERLAP)
- {
- var awaitable = (AsyncCopyToAwaitable)ThreadPoolBoundHandle.GetNativeOverlappedState(pOVERLAP);
-
- Debug.Assert(awaitable._continuation != s_sentinel, "Sentinel must not have already been set as the continuation");
- awaitable._errorCode = errorCode;
- awaitable._numBytes = numBytes;
-
- (awaitable._continuation ?? Interlocked.CompareExchange(ref awaitable._continuation, s_sentinel, null))?.Invoke();
- }
-
- /// <summary>
- /// Called when it's known that the I/O callback for an operation will not be invoked but we'll
- /// still be awaiting the awaitable.
- /// </summary>
- internal void MarkCompleted()
- {
- Debug.Assert(_continuation == null, "Expected null continuation");
- _continuation = s_sentinel;
- }
-
- public AsyncCopyToAwaitable GetAwaiter() => this;
- public bool IsCompleted => _continuation == s_sentinel;
- public void GetResult() { }
- public void OnCompleted(Action continuation) => UnsafeOnCompleted(continuation);
- public void UnsafeOnCompleted(Action continuation)
- {
- if (_continuation == s_sentinel ||
- Interlocked.CompareExchange(ref _continuation, continuation, null) != null)
- {
- Debug.Assert(_continuation == s_sentinel, $"Expected continuation set to s_sentinel, got ${_continuation}");
- Task.Run(continuation);
- }
- }
- }
-
- // Unlike Flush(), FlushAsync() always flushes to disk. This is intentional.
- // Legend is that we chose not to flush the OS file buffers in Flush() in fear of
- // perf problems with frequent, long running FlushFileBuffers() calls. But we don't
- // have that problem with FlushAsync() because we will call FlushFileBuffers() in the background.
- private Task FlushAsyncInternal(CancellationToken cancellationToken)
- {
- if (cancellationToken.IsCancellationRequested)
- return Task.FromCanceled(cancellationToken);
-
- if (_fileHandle.IsClosed)
- throw Error.GetFileNotOpen();
-
- // The always synchronous data transfer between the OS and the internal buffer is intentional
- // because this is needed to allow concurrent async IO requests. Concurrent data transfer
- // between the OS and the internal buffer will result in race conditions. Since FlushWrite and
- // FlushRead modify internal state of the stream and transfer data between the OS and the
- // internal buffer, they cannot be truly async. We will, however, flush the OS file buffers
- // asynchronously because it doesn't modify any internal state of the stream and is potentially
- // a long running process.
- try
- {
- FlushInternalBuffer();
- }
- catch (Exception e)
- {
- return Task.FromException(e);
- }
-
- if (CanWrite)
- {
- return Task.Factory.StartNew(
- state => ((FileStream)state).FlushOSBuffer(),
- this,
- cancellationToken,
- TaskCreationOptions.DenyChildAttach,
- TaskScheduler.Default);
- }
- else
- {
- return Task.CompletedTask;
- }
- }
-
- private Task<int> TaskFromResultOrCache(int result)
- {
- Task<int> completedTask = _lastSynchronouslyCompletedTask;
- Debug.Assert(completedTask == null || completedTask.Status == TaskStatus.RanToCompletion, "Cached task should have completed successfully");
-
- if ((completedTask == null) || (completedTask.Result != result))
- {
- completedTask = Task.FromResult(result);
- _lastSynchronouslyCompletedTask = completedTask;
- }
-
- return completedTask;
- }
-
- private void LockInternal(long position, long length)
- {
- int positionLow = unchecked((int)(position));
- int positionHigh = unchecked((int)(position >> 32));
- int lengthLow = unchecked((int)(length));
- int lengthHigh = unchecked((int)(length >> 32));
-
- if (!Interop.Kernel32.LockFile(_fileHandle, positionLow, positionHigh, lengthLow, lengthHigh))
- {
- throw Win32Marshal.GetExceptionForLastWin32Error();
- }
- }
-
- private void UnlockInternal(long position, long length)
- {
- int positionLow = unchecked((int)(position));
- int positionHigh = unchecked((int)(position >> 32));
- int lengthLow = unchecked((int)(length));
- int lengthHigh = unchecked((int)(length >> 32));
-
- if (!Interop.Kernel32.UnlockFile(_fileHandle, positionLow, positionHigh, lengthLow, lengthHigh))
- {
- throw Win32Marshal.GetExceptionForLastWin32Error();
- }
- }
}
}
diff --git a/src/mscorlib/shared/System/IO/FileStream.WinRT.cs b/src/mscorlib/shared/System/IO/FileStream.WinRT.cs
new file mode 100644
index 0000000000..062b160b57
--- /dev/null
+++ b/src/mscorlib/shared/System/IO/FileStream.WinRT.cs
@@ -0,0 +1,78 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using Microsoft.Win32.SafeHandles;
+using System.Runtime.InteropServices;
+
+namespace System.IO
+{
+ public partial class FileStream : Stream
+ {
+ private unsafe SafeFileHandle OpenHandle(FileMode mode, FileShare share, FileOptions options)
+ {
+ Interop.Kernel32.SECURITY_ATTRIBUTES secAttrs = GetSecAttrs(share);
+
+ int fAccess =
+ ((_access & FileAccess.Read) == FileAccess.Read ? GENERIC_READ : 0) |
+ ((_access & FileAccess.Write) == FileAccess.Write ? GENERIC_WRITE : 0);
+
+ // Our Inheritable bit was stolen from Windows, but should be set in
+ // the security attributes class. Don't leave this bit set.
+ share &= ~FileShare.Inheritable;
+
+ // Must use a valid Win32 constant here...
+ if (mode == FileMode.Append)
+ mode = FileMode.OpenOrCreate;
+
+ Interop.Kernel32.CREATEFILE2_EXTENDED_PARAMETERS parameters = new Interop.Kernel32.CREATEFILE2_EXTENDED_PARAMETERS();
+ parameters.dwSize = (uint)sizeof(Interop.Kernel32.CREATEFILE2_EXTENDED_PARAMETERS);
+ parameters.dwFileFlags = (uint)options;
+ parameters.lpSecurityAttributes = &secAttrs;
+
+ SafeFileHandle fileHandle = Interop.Kernel32.CreateFile2(
+ lpFileName: _path,
+ dwDesiredAccess: fAccess,
+ dwShareMode: share,
+ dwCreationDisposition: mode,
+ pCreateExParams: &parameters);
+
+ fileHandle.IsAsync = _useAsyncIO;
+
+ if (fileHandle.IsInvalid)
+ {
+ // Return a meaningful exception with the full path.
+
+ // NT5 oddity - when trying to open "C:\" as a Win32FileStream,
+ // we usually get ERROR_PATH_NOT_FOUND from the OS. We should
+ // probably be consistent w/ every other directory.
+ int errorCode = Marshal.GetLastWin32Error();
+
+ if (errorCode == Interop.Errors.ERROR_PATH_NOT_FOUND && _path.Length == PathInternal.GetRootLength(_path))
+ errorCode = Interop.Errors.ERROR_ACCESS_DENIED;
+
+ throw Win32Marshal.GetExceptionForWin32Error(errorCode, $"{_path} {options} {fAccess} {share} {mode}");
+ }
+
+ return fileHandle;
+ }
+
+#if PROJECTN
+ // TODO: These internal methods should be removed once we start consuming updated CoreFX builds
+ public static FileStream InternalOpen(string path, int bufferSize = 4096, bool useAsync = true)
+ {
+ return new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize, useAsync);
+ }
+
+ public static FileStream InternalCreate(string path, int bufferSize = 4096, bool useAsync = true)
+ {
+ return new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read, bufferSize, useAsync);
+ }
+
+ public static FileStream InternalAppend(string path, int bufferSize = 4096, bool useAsync = true)
+ {
+ return new FileStream(path, FileMode.Append, FileAccess.Write, FileShare.Read, bufferSize, useAsync);
+ }
+#endif
+ }
+}
diff --git a/src/mscorlib/shared/System/IO/FileStream.Windows.cs b/src/mscorlib/shared/System/IO/FileStream.Windows.cs
new file mode 100644
index 0000000000..7c09ae1a1c
--- /dev/null
+++ b/src/mscorlib/shared/System/IO/FileStream.Windows.cs
@@ -0,0 +1,1717 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Buffers;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+using System.Threading;
+using System.Threading.Tasks;
+using Microsoft.Win32.SafeHandles;
+using System.Runtime.CompilerServices;
+
+/*
+ * Win32FileStream supports different modes of accessing the disk - async mode
+ * and sync mode. They are two completely different codepaths in the
+ * sync & async methods (i.e. Read/Write vs. ReadAsync/WriteAsync). File
+ * handles in NT can be opened in only sync or overlapped (async) mode,
+ * and we have to deal with this pain. Stream has implementations of
+ * the sync methods in terms of the async ones, so we'll
+ * call through to our base class to get those methods when necessary.
+ *
+ * Also buffering is added into Win32FileStream as well. Folded in the
+ * code from BufferedStream, so all the comments about it being mostly
+ * aggressive (and the possible perf improvement) apply to Win32FileStream as
+ * well. Also added some buffering to the async code paths.
+ *
+ * Class Invariants:
+ * The class has one buffer, shared for reading & writing. It can only be
+ * used for one or the other at any point in time - not both. The following
+ * should be true:
+ * 0 <= _readPos <= _readLen < _bufferSize
+ * 0 <= _writePos < _bufferSize
+ * _readPos == _readLen && _readPos > 0 implies the read buffer is valid,
+ * but we're at the end of the buffer.
+ * _readPos == _readLen == 0 means the read buffer contains garbage.
+ * Either _writePos can be greater than 0, or _readLen & _readPos can be
+ * greater than zero, but neither can be greater than zero at the same time.
+ *
+ */
+
+namespace System.IO
+{
+ public partial class FileStream : Stream
+ {
+ private bool _canSeek;
+ private bool _isPipe; // Whether to disable async buffering code.
+ private long _appendStart; // When appending, prevent overwriting file.
+
+ private static unsafe IOCompletionCallback s_ioCallback = FileStreamCompletionSource.IOCallback;
+
+ private Task<int> _lastSynchronouslyCompletedTask = null; // cached task for read ops that complete synchronously
+ private Task _activeBufferOperation = null; // tracks in-progress async ops using the buffer
+ private PreAllocatedOverlapped _preallocatedOverlapped; // optimization for async ops to avoid per-op allocations
+ private FileStreamCompletionSource _currentOverlappedOwner; // async op currently using the preallocated overlapped
+
+ private void Init(FileMode mode, FileShare share)
+ {
+ // Disallow access to all non-file devices from the Win32FileStream
+ // constructors that take a String. Everyone else can call
+ // CreateFile themselves then use the constructor that takes an
+ // IntPtr. Disallows "con:", "com1:", "lpt1:", etc.
+ int fileType = Interop.Kernel32.GetFileType(_fileHandle);
+ if (fileType != Interop.Kernel32.FileTypes.FILE_TYPE_DISK)
+ {
+ _fileHandle.Dispose();
+ throw new NotSupportedException(SR.NotSupported_FileStreamOnNonFiles);
+ }
+
+ // This is necessary for async IO using IO Completion ports via our
+ // managed Threadpool API's. This (theoretically) calls the OS's
+ // BindIoCompletionCallback method, and passes in a stub for the
+ // LPOVERLAPPED_COMPLETION_ROUTINE. This stub looks at the Overlapped
+ // struct for this request and gets a delegate to a managed callback
+ // from there, which it then calls on a threadpool thread. (We allocate
+ // our native OVERLAPPED structs 2 pointers too large and store EE state
+ // & GC handles there, one to an IAsyncResult, the other to a delegate.)
+ if (_useAsyncIO)
+ {
+ try
+ {
+ _fileHandle.ThreadPoolBinding = ThreadPoolBoundHandle.BindHandle(_fileHandle);
+ }
+ catch (ArgumentException ex)
+ {
+ throw new IOException(SR.IO_BindHandleFailed, ex);
+ }
+ finally
+ {
+ if (_fileHandle.ThreadPoolBinding == null)
+ {
+ // We should close the handle so that the handle is not open until SafeFileHandle GC
+ Debug.Assert(!_exposedHandle, "Are we closing handle that we exposed/not own, how?");
+ _fileHandle.Dispose();
+ }
+ }
+ }
+
+ _canSeek = true;
+
+ // For Append mode...
+ if (mode == FileMode.Append)
+ {
+ _appendStart = SeekCore(0, SeekOrigin.End);
+ }
+ else
+ {
+ _appendStart = -1;
+ }
+ }
+
+ private void InitFromHandle(SafeFileHandle handle)
+ {
+ int handleType = Interop.Kernel32.GetFileType(_fileHandle);
+ Debug.Assert(handleType == Interop.Kernel32.FileTypes.FILE_TYPE_DISK || handleType == Interop.Kernel32.FileTypes.FILE_TYPE_PIPE || handleType == Interop.Kernel32.FileTypes.FILE_TYPE_CHAR, "FileStream was passed an unknown file type!");
+
+ _canSeek = handleType == Interop.Kernel32.FileTypes.FILE_TYPE_DISK;
+ _isPipe = handleType == Interop.Kernel32.FileTypes.FILE_TYPE_PIPE;
+
+ // This is necessary for async IO using IO Completion ports via our
+ // managed Threadpool API's. This calls the OS's
+ // BindIoCompletionCallback method, and passes in a stub for the
+ // LPOVERLAPPED_COMPLETION_ROUTINE. This stub looks at the Overlapped
+ // struct for this request and gets a delegate to a managed callback
+ // from there, which it then calls on a threadpool thread. (We allocate
+ // our native OVERLAPPED structs 2 pointers too large and store EE
+ // state & a handle to a delegate there.)
+ //
+ // If, however, we've already bound this file handle to our completion port,
+ // don't try to bind it again because it will fail. A handle can only be
+ // bound to a single completion port at a time.
+ if (_useAsyncIO && !GetSuppressBindHandle(handle))
+ {
+ try
+ {
+ _fileHandle.ThreadPoolBinding = ThreadPoolBoundHandle.BindHandle(_fileHandle);
+ }
+ catch (Exception ex)
+ {
+ // If you passed in a synchronous handle and told us to use
+ // it asynchronously, throw here.
+ throw new ArgumentException(SR.Arg_HandleNotAsync, nameof(handle), ex);
+ }
+ }
+ else if (!_useAsyncIO)
+ {
+ if (handleType != Interop.Kernel32.FileTypes.FILE_TYPE_PIPE)
+ VerifyHandleIsSync();
+ }
+
+ if (_canSeek)
+ SeekCore(0, SeekOrigin.Current);
+ else
+ _filePosition = 0;
+ }
+
+ private static bool GetSuppressBindHandle(SafeFileHandle handle)
+ {
+ return handle.IsAsync.HasValue ? handle.IsAsync.Value : false;
+ }
+
+ private unsafe static Interop.Kernel32.SECURITY_ATTRIBUTES GetSecAttrs(FileShare share)
+ {
+ Interop.Kernel32.SECURITY_ATTRIBUTES secAttrs = default(Interop.Kernel32.SECURITY_ATTRIBUTES);
+ if ((share & FileShare.Inheritable) != 0)
+ {
+ secAttrs = new Interop.Kernel32.SECURITY_ATTRIBUTES();
+ secAttrs.nLength = (uint)sizeof(Interop.Kernel32.SECURITY_ATTRIBUTES);
+
+ secAttrs.bInheritHandle = Interop.BOOL.TRUE;
+ }
+ return secAttrs;
+ }
+
+ // Verifies that this handle supports synchronous IO operations (unless you
+ // didn't open it for either reading or writing).
+ private unsafe void VerifyHandleIsSync()
+ {
+ Debug.Assert(!_useAsyncIO);
+
+ // Do NOT use this method on pipes. Reading or writing to a pipe may
+ // cause an app to block incorrectly, introducing a deadlock (depending
+ // on whether a write will wake up an already-blocked thread or this
+ // Win32FileStream's thread).
+ Debug.Assert(Interop.Kernel32.GetFileType(_fileHandle) != Interop.Kernel32.FileTypes.FILE_TYPE_PIPE);
+
+ byte* bytes = stackalloc byte[1];
+ int numBytesReadWritten;
+ int r = -1;
+
+ // If the handle is a pipe, ReadFile will block until there
+ // has been a write on the other end. We'll just have to deal with it,
+ // For the read end of a pipe, you can mess up and
+ // accidentally read synchronously from an async pipe.
+ if ((_access & FileAccess.Read) != 0) // don't use the virtual CanRead or CanWrite, as this may be used in the ctor
+ {
+ r = Interop.Kernel32.ReadFile(_fileHandle, bytes, 0, out numBytesReadWritten, IntPtr.Zero);
+ }
+ else if ((_access & FileAccess.Write) != 0) // don't use the virtual CanRead or CanWrite, as this may be used in the ctor
+ {
+ r = Interop.Kernel32.WriteFile(_fileHandle, bytes, 0, out numBytesReadWritten, IntPtr.Zero);
+ }
+
+ if (r == 0)
+ {
+ int errorCode = GetLastWin32ErrorAndDisposeHandleIfInvalid(throwIfInvalidHandle: true);
+ if (errorCode == ERROR_INVALID_PARAMETER)
+ throw new ArgumentException(SR.Arg_HandleNotSync, "handle");
+ }
+ }
+
+ private bool HasActiveBufferOperation
+ {
+ get { return _activeBufferOperation != null && !_activeBufferOperation.IsCompleted; }
+ }
+
+ public override bool CanSeek
+ {
+ get { return _canSeek; }
+ }
+
+ private unsafe long GetLengthInternal()
+ {
+ Interop.Kernel32.FILE_STANDARD_INFO info = new Interop.Kernel32.FILE_STANDARD_INFO();
+
+ if (!Interop.Kernel32.GetFileInformationByHandleEx(_fileHandle, Interop.Kernel32.FILE_INFO_BY_HANDLE_CLASS.FileStandardInfo, out info, (uint)sizeof(Interop.Kernel32.FILE_STANDARD_INFO)))
+ throw Win32Marshal.GetExceptionForLastWin32Error();
+ long len = info.EndOfFile;
+ // If we're writing near the end of the file, we must include our
+ // internal buffer in our Length calculation. Don't flush because
+ // we use the length of the file in our async write method.
+ if (_writePos > 0 && _filePosition + _writePos > len)
+ len = _writePos + _filePosition;
+ return len;
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ // Nothing will be done differently based on whether we are
+ // disposing vs. finalizing. This is taking advantage of the
+ // weak ordering between normal finalizable objects & critical
+ // finalizable objects, which I included in the SafeHandle
+ // design for Win32FileStream, which would often "just work" when
+ // finalized.
+ try
+ {
+ if (_fileHandle != null && !_fileHandle.IsClosed)
+ {
+ // Flush data to disk iff we were writing. After
+ // thinking about this, we also don't need to flush
+ // our read position, regardless of whether the handle
+ // was exposed to the user. They probably would NOT
+ // want us to do this.
+ if (_writePos > 0)
+ {
+ FlushWriteBuffer(!disposing);
+ }
+ }
+ }
+ finally
+ {
+ if (_fileHandle != null && !_fileHandle.IsClosed)
+ {
+ if (_fileHandle.ThreadPoolBinding != null)
+ _fileHandle.ThreadPoolBinding.Dispose();
+
+ _fileHandle.Dispose();
+ }
+
+ if (_preallocatedOverlapped != null)
+ _preallocatedOverlapped.Dispose();
+
+ _canSeek = false;
+
+ // Don't set the buffer to null, to avoid a NullReferenceException
+ // when users have a race condition in their code (i.e. they call
+ // Close when calling another method on Stream like Read).
+ //_buffer = null;
+ base.Dispose(disposing);
+ }
+ }
+
+ private void FlushOSBuffer()
+ {
+ if (!Interop.Kernel32.FlushFileBuffers(_fileHandle))
+ {
+ throw Win32Marshal.GetExceptionForLastWin32Error();
+ }
+ }
+
+ // Returns a task that flushes the internal write buffer
+ private Task FlushWriteAsync(CancellationToken cancellationToken)
+ {
+ Debug.Assert(_useAsyncIO);
+ Debug.Assert(_readPos == 0 && _readLength == 0, "FileStream: Read buffer must be empty in FlushWriteAsync!");
+
+ // If the buffer is already flushed, don't spin up the OS write
+ if (_writePos == 0) return Task.CompletedTask;
+
+ Task flushTask = WriteInternalCoreAsync(GetBuffer(), 0, _writePos, cancellationToken);
+ _writePos = 0;
+
+ // Update the active buffer operation
+ _activeBufferOperation = HasActiveBufferOperation ?
+ Task.WhenAll(_activeBufferOperation, flushTask) :
+ flushTask;
+
+ return flushTask;
+ }
+
+ // Writes are buffered. Anytime the buffer fills up
+ // (_writePos + delta > _bufferSize) or the buffer switches to reading
+ // and there is left over data (_writePos > 0), this function must be called.
+ private void FlushWriteBuffer(bool calledFromFinalizer = false)
+ {
+ if (_writePos == 0) return;
+ Debug.Assert(_readPos == 0 && _readLength == 0, "FileStream: Read buffer must be empty in FlushWrite!");
+
+ if (_useAsyncIO)
+ {
+ Task writeTask = FlushWriteAsync(CancellationToken.None);
+ // With our Whidbey async IO & overlapped support for AD unloads,
+ // we don't strictly need to block here to release resources
+ // since that support takes care of the pinning & freeing the
+ // overlapped struct. We need to do this when called from
+ // Close so that the handle is closed when Close returns, but
+ // we don't need to call EndWrite from the finalizer.
+ // Additionally, if we do call EndWrite, we block forever
+ // because AD unloads prevent us from running the managed
+ // callback from the IO completion port. Blocking here when
+ // called from the finalizer during AD unload is clearly wrong,
+ // but we can't use any sort of test for whether the AD is
+ // unloading because if we weren't unloading, an AD unload
+ // could happen on a separate thread before we call EndWrite.
+ if (!calledFromFinalizer)
+ {
+ writeTask.GetAwaiter().GetResult();
+ }
+ }
+ else
+ {
+ WriteCore(GetBuffer(), 0, _writePos);
+ }
+
+ _writePos = 0;
+ }
+
+ private void SetLengthInternal(long value)
+ {
+ // Handle buffering updates.
+ if (_writePos > 0)
+ {
+ FlushWriteBuffer();
+ }
+ else if (_readPos < _readLength)
+ {
+ FlushReadBuffer();
+ }
+ _readPos = 0;
+ _readLength = 0;
+
+ if (_appendStart != -1 && value < _appendStart)
+ throw new IOException(SR.IO_SetLengthAppendTruncate);
+ SetLengthCore(value);
+ }
+
+ // We absolutely need this method broken out so that WriteInternalCoreAsync can call
+ // a method without having to go through buffering code that might call FlushWrite.
+ private void SetLengthCore(long value)
+ {
+ Debug.Assert(value >= 0, "value >= 0");
+ long origPos = _filePosition;
+
+ VerifyOSHandlePosition();
+ if (_filePosition != value)
+ SeekCore(value, SeekOrigin.Begin);
+ if (!Interop.Kernel32.SetEndOfFile(_fileHandle))
+ {
+ int errorCode = Marshal.GetLastWin32Error();
+ if (errorCode == Interop.Errors.ERROR_INVALID_PARAMETER)
+ throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_FileLengthTooBig);
+ throw Win32Marshal.GetExceptionForWin32Error(errorCode);
+ }
+ // Return file pointer to where it was before setting length
+ if (origPos != value)
+ {
+ if (origPos < value)
+ SeekCore(origPos, SeekOrigin.Begin);
+ else
+ SeekCore(0, SeekOrigin.End);
+ }
+ }
+
+ // Instance method to help code external to this MarshalByRefObject avoid
+ // accessing its fields by ref. This avoids a compiler warning.
+ private FileStreamCompletionSource CompareExchangeCurrentOverlappedOwner(FileStreamCompletionSource newSource, FileStreamCompletionSource existingSource) => Interlocked.CompareExchange(ref _currentOverlappedOwner, newSource, existingSource);
+
+ public override int Read(byte[] array, int offset, int count)
+ {
+ ValidateReadWriteArgs(array, offset, count);
+ return ReadCore(array, offset, count);
+ }
+
+ private int ReadCore(byte[] array, int offset, int count)
+ {
+ Debug.Assert((_readPos == 0 && _readLength == 0 && _writePos >= 0) || (_writePos == 0 && _readPos <= _readLength),
+ "We're either reading or writing, but not both.");
+
+ bool isBlocked = false;
+ int n = _readLength - _readPos;
+ // if the read buffer is empty, read into either user's array or our
+ // buffer, depending on number of bytes user asked for and buffer size.
+ if (n == 0)
+ {
+ if (!CanRead) throw Error.GetReadNotSupported();
+ if (_writePos > 0) FlushWriteBuffer();
+ if (!CanSeek || (count >= _bufferLength))
+ {
+ n = ReadNative(array, offset, count);
+ // Throw away read buffer.
+ _readPos = 0;
+ _readLength = 0;
+ return n;
+ }
+ n = ReadNative(GetBuffer(), 0, _bufferLength);
+ if (n == 0) return 0;
+ isBlocked = n < _bufferLength;
+ _readPos = 0;
+ _readLength = n;
+ }
+ // Now copy min of count or numBytesAvailable (i.e. near EOF) to array.
+ if (n > count) n = count;
+ Buffer.BlockCopy(GetBuffer(), _readPos, array, offset, n);
+ _readPos += n;
+
+ // We may have read less than the number of bytes the user asked
+ // for, but that is part of the Stream contract. Reading again for
+ // more data may cause us to block if we're using a device with
+ // no clear end of file, such as a serial port or pipe. If we
+ // blocked here & this code was used with redirected pipes for a
+ // process's standard output, this can lead to deadlocks involving
+ // two processes. But leave this here for files to avoid what would
+ // probably be a breaking change. --
+
+ // If we are reading from a device with no clear EOF like a
+ // serial port or a pipe, this will cause us to block incorrectly.
+ if (!_isPipe)
+ {
+ // If we hit the end of the buffer and didn't have enough bytes, we must
+ // read some more from the underlying stream. However, if we got
+ // fewer bytes from the underlying stream than we asked for (i.e. we're
+ // probably blocked), don't ask for more bytes.
+ if (n < count && !isBlocked)
+ {
+ Debug.Assert(_readPos == _readLength, "Read buffer should be empty!");
+ int moreBytesRead = ReadNative(array, offset + n, count - n);
+ n += moreBytesRead;
+ // We've just made our buffer inconsistent with our position
+ // pointer. We must throw away the read buffer.
+ _readPos = 0;
+ _readLength = 0;
+ }
+ }
+
+ return n;
+ }
+
+ [Conditional("DEBUG")]
+ private void AssertCanRead(byte[] buffer, int offset, int count)
+ {
+ Debug.Assert(!_fileHandle.IsClosed, "!_fileHandle.IsClosed");
+ Debug.Assert(CanRead, "CanRead");
+ Debug.Assert(buffer != null, "buffer != null");
+ Debug.Assert(_writePos == 0, "_writePos == 0");
+ Debug.Assert(offset >= 0, "offset is negative");
+ Debug.Assert(count >= 0, "count is negative");
+ }
+
+ private unsafe int ReadNative(byte[] buffer, int offset, int count)
+ {
+ AssertCanRead(buffer, offset, count);
+
+ if (_useAsyncIO)
+ return ReadNativeAsync(buffer, offset, count, 0, CancellationToken.None).GetAwaiter().GetResult();
+
+ // Make sure we are reading from the right spot
+ VerifyOSHandlePosition();
+
+ int errorCode = 0;
+ int r = ReadFileNative(_fileHandle, buffer, offset, count, null, out errorCode);
+
+ if (r == -1)
+ {
+ // For pipes, ERROR_BROKEN_PIPE is the normal end of the pipe.
+ if (errorCode == ERROR_BROKEN_PIPE)
+ {
+ r = 0;
+ }
+ else
+ {
+ if (errorCode == ERROR_INVALID_PARAMETER)
+ throw new ArgumentException(SR.Arg_HandleNotSync, "_fileHandle");
+
+ throw Win32Marshal.GetExceptionForWin32Error(errorCode);
+ }
+ }
+ Debug.Assert(r >= 0, "FileStream's ReadNative is likely broken.");
+ _filePosition += r;
+
+ return r;
+ }
+
+ public override long Seek(long offset, SeekOrigin origin)
+ {
+ if (origin < SeekOrigin.Begin || origin > SeekOrigin.End)
+ throw new ArgumentException(SR.Argument_InvalidSeekOrigin, nameof(origin));
+ if (_fileHandle.IsClosed) throw Error.GetFileNotOpen();
+ if (!CanSeek) throw Error.GetSeekNotSupported();
+
+ Debug.Assert((_readPos == 0 && _readLength == 0 && _writePos >= 0) || (_writePos == 0 && _readPos <= _readLength), "We're either reading or writing, but not both.");
+
+ // If we've got bytes in our buffer to write, write them out.
+ // If we've read in and consumed some bytes, we'll have to adjust
+ // our seek positions ONLY IF we're seeking relative to the current
+ // position in the stream. This simulates doing a seek to the new
+ // position, then a read for the number of bytes we have in our buffer.
+ if (_writePos > 0)
+ {
+ FlushWriteBuffer();
+ }
+ else if (origin == SeekOrigin.Current)
+ {
+ // Don't call FlushRead here, which would have caused an infinite
+ // loop. Simply adjust the seek origin. This isn't necessary
+ // if we're seeking relative to the beginning or end of the stream.
+ offset -= (_readLength - _readPos);
+ }
+ _readPos = _readLength = 0;
+
+ // Verify that internal position is in sync with the handle
+ VerifyOSHandlePosition();
+
+ long oldPos = _filePosition + (_readPos - _readLength);
+ long pos = SeekCore(offset, origin);
+
+ // Prevent users from overwriting data in a file that was opened in
+ // append mode.
+ if (_appendStart != -1 && pos < _appendStart)
+ {
+ SeekCore(oldPos, SeekOrigin.Begin);
+ throw new IOException(SR.IO_SeekAppendOverwrite);
+ }
+
+ // We now must update the read buffer. We can in some cases simply
+ // update _readPos within the buffer, copy around the buffer so our
+ // Position property is still correct, and avoid having to do more
+ // reads from the disk. Otherwise, discard the buffer's contents.
+ if (_readLength > 0)
+ {
+ // We can optimize the following condition:
+ // oldPos - _readPos <= pos < oldPos + _readLen - _readPos
+ if (oldPos == pos)
+ {
+ if (_readPos > 0)
+ {
+ //Console.WriteLine("Seek: seeked for 0, adjusting buffer back by: "+_readPos+" _readLen: "+_readLen);
+ Buffer.BlockCopy(GetBuffer(), _readPos, GetBuffer(), 0, _readLength - _readPos);
+ _readLength -= _readPos;
+ _readPos = 0;
+ }
+ // If we still have buffered data, we must update the stream's
+ // position so our Position property is correct.
+ if (_readLength > 0)
+ SeekCore(_readLength, SeekOrigin.Current);
+ }
+ else if (oldPos - _readPos < pos && pos < oldPos + _readLength - _readPos)
+ {
+ int diff = (int)(pos - oldPos);
+ //Console.WriteLine("Seek: diff was "+diff+", readpos was "+_readPos+" adjusting buffer - shrinking by "+ (_readPos + diff));
+ Buffer.BlockCopy(GetBuffer(), _readPos + diff, GetBuffer(), 0, _readLength - (_readPos + diff));
+ _readLength -= (_readPos + diff);
+ _readPos = 0;
+ if (_readLength > 0)
+ SeekCore(_readLength, SeekOrigin.Current);
+ }
+ else
+ {
+ // Lose the read buffer.
+ _readPos = 0;
+ _readLength = 0;
+ }
+ Debug.Assert(_readLength >= 0 && _readPos <= _readLength, "_readLen should be nonnegative, and _readPos should be less than or equal _readLen");
+ Debug.Assert(pos == Position, "Seek optimization: pos != Position! Buffer math was mangled.");
+ }
+ return pos;
+ }
+
+ // This doesn't do argument checking. Necessary for SetLength, which must
+ // set the file pointer beyond the end of the file. This will update the
+ // internal position
+ // This is called during construction so it should avoid any virtual
+ // calls
+ private long SeekCore(long offset, SeekOrigin origin)
+ {
+ Debug.Assert(!_fileHandle.IsClosed && _canSeek, "!_handle.IsClosed && _parent.CanSeek");
+ Debug.Assert(origin >= SeekOrigin.Begin && origin <= SeekOrigin.End, "origin>=SeekOrigin.Begin && origin<=SeekOrigin.End");
+ long ret = 0;
+
+ if (!Interop.Kernel32.SetFilePointerEx(_fileHandle, offset, out ret, (uint)origin))
+ {
+ int errorCode = GetLastWin32ErrorAndDisposeHandleIfInvalid();
+ throw Win32Marshal.GetExceptionForWin32Error(errorCode);
+ }
+
+ _filePosition = ret;
+ return ret;
+ }
+
+ partial void OnBufferAllocated()
+ {
+ Debug.Assert(_buffer != null);
+ Debug.Assert(_preallocatedOverlapped == null);
+
+ if (_useAsyncIO)
+ _preallocatedOverlapped = new PreAllocatedOverlapped(s_ioCallback, this, _buffer);
+ }
+
+ public override void Write(byte[] array, int offset, int count)
+ {
+ ValidateReadWriteArgs(array, offset, count);
+
+ if (_writePos == 0)
+ {
+ // Ensure we can write to the stream, and ready buffer for writing.
+ if (!CanWrite) throw Error.GetWriteNotSupported();
+ if (_readPos < _readLength) FlushReadBuffer();
+ _readPos = 0;
+ _readLength = 0;
+ }
+
+ // If our buffer has data in it, copy data from the user's array into
+ // the buffer, and if we can fit it all there, return. Otherwise, write
+ // the buffer to disk and copy any remaining data into our buffer.
+ // The assumption here is memcpy is cheaper than disk (or net) IO.
+ // (10 milliseconds to disk vs. ~20-30 microseconds for a 4K memcpy)
+ // So the extra copying will reduce the total number of writes, in
+ // non-pathological cases (i.e. write 1 byte, then write for the buffer
+ // size repeatedly)
+ if (_writePos > 0)
+ {
+ int numBytes = _bufferLength - _writePos; // space left in buffer
+ if (numBytes > 0)
+ {
+ if (numBytes > count)
+ numBytes = count;
+ Buffer.BlockCopy(array, offset, GetBuffer(), _writePos, numBytes);
+ _writePos += numBytes;
+ if (count == numBytes) return;
+ offset += numBytes;
+ count -= numBytes;
+ }
+ // Reset our buffer. We essentially want to call FlushWrite
+ // without calling Flush on the underlying Stream.
+
+ if (_useAsyncIO)
+ {
+ WriteInternalCoreAsync(GetBuffer(), 0, _writePos, CancellationToken.None).GetAwaiter().GetResult();
+ }
+ else
+ {
+ WriteCore(GetBuffer(), 0, _writePos);
+ }
+ _writePos = 0;
+ }
+ // If the buffer would slow writes down, avoid buffer completely.
+ if (count >= _bufferLength)
+ {
+ Debug.Assert(_writePos == 0, "FileStream cannot have buffered data to write here! Your stream will be corrupted.");
+ WriteCore(array, offset, count);
+ return;
+ }
+ else if (count == 0)
+ {
+ return; // Don't allocate a buffer then call memcpy for 0 bytes.
+ }
+
+ // Copy remaining bytes into buffer, to write at a later date.
+ Buffer.BlockCopy(array, offset, GetBuffer(), _writePos, count);
+ _writePos = count;
+ return;
+ }
+
+ private unsafe void WriteCore(byte[] buffer, int offset, int count)
+ {
+ Debug.Assert(!_fileHandle.IsClosed, "!_handle.IsClosed");
+ Debug.Assert(CanWrite, "_parent.CanWrite");
+
+ Debug.Assert(buffer != null, "buffer != null");
+ Debug.Assert(_readPos == _readLength, "_readPos == _readLen");
+ Debug.Assert(offset >= 0, "offset is negative");
+ Debug.Assert(count >= 0, "count is negative");
+ if (_useAsyncIO)
+ {
+ WriteInternalCoreAsync(buffer, offset, count, CancellationToken.None).GetAwaiter().GetResult();
+ return;
+ }
+
+ // Make sure we are writing to the position that we think we are
+ VerifyOSHandlePosition();
+
+ int errorCode = 0;
+ int r = WriteFileNative(_fileHandle, buffer, offset, count, null, out errorCode);
+
+ if (r == -1)
+ {
+ // For pipes, ERROR_NO_DATA is not an error, but the pipe is closing.
+ if (errorCode == ERROR_NO_DATA)
+ {
+ r = 0;
+ }
+ else
+ {
+ // ERROR_INVALID_PARAMETER may be returned for writes
+ // where the position is too large (i.e. writing at Int64.MaxValue
+ // on Win9x) OR for synchronous writes to a handle opened
+ // asynchronously.
+ if (errorCode == ERROR_INVALID_PARAMETER)
+ throw new IOException(SR.IO_FileTooLongOrHandleNotSync);
+ throw Win32Marshal.GetExceptionForWin32Error(errorCode);
+ }
+ }
+ Debug.Assert(r >= 0, "FileStream's WriteCore is likely broken.");
+ _filePosition += r;
+ return;
+ }
+
+ private Task<int> ReadAsyncInternal(byte[] array, int offset, int numBytes, CancellationToken cancellationToken)
+ {
+ // If async IO is not supported on this platform or
+ // if this Win32FileStream was not opened with FileOptions.Asynchronous.
+ if (!_useAsyncIO)
+ {
+ return base.ReadAsync(array, offset, numBytes, cancellationToken);
+ }
+
+ if (!CanRead) throw Error.GetReadNotSupported();
+
+ Debug.Assert((_readPos == 0 && _readLength == 0 && _writePos >= 0) || (_writePos == 0 && _readPos <= _readLength), "We're either reading or writing, but not both.");
+
+ if (_isPipe)
+ {
+ // Pipes are tricky, at least when you have 2 different pipes
+ // that you want to use simultaneously. When redirecting stdout
+ // & stderr with the Process class, it's easy to deadlock your
+ // parent & child processes when doing writes 4K at a time. The
+ // OS appears to use a 4K buffer internally. If you write to a
+ // pipe that is full, you will block until someone read from
+ // that pipe. If you try reading from an empty pipe and
+ // Win32FileStream's ReadAsync blocks waiting for data to fill it's
+ // internal buffer, you will be blocked. In a case where a child
+ // process writes to stdout & stderr while a parent process tries
+ // reading from both, you can easily get into a deadlock here.
+ // To avoid this deadlock, don't buffer when doing async IO on
+ // pipes. But don't completely ignore buffered data either.
+ if (_readPos < _readLength)
+ {
+ int n = _readLength - _readPos;
+ if (n > numBytes) n = numBytes;
+ Buffer.BlockCopy(GetBuffer(), _readPos, array, offset, n);
+ _readPos += n;
+
+ // Return a completed task
+ return TaskFromResultOrCache(n);
+ }
+ else
+ {
+ Debug.Assert(_writePos == 0, "Win32FileStream must not have buffered write data here! Pipes should be unidirectional.");
+ return ReadNativeAsync(array, offset, numBytes, 0, cancellationToken);
+ }
+ }
+
+ Debug.Assert(!_isPipe, "Should not be a pipe.");
+
+ // Handle buffering.
+ if (_writePos > 0) FlushWriteBuffer();
+ if (_readPos == _readLength)
+ {
+ // I can't see how to handle buffering of async requests when
+ // filling the buffer asynchronously, without a lot of complexity.
+ // The problems I see are issuing an async read, we do an async
+ // read to fill the buffer, then someone issues another read
+ // (either synchronously or asynchronously) before the first one
+ // returns. This would involve some sort of complex buffer locking
+ // that we probably don't want to get into, at least not in V1.
+ // If we did a sync read to fill the buffer, we could avoid the
+ // problem, and any async read less than 64K gets turned into a
+ // synchronous read by NT anyways... --
+
+ if (numBytes < _bufferLength)
+ {
+ Task<int> readTask = ReadNativeAsync(GetBuffer(), 0, _bufferLength, 0, cancellationToken);
+ _readLength = readTask.GetAwaiter().GetResult();
+ int n = _readLength;
+ if (n > numBytes) n = numBytes;
+ Buffer.BlockCopy(GetBuffer(), 0, array, offset, n);
+ _readPos = n;
+
+ // Return a completed task (recycling the one above if possible)
+ return (_readLength == n ? readTask : TaskFromResultOrCache(n));
+ }
+ else
+ {
+ // Here we're making our position pointer inconsistent
+ // with our read buffer. Throw away the read buffer's contents.
+ _readPos = 0;
+ _readLength = 0;
+ return ReadNativeAsync(array, offset, numBytes, 0, cancellationToken);
+ }
+ }
+ else
+ {
+ int n = _readLength - _readPos;
+ if (n > numBytes) n = numBytes;
+ Buffer.BlockCopy(GetBuffer(), _readPos, array, offset, n);
+ _readPos += n;
+
+ if (n >= numBytes)
+ {
+ // Return a completed task
+ return TaskFromResultOrCache(n);
+ }
+ else
+ {
+ // For streams with no clear EOF like serial ports or pipes
+ // we cannot read more data without causing an app to block
+ // incorrectly. Pipes don't go down this path
+ // though. This code needs to be fixed.
+ // Throw away read buffer.
+ _readPos = 0;
+ _readLength = 0;
+ return ReadNativeAsync(array, offset + n, numBytes - n, n, cancellationToken);
+ }
+ }
+ }
+
+ unsafe private Task<int> ReadNativeAsync(byte[] bytes, int offset, int numBytes, int numBufferedBytesRead, CancellationToken cancellationToken)
+ {
+ AssertCanRead(bytes, offset, numBytes);
+ Debug.Assert(_useAsyncIO, "ReadNativeAsync doesn't work on synchronous file streams!");
+
+ // Create and store async stream class library specific data in the async result
+
+ FileStreamCompletionSource completionSource = new FileStreamCompletionSource(this, numBufferedBytesRead, bytes, cancellationToken);
+ NativeOverlapped* intOverlapped = completionSource.Overlapped;
+
+ // Calculate position in the file we should be at after the read is done
+ if (CanSeek)
+ {
+ long len = Length;
+
+ // Make sure we are reading from the position that we think we are
+ VerifyOSHandlePosition();
+
+ if (_filePosition + numBytes > len)
+ {
+ if (_filePosition <= len)
+ numBytes = (int)(len - _filePosition);
+ else
+ numBytes = 0;
+ }
+
+ // Now set the position to read from in the NativeOverlapped struct
+ // For pipes, we should leave the offset fields set to 0.
+ intOverlapped->OffsetLow = unchecked((int)_filePosition);
+ intOverlapped->OffsetHigh = (int)(_filePosition >> 32);
+
+ // When using overlapped IO, the OS is not supposed to
+ // touch the file pointer location at all. We will adjust it
+ // ourselves. This isn't threadsafe.
+
+ // WriteFile should not update the file pointer when writing
+ // in overlapped mode, according to MSDN. But it does update
+ // the file pointer when writing to a UNC path!
+ // So changed the code below to seek to an absolute
+ // location, not a relative one. ReadFile seems consistent though.
+ SeekCore(numBytes, SeekOrigin.Current);
+ }
+
+ // queue an async ReadFile operation and pass in a packed overlapped
+ int errorCode = 0;
+ int r = ReadFileNative(_fileHandle, bytes, offset, numBytes, intOverlapped, out errorCode);
+ // ReadFile, the OS version, will return 0 on failure. But
+ // my ReadFileNative wrapper returns -1. My wrapper will return
+ // the following:
+ // On error, r==-1.
+ // On async requests that are still pending, r==-1 w/ errorCode==ERROR_IO_PENDING
+ // on async requests that completed sequentially, r==0
+ // You will NEVER RELIABLY be able to get the number of bytes
+ // read back from this call when using overlapped structures! You must
+ // not pass in a non-null lpNumBytesRead to ReadFile when using
+ // overlapped structures! This is by design NT behavior.
+ if (r == -1 && numBytes != -1)
+ {
+ // For pipes, when they hit EOF, they will come here.
+ if (errorCode == ERROR_BROKEN_PIPE)
+ {
+ // Not an error, but EOF. AsyncFSCallback will NOT be
+ // called. Call the user callback here.
+
+ // We clear the overlapped status bit for this special case.
+ // Failure to do so looks like we are freeing a pending overlapped later.
+ intOverlapped->InternalLow = IntPtr.Zero;
+ completionSource.SetCompletedSynchronously(0);
+ }
+ else if (errorCode != ERROR_IO_PENDING)
+ {
+ if (!_fileHandle.IsClosed && CanSeek) // Update Position - It could be anywhere.
+ {
+ SeekCore(0, SeekOrigin.Current);
+ }
+
+ completionSource.ReleaseNativeResource();
+
+ if (errorCode == ERROR_HANDLE_EOF)
+ {
+ throw Error.GetEndOfFile();
+ }
+ else
+ {
+ throw Win32Marshal.GetExceptionForWin32Error(errorCode);
+ }
+ }
+ else
+ {
+ // Only once the IO is pending do we register for cancellation
+ completionSource.RegisterForCancellation();
+ }
+ }
+ else
+ {
+ // Due to a workaround for a race condition in NT's ReadFile &
+ // WriteFile routines, we will always be returning 0 from ReadFileNative
+ // when we do async IO instead of the number of bytes read,
+ // irregardless of whether the operation completed
+ // synchronously or asynchronously. We absolutely must not
+ // set asyncResult._numBytes here, since will never have correct
+ // results.
+ //Console.WriteLine("ReadFile returned: "+r+" (0x"+Int32.Format(r, "x")+") The IO completed synchronously, but the user callback was called on a separate thread");
+ }
+
+ return completionSource.Task;
+ }
+
+ // Reads a byte from the file stream. Returns the byte cast to an int
+ // or -1 if reading from the end of the stream.
+ public override int ReadByte()
+ {
+ return ReadByteCore();
+ }
+
+ private Task WriteAsyncInternal(byte[] array, int offset, int numBytes, CancellationToken cancellationToken)
+ {
+ // If async IO is not supported on this platform or
+ // if this Win32FileStream was not opened with FileOptions.Asynchronous.
+ if (!_useAsyncIO)
+ {
+ return base.WriteAsync(array, offset, numBytes, cancellationToken);
+ }
+
+ if (!CanWrite) throw Error.GetWriteNotSupported();
+
+ Debug.Assert((_readPos == 0 && _readLength == 0 && _writePos >= 0) || (_writePos == 0 && _readPos <= _readLength), "We're either reading or writing, but not both.");
+ Debug.Assert(!_isPipe || (_readPos == 0 && _readLength == 0), "Win32FileStream must not have buffered data here! Pipes should be unidirectional.");
+
+ bool writeDataStoredInBuffer = false;
+ if (!_isPipe) // avoid async buffering with pipes, as doing so can lead to deadlocks (see comments in ReadInternalAsyncCore)
+ {
+ // Ensure the buffer is clear for writing
+ if (_writePos == 0)
+ {
+ if (_readPos < _readLength)
+ {
+ FlushReadBuffer();
+ }
+ _readPos = 0;
+ _readLength = 0;
+ }
+
+ // Determine how much space remains in the buffer
+ int remainingBuffer = _bufferLength - _writePos;
+ Debug.Assert(remainingBuffer >= 0);
+
+ // Simple/common case:
+ // - The write is smaller than our buffer, such that it's worth considering buffering it.
+ // - There's no active flush operation, such that we don't have to worry about the existing buffer being in use.
+ // - And the data we're trying to write fits in the buffer, meaning it wasn't already filled by previous writes.
+ // In that case, just store it in the buffer.
+ if (numBytes < _bufferLength && !HasActiveBufferOperation && numBytes <= remainingBuffer)
+ {
+ Buffer.BlockCopy(array, offset, GetBuffer(), _writePos, numBytes);
+ _writePos += numBytes;
+ writeDataStoredInBuffer = true;
+
+ // There is one special-but-common case, common because devs often use
+ // byte[] sizes that are powers of 2 and thus fit nicely into our buffer, which is
+ // also a power of 2. If after our write the buffer still has remaining space,
+ // then we're done and can return a completed task now. But if we filled the buffer
+ // completely, we want to do the asynchronous flush/write as part of this operation
+ // rather than waiting until the next write that fills the buffer.
+ if (numBytes != remainingBuffer)
+ return Task.CompletedTask;
+
+ Debug.Assert(_writePos == _bufferLength);
+ }
+ }
+
+ // At this point, at least one of the following is true:
+ // 1. There was an active flush operation (it could have completed by now, though).
+ // 2. The data doesn't fit in the remaining buffer (or it's a pipe and we chose not to try).
+ // 3. We wrote all of the data to the buffer, filling it.
+ //
+ // If there's an active operation, we can't touch the current buffer because it's in use.
+ // That gives us a choice: we can either allocate a new buffer, or we can skip the buffer
+ // entirely (even if the data would otherwise fit in it). For now, for simplicity, we do
+ // the latter; it could also have performance wins due to OS-level optimizations, and we could
+ // potentially add support for PreAllocatedOverlapped due to having a single buffer. (We can
+ // switch to allocating a new buffer, potentially experimenting with buffer pooling, should
+ // performance data suggest it's appropriate.)
+ //
+ // If the data doesn't fit in the remaining buffer, it could be because it's so large
+ // it's greater than the entire buffer size, in which case we'd always skip the buffer,
+ // or it could be because there's more data than just the space remaining. For the latter
+ // case, we need to issue an asynchronous write to flush that data, which then turns this into
+ // the first case above with an active operation.
+ //
+ // If we already stored the data, then we have nothing additional to write beyond what
+ // we need to flush.
+ //
+ // In any of these cases, we have the same outcome:
+ // - If there's data in the buffer, flush it by writing it out asynchronously.
+ // - Then, if there's any data to be written, issue a write for it concurrently.
+ // We return a Task that represents one or both.
+
+ // Flush the buffer asynchronously if there's anything to flush
+ Task flushTask = null;
+ if (_writePos > 0)
+ {
+ flushTask = FlushWriteAsync(cancellationToken);
+
+ // If we already copied all of the data into the buffer,
+ // simply return the flush task here. Same goes for if the task has
+ // already completed and was unsuccessful.
+ if (writeDataStoredInBuffer ||
+ flushTask.IsFaulted ||
+ flushTask.IsCanceled)
+ {
+ return flushTask;
+ }
+ }
+
+ Debug.Assert(!writeDataStoredInBuffer);
+ Debug.Assert(_writePos == 0);
+
+ // Finally, issue the write asynchronously, and return a Task that logically
+ // represents the write operation, including any flushing done.
+ Task writeTask = WriteInternalCoreAsync(array, offset, numBytes, cancellationToken);
+ return
+ (flushTask == null || flushTask.Status == TaskStatus.RanToCompletion) ? writeTask :
+ (writeTask.Status == TaskStatus.RanToCompletion) ? flushTask :
+ Task.WhenAll(flushTask, writeTask);
+ }
+
+ private unsafe Task WriteInternalCoreAsync(byte[] bytes, int offset, int numBytes, CancellationToken cancellationToken)
+ {
+ Debug.Assert(!_fileHandle.IsClosed, "!_handle.IsClosed");
+ Debug.Assert(CanWrite, "_parent.CanWrite");
+ Debug.Assert(bytes != null, "bytes != null");
+ Debug.Assert(_readPos == _readLength, "_readPos == _readLen");
+ Debug.Assert(_useAsyncIO, "WriteInternalCoreAsync doesn't work on synchronous file streams!");
+ Debug.Assert(offset >= 0, "offset is negative");
+ Debug.Assert(numBytes >= 0, "numBytes is negative");
+
+ // Create and store async stream class library specific data in the async result
+ FileStreamCompletionSource completionSource = new FileStreamCompletionSource(this, 0, bytes, cancellationToken);
+ NativeOverlapped* intOverlapped = completionSource.Overlapped;
+
+ if (CanSeek)
+ {
+ // Make sure we set the length of the file appropriately.
+ long len = Length;
+ //Console.WriteLine("WriteInternalCoreAsync - Calculating end pos. pos: "+pos+" len: "+len+" numBytes: "+numBytes);
+
+ // Make sure we are writing to the position that we think we are
+ VerifyOSHandlePosition();
+
+ if (_filePosition + numBytes > len)
+ {
+ //Console.WriteLine("WriteInternalCoreAsync - Setting length to: "+(pos + numBytes));
+ SetLengthCore(_filePosition + numBytes);
+ }
+
+ // Now set the position to read from in the NativeOverlapped struct
+ // For pipes, we should leave the offset fields set to 0.
+ intOverlapped->OffsetLow = (int)_filePosition;
+ intOverlapped->OffsetHigh = (int)(_filePosition >> 32);
+
+ // When using overlapped IO, the OS is not supposed to
+ // touch the file pointer location at all. We will adjust it
+ // ourselves. This isn't threadsafe.
+ SeekCore(numBytes, SeekOrigin.Current);
+ }
+
+ //Console.WriteLine("WriteInternalCoreAsync finishing. pos: "+pos+" numBytes: "+numBytes+" _pos: "+_pos+" Position: "+Position);
+
+ int errorCode = 0;
+ // queue an async WriteFile operation and pass in a packed overlapped
+ int r = WriteFileNative(_fileHandle, bytes, offset, numBytes, intOverlapped, out errorCode);
+
+ // WriteFile, the OS version, will return 0 on failure. But
+ // my WriteFileNative wrapper returns -1. My wrapper will return
+ // the following:
+ // On error, r==-1.
+ // On async requests that are still pending, r==-1 w/ errorCode==ERROR_IO_PENDING
+ // On async requests that completed sequentially, r==0
+ // You will NEVER RELIABLY be able to get the number of bytes
+ // written back from this call when using overlapped IO! You must
+ // not pass in a non-null lpNumBytesWritten to WriteFile when using
+ // overlapped structures! This is ByDesign NT behavior.
+ if (r == -1 && numBytes != -1)
+ {
+ //Console.WriteLine("WriteFile returned 0; Write will complete asynchronously (if errorCode==3e5) errorCode: 0x{0:x}", errorCode);
+
+ // For pipes, when they are closed on the other side, they will come here.
+ if (errorCode == ERROR_NO_DATA)
+ {
+ // Not an error, but EOF. AsyncFSCallback will NOT be called.
+ // Completing TCS and return cached task allowing the GC to collect TCS.
+ completionSource.SetCompletedSynchronously(0);
+ return Task.CompletedTask;
+ }
+ else if (errorCode != ERROR_IO_PENDING)
+ {
+ if (!_fileHandle.IsClosed && CanSeek) // Update Position - It could be anywhere.
+ {
+ SeekCore(0, SeekOrigin.Current);
+ }
+
+ completionSource.ReleaseNativeResource();
+
+ if (errorCode == ERROR_HANDLE_EOF)
+ {
+ throw Error.GetEndOfFile();
+ }
+ else
+ {
+ throw Win32Marshal.GetExceptionForWin32Error(errorCode);
+ }
+ }
+ else // ERROR_IO_PENDING
+ {
+ // Only once the IO is pending do we register for cancellation
+ completionSource.RegisterForCancellation();
+ }
+ }
+ else
+ {
+ // Due to a workaround for a race condition in NT's ReadFile &
+ // WriteFile routines, we will always be returning 0 from WriteFileNative
+ // when we do async IO instead of the number of bytes written,
+ // irregardless of whether the operation completed
+ // synchronously or asynchronously. We absolutely must not
+ // set asyncResult._numBytes here, since will never have correct
+ // results.
+ //Console.WriteLine("WriteFile returned: "+r+" (0x"+Int32.Format(r, "x")+") The IO completed synchronously, but the user callback was called on another thread.");
+ }
+
+ return completionSource.Task;
+ }
+
+ public override void WriteByte(byte value)
+ {
+ WriteByteCore(value);
+ }
+
+ // Windows API definitions, from winbase.h and others
+
+ private const int FILE_ATTRIBUTE_NORMAL = 0x00000080;
+ private const int FILE_ATTRIBUTE_ENCRYPTED = 0x00004000;
+ private const int FILE_FLAG_OVERLAPPED = 0x40000000;
+ internal const int GENERIC_READ = unchecked((int)0x80000000);
+ private const int GENERIC_WRITE = 0x40000000;
+
+ private const int FILE_BEGIN = 0;
+ private const int FILE_CURRENT = 1;
+ private const int FILE_END = 2;
+
+ // Error codes (not HRESULTS), from winerror.h
+ internal const int ERROR_BROKEN_PIPE = 109;
+ internal const int ERROR_NO_DATA = 232;
+ private const int ERROR_HANDLE_EOF = 38;
+ private const int ERROR_INVALID_PARAMETER = 87;
+ private const int ERROR_IO_PENDING = 997;
+
+ // __ConsoleStream also uses this code.
+ private unsafe int ReadFileNative(SafeFileHandle handle, byte[] bytes, int offset, int count, NativeOverlapped* overlapped, out int errorCode)
+ {
+ Debug.Assert(handle != null, "handle != null");
+ Debug.Assert(offset >= 0, "offset >= 0");
+ Debug.Assert(count >= 0, "count >= 0");
+ Debug.Assert(bytes != null, "bytes != null");
+ // Don't corrupt memory when multiple threads are erroneously writing
+ // to this stream simultaneously.
+ if (bytes.Length - offset < count)
+ throw new IndexOutOfRangeException(SR.IndexOutOfRange_IORaceCondition);
+
+ Debug.Assert((_useAsyncIO && overlapped != null) || (!_useAsyncIO && overlapped == null), "Async IO and overlapped parameters inconsistent in call to ReadFileNative.");
+
+ // You can't use the fixed statement on an array of length 0.
+ if (bytes.Length == 0)
+ {
+ errorCode = 0;
+ return 0;
+ }
+
+ int r = 0;
+ int numBytesRead = 0;
+
+ fixed (byte* p = &bytes[0])
+ {
+ if (_useAsyncIO)
+ r = Interop.Kernel32.ReadFile(handle, p + offset, count, IntPtr.Zero, overlapped);
+ else
+ r = Interop.Kernel32.ReadFile(handle, p + offset, count, out numBytesRead, IntPtr.Zero);
+ }
+
+ if (r == 0)
+ {
+ errorCode = GetLastWin32ErrorAndDisposeHandleIfInvalid();
+ return -1;
+ }
+ else
+ {
+ errorCode = 0;
+ return numBytesRead;
+ }
+ }
+
+ private unsafe int WriteFileNative(SafeFileHandle handle, byte[] bytes, int offset, int count, NativeOverlapped* overlapped, out int errorCode)
+ {
+ Debug.Assert(handle != null, "handle != null");
+ Debug.Assert(offset >= 0, "offset >= 0");
+ Debug.Assert(count >= 0, "count >= 0");
+ Debug.Assert(bytes != null, "bytes != null");
+ // Don't corrupt memory when multiple threads are erroneously writing
+ // to this stream simultaneously. (the OS is reading from
+ // the array we pass to WriteFile, but if we read beyond the end and
+ // that memory isn't allocated, we could get an AV.)
+ if (bytes.Length - offset < count)
+ throw new IndexOutOfRangeException(SR.IndexOutOfRange_IORaceCondition);
+
+ Debug.Assert((_useAsyncIO && overlapped != null) || (!_useAsyncIO && overlapped == null), "Async IO and overlapped parameters inconsistent in call to WriteFileNative.");
+
+ // You can't use the fixed statement on an array of length 0.
+ if (bytes.Length == 0)
+ {
+ errorCode = 0;
+ return 0;
+ }
+
+ int numBytesWritten = 0;
+ int r = 0;
+
+ fixed (byte* p = &bytes[0])
+ {
+ if (_useAsyncIO)
+ r = Interop.Kernel32.WriteFile(handle, p + offset, count, IntPtr.Zero, overlapped);
+ else
+ r = Interop.Kernel32.WriteFile(handle, p + offset, count, out numBytesWritten, IntPtr.Zero);
+ }
+
+ if (r == 0)
+ {
+ errorCode = GetLastWin32ErrorAndDisposeHandleIfInvalid();
+ return -1;
+ }
+ else
+ {
+ errorCode = 0;
+ return numBytesWritten;
+ }
+ }
+
+ private int GetLastWin32ErrorAndDisposeHandleIfInvalid(bool throwIfInvalidHandle = false)
+ {
+ int errorCode = Marshal.GetLastWin32Error();
+
+ // If ERROR_INVALID_HANDLE is returned, it doesn't suffice to set
+ // the handle as invalid; the handle must also be closed.
+ //
+ // Marking the handle as invalid but not closing the handle
+ // resulted in exceptions during finalization and locked column
+ // values (due to invalid but unclosed handle) in SQL Win32FileStream
+ // scenarios.
+ //
+ // A more mainstream scenario involves accessing a file on a
+ // network share. ERROR_INVALID_HANDLE may occur because the network
+ // connection was dropped and the server closed the handle. However,
+ // the client side handle is still open and even valid for certain
+ // operations.
+ //
+ // Note that _parent.Dispose doesn't throw so we don't need to special case.
+ // SetHandleAsInvalid only sets _closed field to true (without
+ // actually closing handle) so we don't need to call that as well.
+ if (errorCode == Interop.Errors.ERROR_INVALID_HANDLE)
+ {
+ _fileHandle.Dispose();
+
+ if (throwIfInvalidHandle)
+ throw Win32Marshal.GetExceptionForWin32Error(errorCode);
+ }
+
+ return errorCode;
+ }
+
+ public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
+ {
+ // If we're in sync mode, just use the shared CopyToAsync implementation that does
+ // typical read/write looping. We also need to take this path if this is a derived
+ // instance from FileStream, as a derived type could have overridden ReadAsync, in which
+ // case our custom CopyToAsync implementation isn't necessarily correct.
+ if (!_useAsyncIO || GetType() != typeof(FileStream))
+ {
+ return base.CopyToAsync(destination, bufferSize, cancellationToken);
+ }
+
+ StreamHelpers.ValidateCopyToArgs(this, destination, bufferSize);
+
+ // Bail early for cancellation if cancellation has been requested
+ if (cancellationToken.IsCancellationRequested)
+ {
+ return Task.FromCanceled<int>(cancellationToken);
+ }
+
+ // Fail if the file was closed
+ if (_fileHandle.IsClosed)
+ {
+ throw Error.GetFileNotOpen();
+ }
+
+ // Do the async copy, with differing implementations based on whether the FileStream was opened as async or sync
+ Debug.Assert((_readPos == 0 && _readLength == 0 && _writePos >= 0) || (_writePos == 0 && _readPos <= _readLength), "We're either reading or writing, but not both.");
+ return AsyncModeCopyToAsync(destination, bufferSize, cancellationToken);
+ }
+
+ private async Task AsyncModeCopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
+ {
+ Debug.Assert(_useAsyncIO, "This implementation is for async mode only");
+ Debug.Assert(!_fileHandle.IsClosed, "!_handle.IsClosed");
+ Debug.Assert(CanRead, "_parent.CanRead");
+
+ // Make sure any pending writes have been flushed before we do a read.
+ if (_writePos > 0)
+ {
+ await FlushWriteAsync(cancellationToken).ConfigureAwait(false);
+ }
+
+ // Typically CopyToAsync would be invoked as the only "read" on the stream, but it's possible some reading is
+ // done and then the CopyToAsync is issued. For that case, see if we have any data available in the buffer.
+ if (GetBuffer() != null)
+ {
+ int bufferedBytes = _readLength - _readPos;
+ if (bufferedBytes > 0)
+ {
+ await destination.WriteAsync(GetBuffer(), _readPos, bufferedBytes, cancellationToken).ConfigureAwait(false);
+ _readPos = _readLength = 0;
+ }
+ }
+
+ // For efficiency, we avoid creating a new task and associated state for each asynchronous read.
+ // Instead, we create a single reusable awaitable object that will be triggered when an await completes
+ // and reset before going again.
+ var readAwaitable = new AsyncCopyToAwaitable(this);
+
+ // Make sure we are reading from the position that we think we are.
+ // Only set the position in the awaitable if we can seek (e.g. not for pipes).
+ bool canSeek = CanSeek;
+ if (canSeek)
+ {
+ VerifyOSHandlePosition();
+ readAwaitable._position = _filePosition;
+ }
+
+ // Get the buffer to use for the copy operation, as the base CopyToAsync does. We don't try to use
+ // _buffer here, even if it's not null, as concurrent operations are allowed, and another operation may
+ // actually be using the buffer already. Plus, it'll be rare for _buffer to be non-null, as typically
+ // CopyToAsync is used as the only operation performed on the stream, and the buffer is lazily initialized.
+ // Further, typically the CopyToAsync buffer size will be larger than that used by the FileStream, such that
+ // we'd likely be unable to use it anyway. Instead, we rent the buffer from a pool.
+ byte[] copyBuffer = ArrayPool<byte>.Shared.Rent(bufferSize);
+ bufferSize = 0; // repurpose bufferSize to be the high water mark for the buffer, to avoid an extra field in the state machine
+
+ // Allocate an Overlapped we can use repeatedly for all operations
+ var awaitableOverlapped = new PreAllocatedOverlapped(AsyncCopyToAwaitable.s_callback, readAwaitable, copyBuffer);
+ var cancellationReg = default(CancellationTokenRegistration);
+ try
+ {
+ // Register for cancellation. We do this once for the whole copy operation, and just try to cancel
+ // whatever read operation may currently be in progress, if there is one. It's possible the cancellation
+ // request could come in between operations, in which case we flag that with explicit calls to ThrowIfCancellationRequested
+ // in the read/write copy loop.
+ if (cancellationToken.CanBeCanceled)
+ {
+ cancellationReg = cancellationToken.Register(s =>
+ {
+ var innerAwaitable = (AsyncCopyToAwaitable)s;
+ unsafe
+ {
+ lock (innerAwaitable.CancellationLock) // synchronize with cleanup of the overlapped
+ {
+ if (innerAwaitable._nativeOverlapped != null)
+ {
+ // Try to cancel the I/O. We ignore the return value, as cancellation is opportunistic and we
+ // don't want to fail the operation because we couldn't cancel it.
+ Interop.Kernel32.CancelIoEx(innerAwaitable._fileStream._fileHandle, innerAwaitable._nativeOverlapped);
+ }
+ }
+ }
+ }, readAwaitable);
+ }
+
+ // Repeatedly read from this FileStream and write the results to the destination stream.
+ while (true)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ readAwaitable.ResetForNextOperation();
+
+ try
+ {
+ bool synchronousSuccess;
+ int errorCode;
+ unsafe
+ {
+ // Allocate a native overlapped for our reusable overlapped, and set position to read based on the next
+ // desired address stored in the awaitable. (This position may be 0, if either we're at the beginning or
+ // if the stream isn't seekable.)
+ readAwaitable._nativeOverlapped = _fileHandle.ThreadPoolBinding.AllocateNativeOverlapped(awaitableOverlapped);
+ if (canSeek)
+ {
+ readAwaitable._nativeOverlapped->OffsetLow = unchecked((int)readAwaitable._position);
+ readAwaitable._nativeOverlapped->OffsetHigh = (int)(readAwaitable._position >> 32);
+ }
+
+ // Kick off the read.
+ synchronousSuccess = ReadFileNative(_fileHandle, copyBuffer, 0, copyBuffer.Length, readAwaitable._nativeOverlapped, out errorCode) >= 0;
+ }
+
+ // If the operation did not synchronously succeed, it either failed or initiated the asynchronous operation.
+ if (!synchronousSuccess)
+ {
+ switch (errorCode)
+ {
+ case ERROR_IO_PENDING:
+ // Async operation in progress.
+ break;
+ case ERROR_BROKEN_PIPE:
+ case ERROR_HANDLE_EOF:
+ // We're at or past the end of the file, and the overlapped callback
+ // won't be raised in these cases. Mark it as completed so that the await
+ // below will see it as such.
+ readAwaitable.MarkCompleted();
+ break;
+ default:
+ // Everything else is an error (and there won't be a callback).
+ throw Win32Marshal.GetExceptionForWin32Error(errorCode);
+ }
+ }
+
+ // Wait for the async operation (which may or may not have already completed), then throw if it failed.
+ await readAwaitable;
+ switch (readAwaitable._errorCode)
+ {
+ case 0: // success
+ Debug.Assert(readAwaitable._numBytes >= 0, $"Expected non-negative numBytes, got {readAwaitable._numBytes}");
+ break;
+ case ERROR_BROKEN_PIPE: // logically success with 0 bytes read (write end of pipe closed)
+ case ERROR_HANDLE_EOF: // logically success with 0 bytes read (read at end of file)
+ Debug.Assert(readAwaitable._numBytes == 0, $"Expected 0 bytes read, got {readAwaitable._numBytes}");
+ break;
+ case Interop.Errors.ERROR_OPERATION_ABORTED: // canceled
+ throw new OperationCanceledException(cancellationToken.IsCancellationRequested ? cancellationToken : new CancellationToken(true));
+ default: // error
+ throw Win32Marshal.GetExceptionForWin32Error((int)readAwaitable._errorCode);
+ }
+
+ // Successful operation. If we got zero bytes, we're done: exit the read/write loop.
+ int numBytesRead = (int)readAwaitable._numBytes;
+ if (numBytesRead == 0)
+ {
+ break;
+ }
+
+ // Otherwise, update the read position for next time accordingly.
+ if (canSeek)
+ {
+ readAwaitable._position += numBytesRead;
+ }
+
+ // (and keep track of the maximum number of bytes in the buffer we used, to avoid excessive and unnecessary
+ // clearing of the buffer before we return it to the pool)
+ if (numBytesRead > bufferSize)
+ {
+ bufferSize = numBytesRead;
+ }
+ }
+ finally
+ {
+ // Free the resources for this read operation
+ unsafe
+ {
+ NativeOverlapped* overlapped;
+ lock (readAwaitable.CancellationLock) // just an Exchange, but we need this to be synchronized with cancellation, so using the same lock
+ {
+ overlapped = readAwaitable._nativeOverlapped;
+ readAwaitable._nativeOverlapped = null;
+ }
+ if (overlapped != null)
+ {
+ _fileHandle.ThreadPoolBinding.FreeNativeOverlapped(overlapped);
+ }
+ }
+ }
+
+ // Write out the read data.
+ await destination.WriteAsync(copyBuffer, 0, (int)readAwaitable._numBytes, cancellationToken).ConfigureAwait(false);
+ }
+ }
+ finally
+ {
+ // Cleanup from the whole copy operation
+ cancellationReg.Dispose();
+ awaitableOverlapped.Dispose();
+
+ Array.Clear(copyBuffer, 0, bufferSize);
+ ArrayPool<byte>.Shared.Return(copyBuffer, clearArray: false);
+
+ // Make sure the stream's current position reflects where we ended up
+ if (!_fileHandle.IsClosed && CanSeek)
+ {
+ SeekCore(0, SeekOrigin.End);
+ }
+ }
+ }
+
+ /// <summary>Used by CopyToAsync to enable awaiting the result of an overlapped I/O operation with minimal overhead.</summary>
+ private sealed unsafe class AsyncCopyToAwaitable : ICriticalNotifyCompletion
+ {
+ /// <summary>Sentinel object used to indicate that the I/O operation has completed before being awaited.</summary>
+ private readonly static Action s_sentinel = () => { };
+ /// <summary>Cached delegate to IOCallback.</summary>
+ internal static readonly IOCompletionCallback s_callback = IOCallback;
+
+ /// <summary>The FileStream that owns this instance.</summary>
+ internal readonly FileStream _fileStream;
+
+ /// <summary>Tracked position representing the next location from which to read.</summary>
+ internal long _position;
+ /// <summary>The current native overlapped pointer. This changes for each operation.</summary>
+ internal NativeOverlapped* _nativeOverlapped;
+ /// <summary>
+ /// null if the operation is still in progress,
+ /// s_sentinel if the I/O operation completed before the await,
+ /// s_callback if it completed after the await yielded.
+ /// </summary>
+ internal Action _continuation;
+ /// <summary>Last error code from completed operation.</summary>
+ internal uint _errorCode;
+ /// <summary>Last number of read bytes from completed operation.</summary>
+ internal uint _numBytes;
+
+ /// <summary>Lock object used to protect cancellation-related access to _nativeOverlapped.</summary>
+ internal object CancellationLock => this;
+
+ /// <summary>Initialize the awaitable.</summary>
+ internal unsafe AsyncCopyToAwaitable(FileStream fileStream)
+ {
+ _fileStream = fileStream;
+ }
+
+ /// <summary>Reset state to prepare for the next read operation.</summary>
+ internal void ResetForNextOperation()
+ {
+ Debug.Assert(_position >= 0, $"Expected non-negative position, got {_position}");
+ _continuation = null;
+ _errorCode = 0;
+ _numBytes = 0;
+ }
+
+ /// <summary>Overlapped callback: store the results, then invoke the continuation delegate.</summary>
+ internal unsafe static void IOCallback(uint errorCode, uint numBytes, NativeOverlapped* pOVERLAP)
+ {
+ var awaitable = (AsyncCopyToAwaitable)ThreadPoolBoundHandle.GetNativeOverlappedState(pOVERLAP);
+
+ Debug.Assert(awaitable._continuation != s_sentinel, "Sentinel must not have already been set as the continuation");
+ awaitable._errorCode = errorCode;
+ awaitable._numBytes = numBytes;
+
+ (awaitable._continuation ?? Interlocked.CompareExchange(ref awaitable._continuation, s_sentinel, null))?.Invoke();
+ }
+
+ /// <summary>
+ /// Called when it's known that the I/O callback for an operation will not be invoked but we'll
+ /// still be awaiting the awaitable.
+ /// </summary>
+ internal void MarkCompleted()
+ {
+ Debug.Assert(_continuation == null, "Expected null continuation");
+ _continuation = s_sentinel;
+ }
+
+ public AsyncCopyToAwaitable GetAwaiter() => this;
+ public bool IsCompleted => _continuation == s_sentinel;
+ public void GetResult() { }
+ public void OnCompleted(Action continuation) => UnsafeOnCompleted(continuation);
+ public void UnsafeOnCompleted(Action continuation)
+ {
+ if (_continuation == s_sentinel ||
+ Interlocked.CompareExchange(ref _continuation, continuation, null) != null)
+ {
+ Debug.Assert(_continuation == s_sentinel, $"Expected continuation set to s_sentinel, got ${_continuation}");
+ Task.Run(continuation);
+ }
+ }
+ }
+
+ // Unlike Flush(), FlushAsync() always flushes to disk. This is intentional.
+ // Legend is that we chose not to flush the OS file buffers in Flush() in fear of
+ // perf problems with frequent, long running FlushFileBuffers() calls. But we don't
+ // have that problem with FlushAsync() because we will call FlushFileBuffers() in the background.
+ private Task FlushAsyncInternal(CancellationToken cancellationToken)
+ {
+ if (cancellationToken.IsCancellationRequested)
+ return Task.FromCanceled(cancellationToken);
+
+ if (_fileHandle.IsClosed)
+ throw Error.GetFileNotOpen();
+
+ // The always synchronous data transfer between the OS and the internal buffer is intentional
+ // because this is needed to allow concurrent async IO requests. Concurrent data transfer
+ // between the OS and the internal buffer will result in race conditions. Since FlushWrite and
+ // FlushRead modify internal state of the stream and transfer data between the OS and the
+ // internal buffer, they cannot be truly async. We will, however, flush the OS file buffers
+ // asynchronously because it doesn't modify any internal state of the stream and is potentially
+ // a long running process.
+ try
+ {
+ FlushInternalBuffer();
+ }
+ catch (Exception e)
+ {
+ return Task.FromException(e);
+ }
+
+ if (CanWrite)
+ {
+ return Task.Factory.StartNew(
+ state => ((FileStream)state).FlushOSBuffer(),
+ this,
+ cancellationToken,
+ TaskCreationOptions.DenyChildAttach,
+ TaskScheduler.Default);
+ }
+ else
+ {
+ return Task.CompletedTask;
+ }
+ }
+
+ private Task<int> TaskFromResultOrCache(int result)
+ {
+ Task<int> completedTask = _lastSynchronouslyCompletedTask;
+ Debug.Assert(completedTask == null || completedTask.Status == TaskStatus.RanToCompletion, "Cached task should have completed successfully");
+
+ if ((completedTask == null) || (completedTask.Result != result))
+ {
+ completedTask = Task.FromResult(result);
+ _lastSynchronouslyCompletedTask = completedTask;
+ }
+
+ return completedTask;
+ }
+
+ private void LockInternal(long position, long length)
+ {
+ int positionLow = unchecked((int)(position));
+ int positionHigh = unchecked((int)(position >> 32));
+ int lengthLow = unchecked((int)(length));
+ int lengthHigh = unchecked((int)(length >> 32));
+
+ if (!Interop.Kernel32.LockFile(_fileHandle, positionLow, positionHigh, lengthLow, lengthHigh))
+ {
+ throw Win32Marshal.GetExceptionForLastWin32Error();
+ }
+ }
+
+ private void UnlockInternal(long position, long length)
+ {
+ int positionLow = unchecked((int)(position));
+ int positionHigh = unchecked((int)(position >> 32));
+ int lengthLow = unchecked((int)(length));
+ int lengthHigh = unchecked((int)(length >> 32));
+
+ if (!Interop.Kernel32.UnlockFile(_fileHandle, positionLow, positionHigh, lengthLow, lengthHigh))
+ {
+ throw Win32Marshal.GetExceptionForLastWin32Error();
+ }
+ }
+ }
+}
diff --git a/src/mscorlib/shared/System/IO/FileStream.cs b/src/mscorlib/shared/System/IO/FileStream.cs
index 7db8518435..7545d0c696 100644
--- a/src/mscorlib/shared/System/IO/FileStream.cs
+++ b/src/mscorlib/shared/System/IO/FileStream.cs
@@ -9,6 +9,9 @@ using System.Diagnostics;
namespace System.IO
{
+#if PROJECTN
+ [Internal.Runtime.CompilerServices.RelocatedTypeAttribute("System.IO.FileSystem")]
+#endif
public partial class FileStream : Stream
{
private const FileShare DefaultShare = FileShare.Read;
diff --git a/src/mscorlib/shared/System/IO/Path.Windows.cs b/src/mscorlib/shared/System/IO/Path.Windows.cs
index 0f8e3b39cc..d6f0c628c3 100644
--- a/src/mscorlib/shared/System/IO/Path.Windows.cs
+++ b/src/mscorlib/shared/System/IO/Path.Windows.cs
@@ -114,7 +114,7 @@ namespace System.IO
}
// Tests if the given path contains a root. A path is considered rooted
- // if it starts with a backslash ("\") or a drive letter and a colon (":").
+ // if it starts with a backslash ("\") or a valid drive letter and a colon (":").
public static bool IsPathRooted(string path)
{
if (path != null)
@@ -123,7 +123,7 @@ namespace System.IO
int length = path.Length;
if ((length >= 1 && PathInternal.IsDirectorySeparator(path[0])) ||
- (length >= 2 && path[1] == PathInternal.VolumeSeparatorChar))
+ (length >= 2 && PathInternal.IsValidDriveChar(path[0]) && path[1] == PathInternal.VolumeSeparatorChar))
return true;
}
return false;
diff --git a/src/mscorlib/shared/System/IO/Path.cs b/src/mscorlib/shared/System/IO/Path.cs
index b3a8783c32..d26530b8e2 100644
--- a/src/mscorlib/shared/System/IO/Path.cs
+++ b/src/mscorlib/shared/System/IO/Path.cs
@@ -11,6 +11,9 @@ namespace System.IO
// Provides methods for processing file system strings in a cross-platform manner.
// Most of the methods don't do a complete parsing (such as examining a UNC hostname),
// but they will handle most string operations.
+#if PROJECTN
+ [Internal.Runtime.CompilerServices.RelocatedTypeAttribute("System.Runtime.Extensions")]
+#endif
public static partial class Path
{
// Public static readonly variant of the separators. The Path implementation itself is using
diff --git a/src/mscorlib/src/System/IO/StreamHelpers.CopyValidation.cs b/src/mscorlib/shared/System/IO/StreamHelpers.CopyValidation.cs
index 8ff0e045ca..45bbd816df 100644
--- a/src/mscorlib/src/System/IO/StreamHelpers.CopyValidation.cs
+++ b/src/mscorlib/shared/System/IO/StreamHelpers.CopyValidation.cs
@@ -17,29 +17,29 @@ namespace System.IO
if (bufferSize <= 0)
{
- throw new ArgumentOutOfRangeException(nameof(bufferSize), bufferSize, Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum"));
+ throw new ArgumentOutOfRangeException(nameof(bufferSize), bufferSize, SR.ArgumentOutOfRange_NeedPosNum);
}
bool sourceCanRead = source.CanRead;
if (!sourceCanRead && !source.CanWrite)
{
- throw new ObjectDisposedException(null, Environment.GetResourceString("ObjectDisposed_StreamClosed"));
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_StreamClosed);
}
bool destinationCanWrite = destination.CanWrite;
if (!destinationCanWrite && !destination.CanRead)
{
- throw new ObjectDisposedException(nameof(destination), Environment.GetResourceString("ObjectDisposed_StreamClosed"));
+ throw new ObjectDisposedException(nameof(destination), SR.ObjectDisposed_StreamClosed);
}
if (!sourceCanRead)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_UnreadableStream"));
+ throw new NotSupportedException(SR.NotSupported_UnreadableStream);
}
if (!destinationCanWrite)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_UnwritableStream"));
+ throw new NotSupportedException(SR.NotSupported_UnwritableStream);
}
}
}
diff --git a/src/mscorlib/shared/System/Lazy.cs b/src/mscorlib/shared/System/Lazy.cs
index 46a019f850..55f915b65d 100644
--- a/src/mscorlib/shared/System/Lazy.cs
+++ b/src/mscorlib/shared/System/Lazy.cs
@@ -201,7 +201,7 @@ namespace System
[NonSerialized]
private Func<T> _factory;
- // m_value eventually stores the lazily created value. It is valid when _state = null.
+ // _value eventually stores the lazily created value. It is valid when _state = null.
private T _value;
/// <summary>
diff --git a/src/mscorlib/shared/System/MarshalByRefObject.cs b/src/mscorlib/shared/System/MarshalByRefObject.cs
index 9014de00c7..1f1739b9cb 100644
--- a/src/mscorlib/shared/System/MarshalByRefObject.cs
+++ b/src/mscorlib/shared/System/MarshalByRefObject.cs
@@ -13,12 +13,12 @@ namespace System
public object GetLifetimeService()
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_Remoting);
}
public virtual object InitializeLifetimeService()
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_Remoting);
}
protected MarshalByRefObject MemberwiseClone(bool cloneIdentity)
diff --git a/src/mscorlib/shared/System/Reflection/AmbiguousMatchException.cs b/src/mscorlib/shared/System/Reflection/AmbiguousMatchException.cs
new file mode 100644
index 0000000000..459a19cb71
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/AmbiguousMatchException.cs
@@ -0,0 +1,35 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.Serialization;
+
+namespace System.Reflection
+{
+ [Serializable]
+ public sealed class AmbiguousMatchException : SystemException
+ {
+ public AmbiguousMatchException()
+ : base(SR.RFLCT_Ambiguous)
+ {
+ HResult = __HResults.COR_E_AMBIGUOUSMATCH;
+ }
+
+ public AmbiguousMatchException(string message)
+ : base(message)
+ {
+ HResult = __HResults.COR_E_AMBIGUOUSMATCH;
+ }
+
+ public AmbiguousMatchException(string message, Exception inner)
+ : base(message, inner)
+ {
+ HResult = __HResults.COR_E_AMBIGUOUSMATCH;
+ }
+
+ internal AmbiguousMatchException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+ }
+}
diff --git a/src/mscorlib/shared/System/Reflection/Assembly.cs b/src/mscorlib/shared/System/Reflection/Assembly.cs
new file mode 100644
index 0000000000..d35ffc7066
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/Assembly.cs
@@ -0,0 +1,200 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.IO;
+using System.Globalization;
+using System.Collections.Generic;
+using System.Configuration.Assemblies;
+using System.Runtime.Serialization;
+using System.Security;
+
+namespace System.Reflection
+{
+ public abstract partial class Assembly : ICustomAttributeProvider, ISerializable
+ {
+ protected Assembly() { }
+
+ public virtual IEnumerable<TypeInfo> DefinedTypes
+ {
+ get
+ {
+ Type[] types = GetTypes();
+ TypeInfo[] typeinfos = new TypeInfo[types.Length];
+ for (int i = 0; i < types.Length; i++)
+ {
+ TypeInfo typeinfo = types[i].GetTypeInfo();
+ if (typeinfo == null)
+ throw new NotSupportedException(SR.Format(SR.NotSupported_NoTypeInfo, types[i].FullName));
+
+ typeinfos[i] = typeinfo;
+ }
+ return typeinfos;
+ }
+ }
+
+ public virtual Type[] GetTypes()
+ {
+ Module[] m = GetModules(false);
+
+ int finalLength = 0;
+ Type[][] moduleTypes = new Type[m.Length][];
+
+ for (int i = 0; i < moduleTypes.Length; i++)
+ {
+ moduleTypes[i] = m[i].GetTypes();
+ finalLength += moduleTypes[i].Length;
+ }
+
+ int current = 0;
+ Type[] ret = new Type[finalLength];
+ for (int i = 0; i < moduleTypes.Length; i++)
+ {
+ int length = moduleTypes[i].Length;
+ Array.Copy(moduleTypes[i], 0, ret, current, length);
+ current += length;
+ }
+
+ return ret;
+ }
+
+ public virtual IEnumerable<Type> ExportedTypes => GetExportedTypes();
+ public virtual Type[] GetExportedTypes() { throw NotImplemented.ByDesign; }
+
+ public virtual string CodeBase { get { throw NotImplemented.ByDesign; } }
+ public virtual MethodInfo EntryPoint { get { throw NotImplemented.ByDesign; } }
+ public virtual string FullName { get { throw NotImplemented.ByDesign; } }
+ public virtual string ImageRuntimeVersion { get { throw NotImplemented.ByDesign; } }
+ public virtual bool IsDynamic => false;
+ public virtual string Location { get { throw NotImplemented.ByDesign; } }
+ public virtual bool ReflectionOnly { get { throw NotImplemented.ByDesign; } }
+
+ public virtual ManifestResourceInfo GetManifestResourceInfo(string resourceName) { throw NotImplemented.ByDesign; }
+ public virtual string[] GetManifestResourceNames() { throw NotImplemented.ByDesign; }
+ public virtual Stream GetManifestResourceStream(string name) { throw NotImplemented.ByDesign; }
+ public virtual Stream GetManifestResourceStream(Type type, string name) { throw NotImplemented.ByDesign; }
+
+ public bool IsFullyTrusted => true;
+
+ public virtual AssemblyName GetName() => GetName(copiedName: false);
+ public virtual AssemblyName GetName(bool copiedName) { throw NotImplemented.ByDesign; }
+
+ public virtual Type GetType(string name) => GetType(name, throwOnError: false, ignoreCase: false);
+ public virtual Type GetType(string name, bool throwOnError) => GetType(name, throwOnError: throwOnError, ignoreCase: false);
+ public virtual Type GetType(string name, bool throwOnError, bool ignoreCase) { throw NotImplemented.ByDesign; }
+
+ public virtual bool IsDefined(Type attributeType, bool inherit) { throw NotImplemented.ByDesign; }
+
+ public virtual IEnumerable<CustomAttributeData> CustomAttributes => GetCustomAttributesData();
+ public virtual IList<CustomAttributeData> GetCustomAttributesData() { throw NotImplemented.ByDesign; }
+
+ public virtual object[] GetCustomAttributes(bool inherit) { throw NotImplemented.ByDesign; }
+ public virtual object[] GetCustomAttributes(Type attributeType, bool inherit) { throw NotImplemented.ByDesign; }
+
+ public virtual string EscapedCodeBase => AssemblyName.EscapeCodeBase(CodeBase);
+
+ public object CreateInstance(string typeName) => CreateInstance(typeName, false, BindingFlags.Public | BindingFlags.Instance, binder: null, args: null, culture: null, activationAttributes: null);
+ public object CreateInstance(string typeName, bool ignoreCase) => CreateInstance(typeName, ignoreCase, BindingFlags.Public | BindingFlags.Instance, binder: null, args: null, culture: null, activationAttributes: null);
+ public virtual object CreateInstance(string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes)
+ {
+ Type t = GetType(typeName, throwOnError: false, ignoreCase: ignoreCase);
+ if (t == null)
+ return null;
+
+ return Activator.CreateInstance(t, bindingAttr, binder, args, culture, activationAttributes);
+ }
+
+ public virtual event ModuleResolveEventHandler ModuleResolve { add { throw NotImplemented.ByDesign; } remove { throw NotImplemented.ByDesign; } }
+
+ public virtual Module ManifestModule { get { throw NotImplemented.ByDesign; } }
+ public virtual Module GetModule(string name) { throw NotImplemented.ByDesign; }
+
+ public Module[] GetModules() => GetModules(getResourceModules: false);
+ public virtual Module[] GetModules(bool getResourceModules) { throw NotImplemented.ByDesign; }
+
+ public virtual IEnumerable<Module> Modules => GetLoadedModules(getResourceModules: true);
+ public Module[] GetLoadedModules() => GetLoadedModules(getResourceModules: false);
+ public virtual Module[] GetLoadedModules(bool getResourceModules) { throw NotImplemented.ByDesign; }
+
+ public virtual AssemblyName[] GetReferencedAssemblies() { throw NotImplemented.ByDesign; }
+
+ public virtual Assembly GetSatelliteAssembly(CultureInfo culture) { throw NotImplemented.ByDesign; }
+ public virtual Assembly GetSatelliteAssembly(CultureInfo culture, Version version) { throw NotImplemented.ByDesign; }
+
+ public virtual FileStream GetFile(string name) { throw NotImplemented.ByDesign; }
+ public virtual FileStream[] GetFiles() => GetFiles(getResourceModules: false);
+ public virtual FileStream[] GetFiles(bool getResourceModules) { throw NotImplemented.ByDesign; }
+
+ public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { throw NotImplemented.ByDesign; }
+
+ public override string ToString()
+ {
+ string displayName = FullName;
+ if (displayName == null)
+ return base.ToString();
+ else
+ return displayName;
+ }
+
+ /*
+ Returns true if the assembly was loaded from the global assembly cache.
+ */
+ public virtual bool GlobalAssemblyCache { get { throw NotImplemented.ByDesign; } }
+ public virtual Int64 HostContext { get { throw NotImplemented.ByDesign; } }
+
+ public override bool Equals(object o) => base.Equals(o);
+ public override int GetHashCode() => base.GetHashCode();
+
+ public static bool operator ==(Assembly left, Assembly right)
+ {
+ if (object.ReferenceEquals(left, right))
+ return true;
+
+ if ((object)left == null || (object)right == null)
+ return false;
+
+ return left.Equals(right);
+ }
+
+ public static bool operator !=(Assembly left, Assembly right)
+ {
+ return !(left == right);
+ }
+
+ public static string CreateQualifiedName(string assemblyName, string typeName) => typeName + ", " + assemblyName;
+
+ public static Assembly GetAssembly(Type type)
+ {
+ if (type == null)
+ throw new ArgumentNullException(nameof(type));
+
+ Module m = type.Module;
+ if (m == null)
+ return null;
+ else
+ return m.Assembly;
+ }
+
+ public static Assembly Load(byte[] rawAssembly) => Load(rawAssembly, rawSymbolStore: null);
+
+ [Obsolete("This method has been deprecated. Please use Assembly.Load() instead. http://go.microsoft.com/fwlink/?linkid=14202")]
+ public static Assembly LoadWithPartialName(string partialName)
+ {
+ if (partialName == null)
+ throw new ArgumentNullException(nameof(partialName));
+
+ return Load(partialName);
+ }
+
+ public static Assembly UnsafeLoadFrom(string assemblyFile) => LoadFrom(assemblyFile);
+
+ public Module LoadModule(string moduleName, byte[] rawModule) => LoadModule(moduleName, rawModule, null);
+ public virtual Module LoadModule(string moduleName, byte[] rawModule, byte[] rawSymbolStore) { throw NotImplemented.ByDesign; }
+
+ public static Assembly ReflectionOnlyLoad(byte[] rawAssembly) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ReflectionOnly); }
+ public static Assembly ReflectionOnlyLoad(string assemblyString) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ReflectionOnly); }
+ public static Assembly ReflectionOnlyLoadFrom(string assemblyFile) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ReflectionOnly); }
+
+ public virtual SecurityRuleSet SecurityRuleSet => SecurityRuleSet.None;
+ }
+}
diff --git a/src/mscorlib/shared/System/Reflection/AssemblyAlgorithmIdAttribute.cs b/src/mscorlib/shared/System/Reflection/AssemblyAlgorithmIdAttribute.cs
new file mode 100644
index 0000000000..fe24f353be
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/AssemblyAlgorithmIdAttribute.cs
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Configuration.Assemblies;
+
+namespace System.Reflection
+{
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
+ public sealed class AssemblyAlgorithmIdAttribute : Attribute
+ {
+ public AssemblyAlgorithmIdAttribute(AssemblyHashAlgorithm algorithmId)
+ {
+ AlgorithmId = (uint)algorithmId;
+ }
+
+ [CLSCompliant(false)]
+ public AssemblyAlgorithmIdAttribute(uint algorithmId)
+ {
+ AlgorithmId = algorithmId;
+ }
+
+ [CLSCompliant(false)]
+ public uint AlgorithmId { get; }
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/AssemblyCompanyAttribute.cs b/src/mscorlib/shared/System/Reflection/AssemblyCompanyAttribute.cs
new file mode 100644
index 0000000000..d986db60a3
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/AssemblyCompanyAttribute.cs
@@ -0,0 +1,18 @@
+// 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 System.Reflection
+{
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
+ public sealed class AssemblyCompanyAttribute : Attribute
+ {
+ public AssemblyCompanyAttribute(string company)
+ {
+ Company = company;
+ }
+
+ public string Company { get; }
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/AssemblyConfigurationAttribute.cs b/src/mscorlib/shared/System/Reflection/AssemblyConfigurationAttribute.cs
new file mode 100644
index 0000000000..195c4d0ca6
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/AssemblyConfigurationAttribute.cs
@@ -0,0 +1,18 @@
+// 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 System.Reflection
+{
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
+ public sealed class AssemblyConfigurationAttribute : Attribute
+ {
+ public AssemblyConfigurationAttribute(string configuration)
+ {
+ Configuration = configuration;
+ }
+
+ public string Configuration { get; }
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/AssemblyContentType.cs b/src/mscorlib/shared/System/Reflection/AssemblyContentType.cs
new file mode 100644
index 0000000000..2ee1a00818
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/AssemblyContentType.cs
@@ -0,0 +1,13 @@
+// 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 System.Reflection
+{
+ public enum AssemblyContentType
+ {
+ Default = 0,
+ WindowsRuntime = 1,
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/AssemblyCopyrightAttribute.cs b/src/mscorlib/shared/System/Reflection/AssemblyCopyrightAttribute.cs
new file mode 100644
index 0000000000..e50e19932b
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/AssemblyCopyrightAttribute.cs
@@ -0,0 +1,18 @@
+// 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 System.Reflection
+{
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
+ public sealed class AssemblyCopyrightAttribute : Attribute
+ {
+ public AssemblyCopyrightAttribute(string copyright)
+ {
+ Copyright = copyright;
+ }
+
+ public string Copyright { get; }
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/AssemblyCultureAttribute.cs b/src/mscorlib/shared/System/Reflection/AssemblyCultureAttribute.cs
new file mode 100644
index 0000000000..e31c6f9c1c
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/AssemblyCultureAttribute.cs
@@ -0,0 +1,18 @@
+// 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 System.Reflection
+{
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
+ public sealed class AssemblyCultureAttribute : Attribute
+ {
+ public AssemblyCultureAttribute(string culture)
+ {
+ Culture = culture;
+ }
+
+ public string Culture { get; }
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/AssemblyDefaultAliasAttribute.cs b/src/mscorlib/shared/System/Reflection/AssemblyDefaultAliasAttribute.cs
new file mode 100644
index 0000000000..ced35ed3fd
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/AssemblyDefaultAliasAttribute.cs
@@ -0,0 +1,18 @@
+// 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 System.Reflection
+{
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
+ public sealed class AssemblyDefaultAliasAttribute : Attribute
+ {
+ public AssemblyDefaultAliasAttribute(string defaultAlias)
+ {
+ DefaultAlias = defaultAlias;
+ }
+
+ public string DefaultAlias { get; }
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/AssemblyDelaySignAttribute.cs b/src/mscorlib/shared/System/Reflection/AssemblyDelaySignAttribute.cs
new file mode 100644
index 0000000000..eae2cf613c
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/AssemblyDelaySignAttribute.cs
@@ -0,0 +1,18 @@
+// 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 System.Reflection
+{
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
+ public sealed class AssemblyDelaySignAttribute : Attribute
+ {
+ public AssemblyDelaySignAttribute(bool delaySign)
+ {
+ DelaySign = delaySign;
+ }
+
+ public bool DelaySign { get; }
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/AssemblyDescriptionAttribute.cs b/src/mscorlib/shared/System/Reflection/AssemblyDescriptionAttribute.cs
new file mode 100644
index 0000000000..50f57c96a6
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/AssemblyDescriptionAttribute.cs
@@ -0,0 +1,18 @@
+// 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 System.Reflection
+{
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
+ public sealed class AssemblyDescriptionAttribute : Attribute
+ {
+ public AssemblyDescriptionAttribute(string description)
+ {
+ Description = description;
+ }
+
+ public string Description { get; }
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/AssemblyFileVersionAttribute.cs b/src/mscorlib/shared/System/Reflection/AssemblyFileVersionAttribute.cs
new file mode 100644
index 0000000000..b5face65bc
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/AssemblyFileVersionAttribute.cs
@@ -0,0 +1,20 @@
+// 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 System.Reflection
+{
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
+ public sealed class AssemblyFileVersionAttribute : Attribute
+ {
+ public AssemblyFileVersionAttribute(string version)
+ {
+ if (version == null)
+ throw new ArgumentNullException(nameof(version));
+ Version = version;
+ }
+
+ public string Version { get; }
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/AssemblyFlagsAttribute.cs b/src/mscorlib/shared/System/Reflection/AssemblyFlagsAttribute.cs
new file mode 100644
index 0000000000..103413340c
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/AssemblyFlagsAttribute.cs
@@ -0,0 +1,43 @@
+// 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 System.Reflection
+{
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
+ public sealed class AssemblyFlagsAttribute : Attribute
+ {
+ private AssemblyNameFlags _flags;
+
+ [Obsolete("This constructor has been deprecated. Please use AssemblyFlagsAttribute(AssemblyNameFlags) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
+ [CLSCompliant(false)]
+ public AssemblyFlagsAttribute(uint flags)
+ {
+ _flags = (AssemblyNameFlags)flags;
+ }
+
+ [Obsolete("This property has been deprecated. Please use AssemblyFlags instead. http://go.microsoft.com/fwlink/?linkid=14202")]
+ [CLSCompliant(false)]
+ public uint Flags
+ {
+ get { return (uint)_flags; }
+ }
+
+ public int AssemblyFlags
+ {
+ get { return (int)_flags; }
+ }
+
+ [Obsolete("This constructor has been deprecated. Please use AssemblyFlagsAttribute(AssemblyNameFlags) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
+ public AssemblyFlagsAttribute(int assemblyFlags)
+ {
+ _flags = (AssemblyNameFlags)assemblyFlags;
+ }
+
+ public AssemblyFlagsAttribute(AssemblyNameFlags assemblyFlags)
+ {
+ _flags = assemblyFlags;
+ }
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/AssemblyInformationalVersionAttribute.cs b/src/mscorlib/shared/System/Reflection/AssemblyInformationalVersionAttribute.cs
new file mode 100644
index 0000000000..915b973ab9
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/AssemblyInformationalVersionAttribute.cs
@@ -0,0 +1,18 @@
+// 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 System.Reflection
+{
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
+ public sealed class AssemblyInformationalVersionAttribute : Attribute
+ {
+ public AssemblyInformationalVersionAttribute(string informationalVersion)
+ {
+ InformationalVersion = informationalVersion;
+ }
+
+ public string InformationalVersion { get; }
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/AssemblyKeyFileAttribute.cs b/src/mscorlib/shared/System/Reflection/AssemblyKeyFileAttribute.cs
new file mode 100644
index 0000000000..9f7387d8af
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/AssemblyKeyFileAttribute.cs
@@ -0,0 +1,18 @@
+// 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 System.Reflection
+{
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
+ public sealed class AssemblyKeyFileAttribute : Attribute
+ {
+ public AssemblyKeyFileAttribute(string keyFile)
+ {
+ KeyFile = keyFile;
+ }
+
+ public string KeyFile { get; }
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/AssemblyKeyNameAttribute.cs b/src/mscorlib/shared/System/Reflection/AssemblyKeyNameAttribute.cs
new file mode 100644
index 0000000000..4cf51754ea
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/AssemblyKeyNameAttribute.cs
@@ -0,0 +1,18 @@
+// 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 System.Reflection
+{
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
+ public sealed class AssemblyKeyNameAttribute : Attribute
+ {
+ public AssemblyKeyNameAttribute(string keyName)
+ {
+ KeyName = keyName;
+ }
+
+ public string KeyName { get; }
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/AssemblyMetadataAttribute.cs b/src/mscorlib/shared/System/Reflection/AssemblyMetadataAttribute.cs
new file mode 100644
index 0000000000..de9f6351ec
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/AssemblyMetadataAttribute.cs
@@ -0,0 +1,21 @@
+// 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 System.Reflection
+{
+ [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
+ public sealed class AssemblyMetadataAttribute : Attribute
+ {
+ public AssemblyMetadataAttribute(string key, string value)
+ {
+ Key = key;
+ Value = value;
+ }
+
+ public string Key { get; }
+
+ public string Value { get; }
+ }
+}
+
diff --git a/src/mscorlib/src/System/Reflection/AssemblyNameFlags.cs b/src/mscorlib/shared/System/Reflection/AssemblyNameFlags.cs
index dd4fc4baf4..d321032031 100644
--- a/src/mscorlib/src/System/Reflection/AssemblyNameFlags.cs
+++ b/src/mscorlib/shared/System/Reflection/AssemblyNameFlags.cs
@@ -2,25 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*============================================================
-**
-**
-**
-**
-**
-**
-** Purpose: Flags controlling how an AssemblyName is used
-** during binding
-**
-**
-===========================================================*/
-
-using System;
-
namespace System.Reflection
{
- [Serializable]
- [FlagsAttribute()]
+ [Flags]
public enum AssemblyNameFlags
{
None = 0x0000,
@@ -34,22 +18,4 @@ namespace System.Reflection
Retargetable = 0x0100,
//ContentType = 0x0E00, // Bits describing the ContentType are accessible via AssemblyName.ContentType
}
-
- [Serializable]
- public enum AssemblyContentType
- {
- Default = 0x0000,
- WindowsRuntime = 0x0001
- }
-
- [Serializable]
- public enum ProcessorArchitecture
- {
- None = 0x0000,
- MSIL = 0x0001,
- X86 = 0x0002,
- IA64 = 0x0003,
- Amd64 = 0x0004,
- Arm = 0x0005
- }
}
diff --git a/src/mscorlib/shared/System/Reflection/AssemblyProductAttribute.cs b/src/mscorlib/shared/System/Reflection/AssemblyProductAttribute.cs
new file mode 100644
index 0000000000..43cb62df99
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/AssemblyProductAttribute.cs
@@ -0,0 +1,18 @@
+// 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 System.Reflection
+{
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
+ public sealed class AssemblyProductAttribute : Attribute
+ {
+ public AssemblyProductAttribute(string product)
+ {
+ Product = product;
+ }
+
+ public string Product { get; }
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/AssemblySignatureKeyAttribute.cs b/src/mscorlib/shared/System/Reflection/AssemblySignatureKeyAttribute.cs
new file mode 100644
index 0000000000..e6ec8af1b3
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/AssemblySignatureKeyAttribute.cs
@@ -0,0 +1,21 @@
+// 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 System.Reflection
+{
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)]
+ public sealed class AssemblySignatureKeyAttribute : Attribute
+ {
+ public AssemblySignatureKeyAttribute(string publicKey, string countersignature)
+ {
+ PublicKey = publicKey;
+ Countersignature = countersignature;
+ }
+
+ public string PublicKey { get; }
+
+ public string Countersignature { get; }
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/AssemblyTitleAttribute.cs b/src/mscorlib/shared/System/Reflection/AssemblyTitleAttribute.cs
new file mode 100644
index 0000000000..26d7a2e66c
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/AssemblyTitleAttribute.cs
@@ -0,0 +1,18 @@
+// 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 System.Reflection
+{
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
+ public sealed class AssemblyTitleAttribute : Attribute
+ {
+ public AssemblyTitleAttribute(string title)
+ {
+ Title = title;
+ }
+
+ public string Title { get; }
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/AssemblyTrademarkAttribute.cs b/src/mscorlib/shared/System/Reflection/AssemblyTrademarkAttribute.cs
new file mode 100644
index 0000000000..1d3edf51d5
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/AssemblyTrademarkAttribute.cs
@@ -0,0 +1,18 @@
+// 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 System.Reflection
+{
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
+ public sealed class AssemblyTrademarkAttribute : Attribute
+ {
+ public AssemblyTrademarkAttribute(string trademark)
+ {
+ Trademark = trademark;
+ }
+
+ public string Trademark { get; }
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/AssemblyVersionAttribute.cs b/src/mscorlib/shared/System/Reflection/AssemblyVersionAttribute.cs
new file mode 100644
index 0000000000..b3557bac97
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/AssemblyVersionAttribute.cs
@@ -0,0 +1,18 @@
+// 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 System.Reflection
+{
+ [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
+ public sealed class AssemblyVersionAttribute : Attribute
+ {
+ public AssemblyVersionAttribute(string version)
+ {
+ Version = version;
+ }
+
+ public string Version { get; }
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/Binder.cs b/src/mscorlib/shared/System/Reflection/Binder.cs
new file mode 100644
index 0000000000..3dc5665d52
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/Binder.cs
@@ -0,0 +1,19 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Globalization;
+
+namespace System.Reflection
+{
+ public abstract class Binder
+ {
+ protected Binder() { }
+ public abstract FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo[] match, object value, CultureInfo culture);
+ public abstract MethodBase BindToMethod(BindingFlags bindingAttr, MethodBase[] match, ref object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] names, out object state);
+ public abstract object ChangeType(object value, Type type, CultureInfo culture);
+ public abstract void ReorderArgumentArray(ref object[] args, object state);
+ public abstract MethodBase SelectMethod(BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[] modifiers);
+ public abstract PropertyInfo SelectProperty(BindingFlags bindingAttr, PropertyInfo[] match, Type returnType, Type[] indexes, ParameterModifier[] modifiers);
+ }
+}
diff --git a/src/mscorlib/src/System/Reflection/BindingFlags.cs b/src/mscorlib/shared/System/Reflection/BindingFlags.cs
index 45f7f662df..26c875d0f9 100644
--- a/src/mscorlib/src/System/Reflection/BindingFlags.cs
+++ b/src/mscorlib/shared/System/Reflection/BindingFlags.cs
@@ -2,22 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// BindingFlags are a set of flags that control the binding and invocation process
-//
-// in Reflection. There are two processes. The first is selection of a Member which
-// is the binding phase. The second, is invocation. These flags control how this
-// process works.
-//
-//
-
-using System;
-
namespace System.Reflection
{
- [Serializable]
[Flags]
public enum BindingFlags
{
@@ -28,13 +14,13 @@ namespace System.Reflection
Default = 0x00,
// These flags indicate what to search for when binding
- IgnoreCase = 0x01, // Ignore the case of Names while searching
+ IgnoreCase = 0x01, // Ignore the case of Names while searching
DeclaredOnly = 0x02, // Only look at the members declared on the Type
- Instance = 0x04, // Include Instance members in search
- Static = 0x08, // Include Static members in search
- Public = 0x10, // Include Public members in search
- NonPublic = 0x20, // Include Non-Public members in search
- FlattenHierarchy = 0x40, // Rollup the statics into the class.
+ Instance = 0x04, // Include Instance members in search
+ Static = 0x08, // Include Static members in search
+ Public = 0x10, // Include Public members in search
+ NonPublic = 0x20, // Include Non-Public members in search
+ FlattenHierarchy = 0x40, // Rollup the statics into the class.
// These flags are used by InvokeMember to determine
// what type of member we are trying to Invoke.
@@ -51,7 +37,7 @@ namespace System.Reflection
PutDispProperty = 0x4000,
PutRefDispProperty = 0x8000,
- ExactBinding = 0x010000, // Bind with Exact Type matching, No Change type
+ ExactBinding = 0x010000, // Bind with Exact Type matching, No Change type
SuppressChangeType = 0x020000,
// DefaultValueBinding will return the set of methods having ArgCount or
@@ -59,6 +45,6 @@ namespace System.Reflection
OptionalParamBinding = 0x040000,
// These are a couple of misc attributes used
- IgnoreReturn = 0x01000000, // This is used in COM Interop
+ IgnoreReturn = 0x01000000, // This is used in COM Interop
}
}
diff --git a/src/mscorlib/src/System/Reflection/CallingConventions.cs b/src/mscorlib/shared/System/Reflection/CallingConventions.cs
index 2fbf2f3362..bb6d6cd809 100644
--- a/src/mscorlib/src/System/Reflection/CallingConventions.cs
+++ b/src/mscorlib/shared/System/Reflection/CallingConventions.cs
@@ -2,21 +2,10 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// CallingConventions is a set of Bits representing the calling conventions
-//
-// in the system.
-//
-//
-
-using System.Runtime.InteropServices;
-using System;
+// CallingConventions is a set of Bits representing the calling conventions in the system.
namespace System.Reflection
{
- [Serializable]
[Flags]
public enum CallingConventions
{
diff --git a/src/mscorlib/shared/System/Reflection/ConstructorInfo.cs b/src/mscorlib/shared/System/Reflection/ConstructorInfo.cs
new file mode 100644
index 0000000000..3ee1dbf855
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/ConstructorInfo.cs
@@ -0,0 +1,40 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Diagnostics;
+using System.Globalization;
+
+namespace System.Reflection
+{
+ public abstract partial class ConstructorInfo : MethodBase
+ {
+ protected ConstructorInfo() { }
+
+ public override MemberTypes MemberType => MemberTypes.Constructor;
+
+ [DebuggerHidden]
+ [DebuggerStepThrough]
+ public object Invoke(object[] parameters) => Invoke(BindingFlags.Default, binder: null, parameters: parameters, culture: null);
+ public abstract object Invoke(BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture);
+
+ public override bool Equals(object obj) => base.Equals(obj);
+ public override int GetHashCode() => base.GetHashCode();
+
+ public static bool operator ==(ConstructorInfo left, ConstructorInfo right)
+ {
+ if (object.ReferenceEquals(left, right))
+ return true;
+
+ if ((object)left == null || (object)right == null)
+ return false;
+
+ return left.Equals(right);
+ }
+
+ public static bool operator !=(ConstructorInfo left, ConstructorInfo right) => !(left == right);
+
+ public static readonly string ConstructorName = ".ctor";
+ public static readonly string TypeConstructorName = ".cctor";
+ }
+}
diff --git a/src/mscorlib/shared/System/Reflection/CustomAttributeFormatException.cs b/src/mscorlib/shared/System/Reflection/CustomAttributeFormatException.cs
new file mode 100644
index 0000000000..6e11540505
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/CustomAttributeFormatException.cs
@@ -0,0 +1,33 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.Serialization;
+
+namespace System.Reflection
+{
+ [Serializable]
+ public class CustomAttributeFormatException : FormatException
+ {
+ public CustomAttributeFormatException()
+ : this(SR.Arg_CustomAttributeFormatException)
+ {
+ }
+
+ public CustomAttributeFormatException(string message)
+ : this(message, null)
+ {
+ }
+
+ public CustomAttributeFormatException(string message, Exception inner)
+ : base(message, inner)
+ {
+ HResult = __HResults.COR_E_CUSTOMATTRIBUTEFORMAT;
+ }
+
+ protected CustomAttributeFormatException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+ }
+}
diff --git a/src/mscorlib/src/System/Reflection/DefaultMemberAttribute.cs b/src/mscorlib/shared/System/Reflection/DefaultMemberAttribute.cs
index 3a0fdbf48d..3511433713 100644
--- a/src/mscorlib/src/System/Reflection/DefaultMemberAttribute.cs
+++ b/src/mscorlib/shared/System/Reflection/DefaultMemberAttribute.cs
@@ -2,41 +2,21 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// DefaultMemberAttribute is defines the Member of a Type that is the "default"
-//
-// member used by Type.InvokeMember. The default member is simply a name given
-// to a type.
-//
-//
-//
-//
-
-using System;
-
namespace System.Reflection
{
[Serializable]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface)]
public sealed class DefaultMemberAttribute : Attribute
{
- // The name of the member
- private String m_memberName;
-
// You must provide the name of the member, this is required
- public DefaultMemberAttribute(String memberName)
+ public DefaultMemberAttribute(string memberName)
{
- m_memberName = memberName;
+ MemberName = memberName;
}
// A get accessor to return the name from the attribute.
// NOTE: There is no setter because the name must be provided
// to the constructor. The name is not optional.
- public String MemberName
- {
- get { return m_memberName; }
- }
+ public string MemberName { get; }
}
}
diff --git a/src/mscorlib/src/System/Reflection/EventAttributes.cs b/src/mscorlib/shared/System/Reflection/EventAttributes.cs
index fcf14786c4..fbc2972f69 100644
--- a/src/mscorlib/src/System/Reflection/EventAttributes.cs
+++ b/src/mscorlib/shared/System/Reflection/EventAttributes.cs
@@ -2,21 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// EventAttributes are an enum defining the attributes associated with
-//
-// and Event. These are defined in CorHdr.h and are a combination of
-// bits and enums.
-//
-//
-
-using System;
+// EventAttributes are an enum defining the attributes associated with and Event.
+// These are defined in CorHdr.h and are a combination of bits and enums.
namespace System.Reflection
{
- [Serializable]
[Flags]
public enum EventAttributes
{
@@ -25,8 +15,8 @@ namespace System.Reflection
// This Enum matchs the CorEventAttr defined in CorHdr.h
SpecialName = 0x0200, // event is special. Name describes how.
- // Reserved flags for Runtime use only.
- ReservedMask = 0x0400,
RTSpecialName = 0x0400, // Runtime(metadata internal APIs) should check name encoding.
+
+ ReservedMask = 0x0400,
}
}
diff --git a/src/mscorlib/shared/System/Reflection/EventInfo.cs b/src/mscorlib/shared/System/Reflection/EventInfo.cs
new file mode 100644
index 0000000000..ccd9acf648
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/EventInfo.cs
@@ -0,0 +1,115 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Diagnostics;
+
+#if FEATURE_COMINTEROP
+using EventRegistrationToken = System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken;
+#endif //#if FEATURE_COMINTEROP
+
+namespace System.Reflection
+{
+ public abstract class EventInfo : MemberInfo
+ {
+ protected EventInfo() { }
+
+ public override MemberTypes MemberType => MemberTypes.Event;
+
+ public abstract EventAttributes Attributes { get; }
+ public bool IsSpecialName => (Attributes & EventAttributes.SpecialName) != 0;
+
+ public MethodInfo[] GetOtherMethods() => GetOtherMethods(nonPublic: false);
+ public virtual MethodInfo[] GetOtherMethods(bool nonPublic) { throw NotImplemented.ByDesign; }
+
+ public virtual MethodInfo AddMethod => GetAddMethod(nonPublic: true);
+ public virtual MethodInfo RemoveMethod => GetRemoveMethod(nonPublic: true);
+ public virtual MethodInfo RaiseMethod => GetRaiseMethod(nonPublic: true);
+
+ public MethodInfo GetAddMethod() => GetAddMethod(nonPublic: false);
+ public MethodInfo GetRemoveMethod() => GetRemoveMethod(nonPublic: false);
+ public MethodInfo GetRaiseMethod() => GetRaiseMethod(nonPublic: false);
+
+ public abstract MethodInfo GetAddMethod(bool nonPublic);
+ public abstract MethodInfo GetRemoveMethod(bool nonPublic);
+ public abstract MethodInfo GetRaiseMethod(bool nonPublic);
+
+ public virtual bool IsMulticast
+ {
+ get
+ {
+ Type cl = EventHandlerType;
+ Type mc = typeof(MulticastDelegate);
+ return mc.IsAssignableFrom(cl);
+ }
+ }
+
+ public virtual Type EventHandlerType
+ {
+ get
+ {
+ MethodInfo m = GetAddMethod(true);
+ ParameterInfo[] p = m.GetParametersNoCopy();
+ Type del = typeof(Delegate);
+ for (int i = 0; i < p.Length; i++)
+ {
+ Type c = p[i].ParameterType;
+ if (c.IsSubclassOf(del))
+ return c;
+ }
+ return null;
+ }
+ }
+
+ [DebuggerHidden]
+ [DebuggerStepThrough]
+ public virtual void AddEventHandler(object target, Delegate handler)
+ {
+ MethodInfo addMethod = GetAddMethod(nonPublic: false);
+
+ if (addMethod == null)
+ throw new InvalidOperationException(SR.InvalidOperation_NoPublicAddMethod);
+
+#if FEATURE_COMINTEROP
+ if (addMethod.ReturnType == typeof(EventRegistrationToken))
+ throw new InvalidOperationException(SR.InvalidOperation_NotSupportedOnWinRTEvent);
+#endif //#if FEATURE_COMINTEROP
+
+ addMethod.Invoke(target, new object[] { handler });
+ }
+
+ [DebuggerHidden]
+ [DebuggerStepThrough]
+ public virtual void RemoveEventHandler(object target, Delegate handler)
+ {
+ MethodInfo removeMethod = GetRemoveMethod(nonPublic: false);
+
+ if (removeMethod == null)
+ throw new InvalidOperationException(SR.InvalidOperation_NoPublicRemoveMethod);
+
+#if FEATURE_COMINTEROP
+ ParameterInfo[] parameters = removeMethod.GetParametersNoCopy();
+ if (parameters[0].ParameterType == typeof(EventRegistrationToken))
+ throw new InvalidOperationException(SR.InvalidOperation_NotSupportedOnWinRTEvent);
+#endif //#if FEATURE_COMINTEROP
+
+ removeMethod.Invoke(target, new object[] { handler });
+ }
+
+ public override bool Equals(object obj) => base.Equals(obj);
+ public override int GetHashCode() => base.GetHashCode();
+
+ public static bool operator ==(EventInfo left, EventInfo right)
+ {
+ if (object.ReferenceEquals(left, right))
+ return true;
+
+ if ((object)left == null || (object)right == null)
+ return false;
+
+ return left.Equals(right);
+ }
+
+ public static bool operator !=(EventInfo left, EventInfo right) => !(left == right);
+ }
+}
diff --git a/src/mscorlib/shared/System/Reflection/ExceptionHandlingClauseOptions.cs b/src/mscorlib/shared/System/Reflection/ExceptionHandlingClauseOptions.cs
new file mode 100644
index 0000000000..46285f7c82
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/ExceptionHandlingClauseOptions.cs
@@ -0,0 +1,16 @@
+// 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 System.Reflection
+{
+ [Flags]
+ public enum ExceptionHandlingClauseOptions : int
+ {
+ Clause = 0x0,
+ Filter = 0x1,
+ Finally = 0x2,
+ Fault = 0x4,
+ }
+}
+
diff --git a/src/mscorlib/src/System/Reflection/FieldAttributes.cs b/src/mscorlib/shared/System/Reflection/FieldAttributes.cs
index 02bfbece2d..048d0e7031 100644
--- a/src/mscorlib/src/System/Reflection/FieldAttributes.cs
+++ b/src/mscorlib/shared/System/Reflection/FieldAttributes.cs
@@ -2,13 +2,10 @@
// 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;
-
namespace System.Reflection
{
// This Enum matchs the CorFieldAttr defined in CorHdr.h
- [Serializable]
- [Flags()]
+ [Flags]
public enum FieldAttributes
{
// member access mask - Use this mask to retrieve accessibility information.
@@ -33,11 +30,11 @@ namespace System.Reflection
// interop attributes
PinvokeImpl = 0x2000, // Implementation is forwarded through pinvoke.
- // Reserved flags for runtime use only.
- ReservedMask = 0x9500,
RTSpecialName = 0x0400, // Runtime(metadata internal APIs) should check name encoding.
HasFieldMarshal = 0x1000, // Field has marshalling information.
HasDefault = 0x8000, // Field has default.
HasFieldRVA = 0x0100, // Field has RVA.
+
+ ReservedMask = 0x9500,
}
}
diff --git a/src/mscorlib/shared/System/Reflection/FieldInfo.cs b/src/mscorlib/shared/System/Reflection/FieldInfo.cs
new file mode 100644
index 0000000000..0863c2b019
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/FieldInfo.cs
@@ -0,0 +1,72 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Diagnostics;
+using System.Globalization;
+
+namespace System.Reflection
+{
+ public abstract partial class FieldInfo : MemberInfo
+ {
+ protected FieldInfo() { }
+
+ public override MemberTypes MemberType => MemberTypes.Field;
+
+ public abstract FieldAttributes Attributes { get; }
+ public abstract Type FieldType { get; }
+
+ public bool IsInitOnly => (Attributes & FieldAttributes.InitOnly) != 0;
+ public bool IsLiteral => (Attributes & FieldAttributes.Literal) != 0;
+ public bool IsNotSerialized => (Attributes & FieldAttributes.NotSerialized) != 0;
+ public bool IsPinvokeImpl => (Attributes & FieldAttributes.PinvokeImpl) != 0;
+ public bool IsSpecialName => (Attributes & FieldAttributes.SpecialName) != 0;
+ public bool IsStatic => (Attributes & FieldAttributes.Static) != 0;
+
+ public bool IsAssembly => (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Assembly;
+ public bool IsFamily => (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Family;
+ public bool IsFamilyAndAssembly => (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.FamANDAssem;
+ public bool IsFamilyOrAssembly => (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.FamORAssem;
+ public bool IsPrivate => (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Private;
+ public bool IsPublic => (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Public;
+
+ public virtual bool IsSecurityCritical => true;
+ public virtual bool IsSecuritySafeCritical => false;
+ public virtual bool IsSecurityTransparent => false;
+
+ public abstract RuntimeFieldHandle FieldHandle { get; }
+
+ public override bool Equals(object obj) => base.Equals(obj);
+ public override int GetHashCode() => base.GetHashCode();
+
+ public static bool operator ==(FieldInfo left, FieldInfo right)
+ {
+ if (object.ReferenceEquals(left, right))
+ return true;
+
+ if ((object)left == null || (object)right == null)
+ return false;
+
+ return left.Equals(right);
+ }
+
+ public static bool operator !=(FieldInfo left, FieldInfo right) => !(left == right);
+
+ public abstract object GetValue(object obj);
+
+ [DebuggerHidden]
+ [DebuggerStepThrough]
+ public void SetValue(object obj, object value) => SetValue(obj, value, BindingFlags.Default, Type.DefaultBinder, null);
+ public abstract void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture);
+
+ [CLSCompliant(false)]
+ public virtual void SetValueDirect(TypedReference obj, object value) { throw new NotSupportedException(SR.NotSupported_AbstractNonCLS); }
+ [CLSCompliant(false)]
+ public virtual object GetValueDirect(TypedReference obj) { throw new NotSupportedException(SR.NotSupported_AbstractNonCLS); }
+
+ public virtual object GetRawConstantValue() { throw new NotSupportedException(SR.NotSupported_AbstractNonCLS); }
+
+ public virtual Type[] GetOptionalCustomModifiers() { throw NotImplemented.ByDesign; }
+ public virtual Type[] GetRequiredCustomModifiers() { throw NotImplemented.ByDesign; }
+ }
+}
diff --git a/src/mscorlib/src/System/Reflection/GenericParameterAttributes.cs b/src/mscorlib/shared/System/Reflection/GenericParameterAttributes.cs
index 0dfc4b676d..4b579d273e 100644
--- a/src/mscorlib/src/System/Reflection/GenericParameterAttributes.cs
+++ b/src/mscorlib/shared/System/Reflection/GenericParameterAttributes.cs
@@ -2,11 +2,9 @@
// 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.Reflection
{
- [Flags()]
+ [Flags]
public enum GenericParameterAttributes
{
None = 0x0000,
diff --git a/src/mscorlib/shared/System/Reflection/ICustomAttributeProvider.cs b/src/mscorlib/shared/System/Reflection/ICustomAttributeProvider.cs
new file mode 100644
index 0000000000..3cae295bc4
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/ICustomAttributeProvider.cs
@@ -0,0 +1,13 @@
+// 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 System.Reflection
+{
+ public interface ICustomAttributeProvider
+ {
+ object[] GetCustomAttributes(bool inherit);
+ object[] GetCustomAttributes(Type attributeType, bool inherit);
+ bool IsDefined(Type attributeType, bool inherit);
+ }
+} \ No newline at end of file
diff --git a/src/mscorlib/src/System/Reflection/IReflect.cs b/src/mscorlib/shared/System/Reflection/IReflect.cs
index 7f023e04d7..51141ae47c 100644
--- a/src/mscorlib/src/System/Reflection/IReflect.cs
+++ b/src/mscorlib/shared/System/Reflection/IReflect.cs
@@ -2,81 +2,49 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// IReflect is an interface that defines a subset of the Type reflection methods.
-//
-// This interface is used to access and invoke members of a Type. It can be either
-// type based (like Type) or instance based (like Expando). This interface is used in
-// combination with IExpando to model the IDispatchEx expando capibilities in
-// the interop layer.
-//
-//
+using System.Globalization;
namespace System.Reflection
{
- using System;
- using System.Runtime.InteropServices;
- using CultureInfo = System.Globalization.CultureInfo;
-
- // Interface does not need to be marked with the serializable attribute
- [Guid("AFBF15E5-C37C-11d2-B88E-00A0C9B471B8")]
public interface IReflect
{
// Return the requested method if it is implemented by the Reflection object. The
// match is based upon the name and DescriptorInfo which describes the signature
// of the method.
- MethodInfo GetMethod(String name, BindingFlags bindingAttr, Binder binder,
- Type[] types, ParameterModifier[] modifiers);
+ MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers);
// Return the requested method if it is implemented by the Reflection object. The
// match is based upon the name of the method. If the object implementes multiple methods
// with the same name an AmbiguousMatchException is thrown.
- MethodInfo GetMethod(String name, BindingFlags bindingAttr);
+ MethodInfo GetMethod(string name, BindingFlags bindingAttr);
MethodInfo[] GetMethods(BindingFlags bindingAttr);
// Return the requestion field if it is implemented by the Reflection object. The
// match is based upon a name. There cannot be more than a single field with
// a name.
- FieldInfo GetField(
- String name,
- BindingFlags bindingAttr);
+ FieldInfo GetField(string name, BindingFlags bindingAttr);
- FieldInfo[] GetFields(
- BindingFlags bindingAttr);
+ FieldInfo[] GetFields(BindingFlags bindingAttr);
// Return the property based upon name. If more than one property has the given
// name an AmbiguousMatchException will be thrown. Returns null if no property
// is found.
- PropertyInfo GetProperty(
- String name,
- BindingFlags bindingAttr);
+ PropertyInfo GetProperty(string name, BindingFlags bindingAttr);
// Return the property based upon the name and Descriptor info describing the property
// indexing. Return null if no property is found.
- PropertyInfo GetProperty(
- String name,
- BindingFlags bindingAttr,
- Binder binder,
- Type returnType,
- Type[] types,
- ParameterModifier[] modifiers);
+ PropertyInfo GetProperty(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers);
// Returns an array of PropertyInfos for all the properties defined on
// the Reflection object.
- PropertyInfo[] GetProperties(
- BindingFlags bindingAttr);
+ PropertyInfo[] GetProperties(BindingFlags bindingAttr);
// Return an array of members which match the passed in name.
- MemberInfo[] GetMember(
- String name,
- BindingFlags bindingAttr);
+ MemberInfo[] GetMember(string name, BindingFlags bindingAttr);
// Return an array of all of the members defined for this object.
- MemberInfo[] GetMembers(
- BindingFlags bindingAttr);
+ MemberInfo[] GetMembers(BindingFlags bindingAttr);
// Description of the Binding Process.
// We must invoke a method that is accessable and for which the provided
@@ -99,21 +67,10 @@ namespace System.Reflection
// For the default binder, the most specific method will be selected.
//
// This will invoke a specific member...
- Object InvokeMember(
- String name,
- BindingFlags invokeAttr,
- Binder binder,
- Object target,
- Object[] args,
- ParameterModifier[] modifiers,
- CultureInfo culture,
- String[] namedParameters);
+ object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters);
// Return the underlying Type that represents the IReflect Object. For expando object,
// this is the (Object) IReflectInstance.GetType(). For Type object it is this.
- Type UnderlyingSystemType
- {
- get;
- }
+ Type UnderlyingSystemType { get; }
}
}
diff --git a/src/mscorlib/src/System/Reflection/IReflectableType.cs b/src/mscorlib/shared/System/Reflection/IReflectableType.cs
index 72b1b871fc..5e2c0edab4 100644
--- a/src/mscorlib/src/System/Reflection/IReflectableType.cs
+++ b/src/mscorlib/shared/System/Reflection/IReflectableType.cs
@@ -2,17 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// IReflectableType is an interface that is implemented by a Type produced
-// by a ReflectionContext
-//
-
-//
-
-using System;
-
namespace System.Reflection
{
public interface IReflectableType
@@ -20,3 +9,4 @@ namespace System.Reflection
TypeInfo GetTypeInfo();
}
}
+
diff --git a/src/mscorlib/shared/System/Reflection/ImageFileMachine.cs b/src/mscorlib/shared/System/Reflection/ImageFileMachine.cs
new file mode 100644
index 0000000000..230bc952e5
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/ImageFileMachine.cs
@@ -0,0 +1,15 @@
+// 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 System.Reflection
+{
+ public enum ImageFileMachine
+ {
+ I386 = 0x014c,
+ IA64 = 0x0200,
+ AMD64 = 0x8664,
+ ARM = 0x01c4,
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/InterfaceMapping.cs b/src/mscorlib/shared/System/Reflection/InterfaceMapping.cs
new file mode 100644
index 0000000000..2e0c0d8a28
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/InterfaceMapping.cs
@@ -0,0 +1,14 @@
+// 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 System.Reflection
+{
+ public struct InterfaceMapping
+ {
+ public Type TargetType; // The type implementing the interface
+ public Type InterfaceType; // The type representing the interface
+ public MethodInfo[] TargetMethods; // The methods implementing the interface
+ public MethodInfo[] InterfaceMethods; // The methods defined on the interface
+ }
+}
diff --git a/src/mscorlib/src/System/Reflection/IntrospectionExtensions.cs b/src/mscorlib/shared/System/Reflection/IntrospectionExtensions.cs
index 79316bcadc..6a18fdaa72 100644
--- a/src/mscorlib/src/System/Reflection/IntrospectionExtensions.cs
+++ b/src/mscorlib/shared/System/Reflection/IntrospectionExtensions.cs
@@ -2,16 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*=============================================================================
-**
-**
-**
-**
-**
-** Purpose: Get the underlying TypeInfo from a Type
-**
-**
-=============================================================================*/
+using System.Diagnostics;
namespace System.Reflection
{
@@ -22,8 +13,8 @@ namespace System.Reflection
if (type == null)
throw new ArgumentNullException(nameof(type));
- var rcType = (IReflectableType)type;
- return rcType.GetTypeInfo();
+ return ((IReflectableType)type).GetTypeInfo(); // Unguarded cast is unbecoming but kept for compatibility.
}
}
}
+
diff --git a/src/mscorlib/shared/System/Reflection/InvalidFilterCriteriaException.cs b/src/mscorlib/shared/System/Reflection/InvalidFilterCriteriaException.cs
new file mode 100644
index 0000000000..e3f882c409
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/InvalidFilterCriteriaException.cs
@@ -0,0 +1,33 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.Serialization;
+
+namespace System.Reflection
+{
+ [Serializable]
+ public class InvalidFilterCriteriaException : ApplicationException
+ {
+ public InvalidFilterCriteriaException()
+ : this(SR.Arg_InvalidFilterCriteriaException)
+ {
+ }
+
+ public InvalidFilterCriteriaException(string message)
+ : this(message, null)
+ {
+ }
+
+ public InvalidFilterCriteriaException(string message, Exception inner)
+ : base(message, inner)
+ {
+ HResult = __HResults.COR_E_INVALIDFILTERCRITERIA;
+ }
+
+ protected InvalidFilterCriteriaException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+ }
+}
diff --git a/src/mscorlib/shared/System/Reflection/ManifestResourceInfo.cs b/src/mscorlib/shared/System/Reflection/ManifestResourceInfo.cs
new file mode 100644
index 0000000000..b9c56ab857
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/ManifestResourceInfo.cs
@@ -0,0 +1,23 @@
+// 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 System.Reflection
+{
+ public class ManifestResourceInfo
+ {
+ public ManifestResourceInfo(Assembly containingAssembly,
+ string containingFileName,
+ ResourceLocation resourceLocation)
+ {
+ ReferencedAssembly = containingAssembly;
+ FileName = containingFileName;
+ ResourceLocation = resourceLocation;
+ }
+
+ public virtual Assembly ReferencedAssembly { get; }
+ public virtual string FileName { get; }
+ public virtual ResourceLocation ResourceLocation { get; }
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/MemberFilter.cs b/src/mscorlib/shared/System/Reflection/MemberFilter.cs
new file mode 100644
index 0000000000..bb1b15796a
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/MemberFilter.cs
@@ -0,0 +1,8 @@
+// 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 System.Reflection
+{
+ public delegate bool MemberFilter(MemberInfo m, object filterCriteria);
+} \ No newline at end of file
diff --git a/src/mscorlib/src/System/Reflection/MemberInfoSerializationHolder.cs b/src/mscorlib/shared/System/Reflection/MemberInfoSerializationHolder.cs
index d59205d707..dfc56667bd 100644
--- a/src/mscorlib/src/System/Reflection/MemberInfoSerializationHolder.cs
+++ b/src/mscorlib/shared/System/Reflection/MemberInfoSerializationHolder.cs
@@ -2,10 +2,7 @@
// 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.Runtime.Remoting;
using System.Runtime.Serialization;
using System.Globalization;
using System.Diagnostics.Contracts;
@@ -13,20 +10,54 @@ using System.Diagnostics.Contracts;
namespace System.Reflection
{
[Serializable]
- internal class MemberInfoSerializationHolder : ISerializable, IObjectReference
+#if CORECLR
+ internal
+#else
+ public // On CoreRT, this must be public because of the Reflection.Core/CoreLib divide and the need to whitelist past the ReflectionBlock.
+#endif
+ class MemberInfoSerializationHolder : ISerializable, IObjectReference
{
#region Staitc Public Members
- public static void GetSerializationInfo(SerializationInfo info, String name, RuntimeType reflectedClass, String signature, MemberTypes type)
+ public static void GetSerializationInfo(SerializationInfo info, FieldInfo f)
+ {
+ // Compat: Serializing ToString() since the full framework does it but the deserialization logic makes no use of it.
+ GetSerializationInfo(info, f.Name, f.ReflectedType, f.ToString(), MemberTypes.Field);
+ }
+
+ public static void GetSerializationInfo(SerializationInfo info, EventInfo e)
+ {
+ GetSerializationInfo(info, e.Name, e.ReflectedType, null, MemberTypes.Event);
+ }
+
+ public static void GetSerializationInfo(SerializationInfo info, ConstructorInfo c)
+ {
+ GetSerializationInfo(info, c.Name, c.ReflectedType, c.ToString(), c.SerializationToString(), MemberTypes.Constructor, genericArguments: null);
+ }
+
+ public static void GetSerializationInfo(SerializationInfo info, MethodInfo m)
+ {
+ Type[] genericArguments = m.IsConstructedGenericMethod ? m.GetGenericArguments() : null;
+ GetSerializationInfo(info, m.Name, m.ReflectedType, m.ToString(), m.SerializationToString(), MemberTypes.Method, genericArguments);
+ }
+
+ public static void GetSerializationInfo(SerializationInfo info, PropertyInfo p)
+ {
+ GetSerializationInfo(info, p.Name, p.ReflectedType, p.ToString(), p.SerializationToString(), MemberTypes.Property, genericArguments: null);
+ }
+ #endregion
+
+ #region Private Static Members
+ private static void GetSerializationInfo(SerializationInfo info, string name, Type reflectedClass, string signature, MemberTypes type)
{
GetSerializationInfo(info, name, reflectedClass, signature, null, type, null);
}
- public static void GetSerializationInfo(
+ private static void GetSerializationInfo(
SerializationInfo info,
- String name,
- RuntimeType reflectedClass,
- String signature,
- String signature2,
+ string name,
+ Type reflectedClass,
+ string signature,
+ string signature2,
MemberTypes type,
Type[] genericArguments)
{
@@ -34,83 +65,84 @@ namespace System.Reflection
throw new ArgumentNullException(nameof(info));
Contract.EndContractBlock();
- String assemblyName = reflectedClass.Module.Assembly.FullName;
- String typeName = reflectedClass.FullName;
+ string assemblyName = reflectedClass.Module.Assembly.FullName;
+ string typeName = reflectedClass.FullName;
info.SetType(typeof(MemberInfoSerializationHolder));
- info.AddValue("Name", name, typeof(String));
- info.AddValue("AssemblyName", assemblyName, typeof(String));
- info.AddValue("ClassName", typeName, typeof(String));
- info.AddValue("Signature", signature, typeof(String));
- info.AddValue("Signature2", signature2, typeof(String));
+ info.AddValue("Name", name, typeof(string));
+ info.AddValue("AssemblyName", assemblyName, typeof(string));
+ info.AddValue("ClassName", typeName, typeof(string));
+ info.AddValue("Signature", signature, typeof(string));
+ info.AddValue("Signature2", signature2, typeof(string));
info.AddValue("MemberType", (int)type);
info.AddValue("GenericArguments", genericArguments, typeof(Type[]));
}
#endregion
#region Private Data Members
- private String m_memberName;
- private RuntimeType m_reflectedType;
- // m_signature stores the ToString() representation of the member which is sometimes ambiguous.
+ private readonly string _memberName;
+ private readonly Type _reflectedType;
+ // _signature stores the ToString() representation of the member which is sometimes ambiguous.
// Mulitple overloads of the same methods or properties can identical ToString().
- // m_signature2 stores the SerializationToString() representation which should be unique for each member.
+ // _signature2 stores the SerializationToString() representation which should be unique for each member.
// It is only written and used by post 4.0 CLR versions.
- private String m_signature;
- private String m_signature2;
- private MemberTypes m_memberType;
- private SerializationInfo m_info;
+ private readonly string _signature;
+ private readonly string _signature2;
+ private readonly MemberTypes _memberType;
+ private readonly SerializationInfo _info;
#endregion
#region Constructor
- internal MemberInfoSerializationHolder(SerializationInfo info, StreamingContext context)
+ // Needs to be public so it can be whitelisted in Reflection.
+ public MemberInfoSerializationHolder(SerializationInfo info, StreamingContext context)
{
if (info == null)
throw new ArgumentNullException(nameof(info));
Contract.EndContractBlock();
- String assemblyName = info.GetString("AssemblyName");
- String typeName = info.GetString("ClassName");
+ string assemblyName = info.GetString("AssemblyName");
+ string typeName = info.GetString("ClassName");
if (assemblyName == null || typeName == null)
- throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientState"));
+ throw new SerializationException(SR.Serialization_InsufficientState);
- Assembly assem = FormatterServices.LoadAssemblyFromString(assemblyName);
- m_reflectedType = assem.GetType(typeName, true, false) as RuntimeType;
- m_memberName = info.GetString("Name");
- m_signature = info.GetString("Signature");
+ Assembly assem = Assembly.Load(assemblyName);
+ _reflectedType = assem.GetType(typeName, true, false);
+ _memberName = info.GetString("Name");
+ _signature = info.GetString("Signature");
// Only v4.0 and later generates and consumes Signature2
- m_signature2 = (string)info.GetValueNoThrow("Signature2", typeof(string));
- m_memberType = (MemberTypes)info.GetInt32("MemberType");
- m_info = info;
+ _signature2 = (string)info.GetValueNoThrow("Signature2", typeof(string));
+ _memberType = (MemberTypes)info.GetInt32("MemberType");
+ _info = info;
}
#endregion
#region ISerializable
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
- throw new NotSupportedException(Environment.GetResourceString(ResId.NotSupported_Method));
+ throw new NotSupportedException();
}
#endregion
#region IObjectReference
- public virtual Object GetRealObject(StreamingContext context)
+ public virtual object GetRealObject(StreamingContext context)
{
- if (m_memberName == null || m_reflectedType == null || m_memberType == 0)
- throw new SerializationException(Environment.GetResourceString(ResId.Serialization_InsufficientState));
+ if (_memberName == null || _reflectedType == null || _memberType == 0)
+ throw new SerializationException(SR.Serialization_InsufficientState);
BindingFlags bindingFlags =
BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.Static | BindingFlags.OptionalParamBinding;
- switch (m_memberType)
+ switch (_memberType)
{
#region case MemberTypes.Field:
case MemberTypes.Field:
{
- FieldInfo[] fields = m_reflectedType.GetMember(m_memberName, MemberTypes.Field, bindingFlags) as FieldInfo[];
+ FieldInfo[] fields = _reflectedType.GetMember(_memberName, MemberTypes.Field, bindingFlags) as FieldInfo[];
if (fields.Length == 0)
- throw new SerializationException(Environment.GetResourceString("Serialization_UnknownMember", m_memberName));
+ throw new SerializationException(SR.Format(SR.Serialization_UnknownMember, _memberName));
return fields[0];
}
@@ -119,10 +151,10 @@ namespace System.Reflection
#region case MemberTypes.Event:
case MemberTypes.Event:
{
- EventInfo[] events = m_reflectedType.GetMember(m_memberName, MemberTypes.Event, bindingFlags) as EventInfo[];
+ EventInfo[] events = _reflectedType.GetMember(_memberName, MemberTypes.Event, bindingFlags) as EventInfo[];
if (events.Length == 0)
- throw new SerializationException(Environment.GetResourceString("Serialization_UnknownMember", m_memberName));
+ throw new SerializationException(SR.Format(SR.Serialization_UnknownMember, _memberName));
return events[0];
}
@@ -131,10 +163,10 @@ namespace System.Reflection
#region case MemberTypes.Property:
case MemberTypes.Property:
{
- PropertyInfo[] properties = m_reflectedType.GetMember(m_memberName, MemberTypes.Property, bindingFlags) as PropertyInfo[];
+ PropertyInfo[] properties = _reflectedType.GetMember(_memberName, MemberTypes.Property, bindingFlags) as PropertyInfo[];
if (properties.Length == 0)
- throw new SerializationException(Environment.GetResourceString("Serialization_UnknownMember", m_memberName));
+ throw new SerializationException(SR.Format(SR.Serialization_UnknownMember, _memberName));
if (properties.Length == 1)
return properties[0];
@@ -143,30 +175,30 @@ namespace System.Reflection
{
for (int i = 0; i < properties.Length; i++)
{
- if (m_signature2 != null)
+ if (_signature2 != null)
{
- if (((RuntimePropertyInfo)properties[i]).SerializationToString().Equals(m_signature2))
+ if (properties[i].SerializationToString().Equals(_signature2))
return properties[i];
}
else
{
- if ((properties[i]).ToString().Equals(m_signature))
+ if ((properties[i]).ToString().Equals(_signature))
return properties[i];
}
}
}
- throw new SerializationException(Environment.GetResourceString(ResId.Serialization_UnknownMember, m_memberName));
+ throw new SerializationException(SR.Format(SR.Serialization_UnknownMember, _memberName));
}
#endregion
#region case MemberTypes.Constructor:
case MemberTypes.Constructor:
{
- if (m_signature == null)
- throw new SerializationException(Environment.GetResourceString(ResId.Serialization_NullSignature));
+ if (_signature == null)
+ throw new SerializationException(SR.Serialization_NullSignature);
- ConstructorInfo[] constructors = m_reflectedType.GetMember(m_memberName, MemberTypes.Constructor, bindingFlags) as ConstructorInfo[];
+ ConstructorInfo[] constructors = _reflectedType.GetMember(_memberName, MemberTypes.Constructor, bindingFlags) as ConstructorInfo[];
if (constructors.Length == 1)
return constructors[0];
@@ -175,20 +207,20 @@ namespace System.Reflection
{
for (int i = 0; i < constructors.Length; i++)
{
- if (m_signature2 != null)
+ if (_signature2 != null)
{
- if (((RuntimeConstructorInfo)constructors[i]).SerializationToString().Equals(m_signature2))
+ if (constructors[i].SerializationToString().Equals(_signature2))
return constructors[i];
}
else
{
- if (constructors[i].ToString().Equals(m_signature))
+ if (constructors[i].ToString().Equals(_signature))
return constructors[i];
}
}
}
- throw new SerializationException(Environment.GetResourceString(ResId.Serialization_UnknownMember, m_memberName));
+ throw new SerializationException(SR.Format(SR.Serialization_UnknownMember, _memberName));
}
#endregion
@@ -197,12 +229,12 @@ namespace System.Reflection
{
MethodInfo methodInfo = null;
- if (m_signature == null)
- throw new SerializationException(Environment.GetResourceString(ResId.Serialization_NullSignature));
+ if (_signature == null)
+ throw new SerializationException(SR.Serialization_NullSignature);
- Type[] genericArguments = m_info.GetValueNoThrow("GenericArguments", typeof(Type[])) as Type[];
+ Type[] genericArguments = _info.GetValueNoThrow("GenericArguments", typeof(Type[])) as Type[];
- MethodInfo[] methods = m_reflectedType.GetMember(m_memberName, MemberTypes.Method, bindingFlags) as MethodInfo[];
+ MethodInfo[] methods = _reflectedType.GetMember(_memberName, MemberTypes.Method, bindingFlags) as MethodInfo[];
if (methods.Length == 1)
methodInfo = methods[0];
@@ -211,9 +243,9 @@ namespace System.Reflection
{
for (int i = 0; i < methods.Length; i++)
{
- if (m_signature2 != null)
+ if (_signature2 != null)
{
- if (((RuntimeMethodInfo)methods[i]).SerializationToString().Equals(m_signature2))
+ if (methods[i].SerializationToString().Equals(_signature2))
{
methodInfo = methods[i];
break;
@@ -221,7 +253,7 @@ namespace System.Reflection
}
else
{
- if (methods[i].ToString().Equals(m_signature))
+ if (methods[i].ToString().Equals(_signature))
{
methodInfo = methods[i];
break;
@@ -236,9 +268,9 @@ namespace System.Reflection
{
MethodInfo candidateMethod = methods[i].MakeGenericMethod(genericArguments);
- if (m_signature2 != null)
+ if (_signature2 != null)
{
- if (((RuntimeMethodInfo)candidateMethod).SerializationToString().Equals(m_signature2))
+ if (candidateMethod.SerializationToString().Equals(_signature2))
{
methodInfo = candidateMethod;
break;
@@ -246,7 +278,7 @@ namespace System.Reflection
}
else
{
- if (candidateMethod.ToString().Equals(m_signature))
+ if (candidateMethod.ToString().Equals(_signature))
{
methodInfo = candidateMethod;
break;
@@ -258,7 +290,7 @@ namespace System.Reflection
}
if (methodInfo == null)
- throw new SerializationException(Environment.GetResourceString(ResId.Serialization_UnknownMember, m_memberName));
+ throw new SerializationException(SR.Format(SR.Serialization_UnknownMember, _memberName));
if (!methodInfo.IsGenericMethodDefinition)
return methodInfo;
@@ -274,9 +306,10 @@ namespace System.Reflection
#endregion
default:
- throw new ArgumentException(Environment.GetResourceString("Serialization_MemberTypeNotRecognized"));
+ throw new ArgumentException(SR.Serialization_MemberTypeNotRecognized);
}
}
#endregion
}
}
+
diff --git a/src/mscorlib/src/System/Reflection/MemberTypes.cs b/src/mscorlib/shared/System/Reflection/MemberTypes.cs
index aac59ecf35..57072dcfbe 100644
--- a/src/mscorlib/src/System/Reflection/MemberTypes.cs
+++ b/src/mscorlib/shared/System/Reflection/MemberTypes.cs
@@ -2,26 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// MemberTypes is an bit mask marking each type of Member that is defined as
-//
-// a subclass of MemberInfo. These are returned by MemberInfo.MemberType and
-// are useful in switch statements.
-//
-//
-
-using System;
-
namespace System.Reflection
{
- // This Enum matchs the CorTypeAttr defined in CorHdr.h
- [Serializable]
- [Flags()]
+ [Flags]
public enum MemberTypes
{
- // The following are the known classes which extend MemberInfo
Constructor = 0x01,
Event = 0x02,
Field = 0x04,
@@ -32,4 +17,4 @@ namespace System.Reflection
NestedType = 0x80,
All = Constructor | Event | Field | Method | Property | TypeInfo | NestedType,
}
-}
+} \ No newline at end of file
diff --git a/src/mscorlib/src/System/Reflection/MethodAttributes.cs b/src/mscorlib/shared/System/Reflection/MethodAttributes.cs
index 38b35ff151..1a7c7bf154 100644
--- a/src/mscorlib/src/System/Reflection/MethodAttributes.cs
+++ b/src/mscorlib/shared/System/Reflection/MethodAttributes.cs
@@ -2,14 +2,8 @@
// 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;
-
namespace System.Reflection
{
- [Serializable]
[Flags]
public enum MethodAttributes
{
@@ -48,9 +42,9 @@ namespace System.Reflection
UnmanagedExport = 0x0008, // Managed method exported via thunk to unmanaged code.
RTSpecialName = 0x1000, // Runtime should check name encoding.
- // Reserved flags for runtime use only.
- ReservedMask = 0xd000,
HasSecurity = 0x4000, // Method has security associate with it.
RequireSecObject = 0x8000, // Method calls another method containing security code.
+
+ ReservedMask = 0xd000,
}
}
diff --git a/src/mscorlib/shared/System/Reflection/MethodBase.cs b/src/mscorlib/shared/System/Reflection/MethodBase.cs
new file mode 100644
index 0000000000..0037c74f4c
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/MethodBase.cs
@@ -0,0 +1,86 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Globalization;
+using System.Diagnostics;
+
+namespace System.Reflection
+{
+ public abstract partial class MethodBase : MemberInfo
+ {
+ protected MethodBase() { }
+
+ public abstract ParameterInfo[] GetParameters();
+ public abstract MethodAttributes Attributes { get; }
+ public virtual MethodImplAttributes MethodImplementationFlags => GetMethodImplementationFlags();
+ public abstract MethodImplAttributes GetMethodImplementationFlags();
+ public virtual MethodBody GetMethodBody() { throw new InvalidOperationException(); }
+ public virtual CallingConventions CallingConvention => CallingConventions.Standard;
+
+ public bool IsAbstract => (Attributes & MethodAttributes.Abstract) != 0;
+ public bool IsConstructor
+ {
+ get
+ {
+ // To be backward compatible we only return true for instance RTSpecialName ctors.
+ return (this is ConstructorInfo &&
+ !IsStatic &&
+ ((Attributes & MethodAttributes.RTSpecialName) == MethodAttributes.RTSpecialName));
+ }
+ }
+ public bool IsFinal => (Attributes & MethodAttributes.Final) != 0;
+ public bool IsHideBySig => (Attributes & MethodAttributes.HideBySig) != 0;
+ public bool IsSpecialName => (Attributes & MethodAttributes.SpecialName) != 0;
+ public bool IsStatic => (Attributes & MethodAttributes.Static) != 0;
+ public bool IsVirtual => (Attributes & MethodAttributes.Virtual) != 0;
+
+ public bool IsAssembly => (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Assembly;
+ public bool IsFamily => (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Family;
+ public bool IsFamilyAndAssembly => (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.FamANDAssem;
+ public bool IsFamilyOrAssembly => (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.FamORAssem;
+ public bool IsPrivate => (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Private;
+ public bool IsPublic => (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Public;
+
+ public virtual bool IsConstructedGenericMethod => IsGenericMethod && !IsGenericMethodDefinition;
+ public virtual bool IsGenericMethod => false;
+ public virtual bool IsGenericMethodDefinition => false;
+ public virtual Type[] GetGenericArguments() { throw new NotSupportedException(SR.NotSupported_SubclassOverride); }
+ public virtual bool ContainsGenericParameters => false;
+
+ [DebuggerHidden]
+ [DebuggerStepThrough]
+ public object Invoke(object obj, object[] parameters) => Invoke(obj, BindingFlags.Default, binder: null, parameters: parameters, culture: null);
+ public abstract object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture);
+
+ public abstract RuntimeMethodHandle MethodHandle { get; }
+
+ public virtual bool IsSecurityCritical { get { throw NotImplemented.ByDesign; } }
+ public virtual bool IsSecuritySafeCritical { get { throw NotImplemented.ByDesign; } }
+ public virtual bool IsSecurityTransparent { get { throw NotImplemented.ByDesign; } }
+
+ public override bool Equals(object obj) => base.Equals(obj);
+ public override int GetHashCode() => base.GetHashCode();
+
+ public static bool operator ==(MethodBase left, MethodBase right)
+ {
+ if (object.ReferenceEquals(left, right))
+ return true;
+
+ if ((object)left == null || (object)right == null)
+ return false;
+
+ MethodInfo method1, method2;
+ ConstructorInfo constructor1, constructor2;
+
+ if ((method1 = left as MethodInfo) != null && (method2 = right as MethodInfo) != null)
+ return method1 == method2;
+ else if ((constructor1 = left as ConstructorInfo) != null && (constructor2 = right as ConstructorInfo) != null)
+ return constructor1 == constructor2;
+
+ return false;
+ }
+
+ public static bool operator !=(MethodBase left, MethodBase right) => !(left == right);
+ }
+}
diff --git a/src/mscorlib/src/System/Reflection/MethodImplAttributes.cs b/src/mscorlib/shared/System/Reflection/MethodImplAttributes.cs
index a22735725b..a1ed326002 100644
--- a/src/mscorlib/src/System/Reflection/MethodImplAttributes.cs
+++ b/src/mscorlib/shared/System/Reflection/MethodImplAttributes.cs
@@ -2,22 +2,15 @@
// 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;
-
namespace System.Reflection
{
// This Enum matchs the CorMethodImpl defined in CorHdr.h
- [Serializable]
public enum MethodImplAttributes
{
// code impl mask
CodeTypeMask = 0x0003, // Flags about code type.
IL = 0x0000, // Method impl is IL.
Native = 0x0001, // Method impl is native.
- /// <internalonly/>
OPTIL = 0x0002, // Method impl is OPTIL
Runtime = 0x0003, // Method impl is provided by the runtime.
// end code impl mask
@@ -39,6 +32,6 @@ namespace System.Reflection
AggressiveInlining = 0x0100, // Method should be inlined if possible.
NoOptimization = 0x0040, // Method may not be optimized.
- MaxMethodImplVal = 0xFFFF, // Range check value
+ MaxMethodImplVal = 0xffff,
}
}
diff --git a/src/mscorlib/shared/System/Reflection/MethodInfo.cs b/src/mscorlib/shared/System/Reflection/MethodInfo.cs
new file mode 100644
index 0000000000..3f60149e87
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/MethodInfo.cs
@@ -0,0 +1,43 @@
+// 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 System.Reflection
+{
+ public abstract class MethodInfo : MethodBase
+ {
+ protected MethodInfo() { }
+
+ public override MemberTypes MemberType => MemberTypes.Method;
+
+ public virtual ParameterInfo ReturnParameter { get { throw NotImplemented.ByDesign; } }
+ public virtual Type ReturnType { get { throw NotImplemented.ByDesign; } }
+
+ public override Type[] GetGenericArguments() { throw new NotSupportedException(SR.NotSupported_SubclassOverride); }
+ public virtual MethodInfo GetGenericMethodDefinition() { throw new NotSupportedException(SR.NotSupported_SubclassOverride); }
+ public virtual MethodInfo MakeGenericMethod(params Type[] typeArguments) { throw new NotSupportedException(SR.NotSupported_SubclassOverride); }
+
+ public abstract MethodInfo GetBaseDefinition();
+
+ public abstract ICustomAttributeProvider ReturnTypeCustomAttributes { get; }
+
+ public virtual Delegate CreateDelegate(Type delegateType) { throw new NotSupportedException(SR.NotSupported_SubclassOverride); }
+ public virtual Delegate CreateDelegate(Type delegateType, object target) { throw new NotSupportedException(SR.NotSupported_SubclassOverride); }
+
+ public override bool Equals(object obj) => base.Equals(obj);
+ public override int GetHashCode() => base.GetHashCode();
+
+ public static bool operator ==(MethodInfo left, MethodInfo right)
+ {
+ if (object.ReferenceEquals(left, right))
+ return true;
+
+ if ((object)left == null || (object)right == null)
+ return false;
+
+ return left.Equals(right);
+ }
+
+ public static bool operator !=(MethodInfo left, MethodInfo right) => !(left == right);
+ }
+}
diff --git a/src/mscorlib/src/System/Reflection/Missing.cs b/src/mscorlib/shared/System/Reflection/Missing.cs
index 1a8a641765..fa32d43ccb 100644
--- a/src/mscorlib/src/System/Reflection/Missing.cs
+++ b/src/mscorlib/shared/System/Reflection/Missing.cs
@@ -2,34 +2,23 @@
// 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.Runtime.Remoting;
using System.Runtime.Serialization;
-using System.Diagnostics.Contracts;
namespace System.Reflection
{
- // This is not serializable because it is a reflection command.
[Serializable]
public sealed class Missing : ISerializable
{
public static readonly Missing Value = new Missing();
- #region Constructor
private Missing() { }
- #endregion
- #region ISerializable
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
throw new ArgumentNullException(nameof(info));
- Contract.EndContractBlock();
UnitySerializationHolder.GetUnitySerializationInfo(info, this);
}
- #endregion
}
}
diff --git a/src/mscorlib/shared/System/Reflection/Module.cs b/src/mscorlib/shared/System/Reflection/Module.cs
new file mode 100644
index 0000000000..56f83c40d9
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/Module.cs
@@ -0,0 +1,182 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+
+namespace System.Reflection
+{
+ public abstract class Module : ICustomAttributeProvider, ISerializable
+ {
+ protected Module() { }
+
+ public virtual Assembly Assembly { get { throw NotImplemented.ByDesign; } }
+ public virtual string FullyQualifiedName { get { throw NotImplemented.ByDesign; } }
+ public virtual string Name { get { throw NotImplemented.ByDesign; } }
+
+ public virtual int MDStreamVersion { get { throw NotImplemented.ByDesign; } }
+ public virtual Guid ModuleVersionId { get { throw NotImplemented.ByDesign; } }
+ public virtual string ScopeName { get { throw NotImplemented.ByDesign; } }
+ public ModuleHandle ModuleHandle => GetModuleHandleImpl();
+ protected virtual ModuleHandle GetModuleHandleImpl() => ModuleHandle.EmptyHandle; // Not an api but declared protected because of Reflection.Core/Corelib divide (when built by CoreRt)
+ public virtual void GetPEKind(out PortableExecutableKinds peKind, out ImageFileMachine machine) { throw NotImplemented.ByDesign; }
+ public virtual bool IsResource() { throw NotImplemented.ByDesign; }
+
+ public virtual bool IsDefined(Type attributeType, bool inherit) { throw NotImplemented.ByDesign; }
+ public virtual IEnumerable<CustomAttributeData> CustomAttributes => GetCustomAttributesData();
+ public virtual IList<CustomAttributeData> GetCustomAttributesData() { throw NotImplemented.ByDesign; }
+ public virtual object[] GetCustomAttributes(bool inherit) { throw NotImplemented.ByDesign; }
+ public virtual object[] GetCustomAttributes(Type attributeType, bool inherit) { throw NotImplemented.ByDesign; }
+
+ public MethodInfo GetMethod(string name)
+ {
+ if (name == null)
+ throw new ArgumentNullException(nameof(name));
+
+ return GetMethodImpl(name, Module.DefaultLookup, null, CallingConventions.Any, null, null);
+ }
+
+ public MethodInfo GetMethod(string name, Type[] types) => GetMethod(name, Module.DefaultLookup, null, CallingConventions.Any, types, null);
+ public MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
+ {
+ if (name == null)
+ throw new ArgumentNullException(nameof(name));
+ if (types == null)
+ throw new ArgumentNullException(nameof(types));
+ for (int i = 0; i < types.Length; i++)
+ {
+ if (types[i] == null)
+ throw new ArgumentNullException(nameof(types));
+ }
+ return GetMethodImpl(name, bindingAttr, binder, callConvention, types, modifiers);
+ }
+
+ protected virtual MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) { throw NotImplemented.ByDesign; }
+
+ public MethodInfo[] GetMethods() => GetMethods(Module.DefaultLookup);
+ public virtual MethodInfo[] GetMethods(BindingFlags bindingFlags) { throw NotImplemented.ByDesign; }
+
+ public FieldInfo GetField(string name) => GetField(name, Module.DefaultLookup);
+ public virtual FieldInfo GetField(string name, BindingFlags bindingAttr) { throw NotImplemented.ByDesign; }
+
+ public FieldInfo[] GetFields() => GetFields(Module.DefaultLookup);
+ public virtual FieldInfo[] GetFields(BindingFlags bindingFlags) { throw NotImplemented.ByDesign; }
+
+ public virtual Type[] GetTypes() { throw NotImplemented.ByDesign; }
+
+ public virtual Type GetType(string className) => GetType(className, throwOnError: false, ignoreCase: false);
+ public virtual Type GetType(string className, bool ignoreCase) => GetType(className, throwOnError: false, ignoreCase: ignoreCase);
+ public virtual Type GetType(string className, bool throwOnError, bool ignoreCase) { throw NotImplemented.ByDesign; }
+
+ public virtual Type[] FindTypes(TypeFilter filter, object filterCriteria)
+ {
+ Type[] c = GetTypes();
+ int cnt = 0;
+ for (int i = 0; i < c.Length; i++)
+ {
+ if (filter != null && !filter(c[i], filterCriteria))
+ c[i] = null;
+ else
+ cnt++;
+ }
+ if (cnt == c.Length)
+ return c;
+
+ Type[] ret = new Type[cnt];
+ cnt = 0;
+ for (int i = 0; i < c.Length; i++)
+ {
+ if (c[i] != null)
+ ret[cnt++] = c[i];
+ }
+ return ret;
+ }
+
+ public virtual int MetadataToken { get { throw NotImplemented.ByDesign; } }
+
+ public FieldInfo ResolveField(int metadataToken) => ResolveField(metadataToken, null, null);
+ public virtual FieldInfo ResolveField(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) { throw NotImplemented.ByDesign; }
+
+ public MemberInfo ResolveMember(int metadataToken) => ResolveMember(metadataToken, null, null);
+ public virtual MemberInfo ResolveMember(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) { throw NotImplemented.ByDesign; }
+
+ public MethodBase ResolveMethod(int metadataToken) => ResolveMethod(metadataToken, null, null);
+ public virtual MethodBase ResolveMethod(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) { throw NotImplemented.ByDesign; }
+
+ public virtual byte[] ResolveSignature(int metadataToken) { throw NotImplemented.ByDesign; }
+ public virtual string ResolveString(int metadataToken) { throw NotImplemented.ByDesign; }
+
+ public Type ResolveType(int metadataToken) => ResolveType(metadataToken, null, null);
+ public virtual Type ResolveType(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) { throw NotImplemented.ByDesign; }
+
+ public virtual void GetObjectData(SerializationInfo info, StreamingContext context) { throw NotImplemented.ByDesign; }
+
+ public override bool Equals(object o) => base.Equals(o);
+ public override int GetHashCode() => base.GetHashCode();
+
+ public static bool operator ==(Module left, Module right)
+ {
+ if (object.ReferenceEquals(left, right))
+ return true;
+
+ if ((object)left == null || (object)right == null)
+ return false;
+
+ return left.Equals(right);
+ }
+
+ public static bool operator !=(Module left, Module right) => !(left == right);
+
+ public override string ToString() => ScopeName;
+
+ public static readonly TypeFilter FilterTypeName = FilterTypeNameImpl;
+ public static readonly TypeFilter FilterTypeNameIgnoreCase = FilterTypeNameIgnoreCaseImpl;
+
+ private const BindingFlags DefaultLookup = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public;
+
+ // FilterTypeName
+ // This method will filter the class based upon the name. It supports
+ // a trailing wild card.
+ private static bool FilterTypeNameImpl(Type cls, object filterCriteria)
+ {
+ // Check that the criteria object is a String object
+ if (filterCriteria == null || !(filterCriteria is string))
+ throw new InvalidFilterCriteriaException(SR.InvalidFilterCriteriaException_CritString);
+
+ string str = (string)filterCriteria;
+
+ // Check to see if this is a prefix or exact match requirement
+ if (str.Length > 0 && str[str.Length - 1] == '*')
+ {
+ str = str.Substring(0, str.Length - 1);
+ return cls.Name.StartsWith(str, StringComparison.Ordinal);
+ }
+
+ return cls.Name.Equals(str);
+ }
+
+ // FilterFieldNameIgnoreCase
+ // This method filter the Type based upon name, it ignores case.
+ private static bool FilterTypeNameIgnoreCaseImpl(Type cls, object filterCriteria)
+ {
+ // Check that the criteria object is a String object
+ if (filterCriteria == null || !(filterCriteria is string))
+ throw new InvalidFilterCriteriaException(SR.InvalidFilterCriteriaException_CritString);
+
+ string str = (string)filterCriteria;
+
+ // Check to see if this is a prefix or exact match requirement
+ if (str.Length > 0 && str[str.Length - 1] == '*')
+ {
+ str = str.Substring(0, str.Length - 1);
+ string name = cls.Name;
+ if (name.Length >= str.Length)
+ return (string.Compare(name, 0, str, 0, str.Length, StringComparison.OrdinalIgnoreCase) == 0);
+ else
+ return false;
+ }
+ return (string.Compare(str, cls.Name, StringComparison.OrdinalIgnoreCase) == 0);
+ }
+ }
+}
diff --git a/src/mscorlib/shared/System/Reflection/ModuleResolveEventHandler.cs b/src/mscorlib/shared/System/Reflection/ModuleResolveEventHandler.cs
new file mode 100644
index 0000000000..eb8926b5db
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/ModuleResolveEventHandler.cs
@@ -0,0 +1,9 @@
+// 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 System.Reflection
+{
+ public delegate Module ModuleResolveEventHandler(object sender, ResolveEventArgs e);
+}
+
diff --git a/src/mscorlib/src/System/Reflection/ParameterAttributes.cs b/src/mscorlib/shared/System/Reflection/ParameterAttributes.cs
index e4f3476d59..ce195897c2 100644
--- a/src/mscorlib/src/System/Reflection/ParameterAttributes.cs
+++ b/src/mscorlib/shared/System/Reflection/ParameterAttributes.cs
@@ -2,21 +2,12 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
// ParameterAttributes is an enum defining the attributes that may be
-//
-// associated with a Parameter. These are defined in CorHdr.h.
-//
-//
-
-using System;
+// associated with a Parameter. These are defined in CorHdr.h.
namespace System.Reflection
{
// This Enum matchs the CorParamAttr defined in CorHdr.h
- [Serializable]
[Flags]
public enum ParameterAttributes
{
@@ -24,14 +15,15 @@ namespace System.Reflection
In = 0x0001, // Param is [In]
Out = 0x0002, // Param is [Out]
Lcid = 0x0004, // Param is [lcid]
- Retval = 0x0008, // Param is [Retval]
+
+ Retval = 0x0008, // Param is [Retval]
Optional = 0x0010, // Param is optional
- // Reserved flags for Runtime use only.
- ReservedMask = 0xf000,
HasDefault = 0x1000, // Param has default value.
HasFieldMarshal = 0x2000, // Param has FieldMarshal.
- Reserved3 = 0x4000, // reserved bit
- Reserved4 = 0x8000 // reserved bit
+
+ Reserved3 = 0x4000,
+ Reserved4 = 0x8000,
+ ReservedMask = 0xf000,
}
}
diff --git a/src/mscorlib/shared/System/Reflection/ParameterInfo.cs b/src/mscorlib/shared/System/Reflection/ParameterInfo.cs
new file mode 100644
index 0000000000..94bfffaa53
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/ParameterInfo.cs
@@ -0,0 +1,110 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+
+namespace System.Reflection
+{
+ public class ParameterInfo : ICustomAttributeProvider, IObjectReference
+ {
+ protected ParameterInfo() { }
+
+ public virtual ParameterAttributes Attributes => AttrsImpl;
+ public virtual MemberInfo Member => MemberImpl;
+ public virtual string Name => NameImpl;
+ public virtual Type ParameterType => ClassImpl;
+ public virtual int Position => PositionImpl;
+
+ public bool IsIn => (Attributes & ParameterAttributes.In) != 0;
+ public bool IsLcid => (Attributes & ParameterAttributes.Lcid) != 0;
+ public bool IsOptional => (Attributes & ParameterAttributes.Optional) != 0;
+ public bool IsOut => (Attributes & ParameterAttributes.Out) != 0;
+ public bool IsRetval => (Attributes & ParameterAttributes.Retval) != 0;
+
+ public virtual object DefaultValue { get { throw NotImplemented.ByDesign; } }
+ public virtual object RawDefaultValue { get { throw NotImplemented.ByDesign; } }
+ public virtual bool HasDefaultValue { get { throw NotImplemented.ByDesign; } }
+
+ public virtual bool IsDefined(Type attributeType, bool inherit)
+ {
+ if (attributeType == null)
+ throw new ArgumentNullException(nameof(attributeType));
+
+ return false;
+ }
+
+ public virtual IEnumerable<CustomAttributeData> CustomAttributes => GetCustomAttributesData();
+ public virtual IList<CustomAttributeData> GetCustomAttributesData() { throw NotImplemented.ByDesign; }
+
+ public virtual object[] GetCustomAttributes(bool inherit) => Array.Empty<object>();
+ public virtual object[] GetCustomAttributes(Type attributeType, bool inherit)
+ {
+ if (attributeType == null)
+ throw new ArgumentNullException(nameof(attributeType));
+
+ return Array.Empty<object>();
+ }
+
+ public virtual Type[] GetOptionalCustomModifiers() => Array.Empty<Type>();
+ public virtual Type[] GetRequiredCustomModifiers() => Array.Empty<Type>();
+
+ public virtual int MetadataToken => MetadataToken_ParamDef;
+
+ public object GetRealObject(StreamingContext context)
+ {
+ // Once all the serializable fields have come in we can set up the real
+ // instance based on just two of them (MemberImpl and PositionImpl).
+
+ if (MemberImpl == null)
+ throw new SerializationException(SR.Serialization_InsufficientState);
+
+ ParameterInfo[] args = null;
+
+ switch (MemberImpl.MemberType)
+ {
+ case MemberTypes.Constructor:
+ case MemberTypes.Method:
+ if (PositionImpl == -1)
+ {
+ if (MemberImpl.MemberType == MemberTypes.Method)
+ return ((MethodInfo)MemberImpl).ReturnParameter;
+ else
+ throw new SerializationException(SR.Serialization_BadParameterInfo);
+ }
+ else
+ {
+ args = ((MethodBase)MemberImpl).GetParametersNoCopy();
+
+ if (args != null && PositionImpl < args.Length)
+ return args[PositionImpl];
+ else
+ throw new SerializationException(SR.Serialization_BadParameterInfo);
+ }
+
+ case MemberTypes.Property:
+ args = ((PropertyInfo)MemberImpl).GetIndexParameters();
+
+ if (args != null && PositionImpl > -1 && PositionImpl < args.Length)
+ return args[PositionImpl];
+ else
+ throw new SerializationException(SR.Serialization_BadParameterInfo);
+
+ default:
+ throw new SerializationException(SR.Serialization_NoParameterInfo);
+ }
+ }
+
+ public override string ToString() => ParameterType.FormatTypeName() + " " + Name;
+
+ protected ParameterAttributes AttrsImpl;
+ protected Type ClassImpl;
+ protected object DefaultValueImpl;
+ protected MemberInfo MemberImpl;
+ protected string NameImpl;
+ protected int PositionImpl;
+
+ private const int MetadataToken_ParamDef = 0x08000000;
+ }
+}
diff --git a/src/mscorlib/src/System/Reflection/ParameterModifier.cs b/src/mscorlib/shared/System/Reflection/ParameterModifier.cs
index 652831c94e..18d6cf669d 100644
--- a/src/mscorlib/src/System/Reflection/ParameterModifier.cs
+++ b/src/mscorlib/shared/System/Reflection/ParameterModifier.cs
@@ -2,34 +2,21 @@
// 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.Diagnostics.Contracts;
-using System;
-
namespace System.Reflection
{
[Serializable]
public struct ParameterModifier
{
- #region Private Data Members
- private bool[] _byRef;
- #endregion
+ private readonly bool[] _byRef;
- #region Constructor
public ParameterModifier(int parameterCount)
{
if (parameterCount <= 0)
- throw new ArgumentException(Environment.GetResourceString("Arg_ParmArraySize"));
- Contract.EndContractBlock();
+ throw new ArgumentException(SR.Arg_ParmArraySize);
_byRef = new bool[parameterCount];
}
- #endregion
-
- #region Internal Members
- internal bool[] IsByRefArray { get { return _byRef; } }
- #endregion
- #region Public Members
public bool this[int index]
{
get
@@ -41,6 +28,9 @@ namespace System.Reflection
_byRef[index] = value;
}
}
- #endregion
+
+#if CORECLR
+ internal bool[] IsByRefArray => _byRef;
+#endif
}
}
diff --git a/src/mscorlib/shared/System/Reflection/Pointer.cs b/src/mscorlib/shared/System/Reflection/Pointer.cs
new file mode 100644
index 0000000000..13a5efff46
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/Pointer.cs
@@ -0,0 +1,61 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Diagnostics;
+using System.Runtime.Serialization;
+
+namespace System.Reflection
+{
+ [Serializable]
+ [CLSCompliant(false)]
+ public sealed unsafe class Pointer : ISerializable
+ {
+ // CoreCLR: Do not add or remove fields without updating the ReflectionPointer class in runtimehandles.h
+ private readonly void* _ptr;
+ private readonly Type _ptrType;
+
+ private Pointer(void* ptr, Type ptrType)
+ {
+ Debug.Assert(ptrType.IsRuntimeImplemented()); // CoreCLR: For CoreRT's sake, _ptrType has to be declared as "Type", but in fact, it is always a RuntimeType. Code on CoreCLR expects this.
+ _ptr = ptr;
+ _ptrType = ptrType;
+ }
+
+ private Pointer(SerializationInfo info, StreamingContext context)
+ {
+ _ptr = ((IntPtr)(info.GetValue("_ptr", typeof(IntPtr)))).ToPointer();
+ _ptrType = (Type)info.GetValue("_ptrType", typeof(Type));
+ if (!_ptrType.IsRuntimeImplemented())
+ throw new SerializationException(SR.Arg_MustBeType);
+ }
+
+ public static object Box(void* ptr, Type type)
+ {
+ if (type == null)
+ throw new ArgumentNullException(nameof(type));
+ if (!type.IsPointer)
+ throw new ArgumentException(SR.Arg_MustBePointer, nameof(ptr));
+ if (!type.IsRuntimeImplemented())
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(ptr));
+
+ return new Pointer(ptr, type);
+ }
+
+ public static void* Unbox(object ptr)
+ {
+ if (!(ptr is Pointer))
+ throw new ArgumentException(SR.Arg_MustBePointer, nameof(ptr));
+ return ((Pointer)ptr)._ptr;
+ }
+
+ void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ info.AddValue("_ptr", new IntPtr(_ptr));
+ info.AddValue("_ptrType", _ptrType);
+ }
+
+ internal Type GetPointerType() => _ptrType;
+ internal object GetPointerValue() => (IntPtr)_ptr;
+ }
+}
diff --git a/src/mscorlib/shared/System/Reflection/PortableExecutableKinds.cs b/src/mscorlib/shared/System/Reflection/PortableExecutableKinds.cs
new file mode 100644
index 0000000000..79be338685
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/PortableExecutableKinds.cs
@@ -0,0 +1,18 @@
+// 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 System.Reflection
+{
+ [Flags]
+ public enum PortableExecutableKinds
+ {
+ NotAPortableExecutableImage = 0x0,
+ ILOnly = 0x1,
+ Required32Bit = 0x2,
+ PE32Plus = 0x4,
+ Unmanaged32Bit = 0x8,
+ Preferred32Bit = 0x10,
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/ProcessorArchitecture.cs b/src/mscorlib/shared/System/Reflection/ProcessorArchitecture.cs
new file mode 100644
index 0000000000..becb346c4f
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/ProcessorArchitecture.cs
@@ -0,0 +1,16 @@
+// 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 System.Reflection
+{
+ public enum ProcessorArchitecture
+ {
+ None = 0x0000,
+ MSIL = 0x0001,
+ X86 = 0x0002,
+ IA64 = 0x0003,
+ Amd64 = 0x0004,
+ Arm = 0x0005
+ }
+}
diff --git a/src/mscorlib/src/System/Reflection/PropertyAttributes.cs b/src/mscorlib/shared/System/Reflection/PropertyAttributes.cs
index 188bc0e87e..31e7a653bb 100644
--- a/src/mscorlib/src/System/Reflection/PropertyAttributes.cs
+++ b/src/mscorlib/shared/System/Reflection/PropertyAttributes.cs
@@ -2,33 +2,24 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
// PropertyAttributes is an enum which defines the attributes that may be associated
-//
-// with a property. The values here are defined in Corhdr.h.
-//
-//
-
-using System;
+// with a property. The values here are defined in Corhdr.h.
namespace System.Reflection
{
// This Enum matchs the CorPropertyAttr defined in CorHdr.h
- [Serializable]
[Flags]
public enum PropertyAttributes
{
None = 0x0000,
SpecialName = 0x0200, // property is special. Name describes how.
- // Reserved flags for Runtime use only.
- ReservedMask = 0xf400,
RTSpecialName = 0x0400, // Runtime(metadata internal APIs) should check name encoding.
HasDefault = 0x1000, // Property has default
- Reserved2 = 0x2000, // reserved bit
- Reserved3 = 0x4000, // reserved bit
- Reserved4 = 0x8000 // reserved bit
+
+ Reserved2 = 0x2000,
+ Reserved3 = 0x4000,
+ Reserved4 = 0x8000,
+ ReservedMask = 0xf400,
}
}
diff --git a/src/mscorlib/shared/System/Reflection/PropertyInfo.cs b/src/mscorlib/shared/System/Reflection/PropertyInfo.cs
new file mode 100644
index 0000000000..ff8a02e96d
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/PropertyInfo.cs
@@ -0,0 +1,74 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Diagnostics;
+using System.Globalization;
+
+namespace System.Reflection
+{
+ public abstract class PropertyInfo : MemberInfo
+ {
+ protected PropertyInfo() { }
+
+ public override MemberTypes MemberType => MemberTypes.Property;
+
+ public abstract Type PropertyType { get; }
+ public abstract ParameterInfo[] GetIndexParameters();
+
+ public abstract PropertyAttributes Attributes { get; }
+ public bool IsSpecialName => (Attributes & PropertyAttributes.SpecialName) != 0;
+
+ public abstract bool CanRead { get; }
+ public abstract bool CanWrite { get; }
+
+ public MethodInfo[] GetAccessors() => GetAccessors(nonPublic: false);
+ public abstract MethodInfo[] GetAccessors(bool nonPublic);
+
+ public virtual MethodInfo GetMethod => GetGetMethod(nonPublic: true);
+ public MethodInfo GetGetMethod() => GetGetMethod(nonPublic: false);
+ public abstract MethodInfo GetGetMethod(bool nonPublic);
+
+ public virtual MethodInfo SetMethod => GetSetMethod(nonPublic: true);
+ public MethodInfo GetSetMethod() => GetSetMethod(nonPublic: false);
+ public abstract MethodInfo GetSetMethod(bool nonPublic);
+
+ public virtual Type[] GetOptionalCustomModifiers() => Array.Empty<Type>();
+ public virtual Type[] GetRequiredCustomModifiers() => Array.Empty<Type>();
+
+ [DebuggerHidden]
+ [DebuggerStepThrough]
+ public object GetValue(object obj) => GetValue(obj, index: null);
+ [DebuggerHidden]
+ [DebuggerStepThrough]
+ public virtual object GetValue(object obj, object[] index) => GetValue(obj, BindingFlags.Default, binder: null, index: index, culture: null);
+ public abstract object GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture);
+
+ public virtual object GetConstantValue() { throw NotImplemented.ByDesign; }
+ public virtual object GetRawConstantValue() { throw NotImplemented.ByDesign; }
+
+ [DebuggerHidden]
+ [DebuggerStepThrough]
+ public void SetValue(object obj, object value) => SetValue(obj, value, index: null);
+ [DebuggerHidden]
+ [DebuggerStepThrough]
+ public virtual void SetValue(object obj, object value, object[] index) => SetValue(obj, value, BindingFlags.Default, binder: null, index: index, culture: null);
+ public abstract void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture);
+
+ public override bool Equals(object obj) => base.Equals(obj);
+ public override int GetHashCode() => base.GetHashCode();
+
+ public static bool operator ==(PropertyInfo left, PropertyInfo right)
+ {
+ if (object.ReferenceEquals(left, right))
+ return true;
+
+ if ((object)left == null || (object)right == null)
+ return false;
+
+ return left.Equals(right);
+ }
+
+ public static bool operator !=(PropertyInfo left, PropertyInfo right) => !(left == right);
+ }
+}
diff --git a/src/mscorlib/src/System/Reflection/ReflectionContext.cs b/src/mscorlib/shared/System/Reflection/ReflectionContext.cs
index e11480d6cf..e9e93dab81 100644
--- a/src/mscorlib/src/System/Reflection/ReflectionContext.cs
+++ b/src/mscorlib/shared/System/Reflection/ReflectionContext.cs
@@ -2,19 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*=============================================================================
-**
-**
-**
-**
-**
-** Purpose: For Assembly-related stuff.
-**
-**
-=============================================================================*/
-
-using System;
-
namespace System.Reflection
{
public abstract class ReflectionContext
@@ -34,3 +21,4 @@ namespace System.Reflection
}
}
}
+
diff --git a/src/mscorlib/shared/System/Reflection/ReflectionTypeLoadException.cs b/src/mscorlib/shared/System/Reflection/ReflectionTypeLoadException.cs
new file mode 100644
index 0000000000..772620cf84
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/ReflectionTypeLoadException.cs
@@ -0,0 +1,46 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.Serialization;
+
+namespace System.Reflection
+{
+ [Serializable]
+ public sealed class ReflectionTypeLoadException : SystemException, ISerializable
+ {
+ public ReflectionTypeLoadException(Type[] classes, Exception[] exceptions)
+ : base(null)
+ {
+ Types = classes;
+ LoaderExceptions = exceptions;
+ HResult = __HResults.COR_E_REFLECTIONTYPELOAD;
+ }
+
+ public ReflectionTypeLoadException(Type[] classes, Exception[] exceptions, string message)
+ : base(message)
+ {
+ Types = classes;
+ LoaderExceptions = exceptions;
+ HResult = __HResults.COR_E_REFLECTIONTYPELOAD;
+ }
+
+ internal ReflectionTypeLoadException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ Types = (Type[])(info.GetValue("Types", typeof(Type[])));
+ LoaderExceptions = (Exception[])(info.GetValue("Exceptions", typeof(Exception[])));
+ }
+
+ public override void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData(info, context);
+ info.AddValue("Types", Types, typeof(Type[]));
+ info.AddValue("Exceptions", LoaderExceptions, typeof(Exception[]));
+ }
+
+ public Type[] Types { get; }
+
+ public Exception[] LoaderExceptions { get; }
+ }
+}
diff --git a/src/mscorlib/shared/System/Reflection/ResourceAttributes.cs b/src/mscorlib/shared/System/Reflection/ResourceAttributes.cs
new file mode 100644
index 0000000000..2d03f42ba0
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/ResourceAttributes.cs
@@ -0,0 +1,14 @@
+// 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 System.Reflection
+{
+ [Flags]
+ public enum ResourceAttributes
+ {
+ Public = 0x0001,
+ Private = 0x0002,
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Reflection/ResourceLocation.cs b/src/mscorlib/shared/System/Reflection/ResourceLocation.cs
new file mode 100644
index 0000000000..4902333ac0
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/ResourceLocation.cs
@@ -0,0 +1,15 @@
+// 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 System.Reflection
+{
+ [Flags]
+ public enum ResourceLocation
+ {
+ ContainedInAnotherAssembly = 2,
+ ContainedInManifestFile = 4,
+ Embedded = 1,
+ }
+}
+
diff --git a/src/mscorlib/src/System/Reflection/StrongNameKeyPair.cs b/src/mscorlib/shared/System/Reflection/StrongNameKeyPair.cs
index 280e1c04f4..c04ddd6d1a 100644
--- a/src/mscorlib/src/System/Reflection/StrongNameKeyPair.cs
+++ b/src/mscorlib/shared/System/Reflection/StrongNameKeyPair.cs
@@ -2,28 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*============================================================
-**
-**
-**
-**
-**
-** Purpose: Encapsulate access to a public/private key pair
-** used to sign strong name assemblies.
-**
-**
-===========================================================*/
-
-using System;
using System.IO;
-using System.Runtime.CompilerServices;
-using System.Runtime.ConstrainedExecution;
-using System.Runtime.InteropServices;
using System.Runtime.Serialization;
-using System.Security;
-using System.Runtime.Versioning;
-using Microsoft.Win32;
-using System.Diagnostics.Contracts;
namespace System.Reflection
{
@@ -32,7 +12,7 @@ namespace System.Reflection
{
private bool _keyPairExported;
private byte[] _keyPairArray;
- private String _keyPairContainer;
+ private string _keyPairContainer;
private byte[] _publicKey;
// Build key pair from file.
@@ -40,7 +20,6 @@ namespace System.Reflection
{
if (keyPairFile == null)
throw new ArgumentNullException(nameof(keyPairFile));
- Contract.EndContractBlock();
int length = (int)keyPairFile.Length;
_keyPairArray = new byte[length];
@@ -54,7 +33,6 @@ namespace System.Reflection
{
if (keyPairArray == null)
throw new ArgumentNullException(nameof(keyPairArray));
- Contract.EndContractBlock();
_keyPairArray = new byte[keyPairArray.Length];
Array.Copy(keyPairArray, _keyPairArray, keyPairArray.Length);
@@ -70,20 +48,19 @@ namespace System.Reflection
_publicKey = (byte[])info.GetValue("_publicKey", typeof(byte[]));
}
- public StrongNameKeyPair(String keyPairContainer)
+ public StrongNameKeyPair(string keyPairContainer)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_StrongNameSigning);
}
public byte[] PublicKey
{
get
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_StrongNameSigning);
}
}
- /// <internalonly/>
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("_keyPairExported", _keyPairExported);
@@ -92,7 +69,6 @@ namespace System.Reflection
info.AddValue("_publicKey", _publicKey);
}
- /// <internalonly/>
- void IDeserializationCallback.OnDeserialization(Object sender) { }
+ void IDeserializationCallback.OnDeserialization(object sender) { }
}
}
diff --git a/src/mscorlib/shared/System/Reflection/TargetException.cs b/src/mscorlib/shared/System/Reflection/TargetException.cs
new file mode 100644
index 0000000000..03f8730cdd
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/TargetException.cs
@@ -0,0 +1,33 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.Serialization;
+
+namespace System.Reflection
+{
+ [Serializable]
+ public class TargetException : ApplicationException
+ {
+ public TargetException()
+ : this(null)
+ {
+ }
+
+ public TargetException(string message)
+ : this(message, null)
+ {
+ }
+
+ public TargetException(string message, Exception inner)
+ : base(message, inner)
+ {
+ HResult = __HResults.COR_E_TARGET;
+ }
+
+ protected TargetException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+ }
+}
diff --git a/src/mscorlib/shared/System/Reflection/TargetInvocationException.cs b/src/mscorlib/shared/System/Reflection/TargetInvocationException.cs
new file mode 100644
index 0000000000..e934e5bde7
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/TargetInvocationException.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.Serialization;
+
+namespace System.Reflection
+{
+ [Serializable]
+ public sealed class TargetInvocationException : ApplicationException
+ {
+ public TargetInvocationException(Exception inner)
+ : base(SR.Arg_TargetInvocationException, inner)
+ {
+ HResult = __HResults.COR_E_TARGETINVOCATION;
+ }
+
+ public TargetInvocationException(string message, Exception inner)
+ : base(message, inner)
+ {
+ HResult = __HResults.COR_E_TARGETINVOCATION;
+ }
+
+ internal TargetInvocationException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+ }
+}
diff --git a/src/mscorlib/shared/System/Reflection/TargetParameterCountException.cs b/src/mscorlib/shared/System/Reflection/TargetParameterCountException.cs
new file mode 100644
index 0000000000..c3604548e6
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/TargetParameterCountException.cs
@@ -0,0 +1,35 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.Serialization;
+
+namespace System.Reflection
+{
+ [Serializable]
+ public sealed class TargetParameterCountException : ApplicationException
+ {
+ public TargetParameterCountException()
+ : base(SR.Arg_TargetParameterCountException)
+ {
+ HResult = __HResults.COR_E_TARGETPARAMCOUNT;
+ }
+
+ public TargetParameterCountException(string message)
+ : base(message)
+ {
+ HResult = __HResults.COR_E_TARGETPARAMCOUNT;
+ }
+
+ public TargetParameterCountException(string message, Exception inner)
+ : base(message, inner)
+ {
+ HResult = __HResults.COR_E_TARGETPARAMCOUNT;
+ }
+
+ internal TargetParameterCountException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+ }
+}
diff --git a/src/mscorlib/src/System/Reflection/TypeAttributes.cs b/src/mscorlib/shared/System/Reflection/TypeAttributes.cs
index ad7d29dd1f..aa30331856 100644
--- a/src/mscorlib/src/System/Reflection/TypeAttributes.cs
+++ b/src/mscorlib/shared/System/Reflection/TypeAttributes.cs
@@ -3,12 +3,10 @@
// See the LICENSE file in the project root for more information.
using System.Runtime.InteropServices;
-using System;
namespace System.Reflection
{
// This Enum matchs the CorTypeAttr defined in CorHdr.h
- [Serializable]
[Flags]
public enum TypeAttributes
{
@@ -43,7 +41,6 @@ namespace System.Reflection
// Implementation attributes.
Import = 0x00001000, // Class / interface is imported
Serializable = 0x00002000, // The class is Serializable.
-
WindowsRuntime = 0x00004000, // Type is a Windows Runtime type.
// Use tdStringFormatMask to retrieve string information for native interop
@@ -58,9 +55,9 @@ namespace System.Reflection
BeforeFieldInit = 0x00100000, // Initialize the class any time before first static field access.
- // Flags reserved for runtime use.
- ReservedMask = 0x00040800,
RTSpecialName = 0x00000800, // Runtime should check name encoding.
HasSecurity = 0x00040000, // Class has security associate with it.
+
+ ReservedMask = 0x00040800,
}
}
diff --git a/src/vm/gcscan.h b/src/mscorlib/shared/System/Reflection/TypeFilter.cs
index aba1e6b74e..eb049f81f9 100644
--- a/src/vm/gcscan.h
+++ b/src/mscorlib/shared/System/Reflection/TypeFilter.cs
@@ -2,4 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-#include "../gc/gcscan.h"
+namespace System.Reflection
+{
+ public delegate bool TypeFilter(Type m, object filterCriteria);
+}
diff --git a/src/mscorlib/shared/System/Reflection/TypeInfo.cs b/src/mscorlib/shared/System/Reflection/TypeInfo.cs
new file mode 100644
index 0000000000..f4add736f4
--- /dev/null
+++ b/src/mscorlib/shared/System/Reflection/TypeInfo.cs
@@ -0,0 +1,84 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Collections.Generic;
+
+namespace System.Reflection
+{
+ public abstract partial class TypeInfo : Type, IReflectableType
+ {
+ protected TypeInfo() { }
+
+ TypeInfo IReflectableType.GetTypeInfo() => this;
+ public virtual Type AsType() => this;
+
+ public virtual Type[] GenericTypeParameters => IsGenericTypeDefinition ? GetGenericArguments() : Type.EmptyTypes;
+
+ public virtual EventInfo GetDeclaredEvent(string name) => GetEvent(name, TypeInfo.DeclaredOnlyLookup);
+ public virtual FieldInfo GetDeclaredField(string name) => GetField(name, TypeInfo.DeclaredOnlyLookup);
+ public virtual MethodInfo GetDeclaredMethod(string name) => GetMethod(name, TypeInfo.DeclaredOnlyLookup);
+ public virtual TypeInfo GetDeclaredNestedType(string name) => GetNestedType(name, TypeInfo.DeclaredOnlyLookup)?.GetTypeInfo();
+ public virtual PropertyInfo GetDeclaredProperty(string name) => GetProperty(name, TypeInfo.DeclaredOnlyLookup);
+
+ public virtual IEnumerable<MethodInfo> GetDeclaredMethods(string name)
+ {
+ foreach (MethodInfo method in GetMethods(TypeInfo.DeclaredOnlyLookup))
+ {
+ if (method.Name == name)
+ yield return method;
+ }
+ }
+
+ public virtual IEnumerable<ConstructorInfo> DeclaredConstructors => GetConstructors(TypeInfo.DeclaredOnlyLookup);
+ public virtual IEnumerable<EventInfo> DeclaredEvents => GetEvents(TypeInfo.DeclaredOnlyLookup);
+ public virtual IEnumerable<FieldInfo> DeclaredFields => GetFields(TypeInfo.DeclaredOnlyLookup);
+ public virtual IEnumerable<MemberInfo> DeclaredMembers => GetMembers(TypeInfo.DeclaredOnlyLookup);
+ public virtual IEnumerable<MethodInfo> DeclaredMethods => GetMethods(TypeInfo.DeclaredOnlyLookup);
+ public virtual IEnumerable<System.Reflection.TypeInfo> DeclaredNestedTypes
+ {
+ get
+ {
+ foreach (Type t in GetNestedTypes(TypeInfo.DeclaredOnlyLookup))
+ {
+ yield return t.GetTypeInfo();
+ }
+ }
+ }
+ public virtual IEnumerable<PropertyInfo> DeclaredProperties => GetProperties(TypeInfo.DeclaredOnlyLookup);
+
+ public virtual IEnumerable<Type> ImplementedInterfaces => GetInterfaces();
+
+ //a re-implementation of ISAF from Type, skipping the use of UnderlyingType
+ public virtual bool IsAssignableFrom(TypeInfo typeInfo)
+ {
+ if (typeInfo == null)
+ return false;
+
+ if (this == typeInfo)
+ return true;
+
+ // If c is a subclass of this class, then c can be cast to this type.
+ if (typeInfo.IsSubclassOf(this))
+ return true;
+
+ if (this.IsInterface)
+ {
+ return typeInfo.ImplementInterface(this);
+ }
+ else if (IsGenericParameter)
+ {
+ Type[] constraints = GetGenericParameterConstraints();
+ for (int i = 0; i < constraints.Length; i++)
+ if (!constraints[i].IsAssignableFrom(typeInfo))
+ return false;
+
+ return true;
+ }
+
+ return false;
+ }
+
+ private const BindingFlags DeclaredOnlyLookup = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
+ }
+}
diff --git a/src/mscorlib/shared/System/ResolveEventArgs.cs b/src/mscorlib/shared/System/ResolveEventArgs.cs
new file mode 100644
index 0000000000..6196947bb5
--- /dev/null
+++ b/src/mscorlib/shared/System/ResolveEventArgs.cs
@@ -0,0 +1,25 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Reflection;
+
+namespace System
+{
+ public class ResolveEventArgs : EventArgs
+ {
+ public ResolveEventArgs(string name)
+ {
+ Name = name;
+ }
+
+ public ResolveEventArgs(string name, Assembly requestingAssembly)
+ {
+ Name = name;
+ RequestingAssembly = requestingAssembly;
+ }
+
+ public string Name { get; }
+ public Assembly RequestingAssembly { get; }
+ }
+}
diff --git a/src/mscorlib/shared/System/ResolveEventHandler.cs b/src/mscorlib/shared/System/ResolveEventHandler.cs
new file mode 100644
index 0000000000..cb9af5de66
--- /dev/null
+++ b/src/mscorlib/shared/System/ResolveEventHandler.cs
@@ -0,0 +1,10 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Reflection;
+
+namespace System
+{
+ public delegate Assembly ResolveEventHandler(object sender, ResolveEventArgs args);
+}
diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/CompilationRelaxations.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/CompilationRelaxations.cs
new file mode 100644
index 0000000000..4da95024c5
--- /dev/null
+++ b/src/mscorlib/shared/System/Runtime/CompilerServices/CompilationRelaxations.cs
@@ -0,0 +1,16 @@
+// 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 System.Runtime.CompilerServices
+{
+ /// IMPORTANT: Keep this in sync with corhdr.h
+ [Flags]
+ [Serializable]
+ public enum CompilationRelaxations : int
+ {
+ NoStringInterning = 0x0008 // Start in 0x0008, we had other non public flags in this enum before,
+ // so we'll start here just in case somebody used them. This flag is only
+ // valid when set for Assemblies.
+ }
+} \ No newline at end of file
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/CompilerGlobalScopeAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/CompilerGlobalScopeAttribute.cs
index 7a390d1f53..22fa694200 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/CompilerGlobalScopeAttribute.cs
+++ b/src/mscorlib/shared/System/Runtime/CompilerServices/CompilerGlobalScopeAttribute.cs
@@ -2,20 +2,10 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*============================================================
-**
-**
-**
-** Purpose: Attribute used to communicate to the VS7 debugger
-** that a class should be treated as if it has
-** global scope.
-**
-**
-===========================================================*/
-
-
namespace System.Runtime.CompilerServices
{
+ // Attribute used to communicate to the VS7 debugger that a class should be treated as if it has global scope.
+
[Serializable]
[AttributeUsage(AttributeTargets.Class)]
public class CompilerGlobalScopeAttribute : Attribute
diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/DefaultDependencyAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/DefaultDependencyAttribute.cs
new file mode 100644
index 0000000000..f5419d413b
--- /dev/null
+++ b/src/mscorlib/shared/System/Runtime/CompilerServices/DefaultDependencyAttribute.cs
@@ -0,0 +1,18 @@
+// 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 System.Runtime.CompilerServices
+{
+ [Serializable]
+ [AttributeUsage(AttributeTargets.Assembly)]
+ public sealed class DefaultDependencyAttribute : Attribute
+ {
+ public DefaultDependencyAttribute(LoadHint loadHintArgument)
+ {
+ LoadHint = loadHintArgument;
+ }
+
+ public LoadHint LoadHint { get; }
+ }
+} \ No newline at end of file
diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/DependencyAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/DependencyAttribute.cs
new file mode 100644
index 0000000000..56f4242bb1
--- /dev/null
+++ b/src/mscorlib/shared/System/Runtime/CompilerServices/DependencyAttribute.cs
@@ -0,0 +1,20 @@
+// 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 System.Runtime.CompilerServices
+{
+ [Serializable]
+ [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
+ public sealed class DependencyAttribute : Attribute
+ {
+ public DependencyAttribute(String dependentAssemblyArgument, LoadHint loadHintArgument)
+ {
+ DependentAssembly = dependentAssemblyArgument;
+ LoadHint = loadHintArgument;
+ }
+
+ public String DependentAssembly { get; }
+ public LoadHint LoadHint { get; }
+ }
+} \ No newline at end of file
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/DiscardableAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/DiscardableAttribute.cs
index b6d05a21d3..c88b3a7599 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/DiscardableAttribute.cs
+++ b/src/mscorlib/shared/System/Runtime/CompilerServices/DiscardableAttribute.cs
@@ -2,18 +2,12 @@
// 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;
-
namespace System.Runtime.CompilerServices
{
- // Custom attribute to indicating a TypeDef is a discardable attribute
+ // Custom attribute to indicating a TypeDef is a discardable attribute.
+
public class DiscardableAttribute : Attribute
{
- public DiscardableAttribute()
- {
- }
+ public DiscardableAttribute() { }
}
}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/FixedAddressValueTypeAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/FixedAddressValueTypeAttribute.cs
index 1d8b75b5c4..baf5824241 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/FixedAddressValueTypeAttribute.cs
+++ b/src/mscorlib/shared/System/Runtime/CompilerServices/FixedAddressValueTypeAttribute.cs
@@ -2,13 +2,12 @@
// 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;
-
namespace System.Runtime.CompilerServices
{
[Serializable]
[AttributeUsage(AttributeTargets.Field)]
- sealed public class FixedAddressValueTypeAttribute : Attribute
+ public sealed class FixedAddressValueTypeAttribute : Attribute
{
+ public FixedAddressValueTypeAttribute() { }
}
-}
+} \ No newline at end of file
diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/LoadHint.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/LoadHint.cs
new file mode 100644
index 0000000000..ae6d9b9372
--- /dev/null
+++ b/src/mscorlib/shared/System/Runtime/CompilerServices/LoadHint.cs
@@ -0,0 +1,14 @@
+// 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 System.Runtime.CompilerServices
+{
+ [Serializable]
+ public enum LoadHint
+ {
+ Default = 0x0000, // No preference specified
+ Always = 0x0001, // Dependency is always loaded
+ Sometimes = 0x0002, // Dependency is sometimes loaded
+ }
+} \ No newline at end of file
diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/MethodCodeType.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/MethodCodeType.cs
new file mode 100644
index 0000000000..e82993a5de
--- /dev/null
+++ b/src/mscorlib/shared/System/Runtime/CompilerServices/MethodCodeType.cs
@@ -0,0 +1,17 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Reflection;
+
+namespace System.Runtime.CompilerServices
+{
+ [Serializable]
+ public enum MethodCodeType
+ {
+ IL = MethodImplAttributes.IL,
+ Native = MethodImplAttributes.Native,
+ OPTIL = MethodImplAttributes.OPTIL,
+ Runtime = MethodImplAttributes.Runtime
+ }
+}
diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/MethodImplOptions.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/MethodImplOptions.cs
new file mode 100644
index 0000000000..2b5affc699
--- /dev/null
+++ b/src/mscorlib/shared/System/Runtime/CompilerServices/MethodImplOptions.cs
@@ -0,0 +1,21 @@
+// 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 System.Runtime.CompilerServices
+{
+ // This Enum matchs the miImpl flags defined in corhdr.h. It is used to specify
+ // certain method properties.
+ [Flags]
+ public enum MethodImplOptions
+ {
+ Unmanaged = 0x0004,
+ NoInlining = 0x0008,
+ ForwardRef = 0x0010,
+ Synchronized = 0x0020,
+ NoOptimization = 0x0040,
+ PreserveSig = 0x0080,
+ AggressiveInlining = 0x0100,
+ InternalCall = 0x1000
+ }
+} \ No newline at end of file
diff --git a/src/mscorlib/src/System/StringFreezingAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/StringFreezingAttribute.cs
index 87fa165f52..7772a1a263 100644
--- a/src/mscorlib/src/System/StringFreezingAttribute.cs
+++ b/src/mscorlib/shared/System/Runtime/CompilerServices/StringFreezingAttribute.cs
@@ -2,23 +2,14 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*============================================================
-**
-**
-**
-** Purpose: Custom attribute to indicate that strings should be frozen
-**
-**
-===========================================================*/
-
namespace System.Runtime.CompilerServices
{
+ // Custom attribute to indicate that strings should be frozen.
+
[Serializable]
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class StringFreezingAttribute : Attribute
{
- public StringFreezingAttribute()
- {
- }
+ public StringFreezingAttribute() { }
}
}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/SuppressIldasmAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/SuppressIldasmAttribute.cs
index f5777e6819..b4224b1c89 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/SuppressIldasmAttribute.cs
+++ b/src/mscorlib/shared/System/Runtime/CompilerServices/SuppressIldasmAttribute.cs
@@ -2,19 +2,12 @@
// 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;
-
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module)]
public sealed class SuppressIldasmAttribute : Attribute
{
- public SuppressIldasmAttribute()
- {
- }
+ public SuppressIldasmAttribute() { }
}
}
diff --git a/src/mscorlib/shared/System/Runtime/CompilerServices/TupleElementNamesAttribute.cs b/src/mscorlib/shared/System/Runtime/CompilerServices/TupleElementNamesAttribute.cs
index 65b120e6b4..ad923dfae5 100644
--- a/src/mscorlib/shared/System/Runtime/CompilerServices/TupleElementNamesAttribute.cs
+++ b/src/mscorlib/shared/System/Runtime/CompilerServices/TupleElementNamesAttribute.cs
@@ -54,4 +54,4 @@ namespace System.Runtime.CompilerServices
/// </summary>
public IList<string> TransformNames => _transformNames;
}
-} \ No newline at end of file
+}
diff --git a/src/mscorlib/shared/System/Runtime/Serialization/ISafeSerializationData.cs b/src/mscorlib/shared/System/Runtime/Serialization/ISafeSerializationData.cs
index 12c2e34d09..5089d134c3 100644
--- a/src/mscorlib/shared/System/Runtime/Serialization/ISafeSerializationData.cs
+++ b/src/mscorlib/shared/System/Runtime/Serialization/ISafeSerializationData.cs
@@ -69,7 +69,7 @@ namespace System.Runtime.Serialization
// ...
// realSerializedDataN
// safeSerializationData -> this is the serialization data member of the parent type
- // m_serializedState -> list of saved serialized states from subclasses responding to the safe
+ // _serializedState -> list of saved serialized states from subclasses responding to the safe
// serialization event
// RealTypeSerializationName -> type which is using safe serialization
// Type:
@@ -135,21 +135,21 @@ namespace System.Runtime.Serialization
//
// 1. Include a data member of type SafeSerializationManager:
//
- // private SafeSerializationManager m_safeSerializationManager;
+ // private SafeSerializationManager _safeSerializationManager;
//
// 2. Add a protected SerializeObjectState event, which passes through to the SafeSerializationManager:
//
// protected event EventHandler<SafeSerializationEventArgs> SerializeObjectState
// {
- // add { m_safeSerializationManager.SerializeObjectState += value; }
- // remove { m_safeSerializationManager.SerializeObjectState -= value; }
+ // add { _safeSerializationManager.SerializeObjectState += value; }
+ // remove { _safeSerializationManager.SerializeObjectState -= value; }
// }
//
// 3. Serialize the safe serialization object in GetObjectData, and call its CompleteSerialization method:
//
// {
- // info.AddValue("m_safeSerializationManager", m_safeSerializationManager, typeof(SafeSerializationManager));
- // m_safeSerializationManager.CompleteSerialization(this, info, context);
+ // info.AddValue("_safeSerializationManager", _safeSerializationManager, typeof(SafeSerializationManager));
+ // _safeSerializationManager.CompleteSerialization(this, info, context);
// }
//
// 4. Add an OnDeserialized handler if one doesn't already exist, and call CompleteDeserialization in it:
@@ -157,7 +157,7 @@ namespace System.Runtime.Serialization
// [OnDeserialized]
// private void OnDeserialized(StreamingContext context)
// {
- // m_safeSerializationManager.CompleteDeserialization(this);
+ // _safeSerializationManager.CompleteDeserialization(this);
// }
//
// On the client side, using safe serialization is also pretty easy. For example:
@@ -168,30 +168,30 @@ namespace System.Runtime.Serialization
// [Serializable]
// private struct TransparentExceptionState : ISafeSerializationData
// {
- // public string m_extraData;
+ // public string _extraData;
//
// void ISafeSerializationData.CompleteDeserialization(object obj)
// {
// TransparentException exception = obj as TransparentException;
- // exception.m_state = this;
+ // exception._state = this;
// }
// }
//
// [NonSerialized]
- // private TransparentExceptionState m_state = new TransparentExceptionState();
+ // private TransparentExceptionState _state = new TransparentExceptionState();
//
// public TransparentException()
// {
// SerializeObjectState += delegate(object exception, SafeSerializationEventArgs eventArgs)
// {
- // eventArgs.AddSerializedState(m_state);
+ // eventArgs.AddSerializedState(_state);
// };
// }
//
// public string ExtraData
// {
- // get { return m_state.m_extraData; }
- // set { m_state.m_extraData = value; }
+ // get { return _state._extraData; }
+ // set { _state._extraData = value; }
// }
// }
//
diff --git a/src/mscorlib/src/System/Security/SecureString.Unix.cs b/src/mscorlib/shared/System/Security/SecureString.Unix.cs
index 0ef38e40ee..0ef38e40ee 100644
--- a/src/mscorlib/src/System/Security/SecureString.Unix.cs
+++ b/src/mscorlib/shared/System/Security/SecureString.Unix.cs
diff --git a/src/mscorlib/src/System/Security/SecureString.cs b/src/mscorlib/shared/System/Security/SecureString.cs
index 9059f90e60..9059f90e60 100644
--- a/src/mscorlib/src/System/Security/SecureString.cs
+++ b/src/mscorlib/shared/System/Security/SecureString.cs
diff --git a/src/mscorlib/shared/System/Security/SecurityException.cs b/src/mscorlib/shared/System/Security/SecurityException.cs
new file mode 100644
index 0000000000..86e3cd4631
--- /dev/null
+++ b/src/mscorlib/shared/System/Security/SecurityException.cs
@@ -0,0 +1,66 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Reflection;
+using System.Runtime.Serialization;
+
+namespace System.Security
+{
+ [Serializable]
+ public class SecurityException : SystemException
+ {
+ public SecurityException()
+ : base(SR.Arg_SecurityException)
+ {
+ HResult = __HResults.COR_E_SECURITY;
+ }
+
+ public SecurityException(string message)
+ : base(message)
+ {
+ HResult = __HResults.COR_E_SECURITY;
+ }
+
+ public SecurityException(string message, Exception inner)
+ : base(message, inner)
+ {
+ HResult = __HResults.COR_E_SECURITY;
+ }
+
+ public SecurityException(string message, Type type)
+ : base(message)
+ {
+ HResult = __HResults.COR_E_SECURITY;
+ PermissionType = type;
+ }
+
+ public SecurityException(string message, Type type, string state)
+ : base(message)
+ {
+ HResult = __HResults.COR_E_SECURITY;
+ PermissionType = type;
+ PermissionState = state;
+ }
+
+ protected SecurityException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+
+ public override string ToString() => base.ToString();
+
+ public override void GetObjectData(SerializationInfo info, StreamingContext context) => base.GetObjectData(info, context);
+
+ public object Demanded { get; set; }
+ public object DenySetInstance { get; set; }
+ public AssemblyName FailedAssemblyInfo { get; set; }
+ public string GrantedSet { get; set; }
+ public MethodInfo Method { get; set; }
+ public string PermissionState { get; set; }
+ public Type PermissionType { get; set; }
+ public object PermitOnlySetInstance { get; set; }
+ public string RefusedSet { get; set; }
+ public string Url { get; set; }
+ }
+}
diff --git a/src/mscorlib/src/System/StringComparer.cs b/src/mscorlib/shared/System/StringComparer.cs
index 19d2e9aedf..a5cad8cd80 100644
--- a/src/mscorlib/src/System/StringComparer.cs
+++ b/src/mscorlib/shared/System/StringComparer.cs
@@ -2,31 +2,27 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using System.Collections;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Diagnostics.Contracts;
namespace System
{
- using System.Collections;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Diagnostics.Contracts;
- using System.Runtime.Serialization;
- using System.Runtime.CompilerServices;
-
-
[Serializable]
public abstract class StringComparer : IComparer, IEqualityComparer, IComparer<string>, IEqualityComparer<string>
{
- private static readonly CultureAwareComparer _invariantCulture = new CultureAwareComparer(CultureInfo.InvariantCulture, false);
- private static readonly CultureAwareComparer _invariantCultureIgnoreCase = new CultureAwareComparer(CultureInfo.InvariantCulture, true);
- private static readonly OrdinalComparer _ordinal = new OrdinalComparer();
- private static readonly OrdinalIgnoreCaseComparer _ordinalIgnoreCase = new OrdinalIgnoreCaseComparer();
+ private static readonly CultureAwareComparer s_invariantCulture = new CultureAwareComparer(CultureInfo.InvariantCulture, false);
+ private static readonly CultureAwareComparer s_invariantCultureIgnoreCase = new CultureAwareComparer(CultureInfo.InvariantCulture, true);
+ private static readonly OrdinalComparer s_ordinal = new OrdinalComparer();
+ private static readonly OrdinalIgnoreCaseComparer s_ordinalIgnoreCase = new OrdinalIgnoreCaseComparer();
public static StringComparer InvariantCulture
{
get
{
Contract.Ensures(Contract.Result<StringComparer>() != null);
- return _invariantCulture;
+ return s_invariantCulture;
}
}
@@ -35,7 +31,7 @@ namespace System
get
{
Contract.Ensures(Contract.Result<StringComparer>() != null);
- return _invariantCultureIgnoreCase;
+ return s_invariantCultureIgnoreCase;
}
}
@@ -62,7 +58,7 @@ namespace System
get
{
Contract.Ensures(Contract.Result<StringComparer>() != null);
- return _ordinal;
+ return s_ordinal;
}
}
@@ -71,7 +67,7 @@ namespace System
get
{
Contract.Ensures(Contract.Result<StringComparer>() != null);
- return _ordinalIgnoreCase;
+ return s_ordinalIgnoreCase;
}
}
@@ -93,7 +89,7 @@ namespace System
case StringComparison.OrdinalIgnoreCase:
return OrdinalIgnoreCase;
default:
- throw new ArgumentException(Environment.GetResourceString("NotSupported_StringComparison"), nameof(comparisonType));
+ throw new ArgumentException(SR.NotSupported_StringComparison, nameof(comparisonType));
}
}
@@ -131,7 +127,7 @@ namespace System
return ia.CompareTo(y);
}
- throw new ArgumentException(Environment.GetResourceString("Argument_ImplementIComparable"));
+ throw new ArgumentException(SR.Argument_ImplementIComparable);
}
@@ -215,7 +211,7 @@ namespace System
// Equals method for the comparer itself.
public override bool Equals(object obj)
{
- var comparer = obj as CultureAwareComparer;
+ CultureAwareComparer comparer = obj as CultureAwareComparer;
return
comparer != null &&
_options == comparer._options &&
@@ -247,7 +243,11 @@ namespace System
{
if (obj == null)
{
+#if CORECLR
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.obj);
+#else
+ throw new ArgumentNullException(nameof(obj));
+#endif
}
return obj.GetHashCode();
}
@@ -275,7 +275,11 @@ namespace System
{
if (obj == null)
{
+#if CORECLR
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.obj);
+#else
+ throw new ArgumentNullException(nameof(obj));
+#endif
}
return TextInfo.GetHashCodeOrdinalIgnoreCase(obj);
}
diff --git a/src/mscorlib/src/System/StringComparison.cs b/src/mscorlib/shared/System/StringComparison.cs
index c654f7200f..8b4e2ae2fe 100644
--- a/src/mscorlib/src/System/StringComparison.cs
+++ b/src/mscorlib/shared/System/StringComparison.cs
@@ -2,18 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*============================================================
-**
-** Enum: StringComparison
-**
-**
-** Purpose: A mechanism to expose a simplified infrastructure for
-** Comparing strings. This enum lets you choose of the custom
-** implementations provided by the runtime for the user.
-**
-**
-===========================================================*/
-
namespace System
{
[Serializable]
diff --git a/src/mscorlib/shared/System/StringSplitOptions.cs b/src/mscorlib/shared/System/StringSplitOptions.cs
index 43b626a010..d7020559a1 100644
--- a/src/mscorlib/shared/System/StringSplitOptions.cs
+++ b/src/mscorlib/shared/System/StringSplitOptions.cs
@@ -10,4 +10,4 @@ namespace System
None = 0,
RemoveEmptyEntries = 1
}
-} \ No newline at end of file
+}
diff --git a/src/mscorlib/src/System/Text/StringBuilder.cs b/src/mscorlib/shared/System/Text/StringBuilder.cs
index 0cb0db04e1..df1a889823 100644
--- a/src/mscorlib/src/System/Text/StringBuilder.cs
+++ b/src/mscorlib/shared/System/Text/StringBuilder.cs
@@ -2,15 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*============================================================
-**
-**
-**
-** Purpose: implementation of the StringBuilder
-** class.
-**
-===========================================================*/
-
using System.Text;
using System.Runtime;
using System.Runtime.Serialization;
@@ -44,7 +35,7 @@ namespace System.Text
// Console.WriteLine(sb2);
//
[Serializable]
- public sealed class StringBuilder : ISerializable
+ public sealed partial class StringBuilder : ISerializable
{
// A StringBuilder is internally represented as a linked list of blocks each of which holds
// a chunk of the string. It turns out string as a whole can also be represented as just a chunk,
@@ -127,16 +118,16 @@ namespace System.Text
if (capacity < 0)
{
throw new ArgumentOutOfRangeException(nameof(capacity),
- Environment.GetResourceString("ArgumentOutOfRange_MustBePositive", nameof(capacity)));
+ SR.Format(SR.ArgumentOutOfRange_MustBePositive, nameof(capacity)));
}
if (length < 0)
{
throw new ArgumentOutOfRangeException(nameof(length),
- Environment.GetResourceString("ArgumentOutOfRange_MustBeNonNegNum", nameof(length)));
+ SR.Format(SR.ArgumentOutOfRange_MustBeNonNegNum, nameof(length)));
}
if (startIndex < 0)
{
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_StartIndex"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_StartIndex);
}
Contract.EndContractBlock();
@@ -146,7 +137,7 @@ namespace System.Text
}
if (startIndex > value.Length - length)
{
- throw new ArgumentOutOfRangeException(nameof(length), Environment.GetResourceString("ArgumentOutOfRange_IndexLength"));
+ throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_IndexLength);
}
m_MaxCapacity = Int32.MaxValue;
if (capacity == 0)
@@ -172,16 +163,16 @@ namespace System.Text
{
if (capacity > maxCapacity)
{
- throw new ArgumentOutOfRangeException(nameof(capacity), Environment.GetResourceString("ArgumentOutOfRange_Capacity"));
+ throw new ArgumentOutOfRangeException(nameof(capacity), SR.ArgumentOutOfRange_Capacity);
}
if (maxCapacity < 1)
{
- throw new ArgumentOutOfRangeException(nameof(maxCapacity), Environment.GetResourceString("ArgumentOutOfRange_SmallMaxCapacity"));
+ throw new ArgumentOutOfRangeException(nameof(maxCapacity), SR.ArgumentOutOfRange_SmallMaxCapacity);
}
if (capacity < 0)
{
throw new ArgumentOutOfRangeException(nameof(capacity),
- Environment.GetResourceString("ArgumentOutOfRange_MustBePositive", nameof(capacity)));
+ SR.Format(SR.ArgumentOutOfRange_MustBePositive, nameof(capacity)));
}
Contract.EndContractBlock();
@@ -234,7 +225,7 @@ namespace System.Text
}
if (persistedMaxCapacity < 1 || persistedString.Length > persistedMaxCapacity)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_StringBuilderMaxCapacity"));
+ throw new SerializationException(SR.Serialization_StringBuilderMaxCapacity);
}
if (!capacityPresent)
@@ -252,7 +243,7 @@ namespace System.Text
}
if (persistedCapacity < 0 || persistedCapacity < persistedString.Length || persistedCapacity > persistedMaxCapacity)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_StringBuilderCapacity"));
+ throw new SerializationException(SR.Serialization_StringBuilderCapacity);
}
// Assign
@@ -283,7 +274,7 @@ namespace System.Text
[System.Diagnostics.Conditional("_DEBUG")]
private void VerifyClassInvariant()
{
- BCLDebug.Correctness((uint)(m_ChunkOffset + m_ChunkChars.Length) >= m_ChunkOffset, "Integer Overflow");
+ Debug.Assert((uint)(m_ChunkOffset + m_ChunkChars.Length) >= m_ChunkOffset, "Integer Overflow");
StringBuilder currentBlock = this;
int maxCapacity = this.m_MaxCapacity;
for (;;)
@@ -315,15 +306,15 @@ namespace System.Text
{
if (value < 0)
{
- throw new ArgumentOutOfRangeException(nameof(value), Environment.GetResourceString("ArgumentOutOfRange_NegativeCapacity"));
+ throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_NegativeCapacity);
}
if (value > MaxCapacity)
{
- throw new ArgumentOutOfRangeException(nameof(value), Environment.GetResourceString("ArgumentOutOfRange_Capacity"));
+ throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_Capacity);
}
if (value < Length)
{
- throw new ArgumentOutOfRangeException(nameof(value), Environment.GetResourceString("ArgumentOutOfRange_SmallCapacity"));
+ throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_SmallCapacity);
}
Contract.EndContractBlock();
@@ -331,7 +322,7 @@ namespace System.Text
{
int newLen = value - m_ChunkOffset;
char[] newArray = new char[newLen];
- Array.Copy(m_ChunkChars, newArray, m_ChunkLength);
+ Array.Copy(m_ChunkChars, 0, newArray, 0, m_ChunkLength);
m_ChunkChars = newArray;
}
}
@@ -342,7 +333,6 @@ namespace System.Text
get { return m_MaxCapacity; }
}
- // Read-Only Property
// Ensures that the capacity of this string builder is at least the specified value.
// If capacity is greater than the capacity of this string builder, then the capacity
// is set to capacity; otherwise the capacity is unchanged.
@@ -351,7 +341,7 @@ namespace System.Text
{
if (capacity < 0)
{
- throw new ArgumentOutOfRangeException(nameof(capacity), Environment.GetResourceString("ArgumentOutOfRange_NegativeCapacity"));
+ throw new ArgumentOutOfRangeException(nameof(capacity), SR.ArgumentOutOfRange_NegativeCapacity);
}
Contract.EndContractBlock();
@@ -392,7 +382,7 @@ namespace System.Text
}
else
{
- throw new ArgumentOutOfRangeException(nameof(chunkLength), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(chunkLength), SR.ArgumentOutOfRange_Index);
}
}
chunk = chunk.m_ChunkPrevious;
@@ -412,19 +402,19 @@ namespace System.Text
int currentLength = this.Length;
if (startIndex < 0)
{
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_StartIndex"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_StartIndex);
}
if (startIndex > currentLength)
{
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_StartIndexLargerThanLength"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_StartIndexLargerThanLength);
}
if (length < 0)
{
- throw new ArgumentOutOfRangeException(nameof(length), Environment.GetResourceString("ArgumentOutOfRange_NegativeLength"));
+ throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_NegativeLength);
}
if (startIndex > (currentLength - length))
{
- throw new ArgumentOutOfRangeException(nameof(length), Environment.GetResourceString("ArgumentOutOfRange_IndexLength"));
+ throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_IndexLength);
}
VerifyClassInvariant();
@@ -469,7 +459,7 @@ namespace System.Text
}
else
{
- throw new ArgumentOutOfRangeException(nameof(chunkCount), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(chunkCount), SR.ArgumentOutOfRange_Index);
}
}
}
@@ -504,12 +494,12 @@ namespace System.Text
//If the new length is less than 0 or greater than our Maximum capacity, bail.
if (value < 0)
{
- throw new ArgumentOutOfRangeException(nameof(value), Environment.GetResourceString("ArgumentOutOfRange_NegativeLength"));
+ throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_NegativeLength);
}
if (value > MaxCapacity)
{
- throw new ArgumentOutOfRangeException(nameof(value), Environment.GetResourceString("ArgumentOutOfRange_SmallCapacity"));
+ throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_SmallCapacity);
}
Contract.EndContractBlock();
@@ -542,7 +532,7 @@ namespace System.Text
char[] newArray = new char[newLen];
Debug.Assert(newLen > chunk.m_ChunkChars.Length, "the new chunk should be larger than the one it is replacing");
- Array.Copy(chunk.m_ChunkChars, newArray, chunk.m_ChunkLength);
+ Array.Copy(chunk.m_ChunkChars, 0, newArray, 0, chunk.m_ChunkLength);
m_ChunkChars = newArray;
m_ChunkPrevious = chunk.m_ChunkPrevious;
@@ -584,13 +574,13 @@ namespace System.Text
if (indexInBlock >= 0)
{
if (indexInBlock >= chunk.m_ChunkLength)
- throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
chunk.m_ChunkChars[indexInBlock] = value;
return;
}
chunk = chunk.m_ChunkPrevious;
if (chunk == null)
- throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
}
}
}
@@ -600,7 +590,7 @@ namespace System.Text
{
if (repeatCount < 0)
{
- throw new ArgumentOutOfRangeException(nameof(repeatCount), Environment.GetResourceString("ArgumentOutOfRange_NegativeCount"));
+ throw new ArgumentOutOfRangeException(nameof(repeatCount), SR.ArgumentOutOfRange_NegativeCount);
}
Contract.Ensures(Contract.Result<StringBuilder>() != null);
Contract.EndContractBlock();
@@ -615,7 +605,7 @@ namespace System.Text
int newLength = Length + repeatCount;
if (newLength > m_MaxCapacity || newLength < repeatCount)
{
- throw new ArgumentOutOfRangeException(nameof(repeatCount), Environment.GetResourceString("ArgumentOutOfRange_LengthGreaterThanCapacity"));
+ throw new ArgumentOutOfRangeException(nameof(repeatCount), SR.ArgumentOutOfRange_LengthGreaterThanCapacity);
}
int idx = m_ChunkLength;
@@ -644,11 +634,11 @@ namespace System.Text
{
if (startIndex < 0)
{
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_GenericPositive"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_GenericPositive);
}
if (charCount < 0)
{
- throw new ArgumentOutOfRangeException(nameof(charCount), Environment.GetResourceString("ArgumentOutOfRange_GenericPositive"));
+ throw new ArgumentOutOfRangeException(nameof(charCount), SR.ArgumentOutOfRange_GenericPositive);
}
Contract.Ensures(Contract.Result<StringBuilder>() != null);
Contract.EndContractBlock();
@@ -663,7 +653,7 @@ namespace System.Text
}
if (charCount > value.Length - startIndex)
{
- throw new ArgumentOutOfRangeException(nameof(charCount), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(charCount), SR.ArgumentOutOfRange_Index);
}
if (charCount == 0)
@@ -733,24 +723,18 @@ namespace System.Text
}
}
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal unsafe extern void ReplaceBufferInternal(char* newBuffer, int newLength);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal unsafe extern void ReplaceBufferAnsiInternal(sbyte* newBuffer, int newLength);
-
// Appends a copy of the characters in value from startIndex to startIndex +
// count at the end of this string builder.
public StringBuilder Append(String value, int startIndex, int count)
{
if (startIndex < 0)
{
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_Index);
}
if (count < 0)
{
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_GenericPositive"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_GenericPositive);
}
Contract.Ensures(Contract.Result<StringBuilder>() != null);
@@ -772,7 +756,7 @@ namespace System.Text
if (startIndex > value.Length - count)
{
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_Index);
}
unsafe
@@ -808,28 +792,28 @@ namespace System.Text
if (count < 0)
{
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("Arg_NegativeArgCount"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.Arg_NegativeArgCount);
}
if (destinationIndex < 0)
{
throw new ArgumentOutOfRangeException(nameof(destinationIndex),
- Environment.GetResourceString("ArgumentOutOfRange_MustBeNonNegNum", nameof(destinationIndex)));
+ SR.Format(SR.ArgumentOutOfRange_MustBeNonNegNum, nameof(destinationIndex)));
}
if (destinationIndex > destination.Length - count)
{
- throw new ArgumentException(Environment.GetResourceString("ArgumentOutOfRange_OffsetOut"));
+ throw new ArgumentException(SR.ArgumentOutOfRange_OffsetOut);
}
if ((uint)sourceIndex > (uint)Length)
{
- throw new ArgumentOutOfRangeException(nameof(sourceIndex), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(sourceIndex), SR.ArgumentOutOfRange_Index);
}
if (sourceIndex > Length - count)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_LongerThanSrcString"));
+ throw new ArgumentException(SR.Arg_LongerThanSrcString);
}
Contract.EndContractBlock();
@@ -873,7 +857,7 @@ namespace System.Text
{
if (count < 0)
{
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
}
Contract.Ensures(Contract.Result<StringBuilder>() != null);
Contract.EndContractBlock();
@@ -882,7 +866,7 @@ namespace System.Text
int currentLength = Length;
if ((uint)index > (uint)currentLength)
{
- throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
}
//If value is null, empty or count is 0, do nothing. This is ECMA standard.
@@ -926,17 +910,17 @@ namespace System.Text
{
if (length < 0)
{
- throw new ArgumentOutOfRangeException(nameof(length), Environment.GetResourceString("ArgumentOutOfRange_NegativeLength"));
+ throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_NegativeLength);
}
if (startIndex < 0)
{
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_StartIndex"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_StartIndex);
}
if (length > Length - startIndex)
{
- throw new ArgumentOutOfRangeException(nameof(length), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_Index);
}
Contract.Ensures(Contract.Result<StringBuilder>() != null);
Contract.EndContractBlock();
@@ -957,14 +941,6 @@ namespace System.Text
return this;
}
- //
- // PUBLIC INSTANCE FUNCTIONS
- //
- //
-
- /*====================================Append====================================
- **
- ==============================================================================*/
// Appends a boolean to the end of this string builder.
// The capacity is adjusted as needed.
public StringBuilder Append(bool value)
@@ -979,7 +955,7 @@ namespace System.Text
public StringBuilder Append(sbyte value)
{
Contract.Ensures(Contract.Result<StringBuilder>() != null);
- return Append(value.ToString(CultureInfo.CurrentCulture));
+ return Append(value.ToString());
}
// Appends a ubyte to this string builder.
@@ -987,7 +963,7 @@ namespace System.Text
public StringBuilder Append(byte value)
{
Contract.Ensures(Contract.Result<StringBuilder>() != null);
- return Append(value.ToString(CultureInfo.CurrentCulture));
+ return Append(value.ToString());
}
// Appends a character at the end of this string builder. The capacity is adjusted as needed.
@@ -1007,7 +983,7 @@ namespace System.Text
public StringBuilder Append(short value)
{
Contract.Ensures(Contract.Result<StringBuilder>() != null);
- return Append(value.ToString(CultureInfo.CurrentCulture));
+ return Append(value.ToString());
}
// Appends an int to this string builder.
@@ -1015,7 +991,7 @@ namespace System.Text
public StringBuilder Append(int value)
{
Contract.Ensures(Contract.Result<StringBuilder>() != null);
- return Append(value.ToString(CultureInfo.CurrentCulture));
+ return Append(value.ToString());
}
// Appends a long to this string builder.
@@ -1023,7 +999,7 @@ namespace System.Text
public StringBuilder Append(long value)
{
Contract.Ensures(Contract.Result<StringBuilder>() != null);
- return Append(value.ToString(CultureInfo.CurrentCulture));
+ return Append(value.ToString());
}
// Appends a float to this string builder.
@@ -1031,7 +1007,7 @@ namespace System.Text
public StringBuilder Append(float value)
{
Contract.Ensures(Contract.Result<StringBuilder>() != null);
- return Append(value.ToString(CultureInfo.CurrentCulture));
+ return Append(value.ToString());
}
// Appends a double to this string builder.
@@ -1039,13 +1015,13 @@ namespace System.Text
public StringBuilder Append(double value)
{
Contract.Ensures(Contract.Result<StringBuilder>() != null);
- return Append(value.ToString(CultureInfo.CurrentCulture));
+ return Append(value.ToString());
}
public StringBuilder Append(decimal value)
{
Contract.Ensures(Contract.Result<StringBuilder>() != null);
- return Append(value.ToString(CultureInfo.CurrentCulture));
+ return Append(value.ToString());
}
// Appends an ushort to this string builder.
@@ -1054,7 +1030,7 @@ namespace System.Text
public StringBuilder Append(ushort value)
{
Contract.Ensures(Contract.Result<StringBuilder>() != null);
- return Append(value.ToString(CultureInfo.CurrentCulture));
+ return Append(value.ToString());
}
// Appends an uint to this string builder.
@@ -1063,7 +1039,7 @@ namespace System.Text
public StringBuilder Append(uint value)
{
Contract.Ensures(Contract.Result<StringBuilder>() != null);
- return Append(value.ToString(CultureInfo.CurrentCulture));
+ return Append(value.ToString());
}
// Appends an unsigned long to this string builder.
@@ -1072,7 +1048,7 @@ namespace System.Text
public StringBuilder Append(ulong value)
{
Contract.Ensures(Contract.Result<StringBuilder>() != null);
- return Append(value.ToString(CultureInfo.CurrentCulture));
+ return Append(value.ToString());
}
// Appends an Object to this string builder.
@@ -1200,7 +1176,7 @@ namespace System.Text
{
if ((uint)index > (uint)Length)
{
- throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
}
Contract.Ensures(Contract.Result<StringBuilder>() != null);
Contract.EndContractBlock();
@@ -1236,7 +1212,7 @@ namespace System.Text
public StringBuilder Insert(int index, sbyte value)
{
Contract.Ensures(Contract.Result<StringBuilder>() != null);
- return Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
+ return Insert(index, value.ToString(), 1);
}
// Returns a reference to the StringBuilder with ; value inserted into
@@ -1247,7 +1223,7 @@ namespace System.Text
public StringBuilder Insert(int index, byte value)
{
Contract.Ensures(Contract.Result<StringBuilder>() != null);
- return Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
+ return Insert(index, value.ToString(), 1);
}
// Returns a reference to the StringBuilder with ; value inserted into
@@ -1258,7 +1234,7 @@ namespace System.Text
public StringBuilder Insert(int index, short value)
{
Contract.Ensures(Contract.Result<StringBuilder>() != null);
- return Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
+ return Insert(index, value.ToString(), 1);
}
// Returns a reference to the StringBuilder with ; value inserted into
@@ -1285,7 +1261,7 @@ namespace System.Text
{
if ((uint)index > (uint)Length)
{
- throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
}
Contract.Ensures(Contract.Result<StringBuilder>() != null);
Contract.EndContractBlock();
@@ -1306,7 +1282,7 @@ namespace System.Text
int currentLength = Length;
if ((uint)index > (uint)currentLength)
{
- throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
}
//If they passed in a null char array, just jump out quickly.
@@ -1316,23 +1292,23 @@ namespace System.Text
{
return this;
}
- throw new ArgumentNullException(nameof(value), Environment.GetResourceString("ArgumentNull_String"));
+ throw new ArgumentNullException(nameof(value), SR.ArgumentNull_String);
}
//Range check the array.
if (startIndex < 0)
{
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_StartIndex"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_StartIndex);
}
if (charCount < 0)
{
- throw new ArgumentOutOfRangeException(nameof(charCount), Environment.GetResourceString("ArgumentOutOfRange_GenericPositive"));
+ throw new ArgumentOutOfRangeException(nameof(charCount), SR.ArgumentOutOfRange_GenericPositive);
}
if (startIndex > value.Length - charCount)
{
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_Index);
}
if (charCount > 0)
@@ -1354,7 +1330,7 @@ namespace System.Text
public StringBuilder Insert(int index, int value)
{
Contract.Ensures(Contract.Result<StringBuilder>() != null);
- return Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
+ return Insert(index, value.ToString(), 1);
}
// Returns a reference to the StringBuilder with ; value inserted into
@@ -1365,7 +1341,7 @@ namespace System.Text
public StringBuilder Insert(int index, long value)
{
Contract.Ensures(Contract.Result<StringBuilder>() != null);
- return Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
+ return Insert(index, value.ToString(), 1);
}
// Returns a reference to the StringBuilder with ; value inserted into
@@ -1376,7 +1352,7 @@ namespace System.Text
public StringBuilder Insert(int index, float value)
{
Contract.Ensures(Contract.Result<StringBuilder>() != null);
- return Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
+ return Insert(index, value.ToString(), 1);
}
// Returns a reference to the StringBuilder with ; value inserted into
@@ -1387,13 +1363,13 @@ namespace System.Text
public StringBuilder Insert(int index, double value)
{
Contract.Ensures(Contract.Result<StringBuilder>() != null);
- return Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
+ return Insert(index, value.ToString(), 1);
}
public StringBuilder Insert(int index, decimal value)
{
Contract.Ensures(Contract.Result<StringBuilder>() != null);
- return Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
+ return Insert(index, value.ToString(), 1);
}
// Returns a reference to the StringBuilder with value inserted into
@@ -1404,7 +1380,7 @@ namespace System.Text
public StringBuilder Insert(int index, ushort value)
{
Contract.Ensures(Contract.Result<StringBuilder>() != null);
- return Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
+ return Insert(index, value.ToString(), 1);
}
// Returns a reference to the StringBuilder with value inserted into
@@ -1415,7 +1391,7 @@ namespace System.Text
public StringBuilder Insert(int index, uint value)
{
Contract.Ensures(Contract.Result<StringBuilder>() != null);
- return Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
+ return Insert(index, value.ToString(), 1);
}
// Returns a reference to the StringBuilder with value inserted into
@@ -1426,7 +1402,7 @@ namespace System.Text
public StringBuilder Insert(int index, ulong value)
{
Contract.Ensures(Contract.Result<StringBuilder>() != null);
- return Insert(index, value.ToString(CultureInfo.CurrentCulture), 1);
+ return Insert(index, value.ToString(), 1);
}
// Returns a reference to this string builder with value inserted into
@@ -1510,7 +1486,7 @@ namespace System.Text
private static void FormatError()
{
- throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ throw new FormatException(SR.Format_InvalidString);
}
// undocumented exclusive limits on the range for Argument Hole Index and Argument Hole Alignment.
@@ -1597,7 +1573,7 @@ namespace System.Text
} while (ch >= '0' && ch <= '9' && index < Index_Limit);
// If value of index is not within the range of the arguments passed in then error (Index out of range)
- if (index >= args.Length) throw new FormatException(Environment.GetResourceString("Format_IndexOutOfRange"));
+ if (index >= args.Length) throw new FormatException(SR.Format_IndexOutOfRange);
// Consume optional whitespace.
while (pos < len && (ch = format[pos]) == ' ') pos++;
@@ -1817,11 +1793,11 @@ namespace System.Text
int currentLength = Length;
if ((uint)startIndex > (uint)currentLength)
{
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_Index);
}
if (count < 0 || startIndex > currentLength - count)
{
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_Index);
}
if (oldValue == null)
{
@@ -1829,7 +1805,7 @@ namespace System.Text
}
if (oldValue.Length == 0)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(oldValue));
+ throw new ArgumentException(SR.Argument_EmptyName, nameof(oldValue));
}
if (newValue == null)
@@ -1855,9 +1831,7 @@ namespace System.Text
replacements = new int[5];
else if (replacementsCount >= replacements.Length)
{
- int[] newArray = new int[replacements.Length * 3 / 2 + 4]; // grow by 1.5X but more in the begining
- Array.Copy(replacements, newArray, replacements.Length);
- replacements = newArray;
+ Array.Resize(ref replacements, replacements.Length * 3 / 2 + 4); // grow by 1.5X but more in the beginning
}
replacements[replacementsCount++] = indexInChunk;
indexInChunk += oldValue.Length;
@@ -1906,12 +1880,12 @@ namespace System.Text
int currentLength = Length;
if ((uint)startIndex > (uint)currentLength)
{
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_Index);
}
if (count < 0 || startIndex > currentLength - count)
{
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_Index);
}
int endIndex = startIndex + count;
@@ -1941,13 +1915,13 @@ namespace System.Text
/// <summary>
/// Appends 'value' of length 'count' to the stringBuilder.
/// </summary>
- [System.CLSCompliantAttribute(false)]
+ [CLSCompliant(false)]
public unsafe StringBuilder Append(char* value, int valueCount)
{
// We don't check null value as this case will throw null reference exception anyway
if (valueCount < 0)
{
- throw new ArgumentOutOfRangeException(nameof(valueCount), Environment.GetResourceString("ArgumentOutOfRange_NegativeCount"));
+ throw new ArgumentOutOfRangeException(nameof(valueCount), SR.ArgumentOutOfRange_NegativeCount);
}
// this is where we can check if the valueCount will put us over m_MaxCapacity
@@ -1955,7 +1929,7 @@ namespace System.Text
int newLength = Length + valueCount;
if (newLength > m_MaxCapacity || newLength < valueCount)
{
- throw new ArgumentOutOfRangeException(nameof(valueCount), Environment.GetResourceString("ArgumentOutOfRange_LengthGreaterThanCapacity"));
+ throw new ArgumentOutOfRangeException(nameof(valueCount), SR.ArgumentOutOfRange_LengthGreaterThanCapacity);
}
// This case is so common we want to optimize for it heavily.
@@ -1995,7 +1969,7 @@ namespace System.Text
{
if ((uint)index > (uint)Length)
{
- throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
}
if (valueCount > 0)
@@ -2132,7 +2106,7 @@ namespace System.Text
/// The only way to do this is to copy all interesting variables out of the heap and then do the
/// bounds check. This is what we do here.
/// </summary>
- unsafe private static void ThreadSafeCopy(char* sourcePtr, char[] destination, int destinationIndex, int count)
+ private static unsafe void ThreadSafeCopy(char* sourcePtr, char[] destination, int destinationIndex, int count)
{
if (count > 0)
{
@@ -2143,10 +2117,11 @@ namespace System.Text
}
else
{
- throw new ArgumentOutOfRangeException(nameof(destinationIndex), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(destinationIndex), SR.ArgumentOutOfRange_Index);
}
}
}
+
private static void ThreadSafeCopy(char[] source, int sourceIndex, char[] destination, int destinationIndex, int count)
{
if (count > 0)
@@ -2161,42 +2136,11 @@ namespace System.Text
}
else
{
- throw new ArgumentOutOfRangeException(nameof(sourceIndex), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(sourceIndex), SR.ArgumentOutOfRange_Index);
}
}
}
- // Copies the source StringBuilder to the destination IntPtr memory allocated with len bytes.
- internal unsafe void InternalCopy(IntPtr dest, int len)
- {
- if (len == 0)
- return;
-
- bool isLastChunk = true;
- byte* dstPtr = (byte*)dest.ToPointer();
- StringBuilder currentSrc = FindChunkForByte(len);
-
- do
- {
- int chunkOffsetInBytes = currentSrc.m_ChunkOffset * sizeof(char);
- int chunkLengthInBytes = currentSrc.m_ChunkLength * sizeof(char);
- fixed (char* charPtr = &currentSrc.m_ChunkChars[0])
- {
- byte* srcPtr = (byte*)charPtr;
- if (isLastChunk)
- {
- isLastChunk = false;
- Buffer.Memcpy(dstPtr + chunkOffsetInBytes, srcPtr, len - chunkOffsetInBytes);
- }
- else
- {
- Buffer.Memcpy(dstPtr + chunkOffsetInBytes, srcPtr, chunkLengthInBytes);
- }
- }
- currentSrc = currentSrc.m_ChunkPrevious;
- } while (currentSrc != null);
- }
-
/// <summary>
/// Finds the chunk for the logical index (number of characters in the whole stringbuilder) 'index'
/// YOu can then get the offset in this chunk by subtracting the m_BlockOffset field from 'index'
@@ -2258,7 +2202,7 @@ namespace System.Text
VerifyClassInvariant();
if ((minBlockCharCount + Length) > m_MaxCapacity || minBlockCharCount + Length < minBlockCharCount)
- throw new ArgumentOutOfRangeException("requiredLength", Environment.GetResourceString("ArgumentOutOfRange_SmallCapacity"));
+ throw new ArgumentOutOfRangeException("requiredLength", SR.ArgumentOutOfRange_SmallCapacity);
// Compute the length of the new block we need
// We make the new chunk at least big enough for the current need (minBlockCharCount)
@@ -2317,7 +2261,7 @@ namespace System.Text
Debug.Assert(count > 0, "Count must be strictly positive");
Debug.Assert(index >= 0, "Index can't be negative");
if (count + Length > m_MaxCapacity || count + Length < count)
- throw new ArgumentOutOfRangeException("requiredLength", Environment.GetResourceString("ArgumentOutOfRange_SmallCapacity"));
+ throw new ArgumentOutOfRangeException("requiredLength", SR.ArgumentOutOfRange_SmallCapacity);
chunk = this;
while (chunk.m_ChunkOffset > index)
diff --git a/src/mscorlib/src/System/Threading/Tasks/TaskCanceledException.cs b/src/mscorlib/shared/System/Threading/Tasks/TaskCanceledException.cs
index 890a9c8b9b..d7690d4c7c 100644
--- a/src/mscorlib/src/System/Threading/Tasks/TaskCanceledException.cs
+++ b/src/mscorlib/shared/System/Threading/Tasks/TaskCanceledException.cs
@@ -28,7 +28,7 @@ namespace System.Threading.Tasks
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Threading.Tasks.TaskCanceledException"/> class.
/// </summary>
- public TaskCanceledException() : base(Environment.GetResourceString("TaskCanceledException_ctor_DefaultMessage"))
+ public TaskCanceledException() : base(SR.TaskCanceledException_ctor_DefaultMessage)
{
}
@@ -58,7 +58,7 @@ namespace System.Threading.Tasks
/// </summary>
/// <param name="task">A task that has been canceled.</param>
public TaskCanceledException(Task task) :
- base(Environment.GetResourceString("TaskCanceledException_ctor_DefaultMessage"), task != null ? task.CancellationToken : new CancellationToken())
+ base(SR.TaskCanceledException_ctor_DefaultMessage, task != null ? task.CancellationToken : new CancellationToken())
{
m_canceledTask = task;
}
diff --git a/src/mscorlib/src/System/Threading/Tasks/TaskExtensions.cs b/src/mscorlib/shared/System/Threading/Tasks/TaskExtensions.cs
index 1098299517..1098299517 100644
--- a/src/mscorlib/src/System/Threading/Tasks/TaskExtensions.cs
+++ b/src/mscorlib/shared/System/Threading/Tasks/TaskExtensions.cs
diff --git a/src/mscorlib/src/System/Threading/Tasks/TaskSchedulerException.cs b/src/mscorlib/shared/System/Threading/Tasks/TaskSchedulerException.cs
index 3726a5e18e..148b6300ef 100644
--- a/src/mscorlib/src/System/Threading/Tasks/TaskSchedulerException.cs
+++ b/src/mscorlib/shared/System/Threading/Tasks/TaskSchedulerException.cs
@@ -26,7 +26,7 @@ namespace System.Threading.Tasks
/// <summary>
/// Initializes a new instance of the <see cref="T:System.Threading.Tasks.TaskSchedulerException"/> class.
/// </summary>
- public TaskSchedulerException() : base(Environment.GetResourceString("TaskSchedulerException_ctor_DefaultMessage")) //
+ public TaskSchedulerException() : base(SR.TaskSchedulerException_ctor_DefaultMessage) //
{
}
@@ -46,7 +46,7 @@ namespace System.Threading.Tasks
/// </summary>
/// <param name="innerException">The exception that is the cause of the current exception.</param>
public TaskSchedulerException(Exception innerException)
- : base(Environment.GetResourceString("TaskSchedulerException_ctor_DefaultMessage"), innerException)
+ : base(SR.TaskSchedulerException_ctor_DefaultMessage, innerException)
{
}
diff --git a/src/mscorlib/src/System/TimeZone.cs b/src/mscorlib/shared/System/TimeZone.cs
index 88e2e21864..88e2e21864 100644
--- a/src/mscorlib/src/System/TimeZone.cs
+++ b/src/mscorlib/shared/System/TimeZone.cs
diff --git a/src/mscorlib/shared/System/TupleExtensions.cs b/src/mscorlib/shared/System/TupleExtensions.cs
index b63cb41213..106a88a08b 100644
--- a/src/mscorlib/shared/System/TupleExtensions.cs
+++ b/src/mscorlib/shared/System/TupleExtensions.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// 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.
@@ -927,4 +927,4 @@ namespace System
private static Tuple<T1, T2, T3, T4, T5, T6, T7, TRest> CreateLongRef<T1, T2, T3, T4, T5, T6, T7, TRest>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7, TRest rest) where TRest : ITuple =>
new Tuple<T1, T2, T3, T4, T5, T6, T7, TRest>(item1, item2, item3, item4, item5, item6, item7, rest);
}
-} \ No newline at end of file
+}
diff --git a/src/mscorlib/shared/System/Type.Enum.cs b/src/mscorlib/shared/System/Type.Enum.cs
new file mode 100644
index 0000000000..4d82410383
--- /dev/null
+++ b/src/mscorlib/shared/System/Type.Enum.cs
@@ -0,0 +1,186 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Reflection;
+using System.Collections;
+using System.Collections.Generic;
+
+namespace System
+{
+ //
+ // This file collects a set of Enum-related apis that run when the Type is subclassed by an application.
+ // None of it runs on normal Type objects supplied by the runtime (as those types override these methods.)
+ //
+ // Since app-subclassed Types are "untrusted classes" that may or may not implement the complete surface area correctly,
+ // this code should be considered brittle and not changed lightly.
+ //
+ public abstract partial class Type
+ {
+ public virtual bool IsEnumDefined(object value)
+ {
+ if (value == null)
+ throw new ArgumentNullException(nameof(value));
+
+ if (!IsEnum)
+ throw new ArgumentException(SR.Arg_MustBeEnum, "enumType");
+
+ // Check if both of them are of the same type
+ Type valueType = value.GetType();
+
+ // If the value is an Enum then we need to extract the underlying value from it
+ if (valueType.IsEnum)
+ {
+ if (!valueType.IsEquivalentTo(this))
+ throw new ArgumentException(SR.Format(SR.Arg_EnumAndObjectMustBeSameType, valueType.ToString(), this.ToString()));
+
+ valueType = valueType.GetEnumUnderlyingType();
+ }
+
+ // If a string is passed in
+ if (valueType == typeof(string))
+ {
+ string[] names = GetEnumNames();
+ if (Array.IndexOf(names, value) >= 0)
+ return true;
+ else
+ return false;
+ }
+
+ // If an enum or integer value is passed in
+ if (Type.IsIntegerType(valueType))
+ {
+ Type underlyingType = GetEnumUnderlyingType();
+ // We cannot compare the types directly because valueType is always a runtime type but underlyingType might not be.
+ if (underlyingType.GetTypeCodeImpl() != valueType.GetTypeCodeImpl())
+ throw new ArgumentException(SR.Format(SR.Arg_EnumUnderlyingTypeAndObjectMustBeSameType, valueType.ToString(), underlyingType.ToString()));
+
+ Array values = GetEnumRawConstantValues();
+ return (BinarySearch(values, value) >= 0);
+ }
+ else
+ {
+ throw new InvalidOperationException(SR.InvalidOperation_UnknownEnumType);
+ }
+ }
+
+ public virtual string GetEnumName(object value)
+ {
+ if (value == null)
+ throw new ArgumentNullException(nameof(value));
+
+ if (!IsEnum)
+ throw new ArgumentException(SR.Arg_MustBeEnum, "enumType");
+
+ Type valueType = value.GetType();
+
+ if (!(valueType.IsEnum || Type.IsIntegerType(valueType)))
+ throw new ArgumentException(SR.Arg_MustBeEnumBaseTypeOrEnum, nameof(value));
+
+ Array values = GetEnumRawConstantValues();
+ int index = BinarySearch(values, value);
+
+ if (index >= 0)
+ {
+ string[] names = GetEnumNames();
+ return names[index];
+ }
+
+ return null;
+ }
+
+ public virtual string[] GetEnumNames()
+ {
+ if (!IsEnum)
+ throw new ArgumentException(SR.Arg_MustBeEnum, "enumType");
+
+ string[] names;
+ Array values;
+ GetEnumData(out names, out values);
+ return names;
+ }
+
+
+ // Returns the enum values as an object array.
+ private Array GetEnumRawConstantValues()
+ {
+ string[] names;
+ Array values;
+ GetEnumData(out names, out values);
+ return values;
+ }
+
+ // This will return enumValues and enumNames sorted by the values.
+ private void GetEnumData(out string[] enumNames, out Array enumValues)
+ {
+ FieldInfo[] flds = GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
+
+ object[] values = new object[flds.Length];
+ string[] names = new string[flds.Length];
+
+ for (int i = 0; i < flds.Length; i++)
+ {
+ names[i] = flds[i].Name;
+ values[i] = flds[i].GetRawConstantValue();
+ }
+
+ // Insertion Sort these values in ascending order.
+ // We use this O(n^2) algorithm, but it turns out that most of the time the elements are already in sorted order and
+ // the common case performance will be faster than quick sorting this.
+ IComparer comparer = Comparer<object>.Default;
+ for (int i = 1; i < values.Length; i++)
+ {
+ int j = i;
+ string tempStr = names[i];
+ object val = values[i];
+ bool exchanged = false;
+
+ // Since the elements are sorted we only need to do one comparision, we keep the check for j inside the loop.
+ while (comparer.Compare(values[j - 1], val) > 0)
+ {
+ names[j] = names[j - 1];
+ values[j] = values[j - 1];
+ j--;
+ exchanged = true;
+ if (j == 0)
+ break;
+ }
+
+ if (exchanged)
+ {
+ names[j] = tempStr;
+ values[j] = val;
+ }
+ }
+
+ enumNames = names;
+ enumValues = values;
+ }
+
+ // Convert everything to ulong then perform a binary search.
+ private static int BinarySearch(Array array, object value)
+ {
+ ulong[] ulArray = new ulong[array.Length];
+ for (int i = 0; i < array.Length; ++i)
+ ulArray[i] = Enum.ToUInt64(array.GetValue(i));
+
+ ulong ulValue = Enum.ToUInt64(value);
+
+ return Array.BinarySearch(ulArray, ulValue);
+ }
+
+ internal static bool IsIntegerType(Type t)
+ {
+ return (t == typeof(int) ||
+ t == typeof(short) ||
+ t == typeof(ushort) ||
+ t == typeof(byte) ||
+ t == typeof(sbyte) ||
+ t == typeof(uint) ||
+ t == typeof(long) ||
+ t == typeof(ulong) ||
+ t == typeof(char) ||
+ t == typeof(bool));
+ }
+ }
+}
diff --git a/src/mscorlib/shared/System/Type.Helpers.cs b/src/mscorlib/shared/System/Type.Helpers.cs
new file mode 100644
index 0000000000..db8df231e4
--- /dev/null
+++ b/src/mscorlib/shared/System/Type.Helpers.cs
@@ -0,0 +1,527 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Reflection;
+
+namespace System
+{
+ // This file collects the longer methods of Type to make the main Type class more readable.
+ public abstract partial class Type : MemberInfo, IReflect
+ {
+ public virtual bool IsSerializable
+ {
+ get
+ {
+ if ((GetAttributeFlagsImpl() & TypeAttributes.Serializable) != 0)
+ return true;
+
+ Type underlyingType = UnderlyingSystemType;
+ if (underlyingType.IsRuntimeImplemented())
+ {
+ do
+ {
+ // In all sane cases we only need to compare the direct level base type with
+ // System.Enum and System.MulticastDelegate. However, a generic parameter can
+ // have a base type constraint that is Delegate or even a real delegate type.
+ // Let's maintain compatibility and return true for them.
+ if (underlyingType == typeof(Delegate) || underlyingType == typeof(Enum))
+ return true;
+
+ underlyingType = underlyingType.BaseType;
+ }
+ while (underlyingType != null);
+ }
+
+ return false;
+ }
+ }
+
+ public virtual bool ContainsGenericParameters
+ {
+ get
+ {
+ if (HasElementType)
+ return GetRootElementType().ContainsGenericParameters;
+
+ if (IsGenericParameter)
+ return true;
+
+ if (!IsGenericType)
+ return false;
+
+ Type[] genericArguments = GetGenericArguments();
+ for (int i = 0; i < genericArguments.Length; i++)
+ {
+ if (genericArguments[i].ContainsGenericParameters)
+ return true;
+ }
+
+ return false;
+ }
+ }
+
+ internal Type GetRootElementType()
+ {
+ Type rootElementType = this;
+
+ while (rootElementType.HasElementType)
+ rootElementType = rootElementType.GetElementType();
+
+ return rootElementType;
+ }
+
+ public bool IsVisible
+ {
+ get
+ {
+#if CORECLR
+ RuntimeType rt = this as RuntimeType;
+ if (rt != null)
+ return RuntimeTypeHandle.IsVisible(rt);
+#endif //CORECLR
+
+ if (IsGenericParameter)
+ return true;
+
+ if (HasElementType)
+ return GetElementType().IsVisible;
+
+ Type type = this;
+ while (type.IsNested)
+ {
+ if (!type.IsNestedPublic)
+ return false;
+
+ // this should be null for non-nested types.
+ type = type.DeclaringType;
+ }
+
+ // Now "type" should be a top level type
+ if (!type.IsPublic)
+ return false;
+
+ if (IsGenericType && !IsGenericTypeDefinition)
+ {
+ foreach (Type t in GetGenericArguments())
+ {
+ if (!t.IsVisible)
+ return false;
+ }
+ }
+
+ return true;
+ }
+ }
+
+ public virtual Type[] FindInterfaces(TypeFilter filter, object filterCriteria)
+ {
+ if (filter == null)
+ throw new ArgumentNullException(nameof(filter));
+
+ Type[] c = GetInterfaces();
+ int cnt = 0;
+ for (int i = 0; i < c.Length; i++)
+ {
+ if (!filter(c[i], filterCriteria))
+ c[i] = null;
+ else
+ cnt++;
+ }
+ if (cnt == c.Length)
+ return c;
+
+ Type[] ret = new Type[cnt];
+ cnt = 0;
+ for (int i = 0; i < c.Length; i++)
+ {
+ if (c[i] != null)
+ ret[cnt++] = c[i];
+ }
+ return ret;
+ }
+
+ public virtual MemberInfo[] FindMembers(MemberTypes memberType, BindingFlags bindingAttr, MemberFilter filter, object filterCriteria)
+ {
+ // Define the work arrays
+ MethodInfo[] m = null;
+ ConstructorInfo[] c = null;
+ FieldInfo[] f = null;
+ PropertyInfo[] p = null;
+ EventInfo[] e = null;
+ Type[] t = null;
+
+ int i = 0;
+ int cnt = 0; // Total Matchs
+
+ // Check the methods
+ if ((memberType & MemberTypes.Method) != 0)
+ {
+ m = GetMethods(bindingAttr);
+ if (filter != null)
+ {
+ for (i = 0; i < m.Length; i++)
+ if (!filter(m[i], filterCriteria))
+ m[i] = null;
+ else
+ cnt++;
+ }
+ else
+ {
+ cnt += m.Length;
+ }
+ }
+
+ // Check the constructors
+ if ((memberType & MemberTypes.Constructor) != 0)
+ {
+ c = GetConstructors(bindingAttr);
+ if (filter != null)
+ {
+ for (i = 0; i < c.Length; i++)
+ if (!filter(c[i], filterCriteria))
+ c[i] = null;
+ else
+ cnt++;
+ }
+ else
+ {
+ cnt += c.Length;
+ }
+ }
+
+ // Check the fields
+ if ((memberType & MemberTypes.Field) != 0)
+ {
+ f = GetFields(bindingAttr);
+ if (filter != null)
+ {
+ for (i = 0; i < f.Length; i++)
+ if (!filter(f[i], filterCriteria))
+ f[i] = null;
+ else
+ cnt++;
+ }
+ else
+ {
+ cnt += f.Length;
+ }
+ }
+
+ // Check the Properties
+ if ((memberType & MemberTypes.Property) != 0)
+ {
+ p = GetProperties(bindingAttr);
+ if (filter != null)
+ {
+ for (i = 0; i < p.Length; i++)
+ if (!filter(p[i], filterCriteria))
+ p[i] = null;
+ else
+ cnt++;
+ }
+ else
+ {
+ cnt += p.Length;
+ }
+ }
+
+ // Check the Events
+ if ((memberType & MemberTypes.Event) != 0)
+ {
+ e = GetEvents(bindingAttr);
+ if (filter != null)
+ {
+ for (i = 0; i < e.Length; i++)
+ if (!filter(e[i], filterCriteria))
+ e[i] = null;
+ else
+ cnt++;
+ }
+ else
+ {
+ cnt += e.Length;
+ }
+ }
+
+ // Check the Types
+ if ((memberType & MemberTypes.NestedType) != 0)
+ {
+ t = GetNestedTypes(bindingAttr);
+ if (filter != null)
+ {
+ for (i = 0; i < t.Length; i++)
+ if (!filter(t[i], filterCriteria))
+ t[i] = null;
+ else
+ cnt++;
+ }
+ else
+ {
+ cnt += t.Length;
+ }
+ }
+
+ // Allocate the Member Info
+ MemberInfo[] ret = new MemberInfo[cnt];
+
+ // Copy the Methods
+ cnt = 0;
+ if (m != null)
+ {
+ for (i = 0; i < m.Length; i++)
+ if (m[i] != null)
+ ret[cnt++] = m[i];
+ }
+
+ // Copy the Constructors
+ if (c != null)
+ {
+ for (i = 0; i < c.Length; i++)
+ if (c[i] != null)
+ ret[cnt++] = c[i];
+ }
+
+ // Copy the Fields
+ if (f != null)
+ {
+ for (i = 0; i < f.Length; i++)
+ if (f[i] != null)
+ ret[cnt++] = f[i];
+ }
+
+ // Copy the Properties
+ if (p != null)
+ {
+ for (i = 0; i < p.Length; i++)
+ if (p[i] != null)
+ ret[cnt++] = p[i];
+ }
+
+ // Copy the Events
+ if (e != null)
+ {
+ for (i = 0; i < e.Length; i++)
+ if (e[i] != null)
+ ret[cnt++] = e[i];
+ }
+
+ // Copy the Types
+ if (t != null)
+ {
+ for (i = 0; i < t.Length; i++)
+ if (t[i] != null)
+ ret[cnt++] = t[i];
+ }
+
+ return ret;
+ }
+
+ public virtual bool IsSubclassOf(Type c)
+ {
+ Type p = this;
+ if (p == c)
+ return false;
+ while (p != null)
+ {
+ if (p == c)
+ return true;
+ p = p.BaseType;
+ }
+ return false;
+ }
+
+ public virtual bool IsAssignableFrom(Type c)
+ {
+ if (c == null)
+ return false;
+
+ if (this == c)
+ return true;
+
+ // For backward-compatibility, we need to special case for the types
+ // whose UnderlyingSystemType are runtime implemented.
+ Type toType = this.UnderlyingSystemType;
+ if (toType.IsRuntimeImplemented())
+ return toType.IsAssignableFrom(c);
+
+ // If c is a subclass of this class, then c can be cast to this type.
+ if (c.IsSubclassOf(this))
+ return true;
+
+ if (this.IsInterface)
+ {
+ return c.ImplementInterface(this);
+ }
+ else if (IsGenericParameter)
+ {
+ Type[] constraints = GetGenericParameterConstraints();
+ for (int i = 0; i < constraints.Length; i++)
+ if (!constraints[i].IsAssignableFrom(c))
+ return false;
+
+ return true;
+ }
+
+ return false;
+ }
+
+ internal bool ImplementInterface(Type ifaceType)
+ {
+ Type t = this;
+ while (t != null)
+ {
+ Type[] interfaces = t.GetInterfaces();
+ if (interfaces != null)
+ {
+ for (int i = 0; i < interfaces.Length; i++)
+ {
+ // Interfaces don't derive from other interfaces, they implement them.
+ // So instead of IsSubclassOf, we should use ImplementInterface instead.
+ if (interfaces[i] == ifaceType ||
+ (interfaces[i] != null && interfaces[i].ImplementInterface(ifaceType)))
+ return true;
+ }
+ }
+
+ t = t.BaseType;
+ }
+
+ return false;
+ }
+
+ // FilterAttribute
+ // This method will search for a member based upon the attribute passed in.
+ // filterCriteria -- an Int32 representing the attribute
+ private static bool FilterAttributeImpl(MemberInfo m, object filterCriteria)
+ {
+ // Check that the criteria object is an Integer object
+ if (filterCriteria == null)
+ throw new InvalidFilterCriteriaException(SR.InvalidFilterCriteriaException_CritInt);
+
+ switch (m.MemberType)
+ {
+ case MemberTypes.Constructor:
+ case MemberTypes.Method:
+ {
+ MethodAttributes criteria = 0;
+ try
+ {
+ int i = (int)filterCriteria;
+ criteria = (MethodAttributes)i;
+ }
+ catch
+ {
+ throw new InvalidFilterCriteriaException(SR.InvalidFilterCriteriaException_CritInt);
+ }
+
+
+ MethodAttributes attr;
+ if (m.MemberType == MemberTypes.Method)
+ attr = ((MethodInfo)m).Attributes;
+ else
+ attr = ((ConstructorInfo)m).Attributes;
+
+ if (((criteria & MethodAttributes.MemberAccessMask) != 0) && (attr & MethodAttributes.MemberAccessMask) != (criteria & MethodAttributes.MemberAccessMask))
+ return false;
+ if (((criteria & MethodAttributes.Static) != 0) && (attr & MethodAttributes.Static) == 0)
+ return false;
+ if (((criteria & MethodAttributes.Final) != 0) && (attr & MethodAttributes.Final) == 0)
+ return false;
+ if (((criteria & MethodAttributes.Virtual) != 0) && (attr & MethodAttributes.Virtual) == 0)
+ return false;
+ if (((criteria & MethodAttributes.Abstract) != 0) && (attr & MethodAttributes.Abstract) == 0)
+ return false;
+ if (((criteria & MethodAttributes.SpecialName) != 0) && (attr & MethodAttributes.SpecialName) == 0)
+ return false;
+ return true;
+ }
+ case MemberTypes.Field:
+ {
+ FieldAttributes criteria = 0;
+ try
+ {
+ int i = (int)filterCriteria;
+ criteria = (FieldAttributes)i;
+ }
+ catch
+ {
+ throw new InvalidFilterCriteriaException(SR.InvalidFilterCriteriaException_CritInt);
+ }
+
+ FieldAttributes attr = ((FieldInfo)m).Attributes;
+ if (((criteria & FieldAttributes.FieldAccessMask) != 0) && (attr & FieldAttributes.FieldAccessMask) != (criteria & FieldAttributes.FieldAccessMask))
+ return false;
+ if (((criteria & FieldAttributes.Static) != 0) && (attr & FieldAttributes.Static) == 0)
+ return false;
+ if (((criteria & FieldAttributes.InitOnly) != 0) && (attr & FieldAttributes.InitOnly) == 0)
+ return false;
+ if (((criteria & FieldAttributes.Literal) != 0) && (attr & FieldAttributes.Literal) == 0)
+ return false;
+ if (((criteria & FieldAttributes.NotSerialized) != 0) && (attr & FieldAttributes.NotSerialized) == 0)
+ return false;
+ if (((criteria & FieldAttributes.PinvokeImpl) != 0) && (attr & FieldAttributes.PinvokeImpl) == 0)
+ return false;
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ // FilterName
+ // This method will filter based upon the name. A partial wildcard
+ // at the end of the string is supported.
+ // filterCriteria -- This is the string name
+ private static bool FilterNameImpl(MemberInfo m, object filterCriteria)
+ {
+ // Check that the criteria object is a String object
+ if (filterCriteria == null || !(filterCriteria is string))
+ throw new InvalidFilterCriteriaException(SR.InvalidFilterCriteriaException_CritString);
+
+ // At the moment this fails if its done on a single line....
+ string str = ((string)filterCriteria);
+ str = str.Trim();
+
+ string name = m.Name;
+ // Get the nested class name only, as opposed to the mangled one
+ if (m.MemberType == MemberTypes.NestedType)
+ name = name.Substring(name.LastIndexOf('+') + 1);
+ // Check to see if this is a prefix or exact match requirement
+ if (str.Length > 0 && str[str.Length - 1] == '*')
+ {
+ str = str.Substring(0, str.Length - 1);
+ return (name.StartsWith(str, StringComparison.Ordinal));
+ }
+
+ return (name.Equals(str));
+ }
+
+ // FilterIgnoreCase
+ // This delegate will do a name search but does it with the
+ // ignore case specified.
+ private static bool FilterNameIgnoreCaseImpl(MemberInfo m, object filterCriteria)
+ {
+ // Check that the criteria object is a String object
+ if (filterCriteria == null || !(filterCriteria is string))
+ throw new InvalidFilterCriteriaException(SR.InvalidFilterCriteriaException_CritString);
+
+ string str = (string)filterCriteria;
+ str = str.Trim();
+
+ string name = m.Name;
+ // Get the nested class name only, as opposed to the mangled one
+ if (m.MemberType == MemberTypes.NestedType)
+ name = name.Substring(name.LastIndexOf('+') + 1);
+ // Check to see if this is a prefix or exact match requirement
+ if (str.Length > 0 && str[str.Length - 1] == '*')
+ {
+ str = str.Substring(0, str.Length - 1);
+ return (string.Compare(name, 0, str, 0, str.Length, StringComparison.OrdinalIgnoreCase) == 0);
+ }
+
+ return (string.Compare(str, name, StringComparison.OrdinalIgnoreCase) == 0);
+ }
+ }
+}
+
diff --git a/src/mscorlib/shared/System/Type.cs b/src/mscorlib/shared/System/Type.cs
new file mode 100644
index 0000000000..fa0a7b918b
--- /dev/null
+++ b/src/mscorlib/shared/System/Type.cs
@@ -0,0 +1,357 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Threading;
+using System.Reflection;
+using System.Diagnostics;
+using System.Globalization;
+using System.Runtime.InteropServices;
+
+namespace System
+{
+ public abstract partial class Type : MemberInfo, IReflect
+ {
+ protected Type() { }
+
+ public override MemberTypes MemberType => MemberTypes.TypeInfo;
+
+ public new Type GetType() => base.GetType();
+
+ public abstract string Namespace { get; }
+ public abstract string AssemblyQualifiedName { get; }
+ public abstract string FullName { get; }
+
+ public abstract Assembly Assembly { get; }
+ public abstract new Module Module { get; }
+
+ public bool IsNested => DeclaringType != null;
+ public override Type DeclaringType => null;
+ public virtual MethodBase DeclaringMethod => null;
+
+ public override Type ReflectedType => null;
+ public abstract Type UnderlyingSystemType { get; }
+
+ public bool IsArray => IsArrayImpl();
+ protected abstract bool IsArrayImpl();
+ public bool IsByRef => IsByRefImpl();
+ protected abstract bool IsByRefImpl();
+ public bool IsPointer => IsPointerImpl();
+ protected abstract bool IsPointerImpl();
+ public virtual bool IsConstructedGenericType { get { throw NotImplemented.ByDesign; } }
+ public virtual bool IsGenericParameter => false;
+ public virtual bool IsGenericType => false;
+ public virtual bool IsGenericTypeDefinition => false;
+
+ public virtual bool IsSZArray { get { throw NotImplemented.ByDesign; } }
+
+ public bool HasElementType => HasElementTypeImpl();
+ protected abstract bool HasElementTypeImpl();
+ public abstract Type GetElementType();
+
+ public virtual int GetArrayRank() { throw new NotSupportedException(SR.NotSupported_SubclassOverride); }
+
+ public virtual Type GetGenericTypeDefinition() { throw new NotSupportedException(SR.NotSupported_SubclassOverride); }
+ public virtual Type[] GenericTypeArguments => (IsGenericType && !IsGenericTypeDefinition) ? GetGenericArguments() : Array.Empty<Type>();
+ public virtual Type[] GetGenericArguments() { throw new NotSupportedException(SR.NotSupported_SubclassOverride); }
+
+ public virtual int GenericParameterPosition { get { throw new InvalidOperationException(SR.Arg_NotGenericParameter); } }
+ public virtual GenericParameterAttributes GenericParameterAttributes { get { throw new NotSupportedException(); } }
+ public virtual Type[] GetGenericParameterConstraints()
+ {
+ if (!IsGenericParameter)
+ throw new InvalidOperationException(SR.Arg_NotGenericParameter);
+ throw new InvalidOperationException();
+ }
+
+ public TypeAttributes Attributes => GetAttributeFlagsImpl();
+ protected abstract TypeAttributes GetAttributeFlagsImpl();
+
+ public bool IsAbstract => (GetAttributeFlagsImpl() & TypeAttributes.Abstract) != 0;
+ public bool IsImport => (GetAttributeFlagsImpl() & TypeAttributes.Import) != 0;
+ public bool IsSealed => (GetAttributeFlagsImpl() & TypeAttributes.Sealed) != 0;
+ public bool IsSpecialName => (GetAttributeFlagsImpl() & TypeAttributes.SpecialName) != 0;
+
+ public bool IsClass => (GetAttributeFlagsImpl() & TypeAttributes.ClassSemanticsMask) == TypeAttributes.Class && !IsValueType;
+
+ public bool IsNestedAssembly => (GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.NestedAssembly;
+ public bool IsNestedFamANDAssem => (GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamANDAssem;
+ public bool IsNestedFamily => (GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamily;
+ public bool IsNestedFamORAssem => (GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamORAssem;
+ public bool IsNestedPrivate => (GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPrivate;
+ public bool IsNestedPublic => (GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPublic;
+ public bool IsNotPublic => (GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.NotPublic;
+ public bool IsPublic => (GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.Public;
+
+ public bool IsAutoLayout => (GetAttributeFlagsImpl() & TypeAttributes.LayoutMask) == TypeAttributes.AutoLayout;
+ public bool IsExplicitLayout => (GetAttributeFlagsImpl() & TypeAttributes.LayoutMask) == TypeAttributes.ExplicitLayout;
+ public bool IsLayoutSequential => (GetAttributeFlagsImpl() & TypeAttributes.LayoutMask) == TypeAttributes.SequentialLayout;
+
+ public bool IsAnsiClass => (GetAttributeFlagsImpl() & TypeAttributes.StringFormatMask) == TypeAttributes.AnsiClass;
+ public bool IsAutoClass => (GetAttributeFlagsImpl() & TypeAttributes.StringFormatMask) == TypeAttributes.AutoClass;
+ public bool IsUnicodeClass => (GetAttributeFlagsImpl() & TypeAttributes.StringFormatMask) == TypeAttributes.UnicodeClass;
+
+ public bool IsCOMObject => IsCOMObjectImpl();
+ protected abstract bool IsCOMObjectImpl();
+ public bool IsContextful => IsContextfulImpl();
+ protected virtual bool IsContextfulImpl() => false;
+
+ public virtual bool IsEnum => IsSubclassOf(typeof(Enum));
+ public bool IsMarshalByRef => IsMarshalByRefImpl();
+ protected virtual bool IsMarshalByRefImpl() => false;
+ public bool IsPrimitive => IsPrimitiveImpl();
+ protected abstract bool IsPrimitiveImpl();
+ public bool IsValueType => IsValueTypeImpl();
+ protected virtual bool IsValueTypeImpl() => IsSubclassOf(typeof(ValueType));
+
+ public virtual bool IsSecurityCritical { get { throw NotImplemented.ByDesign; } }
+ public virtual bool IsSecuritySafeCritical { get { throw NotImplemented.ByDesign; } }
+ public virtual bool IsSecurityTransparent { get { throw NotImplemented.ByDesign; } }
+
+ public virtual StructLayoutAttribute StructLayoutAttribute { get { throw new NotSupportedException(); } }
+ public ConstructorInfo TypeInitializer => GetConstructorImpl(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, CallingConventions.Any, Type.EmptyTypes, null);
+
+ public ConstructorInfo GetConstructor(Type[] types) => GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, types, null);
+ public ConstructorInfo GetConstructor(BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers) => GetConstructor(bindingAttr, binder, CallingConventions.Any, types, modifiers);
+ public ConstructorInfo GetConstructor(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
+ {
+ if (types == null)
+ throw new ArgumentNullException(nameof(types));
+ for (int i = 0; i < types.Length; i++)
+ {
+ if (types[i] == null)
+ throw new ArgumentNullException(nameof(types));
+ }
+ return GetConstructorImpl(bindingAttr, binder, callConvention, types, modifiers);
+ }
+ protected abstract ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers);
+
+ public ConstructorInfo[] GetConstructors() => GetConstructors(BindingFlags.Public | BindingFlags.Instance);
+ public abstract ConstructorInfo[] GetConstructors(BindingFlags bindingAttr);
+
+ public EventInfo GetEvent(string name) => GetEvent(name, Type.DefaultLookup);
+ public abstract EventInfo GetEvent(string name, BindingFlags bindingAttr);
+
+ public virtual EventInfo[] GetEvents() => GetEvents(Type.DefaultLookup);
+ public abstract EventInfo[] GetEvents(BindingFlags bindingAttr);
+
+ public FieldInfo GetField(string name) => GetField(name, Type.DefaultLookup);
+ public abstract FieldInfo GetField(string name, BindingFlags bindingAttr);
+
+ public FieldInfo[] GetFields() => GetFields(Type.DefaultLookup);
+ public abstract FieldInfo[] GetFields(BindingFlags bindingAttr);
+
+ public MemberInfo[] GetMember(string name) => GetMember(name, Type.DefaultLookup);
+ public virtual MemberInfo[] GetMember(string name, BindingFlags bindingAttr) => GetMember(name, MemberTypes.All, bindingAttr);
+ public virtual MemberInfo[] GetMember(string name, MemberTypes type, BindingFlags bindingAttr) { throw new NotSupportedException(SR.NotSupported_SubclassOverride); }
+
+ public MemberInfo[] GetMembers() => GetMembers(Type.DefaultLookup);
+ public abstract MemberInfo[] GetMembers(BindingFlags bindingAttr);
+
+ public MethodInfo GetMethod(string name) => GetMethod(name, Type.DefaultLookup);
+ public MethodInfo GetMethod(string name, BindingFlags bindingAttr)
+ {
+ if (name == null)
+ throw new ArgumentNullException(nameof(name));
+ return GetMethodImpl(name, bindingAttr, null, CallingConventions.Any, null, null);
+ }
+
+ public MethodInfo GetMethod(string name, Type[] types) => GetMethod(name, types, null);
+ public MethodInfo GetMethod(string name, Type[] types, ParameterModifier[] modifiers) => GetMethod(name, Type.DefaultLookup, null, types, modifiers);
+ public MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers) => GetMethod(name, bindingAttr, binder, CallingConventions.Any, types, modifiers);
+ public MethodInfo GetMethod(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
+ {
+ if (name == null)
+ throw new ArgumentNullException(nameof(name));
+ if (types == null)
+ throw new ArgumentNullException(nameof(types));
+ for (int i = 0; i < types.Length; i++)
+ {
+ if (types[i] == null)
+ throw new ArgumentNullException(nameof(types));
+ }
+ return GetMethodImpl(name, bindingAttr, binder, callConvention, types, modifiers);
+ }
+
+ protected abstract MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers);
+
+ public MethodInfo[] GetMethods() => GetMethods(Type.DefaultLookup);
+ public abstract MethodInfo[] GetMethods(BindingFlags bindingAttr);
+
+ public Type GetNestedType(string name) => GetNestedType(name, Type.DefaultLookup);
+ public abstract Type GetNestedType(string name, BindingFlags bindingAttr);
+
+ public Type[] GetNestedTypes() => GetNestedTypes(Type.DefaultLookup);
+ public abstract Type[] GetNestedTypes(BindingFlags bindingAttr);
+
+ public PropertyInfo GetProperty(string name) => GetProperty(name, Type.DefaultLookup);
+ public PropertyInfo GetProperty(string name, BindingFlags bindingAttr)
+ {
+ if (name == null)
+ throw new ArgumentNullException(nameof(name));
+ return GetPropertyImpl(name, bindingAttr, null, null, null, null);
+ }
+
+ public PropertyInfo GetProperty(string name, Type returnType)
+ {
+ if (name == null)
+ throw new ArgumentNullException(nameof(name));
+ if (returnType == null)
+ throw new ArgumentNullException(nameof(returnType));
+ return GetPropertyImpl(name, Type.DefaultLookup, null, returnType, null, null);
+ }
+
+ public PropertyInfo GetProperty(string name, Type[] types) => GetProperty(name, null, types);
+ public PropertyInfo GetProperty(string name, Type returnType, Type[] types) => GetProperty(name, returnType, types, null);
+ public PropertyInfo GetProperty(string name, Type returnType, Type[] types, ParameterModifier[] modifiers) => GetProperty(name, Type.DefaultLookup, null, returnType, types, modifiers);
+ public PropertyInfo GetProperty(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
+ {
+ if (name == null)
+ throw new ArgumentNullException(nameof(name));
+ if (types == null)
+ throw new ArgumentNullException(nameof(types));
+ return GetPropertyImpl(name, bindingAttr, binder, returnType, types, modifiers);
+ }
+
+ protected abstract PropertyInfo GetPropertyImpl(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers);
+
+ public PropertyInfo[] GetProperties() => GetProperties(Type.DefaultLookup);
+ public abstract PropertyInfo[] GetProperties(BindingFlags bindingAttr);
+
+ public virtual MemberInfo[] GetDefaultMembers() { throw NotImplemented.ByDesign; }
+
+ public virtual RuntimeTypeHandle TypeHandle { get { throw new NotSupportedException(); } }
+ public static RuntimeTypeHandle GetTypeHandle(object o)
+ {
+ if (o == null)
+ throw new ArgumentNullException(null, SR.Arg_InvalidHandle);
+ Type type = o.GetType();
+ return type.TypeHandle;
+ }
+
+ public static Type[] GetTypeArray(object[] args)
+ {
+ if (args == null)
+ throw new ArgumentNullException(nameof(args));
+
+ Type[] cls = new Type[args.Length];
+ for (int i = 0; i < cls.Length; i++)
+ {
+ if (args[i] == null)
+ throw new ArgumentNullException();
+ cls[i] = args[i].GetType();
+ }
+ return cls;
+ }
+
+ public static TypeCode GetTypeCode(Type type)
+ {
+ if (type == null)
+ return TypeCode.Empty;
+ return type.GetTypeCodeImpl();
+ }
+ protected virtual TypeCode GetTypeCodeImpl()
+ {
+ if (this != UnderlyingSystemType && UnderlyingSystemType != null)
+ return Type.GetTypeCode(UnderlyingSystemType);
+
+ return TypeCode.Object;
+ }
+
+ public abstract Guid GUID { get; }
+
+ public static Type GetTypeFromCLSID(Guid clsid) => GetTypeFromCLSID(clsid, null, throwOnError: false);
+ public static Type GetTypeFromCLSID(Guid clsid, bool throwOnError) => GetTypeFromCLSID(clsid, null, throwOnError: throwOnError);
+ public static Type GetTypeFromCLSID(Guid clsid, string server) => GetTypeFromCLSID(clsid, server, throwOnError: false);
+
+ public static Type GetTypeFromProgID(string progID) => GetTypeFromProgID(progID, null, throwOnError: false);
+ public static Type GetTypeFromProgID(string progID, bool throwOnError) => GetTypeFromProgID(progID, null, throwOnError: throwOnError);
+ public static Type GetTypeFromProgID(string progID, string server) => GetTypeFromProgID(progID, server, throwOnError: false);
+
+ public abstract Type BaseType { get; }
+
+ [DebuggerHidden]
+ [DebuggerStepThrough]
+ public object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, object[] args) => InvokeMember(name, invokeAttr, binder, target, args, null, null, null);
+
+ [DebuggerHidden]
+ [DebuggerStepThrough]
+ public object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, CultureInfo culture) => InvokeMember(name, invokeAttr, binder, target, args, null, culture, null);
+ public abstract object InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters);
+
+ public Type GetInterface(string name) => GetInterface(name, ignoreCase: false);
+ public abstract Type GetInterface(string name, bool ignoreCase);
+ public abstract Type[] GetInterfaces();
+
+ public virtual InterfaceMapping GetInterfaceMap(Type interfaceType) { throw new NotSupportedException(SR.NotSupported_SubclassOverride); }
+
+ public virtual bool IsInstanceOfType(object o) => o == null ? false : IsAssignableFrom(o.GetType());
+ public virtual bool IsEquivalentTo(Type other) => this == other;
+
+ public virtual Type GetEnumUnderlyingType()
+ {
+ if (!IsEnum)
+ throw new ArgumentException(SR.Arg_MustBeEnum, "enumType");
+
+ FieldInfo[] fields = GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
+ if (fields == null || fields.Length != 1)
+ throw new ArgumentException(SR.Argument_InvalidEnum, "enumType");
+
+ return fields[0].FieldType;
+ }
+ public virtual Array GetEnumValues()
+ {
+ if (!IsEnum)
+ throw new ArgumentException(SR.Arg_MustBeEnum, "enumType");
+
+ // We don't support GetEnumValues in the default implementation because we cannot create an array of
+ // a non-runtime type. If there is strong need we can consider returning an object or int64 array.
+ throw NotImplemented.ByDesign;
+ }
+
+ public virtual Type MakeArrayType() { throw new NotSupportedException(); }
+ public virtual Type MakeArrayType(int rank) { throw new NotSupportedException(); }
+ public virtual Type MakeByRefType() { throw new NotSupportedException(); }
+ public virtual Type MakeGenericType(params Type[] typeArguments) { throw new NotSupportedException(SR.NotSupported_SubclassOverride); }
+ public virtual Type MakePointerType() { throw new NotSupportedException(); }
+
+ public override string ToString() => "Type: " + Name; // Why do we add the "Type: " prefix?
+
+ public override bool Equals(object o) => o == null ? false : Equals(o as Type);
+ public override int GetHashCode()
+ {
+ Type systemType = UnderlyingSystemType;
+ if (!object.ReferenceEquals(systemType, this))
+ return systemType.GetHashCode();
+ return base.GetHashCode();
+ }
+ public virtual bool Equals(Type o) => o == null ? false : object.ReferenceEquals(this.UnderlyingSystemType, o.UnderlyingSystemType);
+
+ public static Type ReflectionOnlyGetType(string typeName, bool throwIfNotFound, bool ignoreCase) { throw new PlatformNotSupportedException(SR.PlatformNotSupported_ReflectionOnly); }
+
+ public static Binder DefaultBinder
+ {
+ get
+ {
+ if (s_defaultBinder == null)
+ {
+ DefaultBinder binder = new DefaultBinder();
+ Interlocked.CompareExchange<Binder>(ref s_defaultBinder, binder, null);
+ }
+ return s_defaultBinder;
+ }
+ }
+
+ private static volatile Binder s_defaultBinder;
+
+ public static readonly char Delimiter = '.';
+ public static readonly Type[] EmptyTypes = Array.Empty<Type>();
+ public static readonly object Missing = System.Reflection.Missing.Value;
+
+ public static readonly MemberFilter FilterAttribute = FilterAttributeImpl;
+ public static readonly MemberFilter FilterName = FilterNameImpl;
+ public static readonly MemberFilter FilterNameIgnoreCase = FilterNameIgnoreCaseImpl;
+
+ private const BindingFlags DefaultLookup = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public;
+ }
+}
diff --git a/src/mscorlib/src/System/TypeUnloadedException.cs b/src/mscorlib/shared/System/TypeUnloadedException.cs
index 841a281ea1..a4fb4524ad 100644
--- a/src/mscorlib/src/System/TypeUnloadedException.cs
+++ b/src/mscorlib/shared/System/TypeUnloadedException.cs
@@ -2,16 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*=============================================================================
-**
-**
-**
-** Purpose: Exception class for attempt to access an unloaded class
-**
-**
-=============================================================================*/
-
-
using System.Runtime.Serialization;
namespace System
@@ -20,18 +10,18 @@ namespace System
public class TypeUnloadedException : SystemException
{
public TypeUnloadedException()
- : base(Environment.GetResourceString("Arg_TypeUnloadedException"))
+ : base(SR.Arg_TypeUnloadedException)
{
SetErrorCode(__HResults.COR_E_TYPEUNLOADED);
}
- public TypeUnloadedException(String message)
+ public TypeUnloadedException(string message)
: base(message)
{
SetErrorCode(__HResults.COR_E_TYPEUNLOADED);
}
- public TypeUnloadedException(String message, Exception innerException)
+ public TypeUnloadedException(string message, Exception innerException)
: base(message, innerException)
{
SetErrorCode(__HResults.COR_E_TYPEUNLOADED);
@@ -40,7 +30,8 @@ namespace System
//
// This constructor is required for serialization;
//
- protected TypeUnloadedException(SerializationInfo info, StreamingContext context) : base(info, context)
+ protected TypeUnloadedException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
{
}
}
diff --git a/src/mscorlib/src/System/UnitySerializationHolder.cs b/src/mscorlib/shared/System/UnitySerializationHolder.cs
index 038b9b029a..f1957981d3 100644
--- a/src/mscorlib/src/System/UnitySerializationHolder.cs
+++ b/src/mscorlib/shared/System/UnitySerializationHolder.cs
@@ -3,7 +3,6 @@
// See the LICENSE file in the project root for more information.
-using System.Runtime.Remoting;
using System.Runtime.Serialization;
using System.Reflection;
using System.Globalization;
@@ -15,15 +14,20 @@ namespace System
{
[Serializable]
// Holds classes (Empty, Null, Missing) for which we guarantee that there is only ever one instance of.
- internal class UnitySerializationHolder : ISerializable, IObjectReference
+#if CORECLR
+ internal
+#else
+ public // On CoreRT, this must be public because of the Reflection.Core/CoreLib divide and the need to whitelist past the ReflectionBlock.
+#endif
+ class UnitySerializationHolder : ISerializable, IObjectReference
{
- #region Internal Constants
+#region Internal Constants
internal const int EmptyUnity = 0x0001;
internal const int NullUnity = 0x0002;
internal const int MissingUnity = 0x0003;
internal const int RuntimeTypeUnity = 0x0004;
- internal const int ModuleUnity = 0x0005;
- internal const int AssemblyUnity = 0x0006;
+ public const int ModuleUnity = 0x0005;
+ public const int AssemblyUnity = 0x0006;
internal const int GenericParameterTypeUnity = 0x0007;
internal const int PartialInstantiationTypeUnity = 0x0008;
@@ -31,16 +35,16 @@ namespace System
internal const int Array = 0x0002;
internal const int SzArray = 0x0003;
internal const int ByRef = 0x0004;
- #endregion
+#endregion
- #region Internal Static Members
+#region Internal Static Members
internal static void GetUnitySerializationInfo(SerializationInfo info, Missing missing)
{
info.SetType(typeof(UnitySerializationHolder));
info.AddValue("UnityType", MissingUnity);
}
- internal static RuntimeType AddElementTypes(SerializationInfo info, RuntimeType type)
+ internal static Type AddElementTypes(SerializationInfo info, Type type)
{
List<int> elementTypes = new List<int>();
while (type.HasElementType)
@@ -63,7 +67,7 @@ namespace System
elementTypes.Add(ByRef);
}
- type = (RuntimeType)type.GetElementType();
+ type = type.GetElementType();
}
info.AddValue("ElementTypes", elementTypes.ToArray(), typeof(int[]));
@@ -73,21 +77,21 @@ namespace System
internal Type MakeElementTypes(Type type)
{
- for (int i = m_elementTypes.Length - 1; i >= 0; i--)
+ for (int i = _elementTypes.Length - 1; i >= 0; i--)
{
- if (m_elementTypes[i] == SzArray)
+ if (_elementTypes[i] == SzArray)
{
type = type.MakeArrayType();
}
- else if (m_elementTypes[i] == Array)
+ else if (_elementTypes[i] == Array)
{
- type = type.MakeArrayType(m_elementTypes[--i]);
+ type = type.MakeArrayType(_elementTypes[--i]);
}
- else if ((m_elementTypes[i] == Pointer))
+ else if ((_elementTypes[i] == Pointer))
{
type = type.MakePointerType();
}
- else if ((m_elementTypes[i] == ByRef))
+ else if ((_elementTypes[i] == ByRef))
{
type = type.MakeByRefType();
}
@@ -96,9 +100,15 @@ namespace System
return type;
}
- internal static void GetUnitySerializationInfo(SerializationInfo info, RuntimeType type)
+ public static void GetUnitySerializationInfo(SerializationInfo info, Type type)
{
- if (type.GetRootElementType().IsGenericParameter)
+ Type rootElementType = type;
+ while (rootElementType.HasElementType)
+ {
+ rootElementType = rootElementType.GetElementType();
+ }
+
+ if (rootElementType.IsGenericParameter)
{
type = AddElementTypes(info, type);
info.SetType(typeof(UnitySerializationHolder));
@@ -118,14 +128,14 @@ namespace System
unityType = PartialInstantiationTypeUnity;
type = AddElementTypes(info, type);
info.AddValue("GenericArguments", type.GetGenericArguments(), typeof(Type[]));
- type = (RuntimeType)type.GetGenericTypeDefinition();
+ type = type.GetGenericTypeDefinition();
}
- GetUnitySerializationInfo(info, unityType, type.FullName, type.GetRuntimeAssembly());
+ GetUnitySerializationInfo(info, unityType, type.FullName, type.Assembly);
}
- internal static void GetUnitySerializationInfo(
- SerializationInfo info, int unityType, String data, RuntimeAssembly assembly)
+ public static void GetUnitySerializationInfo(
+ SerializationInfo info, int unityType, string data, Assembly assembly)
{
// A helper method that returns the SerializationInfo that a class utilizing
// UnitySerializationHelper should return from a call to GetObjectData. It contains
@@ -133,14 +143,14 @@ namespace System
// types.)
info.SetType(typeof(UnitySerializationHolder));
- info.AddValue("Data", data, typeof(String));
+ info.AddValue("Data", data, typeof(string));
info.AddValue("UnityType", unityType);
- String assemName;
+ string assemName;
if (assembly == null)
{
- assemName = String.Empty;
+ assemName = string.Empty;
}
else
{
@@ -149,78 +159,78 @@ namespace System
info.AddValue("AssemblyName", assemName);
}
- #endregion
-
- #region Private Data Members
- private Type[] m_instantiation;
- private int[] m_elementTypes;
- private int m_genericParameterPosition;
- private Type m_declaringType;
- private MethodBase m_declaringMethod;
- private String m_data;
- private String m_assemblyName;
- private int m_unityType;
- #endregion
-
- #region Constructor
- internal UnitySerializationHolder(SerializationInfo info, StreamingContext context)
+#endregion
+
+#region Private Data Members
+ private readonly Type[] _instantiation;
+ private readonly int[] _elementTypes;
+ private readonly int _genericParameterPosition;
+ private readonly Type _declaringType;
+ private readonly MethodBase _declaringMethod;
+ private readonly string _data;
+ private readonly string _assemblyName;
+ private int _unityType;
+#endregion
+
+#region Constructor
+ public UnitySerializationHolder(SerializationInfo info, StreamingContext context)
{
if (info == null)
throw new ArgumentNullException(nameof(info));
Contract.EndContractBlock();
- m_unityType = info.GetInt32("UnityType");
+ _unityType = info.GetInt32("UnityType");
- if (m_unityType == MissingUnity)
+ if (_unityType == MissingUnity)
return;
- if (m_unityType == GenericParameterTypeUnity)
+ if (_unityType == GenericParameterTypeUnity)
{
- m_declaringMethod = info.GetValue("DeclaringMethod", typeof(MethodBase)) as MethodBase;
- m_declaringType = info.GetValue("DeclaringType", typeof(Type)) as Type;
- m_genericParameterPosition = info.GetInt32("GenericParameterPosition");
- m_elementTypes = info.GetValue("ElementTypes", typeof(int[])) as int[];
+ _declaringMethod = info.GetValue("DeclaringMethod", typeof(MethodBase)) as MethodBase;
+ _declaringType = info.GetValue("DeclaringType", typeof(Type)) as Type;
+ _genericParameterPosition = info.GetInt32("GenericParameterPosition");
+ _elementTypes = info.GetValue("ElementTypes", typeof(int[])) as int[];
return;
}
- if (m_unityType == PartialInstantiationTypeUnity)
+ if (_unityType == PartialInstantiationTypeUnity)
{
- m_instantiation = info.GetValue("GenericArguments", typeof(Type[])) as Type[];
- m_elementTypes = info.GetValue("ElementTypes", typeof(int[])) as int[];
+ _instantiation = info.GetValue("GenericArguments", typeof(Type[])) as Type[];
+ _elementTypes = info.GetValue("ElementTypes", typeof(int[])) as int[];
}
- m_data = info.GetString("Data");
- m_assemblyName = info.GetString("AssemblyName");
+ _data = info.GetString("Data");
+ _assemblyName = info.GetString("AssemblyName");
}
- #endregion
+#endregion
- #region Private Methods
+#region Private Methods
private void ThrowInsufficientInformation(string field)
{
throw new SerializationException(
- Environment.GetResourceString("Serialization_InsufficientDeserializationState", field));
+ SR.Format(SR.Serialization_InsufficientDeserializationState, field));
}
- #endregion
+#endregion
- #region ISerializable
+#region ISerializable
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_UnitySerHolder"));
+ throw new NotSupportedException(SR.NotSupported_UnitySerHolder);
}
- #endregion
+#endregion
- #region IObjectReference
- public virtual Object GetRealObject(StreamingContext context)
+#region IObjectReference
+ public virtual object GetRealObject(StreamingContext context)
{
- // GetRealObject uses the data we have in m_data and m_unityType to do a lookup on the correct
+ // GetRealObject uses the data we have in _data and _unityType to do a lookup on the correct
// object to return. We have specific code here to handle the different types which we support.
// The reflection types (Assembly, Module, and Type) have to be looked up through their static
// accessors by name.
Assembly assembly;
- switch (m_unityType)
+ switch (_unityType)
{
case EmptyUnity:
{
@@ -239,118 +249,81 @@ namespace System
case PartialInstantiationTypeUnity:
{
- m_unityType = RuntimeTypeUnity;
+ _unityType = RuntimeTypeUnity;
Type definition = GetRealObject(context) as Type;
- m_unityType = PartialInstantiationTypeUnity;
+ _unityType = PartialInstantiationTypeUnity;
- if (m_instantiation[0] == null)
+ if (_instantiation[0] == null)
return null;
- return MakeElementTypes(definition.MakeGenericType(m_instantiation));
+ return MakeElementTypes(definition.MakeGenericType(_instantiation));
}
case GenericParameterTypeUnity:
{
- if (m_declaringMethod == null && m_declaringType == null)
+ if (_declaringMethod == null && _declaringType == null)
ThrowInsufficientInformation("DeclaringMember");
- if (m_declaringMethod != null)
- return m_declaringMethod.GetGenericArguments()[m_genericParameterPosition];
+ if (_declaringMethod != null)
+ return _declaringMethod.GetGenericArguments()[_genericParameterPosition];
- return MakeElementTypes(m_declaringType.GetGenericArguments()[m_genericParameterPosition]);
+ return MakeElementTypes(_declaringType.GetGenericArguments()[_genericParameterPosition]);
}
case RuntimeTypeUnity:
{
- if (m_data == null || m_data.Length == 0)
+ if (_data == null || _data.Length == 0)
ThrowInsufficientInformation("Data");
- if (m_assemblyName == null)
+ if (_assemblyName == null)
ThrowInsufficientInformation("AssemblyName");
- if (m_assemblyName.Length == 0)
- return Type.GetType(m_data, true, false);
+ if (_assemblyName.Length == 0)
+ return Type.GetType(_data, true, false);
- assembly = Assembly.Load(m_assemblyName);
+ assembly = Assembly.Load(_assemblyName);
- Type t = assembly.GetType(m_data, true, false);
+ Type t = assembly.GetType(_data, true, false);
return t;
}
case ModuleUnity:
{
- if (m_data == null || m_data.Length == 0)
+ if (_data == null || _data.Length == 0)
ThrowInsufficientInformation("Data");
- if (m_assemblyName == null)
+ if (_assemblyName == null)
ThrowInsufficientInformation("AssemblyName");
- assembly = Assembly.Load(m_assemblyName);
+ assembly = Assembly.Load(_assemblyName);
- Module namedModule = assembly.GetModule(m_data);
+ Module namedModule = assembly.GetModule(_data);
if (namedModule == null)
throw new SerializationException(
- Environment.GetResourceString("Serialization_UnableToFindModule", m_data, m_assemblyName));
+ SR.Format(SR.Serialization_UnableToFindModule, _data, _assemblyName));
return namedModule;
}
case AssemblyUnity:
{
- if (m_data == null || m_data.Length == 0)
+ if (_data == null || _data.Length == 0)
ThrowInsufficientInformation("Data");
- if (m_assemblyName == null)
+ if (_assemblyName == null)
ThrowInsufficientInformation("AssemblyName");
- assembly = Assembly.Load(m_assemblyName);
+ assembly = Assembly.Load(_assemblyName);
return assembly;
}
default:
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidUnity"));
+ throw new ArgumentException(SR.Argument_InvalidUnity);
}
}
- #endregion
+#endregion
}
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/mscorlib/src/Debug.cs b/src/mscorlib/src/Debug.cs
deleted file mode 100644
index 3398c0e31e..0000000000
--- a/src/mscorlib/src/Debug.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Diagnostics;
-
-namespace System
-{
- internal static class Debug
- {
- [Conditional("_DEBUG")]
- static public void Assert(bool condition)
- {
- BCLDebug.Assert(condition);
- }
-
- [Conditional("_DEBUG")]
- static public void Assert(bool condition, string message)
- {
- BCLDebug.Assert(condition, message);
- }
-
- [Conditional("_DEBUG")]
- static public void Fail(string message)
- {
- BCLDebug.Assert(false, message);
- }
- }
-} \ No newline at end of file
diff --git a/src/mscorlib/src/System/LowLevelConsole.cs b/src/mscorlib/src/Internal/Console.cs
index 8fa29e5fd4..a2a323fa13 100644
--- a/src/mscorlib/src/System/LowLevelConsole.cs
+++ b/src/mscorlib/src/Internal/Console.cs
@@ -2,19 +2,20 @@
// 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.Text;
using System.Security;
using Microsoft.Win32;
using Microsoft.Win32.SafeHandles;
-namespace System
+namespace Internal
{
//
// Simple limited console class for internal printf-style debugging in System.Private.CoreLib
// and low-level tests that want to call System.Private.CoreLib directly
//
- public static class LowLevelConsole
+ public static class Console
{
private static readonly SafeFileHandle _outputHandle =
new SafeFileHandle(Win32Native.GetStdHandle(Win32Native.STD_OUTPUT_HANDLE), false);
@@ -40,26 +41,4 @@ namespace System
Write(Environment.NewLine);
}
}
-
- //
- // Internal wrapper with the regular name for convenience. Note that it cannot be public to avoid colliding
- // with the full Console type.
- //
- internal static class Console
- {
- public static void Write(string s)
- {
- LowLevelConsole.Write(s);
- }
-
- public static void WriteLine(string s)
- {
- LowLevelConsole.WriteLine(s);
- }
-
- public static void WriteLine()
- {
- LowLevelConsole.WriteLine();
- }
- }
}
diff --git a/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Collation.cs b/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Collation.cs
index 79aedd74d3..fe14560a3a 100644
--- a/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Collation.cs
+++ b/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.Collation.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
+using System.Diagnostics;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Security;
@@ -60,6 +61,8 @@ internal static partial class Interop
protected override bool ReleaseHandle()
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
CloseSortHandle(handle);
SetHandle(IntPtr.Zero);
return true;
diff --git a/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.ICU.cs b/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.ICU.cs
new file mode 100644
index 0000000000..c690884145
--- /dev/null
+++ b/src/mscorlib/src/Interop/Unix/System.Globalization.Native/Interop.ICU.cs
@@ -0,0 +1,16 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+
+internal static partial class Interop
+{
+ internal static partial class GlobalizationInterop
+ {
+ [DllImport(Libraries.GlobalizationInterop, EntryPoint = "GlobalizationNative_LoadICU")]
+ internal static extern int LoadICU();
+ }
+}
diff --git a/src/mscorlib/src/Interop/Unix/System.Native/Interop.SysLog.cs b/src/mscorlib/src/Interop/Unix/System.Native/Interop.SysLog.cs
new file mode 100644
index 0000000000..6b6a74b743
--- /dev/null
+++ b/src/mscorlib/src/Interop/Unix/System.Native/Interop.SysLog.cs
@@ -0,0 +1,58 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.InteropServices;
+
+internal static partial class Interop
+{
+ internal static partial class Sys
+ {
+ internal enum SysLogPriority : int
+ {
+ // Priorities
+ LOG_EMERG = 0, /* system is unusable */
+ LOG_ALERT = 1, /* action must be taken immediately */
+ LOG_CRIT = 2, /* critical conditions */
+ LOG_ERR = 3, /* error conditions */
+ LOG_WARNING = 4, /* warning conditions */
+ LOG_NOTICE = 5, /* normal but significant condition */
+ LOG_INFO = 6, /* informational */
+ LOG_DEBUG = 7, /* debug-level messages */
+ // Facilities
+ LOG_KERN = (0<<3), /* kernel messages */
+ LOG_USER = (1<<3), /* random user-level messages */
+ LOG_MAIL = (2<<3), /* mail system */
+ LOG_DAEMON = (3<<3), /* system daemons */
+ LOG_AUTH = (4<<3), /* authorization messages */
+ LOG_SYSLOG = (5<<3), /* messages generated internally by syslogd */
+ LOG_LPR = (6<<3), /* line printer subsystem */
+ LOG_NEWS = (7<<3), /* network news subsystem */
+ LOG_UUCP = (8<<3), /* UUCP subsystem */
+ LOG_CRON = (9<<3), /* clock daemon */
+ LOG_AUTHPRIV = (10<<3), /* authorization messages (private) */
+ LOG_FTP = (11<<3), /* ftp daemon */
+ // Between FTP and Local is reserved for system use
+ LOG_LOCAL0 = (16<<3), /* reserved for local use */
+ LOG_LOCAL1 = (17<<3), /* reserved for local use */
+ LOG_LOCAL2 = (18<<3), /* reserved for local use */
+ LOG_LOCAL3 = (19<<3), /* reserved for local use */
+ LOG_LOCAL4 = (20<<3), /* reserved for local use */
+ LOG_LOCAL5 = (21<<3), /* reserved for local use */
+ LOG_LOCAL6 = (22<<3), /* reserved for local use */
+ LOG_LOCAL7 = (23<<3), /* reserved for local use */
+ }
+
+ /// <summary>
+ /// Write a message to the system logger, which in turn writes the message to the system console, log files, etc.
+ /// See man 3 syslog for more info
+ /// </summary>
+ /// <param name="priority">
+ /// The OR of a priority and facility in the SysLogPriority enum to declare the priority and facility of the log entry
+ /// </param>
+ /// <param name="message">The message to put in the log entry</param>
+ /// <param name="arg1">Like printf, the argument is passed to the variadic part of the C++ function to wildcards in the message</param>
+ [DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_SysLog")]
+ internal static extern void SysLog(SysLogPriority priority, string message, string arg1);
+ }
+}
diff --git a/src/mscorlib/src/Interop/Windows/kernel32/Interop.Globalization.cs b/src/mscorlib/src/Interop/Windows/kernel32/Interop.Globalization.cs
index d187e00f0f..2bb349d670 100644
--- a/src/mscorlib/src/Interop/Windows/kernel32/Interop.Globalization.cs
+++ b/src/mscorlib/src/Interop/Windows/kernel32/Interop.Globalization.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// 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.
diff --git a/src/mscorlib/src/Interop/Windows/kernel32/Interop.OutputDebugString.cs b/src/mscorlib/src/Interop/Windows/kernel32/Interop.OutputDebugString.cs
new file mode 100644
index 0000000000..8da50ff8ab
--- /dev/null
+++ b/src/mscorlib/src/Interop/Windows/kernel32/Interop.OutputDebugString.cs
@@ -0,0 +1,14 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.InteropServices;
+
+internal partial class Interop
+{
+ internal partial class Kernel32
+ {
+ [DllImport(Interop.Libraries.Kernel32, CharSet = CharSet.Unicode, EntryPoint = "OutputDebugStringW", ExactSpelling = true)]
+ internal static extern void OutputDebugString(string message);
+ }
+}
diff --git a/src/mscorlib/src/Microsoft/Win32/Registry.cs b/src/mscorlib/src/Microsoft/Win32/Registry.cs
index 47a6072e96..d0dbb0ff7f 100644
--- a/src/mscorlib/src/Microsoft/Win32/Registry.cs
+++ b/src/mscorlib/src/Microsoft/Win32/Registry.cs
@@ -106,7 +106,7 @@ namespace Microsoft.Win32
basekey = Registry.CurrentConfig;
break;
default:
- throw new ArgumentException(Environment.GetResourceString("Arg_RegInvalidKeyName", nameof(keyName)));
+ throw new ArgumentException(SR.Format(SR.Arg_RegInvalidKeyName, nameof(keyName)));
}
if (i == -1 || i == keyName.Length)
{
diff --git a/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs b/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs
index 89974e4e7f..6524c2e435 100644
--- a/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs
+++ b/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs
@@ -545,7 +545,7 @@ namespace Microsoft.Win32
{
if (options < RegistryValueOptions.None || options > RegistryValueOptions.DoNotExpandEnvironmentNames)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)options), nameof(options));
+ throw new ArgumentException(SR.Format(SR.Arg_EnumIllegalVal, (int)options), nameof(options));
}
bool doNotExpand = (options == RegistryValueOptions.DoNotExpandEnvironmentNames);
CheckPermission(RegistryInternalCheck.CheckValueReadPermission, name, false, RegistryKeyPermissionCheck.Default);
@@ -669,7 +669,7 @@ namespace Microsoft.Win32
}
catch (OverflowException e)
{
- throw new IOException(Environment.GetResourceString("Arg_RegGetOverflowBug"), e);
+ throw new IOException(SR.Arg_RegGetOverflowBug, e);
}
}
char[] blob = new char[datasize / 2];
@@ -699,7 +699,7 @@ namespace Microsoft.Win32
}
catch (OverflowException e)
{
- throw new IOException(Environment.GetResourceString("Arg_RegGetOverflowBug"), e);
+ throw new IOException(SR.Arg_RegGetOverflowBug, e);
}
}
char[] blob = new char[datasize / 2];
@@ -732,7 +732,7 @@ namespace Microsoft.Win32
}
catch (OverflowException e)
{
- throw new IOException(Environment.GetResourceString("Arg_RegGetOverflowBug"), e);
+ throw new IOException(SR.Arg_RegGetOverflowBug, e);
}
}
char[] blob = new char[datasize / 2];
@@ -754,7 +754,7 @@ namespace Microsoft.Win32
}
catch (OverflowException e)
{
- throw new IOException(Environment.GetResourceString("Arg_RegGetOverflowBug"), e);
+ throw new IOException(SR.Arg_RegGetOverflowBug, e);
}
blob[blob.Length - 1] = (char)0;
}
@@ -844,11 +844,11 @@ namespace Microsoft.Win32
if (name != null && name.Length > MaxValueLength)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_RegValStrLenBug"));
+ throw new ArgumentException(SR.Arg_RegValStrLenBug);
}
if (!Enum.IsDefined(typeof(RegistryValueKind), valueKind))
- throw new ArgumentException(Environment.GetResourceString("Arg_RegBadKeyKind"), nameof(valueKind));
+ throw new ArgumentException(SR.Arg_RegBadKeyKind, nameof(valueKind));
EnsureWriteable();
@@ -1013,7 +1013,7 @@ namespace Microsoft.Win32
else if (value is String[])
return RegistryValueKind.MultiString;
else
- throw new ArgumentException(Environment.GetResourceString("Arg_RegSetBadArrType", value.GetType().Name));
+ throw new ArgumentException(SR.Format(SR.Arg_RegSetBadArrType, value.GetType().Name));
}
else
return RegistryValueKind.String;
@@ -1043,7 +1043,7 @@ namespace Microsoft.Win32
{
case Win32Native.ERROR_ACCESS_DENIED:
if (str != null)
- throw new UnauthorizedAccessException(Environment.GetResourceString("UnauthorizedAccess_RegistryKeyGeneric_Key", str));
+ throw new UnauthorizedAccessException(SR.Format(SR.UnauthorizedAccess_RegistryKeyGeneric_Key, str));
else
throw new UnauthorizedAccessException();
@@ -1068,7 +1068,7 @@ namespace Microsoft.Win32
goto default;
case Win32Native.ERROR_FILE_NOT_FOUND:
- throw new IOException(Environment.GetResourceString("Arg_RegKeyNotFound"), errorCode);
+ throw new IOException(SR.Arg_RegKeyNotFound, errorCode);
default:
throw new IOException(Win32Native.GetMessage(errorCode), errorCode);
diff --git a/src/mscorlib/src/Microsoft/Win32/Win32Native.cs b/src/mscorlib/src/Microsoft/Win32/Win32Native.cs
index 6f618c2f64..ee0eb25ead 100644
--- a/src/mscorlib/src/Microsoft/Win32/Win32Native.cs
+++ b/src/mscorlib/src/Microsoft/Win32/Win32Native.cs
@@ -296,7 +296,7 @@ namespace Microsoft.Win32
//
if (bytes == null || bytes.Length != 44)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidREG_TZI_FORMAT"), nameof(bytes));
+ throw new ArgumentException(SR.Argument_InvalidREG_TZI_FORMAT, nameof(bytes));
}
Bias = BitConverter.ToInt32(bytes, 0);
StandardBias = BitConverter.ToInt32(bytes, 4);
@@ -499,7 +499,7 @@ namespace Microsoft.Win32
else
{
StringBuilderCache.Release(sb);
- return Environment.GetResourceString("UnknownError_Num", errorCode);
+ return SR.Format(SR.UnknownError_Num, errorCode);
}
}
@@ -815,9 +815,6 @@ namespace Microsoft.Win32
[DllImport(KERNEL32, CharSet = CharSet.Auto, SetLastError = true)]
internal static extern uint GetCurrentProcessId();
- [DllImport(KERNEL32, CharSet = CharSet.Auto, BestFitMapping = false)]
- internal extern static int GetComputerName([Out]StringBuilder nameBuffer, ref int bufferSize);
-
[DllImport(OLE32)]
internal extern static int CoCreateGuid(out Guid guid);
@@ -974,5 +971,15 @@ namespace Microsoft.Win32
#else
private const int BCRYPT_USE_SYSTEM_PREFERRED_RNG = 0x00000002;
#endif
+
+ internal const byte VER_GREATER_EQUAL = 0x3;
+ internal const uint VER_MAJORVERSION = 0x0000002;
+ internal const uint VER_MINORVERSION = 0x0000001;
+ internal const uint VER_SERVICEPACKMAJOR = 0x0000020;
+ internal const uint VER_SERVICEPACKMINOR = 0x0000010;
+ [DllImport("kernel32.dll")]
+ internal static extern bool VerifyVersionInfoW([In, Out] OSVERSIONINFOEX lpVersionInfo, uint dwTypeMask, ulong dwlConditionMask);
+ [DllImport("kernel32.dll")]
+ internal static extern ulong VerSetConditionMask(ulong dwlConditionMask, uint dwTypeBitMask, byte dwConditionMask);
}
}
diff --git a/src/mscorlib/src/SR.cs b/src/mscorlib/src/SR.cs
deleted file mode 100644
index 9ee565e88c..0000000000
--- a/src/mscorlib/src/SR.cs
+++ /dev/null
@@ -1,879 +0,0 @@
-using System;
-using System.Globalization;
-
-// CoreFX creates SR in the System namespace. While putting the CoreCLR SR adapter in the root
-// may be unconventional, it allows us to keep the shared code identical.
-
-internal static class SR
-{
- public static string Arg_ArrayZeroError
- {
- get { return Environment.GetResourceString("Arg_ArrayZeroError"); }
- }
-
- public static string Arg_ExternalException
- {
- get { return Environment.GetResourceString("Arg_ExternalException"); }
- }
-
- public static string Arg_HexStyleNotSupported
- {
- get { return Environment.GetResourceString("Arg_HexStyleNotSupported"); }
- }
-
- public static string Arg_InvalidHexStyle
- {
- get { return Environment.GetResourceString("Arg_InvalidHexStyle"); }
- }
-
- public static string Arg_OutOfMemoryException
- {
- get { return Environment.GetResourceString("Arg_OutOfMemoryException"); }
- }
-
- public static string ArgumentNull_Array
- {
- get { return Environment.GetResourceString("ArgumentNull_Array"); }
- }
-
- public static string ArgumentNull_ArrayValue
- {
- get { return Environment.GetResourceString("ArgumentNull_ArrayValue"); }
- }
-
- public static string ArgumentNull_Obj
- {
- get { return Environment.GetResourceString("ArgumentNull_Obj"); }
- }
-
- public static string ArgumentNull_String
- {
- get { return Environment.GetResourceString("ArgumentNull_String"); }
- }
-
- public static string ArgumentOutOfRange_AddValue
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_AddValue"); }
- }
-
- public static string ArgumentOutOfRange_BadHourMinuteSecond
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_BadHourMinuteSecond"); }
- }
-
- public static string ArgumentOutOfRange_BadYearMonthDay
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_BadYearMonthDay"); }
- }
-
- public static string ArgumentOutOfRange_Bounds_Lower_Upper
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_Bounds_Lower_Upper"); }
- }
-
- public static string ArgumentOutOfRange_CalendarRange
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_CalendarRange"); }
- }
-
- public static string ArgumentOutOfRange_Count
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_Count"); }
- }
-
- public static string ArgumentOutOfRange_Day
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_Day"); }
- }
-
- public static string ArgumentOutOfRange_Enum
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_Enum"); }
- }
-
- public static string ArgumentOutOfRange_Era
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_Era"); }
- }
-
- public static string ArgumentOutOfRange_Index
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_Index"); }
- }
-
- public static string ArgumentOutOfRange_IndexCountBuffer
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_IndexCountBuffer"); }
- }
-
- public static string ArgumentOutOfRange_InvalidEraValue
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_InvalidEraValue"); }
- }
-
- public static string ArgumentOutOfRange_Month
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_Month"); }
- }
-
- public static string ArgumentOutOfRange_NeedNonNegNum
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"); }
- }
-
- public static string ArgumentOutOfRange_NeedPosNum
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum"); }
- }
-
- public static string Arg_ArgumentOutOfRangeException
- {
- get { return Environment.GetResourceString("Arg_ArgumentOutOfRangeException"); }
- }
-
- public static string ArgumentOutOfRange_OffsetLength
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_OffsetLength"); }
- }
-
- public static string ArgumentOutOfRange_Range
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_Range"); }
- }
-
- public static string Argument_CompareOptionOrdinal
- {
- get { return Environment.GetResourceString("Argument_CompareOptionOrdinal"); }
- }
-
- public static string Argument_ConflictingDateTimeRoundtripStyles
- {
- get { return Environment.GetResourceString("Argument_ConflictingDateTimeRoundtripStyles"); }
- }
-
- public static string Argument_ConflictingDateTimeStyles
- {
- get { return Environment.GetResourceString("Argument_ConflictingDateTimeStyles"); }
- }
-
- public static string Argument_CultureIetfNotSupported
- {
- get { return Environment.GetResourceString("Argument_CultureIetfNotSupported"); }
- }
-
- public static string Argument_CultureInvalidIdentifier
- {
- get { return Environment.GetResourceString("Argument_CultureInvalidIdentifier"); }
- }
-
- public static string Argument_CultureNotSupported
- {
- get { return Environment.GetResourceString("Argument_CultureNotSupported"); }
- }
-
- public static string Argument_CultureIsNeutral
- {
- get { return Environment.GetResourceString("Argument_CultureIsNeutral"); }
- }
-
- public static string Argument_CustomCultureCannotBePassedByNumber
- {
- get { return Environment.GetResourceString("Argument_CustomCultureCannotBePassedByNumber"); }
- }
-
- public static string Argument_EmptyDecString
- {
- get { return Environment.GetResourceString("Argument_EmptyDecString"); }
- }
-
- public static string Argument_IdnBadLabelSize
- {
- get { return Environment.GetResourceString("Argument_IdnBadLabelSize"); }
- }
-
- public static string Argument_IdnBadPunycode
- {
- get { return Environment.GetResourceString("Argument_IdnBadPunycode"); }
- }
-
- public static string Argument_IdnIllegalName
- {
- get { return Environment.GetResourceString("Argument_IdnIllegalName"); }
- }
-
- public static string Argument_InvalidArrayLength
- {
- get { return Environment.GetResourceString("Argument_InvalidArrayLength"); }
- }
-
- public static string Argument_InvalidCalendar
- {
- get { return Environment.GetResourceString("Argument_InvalidCalendar"); }
- }
-
- public static string Argument_InvalidCharSequence
- {
- get { return Environment.GetResourceString("Argument_InvalidCharSequence"); }
- }
-
- public static string Argument_InvalidCharSequenceNoIndex
- {
- get { return Environment.GetResourceString("Argument_InvalidCharSequenceNoIndex"); }
- }
-
- public static string Argument_InvalidCultureName
- {
- get { return Environment.GetResourceString("Argument_InvalidCultureName"); }
- }
-
- public static string Argument_InvalidDateTimeStyles
- {
- get { return Environment.GetResourceString("Argument_InvalidDateTimeStyles"); }
- }
-
- public static string Argument_InvalidDigitSubstitution
- {
- get { return Environment.GetResourceString("Argument_InvalidDigitSubstitution"); }
- }
-
- public static string Argument_InvalidFlag
- {
- get { return Environment.GetResourceString("Argument_InvalidFlag"); }
- }
-
- public static string Argument_InvalidGroupSize
- {
- get { return Environment.GetResourceString("Argument_InvalidGroupSize"); }
- }
-
- public static string Argument_InvalidNativeDigitCount
- {
- get { return Environment.GetResourceString("Argument_InvalidNativeDigitCount"); }
- }
-
- public static string Argument_InvalidNativeDigitValue
- {
- get { return Environment.GetResourceString("Argument_InvalidNativeDigitValue"); }
- }
-
- public static string Argument_InvalidNeutralRegionName
- {
- get { return Environment.GetResourceString("Argument_InvalidNeutralRegionName"); }
- }
-
- public static string Argument_InvalidNumberStyles
- {
- get { return Environment.GetResourceString("Argument_InvalidNumberStyles"); }
- }
-
- public static string Argument_InvalidResourceCultureName
- {
- get { return Environment.GetResourceString("Argument_InvalidResourceCultureName"); }
- }
-
- public static string Argument_NoEra
- {
- get { return Environment.GetResourceString("Argument_NoEra"); }
- }
-
- public static string Argument_NoRegionInvariantCulture
- {
- get { return Environment.GetResourceString("Argument_NoRegionInvariantCulture"); }
- }
-
- public static string Argument_OneOfCulturesNotSupported
- {
- get { return Environment.GetResourceString("Argument_OneOfCulturesNotSupported"); }
- }
-
- public static string Argument_OnlyMscorlib
- {
- get { return Environment.GetResourceString("Argument_OnlyMscorlib"); }
- }
-
- public static string Argument_ResultCalendarRange
- {
- get { return Environment.GetResourceString("Argument_ResultCalendarRange"); }
- }
-
- public static string Format_BadFormatSpecifier
- {
- get { return Environment.GetResourceString("Format_BadFormatSpecifier"); }
- }
-
- public static string InvalidOperation_DateTimeParsing
- {
- get { return Environment.GetResourceString("InvalidOperation_DateTimeParsing"); }
- }
-
- public static string InvalidOperation_EnumEnded
- {
- get { return Environment.GetResourceString("InvalidOperation_EnumEnded"); }
- }
-
- public static string InvalidOperation_EnumNotStarted
- {
- get { return Environment.GetResourceString("InvalidOperation_EnumNotStarted"); }
- }
-
- public static string InvalidOperation_ReadOnly
- {
- get { return Environment.GetResourceString("InvalidOperation_ReadOnly"); }
- }
-
- public static string Overflow_TimeSpanTooLong
- {
- get { return Environment.GetResourceString("Overflow_TimeSpanTooLong"); }
- }
-
- public static string Serialization_MemberOutOfRange
- {
- get { return Environment.GetResourceString("Serialization_MemberOutOfRange"); }
- }
-
- public static string Arg_InvalidHandle
- {
- get { return Environment.GetResourceString("Arg_InvalidHandle"); }
- }
-
- public static string ObjectDisposed_FileClosed
- {
- get { return Environment.GetResourceString("ObjectDisposed_FileClosed"); }
- }
-
- public static string Arg_HandleNotAsync
- {
- get { return Environment.GetResourceString("Arg_HandleNotAsync"); }
- }
-
- public static string ArgumentNull_Path
- {
- get { return Environment.GetResourceString("ArgumentNull_Path"); }
- }
-
- public static string Argument_EmptyPath
- {
- get { return Environment.GetResourceString("Argument_EmptyPath"); }
- }
-
- public static string Argument_InvalidFileModeAndAccessCombo
- {
- get { return Environment.GetResourceString("Argument_InvalidFileMode&AccessCombo"); }
- }
-
- public static string Argument_InvalidAppendMode
- {
- get { return Environment.GetResourceString("Argument_InvalidAppendMode"); }
- }
-
- public static string ArgumentNull_Buffer
- {
- get { return Environment.GetResourceString("ArgumentNull_Buffer"); }
- }
-
- public static string Argument_InvalidOffLen
- {
- get { return Environment.GetResourceString("Argument_InvalidOffLen"); }
- }
-
- public static string IO_UnknownFileName
- {
- get { return Environment.GetResourceString("IO_UnknownFileName"); }
- }
-
- public static string IO_FileStreamHandlePosition
- {
- get { return Environment.GetResourceString("IO.IO_FileStreamHandlePosition"); }
- }
-
- public static string NotSupported_FileStreamOnNonFiles
- {
- get { return Environment.GetResourceString("NotSupported_FileStreamOnNonFiles"); }
- }
-
- public static string IO_BindHandleFailed
- {
- get { return Environment.GetResourceString("IO.IO_BindHandleFailed"); }
- }
-
- public static string Arg_HandleNotSync
- {
- get { return Environment.GetResourceString("Arg_HandleNotSync"); }
- }
-
- public static string IO_SetLengthAppendTruncate
- {
- get { return Environment.GetResourceString("IO.IO_SetLengthAppendTruncate"); }
- }
-
- public static string ArgumentOutOfRange_FileLengthTooBig
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_FileLengthTooBig"); }
- }
-
- public static string Argument_InvalidSeekOrigin
- {
- get { return Environment.GetResourceString("Argument_InvalidSeekOrigin"); }
- }
-
- public static string IO_SeekAppendOverwrite
- {
- get { return Environment.GetResourceString("IO.IO_SeekAppendOverwrite"); }
- }
-
- public static string IO_FileTooLongOrHandleNotSync
- {
- get { return Environment.GetResourceString("IO_FileTooLongOrHandleNotSync"); }
- }
-
- public static string IndexOutOfRange_IORaceCondition
- {
- get { return Environment.GetResourceString("IndexOutOfRange_IORaceCondition"); }
- }
-
- public static string IO_FileNotFound
- {
- get { return Environment.GetResourceString("IO.FileNotFound"); }
- }
-
- public static string IO_FileNotFound_FileName
- {
- get { return Environment.GetResourceString("IO.FileNotFound_FileName"); }
- }
-
- public static string IO_PathNotFound_NoPathName
- {
- get { return Environment.GetResourceString("IO.PathNotFound_NoPathName"); }
- }
-
- public static string IO_PathNotFound_Path
- {
- get { return Environment.GetResourceString("IO.PathNotFound_Path"); }
- }
-
- public static string UnauthorizedAccess_IODenied_NoPathName
- {
- get { return Environment.GetResourceString("UnauthorizedAccess_IODenied_NoPathName"); }
- }
-
- public static string UnauthorizedAccess_IODenied_Path
- {
- get { return Environment.GetResourceString("UnauthorizedAccess_IODenied_Path"); }
- }
-
- public static string IO_AlreadyExists_Name
- {
- get { return Environment.GetResourceString("IO.IO_AlreadyExists_Name"); }
- }
-
- public static string IO_PathTooLong
- {
- get { return Environment.GetResourceString("IO.PathTooLong"); }
- }
-
- public static string IO_SharingViolation_NoFileName
- {
- get { return Environment.GetResourceString("IO.IO_SharingViolation_NoFileName"); }
- }
-
- public static string IO_SharingViolation_File
- {
- get { return Environment.GetResourceString("IO.IO_SharingViolation_File"); }
- }
-
- public static string IO_FileExists_Name
- {
- get { return Environment.GetResourceString("IO.IO_FileExists_Name"); }
- }
-
- public static string NotSupported_UnwritableStream
- {
- get { return Environment.GetResourceString("NotSupported_UnwritableStream"); }
- }
-
- public static string NotSupported_UnreadableStream
- {
- get { return Environment.GetResourceString("NotSupported_UnreadableStream"); }
- }
-
- public static string NotSupported_UnseekableStream
- {
- get { return Environment.GetResourceString("NotSupported_UnseekableStream"); }
- }
-
- public static string IO_EOF_ReadBeyondEOF
- {
- get { return Environment.GetResourceString("IO.EOF_ReadBeyondEOF"); }
- }
-
- public static string Argument_InvalidHandle
- {
- get { return Environment.GetResourceString("Argument_InvalidHandle"); }
- }
-
- public static string Argument_AlreadyBoundOrSyncHandle
- {
- get { return Environment.GetResourceString("Argument_AlreadyBoundOrSyncHandle"); }
- }
-
- public static string Argument_PreAllocatedAlreadyAllocated
- {
- get { return Environment.GetResourceString("Argument_PreAllocatedAlreadyAllocated"); }
- }
-
- public static string Argument_NativeOverlappedAlreadyFree
- {
- get { return Environment.GetResourceString("Argument_NativeOverlappedAlreadyFree"); }
- }
-
- public static string Argument_NativeOverlappedWrongBoundHandle
- {
- get { return Environment.GetResourceString("Argument_NativeOverlappedWrongBoundHandle"); }
- }
-
- public static string InvalidOperation_NativeOverlappedReused
- {
- get { return Environment.GetResourceString("InvalidOperation_NativeOverlappedReused"); }
- }
-
- public static string ArgumentOutOfRange_Length
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_Length"); }
- }
-
- public static string ArgumentOutOfRange_IndexString
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_IndexString"); }
- }
-
- public static string ArgumentOutOfRange_Capacity
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_Capacity"); }
- }
-
- public static string Arg_CryptographyException
- {
- get { return Environment.GetResourceString("Arg_CryptographyException"); }
- }
-
- public static string ArgumentException_BufferNotFromPool
- {
- get { return Environment.GetResourceString("ArgumentException_BufferNotFromPool"); }
- }
-
- public static string Argument_InvalidPathChars
- {
- get { return Environment.GetResourceString("Argument_InvalidPathChars"); }
- }
-
- public static string Argument_PathFormatNotSupported
- {
- get { return Environment.GetResourceString("Argument_PathFormatNotSupported"); }
- }
-
- public static string Arg_PathIllegal
- {
- get { return Environment.GetResourceString("Arg_PathIllegal"); }
- }
-
- public static string Arg_PathIllegalUNC
- {
- get { return Environment.GetResourceString("Arg_PathIllegalUNC"); }
- }
-
- public static string Arg_InvalidSearchPattern
- {
- get { return Environment.GetResourceString("Arg_InvalidSearchPattern"); }
- }
-
- public static string InvalidOperation_Cryptography
- {
- get { return Environment.GetResourceString("InvalidOperation_Cryptography"); }
- }
-
- public static string Format(string formatString, params object[] args)
- {
- return string.Format(CultureInfo.CurrentCulture, formatString, args);
- }
-
- internal static string ArgumentException_ValueTupleIncorrectType
- {
- get { return Environment.GetResourceString("ArgumentException_ValueTupleIncorrectType"); }
- }
-
- internal static string ArgumentException_ValueTupleLastArgumentNotATuple
- {
- get { return Environment.GetResourceString("ArgumentException_ValueTupleLastArgumentNotATuple"); }
- }
-
- internal static string SpinLock_TryEnter_ArgumentOutOfRange
- {
- get { return Environment.GetResourceString("SpinLock_TryEnter_ArgumentOutOfRange"); }
- }
-
- internal static string SpinLock_TryReliableEnter_ArgumentException
- {
- get { return Environment.GetResourceString("SpinLock_TryReliableEnter_ArgumentException"); }
- }
-
- internal static string SpinLock_TryEnter_LockRecursionException
- {
- get { return Environment.GetResourceString("SpinLock_TryEnter_LockRecursionException"); }
- }
-
- internal static string SpinLock_Exit_SynchronizationLockException
- {
- get { return Environment.GetResourceString("SpinLock_Exit_SynchronizationLockException"); }
- }
-
- internal static string SpinLock_IsHeldByCurrentThread
- {
- get { return Environment.GetResourceString("SpinLock_IsHeldByCurrentThread"); }
- }
-
- internal static string ObjectDisposed_StreamIsClosed
- {
- get { return Environment.GetResourceString("ObjectDisposed_StreamIsClosed"); }
- }
-
- internal static string Arg_SystemException
- {
- get { return Environment.GetResourceString("Arg_SystemException"); }
- }
-
- internal static string Arg_StackOverflowException
- {
- get { return Environment.GetResourceString("Arg_StackOverflowException"); }
- }
-
- internal static string Arg_DataMisalignedException
- {
- get { return Environment.GetResourceString("Arg_DataMisalignedException"); }
- }
-
- internal static string Arg_ExecutionEngineException
- {
- get { return Environment.GetResourceString("Arg_ExecutionEngineException"); }
- }
-
- internal static string Arg_AccessException
- {
- get { return Environment.GetResourceString("Arg_AccessException"); }
- }
-
- internal static string Arg_AccessViolationException
- {
- get { return Environment.GetResourceString("Arg_AccessViolationException"); }
- }
-
- internal static string Arg_ApplicationException
- {
- get { return Environment.GetResourceString("Arg_ApplicationException"); }
- }
-
- internal static string Arg_ArgumentException
- {
- get { return Environment.GetResourceString("Arg_ArgumentException"); }
- }
-
- internal static string Arg_ParamName_Name
- {
- get { return Environment.GetResourceString("Arg_ParamName_Name"); }
- }
-
- internal static string ArgumentNull_Generic
- {
- get { return Environment.GetResourceString("ArgumentNull_Generic"); }
- }
-
- internal static string Arg_ArithmeticException
- {
- get { return Environment.GetResourceString("Arg_ArithmeticException"); }
- }
-
- internal static string Arg_ArrayTypeMismatchException
- {
- get { return Environment.GetResourceString("Arg_ArrayTypeMismatchException"); }
- }
-
- internal static string Arg_DivideByZero
- {
- get { return Environment.GetResourceString("Arg_DivideByZero"); }
- }
-
- internal static string Arg_DuplicateWaitObjectException
- {
- get { return Environment.GetResourceString("Arg_DuplicateWaitObjectException"); }
- }
-
- internal static string Arg_EntryPointNotFoundException
- {
- get { return Environment.GetResourceString("Arg_EntryPointNotFoundException"); }
- }
-
- internal static string Arg_FieldAccessException
- {
- get { return Environment.GetResourceString("Arg_FieldAccessException"); }
- }
-
- internal static string Arg_FormatException
- {
- get { return Environment.GetResourceString("Arg_FormatException"); }
- }
-
- internal static string Arg_IndexOutOfRangeException
- {
- get { return Environment.GetResourceString("Arg_IndexOutOfRangeException"); }
- }
-
- internal static string Arg_InsufficientExecutionStackException
- {
- get { return Environment.GetResourceString("Arg_InsufficientExecutionStackException"); }
- }
-
- internal static string Arg_InvalidCastException
- {
- get { return Environment.GetResourceString("Arg_InvalidCastException"); }
- }
-
- internal static string Arg_InvalidOperationException
- {
- get { return Environment.GetResourceString("Arg_InvalidOperationException"); }
- }
-
- internal static string InvalidProgram_Default
- {
- get { return Environment.GetResourceString("InvalidProgram_Default"); }
- }
-
- internal static string Arg_MethodAccessException
- {
- get { return Environment.GetResourceString("Arg_MethodAccessException"); }
- }
-
- internal static string Arg_MulticastNotSupportedException
- {
- get { return Environment.GetResourceString("Arg_MulticastNotSupportedException"); }
- }
-
- internal static string Arg_NotFiniteNumberException
- {
- get { return Environment.GetResourceString("Arg_NotFiniteNumberException"); }
- }
-
- internal static string Arg_NotImplementedException
- {
- get { return Environment.GetResourceString("Arg_NotImplementedException"); }
- }
-
- internal static string Arg_NotSupportedException
- {
- get { return Environment.GetResourceString("Arg_NotSupportedException"); }
- }
-
- internal static string Arg_NullReferenceException
- {
- get { return Environment.GetResourceString("Arg_NullReferenceException"); }
- }
-
- internal static string ObjectDisposed_Generic
- {
- get { return Environment.GetResourceString("ObjectDisposed_Generic"); }
- }
-
- internal static string ObjectDisposed_ObjectName_Name
- {
- get { return Environment.GetResourceString("ObjectDisposed_ObjectName_Name"); }
- }
-
- internal static string Arg_OverflowException
- {
- get { return Environment.GetResourceString("Arg_OverflowException"); }
- }
-
- internal static string Arg_PlatformNotSupported
- {
- get { return Environment.GetResourceString("Arg_PlatformNotSupported"); }
- }
-
- internal static string Arg_RankException
- {
- get { return Environment.GetResourceString("Arg_RankException"); }
- }
-
- internal static string Arg_TimeoutException
- {
- get { return Environment.GetResourceString("Arg_TimeoutException"); }
- }
-
- internal static string Arg_TypeAccessException
- {
- get { return Environment.GetResourceString("Arg_TypeAccessException"); }
- }
-
- internal static string TypeInitialization_Default
- {
- get { return Environment.GetResourceString("TypeInitialization_Default"); }
- }
-
- internal static string TypeInitialization_Type
- {
- get { return Environment.GetResourceString("TypeInitialization_Type"); }
- }
-
- internal static string Arg_UnauthorizedAccessException
- {
- get { return Environment.GetResourceString("Arg_UnauthorizedAccessException"); }
- }
-
- internal static string ArgumentOutOfRange_GenericPositive
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_GenericPositive"); }
- }
-
- internal static string ArgumentOutOfRange_LengthTooLarge
- {
- get { return Environment.GetResourceString("ArgumentOutOfRange_LengthTooLarge"); }
- }
-
- internal static string Arg_ArrayPlusOffTooSmall
- {
- get { return Environment.GetResourceString("Arg_ArrayPlusOffTooSmall"); }
- }
-
- internal static string Arg_KeyNotFound =>
- Environment.GetResourceString("Arg_KeyNotFound");
-
- internal static string PlatformNotSupported_OSXFileLocking =>
- Environment.GetResourceString("PlatformNotSupported_OSXFileLocking");
-
- internal static string UnknownError_Num
- {
- get { return Environment.GetResourceString("UnknownError_Num"); }
- }
-
- internal static string Lazy_ctor_ModeInvalid
- {
- get { return Environment.GetResourceString("Lazy_ctor_ModeInvalid"); }
- }
-
- internal static string Lazy_Value_RecursiveCallsToValue
- {
- get { return Environment.GetResourceString("Lazy_Value_RecursiveCallsToValue"); }
- }
-
- internal static string Lazy_CreateValue_NoParameterlessCtorForT
- {
- get { return Environment.GetResourceString("Lazy_CreateValue_NoParameterlessCtorForT"); }
- }
-
- internal static string Lazy_ToString_ValueNotCreated
- {
- get { return Environment.GetResourceString("Lazy_ToString_ValueNotCreated"); }
- }
-
- internal static string Serialization_NonSerType
- {
- get { return Environment.GetResourceString("Serialization_NonSerType"); }
- }
-}
diff --git a/src/mscorlib/src/System.Private.CoreLib.txt b/src/mscorlib/src/System.Private.CoreLib.txt
deleted file mode 100644
index c24a025d54..0000000000
--- a/src/mscorlib/src/System.Private.CoreLib.txt
+++ /dev/null
@@ -1,1969 +0,0 @@
-; 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.
-
-; These are the managed resources for mscorlib.dll.
-; See those first three bytes in the file? This is in UTF-8. Leave the
-; Unicode byte order mark (U+FEFF) written in UTF-8 at the start of this file.
-
-; For resource info, see the ResourceManager documentation and the ResGen tool,
-; which is a managed app using ResourceWriter.
-; ResGen now supports limited preprocessing of txt files, you can use
-; #if SYMBOL and #if !SYMBOL to control what sets of resources are included in
-; the resulting resources.
-
-; The naming scheme is: [Namespace.] ExceptionName _ Reason
-; We'll suppress "System." where possible.
-; Examples:
-; Argument_Null
-; Reflection.TargetInvokation_someReason
-
-; Usage Notes:
-; * Keep exceptions in alphabetical order by package
-; * A single space may exist on either side of the equal sign.
-; * Follow the naming conventions.
-; * Any lines starting with a '#' or ';' are ignored
-; * Equal signs aren't legal characters for keys, but may occur in values.
-; * Correctly punctuate all sentences. Most resources should end in a period.
-; Remember, your mother will probably read some of these messages.
-; * You may use " (quote), \n and \t. Use \\ for a single '\' character.
-; * String inserts work. i.e., BadNumber_File = Wrong number in file "{0}".
-
-; Real words, used by code like Environment.StackTrace
-#if INCLUDE_RUNTIME
-Word_At = at
-StackTrace_InFileLineNumber = in {0}:line {1}
-UnknownError_Num = Unknown error "{0}".
-AllocatedFrom = Allocated from:
-
-; Note this one is special, used as a divider between stack traces!
-Exception_EndOfInnerExceptionStack = --- End of inner exception stack trace ---
-Exception_WasThrown = Exception of type '{0}' was thrown.
-
-; The following are used in the implementation of ExceptionDispatchInfo
-Exception_EndStackTraceFromPreviousThrow = --- End of stack trace from previous location where exception was thrown ---
-
-Arg_ParamName_Name = Parameter name: {0}
-ArgumentOutOfRange_ActualValue = Actual value was {0}.
-
-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 INCLUDE_DEBUG
-
-; For code contracts
-AssumptionFailed = Assumption failed.
-AssumptionFailed_Cnd = Assumption failed: {0}
-AssertionFailed = Assertion failed.
-AssertionFailed_Cnd = Assertion failed: {0}
-PreconditionFailed = Precondition failed.
-PreconditionFailed_Cnd = Precondition failed: {0}
-PostconditionFailed = Postcondition failed.
-PostconditionFailed_Cnd = Postcondition failed: {0}
-PostconditionOnExceptionFailed = Postcondition failed after throwing an exception.
-PostconditionOnExceptionFailed_Cnd = Postcondition failed after throwing an exception: {0}
-InvariantFailed = Invariant failed.
-InvariantFailed_Cnd = Invariant failed: {0}
-MustUseCCRewrite = An assembly (probably "{1}") must be rewritten using the code contracts binary rewriter (CCRewrite) because it is calling Contract.{0} and the CONTRACTS_FULL symbol is defined. Remove any explicit definitions of the CONTRACTS_FULL symbol from your project and rebuild. CCRewrite can be downloaded from http://go.microsoft.com/fwlink/?LinkID=169180. \r\nAfter the rewriter is installed, it can be enabled in Visual Studio from the project's Properties page on the Code Contracts pane. Ensure that "Perform Runtime Contract Checking" is enabled, which will define CONTRACTS_FULL.
-
-; AccessException
-Acc_CreateGeneric = Cannot create a type for which Type.ContainsGenericParameters is true.
-Acc_CreateAbst = Cannot create an abstract class.
-Acc_CreateInterface = Cannot create an instance of an interface.
-Acc_NotClassInit = Type initializer was not callable.
-Acc_CreateGenericEx = Cannot create an instance of {0} because Type.ContainsGenericParameters is true.
-Acc_CreateArgIterator = Cannot dynamically create an instance of ArgIterator.
-Acc_CreateAbstEx = Cannot create an instance of {0} because it is an abstract class.
-Acc_CreateInterfaceEx = Cannot create an instance of {0} because it is an interface.
-Acc_CreateVoid = Cannot dynamically create an instance of System.Void.
-Acc_ReadOnly = Cannot set a constant field.
-Acc_RvaStatic = SkipVerification permission is needed to modify an image-based (RVA) static field.
-Access_Void = Cannot create an instance of void.
-
-; ArgumentException
-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.
-Argument_AddingDuplicateWithKey = An item with the same key has already been added. Key: {0}
-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.
-Argument_ApplicationTrustShouldHaveIdentity = An ApplicationTrust must have an application identity before it can be persisted.
-Argument_ConversionOverflow = Conversion buffer overflow.
-Argument_CodepageNotSupported = {0} is not a supported code page.
-Argument_CultureNotSupported = Culture is not supported.
-Argument_CultureInvalidIdentifier = {0} is an invalid culture identifier.
-Argument_OneOfCulturesNotSupported = Culture name {0} or {1} is not supported.
-Argument_CultureIetfNotSupported = Culture IETF Name {0} is not a recognized IETF name.
-Argument_CultureIsNeutral = Culture ID {0} (0x{0:X4}) is a neutral culture; a region cannot be created from it.
-Argument_InvalidNeutralRegionName = The region name {0} should not correspond to neutral culture; a specific culture name is required.
-Argument_InvalidGenericInstArray = Generic arguments must be provided for each generic parameter and each generic argument must be a RuntimeType.
-Argument_GenericArgsCount = The number of generic arguments provided doesn't equal the arity of the generic type definition.
-Argument_CultureInvalidFormat = Culture '{0}' is a neutral culture. It cannot be used in formatting and parsing and therefore cannot be set as the thread's current culture.
-Argument_CompareOptionOrdinal = CompareOption.Ordinal cannot be used with other options.
-Argument_CustomCultureCannotBePassedByNumber = Customized cultures cannot be passed by LCID, only by name.
-Argument_EncodingConversionOverflowChars = The output char buffer is too small to contain the decoded characters, encoding '{0}' fallback '{1}'.
-Argument_EncodingConversionOverflowBytes = The output byte buffer is too small to contain the encoded data, encoding '{0}' fallback '{1}'.
-Argument_EncoderFallbackNotEmpty = Must complete Convert() operation or call Encoder.Reset() before calling GetBytes() or GetByteCount(). Encoder '{0}' fallback '{1}'.
-Argument_EmptyFileName = Empty file name is not legal.
-Argument_EmptyPath = Empty path name is not legal.
-Argument_EmptyName = Empty name is not legal.
-Argument_ImplementIComparable = At least one object must implement IComparable.
-Argument_InvalidType = The type of arguments passed into generic comparer methods is invalid.
-Argument_InvalidTypeForCA=Cannot build type parameter for custom attribute with a type that does not support the AssemblyQualifiedName property. The type instance supplied was of type '{0}'.
-Argument_IllegalEnvVarName = Environment variable name cannot contain equal character.
-Argument_IllegalAppId = Application identity does not have same number of components as manifest paths.
-Argument_IllegalAppBase = The application base specified is not valid.
-Argument_UnableToParseManifest = Unexpected error while parsing the specified manifest.
-Argument_IllegalAppIdMismatch = Application identity does not match identities in manifests.
-Argument_InvalidAppId = Invalid identity: no deployment or application identity specified.
-Argument_InvalidGenericArg = The generic type parameter was not valid
-Argument_InvalidArrayLength = Length of the array must be {0}.
-Argument_InvalidArrayType = Target array type is not compatible with the type of items in the collection.
-Argument_InvalidAppendMode = Append access can be requested only in write-only mode.
-Argument_InvalidEnumValue = The value '{0}' is not valid for this usage of the type {1}.
-Argument_EnumIsNotIntOrShort = The underlying type of enum argument must be Int32 or Int16.
-Argument_InvalidEnum = The Enum type should contain one and only one instance field.
-Argument_InvalidKeyStore = '{0}' is not a valid KeyStore name.
-Argument_InvalidFileMode&AccessCombo = Combining FileMode: {0} with FileAccess: {1} is invalid.
-Argument_InvalidFileMode&RightsCombo = Combining FileMode: {0} with FileSystemRights: {1} is invalid.
-Argument_InvalidFileModeTruncate&RightsCombo = Combining FileMode: {0} with FileSystemRights: {1} is invalid. FileMode.Truncate is valid only when used with FileSystemRights.Write.
-Argument_InvalidFlag = Value of flags is invalid.
-Argument_InvalidAnyFlag = No flags can be set.
-Argument_InvalidHandle = The handle is invalid.
-Argument_InvalidRegistryKeyPermissionCheck = The specified RegistryKeyPermissionCheck value is invalid.
-Argument_InvalidRegistryOptionsCheck = The specified RegistryOptions value is invalid.
-Argument_InvalidRegistryViewCheck = The specified RegistryView value is invalid.
-Argument_InvalidSubPath = The directory specified, '{0}', is not a subdirectory of '{1}'.
-Argument_NoRegionInvariantCulture = There is no region associated with the Invariant Culture (Culture ID: 0x7F).
-Argument_ResultCalendarRange = The result is out of the supported range for this calendar. The result should be between {0} (Gregorian date) and {1} (Gregorian date), inclusive.
-Argument_ResultIslamicCalendarRange = The date is out of the supported range for the Islamic calendar. The date should be greater than July 18th, 622 AD (Gregorian date).
-Argument_NeverValidGenericArgument = The type '{0}' may not be used as a type argument.
-Argument_NotEnoughGenArguments = The type or method has {1} generic parameter(s), but {0} generic argument(s) were provided. A generic argument must be provided for each generic parameter.
-Argument_NullFullTrustAssembly = A null StrongName was found in the full trust assembly list.
-Argument_GenConstraintViolation = GenericArguments[{0}], '{1}', on '{2}' violates the constraint of type '{3}'.
-Argument_InvalidToken = Token {0:x} is not valid in the scope of module {1}.
-Argument_InvalidTypeToken = Token {0:x} is not a valid Type token.
-Argument_ResolveType = Token {0:x} is not a valid Type token in the scope of module {1}.
-Argument_ResolveMethod = Token {0:x} is not a valid MethodBase token in the scope of module {1}.
-Argument_ResolveField = Token {0:x} is not a valid FieldInfo token in the scope of module {1}.
-Argument_ResolveMember = Token {0:x} is not a valid MemberInfo token in the scope of module {1}.
-Argument_ResolveString = Token {0:x} is not a valid string token in the scope of module {1}.
-Argument_ResolveModuleType = Token {0} resolves to the special module type representing this module.
-Argument_ResolveMethodHandle = Type handle '{0}' and method handle with declaring type '{1}' are incompatible. Get RuntimeMethodHandle and declaring RuntimeTypeHandle off the same MethodBase.
-Argument_ResolveFieldHandle = Type handle '{0}' and field handle with declaring type '{1}' are incompatible. Get RuntimeFieldHandle and declaring RuntimeTypeHandle off the same FieldInfo.
-Argument_ResourceScopeWrongDirection = Resource type in the ResourceScope enum is going from a more restrictive resource type to a more general one. From: "{0}" To: "{1}"
-Argument_BadResourceScopeTypeBits = Unknown value for the ResourceScope: {0} Too many resource type bits may be set.
-Argument_BadResourceScopeVisibilityBits = Unknown value for the ResourceScope: {0} Too many resource visibility bits may be set.
-Argument_WaitHandleNameTooLong = The name can be no more than {0} characters in length.
-Argument_EnumTypeDoesNotMatch = The argument type, '{0}', is not the same as the enum type '{1}'.
-InvalidOperation_MethodBuilderBaked = The signature of the MethodBuilder can no longer be modified because an operation on the MethodBuilder caused the methodDef token to be created. For example, a call to SetCustomAttribute requires the methodDef token to emit the CustomAttribute token.
-InvalidOperation_GenericParametersAlreadySet = The generic parameters are already defined on this MethodBuilder.
-Arg_AccessException = Cannot access member.
-Arg_AppDomainUnloadedException = Attempted to access an unloaded AppDomain.
-Arg_ApplicationException = Error in the application.
-Arg_ArgumentOutOfRangeException = Specified argument was out of the range of valid values.
-Arg_ArithmeticException = Overflow or underflow in the arithmetic operation.
-Arg_ArrayLengthsDiffer = Array lengths must be the same.
-Arg_ArrayPlusOffTooSmall = Destination array is not long enough to copy all the items in the collection. Check array index and length.
-Arg_ArrayTypeMismatchException = Attempted to access an element as a type incompatible with the array.
-Arg_BadDecimal = Read an invalid decimal value from the buffer.
-Arg_BadImageFormatException = Format of the executable (.exe) or library (.dll) is invalid.
-Argument_BadImageFormatExceptionResolve = A BadImageFormatException has been thrown while parsing the signature. This is likely due to lack of a generic context. Ensure genericTypeArguments and genericMethodArguments are provided and contain enough context.
-Arg_BufferTooSmall = Not enough space available in the buffer.
-Arg_CATypeResolutionFailed = Failed to resolve type from string "{0}" which was embedded in custom attribute blob.
-Arg_CannotHaveNegativeValue = String cannot contain a minus sign if the base is not 10.
-Arg_CannotUnloadAppDomainException = Attempt to unload the AppDomain failed.
-Arg_CannotMixComparisonInfrastructure = The usage of IKeyComparer and IHashCodeProvider/IComparer interfaces cannot be mixed; use one or the other.
-Arg_ContextMarshalException = Attempted to marshal an object across a context boundary.
-Arg_DataMisalignedException = A datatype misalignment was detected in a load or store instruction.
-Arg_DevicesNotSupported = FileStream will not open Win32 devices such as disk partitions and tape drives. Avoid use of "\\\\.\\" in the path.
-Arg_DuplicateWaitObjectException = Duplicate objects in argument.
-Arg_EntryPointNotFoundException = Entry point was not found.
-Arg_DllNotFoundException = Dll was not found.
-Arg_ExecutionEngineException = Internal error in the runtime.
-Arg_FieldAccessException = Attempted to access a field that is not accessible by the caller.
-Arg_FileIsDirectory_Name = The target file "{0}" is a directory, not a file.
-Arg_FormatException = One of the identified items was in an invalid format.
-Arg_IndexOutOfRangeException = Index was outside the bounds of the array.
-Arg_InsufficientExecutionStackException = Insufficient stack to continue executing the program safely. This can happen from having too many functions on the call stack or function on the stack using too much stack space.
-Arg_InvalidCastException = Specified cast is not valid.
-Arg_InvalidOperationException = Operation is not valid due to the current state of the object.
-Arg_CorruptedCustomCultureFile = The file of the custom culture {0} is corrupt. Try to unregister this culture.
-Arg_InvokeMember = InvokeMember can be used only for COM objects.
-Arg_InvalidNeutralResourcesLanguage_Asm_Culture = The NeutralResourcesLanguageAttribute on the assembly "{0}" specifies an invalid culture name: "{1}".
-Arg_InvalidNeutralResourcesLanguage_FallbackLoc = The NeutralResourcesLanguageAttribute specifies an invalid or unrecognized ultimate resource fallback location: "{0}".
-Arg_InvalidSatelliteContract_Asm_Ver = Satellite contract version attribute on the assembly '{0}' specifies an invalid version: {1}.
-Arg_MethodAccessException = Attempt to access the method failed.
-Arg_MethodAccessException_WithMethodName = Attempt to access the method "{0}" on type "{1}" failed.
-Arg_MethodAccessException_WithCaller = Attempt by security transparent method '{0}' to access security critical method '{1}' failed.
-Arg_MissingFieldException = Attempted to access a non-existing field.
-Arg_MissingMemberException = Attempted to access a missing member.
-Arg_MissingMethodException = Attempted to access a missing method.
-Arg_MulticastNotSupportedException = Attempted to add multiple callbacks to a delegate that does not support multicast.
-Arg_NotFiniteNumberException = Number encountered was not a finite quantity.
-Arg_NotSupportedException = Specified method is not supported.
-Arg_UnboundGenParam = Late bound operations cannot be performed on types or methods for which ContainsGenericParameters is true.
-Arg_UnboundGenField = Late bound operations cannot be performed on fields with types for which Type.ContainsGenericParameters is true.
-Arg_NotGenericParameter = Method may only be called on a Type for which Type.IsGenericParameter is true.
-Arg_GenericParameter = Method must be called on a Type for which Type.IsGenericParameter is false.
-Arg_NotGenericTypeDefinition = {0} is not a GenericTypeDefinition. MakeGenericType may only be called on a type for which Type.IsGenericTypeDefinition is true.
-Arg_NotGenericMethodDefinition = {0} is not a GenericMethodDefinition. MakeGenericMethod may only be called on a method for which MethodBase.IsGenericMethodDefinition is true.
-Arg_BadLiteralFormat = Encountered an invalid type for a default value.
-Arg_MissingActivationArguments = The AppDomainSetup must specify the activation arguments for this call.
-Argument_BadParameterTypeForCAB = Cannot emit a CustomAttribute with argument of type {0}.
-Argument_InvalidMemberForNamedArgument = The member must be either a field or a property.
-Argument_InvalidTypeName = The name of the type is invalid.
-
-; Note - don't change the NullReferenceException default message. This was
-; negotiated carefully with the VB team to avoid saying "null" or "nothing".
-Arg_NullReferenceException = Object reference not set to an instance of an object.
-
-Arg_AccessViolationException = Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
-Arg_OverflowException = Arithmetic operation resulted in an overflow.
-Arg_PathGlobalRoot = Paths that begin with \\\\?\\GlobalRoot are internal to the kernel and should not be opened by managed applications.
-Arg_PathIllegal = The path is not of a legal form.
-Arg_PathIllegalUNC = The UNC path should be of the form \\\\server\\share.
-Arg_RankException = Attempted to operate on an array with the incorrect number of dimensions.
-Arg_RankMultiDimNotSupported = Only single dimensional arrays are supported for the requested action.
-Arg_NonZeroLowerBound = The lower bound of target array must be zero.
-Arg_RegSubKeyValueAbsent = No value exists with that name.
-Arg_ResourceFileUnsupportedVersion = The ResourceReader class does not know how to read this version of .resources files. Expected version: {0} This file: {1}
-Arg_ResourceNameNotExist = The specified resource name "{0}" does not exist in the resource file.
-Arg_SecurityException = Security error.
-Arg_SerializationException = Serialization error.
-Arg_StackOverflowException = Operation caused a stack overflow.
-Arg_SurrogatesNotAllowedAsSingleChar = Unicode surrogate characters must be written out as pairs together in the same call, not individually. Consider passing in a character array instead.
-Arg_SynchronizationLockException = Object synchronization method was called from an unsynchronized block of code.
-Arg_RWLockRestoreException = ReaderWriterLock.RestoreLock was called without releasing all locks acquired since the call to ReleaseLock.
-Arg_SystemException = System error.
-Arg_TimeoutException = The operation has timed out.
-Arg_UnauthorizedAccessException = Attempted to perform an unauthorized operation.
-Arg_ArgumentException = Value does not fall within the expected range.
-Arg_DirectoryNotFoundException = Attempted to access a path that is not on the disk.
-Arg_DriveNotFoundException = Attempted to access a drive that is not available.
-Arg_EndOfStreamException = Attempted to read past the end of the stream.
-Arg_HexStyleNotSupported = The number style AllowHexSpecifier is not supported on floating point data types.
-Arg_IOException = I/O error occurred.
-Arg_InvalidHexStyle = With the AllowHexSpecifier bit set in the enum bit field, the only other valid bits that can be combined into the enum value must be a subset of those in HexNumber.
-Arg_KeyNotFound = The given key was not present in the dictionary.
-Argument_InvalidNumberStyles = An undefined NumberStyles value is being used.
-Argument_InvalidDateTimeStyles = An undefined DateTimeStyles value is being used.
-Argument_InvalidTimeSpanStyles = An undefined TimeSpanStyles value is being used.
-Argument_DateTimeOffsetInvalidDateTimeStyles = The DateTimeStyles value 'NoCurrentDateDefault' is not allowed when parsing DateTimeOffset.
-Argument_NativeResourceAlreadyDefined = Native resource has already been defined.
-Argument_BadObjRef = Invalid ObjRef provided to '{0}'.
-Argument_InvalidCultureName = Culture name '{0}' is not supported.
-Argument_NameTooLong = The name '{0}' is too long to be a Culture or Region name, which is limited to {1} characters.
-Argument_NameContainsInvalidCharacters = The name '{0}' contains characters that are not valid for a Culture or Region.
-Argument_InvalidRegionName = Region name '{0}' is not supported.
-Argument_CannotCreateTypedReference = Cannot use function evaluation to create a TypedReference object.
-Arg_ArrayZeroError = Array must not be of length zero.
-Arg_BogusIComparer = Unable to sort because the IComparer.Compare() method returns inconsistent results. Either a value does not compare equal to itself, or one value repeatedly compared to another value yields different results. IComparer: '{0}'.
-Arg_CreatInstAccess = Cannot specify both CreateInstance and another access type.
-Arg_CryptographyException = Error occurred during a cryptographic operation.
-Arg_DateTimeRange = Combination of arguments to the DateTime constructor is out of the legal range.
-Arg_DecBitCtor = Decimal byte array constructor requires an array of length four containing valid decimal bytes.
-Arg_DlgtTargMeth = Cannot bind to the target method because its signature or security transparency is not compatible with that of the delegate type.
-Arg_DlgtTypeMis = Delegates must be of the same type.
-Arg_DlgtNullInst = Delegate to an instance method cannot have null 'this'.
-Arg_DllInitFailure = One machine may not have remote administration enabled, or both machines may not be running the remote registry service.
-Arg_EmptyArray = Array may not be empty.
-Arg_EmptyOrNullArray = Array may not be empty or null.
-Arg_EmptyCollection = Collection must not be empty.
-Arg_EmptyOrNullString = String may not be empty or null.
-Argument_ItemNotExist = The specified item does not exist in this KeyedCollection.
-Argument_EncodingNotSupported = '{0}' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.
-Argument_FallbackBufferNotEmpty = Cannot change fallback when buffer is not empty. Previous Convert() call left data in the fallback buffer.
-Argument_InvalidCodePageConversionIndex = Unable to translate Unicode character \\u{0:X4} at index {1} to specified code page.
-Argument_InvalidCodePageBytesIndex = Unable to translate bytes {0} at index {1} from specified code page to Unicode.
-Argument_RecursiveFallback = Recursive fallback not allowed for character \\u{0:X4}.
-Argument_RecursiveFallbackBytes = Recursive fallback not allowed for bytes {0}.
-Arg_EnumAndObjectMustBeSameType = Object must be the same type as the enum. The type passed in was '{0}'; the enum type was '{1}'.
-Arg_EnumIllegalVal = Illegal enum value: {0}.
-Arg_EnumNotSingleFlag = Must set exactly one flag.
-Arg_EnumAtLeastOneFlag = Must set at least one flag.
-Arg_EnumUnderlyingTypeAndObjectMustBeSameType = Enum underlying type and the object must be same type or object must be a String. Type passed in was '{0}'; the enum underlying type was '{1}'.
-Arg_EnumFormatUnderlyingTypeAndObjectMustBeSameType = Enum underlying type and the object must be same type or object. Type passed in was '{0}'; the enum underlying type was '{1}'.
-Arg_EnumMustHaveUnderlyingValueField = All enums must have an underlying value__ field.
-Arg_COMAccess = Must specify property Set or Get or method call for a COM Object.
-Arg_COMPropSetPut = Only one of the following binding flags can be set: BindingFlags.SetProperty, BindingFlags.PutDispProperty, BindingFlags.PutRefDispProperty.
-Arg_FldSetGet = Cannot specify both Get and Set on a field.
-Arg_PropSetGet = Cannot specify both Get and Set on a property.
-Arg_CannotBeNaN = TimeSpan does not accept floating point Not-a-Number values.
-Arg_FldGetPropSet = Cannot specify both GetField and SetProperty.
-Arg_FldSetPropGet = Cannot specify both SetField and GetProperty.
-Arg_FldSetInvoke = Cannot specify Set on a Field and Invoke on a method.
-Arg_FldGetArgErr = No arguments can be provided to Get a field value.
-Arg_FldSetArgErr = Only the field value can be specified to set a field value.
-Arg_GetMethNotFnd = Property Get method was not found.
-Arg_GuidArrayCtor = Byte array for GUID must be exactly {0} bytes long.
-Arg_HandleNotAsync = Handle does not support asynchronous operations. The parameters to the FileStream constructor may need to be changed to indicate that the handle was opened synchronously (that is, it was not opened for overlapped I/O).
-Arg_HandleNotSync = Handle does not support synchronous operations. The parameters to the FileStream constructor may need to be changed to indicate that the handle was opened asynchronously (that is, it was opened explicitly for overlapped I/O).
-Arg_HTCapacityOverflow = Hashtable's capacity overflowed and went negative. Check load factor, capacity and the current size of the table.
-Arg_IndexMustBeInt = All indexes must be of type Int32.
-Arg_InvalidConsoleColor = The ConsoleColor enum value was not defined on that enum. Please use a defined color from the enum.
-Arg_InvalidFileAttrs = Invalid File or Directory attributes value.
-Arg_InvalidHandle = Invalid handle.
-Arg_InvalidTypeInSignature = The signature Type array contains some invalid type (i.e. null, void)
-Arg_InvalidTypeInRetType = The return Type contains some invalid type (i.e. null, ByRef)
-Arg_EHClauseNotFilter = This ExceptionHandlingClause is not a filter.
-Arg_EHClauseNotClause = This ExceptionHandlingClause is not a clause.
-Arg_ReflectionOnlyCA = It is illegal to reflect on the custom attributes of a Type loaded via ReflectionOnlyGetType (see Assembly.ReflectionOnly) -- use CustomAttributeData instead.
-Arg_ReflectionOnlyInvoke = It is illegal to invoke a method on a Type loaded via ReflectionOnlyGetType.
-Arg_ReflectionOnlyField = It is illegal to get or set the value on a field on a Type loaded via ReflectionOnlyGetType.
-Arg_MemberInfoNullModule = The Module object containing the member cannot be null.
-Arg_ParameterInfoNullMember = The MemberInfo object defining the parameter cannot be null.
-Arg_ParameterInfoNullModule = The Module object containing the parameter cannot be null.
-Arg_AssemblyNullModule = The manifest module of the assembly cannot be null.
-Arg_LongerThanSrcArray = Source array was not long enough. Check the source index, length, and the array's lower bounds.
-Arg_LongerThanDestArray = Destination array was not long enough. Check the destination index, length, and the array's lower bounds.
-Arg_LowerBoundsMustMatch = The arrays' lower bounds must be identical.
-Arg_MustBeBoolean = Object must be of type Boolean.
-Arg_MustBeByte = Object must be of type Byte.
-Arg_MustBeChar = Object must be of type Char.
-Arg_MustBeDateTime = Object must be of type DateTime.
-Arg_MustBeDateTimeOffset = Object must be of type DateTimeOffset.
-Arg_MustBeDecimal = Object must be of type Decimal.
-Arg_MustBeDelegate = Type must derive from Delegate.
-Arg_MustBeDouble = Object must be of type Double.
-Arg_MustBeDriveLetterOrRootDir = Object must be a root directory ("C:\\") or a drive letter ("C").
-Arg_MustBeEnum = Type provided must be an Enum.
-Arg_MustBeEnumBaseTypeOrEnum = The value passed in must be an enum base or an underlying type for an enum, such as an Int32.
-Arg_MustBeGuid = Object must be of type GUID.
-Arg_MustBeIdentityReferenceType = Type must be an IdentityReference, such as NTAccount or SecurityIdentifier.
-Arg_MustBeInterface = Type passed must be an interface.
-Arg_MustBeInt16 = Object must be of type Int16.
-Arg_MustBeInt32 = Object must be of type Int32.
-Arg_MustBeInt64 = Object must be of type Int64.
-Arg_MustBePrimArray = Object must be an array of primitives.
-Arg_MustBePointer = Type must be a Pointer.
-Arg_MustBeStatic = Method must be a static method.
-Arg_MustBeString = Object must be of type String.
-Arg_MustBeStringPtrNotAtom = The pointer passed in as a String must not be in the bottom 64K of the process's address space.
-Arg_MustBeSByte = Object must be of type SByte.
-Arg_MustBeSingle = Object must be of type Single.
-Arg_MustBeTimeSpan = Object must be of type TimeSpan.
-Arg_MustBeType = Type must be a type provided by the runtime.
-Arg_MustBeUInt16 = Object must be of type UInt16.
-Arg_MustBeUInt32 = Object must be of type UInt32.
-Arg_MustBeUInt64 = Object must be of type UInt64.
-Arg_MustBeVersion = Object must be of type Version.
-Arg_MustBeTrue = Argument must be true.
-Arg_MustAllBeRuntimeType = At least one type argument is not a runtime type.
-Arg_NamedParamNull = Named parameter value must not be null.
-Arg_NamedParamTooBig = Named parameter array cannot be bigger than argument array.
-Arg_Need1DArray = Array was not a one-dimensional array.
-Arg_Need2DArray = Array was not a two-dimensional array.
-Arg_Need3DArray = Array was not a three-dimensional array.
-Arg_NeedAtLeast1Rank = Must provide at least one rank.
-Arg_NoDefCTor = No parameterless constructor defined for this object.
-Arg_BitArrayTypeUnsupported = Only supported array types for CopyTo on BitArrays are Boolean[], Int32[] and Byte[].
-Arg_DivideByZero = Attempted to divide by zero.
-Arg_NoAccessSpec = Must specify binding flags describing the invoke operation required (BindingFlags.InvokeMethod CreateInstance GetField SetField GetProperty SetProperty).
-Arg_NoStaticVirtual = Method cannot be both static and virtual.
-Arg_NotFoundIFace = Interface not found.
-Arg_ObjObjEx = Object of type '{0}' cannot be converted to type '{1}'.
-Arg_ObjObj = Object type cannot be converted to target type.
-Arg_FieldDeclTarget = Field '{0}' defined on type '{1}' is not a field on the target object which is of type '{2}'.
-Arg_OleAutDateInvalid = Not a legal OleAut date.
-Arg_OleAutDateScale = OleAut date did not convert to a DateTime correctly.
-Arg_PlatformNotSupported = Operation is not supported on this platform.
-Arg_PlatformSecureString = SecureString is only supported on Windows 2000 SP3 and higher platforms.
-Arg_ParmCnt = Parameter count mismatch.
-Arg_ParmArraySize = Must specify one or more parameters.
-Arg_Path2IsRooted = Second path fragment must not be a drive or UNC name.
-Arg_PathIsVolume = Path must not be a drive.
-Arg_PrimWiden = Cannot widen from source type to target type either because the source type is a not a primitive type or the conversion cannot be accomplished.
-Arg_NullIndex = Arrays indexes must be set to an object instance.
-Arg_VarMissNull = Missing parameter does not have a default value.
-Arg_PropSetInvoke = Cannot specify Set on a property and Invoke on a method.
-Arg_PropNotFound = Could not find the specified property.
-Arg_RankIndices = Indices length does not match the array rank.
-Arg_RanksAndBounds = Number of lengths and lowerBounds must match.
-Arg_RegSubKeyAbsent = Cannot delete a subkey tree because the subkey does not exist.
-Arg_RemoveArgNotFound = Cannot remove the specified item because it was not found in the specified Collection.
-Arg_RegKeyDelHive = Cannot delete a registry hive's subtree.
-Arg_RegKeyNoRemoteConnect = No remote connection to '{0}' while trying to read the registry.
-Arg_RegKeyOutOfRange = Registry HKEY was out of the legal range.
-Arg_RegKeyNotFound = The specified registry key does not exist.
-Arg_RegKeyStrLenBug = Registry key names should not be greater than 255 characters.
-Arg_RegValStrLenBug = Registry value names should not be greater than 16,383 characters.
-Arg_RegBadKeyKind = The specified RegistryValueKind is an invalid value.
-Arg_RegGetOverflowBug = RegistryKey.GetValue does not allow a String that has a length greater than Int32.MaxValue.
-Arg_RegSetMismatchedKind = The type of the value object did not match the specified RegistryValueKind or the object could not be properly converted.
-Arg_RegSetBadArrType = RegistryKey.SetValue does not support arrays of type '{0}'. Only Byte[] and String[] are supported.
-Arg_RegSetStrArrNull = RegistryKey.SetValue does not allow a String[] that contains a null String reference.
-Arg_RegInvalidKeyName = Registry key name must start with a valid base key name.
-Arg_ResMgrNotResSet = Type parameter must refer to a subclass of ResourceSet.
-Arg_SetMethNotFnd = Property set method not found.
-Arg_TypeRefPrimitve = TypedReferences cannot be redefined as primitives.
-Arg_UnknownTypeCode = Unknown TypeCode value.
-Arg_VersionString = Version string portion was too short or too long.
-Arg_NoITypeInfo = Specified TypeInfo was invalid because it did not support the ITypeInfo interface.
-Arg_NoITypeLib = Specified TypeLib was invalid because it did not support the ITypeLib interface.
-Arg_NoImporterCallback = Specified type library importer callback was invalid because it did not support the ITypeLibImporterNotifySink interface.
-Arg_ImporterLoadFailure = The type library importer encountered an error during type verification. Try importing without class members.
-Arg_InvalidBase = Invalid Base.
-Arg_EnumValueNotFound = Requested value '{0}' was not found.
-Arg_EnumLitValueNotFound = Literal value was not found.
-Arg_MustContainEnumInfo = Must specify valid information for parsing in the string.
-Arg_InvalidSearchPattern = Search pattern cannot contain ".." to move up directories and can be contained only internally in file/directory names, as in "a..b".
-Arg_NegativeArgCount = Argument count must not be negative.
-Arg_InvalidAccessEntry = Specified access entry is invalid because it is unrestricted. The global flags should be specified instead.
-Arg_InvalidFileName = Specified file name was invalid.
-Arg_InvalidFileExtension = Specified file extension was not a valid extension.
-Arg_COMException = Error HRESULT E_FAIL has been returned from a call to a COM component.
-Arg_ExternalException = External component has thrown an exception.
-Arg_InvalidComObjectException = Attempt has been made to use a COM object that does not have a backing class factory.
-Arg_InvalidOleVariantTypeException = Specified OLE variant was invalid.
-Arg_MarshalDirectiveException = Marshaling directives are invalid.
-Arg_MarshalAsAnyRestriction = AsAny cannot be used on return types, ByRef parameters, ArrayWithOffset, or parameters passed from unmanaged to managed.
-Arg_NDirectBadObject = No PInvoke conversion exists for value passed to Object-typed parameter.
-Arg_SafeArrayTypeMismatchException = Specified array was not of the expected type.
-Arg_VTableCallsNotSupportedException = Attempted to make an early bound call on a COM dispatch-only interface.
-Arg_SafeArrayRankMismatchException = Specified array was not of the expected rank.
-Arg_AmbiguousMatchException = Ambiguous match found.
-Arg_CustomAttributeFormatException = Binary format of the specified custom attribute was invalid.
-Arg_InvalidFilterCriteriaException = Specified filter criteria was invalid.
-Arg_TypeLoadNullStr = A null or zero length string does not represent a valid Type.
-Arg_TargetInvocationException = Exception has been thrown by the target of an invocation.
-Arg_TargetParameterCountException = Number of parameters specified does not match the expected number.
-Arg_TypeAccessException = Attempt to access the type failed.
-Arg_TypeLoadException = Failure has occurred while loading a type.
-Arg_TypeUnloadedException = Type had been unloaded.
-Arg_ThreadStateException = Thread was in an invalid state for the operation being executed.
-Arg_ThreadStartException = Thread failed to start.
-Arg_WrongAsyncResult = IAsyncResult object did not come from the corresponding async method on this type.
-Arg_WrongType = The value "{0}" is not of type "{1}" and cannot be used in this generic collection.
-Argument_InvalidArgumentForComparison = Type of argument is not compatible with the generic comparer.
-Argument_ALSInvalidCapacity = Specified capacity must not be less than the current capacity.
-Argument_ALSInvalidSlot = Specified slot number was invalid.
-Argument_IdnIllegalName = Decoded string is not a valid IDN name.
-Argument_IdnBadBidi = Left to right characters may not be mixed with right to left characters in IDN labels.
-Argument_IdnBadLabelSize = IDN labels must be between 1 and 63 characters long.
-Argument_IdnBadNameSize = IDN names must be between 1 and {0} characters long.
-Argument_IdnBadPunycode = Invalid IDN encoded string.
-Argument_IdnBadStd3 = Label contains character '{0}' not allowed with UseStd3AsciiRules
-Arg_InvalidANSIString = The ANSI string passed in could not be converted from the default ANSI code page to Unicode.
-Arg_InvalidUTF8String = The UTF8 string passed in could not be converted to Unicode.
-Argument_InvalidCharSequence = Invalid Unicode code point found at index {0}.
-Argument_InvalidCharSequenceNoIndex = String contains invalid Unicode code points.
-Argument_InvalidCalendar = Not a valid calendar for the given culture.
-Argument_InvalidNormalizationForm = Invalid or unsupported normalization form.
-Argument_InvalidPathChars = Illegal characters in path.
-Argument_InvalidOffLen = Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
-Argument_InvalidSeekOrigin = Invalid seek origin.
-Argument_SeekOverflow = The specified seek offset '{0}' would result in a negative Stream position.
-Argument_InvalidUnity = Invalid Unity type.
-Argument_LongEnvVarName = Environment variable name cannot contain 1024 or more characters.
-Argument_LongEnvVarValue = Environment variable name or value is too long.
-Argument_StringFirstCharIsZero = The first char in the string is the null character.
-Argument_OnlyMscorlib = Only mscorlib's assembly is valid.
-Argument_PathEmpty = Path cannot be the empty string or all whitespace.
-Argument_PathFormatNotSupported = The given path's format is not supported.
-Argument_PathUriFormatNotSupported = URI formats are not supported.
-Argument_TypeNameTooLong = Type name was too long. The fully qualified type name must be less than 1,024 characters.
-Argument_StreamNotReadable = Stream was not readable.
-Argument_StreamNotWritable = Stream was not writable.
-Argument_InvalidNumberOfMembers = MemberData contains an invalid number of members.
-Argument_InvalidValue = Value was invalid.
-Argument_InvalidKey = Key was invalid.
-Argument_MinMaxValue = '{0}' cannot be greater than {1}.
-Argument_InvalidGroupSize = Every element in the value array should be between one and nine, except for the last element, which can be zero.
-Argument_MustHaveAttributeBaseClass = Type passed in must be derived from System.Attribute or System.Attribute itself.
-Argument_NoUninitializedStrings = Uninitialized Strings cannot be created.
-Argument_UnequalMembers = Supplied MemberInfo does not match the expected type.
-Argument_BadFormatSpecifier = Format specifier was invalid.
-Argument_InvalidHighSurrogate = Found a high surrogate char without a following low surrogate at index: {0}. The input may not be in this encoding, or may not contain valid Unicode (UTF-16) characters.
-Argument_InvalidLowSurrogate = Found a low surrogate char without a preceding high surrogate at index: {0}. The input may not be in this encoding, or may not contain valid Unicode (UTF-16) characters.
-Argument_UnmatchingSymScope = Non-matching symbol scope.
-Argument_NotInExceptionBlock = Not currently in an exception block.
-Argument_BadExceptionCodeGen = Incorrect code generation for exception block.
-Argument_NotExceptionType = Does not extend Exception.
-Argument_DuplicateResourceName = Duplicate resource name within an assembly.
-Argument_BadPersistableModuleInTransientAssembly = Cannot have a persistable module in a transient assembly.
-Argument_InvalidPermissionState = Invalid permission state.
-Argument_UnrestrictedIdentityPermission = Identity permissions cannot be unrestricted.
-Argument_WrongType = Operation on type '{0}' attempted with target of incorrect type.
-Argument_IllegalZone = Illegal security permission zone specified.
-Argument_HasToBeArrayClass = Must be an array type.
-Argument_InvalidDirectory = Invalid directory, '{0}'.
-Argument_DataLengthDifferent = Parameters 'members' and 'data' must have the same length.
-Argument_SigIsFinalized = Completed signature cannot be modified.
-Argument_ArraysInvalid = Array or pointer types are not valid.
-Argument_GenericsInvalid = Generic types are not valid.
-Argument_LargeInteger = Integer or token was too large to be encoded.
-Argument_BadSigFormat = Incorrect signature format.
-Argument_UnmatchedMethodForLocal = Local passed in does not belong to this ILGenerator.
-Argument_DuplicateName = Tried to add NamedPermissionSet with non-unique name.
-Argument_InvalidXMLElement = Invalid XML. Missing required tag <{0}> for type '{1}'.
-Argument_InvalidXMLMissingAttr = Invalid XML. Missing required attribute '{0}'.
-Argument_CannotGetTypeTokenForByRef = Cannot get TypeToken for a ByRef type.
-Argument_NotASimpleNativeType = The UnmanagedType passed to DefineUnmanagedMarshal is not a simple type. None of the following values may be used: UnmanagedType.ByValTStr, UnmanagedType.SafeArray, UnmanagedType.ByValArray, UnmanagedType.LPArray, UnmanagedType.CustomMarshaler.
-Argument_NotACustomMarshaler = Not a custom marshal.
-Argument_NoUnmanagedElementCount = Unmanaged marshal does not have ElementCount.
-Argument_NoNestedMarshal = Only LPArray or SafeArray has nested unmanaged marshal.
-Argument_InvalidXML = Invalid Xml.
-Argument_NoUnderlyingCCW = The object has no underlying COM data associated with it.
-Argument_BadFieldType = Bad field type in defining field.
-Argument_InvalidXMLBadVersion = Invalid Xml - can only parse elements of version one.
-Argument_NotAPermissionElement = 'elem' was not a permission element.
-Argument_NPMSInvalidName = Name can be neither null nor empty.
-Argument_InvalidElementTag = Invalid element tag '{0}'.
-Argument_InvalidElementText = Invalid element text '{0}'.
-Argument_InvalidElementName = Invalid element name '{0}'.
-Argument_InvalidElementValue = Invalid element value '{0}'.
-Argument_AttributeNamesMustBeUnique = Attribute names must be unique.
-Argument_InvalidHexFormat = Improperly formatted hex string.
-Argument_InvalidSite = Invalid site.
-Argument_InterfaceMap = 'this' type cannot be an interface itself.
-Argument_ArrayGetInterfaceMap = Interface maps for generic interfaces on arrays cannot be retrieved.
-Argument_InvalidName = Invalid name.
-Argument_InvalidDirectoryOnUrl = Invalid directory on URL.
-Argument_InvalidUrl = Invalid URL.
-Argument_InvalidKindOfTypeForCA = This type cannot be represented as a custom attribute.
-Argument_MustSupplyContainer = When supplying a FieldInfo for fixing up a nested type, a valid ID for that containing object must also be supplied.
-Argument_MustSupplyParent = When supplying the ID of a containing object, the FieldInfo that identifies the current field within that object must also be supplied.
-Argument_NoClass = Element does not specify a class.
-Argument_WrongElementType = '{0}' element required.
-Argument_UnableToGeneratePermissionSet = Unable to generate permission set; input XML may be malformed.
-Argument_NoEra = No Era was supplied.
-Argument_AssemblyAlreadyFullTrust = Assembly was already fully trusted.
-Argument_AssemblyNotFullTrust = Assembly was not fully trusted.
-Argument_AssemblyWinMD = Assembly must not be a Windows Runtime assembly.
-Argument_MemberAndArray = Cannot supply both a MemberInfo and an Array to indicate the parent of a value type.
-Argument_ObjNotComObject = The object's type must be __ComObject or derived from __ComObject.
-Argument_ObjIsWinRTObject = The object's type must not be a Windows Runtime type.
-Argument_TypeNotComObject = The type must be __ComObject or be derived from __ComObject.
-Argument_TypeIsWinRTType = The type must not be a Windows Runtime type.
-Argument_CantCallSecObjFunc = Cannot evaluate a security function.
-Argument_StructMustNotBeValueClass = The structure must not be a value class.
-Argument_NoSpecificCulture = Please select a specific culture, such as zh-CN, zh-HK, zh-TW, zh-MO, zh-SG.
-Argument_InvalidResourceCultureName = The given culture name '{0}' cannot be used to locate a resource file. Resource filenames must consist of only letters, numbers, hyphens or underscores.
-Argument_InvalidParamInfo = Invalid type for ParameterInfo member in Attribute class.
-Argument_EmptyDecString = Decimal separator cannot be the empty string.
-Argument_OffsetOfFieldNotFound = Field passed in is not a marshaled member of the type '{0}'.
-Argument_EmptyStrongName = StrongName cannot have an empty string for the assembly name.
-Argument_NotSerializable = Argument passed in is not serializable.
-Argument_EmptyApplicationName = ApplicationId cannot have an empty string for the name.
-Argument_NoDomainManager = The domain manager specified by the host could not be instantiated.
-Argument_NoMain = Main entry point not defined.
-Argument_InvalidDateTimeKind = Invalid DateTimeKind value.
-Argument_ConflictingDateTimeStyles = The DateTimeStyles values AssumeLocal and AssumeUniversal cannot be used together.
-Argument_ConflictingDateTimeRoundtripStyles = The DateTimeStyles value RoundtripKind cannot be used with the values AssumeLocal, AssumeUniversal or AdjustToUniversal.
-Argument_InvalidDigitSubstitution = The DigitSubstitution property must be of a valid member of the DigitShapes enumeration. Valid entries include Context, NativeNational or None.
-Argument_InvalidNativeDigitCount = The NativeDigits array must contain exactly ten members.
-Argument_InvalidNativeDigitValue = Each member of the NativeDigits array must be a single text element (one or more UTF16 code points) with a Unicode Nd (Number, Decimal Digit) property indicating it is a digit.
-ArgumentException_InvalidAceBinaryForm = The binary form of an ACE object is invalid.
-ArgumentException_InvalidAclBinaryForm = The binary form of an ACL object is invalid.
-ArgumentException_InvalidSDSddlForm = The SDDL form of a security descriptor object is invalid.
-Argument_InvalidSafeHandle = The SafeHandle is invalid.
-Argument_CannotPrepareAbstract = Abstract methods cannot be prepared.
-Argument_ArrayTooLarge = The input array length must not exceed Int32.MaxValue / {0}. Otherwise BitArray.Length would exceed Int32.MaxValue.
-Argument_RelativeUrlMembershipCondition = UrlMembershipCondition requires an absolute URL.
-Argument_EmptyWaithandleArray = Waithandle array may not be empty.
-Argument_InvalidSafeBufferOffLen = Offset and length were greater than the size of the SafeBuffer.
-Argument_NotEnoughBytesToRead = There are not enough bytes remaining in the accessor to read at this position.
-Argument_NotEnoughBytesToWrite = There are not enough bytes remaining in the accessor to write at this position.
-Argument_OffsetAndLengthOutOfBounds = Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
-Argument_OffsetAndCapacityOutOfBounds = Offset and capacity were greater than the size of the view.
-Argument_UnmanagedMemAccessorWrapAround = The UnmanagedMemoryAccessor capacity and offset would wrap around the high end of the address space.
-Argument_UnrecognizedLoaderOptimization = Unrecognized LOADER_OPTIMIZATION property value. Supported values may include "SingleDomain", "MultiDomain", "MultiDomainHost", and "NotSpecified".
-ArgumentException_NotAllCustomSortingFuncsDefined = Implementations of all the NLS functions must be provided.
-ArgumentException_MinSortingVersion = The runtime does not support a version of "{0}" less than {1}.
-Argument_PreAllocatedAlreadyAllocated = 'preAllocated' is already in use.
-Argument_NativeOverlappedWrongBoundHandle = 'overlapped' was not allocated by this ThreadPoolBoundHandle instance.
-Argument_NativeOverlappedAlreadyFree = 'overlapped' has already been freed.
-Argument_AlreadyBoundOrSyncHandle = 'handle' has already been bound to the thread pool, or was not opened for asynchronous I/O.
-Argument_InvalidTypeWithPointersNotSupported = Cannot use type '{0}'. Only value types without pointers or references are supported.
-Argument_DestinationTooShort = Destination is too short.
-
-;
-; =====================================================
-; Reflection Emit resource strings
-Arugment_EmitMixedContext1 = Type '{0}' was loaded in the ReflectionOnly context but the AssemblyBuilder was not created as AssemblyBuilderAccess.ReflectionOnly.
-Arugment_EmitMixedContext2 = Type '{0}' was not loaded in the ReflectionOnly context but the AssemblyBuilder was created as AssemblyBuilderAccess.ReflectionOnly.
-Argument_BadSizeForData = Data size must be > 0 and < 0x3f0000
-Argument_InvalidLabel = Invalid Label.
-Argument_RedefinedLabel = Label multiply defined.
-Argument_UnclosedExceptionBlock = The IL Generator cannot be used while there are unclosed exceptions.
-Argument_MissingDefaultConstructor = was missing default constructor.
-Argument_TooManyFinallyClause = Exception blocks may have at most one finally clause.
-Argument_NotInTheSameModuleBuilder = The argument passed in was not from the same ModuleBuilder.
-Argument_BadCurrentLocalVariable = Bad current local variable for setting symbol information.
-Argument_DuplicateModuleName = Duplicate dynamic module name within an assembly.
-Argument_DuplicateTypeName = Duplicate type name within an assembly.
-Argument_InvalidAssemblyName = Assembly names may not begin with whitespace or contain the characters '/', or '\\' or ':'.
-Argument_InvalidGenericInstantiation = The given generic instantiation was invalid.
-Argument_DuplicatedFileName = Duplicate file names.
-Argument_GlobalFunctionHasToBeStatic = Global members must be static.
-Argument_BadPInvokeOnInterface = PInvoke methods cannot exist on interfaces.
-Argument_BadPInvokeMethod = PInvoke methods must be static and native and cannot be abstract.
-Argument_MethodRedefined = Method has been already defined.
-Argument_BadTypeAttrAbstractNFinal = Bad type attributes. A type cannot be both abstract and final.
-Argument_BadTypeAttrNestedVisibilityOnNonNestedType = Bad type attributes. Nested visibility flag set on a non-nested type.
-Argument_BadTypeAttrNonNestedVisibilityNestedType = Bad type attributes. Non-nested visibility flag set on a nested type.
-Argument_BadTypeAttrInvalidLayout = Bad type attributes. Invalid layout attribute specified.
-Argument_BadTypeAttrReservedBitsSet = Bad type attributes. Reserved bits set on the type.
-Argument_BadFieldSig = Field signatures do not have return types.
-Argument_ShouldOnlySetVisibilityFlags = Should only set visibility flags when creating EnumBuilder.
-Argument_BadNestedTypeFlags = Visibility of interfaces must be one of the following: NestedAssembly, NestedFamANDAssem, NestedFamily, NestedFamORAssem, NestedPrivate or NestedPublic.
-Argument_ShouldNotSpecifyExceptionType = Should not specify exception type for catch clause for filter block.
-Argument_BadLabel = Bad label in ILGenerator.
-Argument_BadLabelContent = Bad label content in ILGenerator.
-Argument_EmitWriteLineType = EmitWriteLine does not support this field or local type.
-Argument_ConstantNull = Null is not a valid constant value for this type.
-Argument_ConstantDoesntMatch = Constant does not match the defined type.
-Argument_ConstantNotSupported = {0} is not a supported constant type.
-Argument_BadConstructor = Cannot have private or static constructor.
-Argument_BadConstructorCallConv = Constructor must have standard calling convention.
-Argument_BadPropertyForConstructorBuilder = Property must be on the same type of the given ConstructorInfo.
-Argument_NotAWritableProperty = Not a writable property.
-Argument_BadFieldForConstructorBuilder = Field must be on the same type of the given ConstructorInfo.
-Argument_BadAttributeOnInterfaceMethod = Interface method must be abstract and virtual.
-ArgumentException_BadMethodImplBody = MethodOverride's body must be from this type.
-Argument_BadParameterCountsForConstructor = Parameter count does not match passed in argument value count.
-Argument_BadParameterTypeForConstructor = Passed in argument value at index {0} does not match the parameter type.
-Argument_BadTypeInCustomAttribute = An invalid type was used as a custom attribute constructor argument, field or property.
-Argument_DateTimeBadBinaryData = The binary data must result in a DateTime with ticks between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.
-Argument_VerStringTooLong = The unmanaged Version information is too large to persist.
-Argument_UnknownUnmanagedCallConv = Unknown unmanaged calling convention for function signature.
-Argument_BadConstantValue = Bad default value.
-Argument_IllegalName = Illegal name.
-Argument_cvtres_NotFound = Cannot find cvtres.exe
-Argument_BadCAForUnmngRSC = Bad '{0}' while generating unmanaged resource information.
-Argument_MustBeInterfaceMethod = The MemberInfo must be an interface method.
-Argument_CORDBBadVarArgCallConv = Cannot evaluate a VarArgs function.
-Argument_CORDBBadMethod = Cannot find the method on the object instance.
-Argument_InvalidOpCodeOnDynamicMethod = Ldtoken, Ldftn and Ldvirtftn OpCodes cannot target DynamicMethods.
-Argument_InvalidTypeForDynamicMethod = Invalid type owner for DynamicMethod.
-Argument_NeedGenericMethodDefinition = Method must represent a generic method definition on a generic type definition.
-Argument_MethodNeedGenericDeclaringType = The specified method cannot be dynamic or global and must be declared on a generic type definition.
-Argument_ConstructorNeedGenericDeclaringType = The specified constructor must be declared on a generic type definition.
-Argument_FieldNeedGenericDeclaringType = The specified field must be declared on a generic type definition.
-Argument_InvalidMethodDeclaringType = The specified method must be declared on the generic type definition of the specified type.
-Argument_InvalidConstructorDeclaringType = The specified constructor must be declared on the generic type definition of the specified type.
-Argument_InvalidFieldDeclaringType = The specified field must be declared on the generic type definition of the specified type.
-Argument_NeedNonGenericType = The specified Type must not be a generic type definition.
-Argument_MustBeTypeBuilder = 'type' must contain a TypeBuilder as a generic argument.
-Argument_CannotSetParentToInterface = Cannot set parent to an interface.
-Argument_MismatchedArrays = Two arrays, {0} and {1}, must be of the same size.
-Argument_NeedNonGenericObject = The specified object must not be an instance of a generic type.
-Argument_NeedStructWithNoRefs = The specified Type must be a struct containing no references.
-Argument_NotMethodCallOpcode = The specified opcode cannot be passed to EmitCall.
-
-; =====================================================
-;
-Argument_ModuleAlreadyLoaded = The specified module has already been loaded.
-Argument_MustHaveLayoutOrBeBlittable = The specified structure must be blittable or have layout information.
-Argument_NotSimpleFileName = The filename must not include a path specification.
-Argument_TypeMustBeVisibleFromCom = The specified type must be visible from COM.
-Argument_TypeMustBeComCreatable = The type must be creatable from COM.
-Argument_TypeMustNotBeComImport = The type must not be imported from COM.
-Argument_PolicyFileDoesNotExist = The requested policy file does not exist.
-Argument_NonNullObjAndCtx = Either obj or ctx must be null.
-Argument_NoModuleFileExtension = Module file name '{0}' must have file extension.
-Argument_TypeDoesNotContainMethod = Type does not contain the given method.
-Argument_StringZeroLength = String cannot be of zero length.
-Argument_MustBeString = String is too long or has invalid contents.
-Argument_AbsolutePathRequired = Absolute path information is required.
-Argument_ManifestFileDoesNotExist = The specified manifest file does not exist.
-Argument_MustBeRuntimeType = Type must be a runtime Type object.
-Argument_TypeNotValid = The Type object is not valid.
-Argument_MustBeRuntimeMethodInfo = MethodInfo must be a runtime MethodInfo object.
-Argument_MustBeRuntimeFieldInfo = FieldInfo must be a runtime FieldInfo object.
-Argument_InvalidFieldInfo = The FieldInfo object is not valid.
-Argument_InvalidConstructorInfo = The ConstructorInfo object is not valid.
-Argument_MustBeRuntimeAssembly = Assembly must be a runtime Assembly object.
-Argument_MustBeRuntimeModule = Module must be a runtime Module object.
-Argument_MustBeRuntimeParameterInfo = ParameterInfo must be a runtime ParameterInfo object.
-Argument_InvalidParameterInfo = The ParameterInfo object is not valid.
-Argument_MustBeRuntimeReflectionObject = The object must be a runtime Reflection object.
-Argument_InvalidMarshalByRefObject = The MarshalByRefObject is not valid.
-Argument_TypedReferenceInvalidField = Field in TypedReferences cannot be static or init only.
-Argument_HandleLeak = Cannot pass a GCHandle across AppDomains.
-Argument_ArgumentZero = Argument cannot be zero.
-Argument_ImproperType = Improper types in collection.
-Argument_NotAMembershipCondition = The type does not implement IMembershipCondition
-Argument_NotAPermissionType = The type does not implement IPermission
-Argument_NotACodeGroupType = The type does not inherit from CodeGroup
-Argument_NotATP = Type must be a TransparentProxy
-Argument_AlreadyACCW = The object already has a CCW associated with it.
-Argument_OffsetLocalMismatch = The UTC Offset of the local dateTime parameter does not match the offset argument.
-Argument_OffsetUtcMismatch = The UTC Offset for Utc DateTime instances must be 0.
-Argument_UTCOutOfRange = The UTC time represented when the offset is applied must be between year 0 and 10,000.
-Argument_OffsetOutOfRange = Offset must be within plus or minus 14 hours.
-Argument_OffsetPrecision = Offset must be specified in whole minutes.
-Argument_FlagNotSupported = One or more flags are not supported.
-Argument_MustBeFalse = Argument must be initialized to false
-Argument_ToExclusiveLessThanFromExclusive = fromInclusive must be less than or equal to toExclusive.
-Argument_FrameworkNameTooShort=FrameworkName cannot have less than two components or more than three components.
-Argument_FrameworkNameInvalid=FrameworkName is invalid.
-Argument_FrameworkNameMissingVersion=FrameworkName version component is missing.
-#if FEATURE_COMINTEROP
-Argument_TypeNotActivatableViaWindowsRuntime = Type '{0}' does not have an activation factory because it is not activatable by Windows Runtime.
-Argument_WinRTSystemRuntimeType = Cannot marshal type '{0}' to Windows Runtime. Only 'System.RuntimeType' is supported.
-Argument_Unexpected_TypeSource = Unexpected TypeKind when marshaling Windows.Foundation.TypeName.
-#endif // FEATURE_COMINTEROP
-
-; ArgumentNullException
-ArgumentNull_Array = Array cannot be null.
-ArgumentNull_ArrayValue = Found a null value within an array.
-ArgumentNull_ArrayElement = At least one element in the specified array was null.
-ArgumentNull_Assembly = Assembly cannot be null.
-ArgumentNull_AssemblyName = AssemblyName cannot be null.
-ArgumentNull_AssemblyNameName = AssemblyName.Name cannot be null or an empty string.
-ArgumentNull_Buffer = Buffer cannot be null.
-ArgumentNull_Collection = Collection cannot be null.
-ArgumentNull_CultureInfo = CultureInfo cannot be null.
-ArgumentNull_Dictionary = Dictionary cannot be null.
-ArgumentNull_FileName = File name cannot be null.
-ArgumentNull_Key = Key cannot be null.
-ArgumentNull_Graph = Object Graph cannot be null.
-ArgumentNull_Path = Path cannot be null.
-ArgumentNull_Stream = Stream cannot be null.
-ArgumentNull_String = String reference not set to an instance of a String.
-ArgumentNull_Type = Type cannot be null.
-ArgumentNull_Obj = Object cannot be null.
-ArgumentNull_GUID = GUID cannot be null.
-ArgumentNull_NullMember = Member at position {0} was null.
-ArgumentNull_Generic = Value cannot be null.
-ArgumentNull_WithParamName = Parameter '{0}' cannot be null.
-ArgumentNull_Child = Cannot have a null child.
-ArgumentNull_SafeHandle = SafeHandle cannot be null.
-ArgumentNull_CriticalHandle = CriticalHandle cannot be null.
-ArgumentNull_TypedRefType = Type in TypedReference cannot be null.
-ArgumentNull_ApplicationTrust = The application trust cannot be null.
-ArgumentNull_TypeRequiredByResourceScope = The type parameter cannot be null when scoping the resource's visibility to Private or Assembly.
-ArgumentNull_Waithandles = The waitHandles parameter cannot be null.
-
-; ArgumentOutOfRangeException
-ArgumentOutOfRange_AddressSpace = The number of bytes cannot exceed the virtual address space on a 32 bit machine.
-ArgumentOutOfRange_ArrayLB = Number was less than the array's lower bound in the first dimension.
-ArgumentOutOfRange_ArrayLBAndLength = Higher indices will exceed Int32.MaxValue because of large lower bound and/or length.
-ArgumentOutOfRange_ArrayLength = The length of the array must be between {0} and {1}, inclusive.
-ArgumentOutOfRange_ArrayLengthMultiple = The length of the array must be a multiple of {0}.
-ArgumentOutOfRange_ArrayListInsert = Insertion index was out of range. Must be non-negative and less than or equal to size.
-ArgumentOutOfRange_ArrayTooSmall = Destination array is not long enough to copy all the required data. Check array length and offset.
-ArgumentOutOfRange_BeepFrequency = Console.Beep's frequency must be between {0} and {1}.
-ArgumentOutOfRange_BiggerThanCollection = Larger than collection size.
-ArgumentOutOfRange_Bounds_Lower_Upper = Argument must be between {0} and {1}.
-ArgumentOutOfRange_Count = Count must be positive and count must refer to a location within the string/array/collection.
-ArgumentOutOfRange_CalendarRange = Specified time is not supported in this calendar. It should be between {0} (Gregorian date) and {1} (Gregorian date), inclusive.
-ArgumentOutOfRange_ConsoleBufferBoundaries = The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
-ArgumentOutOfRange_ConsoleBufferLessThanWindowSize = The console buffer size must not be less than the current size and position of the console window, nor greater than or equal to Int16.MaxValue.
-ArgumentOutOfRange_ConsoleWindowBufferSize = The new console window size would force the console buffer size to be too large.
-ArgumentOutOfRange_ConsoleTitleTooLong = The console title is too long.
-ArgumentOutOfRange_ConsoleWindowPos = The window position must be set such that the current window size fits within the console's buffer, and the numbers must not be negative.
-ArgumentOutOfRange_ConsoleWindowSize_Size = The value must be less than the console's current maximum window size of {0} in that dimension. Note that this value depends on screen resolution and the console font.
-ArgumentOutOfRange_ConsoleKey = Console key values must be between 0 and 255.
-ArgumentOutOfRange_CursorSize = The cursor size is invalid. It must be a percentage between 1 and 100.
-ArgumentOutOfRange_BadYearMonthDay = Year, Month, and Day parameters describe an un-representable DateTime.
-ArgumentOutOfRange_BadHourMinuteSecond = Hour, Minute, and Second parameters describe an un-representable DateTime.
-ArgumentOutOfRange_DateArithmetic = The added or subtracted value results in an un-representable DateTime.
-ArgumentOutOfRange_DateTimeBadMonths = Months value must be between +/-120000.
-ArgumentOutOfRange_DateTimeBadYears = Years value must be between +/-10000.
-ArgumentOutOfRange_DateTimeBadTicks = Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.
-ArgumentOutOfRange_Day = Day must be between 1 and {0} for month {1}.
-ArgumentOutOfRange_DecimalRound = Decimal can only round to between 0 and 28 digits of precision.
-ArgumentOutOfRange_DecimalScale = Decimal's scale value must be between 0 and 28, inclusive.
-ArgumentOutOfRange_Era = Time value was out of era range.
-ArgumentOutOfRange_Enum = Enum value was out of legal range.
-ArgumentOutOfRange_FileLengthTooBig = Specified file length was too large for the file system.
-ArgumentOutOfRange_FileTimeInvalid = Not a valid Win32 FileTime.
-ArgumentOutOfRange_GetByteCountOverflow = Too many characters. The resulting number of bytes is larger than what can be returned as an int.
-ArgumentOutOfRange_GetCharCountOverflow = Too many bytes. The resulting number of chars is larger than what can be returned as an int.
-ArgumentOutOfRange_HashtableLoadFactor = Load factor needs to be between 0.1 and 1.0.
-ArgumentOutOfRange_HugeArrayNotSupported = Arrays larger than 2GB are not supported.
-ArgumentOutOfRange_InvalidHighSurrogate = A valid high surrogate character is between 0xd800 and 0xdbff, inclusive.
-ArgumentOutOfRange_InvalidLowSurrogate = A valid low surrogate character is between 0xdc00 and 0xdfff, inclusive.
-ArgumentOutOfRange_InvalidEraValue = Era value was not valid.
-ArgumentOutOfRange_InvalidUserDefinedAceType = User-defined ACEs must not have a well-known ACE type.
-ArgumentOutOfRange_InvalidUTF32 = A valid UTF32 value is between 0x000000 and 0x10ffff, inclusive, and should not include surrogate codepoint values (0x00d800 ~ 0x00dfff).
-ArgumentOutOfRange_Index = Index was out of range. Must be non-negative and less than the size of the collection.
-ArgumentOutOfRange_IndexString = Index was out of range. Must be non-negative and less than the length of the string.
-ArgumentOutOfRange_StreamLength = Stream length must be non-negative and less than 2^31 - 1 - origin.
-ArgumentOutOfRange_LessEqualToIntegerMaxVal = Argument must be less than or equal to 2^31 - 1 milliseconds.
-ArgumentOutOfRange_Month = Month must be between one and twelve.
-ArgumentOutOfRange_MustBeNonNegInt32 = Value must be non-negative and less than or equal to Int32.MaxValue.
-ArgumentOutOfRange_NeedNonNegNum = Non-negative number required.
-ArgumentOutOfRange_NeedNonNegOrNegative1 = Number must be either non-negative and less than or equal to Int32.MaxValue or -1.
-ArgumentOutOfRange_NeedPosNum = Positive number required.
-ArgumentOutOfRange_NegativeCapacity = Capacity must be positive.
-ArgumentOutOfRange_NegativeCount = Count cannot be less than zero.
-ArgumentOutOfRange_NegativeLength = Length cannot be less than zero.
-ArgumentOutOfRange_NegFileSize = Length must be non-negative.
-ArgumentOutOfRange_ObjectID = objectID cannot be less than or equal to zero.
-ArgumentOutOfRange_SmallCapacity = capacity was less than the current size.
-ArgumentOutOfRange_QueueGrowFactor = Queue grow factor must be between {0} and {1}.
-ArgumentOutOfRange_RoundingDigits = Rounding digits must be between 0 and 15, inclusive.
-ArgumentOutOfRange_StartIndex = StartIndex cannot be less than zero.
-ArgumentOutOfRange_MustBePositive = '{0}' must be greater than zero.
-ArgumentOutOfRange_MustBeNonNegNum = '{0}' must be non-negative.
-ArgumentOutOfRange_LengthGreaterThanCapacity = The length cannot be greater than the capacity.
-ArgumentOutOfRange_ListInsert = Index must be within the bounds of the List.
-ArgumentOutOfRange_StartIndexLessThanLength = startIndex must be less than length of string.
-ArgumentOutOfRange_StartIndexLargerThanLength = startIndex cannot be larger than length of string.
-ArgumentOutOfRange_EndIndexStartIndex = endIndex cannot be greater than startIndex.
-ArgumentOutOfRange_IndexCount = Index and count must refer to a location within the string.
-ArgumentOutOfRange_IndexCountBuffer = Index and count must refer to a location within the buffer.
-ArgumentOutOfRange_IndexLength = Index and length must refer to a location within the string.
-ArgumentOutOfRange_InvalidThreshold = The specified threshold for creating dictionary is out of range.
-ArgumentOutOfRange_Capacity = Capacity exceeds maximum capacity.
-ArgumentOutOfRange_Length = The specified length exceeds maximum capacity of SecureString.
-ArgumentOutOfRange_LengthTooLarge = The specified length exceeds the maximum value of {0}.
-ArgumentOutOfRange_SmallMaxCapacity = MaxCapacity must be one or greater.
-ArgumentOutOfRange_GenericPositive = Value must be positive.
-ArgumentOutOfRange_Range = Valid values are between {0} and {1}, inclusive.
-ArgumentOutOfRange_AddValue = Value to add was out of range.
-ArgumentOutOfRange_OffsetLength = Offset and length must refer to a position in the string.
-ArgumentOutOfRange_OffsetOut = Either offset did not refer to a position in the string, or there is an insufficient length of destination character array.
-ArgumentOutOfRange_PartialWCHAR = Pointer startIndex and length do not refer to a valid string.
-ArgumentOutOfRange_ParamSequence = The specified parameter index is not in range.
-ArgumentOutOfRange_Version = Version's parameters must be greater than or equal to zero.
-ArgumentOutOfRange_TimeoutTooLarge = Time-out interval must be less than 2^32-2.
-ArgumentOutOfRange_UIntPtrMax-1 = The length of the buffer must be less than the maximum UIntPtr value for your platform.
-ArgumentOutOfRange_UnmanagedMemStreamLength = UnmanagedMemoryStream length must be non-negative and less than 2^63 - 1 - baseAddress.
-ArgumentOutOfRange_UnmanagedMemStreamWrapAround = The UnmanagedMemoryStream capacity would wrap around the high end of the address space.
-ArgumentOutOfRange_PeriodTooLarge = Period must be less than 2^32-2.
-ArgumentOutOfRange_Year = Year must be between 1 and 9999.
-ArgumentOutOfRange_BinaryReaderFillBuffer = The number of bytes requested does not fit into BinaryReader's internal buffer.
-ArgumentOutOfRange_PositionLessThanCapacityRequired = The position may not be greater or equal to the capacity of the accessor.
-
-; ArithmeticException
-Arithmetic_NaN = Function does not accept floating point Not-a-Number values.
-
-; ArrayTypeMismatchException
-ArrayTypeMismatch_CantAssignType = Source array type cannot be assigned to destination array type.
-ArrayTypeMismatch_ConstrainedCopy = Array.ConstrainedCopy will only work on array types that are provably compatible, without any form of boxing, unboxing, widening, or casting of each array element. Change the array types (i.e., copy a Derived[] to a Base[]), or use a mitigation strategy in the CER for Array.Copy's less powerful reliability contract, such as cloning the array or throwing away the potentially corrupt destination array.
-
-; BadImageFormatException
-BadImageFormat_ResType&SerBlobMismatch = The type serialized in the .resources file was not the same type that the .resources file said it contained. Expected '{0}' but read '{1}'.
-BadImageFormat_ResourcesIndexTooLong = Corrupt .resources file. String for name index '{0}' extends past the end of the file.
-BadImageFormat_ResourcesNameTooLong = Corrupt .resources file. Resource name extends past the end of the file.
-BadImageFormat_ResourcesNameInvalidOffset = Corrupt .resources file. Invalid offset '{0}' into name section.
-BadImageFormat_ResourcesHeaderCorrupted = Corrupt .resources file. Unable to read resources from this file because of invalid header information. Try regenerating the .resources file.
-BadImageFormat_ResourceNameCorrupted = Corrupt .resources file. A resource name extends past the end of the stream.
-BadImageFormat_ResourceNameCorrupted_NameIndex = Corrupt .resources file. The resource name for name index {0} extends past the end of the stream.
-BadImageFormat_ResourceDataLengthInvalid = Corrupt .resources file. The specified data length '{0}' is not a valid position in the stream.
-BadImageFormat_TypeMismatch = Corrupt .resources file. The specified type doesn't match the available data in the stream.
-BadImageFormat_InvalidType = Corrupt .resources file. The specified type doesn't exist.
-BadImageFormat_ResourcesIndexInvalid = Corrupt .resources file. The resource index '{0}' is outside the valid range.
-BadImageFormat_StreamPositionInvalid = Corrupt .resources file. The specified position '{0}' is not a valid position in the stream.
-BadImageFormat_ResourcesDataInvalidOffset = Corrupt .resources file. Invalid offset '{0}' into data section.
-BadImageFormat_NegativeStringLength = Corrupt .resources file. String length must be non-negative.
-BadImageFormat_ParameterSignatureMismatch = The parameters and the signature of the method don't match.
-
-; Cryptography
-; These strings still appear in bcl.small but should go away eventually
-Cryptography_CSSM_Error = Error 0x{0} from the operating system security framework: '{1}'.
-Cryptography_CSSM_Error_Unknown = Error 0x{0} from the operating system security framework.
-Cryptography_InvalidDSASignatureSize = Length of the DSA signature was not 40 bytes.
-Cryptography_InvalidHandle = {0} is an invalid handle.
-Cryptography_InvalidOID = Object identifier (OID) is unknown.
-Cryptography_OAEPDecoding = Error occurred while decoding OAEP padding.
-Cryptography_PasswordDerivedBytes_InvalidIV = The Initialization vector should have the same length as the algorithm block size in bytes.
-Cryptography_SSE_InvalidDataSize = Length of the data to encrypt is invalid.
-Cryptography_X509_ExportFailed = The certificate export operation failed.
-Cryptography_X509_InvalidContentType = Invalid content type.
-Cryptography_CryptoStream_FlushFinalBlockTwice = FlushFinalBlock() method was called twice on a CryptoStream. It can only be called once.
-Cryptography_HashKeySet = Hash key cannot be changed after the first write to the stream.
-Cryptography_HashNotYetFinalized = Hash must be finalized before the hash value is retrieved.
-Cryptography_InsufficientBuffer = Input buffer contains insufficient data.
-Cryptography_InvalidBlockSize = Specified block size is not valid for this algorithm.
-Cryptography_InvalidCipherMode = Specified cipher mode is not valid for this algorithm.
-Cryptography_InvalidIVSize = Specified initialization vector (IV) does not match the block size for this algorithm.
-Cryptography_InvalidKeySize = Specified key is not a valid size for this algorithm.
-Cryptography_PasswordDerivedBytes_FewBytesSalt = Salt is not at least eight bytes.
-Cryptography_PKCS7_InvalidPadding = Padding is invalid and cannot be removed.
-Cryptography_UnknownHashAlgorithm='{0}' is not a known hash algorithm.
-
-; EventSource
-EventSource_ToString = EventSource({0}, {1})
-EventSource_EventSourceGuidInUse = An instance of EventSource with Guid {0} already exists.
-EventSource_KeywordNeedPowerOfTwo = Value {0} for keyword {1} needs to be a power of 2.
-EventSource_UndefinedKeyword = Use of undefined keyword value {0} for event {1}.
-EventSource_UnsupportedEventTypeInManifest = Unsupported type {0} in event source.
-EventSource_ListenerNotFound = Listener not found.
-EventSource_ListenerCreatedInsideCallback = Creating an EventListener inside a EventListener callback.
-EventSource_AttributeOnNonVoid = Event attribute placed on method {0} which does not return 'void'.
-EventSource_NeedPositiveId = Event IDs must be positive integers.
-EventSource_ReservedOpcode = Opcode values less than 11 are reserved for system use.
-EventSource_ReservedKeywords = Keywords values larger than 0x0000100000000000 are reserved for system use
-EventSource_PayloadTooBig=The payload for a single event is too large.
-EventSource_NoFreeBuffers=No Free Buffers available from the operating system (e.g. event rate too fast).
-EventSource_NullInput=Null passed as a event argument.
-EventSource_TooManyArgs=Too many arguments.
-EventSource_SessionIdError=Bit position in AllKeywords ({0}) must equal the command argument named "EtwSessionKeyword" ({1}).
-EventSource_EnumKindMismatch = The type of {0} is not expected in {1}.
-EventSource_MismatchIdToWriteEvent = Event {0} is givien event ID {1} but {2} was passed to WriteEvent.
-EventSource_EventIdReused = Event {0} has ID {1} which is already in use.
-EventSource_EventNameReused = Event name {0} used more than once. If you wish to overload a method, the overloaded method should have a NonEvent attribute.
-EventSource_UndefinedChannel = Use of undefined channel value {0} for event {1}.
-EventSource_UndefinedOpcode = Use of undefined opcode value {0} for event {1}.
-ArgumentOutOfRange_MaxArgExceeded = The total number of parameters must not exceed {0}.
-ArgumentOutOfRange_MaxStringsExceeded = The number of String parameters must not exceed {0}.
-ArgumentOutOfRange_NeedValidId = The ID parameter must be in the range {0} through {1}.
-EventSource_NeedGuid = The Guid of an EventSource must be non zero.
-EventSource_NeedName = The name of an EventSource must not be null.
-EventSource_EtwAlreadyRegistered = The provider has already been registered with the operating system.
-EventSource_ListenerWriteFailure = An error occurred when writing to a listener.
-EventSource_TypeMustDeriveFromEventSource = Event source types must derive from EventSource.
-EventSource_TypeMustBeSealedOrAbstract = Event source types must be sealed or abstract.
-EventSource_TaskOpcodePairReused = Event {0} (with ID {1}) has the same task/opcode pair as event {2} (with ID {3}).
-EventSource_EventMustHaveTaskIfNonDefaultOpcode = Event {0} (with ID {1}) has a non-default opcode but not a task.
-EventSource_EventNameDoesNotEqualTaskPlusOpcode = Event {0} (with ID {1}) has a name that is not the concatenation of its task name and opcode.
-EventSource_PeriodIllegalInProviderName = Period character ('.') is illegal in an ETW provider name ({0}).
-EventSource_IllegalOpcodeValue = Opcode {0} has a value of {1} which is outside the legal range (11-238).
-EventSource_OpcodeCollision = Opcodes {0} and {1} are defined with the same value ({2}).
-EventSource_IllegalTaskValue = Task {0} has a value of {1} which is outside the legal range (1-65535).
-EventSource_TaskCollision = Tasks {0} and {1} are defined with the same value ({2}).
-EventSource_IllegalKeywordsValue = Keyword {0} has a value of {1} which is outside the legal range (0-0x0000080000000000).
-EventSource_KeywordCollision = Keywords {0} and {1} are defined with the same value ({2}).
-EventSource_EventChannelOutOfRange = Channel {0} has a value of {1} which is outside the legal range (16-254).
-EventSource_ChannelTypeDoesNotMatchEventChannelValue = Channel {0} does not match event channel value {1}.
-EventSource_MaxChannelExceeded = Attempt to define more than the maximum limit of 8 channels for a provider.
-EventSource_DuplicateStringKey = Multiple definitions for string "{0}".
-EventSource_EventWithAdminChannelMustHaveMessage = Event {0} specifies an Admin channel {1}. It must specify a Message property.
-EventSource_UnsupportedMessageProperty = Event {0} specifies an illegal or unsupported formatting message ("{1}").
-EventSource_AbstractMustNotDeclareKTOC = Abstract event source must not declare {0} nested type.
-EventSource_AbstractMustNotDeclareEventMethods = Abstract event source must not declare event methods ({0} with ID {1}).
-EventSource_EventMustNotBeExplicitImplementation = Event method {0} (with ID {1}) is an explicit interface method implementation. Re-write method as implicit implementation.
-EventSource_EventParametersMismatch = Event {0} was called with {1} argument(s), but it is defined with {2} parameter(s).
-EventSource_InvalidCommand = Invalid command value.
-EventSource_InvalidEventFormat = Can't specify both etw event format flags.
-EventSource_AddScalarOutOfRange = Getting out of bounds during scalar addition.
-EventSource_PinArrayOutOfRange = Pins are out of range.
-EventSource_DataDescriptorsOutOfRange = Data descriptors are out of range.
-EventSource_NotSupportedArrayOfNil = Arrays of Nil are not supported.
-EventSource_NotSupportedArrayOfBinary = Arrays of Binary are not supported.
-EventSource_NotSupportedArrayOfNullTerminatedString = Arrays of null-terminated string are not supported.
-EventSource_TooManyFields = Too many fields in structure.
-EventSource_RecursiveTypeDefinition = Recursive type definition is not supported.
-EventSource_NotSupportedEnumType = Enum type {0} underlying type {1} is not supported for serialization.
-EventSource_NonCompliantTypeError = The API supports only anonymous types or types decorated with the EventDataAttribute. Non-compliant type: {0} dataType.
-EventSource_NotSupportedNestedArraysEnums = Nested arrays/enumerables are not supported.
-EventSource_IncorrentlyAuthoredTypeInfo = Incorrectly-authored TypeInfo - a type should be serialized as one field or as one group
-EventSource_NotSupportedCustomSerializedData = Enumerables of custom-serialized data are not supported
-EventSource_StopsFollowStarts = An event with stop suffix must follow a corresponding event with a start suffix.
-EventSource_NoRelatedActivityId = EventSource expects the first parameter of the Event method to be of type Guid and to be named "relatedActivityId" when calling WriteEventWithRelatedActivityId.
-EventSource_VarArgsParameterMismatch = The parameters to the Event method do not match the parameters to the WriteEvent method. This may cause the event to be displayed incorrectly.
-
-; ExecutionEngineException
-ExecutionEngine_InvalidAttribute = Attribute cannot have multiple definitions.
-ExecutionEngine_MissingSecurityDescriptor = Unable to retrieve security descriptor for this frame.
-
-;;ExecutionContext
-ExecutionContext_UndoFailed = Undo operation on a component context threw an exception
-ExecutionContext_ExceptionInAsyncLocalNotification = An exception was not handled in an AsyncLocal<T> notification callback.
-
-
-; FieldAccessException
-FieldAccess_InitOnly = InitOnly (aka ReadOnly) fields can only be initialized in the type/instance constructor.
-
-; FormatException
-Format_AttributeUsage = Duplicate AttributeUsageAttribute found on attribute type {0}.
-Format_Bad7BitInt32 = Too many bytes in what should have been a 7 bit encoded Int32.
-Format_BadBase = Invalid digits for the specified base.
-Format_BadBase64Char = The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.
-Format_BadBase64CharArrayLength = Invalid length for a Base-64 char array or string.
-Format_BadBoolean = String was not recognized as a valid Boolean.
-Format_BadDateTime = String was not recognized as a valid DateTime.
-Format_BadDateTimeCalendar = The DateTime represented by the string is not supported in calendar {0}.
-Format_BadDayOfWeek = String was not recognized as a valid DateTime because the day of week was incorrect.
-Format_DateOutOfRange = The DateTime represented by the string is out of range.
-Format_BadDatePattern = Could not determine the order of year, month, and date from '{0}'.
-Format_BadFormatSpecifier = Format specifier was invalid.
-Format_BadTimeSpan = String was not recognized as a valid TimeSpan.
-Format_BadQuote = Cannot find a matching quote character for the character '{0}'.
-Format_EmptyInputString = Input string was either empty or contained only whitespace.
-Format_ExtraJunkAtEnd = Additional non-parsable characters are at the end of the string.
-Format_GuidBrace = Expected {0xdddddddd, etc}.
-Format_GuidComma = Could not find a comma, or the length between the previous token and the comma was zero (i.e., '0x,'etc.).
-Format_GuidBraceAfterLastNumber = Could not find a brace, or the length between the previous token and the brace was zero (i.e., '0x,'etc.).
-Format_GuidDashes = Dashes are in the wrong position for GUID parsing.
-Format_GuidEndBrace = Could not find the ending brace.
-Format_GuidHexPrefix = Expected hex 0x in '{0}'.
-Format_GuidInvLen = Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
-Format_GuidInvalidChar = Guid string should only contain hexadecimal characters.
-Format_GuidUnrecognized = Unrecognized Guid format.
-Format_InvalidEnumFormatSpecification = Format String can be only "G", "g", "X", "x", "F", "f", "D" or "d".
-Format_InvalidGuidFormatSpecification = Format String can be only "D", "d", "N", "n", "P", "p", "B", "b", "X" or "x".
-Format_InvalidString = Input string was not in a correct format.
-Format_IndexOutOfRange = Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
-Format_UnknowDateTimeWord = The string was not recognized as a valid DateTime. There is an unknown word starting at index {0}.
-Format_NeedSingleChar = String must be exactly one character long.
-Format_NoParsibleDigits = Could not find any recognizable digits.
-Format_RepeatDateTimePattern = DateTime pattern '{0}' appears more than once with different values.
-Format_StringZeroLength = String cannot have zero length.
-Format_TwoTimeZoneSpecifiers = The String being parsed cannot contain two TimeZone specifiers.
-Format_UTCOutOfRange= The UTC representation of the date falls outside the year range 1-9999.
-Format_OffsetOutOfRange=The time zone offset must be within plus or minus 14 hours.
-Format_MissingIncompleteDate=There must be at least a partial date with a year present in the input.
-
-; IndexOutOfRangeException
-IndexOutOfRange_ArrayRankIndex = Array does not have that many dimensions.
-IndexOutOfRange_IORaceCondition = Probable I/O race condition detected while copying memory. The I/O package is not thread safe by default. In multithreaded applications, a stream must be accessed in a thread-safe way, such as a thread-safe wrapper returned by TextReader's or TextWriter's Synchronized methods. This also applies to classes like StreamWriter and StreamReader.
-IndexOutOfRange_UMSPosition = Unmanaged memory stream position was beyond the capacity of the stream.
-
-; InsufficientMemoryException
-InsufficientMemory_MemFailPoint = Insufficient available memory to meet the expected demands of an operation at this time. Please try again later.
-InsufficientMemory_MemFailPoint_TooBig = Insufficient memory to meet the expected demands of an operation, and this system is likely to never satisfy this request. If this is a 32 bit system, consider booting in 3 GB mode.
-InsufficientMemory_MemFailPoint_VAFrag = Insufficient available memory to meet the expected demands of an operation at this time, possibly due to virtual address space fragmentation. Please try again later.
-
-
-; InvalidCastException
-InvalidCast_DBNull = Object cannot be cast to DBNull.
-InvalidCast_DownCastArrayElement = At least one element in the source array could not be cast down to the destination array type.
-InvalidCast_Empty = Object cannot be cast to Empty.
-InvalidCast_FromDBNull = Object cannot be cast from DBNull to other types.
-InvalidCast_FromTo = Invalid cast from '{0}' to '{1}'.
-InvalidCast_IConvertible = Object must implement IConvertible.
-InvalidCast_OATypeMismatch = OleAut reported a type mismatch.
-InvalidCast_StoreArrayElement = Object cannot be stored in an array of this type.
-InvalidCast_CannotCoerceByRefVariant = Object cannot be coerced to the original type of the ByRef VARIANT it was obtained from.
-InvalidCast_CannotCastNullToValueType = Null object cannot be converted to a value type.
-#if FEATURE_COMINTEROP
-InvalidCast_WinRTIPropertyValueElement = Object in an IPropertyValue is of type '{0}', which cannot be converted to a '{1}'.
-InvalidCast_WinRTIPropertyValueCoersion = Object in an IPropertyValue is of type '{0}' with value '{1}', which cannot be converted to a '{2}'.
-InvalidCast_WinRTIPropertyValueArrayCoersion = Object in an IPropertyValue is of type '{0}' which cannot be convereted to a '{1}' due to array element '{2}': {3}.
-#endif // FEATURE_COMINTEROP
-
-; InvalidOperationException
-InvalidOperation_ActivationArgsAppTrustMismatch = The activation arguments and application trust for the AppDomain must correspond to the same application identity.
-InvalidOperation_AddContextFrozen = Attempted to add properties to a frozen context.
-InvalidOperation_AppDomainSandboxAPINeedsExplicitAppBase = This API requires the ApplicationBase to be specified explicitly in the AppDomainSetup parameter.
-InvalidOperation_CantCancelCtrlBreak = Applications may not prevent control-break from terminating their process.
-InvalidOperation_CalledTwice = The method cannot be called twice on the same instance.
-InvalidOperation_CollectionCorrupted = A prior operation on this collection was interrupted by an exception. Collection's state is no longer trusted.
-InvalidOperation_CriticalTransparentAreMutuallyExclusive = SecurityTransparent and SecurityCritical attributes cannot be applied to the assembly scope at the same time.
-InvalidOperation_ExceptionStateCrossAppDomain = Thread.ExceptionState cannot access an ExceptionState from a different AppDomain.
-InvalidOperation_DebuggerLaunchFailed = Debugger unable to launch.
-InvalidOperation_ApartmentStateSwitchFailed = Failed to set the specified COM apartment state.
-InvalidOperation_EmptyQueue = Queue empty.
-InvalidOperation_EmptyStack = Stack empty.
-InvalidOperation_CannotRemoveFromStackOrQueue = Removal is an invalid operation for Stack or Queue.
-InvalidOperation_EnumEnded = Enumeration already finished.
-InvalidOperation_EnumFailedVersion = Collection was modified; enumeration operation may not execute.
-InvalidOperation_EnumNotStarted = Enumeration has not started. Call MoveNext.
-InvalidOperation_EnumOpCantHappen = Enumeration has either not started or has already finished.
-InvalidOperation_ModifyRONumFmtInfo = Unable to modify a read-only NumberFormatInfo object.
-InvalidOperation_MustBeSameThread = This operation must take place on the same thread on which the object was created.
-InvalidOperation_MustRevertPrivilege = Must revert the privilege prior to attempting this operation.
-InvalidOperation_ReadOnly = Instance is read-only.
-InvalidOperation_RegRemoveSubKey = Registry key has subkeys and recursive removes are not supported by this method.
-InvalidOperation_IComparerFailed = Failed to compare two elements in the array.
-InvalidOperation_InternalState = Invalid internal state.
-InvalidOperation_DuplicatePropertyName = Another property by this name already exists.
-InvalidOperation_NotCurrentDomain = You can only define a dynamic assembly on the current AppDomain.
-InvalidOperation_ContextAlreadyFrozen = Context is already frozen.
-InvalidOperation_WriteOnce = This property has already been set and cannot be modified.
-InvalidOperation_MethodBaked = Type definition of the method is complete.
-InvalidOperation_MethodHasBody = Method already has a body.
-InvalidOperation_ModificationOfNonCanonicalAcl = This access control list is not in canonical form and therefore cannot be modified.
-InvalidOperation_Method = This method is not supported by the current object.
-InvalidOperation_NativeOverlappedReused = NativeOverlapped cannot be reused for multiple operations.
-InvalidOperation_NotADebugModule = Not a debug ModuleBuilder.
-InvalidOperation_NoMultiModuleAssembly = You cannot have more than one dynamic module in each dynamic assembly in this version of the runtime.
-InvalidOperation_OpenLocalVariableScope = Local variable scope was not properly closed.
-InvalidOperation_SetVolumeLabelFailed = Volume labels can only be set for writable local volumes.
-InvalidOperation_SetData = An additional permission should not be supplied for setting loader information.
-InvalidOperation_SetData_OnlyOnce = SetData can only be used to set the value of a given name once.
-InvalidOperation_SetData_OnlyLocationURI = SetData cannot be used to set the value for '{0}'.
-InvalidOperation_TypeHasBeenCreated = Unable to change after type has been created.
-InvalidOperation_TypeNotCreated = Type has not been created.
-InvalidOperation_NoUnderlyingTypeOnEnum = Underlying type information on enumeration is not specified.
-InvalidOperation_ResMgrBadResSet_Type = '{0}': ResourceSet derived classes must provide a constructor that takes a String file name and a constructor that takes a Stream.
-InvalidOperation_AssemblyHasBeenSaved = Assembly '{0}' has been saved.
-InvalidOperation_ModuleHasBeenSaved = Module '{0}' has been saved.
-InvalidOperation_CannotAlterAssembly = Unable to alter assembly information.
-InvalidOperation_BadTransientModuleReference = Unable to make a reference to a transient module from a non-transient module.
-InvalidOperation_BadILGeneratorUsage = ILGenerator usage is invalid.
-InvalidOperation_BadInstructionOrIndexOutOfBound = MSIL instruction is invalid or index is out of bounds.
-InvalidOperation_ShouldNotHaveMethodBody = Method body should not exist.
-InvalidOperation_EntryMethodNotDefinedInAssembly = Entry method is not defined in the same assembly.
-InvalidOperation_CantSaveTransientAssembly = Cannot save a transient assembly.
-InvalidOperation_BadResourceContainer = Unable to add resource to transient module or transient assembly.
-InvalidOperation_CantInstantiateAbstractClass = Instances of abstract classes cannot be created.
-InvalidOperation_CantInstantiateFunctionPointer = Instances of function pointers cannot be created.
-InvalidOperation_BadTypeAttributesNotAbstract = Type must be declared abstract if any of its methods are abstract.
-InvalidOperation_BadInterfaceNotAbstract = Interface must be declared abstract.
-InvalidOperation_ConstructorNotAllowedOnInterface = Interface cannot have constructors.
-InvalidOperation_BadMethodBody = Method '{0}' cannot have a method body.
-InvalidOperation_MetaDataError = Metadata operation failed.
-InvalidOperation_BadEmptyMethodBody = Method '{0}' does not have a method body.
-InvalidOperation_EndInvokeCalledMultiple = EndInvoke can only be called once for each asynchronous operation.
-InvalidOperation_EndReadCalledMultiple = EndRead can only be called once for each asynchronous operation.
-InvalidOperation_EndWriteCalledMultiple = EndWrite can only be called once for each asynchronous operation.
-InvalidOperation_AsmLoadedForReflectionOnly = Assembly has been loaded as ReflectionOnly. This API requires an assembly capable of execution.
-InvalidOperation_NoAsmName = Assembly does not have an assembly name. In order to be registered for use by COM, an assembly must have a valid assembly name.
-InvalidOperation_NoAsmCodeBase = Assembly does not have a code base.
-InvalidOperation_HandleIsNotInitialized = Handle is not initialized.
-InvalidOperation_HandleIsNotPinned = Handle is not pinned.
-InvalidOperation_SlotHasBeenFreed = LocalDataStoreSlot storage has been freed.
-InvalidOperation_GlobalsHaveBeenCreated = Type definition of the global function has been completed.
-InvalidOperation_NotAVarArgCallingConvention = Calling convention must be VarArgs.
-InvalidOperation_CannotImportGlobalFromDifferentModule = Unable to import a global method or field from a different module.
-InvalidOperation_NonStaticComRegFunction = COM register function must be static.
-InvalidOperation_NonStaticComUnRegFunction = COM unregister function must be static.
-InvalidOperation_InvalidComRegFunctionSig = COM register function must have a System.Type parameter and a void return type.
-InvalidOperation_InvalidComUnRegFunctionSig = COM unregister function must have a System.Type parameter and a void return type.
-InvalidOperation_MultipleComRegFunctions = Type '{0}' has more than one COM registration function.
-InvalidOperation_MultipleComUnRegFunctions = Type '{0}' has more than one COM unregistration function.
-InvalidOperation_MustCallInitialize = You must call Initialize on this object instance before using it.
-InvalidOperation_MustLockForReadOrWrite = Object must be locked for read or write.
-InvalidOperation_MustLockForWrite = Object must be locked for read.
-InvalidOperation_NoValue = Nullable object must have a value.
-InvalidOperation_ResourceNotStream_Name = Resource '{0}' was not a Stream - call GetObject instead.
-InvalidOperation_ResourceNotString_Name = Resource '{0}' was not a String - call GetObject instead.
-InvalidOperation_ResourceNotString_Type = Resource was of type '{0}' instead of String - call GetObject instead.
-InvalidOperation_ResourceWriterSaved = The resource writer has already been closed and cannot be edited.
-InvalidOperation_UnderlyingArrayListChanged = This range in the underlying list is invalid. A possible cause is that elements were removed.
-InvalidOperation_AnonymousCannotImpersonate = An anonymous identity cannot perform an impersonation.
-InvalidOperation_DefaultConstructorILGen = Unable to access ILGenerator on a constructor created with DefineDefaultConstructor.
-InvalidOperation_DefaultConstructorDefineBody = The method body of the default constructor cannot be changed.
-InvalidOperation_ComputerName = Computer name could not be obtained.
-InvalidOperation_MismatchedAsyncResult = The IAsyncResult object provided does not match this delegate.
-InvalidOperation_PIAMustBeStrongNamed = Primary interop assemblies must be strongly named.
-InvalidOperation_HashInsertFailed = Hashtable insert failed. Load factor too high. The most common cause is multiple threads writing to the Hashtable simultaneously.
-InvalidOperation_UnknownEnumType = Unknown enum type.
-InvalidOperation_GetVersion = OSVersion's call to GetVersionEx failed.
-InvalidOperation_DateTimeParsing = Internal Error in DateTime and Calendar operations.
-InvalidOperation_UserDomainName = UserDomainName native call failed.
-InvalidOperation_WaitOnTransparentProxy = Cannot wait on a transparent proxy.
-InvalidOperation_NoPublicAddMethod = Cannot add the event handler since no public add method exists for the event.
-InvalidOperation_NoPublicRemoveMethod = Cannot remove the event handler since no public remove method exists for the event.
-InvalidOperation_NotSupportedOnWinRTEvent = Adding or removing event handlers dynamically is not supported on WinRT events.
-InvalidOperation_ConsoleKeyAvailableOnFile = Cannot see if a key has been pressed when either application does not have a console or when console input has been redirected from a file. Try Console.In.Peek.
-InvalidOperation_ConsoleReadKeyOnFile = Cannot read keys when either application does not have a console or when console input has been redirected from a file. Try Console.Read.
-InvalidOperation_ThreadWrongThreadStart = The thread was created with a ThreadStart delegate that does not accept a parameter.
-InvalidOperation_ThreadAPIsNotSupported = Use CompressedStack.(Capture/Run) or ExecutionContext.(Capture/Run) APIs instead.
-InvalidOperation_NotNewCaptureContext = Cannot apply a context that has been marshaled across AppDomains, that was not acquired through a Capture operation or that has already been the argument to a Set call.
-InvalidOperation_NullContext = Cannot call Set on a null context
-InvalidOperation_CannotCopyUsedContext = Only newly captured contexts can be copied
-InvalidOperation_CannotUseSwitcherOtherThread = Undo operation must be performed on the thread where the corresponding context was Set.
-InvalidOperation_SwitcherCtxMismatch = The Undo operation encountered a context that is different from what was applied in the corresponding Set operation. The possible cause is that a context was Set on the thread and not reverted(undone).
-InvalidOperation_CannotOverrideSetWithoutRevert = Must override both HostExecutionContextManager.SetHostExecutionContext and HostExecutionContextManager.Revert.
-InvalidOperation_CannotUseAFCOtherThread = AsyncFlowControl object must be used on the thread where it was created.
-InvalidOperation_CannotRestoreUnsupressedFlow = Cannot restore context flow when it is not suppressed.
-InvalidOperation_CannotSupressFlowMultipleTimes = Context flow is already suppressed.
-InvalidOperation_CannotUseAFCMultiple = AsyncFlowControl object can be used only once to call Undo().
-InvalidOperation_AsyncFlowCtrlCtxMismatch = AsyncFlowControl objects can be used to restore flow only on a Context that had its flow suppressed.
-InvalidOperation_TimeoutsNotSupported = Timeouts are not supported on this stream.
-InvalidOperation_Overlapped_Pack = Cannot pack a packed Overlapped again.
-InvalidOperation_OnlyValidForDS = Adding ACEs with Object Flags and Object GUIDs is only valid for directory-object ACLs.
-InvalidOperation_WrongAsyncResultOrEndReadCalledMultiple = Either the IAsyncResult object did not come from the corresponding async method on this type, or EndRead was called multiple times with the same IAsyncResult.
-InvalidOperation_WrongAsyncResultOrEndWriteCalledMultiple = Either the IAsyncResult object did not come from the corresponding async method on this type, or EndWrite was called multiple times with the same IAsyncResult.
-InvalidOperation_WrongAsyncResultOrEndCalledMultiple = Either the IAsyncResult object did not come from the corresponding async method on this type, or the End method was called multiple times with the same IAsyncResult.
-InvalidOperation_NoSecurityDescriptor = The object does not contain a security descriptor.
-InvalidOperation_NotAllowedInReflectionOnly = The requested operation is invalid in the ReflectionOnly context.
-InvalidOperation_NotAllowedInDynamicMethod = The requested operation is invalid for DynamicMethod.
-InvalidOperation_PropertyInfoNotAvailable = This API does not support PropertyInfo tokens.
-InvalidOperation_EventInfoNotAvailable = This API does not support EventInfo tokens.
-InvalidOperation_UnexpectedWin32Error = Unexpected error when calling an operating system function. The returned error code is 0x{0:x}.
-InvalidOperation_AssertTransparentCode = Cannot perform CAS Asserts in Security Transparent methods
-InvalidOperation_NullModuleHandle = The requested operation is invalid when called on a null ModuleHandle.
-InvalidOperation_NotWithConcurrentGC = This API is not available when the concurrent GC is enabled.
-InvalidOperation_WithoutARM = This API is not available when AppDomain Resource Monitoring is not turned on.
-InvalidOperation_NotGenericType = This operation is only valid on generic types.
-InvalidOperation_TypeCannotBeBoxed = The given type cannot be boxed.
-InvalidOperation_HostModifiedSecurityState = The security state of an AppDomain was modified by an AppDomainManager configured with the NoSecurityChanges flag.
-InvalidOperation_StrongNameKeyPairRequired = A strong name key pair is required to emit a strong-named dynamic assembly.
-#if FEATURE_COMINTEROP
-InvalidOperation_EventTokenTableRequiresDelegate = Type '{0}' is not a delegate type. EventTokenTable may only be used with delegate types.
-#endif // FEATURE_COMINTEROP
-InvalidOperation_NullArray = The underlying array is null.
-;system.security.claims
-InvalidOperation_ClaimCannotBeRemoved = The Claim '{0}' was not able to be removed. It is either not part of this Identity or it is a claim that is owned by the Principal that contains this Identity. For example, the Principal will own the claim when creating a GenericPrincipal with roles. The roles will be exposed through the Identity that is passed in the constructor, but not actually owned by the Identity. Similar logic exists for a RolePrincipal.
-InvalidOperationException_ActorGraphCircular = Actor cannot be set so that circular directed graph will exist chaining the subjects together.
-InvalidOperation_AsyncIOInProgress = The stream is currently in use by a previous operation on the stream.
-InvalidOperation_APIInvalidForCurrentContext = The API '{0}' cannot be used on the current platform. See http://go.microsoft.com/fwlink/?LinkId=248273 for more information.
-
-; InvalidProgramException
-InvalidProgram_Default = Common Language Runtime detected an invalid program.
-
-; Verification Exception
-Verification_Exception = Operation could destabilize the runtime.
-
-; IL stub marshaler exceptions
-Marshaler_StringTooLong = Marshaler restriction: Excessively long string.
-
-; Missing (General)
-MissingConstructor_Name = Constructor on type '{0}' not found.
-MissingField = Field not found.
-MissingField_Name = Field '{0}' not found.
-MissingMember = Member not found.
-MissingMember_Name = Member '{0}' not found.
-MissingMethod_Name = Method '{0}' not found.
-MissingModule = Module '{0}' not found.
-MissingType = Type '{0}' not found.
-
-; MissingManifestResourceException
-Arg_MissingManifestResourceException = Unable to find manifest resource.
-MissingManifestResource_LooselyLinked = Could not find a manifest resource entry called "{0}" in assembly "{1}". Please check spelling, capitalization, and build rules to ensure "{0}" is being linked into the assembly.
-MissingManifestResource_NoNeutralAsm = Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "{0}" was correctly embedded or linked into assembly "{1}" at compile time, or that all the satellite assemblies required are loadable and fully signed.
-MissingManifestResource_NoNeutralDisk = Could not find any resources appropriate for the specified culture (or the neutral culture) on disk.
-MissingManifestResource_MultipleBlobs = A case-insensitive lookup for resource file "{0}" in assembly "{1}" found multiple entries. Remove the duplicates or specify the exact case.
-MissingManifestResource_ResWFileNotLoaded = Unable to load resources for resource file "{0}" in package "{1}".
-MissingManifestResource_NoPRIresources = Unable to open Package Resource Index.
-
-; MissingMember
-MissingMemberTypeRef = FieldInfo does not match the target Type.
-MissingMemberNestErr = TypedReference can only be made on nested value Types.
-
-; MissingSatelliteAssemblyException
-MissingSatelliteAssembly_Default = Resource lookup fell back to the ultimate fallback resources in a satellite assembly, but that satellite either was not found or could not be loaded. Please consider reinstalling or repairing the application.
-MissingSatelliteAssembly_Culture_Name = The satellite assembly named "{1}" for fallback culture "{0}" either could not be found or could not be loaded. This is generally a setup problem. Please consider reinstalling or repairing the application.
-
-; MulticastNotSupportedException
-Multicast_Combine = Delegates that are not of type MulticastDelegate may not be combined.
-
-; NotImplementedException
-Arg_NotImplementedException = The method or operation is not implemented.
-NotImplemented_ResourcesLongerThan2^63 = Resource files longer than 2^63 bytes are not currently implemented.
-
-; NotSupportedException
-NotSupported_NYI = This feature is not currently implemented.
-NotSupported_AbstractNonCLS = This non-CLS method is not implemented.
-NotSupported_ChangeType = ChangeType operation is not supported.
-NotSupported_ByRefLike = Cannot create boxed ByRef-like values.
-NotSupported_ByRefLike[] = Cannot create arrays of ByRef-like values.
-NotSupported_OpenType = Cannot create arrays of open type.
-NotSupported_DBNullSerial = Only one DBNull instance may exist, and calls to DBNull deserialization methods are not allowed.
-NotSupported_DelegateSerHolderSerial = DelegateSerializationHolder objects are designed to represent a delegate during serialization and are not serializable themselves.
-NotSupported_DelegateCreationFromPT = Application code cannot use Activator.CreateInstance to create types that derive from System.Delegate. Delegate.CreateDelegate can be used instead.
-NotSupported_EncryptionNeedsNTFS = File encryption support only works on NTFS partitions.
-NotSupported_FileStreamOnNonFiles = FileStream was asked to open a device that was not a file. For support for devices like 'com1:' or 'lpt1:', call CreateFile, then use the FileStream constructors that take an OS handle as an IntPtr.
-NotSupported_FixedSizeCollection = Collection was of a fixed size.
-NotSupported_KeyCollectionSet = Mutating a key collection derived from a dictionary is not allowed.
-NotSupported_ValueCollectionSet = Mutating a value collection derived from a dictionary is not allowed.
-NotSupported_MemStreamNotExpandable = Memory stream is not expandable.
-NotSupported_ObsoleteResourcesFile = Found an obsolete .resources file in assembly '{0}'. Rebuild that .resources file then rebuild that assembly.
-NotSupported_OleAutBadVarType = The given Variant type is not supported by this OleAut function.
-NotSupported_PopulateData = This Surrogate does not support PopulateData().
-NotSupported_ReadOnlyCollection = Collection is read-only.
-NotSupported_RangeCollection = The specified operation is not supported on Ranges.
-NotSupported_SortedListNestedWrite = This operation is not supported on SortedList nested types because they require modifying the original SortedList.
-NotSupported_SubclassOverride = Derived classes must provide an implementation.
-NotSupported_TypeCannotDeserialized = Direct deserialization of type '{0}' is not supported.
-NotSupported_UnreadableStream = Stream does not support reading.
-NotSupported_UnseekableStream = Stream does not support seeking.
-NotSupported_UnwritableStream = Stream does not support writing.
-NotSupported_CannotWriteToBufferedStreamIfReadBufferCannotBeFlushed = Cannot write to a BufferedStream while the read buffer is not empty if the underlying stream is not seekable. Ensure that the stream underlying this BufferedStream can seek or avoid interleaving read and write operations on this BufferedStream.
-NotSupported_Method = Method is not supported.
-NotSupported_Constructor = Object cannot be created through this constructor.
-NotSupported_DynamicModule = The invoked member is not supported in a dynamic module.
-NotSupported_TypeNotYetCreated = The invoked member is not supported before the type is created.
-NotSupported_SymbolMethod = Not supported in an array method of a type definition that is not complete.
-NotSupported_NotDynamicModule = The MethodRental.SwapMethodBody method can only be called to swap the method body of a method in a dynamic module.
-NotSupported_DynamicAssembly = The invoked member is not supported in a dynamic assembly.
-NotSupported_NotAllTypesAreBaked = Type '{0}' was not completed.
-NotSupported_CannotSaveModuleIndividually = Unable to save a ModuleBuilder if it was created underneath an AssemblyBuilder. Call Save on the AssemblyBuilder instead.
-NotSupported_MaxWaitHandles = The number of WaitHandles must be less than or equal to 64.
-NotSupported_IllegalOneByteBranch = Illegal one-byte branch at position: {0}. Requested branch was: {1}.
-NotSupported_OutputStreamUsingTypeBuilder = Output streams do not support TypeBuilders.
-NotSupported_ValueClassCM = Custom marshalers for value types are not currently supported.
-NotSupported_Void[] = Arrays of System.Void are not supported.
-NotSupported_NoParentDefaultConstructor = Parent does not have a default constructor. The default constructor must be explicitly defined.
-NotSupported_NonReflectedType = Not supported in a non-reflected type.
-NotSupported_GlobalFunctionNotBaked = The type definition of the global function is not completed.
-NotSupported_SecurityPermissionUnion = Union is not implemented.
-NotSupported_UnitySerHolder = The UnitySerializationHolder object is designed to transmit information about other types and is not serializable itself.
-NotSupported_UnknownTypeCode = TypeCode '{0}' was not valid.
-NotSupported_WaitAllSTAThread = WaitAll for multiple handles on a STA thread is not supported.
-NotSupported_SignalAndWaitSTAThread = SignalAndWait on a STA thread is not supported.
-NotSupported_CreateInstanceWithTypeBuilder = CreateInstance cannot be used with an object of type TypeBuilder.
-NotSupported_NonUrlAttrOnMBR = UrlAttribute is the only attribute supported for MarshalByRefObject.
-NotSupported_ActivAttrOnNonMBR = Activation Attributes are not supported for types not deriving from MarshalByRefObject.
-NotSupported_ActivAttr = Activation Attributes are not supported.
-NotSupported_ActivForCom = Activation Attributes not supported for COM Objects.
-NotSupported_NoCodepageData = No data is available for encoding {0}. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.
-NotSupported_CodePage50229 = The ISO-2022-CN Encoding (Code page 50229) is not supported.
-NotSupported_DynamicAssemblyNoRunAccess = Cannot execute code on a dynamic assembly without run access.
-NotSupported_IDispInvokeDefaultMemberWithNamedArgs = Invoking default method with named arguments is not supported.
-NotSupported_Type = Type is not supported.
-NotSupported_GetMethod = The 'get' method is not supported on this property.
-NotSupported_SetMethod = The 'set' method is not supported on this property.
-NotSupported_DeclarativeUnion = Declarative unionizing of these permissions is not supported.
-NotSupported_StringComparison = The string comparison type passed in is currently not supported.
-NotSupported_WrongResourceReader_Type = This .resources file should not be read with this reader. The resource reader type is "{0}".
-NotSupported_MustBeModuleBuilder = Module argument must be a ModuleBuilder.
-NotSupported_CallToVarArg = Vararg calling convention not supported.
-NotSupported_TooManyArgs = Stack size too deep. Possibly too many arguments.
-NotSupported_DeclSecVarArg = Assert, Deny, and PermitOnly are not supported on methods with a Vararg calling convention.
-NotSupported_AmbiguousIdentity = The operation is ambiguous because the permission represents multiple identities.
-NotSupported_DynamicMethodFlags = Wrong MethodAttributes or CallingConventions for DynamicMethod. Only public, static, standard supported
-NotSupported_GlobalMethodSerialization = Serialization of global methods (including implicit serialization via the use of asynchronous delegates) is not supported.
-NotSupported_InComparableType = A type must implement IComparable<T> or IComparable to support comparison.
-NotSupported_ManagedActivation = Cannot create uninitialized instances of types requiring managed activation.
-NotSupported_ByRefReturn = ByRef return value not supported in reflection invocation.
-NotSupported_DelegateMarshalToWrongDomain = Delegates cannot be marshaled from native code into a domain other than their home domain.
-NotSupported_ResourceObjectSerialization = Cannot read resources that depend on serialization.
-NotSupported_One = The arithmetic type '{0}' cannot represent the number one.
-NotSupported_Zero = The arithmetic type '{0}' cannot represent the number zero.
-NotSupported_MaxValue = The arithmetic type '{0}' does not have a maximum value.
-NotSupported_MinValue = The arithmetic type '{0}' does not have a minimum value.
-NotSupported_PositiveInfinity = The arithmetic type '{0}' cannot represent positive infinity.
-NotSupported_NegativeInfinity = The arithmetic type '{0}' cannot represent negative infinity.
-NotSupported_UmsSafeBuffer = This operation is not supported for an UnmanagedMemoryStream created from a SafeBuffer.
-NotSupported_Reading = Accessor does not support reading.
-NotSupported_Writing = Accessor does not support writing.
-NotSupported_UnsafePointer = This accessor was created with a SafeBuffer; use the SafeBuffer to gain access to the pointer.
-NotSupported_CollectibleCOM = COM Interop is not supported for collectible types.
-NotSupported_CollectibleAssemblyResolve = Resolving to a collectible assembly is not supported.
-NotSupported_CollectibleBoundNonCollectible = A non-collectible assembly may not reference a collectible assembly.
-NotSupported_CollectibleDelegateMarshal = Delegate marshaling for types within collectible assemblies is not supported.
-NotSupported_NonStaticMethod = Non-static methods with NativeCallableAttribute are not supported.
-NotSupported_NativeCallableTarget = Methods with NativeCallableAttribute cannot be used as delegate target.
-NotSupported_GenericMethod = Generic methods with NativeCallableAttribute are not supported.
-NotSupported_NonBlittableTypes = Non-blittable parameter types are not supported for NativeCallable methods.
-
-NotSupported_UserDllImport = DllImport cannot be used on user-defined methods.
-NotSupported_UserCOM = COM Interop is not supported for user-defined types.
-
-#if FEATURE_APPX
-NotSupported_AppX = {0} is not supported in AppX.
-LoadOfFxAssemblyNotSupported_AppX = {0} of .NET Framework assemblies is not supported in AppX.
-#endif
-#if FEATURE_COMINTEROP
-NotSupported_WinRT_PartialTrust = Windows Runtime is not supported in partial trust.
-#endif // FEATURE_COMINTEROP
-; ReflectionTypeLoadException
-ReflectionTypeLoad_LoadFailed = Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
-#if FEATURE_COMINTEROP
-NotSupported_PIAInAppxProcess = A Primary Interop Assembly is not supported in AppX.
-#endif
-NotSupported_AssemblyLoadCodeBase = Assembly.Load with a Codebase is not supported.
-NotSupported_AssemblyLoadFromHash = Assembly.LoadFrom with hashValue is not supported.
-NotSupported_CannotCallEqualsOnSpan = Equals() on Span and ReadOnlySpan is not supported. Use operator== instead.
-NotSupported_CannotCallGetHashCodeOnSpan = GetHashCode() on Span and ReadOnlySpan is not supported.
-NotSupported_ReflectionOnlyLoad = Assembly.ReflectionOnlyLoad is not supported.
-NotSupported_ReflectionOnlyGetType = Type.ReflectionOnlyGetType is not supported.
-
-; TypeLoadException
-TypeLoad_ResolveType = Could not resolve type '{0}'.
-TypeLoad_ResolveTypeFromAssembly = Could not resolve type '{0}' in assembly '{1}'.
-TypeLoad_ResolveNestedType = Could not resolve nested type '{0}' in type "{1}'.
-FileNotFound_ResolveAssembly = Could not resolve assembly '{0}'.
-
-; NullReferenceException
-NullReference_This = The pointer for this method was null.
-
-; ObjectDisposedException
-ObjectDisposed_Generic = Cannot access a disposed object.
-ObjectDisposed_FileClosed = Cannot access a closed file.
-ObjectDisposed_ObjectName_Name = Object name: '{0}'.
-ObjectDisposed_ReaderClosed = Cannot read from a closed TextReader.
-ObjectDisposed_ResourceSet = Cannot access a closed resource set.
-ObjectDisposed_RegKeyClosed = Cannot access a closed registry key.
-ObjectDisposed_StreamClosed = Cannot access a closed Stream.
-ObjectDisposed_WriterClosed = Cannot write to a closed TextWriter.
-ObjectDisposed_ViewAccessorClosed = Cannot access a closed accessor.
-
-; OperationCanceledException
-OperationCanceled = The operation was canceled.
-
-; OutOfMemoryException
-OutOfMemory_GCHandleMDA = The GCHandle MDA has run out of available cookies.
-
-; OverflowException
-Overflow_Byte = Value was either too large or too small for an unsigned byte.
-Overflow_Char = Value was either too large or too small for a character.
-Overflow_Currency = Value was either too large or too small for a Currency.
-Overflow_Decimal = Value was either too large or too small for a Decimal.
-Overflow_Int16 = Value was either too large or too small for an Int16.
-Overflow_Int32 = Value was either too large or too small for an Int32.
-Overflow_Int64 = Value was either too large or too small for an Int64.
-Overflow_NegateTwosCompNum = Negating the minimum value of a twos complement number is invalid.
-Overflow_NegativeUnsigned = The string was being parsed as an unsigned number and could not have a negative sign.
-Overflow_SByte = Value was either too large or too small for a signed byte.
-Overflow_Single = Value was either too large or too small for a Single.
-Overflow_Double = Value was either too large or too small for a Double.
-Overflow_TimeSpanTooLong = TimeSpan overflowed because the duration is too long.
-Overflow_TimeSpanElementTooLarge = The TimeSpan could not be parsed because at least one of the numeric components is out of range or contains too many digits.
-Overflow_Duration = The duration cannot be returned for TimeSpan.MinValue because the absolute value of TimeSpan.MinValue exceeds the value of TimeSpan.MaxValue.
-Overflow_UInt16 = Value was either too large or too small for a UInt16.
-Overflow_UInt32 = Value was either too large or too small for a UInt32.
-Overflow_UInt64 = Value was either too large or too small for a UInt64.
-
-; PlatformNotsupportedException
-PlatformNotSupported_RequiresLonghorn = This operation is only supported on Windows Vista and above.
-PlatformNotSupported_RequiresNT = This operation is only supported on Windows 2000, Windows XP, and higher.
-PlatformNotSupported_RequiresW2kSP3 = This operation is only supported on Windows 2000 SP3 or later operating systems.
-#if FEATURE_COMINTEROP
-PlatformNotSupported_WinRT = Windows Runtime is not supported on this operating system.
-#endif // FEATURE_COMINTEROP
-
-; PolicyException
-; This still appears in bcl.small but should go away eventually
-Policy_Default = Error occurred while performing a policy operation.
-Policy_CannotLoadSemiTrustAssembliesDuringInit = All assemblies loaded as part of AppDomain initialization must be fully trusted.
-Policy_SaveNotFileBased = PolicyLevel object not based on a file cannot be saved.
-Policy_AppTrustMustGrantAppRequest = ApplicationTrust grant set does not contain ActivationContext's minimum request set.
-
-Error_SecurityPolicyFileParse = Error occurred while parsing the '{0}' policy level. The default policy level was used instead.
-Error_SecurityPolicyFileParseEx = Error '{1}' occurred while parsing the '{0}' policy level. The default policy level was used instead.
-
-; RankException
-Rank_MultiDimNotSupported = Only single dimension arrays are supported here.
-Rank_MustMatch = The specified arrays must have the same number of dimensions.
-
-; TypeInitializationException
-TypeInitialization_Default = Type constructor threw an exception.
-TypeInitialization_Type = The type initializer for '{0}' threw an exception.
-
-; TypeLoadException
-
-
-;
-; Reflection exceptions
-;
-RtType.InvalidCaller = Caller is not a friend.
-
-;CustomAttributeFormatException
-RFLCT.InvalidPropFail = '{0}' property specified was not found.
-RFLCT.InvalidFieldFail = '{0}' field specified was not found.
-
-;InvalidFilterCriteriaException
-RFLCT.FltCritString = A String must be provided for the filter criteria.
-RFLCT.FltCritInt = An Int32 must be provided for the filter criteria.
-
-; TargetException
-RFLCT.Targ_ITargMismatch = Object does not match target type.
-RFLCT.Targ_StatMethReqTarg = Non-static method requires a target.
-RFLCT.Targ_StatFldReqTarg = Non-static field requires a target.
-
-;AmbiguousMatchException
-RFLCT.Ambiguous = Ambiguous match found.
-RFLCT.AmbigCust = Multiple custom attributes of the same type found.
-
-;
-; Remoting exceptions
-;
-Remoting_AppDomainUnloaded_ThreadUnwound = The application domain in which the thread was running has been unloaded.
-Remoting_AppDomainUnloaded = The target application domain has been unloaded.
-Remoting_CantRemotePointerType = Pointer types cannot be passed in a remote call.
-Remoting_TypeCantBeRemoted = The given type cannot be passed in a remote call.
-Remoting_Delegate_TooManyTargets = The delegate must have only one target.
-Remoting_InvalidContext = The context is not valid.
-Remoting_InvalidValueTypeFieldAccess = An attempt was made to calculate the address of a value type field on a remote object. This was likely caused by an attempt to directly get or set the value of a field within this embedded value type. Avoid this and instead provide and use access methods for each field in the object that will be accessed remotely.
-Remoting_Message_BadRetValOrOutArg = Bad return value or out-argument inside the return message.
-Remoting_NonPublicOrStaticCantBeCalledRemotely = Permission denied: cannot call non-public or static methods remotely.
-Remoting_Proxy_ProxyTypeIsNotMBR = classToProxy argument must derive from MarshalByRef type.
-Remoting_TP_NonNull = The transparent proxy field of a real proxy must be null.
-
-; Resources exceptions
-;
-Resources_StreamNotValid = Stream is not a valid resource file.
-ResourceReaderIsClosed = ResourceReader is closed.
-
-; RuntimeWrappedException
-RuntimeWrappedException = An object that does not derive from System.Exception has been wrapped in a RuntimeWrappedException.
-
-; UnauthorizedAccessException
-UnauthorizedAccess_MemStreamBuffer = MemoryStream's internal buffer cannot be accessed.
-UnauthorizedAccess_IODenied_Path = Access to the path '{0}' is denied.
-UnauthorizedAccess_IODenied_NoPathName = Access to the path is denied.
-UnauthorizedAccess_RegistryKeyGeneric_Key = Access to the registry key '{0}' is denied.
-UnauthorizedAccess_RegistryNoWrite = Cannot write to the registry key.
-UnauthorizedAccess_SystemDomain = Cannot execute an assembly in the system domain.
-
-;
-; Security exceptions
-;
-
-;SecurityException
-; These still appear in bcl.small but should go away eventually
-Security_Generic = Request for the permission of type '{0}' failed.
-Security_GenericNoType = Request failed.
-Security_NoAPTCA = That assembly does not allow partially trusted callers.
-Security_RegistryPermission = Requested registry access is not allowed.
-Security_MustRevertOverride = Stack walk modifier must be reverted before another modification of the same type can be performed.
-
-;
-; HostProtection exceptions
-;
-
-HostProtection_HostProtection = Attempted to perform an operation that was forbidden by the CLR host.
-HostProtection_ProtectedResources = The protected resources (only available with full trust) were:
-HostProtection_DemandedResources = The demanded resources were:
-
-;
-; IO exceptions
-;
-
-; EOFException
-IO.EOF_ReadBeyondEOF = Unable to read beyond the end of the stream.
-
-; FileNotFoundException
-IO.FileNotFound = Unable to find the specified file.
-IO.FileNotFound_FileName = Could not find file '{0}'.
-IO.FileName_Name = File name: '{0}'
-IO.FileLoad = Could not load the specified file.
-
-; IOException
-IO.IO_AlreadyExists_Name = Cannot create "{0}" because a file or directory with the same name already exists.
-IO.IO_BindHandleFailed = BindHandle for ThreadPool failed on this handle.
-IO.IO_FileExists_Name = The file '{0}' already exists.
-IO.IO_FileStreamHandlePosition = The OS handle's position is not what FileStream expected. Do not use a handle simultaneously in one FileStream and in Win32 code or another FileStream. This may cause data loss.
-IO.IO_FileTooLong2GB = The file is too long. This operation is currently limited to supporting files less than 2 gigabytes in size.
-IO.IO_FileTooLongOrHandleNotSync = IO operation will not work. Most likely the file will become too long or the handle was not opened to support synchronous IO operations.
-IO.IO_FixedCapacity = Unable to expand length of this stream beyond its capacity.
-IO.IO_InvalidStringLen_Len = BinaryReader encountered an invalid string length of {0} characters.
-IO.IO_NoConsole = There is no console.
-IO.IO_NoPermissionToDirectoryName = <Path discovery permission to the specified directory was denied.>
-IO.IO_SeekBeforeBegin = An attempt was made to move the position before the beginning of the stream.
-IO.IO_SeekAppendOverwrite = Unable seek backward to overwrite data that previously existed in a file opened in Append mode.
-IO.IO_SetLengthAppendTruncate = Unable to truncate data that previously existed in a file opened in Append mode.
-IO.IO_SharingViolation_File = The process cannot access the file '{0}' because it is being used by another process.
-IO.IO_SharingViolation_NoFileName = The process cannot access the file because it is being used by another process.
-IO.IO_StreamTooLong = Stream was too long.
-IO.IO_CannotCreateDirectory = The specified directory '{0}' cannot be created.
-IO.IO_SourceDestMustBeDifferent = Source and destination path must be different.
-IO.IO_SourceDestMustHaveSameRoot = Source and destination path must have identical roots. Move will not work across volumes.
-
-; DirectoryNotFoundException
-IO.DriveNotFound_Drive = Could not find the drive '{0}'. The drive might not be ready or might not be mapped.
-IO.PathNotFound_Path = Could not find a part of the path '{0}'.
-IO.PathNotFound_NoPathName = Could not find a part of the path.
-
-; PathTooLongException
-IO.PathTooLong = The specified file name or path is too long, or a component of the specified path is too long.
-
-; SecurityException
-FileSecurityState_OperationNotPermitted = File operation not permitted. Access to path '{0}' is denied.
-
-; PrivilegeNotHeldException
-PrivilegeNotHeld_Default = The process does not possess some privilege required for this operation.
-PrivilegeNotHeld_Named = The process does not possess the '{0}' privilege which is required for this operation.
-
-; General strings used in the IO package
-IO_UnknownFileName = [Unknown]
-IO_StreamWriterBufferedDataLost = A StreamWriter was not closed and all buffered data within that StreamWriter was not flushed to the underlying stream. (This was detected when the StreamWriter was finalized with data in its buffer.) A portion of the data was lost. Consider one of calling Close(), Flush(), setting the StreamWriter's AutoFlush property to true, or allocating the StreamWriter with a "using" statement. Stream type: {0}\r\nFile name: {1}\r\nAllocated from:\r\n {2}
-IO_StreamWriterBufferedDataLostCaptureAllocatedFromCallstackNotEnabled = callstack information is not captured by default for performance reasons. Please enable captureAllocatedCallStack config switch for streamWriterBufferedDataLost MDA (refer to MSDN MDA documentation for how to do this).
-
-;
-; Serialization Exceptions
-;
-; SerializationException
-Serialization_InvalidData=An error occurred while deserializing the object. The serialized data is corrupt.
-Serialization_InvalidPtrValue = An IntPtr or UIntPtr with an eight byte value cannot be deserialized on a machine with a four byte word size.
-Serialization_MemberTypeNotRecognized = Unknown member type.
-Serialization_InsufficientState = Insufficient state to return the real object.
-Serialization_InvalidFieldState = Object fields may not be properly initialized.
-Serialization_MissField = Field {0} is missing.
-Serialization_NullSignature = The method signature cannot be null.
-Serialization_UnknownMember = Cannot get the member '{0}'.
-Serialization_InsufficientDeserializationState = Insufficient state to deserialize the object. Missing field '{0}'. More information is needed.
-Serialization_UnableToFindModule = The given module {0} cannot be found within the assembly {1}.
-Serialization_InvalidOnDeser = OnDeserialization method was called while the object was not being deserialized.
-Serialization_MissingKeys = The Keys for this Hashtable are missing.
-Serialization_MissingValues = The values for this dictionary are missing.
-Serialization_NullKey = One of the serialized keys is null.
-Serialization_KeyValueDifferentSizes = The keys and values arrays have different sizes.
-Serialization_SameNameTwice = Cannot add the same member twice to a SerializationInfo object.
-Serialization_BadParameterInfo = Non existent ParameterInfo. Position bigger than member's parameters length.
-Serialization_NoParameterInfo = Serialized member does not have a ParameterInfo.
-Serialization_NotFound = Member '{0}' was not found.
-Serialization_StringBuilderMaxCapacity = The serialized MaxCapacity property of StringBuilder must be positive and greater than or equal to the String length.
-Serialization_StringBuilderCapacity = The serialized Capacity property of StringBuilder must be positive, less than or equal to MaxCapacity and greater than or equal to the String length.
-Serialization_InvalidDelegateType = Cannot serialize delegates over unmanaged function pointers, dynamic methods or methods outside the delegate creator's assembly.
-Serialization_OptionalFieldVersionValue = Version value must be positive.
-Serialization_MissingDateTimeData = Invalid serialized DateTime data. Unable to find 'ticks' or 'dateData'.
-Serialization_DateTimeTicksOutOfRange = Invalid serialized DateTime data. Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.
-; The following serialization exception messages appear in native resources too (mscorrc.rc)
-Serialization_MemberOutOfRange = The deserialized value of the member "{0}" in the class "{1}" is out of range.
-
-
-;
-; StringBuilder Exceptions
-;
-Arg_LongerThanSrcString = Source string was not long enough. Check sourceIndex and count.
-
-
-;
-; System.Threading
-;
-
-;
-; Thread Exceptions
-;
-ThreadState_NoAbortRequested = Unable to reset abort because no abort was requested.
-Threading.WaitHandleTooManyPosts = The WaitHandle cannot be signaled because it would exceed its maximum count.
-;
-; WaitHandleCannotBeOpenedException
-;
-Threading.WaitHandleCannotBeOpenedException = No handle of the given name exists.
-Threading.WaitHandleCannotBeOpenedException_InvalidHandle = A WaitHandle with system-wide name '{0}' cannot be created. A WaitHandle of a different type might have the same name.
-
-;
-; AbandonedMutexException
-;
-Threading.AbandonedMutexException = The wait completed due to an abandoned mutex.
-
-; AggregateException
-AggregateException_ctor_DefaultMessage=One or more errors occurred.
-AggregateException_ctor_InnerExceptionNull=An element of innerExceptions was null.
-AggregateException_DeserializationFailure=The serialization stream contains no inner exceptions.
-AggregateException_ToString={0}{1}---> (Inner Exception #{2}) {3}{4}{5}
-
-; Cancellation
-CancellationToken_CreateLinkedToken_TokensIsEmpty=No tokens were supplied.
-CancellationTokenSource_Disposed=The CancellationTokenSource has been disposed.
-CancellationToken_SourceDisposed=The CancellationTokenSource associated with this CancellationToken has been disposed.
-
-; Exceptions shared by all concurrent collection
-ConcurrentCollection_SyncRoot_NotSupported=The SyncRoot property may not be used for the synchronization of concurrent collections.
-
-; Exceptions shared by ConcurrentStack and ConcurrentQueue
-ConcurrentStackQueue_OnDeserialization_NoData=The serialization stream contains no elements.
-
-; ConcurrentStack<T>
-ConcurrentStack_PushPopRange_StartOutOfRange=The startIndex argument must be greater than or equal to zero.
-ConcurrentStack_PushPopRange_CountOutOfRange=The count argument must be greater than or equal to zero.
-ConcurrentStack_PushPopRange_InvalidCount=The sum of the startIndex and count arguments must be less than or equal to the collection's Count.
-
-; ConcurrentDictionary<TKey, TValue>
-ConcurrentDictionary_ItemKeyIsNull=TKey is a reference type and item.Key is null.
-ConcurrentDictionary_SourceContainsDuplicateKeys=The source argument contains duplicate keys.
-ConcurrentDictionary_IndexIsNegative=The index argument is less than zero.
-ConcurrentDictionary_ConcurrencyLevelMustBePositive=The concurrencyLevel argument must be positive.
-ConcurrentDictionary_CapacityMustNotBeNegative=The capacity argument must be greater than or equal to zero.
-ConcurrentDictionary_ArrayNotLargeEnough=The index is equal to or greater than the length of the array, or the number of elements in the dictionary is greater than the available space from index to the end of the destination array.
-ConcurrentDictionary_ArrayIncorrectType=The array is multidimensional, or the type parameter for the set cannot be cast automatically to the type of the destination array.
-ConcurrentDictionary_KeyAlreadyExisted=The key already existed in the dictionary.
-ConcurrentDictionary_TypeOfKeyIncorrect=The key was of an incorrect type for this dictionary.
-ConcurrentDictionary_TypeOfValueIncorrect=The value was of an incorrect type for this dictionary.
-
-; Partitioner
-Partitioner_DynamicPartitionsNotSupported=Dynamic partitions are not supported by this partitioner.
-
-; OrderablePartitioner
-OrderablePartitioner_GetPartitions_WrongNumberOfPartitions=GetPartitions returned an incorrect number of partitions.
-
-; PartitionerStatic
-PartitionerStatic_CurrentCalledBeforeMoveNext=MoveNext must be called at least once before calling Current.
-PartitionerStatic_CanNotCallGetEnumeratorAfterSourceHasBeenDisposed=Can not call GetEnumerator on partitions after the source enumerable is disposed
-
-; CDSCollectionETWBCLProvider events
-event_ConcurrentStack_FastPushFailed=Push to ConcurrentStack spun {0} time(s).
-event_ConcurrentStack_FastPopFailed=Pop from ConcurrentStack spun {0} time(s).
-event_ConcurrentDictionary_AcquiringAllLocks=ConcurrentDictionary acquiring all locks on {0} bucket(s).
-event_ConcurrentBag_TryTakeSteals=ConcurrentBag stealing in TryTake.
-event_ConcurrentBag_TryPeekSteals=ConcurrentBag stealing in TryPeek.
-
-; CountdownEvent
-CountdownEvent_Decrement_BelowZero=Invalid attempt made to decrement the event's count below zero.
-CountdownEvent_Increment_AlreadyZero=The event is already signaled and cannot be incremented.
-CountdownEvent_Increment_AlreadyMax=The increment operation would cause the CurrentCount to overflow.
-
-; Parallel
-Parallel_Invoke_ActionNull=One of the actions was null.
-Parallel_ForEach_OrderedPartitionerKeysNotNormalized=This method requires the use of an OrderedPartitioner with the KeysNormalized property set to true.
-Parallel_ForEach_PartitionerNotDynamic=The Partitioner used here must support dynamic partitioning.
-Parallel_ForEach_PartitionerReturnedNull=The Partitioner used here returned a null partitioner source.
-Parallel_ForEach_NullEnumerator=The Partitioner source returned a null enumerator.
-
-; Semaphore
-Argument_SemaphoreInitialMaximum=The initial count for the semaphore must be greater than or equal to zero and less than the maximum count.
-
-; SemaphoreFullException
-Threading_SemaphoreFullException=Adding the specified count to the semaphore would cause it to exceed its maximum count.
-
-; Lazy
-Lazy_ctor_ValueSelectorNull=The valueSelector argument is null.
-Lazy_ctor_InfoNull=The info argument is null.
-Lazy_ctor_deserialization_ValueInvalid=The Value cannot be null.
-Lazy_ctor_ModeInvalid=The mode argument specifies an invalid value.
-Lazy_CreateValue_NoParameterlessCtorForT=The lazily-initialized type does not have a public, parameterless constructor.
-Lazy_StaticInit_InvalidOperation=ValueFactory returned null.
-Lazy_Value_RecursiveCallsToValue=ValueFactory attempted to access the Value property of this instance.
-Lazy_ToString_ValueNotCreated=Value is not created.
-
-
-;ThreadLocal
-ThreadLocal_Value_RecursiveCallsToValue=ValueFactory attempted to access the Value property of this instance.
-ThreadLocal_Disposed=The ThreadLocal object has been disposed.
-ThreadLocal_ValuesNotAvailable=The ThreadLocal object is not tracking values. To use the Values property, use a ThreadLocal constructor that accepts the trackAllValues parameter and set the parameter to true.
-
-; SemaphoreSlim
-SemaphoreSlim_ctor_InitialCountWrong=The initialCount argument must be non-negative and less than or equal to the maximumCount.
-SemaphoreSlim_ctor_MaxCountWrong=The maximumCount argument must be a positive number. If a maximum is not required, use the constructor without a maxCount parameter.
-SemaphoreSlim_Wait_TimeoutWrong=The timeout must represent a value between -1 and Int32.MaxValue, inclusive.
-SemaphoreSlim_Release_CountWrong=The releaseCount argument must be greater than zero.
-SemaphoreSlim_Disposed=The semaphore has been disposed.
-
-; ManualResetEventSlim
-ManualResetEventSlim_ctor_SpinCountOutOfRange=The spinCount argument must be in the range 0 to {0}, inclusive.
-ManualResetEventSlim_ctor_TooManyWaiters=There are too many threads currently waiting on the event. A maximum of {0} waiting threads are supported.
-ManualResetEventSlim_Disposed=The event has been disposed.
-
-; SpinLock
-SpinLock_TryEnter_ArgumentOutOfRange=The timeout must be a value between -1 and Int32.MaxValue, inclusive.
-SpinLock_TryEnter_LockRecursionException=The calling thread already holds the lock.
-SpinLock_TryReliableEnter_ArgumentException=The tookLock argument must be set to false before calling this method.
-SpinLock_Exit_SynchronizationLockException=The calling thread does not hold the lock.
-SpinLock_IsHeldByCurrentThread=Thread tracking is disabled.
-
-; SpinWait
-SpinWait_SpinUntil_TimeoutWrong=The timeout must represent a value between -1 and Int32.MaxValue, inclusive.
-SpinWait_SpinUntil_ArgumentNull=The condition argument is null.
-
-; CdsSyncEtwBCLProvider events
-event_SpinLock_FastPathFailed=SpinLock beginning to spin.
-event_SpinWait_NextSpinWillYield=Next spin will yield.
-event_Barrier_PhaseFinished=Barrier finishing phase {1}.
-
-#if PLATFORM_UNIX
-; Unix threading
-PlatformNotSupported_NamedSynchronizationPrimitives=The named version of this synchronization primitive is not supported on this platform.
-PlatformNotSupported_NamedSyncObjectWaitAnyWaitAll=Wait operations on multiple wait handles including a named synchronization primitive are not supported on this platform.
-; OSX File locking
-PlatformNotSupported_OSXFileLocking=Locking/unlocking file regions is not supported on this platform. Use FileShare on the entire file instead.
-#endif
-
-;
-; System.Threading.Tasks
-;
-
-; AsyncMethodBuilder
-AsyncMethodBuilder_InstanceNotInitialized=The builder was not properly initialized.
-
-; TaskAwaiter and YieldAwaitable
-AwaitableAwaiter_InstanceNotInitialized=The awaitable or awaiter was not properly initialized.
-TaskAwaiter_TaskNotCompleted=The awaited task has not yet completed.
-
-; Task<T>
-TaskT_SetException_HasAnInitializer=A task's Exception may only be set directly if the task was created without a function.
-TaskT_TransitionToFinal_AlreadyCompleted=An attempt was made to transition a task to a final state when it had already completed.
-TaskT_ctor_SelfReplicating=It is invalid to specify TaskCreationOptions.SelfReplicating for a Task<TResult>.
-TaskT_DebuggerNoResult={Not yet computed}
-
-; Task
-Task_ctor_LRandSR=(Internal)An attempt was made to create a LongRunning SelfReplicating task.
-Task_ThrowIfDisposed=The task has been disposed.
-Task_Dispose_NotCompleted=A task may only be disposed if it is in a completion state (RanToCompletion, Faulted or Canceled).
-Task_Start_Promise=Start may not be called on a promise-style task.
-Task_Start_AlreadyStarted=Start may not be called on a task that was already started.
-Task_Start_TaskCompleted=Start may not be called on a task that has completed.
-Task_Start_ContinuationTask=Start may not be called on a continuation task.
-Task_RunSynchronously_AlreadyStarted=RunSynchronously may not be called on a task that was already started.
-Task_RunSynchronously_TaskCompleted=RunSynchronously may not be called on a task that has already completed.
-Task_RunSynchronously_Promise=RunSynchronously may not be called on a task not bound to a delegate, such as the task returned from an asynchronous method.
-Task_RunSynchronously_Continuation=RunSynchronously may not be called on a continuation task.
-Task_ContinueWith_NotOnAnything=The specified TaskContinuationOptions excluded all continuation kinds.
-Task_ContinueWith_ESandLR=The specified TaskContinuationOptions combined LongRunning and ExecuteSynchronously. Synchronous continuations should not be long running.
-Task_MultiTaskContinuation_NullTask=The tasks argument included a null value.
-Task_MultiTaskContinuation_FireOptions=It is invalid to exclude specific continuation kinds for continuations off of multiple tasks.
-Task_MultiTaskContinuation_EmptyTaskList=The tasks argument contains no tasks.
-Task_FromAsync_TaskManagerShutDown=FromAsync was called with a TaskManager that had already shut down.
-Task_FromAsync_SelfReplicating=It is invalid to specify TaskCreationOptions.SelfReplicating in calls to FromAsync.
-Task_FromAsync_LongRunning=It is invalid to specify TaskCreationOptions.LongRunning in calls to FromAsync.
-Task_FromAsync_PreferFairness=It is invalid to specify TaskCreationOptions.PreferFairness in calls to FromAsync.
-Task_WaitMulti_NullTask=The tasks array included at least one null element.
-Task_Delay_InvalidMillisecondsDelay=The value needs to be either -1 (signifying an infinite timeout), 0 or a positive integer.
-Task_Delay_InvalidDelay=The value needs to translate in milliseconds to -1 (signifying an infinite timeout), 0 or a positive integer less than or equal to Int32.MaxValue.
-
-; TaskCanceledException
-TaskCanceledException_ctor_DefaultMessage=A task was canceled.
-
-;TaskCompletionSource<T>
-TaskCompletionSourceT_TrySetException_NullException=The exceptions collection included at least one null element.
-TaskCompletionSourceT_TrySetException_NoExceptions=The exceptions collection was empty.
-
-;TaskExceptionHolder
-TaskExceptionHolder_UnknownExceptionType=(Internal)Expected an Exception or an IEnumerable<Exception>
-TaskExceptionHolder_UnhandledException=A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.
-
-; TaskScheduler
-TaskScheduler_ExecuteTask_TaskAlreadyExecuted=ExecuteTask may not be called for a task which was already executed.
-TaskScheduler_ExecuteTask_WrongTaskScheduler=ExecuteTask may not be called for a task which was previously queued to a different TaskScheduler.
-TaskScheduler_InconsistentStateAfterTryExecuteTaskInline=The TryExecuteTaskInline call to the underlying scheduler succeeded, but the task body was not invoked.
-TaskScheduler_FromCurrentSynchronizationContext_NoCurrent=The current SynchronizationContext may not be used as a TaskScheduler.
-
-; TaskSchedulerException
-TaskSchedulerException_ctor_DefaultMessage=An exception was thrown by a TaskScheduler.
-
-;
-; ParallelState ( used in Parallel.For(), Parallel.ForEach() )
-ParallelState_Break_InvalidOperationException_BreakAfterStop=Break was called after Stop was called.
-ParallelState_Stop_InvalidOperationException_StopAfterBreak=Stop was called after Break was called.
-ParallelState_NotSupportedException_UnsupportedMethod=This method is not supported.
-
-;
-; TPLETWProvider events
-event_ParallelLoopBegin=Beginning {3} loop {2} from Task {1}.
-event_ParallelLoopEnd=Ending loop {2} after {3} iterations.
-event_ParallelInvokeBegin=Beginning ParallelInvoke {2} from Task {1} for {4} actions.
-event_ParallelInvokeEnd=Ending ParallelInvoke {2}.
-event_ParallelFork=Task {1} entering fork/join {2}.
-event_ParallelJoin=Task {1} leaving fork/join {2}.
-event_TaskScheduled=Task {2} scheduled to TaskScheduler {0}.
-event_TaskStarted=Task {2} executing.
-event_TaskCompleted=Task {2} completed.
-event_TaskWaitBegin=Beginning wait ({3}) on Task {2}.
-event_TaskWaitEnd=Ending wait on Task {2}.
-
-
-;
-; Weak Reference Exception
-;
-WeakReference_NoLongerValid = The weak reference is no longer valid.
-
-
-;
-; Interop Exceptions
-;
-Interop.COM_TypeMismatch = Type mismatch between source and destination types.
-Interop_Marshal_Unmappable_Char = Cannot marshal: Encountered unmappable character.
-
-;
-; Loader Exceptions
-;
-Loader_InvalidPath = Relative path must be a string that contains the substring, "..", or does not contain a root directory.
-Loader_Name = Name:
-Loader_NoContextPolicies = There are no context policies.
-Loader_ContextPolicies = Context Policies:
-
-;
-; AppDomain Exceptions
-AppDomain_RequireApplicationName = ApplicationName must be set before the DynamicBase can be set.
-AppDomain_AppBaseNotSet = The ApplicationBase must be set before retrieving this property.
-AppDomain_BindingModelIsLocked = Binding model is already locked for the AppDomain and cannot be reset.
-Argument_CustomAssemblyLoadContextRequestedNameMismatch = Resolved assembly's simple name should be the same as of the requested assembly.
-
-;
-; XMLSyntaxExceptions
-XMLSyntax_UnexpectedEndOfFile = Unexpected end of file.
-XMLSyntax_ExpectedCloseBracket = Expected > character.
-XMLSyntax_ExpectedSlashOrString = Expected / character or string.
-XMLSyntax_UnexpectedCloseBracket = Unexpected > character.
-XMLSyntax_SyntaxError = Invalid syntax on line {0}.
-XMLSyntax_SyntaxErrorEx = Invalid syntax on line {0} - '{1}'.
-XMLSyntax_InvalidSyntax = Invalid syntax.
-XML_Syntax_InvalidSyntaxInFile = Invalid XML in file '{0}' near element '{1}'.
-XMLSyntax_InvalidSyntaxSatAssemTag = Invalid XML in file "{0}" near element "{1}". The <satelliteassemblies> section only supports <assembly> tags.
-XMLSyntax_InvalidSyntaxSatAssemTagBadAttr = Invalid XML in file "{0}" near "{1}" and "{2}". In the <satelliteassemblies> section, the <assembly> tag must have exactly 1 attribute called 'name', whose value is a fully-qualified assembly name.
-XMLSyntax_InvalidSyntaxSatAssemTagNoAttr = Invalid XML in file "{0}". In the <satelliteassemblies> section, the <assembly> tag must have exactly 1 attribute called 'name', whose value is a fully-qualified assembly name.
-
-; MembershipConditions
-StrongName_ToString = StrongName - {0}{1}{2}
-StrongName_Name = name = {0}
-StrongName_Version = version = {0}
-Site_ToString = Site
-Publisher_ToString = Publisher
-Hash_ToString = Hash - {0} = {1}
-ApplicationDirectory_ToString = ApplicationDirectory
-Zone_ToString = Zone - {0}
-All_ToString = All code
-Url_ToString = Url
-GAC_ToString = GAC
-
-; Interop non exception strings.
-TypeLibConverter_ImportedTypeLibProductName = Assembly imported from type library '{0}'.
-
-;
-; begin System.TimeZoneInfo ArgumentException's
-;
-Argument_AdjustmentRulesNoNulls = The AdjustmentRule array cannot contain null elements.
-Argument_AdjustmentRulesOutOfOrder = The elements of the AdjustmentRule array must be in chronological order and must not overlap.
-Argument_AdjustmentRulesAmbiguousOverlap = The elements of the AdjustmentRule array must not contain ambiguous time periods that extend beyond the DateStart or DateEnd properties of the element.
-Argument_AdjustmentRulesrDaylightSavingTimeOverlap = The elements of the AdjustmentRule array must not contain Daylight Saving Time periods that overlap adjacent elements in such a way as to cause invalid or ambiguous time periods.
-Argument_AdjustmentRulesrDaylightSavingTimeOverlapNonRuleRange = The elements of the AdjustmentRule array must not contain Daylight Saving Time periods that overlap the DateStart or DateEnd properties in such a way as to cause invalid or ambiguous time periods.
-Argument_AdjustmentRulesInvalidOverlap = The elements of the AdjustmentRule array must not contain invalid time periods that extend beyond the DateStart or DateEnd properties of the element.
-Argument_ConvertMismatch = The conversion could not be completed because the supplied DateTime did not have the Kind property set correctly. For example, when the Kind property is DateTimeKind.Local, the source time zone must be TimeZoneInfo.Local.
-Argument_DateTimeHasTimeOfDay = The supplied DateTime includes a TimeOfDay setting. This is not supported.
-Argument_DateTimeIsInvalid = The supplied DateTime represents an invalid time. For example, when the clock is adjusted forward, any time in the period that is skipped is invalid.
-Argument_DateTimeIsNotAmbiguous = The supplied DateTime is not in an ambiguous time range.
-Argument_DateTimeOffsetIsNotAmbiguous = The supplied DateTimeOffset is not in an ambiguous time range.
-Argument_DateTimeKindMustBeUnspecifiedOrUtc = The supplied DateTime must have the Kind property set to DateTimeKind.Unspecified or DateTimeKind.Utc.
-Argument_DateTimeHasTicks = The supplied DateTime must have the Year, Month, and Day properties set to 1. The time cannot be specified more precisely than whole milliseconds.
-Argument_InvalidId = The specified ID parameter '{0}' is not supported.
-Argument_InvalidSerializedString = The specified serialized string '{0}' is not supported.
-Argument_InvalidREG_TZI_FORMAT = The REG_TZI_FORMAT structure is corrupt.
-Argument_OutOfOrderDateTimes = The DateStart property must come before the DateEnd property.
-Argument_TimeSpanHasSeconds = The TimeSpan parameter cannot be specified more precisely than whole minutes.
-Argument_TimeZoneInfoBadTZif = The tzfile does not begin with the magic characters 'TZif'. Please verify that the file is not corrupt.
-Argument_TimeZoneInfoInvalidTZif = The TZif data structure is corrupt.
-Argument_TransitionTimesAreIdentical = The DaylightTransitionStart property must not equal the DaylightTransitionEnd property.
-;
-; begin System.TimeZoneInfo ArgumentOutOfRangeException's
-;
-ArgumentOutOfRange_DayParam = The Day parameter must be in the range 1 through 31.
-ArgumentOutOfRange_DayOfWeek = The DayOfWeek enumeration must be in the range 0 through 6.
-ArgumentOutOfRange_MonthParam = The Month parameter must be in the range 1 through 12.
-ArgumentOutOfRange_UtcOffset = The TimeSpan parameter must be within plus or minus 14.0 hours.
-ArgumentOutOfRange_UtcOffsetAndDaylightDelta = The sum of the BaseUtcOffset and DaylightDelta properties must within plus or minus 14.0 hours.
-ArgumentOutOfRange_Week = The Week parameter must be in the range 1 through 5.
-;
-; begin System.TimeZoneInfo InvalidTimeZoneException's
-;
-InvalidTimeZone_InvalidRegistryData = The time zone ID '{0}' was found on the local computer, but the registry information was corrupt.
-InvalidTimeZone_InvalidFileData = The time zone ID '{0}' was found on the local computer, but the file at '{1}' was corrupt.
-InvalidTimeZone_InvalidWin32APIData = The Local time zone was found on the local computer, but the data was corrupt.
-InvalidTimeZone_NoTTInfoStructures = There are no ttinfo structures in the tzfile. At least one ttinfo structure is required in order to construct a TimeZoneInfo object.
-InvalidTimeZone_UnparseablePosixMDateString = '{0}' is not a valid POSIX-TZ-environment-variable MDate rule. A valid rule has the format 'Mm.w.d'.
-InvalidTimeZone_JulianDayNotSupported = Julian dates in POSIX strings are unsupported.
-;
-; begin System.TimeZoneInfo SecurityException's
-;
-Security_CannotReadRegistryData = The time zone ID '{0}' was found on the local computer, but the application does not have permission to read the registry information.
-Security_CannotReadFileData = The time zone ID '{0}' was found on the local computer, but the application does not have permission to read the file.
-;
-; begin System.TimeZoneInfo SerializationException's
-;
-Serialization_CorruptField = The value of the field '{0}' is invalid. The serialized data is corrupt.
-Serialization_InvalidEscapeSequence = The serialized data contained an invalid escape sequence '\\{0}'.
-;
-; begin System.TimeZoneInfo TimeZoneNotFoundException's
-;
-TimeZoneNotFound_MissingData = The time zone ID '{0}' was not found on the local computer.
-;
-; end System.TimeZoneInfo
-;
-
-
-; Tuple
-ArgumentException_TupleIncorrectType=Argument must be of type {0}.
-ArgumentException_TupleNonIComparableElement=The tuple contains an element of type {0} which does not implement the IComparable interface.
-ArgumentException_TupleLastArgumentNotATuple=The last element of an eight element tuple must be a Tuple.
-ArgumentException_OtherNotArrayOfCorrectLength=Object is not a array with the same number of elements as the array to compare it to.
-
-; WinRT collection adapters
-Argument_IndexOutOfArrayBounds=The specified index is out of bounds of the specified array.
-Argument_InsufficientSpaceToCopyCollection=The specified space is not sufficient to copy the elements from this Collection.
-ArgumentOutOfRange_IndexLargerThanMaxValue=This collection cannot work with indices larger than Int32.MaxValue - 1 (0x7FFFFFFF - 1).
-ArgumentOutOfRange_IndexOutOfRange=The specified index is outside the current index range of this collection.
-InvalidOperation_CollectionBackingListTooLarge=The collection backing this List contains too many elements.
-InvalidOperation_CollectionBackingDictionaryTooLarge=The collection backing this Dictionary contains too many elements.
-InvalidOperation_CannotRemoveLastFromEmptyCollection=Cannot remove the last element from an empty collection.
-
-; Buffers
-ArgumentException_BufferNotFromPool=The buffer is not associated with this pool and may not be returned to it.
-
-;------------------
-; Encoding names:
-;
-;Total items: 147
-;
-Globalization.cp_1200 = Unicode
-Globalization.cp_1201 = Unicode (Big-Endian)
-Globalization.cp_65001 = Unicode (UTF-8)
-Globalization.cp_65000 = Unicode (UTF-7)
-Globalization.cp_12000 = Unicode (UTF-32)
-Globalization.cp_12001 = Unicode (UTF-32 Big-Endian)
-Globalization.cp_20127 = US-ASCII
-Globalization.cp_28591 = Western European (ISO)
-
-#endif // INCLUDE_DEBUG
-
-;------------------
-
-; ValueTuple
-ArgumentException_ValueTupleIncorrectType=Argument must be of type {0}.
-ArgumentException_ValueTupleLastArgumentNotAValueTuple=The last element of an eight element ValueTuple must be a ValueTuple.
-
-; SafeSerializationEventArgs
-Serialization_NonSerType=Type '{0}' in Assembly '{1}' is not marked as serializable.
-
diff --git a/src/mscorlib/src/System/Activator.cs b/src/mscorlib/src/System/Activator.cs
index 3ee9ec5180..34c6ea5874 100644
--- a/src/mscorlib/src/System/Activator.cs
+++ b/src/mscorlib/src/System/Activator.cs
@@ -66,7 +66,7 @@ namespace System
Contract.EndContractBlock();
if (type is System.Reflection.Emit.TypeBuilder)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_CreateInstanceWithTypeBuilder"));
+ throw new NotSupportedException(SR.NotSupported_CreateInstanceWithTypeBuilder);
// If they didn't specify a lookup, then we will provide the default lookup.
if ((bindingAttr & (BindingFlags)LookupMask) == 0)
@@ -74,13 +74,13 @@ namespace System
if (activationAttributes != null && activationAttributes.Length > 0)
{
- throw new PlatformNotSupportedException(Environment.GetResourceString("NotSupported_ActivAttr"));
+ throw new PlatformNotSupportedException(SR.NotSupported_ActivAttr);
}
RuntimeType rt = type.UnderlyingSystemType as RuntimeType;
if (rt == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(type));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(type));
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return rt.CreateInstanceImpl(bindingAttr, binder, args, culture, activationAttributes, ref stackMark);
@@ -164,7 +164,7 @@ namespace System
RuntimeType rt = type.UnderlyingSystemType as RuntimeType;
if (rt == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(type));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(type));
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return rt.CreateInstanceDefaultCtor(!nonPublic, false, true, ref stackMark);
@@ -178,7 +178,7 @@ namespace System
// This is a workaround to maintain compatibility with V2. Without this we would throw a NotSupportedException for void[].
// Array, Ref, and Pointer types don't have default constructors.
if (rt.HasElementType)
- throw new MissingMethodException(Environment.GetResourceString("Arg_NoDefCTor"));
+ throw new MissingMethodException(SR.Arg_NoDefCTor);
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -371,7 +371,7 @@ namespace System
if (Attr.Length > 0)
{
if (((ComVisibleAttribute)Attr[0]).Value == false)
- throw new TypeLoadException(Environment.GetResourceString("Argument_TypeMustBeVisibleFromCom"));
+ throw new TypeLoadException(SR.Argument_TypeMustBeVisibleFromCom);
}
Log(assembly != null, "CreateInstance:: ", "Loaded " + assembly.FullName, "Failed to Load: " + assemblyName);
diff --git a/src/mscorlib/src/System/AggregateException.cs b/src/mscorlib/src/System/AggregateException.cs
index 3a3b08dc04..22bc323215 100644
--- a/src/mscorlib/src/System/AggregateException.cs
+++ b/src/mscorlib/src/System/AggregateException.cs
@@ -38,7 +38,7 @@ namespace System
/// Initializes a new instance of the <see cref="AggregateException"/> class.
/// </summary>
public AggregateException()
- : base(Environment.GetResourceString("AggregateException_ctor_DefaultMessage"))
+ : base(SR.AggregateException_ctor_DefaultMessage)
{
m_innerExceptions = new ReadOnlyCollection<Exception>(new Exception[0]);
}
@@ -83,7 +83,7 @@ namespace System
/// <exception cref="T:System.ArgumentException">An element of <paramref name="innerExceptions"/> is
/// null.</exception>
public AggregateException(IEnumerable<Exception> innerExceptions) :
- this(Environment.GetResourceString("AggregateException_ctor_DefaultMessage"), innerExceptions)
+ this(SR.AggregateException_ctor_DefaultMessage, innerExceptions)
{
}
@@ -97,7 +97,7 @@ namespace System
/// <exception cref="T:System.ArgumentException">An element of <paramref name="innerExceptions"/> is
/// null.</exception>
public AggregateException(params Exception[] innerExceptions) :
- this(Environment.GetResourceString("AggregateException_ctor_DefaultMessage"), innerExceptions)
+ this(SR.AggregateException_ctor_DefaultMessage, innerExceptions)
{
}
@@ -161,7 +161,7 @@ namespace System
if (exceptionsCopy[i] == null)
{
- throw new ArgumentException(Environment.GetResourceString("AggregateException_ctor_InnerExceptionNull"));
+ throw new ArgumentException(SR.AggregateException_ctor_InnerExceptionNull);
}
}
@@ -180,7 +180,7 @@ namespace System
/// <exception cref="T:System.ArgumentException">An element of <paramref name="innerExceptionInfos"/> is
/// null.</exception>
internal AggregateException(IEnumerable<ExceptionDispatchInfo> innerExceptionInfos) :
- this(Environment.GetResourceString("AggregateException_ctor_DefaultMessage"), innerExceptionInfos)
+ this(SR.AggregateException_ctor_DefaultMessage, innerExceptionInfos)
{
}
@@ -240,7 +240,7 @@ namespace System
if (exceptionsCopy[i] == null)
{
- throw new ArgumentException(Environment.GetResourceString("AggregateException_ctor_InnerExceptionNull"));
+ throw new ArgumentException(SR.AggregateException_ctor_InnerExceptionNull);
}
}
@@ -267,7 +267,7 @@ namespace System
Exception[] innerExceptions = info.GetValue("InnerExceptions", typeof(Exception[])) as Exception[];
if (innerExceptions == null)
{
- throw new SerializationException(Environment.GetResourceString("AggregateException_DeserializationFailure"));
+ throw new SerializationException(SR.AggregateException_DeserializationFailure);
}
m_innerExceptions = new ReadOnlyCollection<Exception>(innerExceptions);
@@ -466,7 +466,7 @@ namespace System
{
text = String.Format(
CultureInfo.InvariantCulture,
- Environment.GetResourceString("AggregateException_ToString"),
+ SR.AggregateException_ToString,
text, Environment.NewLine, i, m_innerExceptions[i].ToString(), "<---", Environment.NewLine);
}
diff --git a/src/mscorlib/src/System/AppContext/AppContext.cs b/src/mscorlib/src/System/AppContext/AppContext.cs
index b8d3076e8c..7c7e74f19b 100644
--- a/src/mscorlib/src/System/AppContext/AppContext.cs
+++ b/src/mscorlib/src/System/AppContext/AppContext.cs
@@ -116,7 +116,7 @@ namespace System
if (switchName == null)
throw new ArgumentNullException(nameof(switchName));
if (switchName.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(switchName));
+ throw new ArgumentException(SR.Argument_EmptyName, nameof(switchName));
// By default, the switch is not enabled.
isEnabled = false;
@@ -212,7 +212,7 @@ namespace System
if (switchName == null)
throw new ArgumentNullException(nameof(switchName));
if (switchName.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(switchName));
+ throw new ArgumentException(SR.Argument_EmptyName, nameof(switchName));
SwitchValueState switchValue = (isEnabled ? SwitchValueState.HasTrueValue : SwitchValueState.HasFalseValue)
| SwitchValueState.HasLookedForOverride;
diff --git a/src/mscorlib/src/System/AppDomain.cs b/src/mscorlib/src/System/AppDomain.cs
index 4db0c15fda..7d2f2ceaf8 100644
--- a/src/mscorlib/src/System/AppDomain.cs
+++ b/src/mscorlib/src/System/AppDomain.cs
@@ -37,63 +37,6 @@ namespace System
using System.Diagnostics.Contracts;
using System.Runtime.ExceptionServices;
- public class ResolveEventArgs : EventArgs
- {
- private String _Name;
- private Assembly _RequestingAssembly;
-
- public String Name
- {
- get
- {
- return _Name;
- }
- }
-
- public Assembly RequestingAssembly
- {
- get
- {
- return _RequestingAssembly;
- }
- }
-
- public ResolveEventArgs(String name)
- {
- _Name = name;
- }
-
- public ResolveEventArgs(String name, Assembly requestingAssembly)
- {
- _Name = name;
- _RequestingAssembly = requestingAssembly;
- }
- }
-
- public class AssemblyLoadEventArgs : EventArgs
- {
- private Assembly _LoadedAssembly;
-
- public Assembly LoadedAssembly
- {
- get
- {
- return _LoadedAssembly;
- }
- }
-
- public AssemblyLoadEventArgs(Assembly loadedAssembly)
- {
- _LoadedAssembly = loadedAssembly;
- }
- }
-
- [Serializable]
- public delegate Assembly ResolveEventHandler(Object sender, ResolveEventArgs args);
-
- [Serializable]
- public delegate void AssemblyLoadEventHandler(Object sender, AssemblyLoadEventArgs args);
-
[Serializable]
internal delegate void AppDomainInitializer(string[] args);
@@ -133,7 +76,7 @@ namespace System
if (nested != null)
nestedDelegates.Add(nested);
else
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeStatic"),
+ throw new ArgumentException(SR.Arg_MustBeStatic,
list[i].Method.ReflectedType.FullName + "::" + list[i].Method.Name);
}
else
@@ -341,7 +284,7 @@ namespace System
// uninitialized object through remoting, etc.
if (_pDomain.IsNull())
{
- throw new InvalidOperationException(Environment.GetResourceString("Argument_InvalidHandle"));
+ throw new InvalidOperationException(SR.Argument_InvalidHandle);
}
return new AppDomainHandle(_pDomain);
@@ -397,20 +340,20 @@ namespace System
}
catch (FileNotFoundException e)
{
- throw new TypeLoadException(Environment.GetResourceString("Argument_NoDomainManager"), e);
+ throw new TypeLoadException(SR.Argument_NoDomainManager, e);
}
catch (SecurityException e)
{
- throw new TypeLoadException(Environment.GetResourceString("Argument_NoDomainManager"), e);
+ throw new TypeLoadException(SR.Argument_NoDomainManager, e);
}
catch (TypeLoadException e)
{
- throw new TypeLoadException(Environment.GetResourceString("Argument_NoDomainManager"), e);
+ throw new TypeLoadException(SR.Argument_NoDomainManager, e);
}
if (_domainManager == null)
{
- throw new TypeLoadException(Environment.GetResourceString("Argument_NoDomainManager"));
+ throw new TypeLoadException(SR.Argument_NoDomainManager);
}
// If this domain was not created by a managed call to CreateDomain, then the AppDomainSetup
@@ -501,7 +444,7 @@ namespace System
{
#if FEATURE_APPX
if (IsAppXModel())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_AppX", "Assembly.LoadFrom"));
+ throw new NotSupportedException(SR.Format(SR.NotSupported_AppX, "Assembly.LoadFrom"));
#endif
}
@@ -513,7 +456,7 @@ namespace System
{
#if FEATURE_APPX
if (IsAppXModel())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_AppX", "Assembly.LoadFile"));
+ throw new NotSupportedException(SR.Format(SR.NotSupported_AppX, "Assembly.LoadFile"));
#endif
}
@@ -525,7 +468,7 @@ namespace System
{
#if FEATURE_APPX
if (IsAppXModel())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_AppX", "Assembly.ReflectionOnlyLoad"));
+ throw new NotSupportedException(SR.Format(SR.NotSupported_AppX, "Assembly.ReflectionOnlyLoad"));
#endif
}
@@ -537,7 +480,7 @@ namespace System
{
#if FEATURE_APPX
if (IsAppXModel())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_AppX", "Assembly.Load(byte[], ...)"));
+ throw new NotSupportedException(SR.Format(SR.NotSupported_AppX, "Assembly.Load(byte[], ...)"));
#endif
}
@@ -682,16 +625,16 @@ namespace System
String fn = nGetFriendlyName();
if (fn != null)
{
- sb.Append(Environment.GetResourceString("Loader_Name") + fn);
+ sb.Append(SR.Loader_Name + fn);
sb.Append(Environment.NewLine);
}
if (_Policies == null || _Policies.Length == 0)
- sb.Append(Environment.GetResourceString("Loader_NoContextPolicies")
+ sb.Append(SR.Loader_NoContextPolicies
+ Environment.NewLine);
else
{
- sb.Append(Environment.GetResourceString("Loader_ContextPolicies")
+ sb.Append(SR.Loader_ContextPolicies
+ Environment.NewLine);
for (int i = 0; i < _Policies.Length; i++)
{
@@ -729,7 +672,7 @@ namespace System
}
if (currentVal != null)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_SetData_OnlyOnce"));
+ throw new InvalidOperationException(SR.InvalidOperation_SetData_OnlyOnce);
}
lock (((ICollection)LocalStore).SyncRoot)
@@ -785,7 +728,7 @@ namespace System
private AppDomain()
{
- throw new NotSupportedException(Environment.GetResourceString(ResId.NotSupported_Constructor));
+ throw new NotSupportedException(SR.GetResourceString(ResId.NotSupported_Constructor));
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -1153,7 +1096,7 @@ namespace System
throw new ArgumentNullException("APPBASE");
if (PathInternal.IsPartiallyQualified(propertyValues[i]))
- throw new ArgumentException(Environment.GetResourceString("Argument_AbsolutePathRequired"));
+ throw new ArgumentException(SR.Argument_AbsolutePathRequired);
newSetup.ApplicationBase = NormalizePath(propertyValues[i], fullCheck: true);
}
@@ -1168,7 +1111,7 @@ namespace System
case "MultiDomain": newSetup.LoaderOptimization = LoaderOptimization.MultiDomain; break;
case "MultiDomainHost": newSetup.LoaderOptimization = LoaderOptimization.MultiDomainHost; break;
case "NotSpecified": newSetup.LoaderOptimization = LoaderOptimization.NotSpecified; break;
- default: throw new ArgumentException(Environment.GetResourceString("Argument_UnrecognizedLoaderOptimization"), "LOADER_OPTIMIZATION");
+ default: throw new ArgumentException(SR.Argument_UnrecognizedLoaderOptimization, "LOADER_OPTIMIZATION");
}
}
else if (propertyNames[i] == "TRUSTED_PLATFORM_ASSEMBLIES" ||
@@ -1254,7 +1197,7 @@ namespace System
continue;
if (PathInternal.IsPartiallyQualified(path))
- throw new ArgumentException(Environment.GetResourceString("Argument_AbsolutePathRequired"));
+ throw new ArgumentException(SR.Argument_AbsolutePathRequired);
string appPath = NormalizePath(path, fullCheck: true);
sb.Append(appPath);
diff --git a/src/mscorlib/src/System/AppDomainManager.cs b/src/mscorlib/src/System/AppDomainManager.cs
index 1c7fb08d98..830de29c16 100644
--- a/src/mscorlib/src/System/AppDomainManager.cs
+++ b/src/mscorlib/src/System/AppDomainManager.cs
@@ -55,10 +55,5 @@ namespace System
return AppDomain.CurrentDomain.DomainManager;
}
}
-
- public virtual bool CheckSecuritySettings(SecurityState state)
- {
- return false;
- }
}
}
diff --git a/src/mscorlib/src/System/AppDomainSetup.cs b/src/mscorlib/src/System/AppDomainSetup.cs
index a8a1d09a5f..2529660670 100644
--- a/src/mscorlib/src/System/AppDomainSetup.cs
+++ b/src/mscorlib/src/System/AppDomainSetup.cs
@@ -261,14 +261,14 @@ namespace System
// with it for "file:\\" + "\\server" and "file:\\\" + "\localpath"
if ((len > 8) &&
((path[8] == '\\') || (path[8] == '/')))
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidPathChars"));
+ throw new ArgumentException(SR.Argument_InvalidPathChars);
// file:\\\ means local path
else
#if !PLATFORM_UNIX
trim = 8;
#else
- // For Unix platform, trim the first 7 charcaters only.
+ // For Unix platform, trim the first 7 characters only.
// Trimming the first 8 characters will cause
// the root path separator to be trimmed away,
// and the absolute local path becomes a relative local path.
@@ -369,7 +369,7 @@ namespace System
String appBase = Value[(int)LoaderInformation.ApplicationBaseValue];
if ((appBase == null) || (appBase.Length == 0))
- throw new MemberAccessException(Environment.GetResourceString("AppDomain_AppBaseNotSet"));
+ throw new MemberAccessException(SR.AppDomain_AppBaseNotSet);
StringBuilder result = StringBuilderCache.Acquire();
diff --git a/src/mscorlib/src/System/AppDomainUnloadedException.cs b/src/mscorlib/src/System/AppDomainUnloadedException.cs
index b8b6150c9f..b11ae3381e 100644
--- a/src/mscorlib/src/System/AppDomainUnloadedException.cs
+++ b/src/mscorlib/src/System/AppDomainUnloadedException.cs
@@ -20,7 +20,7 @@ namespace System
internal class AppDomainUnloadedException : SystemException
{
public AppDomainUnloadedException()
- : base(Environment.GetResourceString("Arg_AppDomainUnloadedException"))
+ : base(SR.Arg_AppDomainUnloadedException)
{
SetErrorCode(__HResults.COR_E_APPDOMAINUNLOADED);
}
diff --git a/src/mscorlib/src/System/ArgIterator.cs b/src/mscorlib/src/System/ArgIterator.cs
index 394d579b94..584f85fbd3 100644
--- a/src/mscorlib/src/System/ArgIterator.cs
+++ b/src/mscorlib/src/System/ArgIterator.cs
@@ -131,55 +131,55 @@ namespace System
// Inherited from object
public override bool Equals(Object o)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NYI"));
+ throw new NotSupportedException(SR.NotSupported_NYI);
}
#else
public ArgIterator(RuntimeArgumentHandle arglist)
{
- throw new PlatformNotSupportedException(); //The JIT requires work to enable ArgIterator see: https://github.com/dotnet/coreclr/issues/9204.
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ArgIterator); // https://github.com/dotnet/coreclr/issues/9204
}
[CLSCompliant(false)]
public unsafe ArgIterator(RuntimeArgumentHandle arglist, void* ptr)
{
- throw new PlatformNotSupportedException(); //The JIT requires work to enable ArgIterator see: https://github.com/dotnet/coreclr/issues/9204.
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ArgIterator); // https://github.com/dotnet/coreclr/issues/9204
}
public void End()
{
- throw new PlatformNotSupportedException(); //The JIT requires work to enable ArgIterator see: https://github.com/dotnet/coreclr/issues/9204.
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ArgIterator); // https://github.com/dotnet/coreclr/issues/9204
}
public override bool Equals(Object o)
{
- throw new PlatformNotSupportedException(); //The JIT requires work to enable ArgIterator see: https://github.com/dotnet/coreclr/issues/9204.
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ArgIterator); // https://github.com/dotnet/coreclr/issues/9204
}
public override int GetHashCode()
{
- throw new PlatformNotSupportedException(); //The JIT requires work to enable ArgIterator see: https://github.com/dotnet/coreclr/issues/9204.
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ArgIterator); // https://github.com/dotnet/coreclr/issues/9204
}
[System.CLSCompliantAttribute(false)]
public System.TypedReference GetNextArg()
{
- throw new PlatformNotSupportedException(); //The JIT requires work to enable ArgIterator see: https://github.com/dotnet/coreclr/issues/9204.
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ArgIterator); // https://github.com/dotnet/coreclr/issues/9204
}
[System.CLSCompliantAttribute(false)]
public System.TypedReference GetNextArg(System.RuntimeTypeHandle rth)
{
- throw new PlatformNotSupportedException(); //The JIT requires work to enable ArgIterator see: https://github.com/dotnet/coreclr/issues/9204.
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ArgIterator); // https://github.com/dotnet/coreclr/issues/9204
}
public unsafe System.RuntimeTypeHandle GetNextArgType()
{
- throw new PlatformNotSupportedException(); //The JIT requires work to enable ArgIterator see: https://github.com/dotnet/coreclr/issues/9204.
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ArgIterator); // https://github.com/dotnet/coreclr/issues/9204
}
public int GetRemainingCount()
{
- throw new PlatformNotSupportedException(); //The JIT requires work to enable ArgIterator see: https://github.com/dotnet/coreclr/issues/9204.
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ArgIterator); // https://github.com/dotnet/coreclr/issues/9204
}
#endif //VARARGS_ENABLED
}
diff --git a/src/mscorlib/src/System/ArgumentOutOfRangeException.cs b/src/mscorlib/src/System/ArgumentOutOfRangeException.cs
index a20b43ff1f..a5f838a70f 100644
--- a/src/mscorlib/src/System/ArgumentOutOfRangeException.cs
+++ b/src/mscorlib/src/System/ArgumentOutOfRangeException.cs
@@ -33,7 +33,7 @@ namespace System
get
{
if (_rangeMessage == null)
- _rangeMessage = Environment.GetResourceString("Arg_ArgumentOutOfRangeException");
+ _rangeMessage = SR.Arg_ArgumentOutOfRangeException;
return _rangeMessage;
}
}
@@ -81,7 +81,7 @@ namespace System
String s = base.Message;
if (m_actualValue != null)
{
- String valueMessage = Environment.GetResourceString("ArgumentOutOfRange_ActualValue", m_actualValue.ToString());
+ String valueMessage = SR.Format(SR.ArgumentOutOfRange_ActualValue, m_actualValue.ToString());
if (s == null)
return valueMessage;
return s + Environment.NewLine + valueMessage;
diff --git a/src/mscorlib/src/System/ArraySegment.cs b/src/mscorlib/src/System/ArraySegment.cs
index 1e127e3a17..e0118c2cbf 100644
--- a/src/mscorlib/src/System/ArraySegment.cs
+++ b/src/mscorlib/src/System/ArraySegment.cs
@@ -15,6 +15,7 @@
using System.Collections;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Diagnostics.Contracts;
namespace System
diff --git a/src/mscorlib/src/System/Attribute.cs b/src/mscorlib/src/System/Attribute.cs
index 7ffbedf78d..baa9a71638 100644
--- a/src/mscorlib/src/System/Attribute.cs
+++ b/src/mscorlib/src/System/Attribute.cs
@@ -431,7 +431,7 @@ namespace System
return AttributeUsageAttribute.Default;
throw new FormatException(
- Environment.GetResourceString("Format_AttributeUsage", type));
+ SR.Format(SR.Format_AttributeUsage, type));
}
private static Attribute[] CreateAttributeArrayHelper(Type elementType, int elementCount)
@@ -459,7 +459,7 @@ namespace System
throw new ArgumentNullException(nameof(type));
if (!type.IsSubclassOf(typeof(Attribute)) && type != typeof(Attribute))
- throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
+ throw new ArgumentException(SR.Argument_MustHaveAttributeBaseClass);
Contract.EndContractBlock();
switch (element.MemberType)
@@ -514,7 +514,7 @@ namespace System
throw new ArgumentNullException(nameof(attributeType));
if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
- throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
+ throw new ArgumentException(SR.Argument_MustHaveAttributeBaseClass);
Contract.EndContractBlock();
switch (element.MemberType)
@@ -545,7 +545,7 @@ namespace System
if (attrib.Length == 1)
return attrib[0];
- throw new AmbiguousMatchException(Environment.GetResourceString("RFLCT.AmbigCust"));
+ throw new AmbiguousMatchException(SR.RFLCT_AmbigCust);
}
#endregion
@@ -570,10 +570,10 @@ namespace System
throw new ArgumentNullException(nameof(attributeType));
if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
- throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
+ throw new ArgumentException(SR.Argument_MustHaveAttributeBaseClass);
if (element.Member == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidParameterInfo"), nameof(element));
+ throw new ArgumentException(SR.Argument_InvalidParameterInfo, nameof(element));
Contract.EndContractBlock();
@@ -590,7 +590,7 @@ namespace System
throw new ArgumentNullException(nameof(element));
if (element.Member == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidParameterInfo"), nameof(element));
+ throw new ArgumentException(SR.Argument_InvalidParameterInfo, nameof(element));
Contract.EndContractBlock();
@@ -616,7 +616,7 @@ namespace System
throw new ArgumentNullException(nameof(attributeType));
if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
- throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
+ throw new ArgumentException(SR.Argument_MustHaveAttributeBaseClass);
Contract.EndContractBlock();
MemberInfo member = element.Member;
@@ -634,7 +634,7 @@ namespace System
default:
Debug.Assert(false, "Invalid type for ParameterInfo member in Attribute class");
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidParamInfo"));
+ throw new ArgumentException(SR.Argument_InvalidParamInfo);
}
}
@@ -658,7 +658,7 @@ namespace System
if (attrib.Length == 1)
return attrib[0];
- throw new AmbiguousMatchException(Environment.GetResourceString("RFLCT.AmbigCust"));
+ throw new AmbiguousMatchException(SR.RFLCT_AmbigCust);
}
#endregion
@@ -692,7 +692,7 @@ namespace System
throw new ArgumentNullException(nameof(attributeType));
if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
- throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
+ throw new ArgumentException(SR.Argument_MustHaveAttributeBaseClass);
Contract.EndContractBlock();
return (Attribute[])element.GetCustomAttributes(attributeType, inherit);
@@ -713,7 +713,7 @@ namespace System
throw new ArgumentNullException(nameof(attributeType));
if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
- throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
+ throw new ArgumentException(SR.Argument_MustHaveAttributeBaseClass);
Contract.EndContractBlock();
return element.IsDefined(attributeType, false);
@@ -736,7 +736,7 @@ namespace System
if (attrib.Length == 1)
return attrib[0];
- throw new AmbiguousMatchException(Environment.GetResourceString("RFLCT.AmbigCust"));
+ throw new AmbiguousMatchException(SR.RFLCT_AmbigCust);
}
#endregion
@@ -756,7 +756,7 @@ namespace System
throw new ArgumentNullException(nameof(attributeType));
if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
- throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
+ throw new ArgumentException(SR.Argument_MustHaveAttributeBaseClass);
Contract.EndContractBlock();
return (Attribute[])element.GetCustomAttributes(attributeType, inherit);
@@ -791,7 +791,7 @@ namespace System
throw new ArgumentNullException(nameof(attributeType));
if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
- throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
+ throw new ArgumentException(SR.Argument_MustHaveAttributeBaseClass);
Contract.EndContractBlock();
return element.IsDefined(attributeType, false);
@@ -814,7 +814,7 @@ namespace System
if (attrib.Length == 1)
return attrib[0];
- throw new AmbiguousMatchException(Environment.GetResourceString("RFLCT.AmbigCust"));
+ throw new AmbiguousMatchException(SR.RFLCT_AmbigCust);
}
#endregion
diff --git a/src/mscorlib/src/System/BadImageFormatException.cs b/src/mscorlib/src/System/BadImageFormatException.cs
index 13d9556f1d..9cb692fc05 100644
--- a/src/mscorlib/src/System/BadImageFormatException.cs
+++ b/src/mscorlib/src/System/BadImageFormatException.cs
@@ -26,7 +26,7 @@ namespace System
private String _fusionLog; // fusion log (when applicable)
public BadImageFormatException()
- : base(Environment.GetResourceString("Arg_BadImageFormatException"))
+ : base(SR.Arg_BadImageFormatException)
{
SetErrorCode(__HResults.COR_E_BADIMAGEFORMAT);
}
@@ -71,7 +71,7 @@ namespace System
{
if ((_fileName == null) &&
(HResult == System.__HResults.COR_E_EXCEPTION))
- _message = Environment.GetResourceString("Arg_BadImageFormatException");
+ _message = SR.Arg_BadImageFormatException;
else
_message = FileLoadException.FormatFileLoadExceptionMessage(_fileName, HResult);
@@ -88,7 +88,7 @@ namespace System
String s = GetType().FullName + ": " + Message;
if (_fileName != null && _fileName.Length != 0)
- s += Environment.NewLine + Environment.GetResourceString("IO.FileName_Name", _fileName);
+ s += Environment.NewLine + SR.Format(SR.IO_FileName_Name, _fileName);
if (InnerException != null)
s = s + " ---> " + InnerException.ToString();
diff --git a/src/mscorlib/src/System/Boolean.cs b/src/mscorlib/src/System/Boolean.cs
index 7a7ac0eee8..fe25e22920 100644
--- a/src/mscorlib/src/System/Boolean.cs
+++ b/src/mscorlib/src/System/Boolean.cs
@@ -134,7 +134,7 @@ namespace System
}
if (!(obj is Boolean))
{
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeBoolean"));
+ throw new ArgumentException(SR.Arg_MustBeBoolean);
}
if (m_value == ((Boolean)obj).m_value)
@@ -174,7 +174,7 @@ namespace System
Boolean result = false;
if (!TryParse(value, out result))
{
- throw new FormatException(Environment.GetResourceString("Format_BadBoolean"));
+ throw new FormatException(SR.Format_BadBoolean);
}
else
{
@@ -259,91 +259,76 @@ namespace System
}
- /// <internalonly/>
bool IConvertible.ToBoolean(IFormatProvider provider)
{
return m_value;
}
- /// <internalonly/>
char IConvertible.ToChar(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "Boolean", "Char"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Boolean", "Char"));
}
- /// <internalonly/>
sbyte IConvertible.ToSByte(IFormatProvider provider)
{
return Convert.ToSByte(m_value);
}
- /// <internalonly/>
byte IConvertible.ToByte(IFormatProvider provider)
{
return Convert.ToByte(m_value);
}
- /// <internalonly/>
short IConvertible.ToInt16(IFormatProvider provider)
{
return Convert.ToInt16(m_value);
}
- /// <internalonly/>
ushort IConvertible.ToUInt16(IFormatProvider provider)
{
return Convert.ToUInt16(m_value);
}
- /// <internalonly/>
int IConvertible.ToInt32(IFormatProvider provider)
{
return Convert.ToInt32(m_value);
}
- /// <internalonly/>
uint IConvertible.ToUInt32(IFormatProvider provider)
{
return Convert.ToUInt32(m_value);
}
- /// <internalonly/>
long IConvertible.ToInt64(IFormatProvider provider)
{
return Convert.ToInt64(m_value);
}
- /// <internalonly/>
ulong IConvertible.ToUInt64(IFormatProvider provider)
{
return Convert.ToUInt64(m_value);
}
- /// <internalonly/>
float IConvertible.ToSingle(IFormatProvider provider)
{
return Convert.ToSingle(m_value);
}
- /// <internalonly/>
double IConvertible.ToDouble(IFormatProvider provider)
{
return Convert.ToDouble(m_value);
}
- /// <internalonly/>
Decimal IConvertible.ToDecimal(IFormatProvider provider)
{
return Convert.ToDecimal(m_value);
}
- /// <internalonly/>
DateTime IConvertible.ToDateTime(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "Boolean", "DateTime"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Boolean", "DateTime"));
}
- /// <internalonly/>
Object IConvertible.ToType(Type type, IFormatProvider provider)
{
return Convert.DefaultToType((IConvertible)this, type, provider);
diff --git a/src/mscorlib/src/System/Buffer.cs b/src/mscorlib/src/System/Buffer.cs
index 5c14d73aa6..92b938df8c 100644
--- a/src/mscorlib/src/System/Buffer.cs
+++ b/src/mscorlib/src/System/Buffer.cs
@@ -142,7 +142,7 @@ namespace System
// Is it of primitive types?
if (!IsPrimitiveTypeArray(array))
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBePrimArray"), nameof(array));
+ throw new ArgumentException(SR.Arg_MustBePrimArray, nameof(array));
// Is the index in valid range of the array?
if (index < 0 || index >= _ByteLength(array))
@@ -168,7 +168,7 @@ namespace System
// Is it of primitive types?
if (!IsPrimitiveTypeArray(array))
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBePrimArray"), nameof(array));
+ throw new ArgumentException(SR.Arg_MustBePrimArray, nameof(array));
// Is the index in valid range of the array?
if (index < 0 || index >= _ByteLength(array))
@@ -196,7 +196,7 @@ namespace System
// Is it of primitive types?
if (!IsPrimitiveTypeArray(array))
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBePrimArray"), nameof(array));
+ throw new ArgumentException(SR.Arg_MustBePrimArray, nameof(array));
return _ByteLength(array);
}
diff --git a/src/mscorlib/src/System/Byte.cs b/src/mscorlib/src/System/Byte.cs
index 9d603600fc..27fdcd7a64 100644
--- a/src/mscorlib/src/System/Byte.cs
+++ b/src/mscorlib/src/System/Byte.cs
@@ -51,7 +51,7 @@ namespace System
}
if (!(value is Byte))
{
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeByte"));
+ throw new ArgumentException(SR.Arg_MustBeByte);
}
return m_value - (((Byte)value).m_value);
@@ -123,10 +123,10 @@ namespace System
}
catch (OverflowException e)
{
- throw new OverflowException(Environment.GetResourceString("Overflow_Byte"), e);
+ throw new OverflowException(SR.Overflow_Byte, e);
}
- if (i < MinValue || i > MaxValue) throw new OverflowException(Environment.GetResourceString("Overflow_Byte"));
+ if (i < MinValue || i > MaxValue) throw new OverflowException(SR.Overflow_Byte);
return (byte)i;
}
@@ -195,91 +195,76 @@ namespace System
}
- /// <internalonly/>
bool IConvertible.ToBoolean(IFormatProvider provider)
{
return Convert.ToBoolean(m_value);
}
- /// <internalonly/>
char IConvertible.ToChar(IFormatProvider provider)
{
return Convert.ToChar(m_value);
}
- /// <internalonly/>
sbyte IConvertible.ToSByte(IFormatProvider provider)
{
return Convert.ToSByte(m_value);
}
- /// <internalonly/>
byte IConvertible.ToByte(IFormatProvider provider)
{
return m_value;
}
- /// <internalonly/>
short IConvertible.ToInt16(IFormatProvider provider)
{
return Convert.ToInt16(m_value);
}
- /// <internalonly/>
ushort IConvertible.ToUInt16(IFormatProvider provider)
{
return Convert.ToUInt16(m_value);
}
- /// <internalonly/>
int IConvertible.ToInt32(IFormatProvider provider)
{
return Convert.ToInt32(m_value);
}
- /// <internalonly/>
uint IConvertible.ToUInt32(IFormatProvider provider)
{
return Convert.ToUInt32(m_value);
}
- /// <internalonly/>
long IConvertible.ToInt64(IFormatProvider provider)
{
return Convert.ToInt64(m_value);
}
- /// <internalonly/>
ulong IConvertible.ToUInt64(IFormatProvider provider)
{
return Convert.ToUInt64(m_value);
}
- /// <internalonly/>
float IConvertible.ToSingle(IFormatProvider provider)
{
return Convert.ToSingle(m_value);
}
- /// <internalonly/>
double IConvertible.ToDouble(IFormatProvider provider)
{
return Convert.ToDouble(m_value);
}
- /// <internalonly/>
Decimal IConvertible.ToDecimal(IFormatProvider provider)
{
return Convert.ToDecimal(m_value);
}
- /// <internalonly/>
DateTime IConvertible.ToDateTime(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "Byte", "DateTime"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Byte", "DateTime"));
}
- /// <internalonly/>
Object IConvertible.ToType(Type type, IFormatProvider provider)
{
return Convert.DefaultToType((IConvertible)this, type, provider);
diff --git a/src/mscorlib/src/System/CLRConfig.cs b/src/mscorlib/src/System/CLRConfig.cs
index 98fe6f3b51..d97922f9b9 100644
--- a/src/mscorlib/src/System/CLRConfig.cs
+++ b/src/mscorlib/src/System/CLRConfig.cs
@@ -9,6 +9,21 @@ using System.Security;
namespace System
{
+ // CLRConfig is mainly reading the config switch values. this is used when we cannot use the AppContext class
+ // one example, is using the context switch in the globalization code which require to read the switch very
+ // early even before the appdomain get initialized.
+ // In general AppContext should be used instead of CLRConfig if there is no reason prevent that.
+ internal class CLRConfig
+ {
+ internal static bool GetBoolValue(string switchName)
+ {
+ return GetConfigBoolValue(switchName);
+ }
+
+ [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
+ [SuppressUnmanagedCodeSecurity]
+ private extern static bool GetConfigBoolValue(string configSwitchName);
+ }
} // namespace System
// file CLRConfig
diff --git a/src/mscorlib/src/System/Collections/ArrayList.cs b/src/mscorlib/src/System/Collections/ArrayList.cs
index 96aca31bad..c95f9b949d 100644
--- a/src/mscorlib/src/System/Collections/ArrayList.cs
+++ b/src/mscorlib/src/System/Collections/ArrayList.cs
@@ -62,7 +62,7 @@ namespace System.Collections
//
public ArrayList(int capacity)
{
- if (capacity < 0) throw new ArgumentOutOfRangeException(nameof(capacity), Environment.GetResourceString("ArgumentOutOfRange_MustBeNonNegNum", nameof(capacity)));
+ if (capacity < 0) throw new ArgumentOutOfRangeException(nameof(capacity), SR.Format(SR.ArgumentOutOfRange_MustBeNonNegNum, nameof(capacity)));
Contract.EndContractBlock();
if (capacity == 0)
@@ -78,7 +78,7 @@ namespace System.Collections
public ArrayList(ICollection c)
{
if (c == null)
- throw new ArgumentNullException(nameof(c), Environment.GetResourceString("ArgumentNull_Collection"));
+ throw new ArgumentNullException(nameof(c), SR.ArgumentNull_Collection);
Contract.EndContractBlock();
int count = c.Count;
@@ -108,7 +108,7 @@ namespace System.Collections
{
if (value < _size)
{
- throw new ArgumentOutOfRangeException(nameof(value), Environment.GetResourceString("ArgumentOutOfRange_SmallCapacity"));
+ throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_SmallCapacity);
}
Contract.Ensures(Capacity >= 0);
Contract.EndContractBlock();
@@ -180,13 +180,13 @@ namespace System.Collections
{
get
{
- if (index < 0 || index >= _size) throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ if (index < 0 || index >= _size) throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
Contract.EndContractBlock();
return _items[index];
}
set
{
- if (index < 0 || index >= _size) throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ if (index < 0 || index >= _size) throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
Contract.EndContractBlock();
_items[index] = value;
_version++;
@@ -269,7 +269,7 @@ namespace System.Collections
public virtual void CopyTo(Array array, int arrayIndex)
{
if ((array != null) && (array.Rank != 1))
- throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
+ throw new ArgumentException(SR.Arg_RankMultiDimNotSupported);
Contract.EndContractBlock();
// Delegate rest of error checking to Array.Copy.
Array.Copy(_items, 0, array, arrayIndex, _size);
@@ -324,7 +324,7 @@ namespace System.Collections
public virtual void Insert(int index, Object value)
{
// Note that insertions at the end are legal.
- if (index < 0 || index > _size) throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_ArrayListInsert"));
+ if (index < 0 || index > _size) throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_ArrayListInsert);
//Contract.Ensures(Count == Contract.OldValue(Count) + 1);
Contract.EndContractBlock();
@@ -346,8 +346,8 @@ namespace System.Collections
public virtual void InsertRange(int index, ICollection c)
{
if (c == null)
- throw new ArgumentNullException(nameof(c), Environment.GetResourceString("ArgumentNull_Collection"));
- if (index < 0 || index > _size) throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentNullException(nameof(c), SR.ArgumentNull_Collection);
+ if (index < 0 || index > _size) throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
//Contract.Ensures(Count == Contract.OldValue(Count) + c.Count);
Contract.EndContractBlock();
@@ -399,7 +399,7 @@ namespace System.Collections
//
public virtual void RemoveAt(int index)
{
- if (index < 0 || index >= _size) throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ if (index < 0 || index >= _size) throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
Contract.Ensures(Count >= 0);
//Contract.Ensures(Count == Contract.OldValue(Count) - 1);
Contract.EndContractBlock();
@@ -467,7 +467,7 @@ namespace System.Collections
}
set
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_ReadOnlyCollection"));
+ throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}
}
@@ -478,12 +478,12 @@ namespace System.Collections
public virtual int Add(Object obj)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_ReadOnlyCollection"));
+ throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}
public virtual void Clear()
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_ReadOnlyCollection"));
+ throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}
public virtual bool Contains(Object obj)
@@ -508,17 +508,17 @@ namespace System.Collections
public virtual void Insert(int index, Object obj)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_ReadOnlyCollection"));
+ throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}
public virtual void Remove(Object value)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_ReadOnlyCollection"));
+ throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}
public virtual void RemoveAt(int index)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_ReadOnlyCollection"));
+ throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
}
}
@@ -552,7 +552,7 @@ namespace System.Collections
{
if (version != list._version)
{
- throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumFailedVersion));
+ throw new InvalidOperationException(SR.GetResourceString(ResId.InvalidOperation_EnumFailedVersion));
}
if (isArrayList)
@@ -594,11 +594,11 @@ namespace System.Collections
{ // check if enumeration has not started or has terminated
if (index == -1)
{
- throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumNotStarted));
+ throw new InvalidOperationException(SR.GetResourceString(ResId.InvalidOperation_EnumNotStarted));
}
else
{
- throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumEnded));
+ throw new InvalidOperationException(SR.GetResourceString(ResId.InvalidOperation_EnumEnded));
}
}
@@ -610,7 +610,7 @@ namespace System.Collections
{
if (version != list._version)
{
- throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumFailedVersion));
+ throw new InvalidOperationException(SR.GetResourceString(ResId.InvalidOperation_EnumFailedVersion));
}
currentElement = dummyObject;
diff --git a/src/mscorlib/src/System/Collections/CollectionBase.cs b/src/mscorlib/src/System/Collections/CollectionBase.cs
deleted file mode 100644
index a0df2bbbbf..0000000000
--- a/src/mscorlib/src/System/Collections/CollectionBase.cs
+++ /dev/null
@@ -1,239 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-//
-
-using System;
-using System.Diagnostics.Contracts;
-
-namespace System.Collections
-{
- // Useful base class for typed read/write collections where items derive from object
- [Serializable]
- public abstract class CollectionBase : IList
- {
- private ArrayList list;
-
- protected CollectionBase()
- {
- list = new ArrayList();
- }
-
- internal ArrayList InnerList
- {
- get
- {
- if (list == null)
- list = new ArrayList();
- return list;
- }
- }
-
- protected IList List
- {
- get { return (IList)this; }
- }
-
-
- public int Count
- {
- get
- {
- return list == null ? 0 : list.Count;
- }
- }
-
- public void Clear()
- {
- OnClear();
- InnerList.Clear();
- OnClearComplete();
- }
-
- public void RemoveAt(int index)
- {
- if (index < 0 || index >= Count)
- throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_Index"));
- Contract.EndContractBlock();
- Object temp = InnerList[index];
- OnValidate(temp);
- OnRemove(index, temp);
- InnerList.RemoveAt(index);
- try
- {
- OnRemoveComplete(index, temp);
- }
- catch
- {
- InnerList.Insert(index, temp);
- throw;
- }
- }
-
- bool IList.IsReadOnly
- {
- get { return InnerList.IsReadOnly; }
- }
-
- bool IList.IsFixedSize
- {
- get { return InnerList.IsFixedSize; }
- }
-
- bool ICollection.IsSynchronized
- {
- get { return InnerList.IsSynchronized; }
- }
-
- Object ICollection.SyncRoot
- {
- get { return InnerList.SyncRoot; }
- }
-
- void ICollection.CopyTo(Array array, int index)
- {
- InnerList.CopyTo(array, index);
- }
-
- Object IList.this[int index]
- {
- get
- {
- if (index < 0 || index >= Count)
- throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_Index"));
- Contract.EndContractBlock();
- return InnerList[index];
- }
- set
- {
- if (index < 0 || index >= Count)
- throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_Index"));
- Contract.EndContractBlock();
- OnValidate(value);
- Object temp = InnerList[index];
- OnSet(index, temp, value);
- InnerList[index] = value;
- try
- {
- OnSetComplete(index, temp, value);
- }
- catch
- {
- InnerList[index] = temp;
- throw;
- }
- }
- }
-
- bool IList.Contains(Object value)
- {
- return InnerList.Contains(value);
- }
-
- int IList.Add(Object value)
- {
- OnValidate(value);
- OnInsert(InnerList.Count, value);
- int index = InnerList.Add(value);
- try
- {
- OnInsertComplete(index, value);
- }
- catch
- {
- InnerList.RemoveAt(index);
- throw;
- }
- return index;
- }
-
-
- void IList.Remove(Object value)
- {
- OnValidate(value);
- int index = InnerList.IndexOf(value);
- if (index < 0) throw new ArgumentException(Environment.GetResourceString("Arg_RemoveArgNotFound"));
- OnRemove(index, value);
- InnerList.RemoveAt(index);
- try
- {
- OnRemoveComplete(index, value);
- }
- catch
- {
- InnerList.Insert(index, value);
- throw;
- }
- }
-
- int IList.IndexOf(Object value)
- {
- return InnerList.IndexOf(value);
- }
-
- void IList.Insert(int index, Object value)
- {
- if (index < 0 || index > Count)
- throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_Index"));
- Contract.EndContractBlock();
- OnValidate(value);
- OnInsert(index, value);
- InnerList.Insert(index, value);
- try
- {
- OnInsertComplete(index, value);
- }
- catch
- {
- InnerList.RemoveAt(index);
- throw;
- }
- }
-
- public IEnumerator GetEnumerator()
- {
- return InnerList.GetEnumerator();
- }
-
- protected virtual void OnSet(int index, Object oldValue, Object newValue)
- {
- }
-
- protected virtual void OnInsert(int index, Object value)
- {
- }
-
- protected virtual void OnClear()
- {
- }
-
- protected virtual void OnRemove(int index, Object value)
- {
- }
-
- protected virtual void OnValidate(Object value)
- {
- if (value == null) throw new ArgumentNullException(nameof(value));
- Contract.EndContractBlock();
- }
-
- protected virtual void OnSetComplete(int index, Object oldValue, Object newValue)
- {
- }
-
- protected virtual void OnInsertComplete(int index, Object value)
- {
- }
-
- protected virtual void OnClearComplete()
- {
- }
-
- protected virtual void OnRemoveComplete(int index, Object value)
- {
- }
- }
-}
diff --git a/src/mscorlib/src/System/Collections/Comparer.cs b/src/mscorlib/src/System/Collections/Comparer.cs
index f1480e1f4f..7f4f9f0a07 100644
--- a/src/mscorlib/src/System/Collections/Comparer.cs
+++ b/src/mscorlib/src/System/Collections/Comparer.cs
@@ -87,7 +87,7 @@ namespace System.Collections
if (ib != null)
return -ib.CompareTo(a);
- throw new ArgumentException(Environment.GetResourceString("Argument_ImplementIComparable"));
+ throw new ArgumentException(SR.Argument_ImplementIComparable);
}
public void GetObjectData(SerializationInfo info, StreamingContext context)
diff --git a/src/mscorlib/src/System/Collections/CompatibleComparer.cs b/src/mscorlib/src/System/Collections/CompatibleComparer.cs
index 54c9132449..1c90707184 100644
--- a/src/mscorlib/src/System/Collections/CompatibleComparer.cs
+++ b/src/mscorlib/src/System/Collections/CompatibleComparer.cs
@@ -33,7 +33,7 @@ namespace System.Collections
if (ia != null)
return ia.CompareTo(b);
- throw new ArgumentException(Environment.GetResourceString("Argument_ImplementIComparable"));
+ throw new ArgumentException(SR.Argument_ImplementIComparable);
}
public new bool Equals(Object a, Object b)
diff --git a/src/mscorlib/src/System/Collections/Concurrent/ConcurrentQueue.cs b/src/mscorlib/src/System/Collections/Concurrent/ConcurrentQueue.cs
index 991e17d6dc..c6211dadd3 100644
--- a/src/mscorlib/src/System/Collections/Concurrent/ConcurrentQueue.cs
+++ b/src/mscorlib/src/System/Collections/Concurrent/ConcurrentQueue.cs
@@ -205,7 +205,7 @@ namespace System.Collections.Concurrent
/// cref="ICollection"/>. This property is not supported.
/// </summary>
/// <exception cref="NotSupportedException">The SyncRoot property is not supported.</exception>
- object ICollection.SyncRoot { get { throw new NotSupportedException(Environment.GetResourceString("ConcurrentCollection_SyncRoot_NotSupported")); } }
+ object ICollection.SyncRoot { get { throw new NotSupportedException(SR.ConcurrentCollection_SyncRoot_NotSupported); } }
/// <summary>Returns an enumerator that iterates through a collection.</summary>
/// <returns>An <see cref="IEnumerator"/> that can be used to iterate through the collection.</returns>
@@ -443,7 +443,7 @@ namespace System.Collections.Concurrent
long count = GetCount(head, headHead, tail, tailTail);
if (index > array.Length - count)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_ArrayPlusOffTooSmall"));
+ throw new ArgumentException(SR.Arg_ArrayPlusOffTooSmall);
}
// Copy the items to the target array
diff --git a/src/mscorlib/src/System/Collections/Concurrent/ConcurrentStack.cs b/src/mscorlib/src/System/Collections/Concurrent/ConcurrentStack.cs
index 7b2bb9c74e..82bc4f9f5c 100644
--- a/src/mscorlib/src/System/Collections/Concurrent/ConcurrentStack.cs
+++ b/src/mscorlib/src/System/Collections/Concurrent/ConcurrentStack.cs
@@ -135,7 +135,7 @@ namespace System.Collections.Concurrent
{
get
{
- throw new NotSupportedException(Environment.GetResourceString("ConcurrentCollection_SyncRoot_NotSupported"));
+ throw new NotSupportedException(SR.ConcurrentCollection_SyncRoot_NotSupported);
}
}
diff --git a/src/mscorlib/src/System/Collections/EmptyReadOnlyDictionaryInternal.cs b/src/mscorlib/src/System/Collections/EmptyReadOnlyDictionaryInternal.cs
index a0ce919ce5..c36f57cf75 100644
--- a/src/mscorlib/src/System/Collections/EmptyReadOnlyDictionaryInternal.cs
+++ b/src/mscorlib/src/System/Collections/EmptyReadOnlyDictionaryInternal.cs
@@ -43,13 +43,13 @@ namespace System.Collections
throw new ArgumentNullException(nameof(array));
if (array.Rank != 1)
- throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
+ throw new ArgumentException(SR.Arg_RankMultiDimNotSupported);
if (index < 0)
- throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_NeedNonNegNum);
if (array.Length - index < this.Count)
- throw new ArgumentException(Environment.GetResourceString("ArgumentOutOfRange_Index"), nameof(index));
+ throw new ArgumentException(SR.ArgumentOutOfRange_Index, nameof(index));
Contract.EndContractBlock();
// the actual copy is a NOP
@@ -87,7 +87,7 @@ namespace System.Collections
{
if (key == null)
{
- throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
+ throw new ArgumentNullException(nameof(key), SR.ArgumentNull_Key);
}
Contract.EndContractBlock();
return null;
@@ -96,17 +96,17 @@ namespace System.Collections
{
if (key == null)
{
- throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
+ throw new ArgumentNullException(nameof(key), SR.ArgumentNull_Key);
}
if (!key.GetType().IsSerializable)
- throw new ArgumentException(Environment.GetResourceString("Argument_NotSerializable"), nameof(key));
+ throw new ArgumentException(SR.Argument_NotSerializable, nameof(key));
if ((value != null) && (!value.GetType().IsSerializable))
- throw new ArgumentException(Environment.GetResourceString("Argument_NotSerializable"), nameof(value));
+ throw new ArgumentException(SR.Argument_NotSerializable, nameof(value));
Contract.EndContractBlock();
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
+ throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
}
}
@@ -135,22 +135,22 @@ namespace System.Collections
{
if (key == null)
{
- throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
+ throw new ArgumentNullException(nameof(key), SR.ArgumentNull_Key);
}
if (!key.GetType().IsSerializable)
- throw new ArgumentException(Environment.GetResourceString("Argument_NotSerializable"), nameof(key));
+ throw new ArgumentException(SR.Argument_NotSerializable, nameof(key));
if ((value != null) && (!value.GetType().IsSerializable))
- throw new ArgumentException(Environment.GetResourceString("Argument_NotSerializable"), nameof(value));
+ throw new ArgumentException(SR.Argument_NotSerializable, nameof(value));
Contract.EndContractBlock();
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
+ throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
}
public void Clear()
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
+ throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
}
public bool IsReadOnly
@@ -176,7 +176,7 @@ namespace System.Collections
public void Remove(Object key)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
+ throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
}
private sealed class NodeEnumerator : IDictionaryEnumerator
@@ -196,7 +196,7 @@ namespace System.Collections
{
get
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumOpCantHappen"));
+ throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
}
}
@@ -210,7 +210,7 @@ namespace System.Collections
{
get
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumOpCantHappen"));
+ throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
}
}
@@ -218,7 +218,7 @@ namespace System.Collections
{
get
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumOpCantHappen"));
+ throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
}
}
@@ -226,7 +226,7 @@ namespace System.Collections
{
get
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumOpCantHappen"));
+ throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
}
}
}
diff --git a/src/mscorlib/src/System/Collections/Generic/ArraySortHelper.cs b/src/mscorlib/src/System/Collections/Generic/ArraySortHelper.cs
index d3284bec1f..e313cda0fb 100644
--- a/src/mscorlib/src/System/Collections/Generic/ArraySortHelper.cs
+++ b/src/mscorlib/src/System/Collections/Generic/ArraySortHelper.cs
@@ -50,7 +50,7 @@ namespace System.Collections.Generic
internal static void ThrowOrIgnoreBadComparer(Object comparer)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_BogusIComparer", comparer));
+ throw new ArgumentException(SR.Format(SR.Arg_BogusIComparer, comparer));
}
}
@@ -109,7 +109,7 @@ namespace System.Collections.Generic
}
catch (Exception e)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_IComparerFailed"), e);
+ throw new InvalidOperationException(SR.InvalidOperation_IComparerFailed, e);
}
}
@@ -126,7 +126,7 @@ namespace System.Collections.Generic
}
catch (Exception e)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_IComparerFailed"), e);
+ throw new InvalidOperationException(SR.InvalidOperation_IComparerFailed, e);
}
}
@@ -149,7 +149,7 @@ namespace System.Collections.Generic
}
catch (Exception e)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_IComparerFailed"), e);
+ throw new InvalidOperationException(SR.InvalidOperation_IComparerFailed, e);
}
}
@@ -399,7 +399,7 @@ namespace System.Collections.Generic
}
catch (Exception e)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_IComparerFailed"), e);
+ throw new InvalidOperationException(SR.InvalidOperation_IComparerFailed, e);
}
}
@@ -421,7 +421,7 @@ namespace System.Collections.Generic
}
catch (Exception e)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_IComparerFailed"), e);
+ throw new InvalidOperationException(SR.InvalidOperation_IComparerFailed, e);
}
}
@@ -723,7 +723,7 @@ namespace System.Collections.Generic
}
catch (Exception e)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_IComparerFailed"), e);
+ throw new InvalidOperationException(SR.InvalidOperation_IComparerFailed, e);
}
}
@@ -980,7 +980,7 @@ namespace System.Collections.Generic
}
catch (Exception e)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_IComparerFailed"), e);
+ throw new InvalidOperationException(SR.InvalidOperation_IComparerFailed, e);
}
}
diff --git a/src/mscorlib/src/System/Collections/Generic/DebugView.cs b/src/mscorlib/src/System/Collections/Generic/DebugView.cs
index c6b58de627..dc487c1411 100644
--- a/src/mscorlib/src/System/Collections/Generic/DebugView.cs
+++ b/src/mscorlib/src/System/Collections/Generic/DebugView.cs
@@ -121,30 +121,4 @@ namespace System.Collections.Generic
}
}
- internal sealed class Mscorlib_KeyedCollectionDebugView<K, T>
- {
- private KeyedCollection<K, T> kc;
-
- public Mscorlib_KeyedCollectionDebugView(KeyedCollection<K, T> keyedCollection)
- {
- if (keyedCollection == null)
- {
- throw new ArgumentNullException(nameof(keyedCollection));
- }
- Contract.EndContractBlock();
-
- kc = keyedCollection;
- }
-
- [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
- public T[] Items
- {
- get
- {
- T[] items = new T[kc.Count];
- kc.CopyTo(items, 0);
- return items;
- }
- }
- }
}
diff --git a/src/mscorlib/src/System/Collections/Generic/EqualityComparer.cs b/src/mscorlib/src/System/Collections/Generic/EqualityComparer.cs
index a717558fbf..0cd1bc1c12 100644
--- a/src/mscorlib/src/System/Collections/Generic/EqualityComparer.cs
+++ b/src/mscorlib/src/System/Collections/Generic/EqualityComparer.cs
@@ -320,11 +320,11 @@ namespace System.Collections.Generic
if (array == null)
throw new ArgumentNullException(nameof(array));
if (startIndex < 0)
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_Index);
if (count < 0)
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_Count"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_Count);
if (count > array.Length - startIndex)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
Contract.EndContractBlock();
if (count == 0) return -1;
fixed (byte* pbytes = array)
diff --git a/src/mscorlib/src/System/Collections/Generic/List.cs b/src/mscorlib/src/System/Collections/Generic/List.cs
index fc47b936e0..67d1668aad 100644
--- a/src/mscorlib/src/System/Collections/Generic/List.cs
+++ b/src/mscorlib/src/System/Collections/Generic/List.cs
@@ -675,7 +675,6 @@ namespace System.Collections.Generic
return new Enumerator(this);
}
- /// <internalonly/>
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
return new Enumerator(this);
diff --git a/src/mscorlib/src/System/Collections/Hashtable.cs b/src/mscorlib/src/System/Collections/Hashtable.cs
index 3a8d2630b4..f21ee99d58 100644
--- a/src/mscorlib/src/System/Collections/Hashtable.cs
+++ b/src/mscorlib/src/System/Collections/Hashtable.cs
@@ -203,9 +203,9 @@ namespace System.Collections
public Hashtable(int capacity, float loadFactor)
{
if (capacity < 0)
- throw new ArgumentOutOfRangeException(nameof(capacity), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(capacity), SR.ArgumentOutOfRange_NeedNonNegNum);
if (!(loadFactor >= 0.1f && loadFactor <= 1.0f))
- throw new ArgumentOutOfRangeException(nameof(loadFactor), Environment.GetResourceString("ArgumentOutOfRange_HashtableLoadFactor", .1, 1.0));
+ throw new ArgumentOutOfRangeException(nameof(loadFactor), SR.Format(SR.ArgumentOutOfRange_HashtableLoadFactor, .1, 1.0));
Contract.EndContractBlock();
// Based on perf work, .72 is the optimal load factor for this table.
@@ -213,7 +213,7 @@ namespace System.Collections
double rawsize = capacity / this.loadFactor;
if (rawsize > Int32.MaxValue)
- throw new ArgumentException(Environment.GetResourceString("Arg_HTCapacityOverflow"));
+ throw new ArgumentException(SR.Arg_HTCapacityOverflow);
// Avoid awfully small sizes
int hashsize = (rawsize > InitialSize) ? HashHelpers.GetPrime((int)rawsize) : InitialSize;
@@ -343,7 +343,7 @@ namespace System.Collections
{
if (key == null)
{
- throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
+ throw new ArgumentNullException(nameof(key), SR.ArgumentNull_Key);
}
Contract.EndContractBlock();
@@ -415,13 +415,13 @@ namespace System.Collections
public virtual void CopyTo(Array array, int arrayIndex)
{
if (array == null)
- throw new ArgumentNullException(nameof(array), Environment.GetResourceString("ArgumentNull_Array"));
+ throw new ArgumentNullException(nameof(array), SR.ArgumentNull_Array);
if (array.Rank != 1)
- throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
+ throw new ArgumentException(SR.Arg_RankMultiDimNotSupported);
if (arrayIndex < 0)
- throw new ArgumentOutOfRangeException(nameof(arrayIndex), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(arrayIndex), SR.ArgumentOutOfRange_NeedNonNegNum);
if (array.Length - arrayIndex < Count)
- throw new ArgumentException(Environment.GetResourceString("Arg_ArrayPlusOffTooSmall"));
+ throw new ArgumentException(SR.Arg_ArrayPlusOffTooSmall);
Contract.EndContractBlock();
CopyEntries(array, arrayIndex);
}
@@ -455,7 +455,7 @@ namespace System.Collections
{
if (key == null)
{
- throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
+ throw new ArgumentNullException(nameof(key), SR.ArgumentNull_Key);
}
Contract.EndContractBlock();
@@ -698,7 +698,7 @@ namespace System.Collections
{
if (key == null)
{
- throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
+ throw new ArgumentNullException(nameof(key), SR.ArgumentNull_Key);
}
Contract.EndContractBlock();
if (count >= loadsize)
@@ -760,7 +760,7 @@ namespace System.Collections
{
if (add)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_AddingDuplicate__", buckets[bucketNumber].key, key));
+ throw new ArgumentException(SR.Format(SR.Argument_AddingDuplicate__, buckets[bucketNumber].key, key));
}
isWriterInProgress = true;
buckets[bucketNumber].val = nvalue;
@@ -804,7 +804,7 @@ namespace System.Collections
// Then verify that our double hash function (h2, described at top of file)
// meets the requirements described above. You should never see this assert.
Debug.Assert(false, "hash table insert failed! Load factor too high, or our double hashing function is incorrect.");
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_HashInsertFailed"));
+ throw new InvalidOperationException(SR.InvalidOperation_HashInsertFailed);
}
private void putEntry(bucket[] newBuckets, Object key, Object nvalue, int hashcode)
@@ -841,7 +841,7 @@ namespace System.Collections
{
if (key == null)
{
- throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
+ throw new ArgumentNullException(nameof(key), SR.ArgumentNull_Key);
}
Contract.EndContractBlock();
Debug.Assert(!isWriterInProgress, "Race condition detected in usages of Hashtable - multiple threads appear to be writing to a Hashtable instance simultaneously! Don't do that - use Hashtable.Synchronized.");
@@ -880,7 +880,7 @@ namespace System.Collections
bn = (int)(((long)bn + incr) % (uint)buckets.Length);
} while (b.hash_coll < 0 && ++ntry < buckets.Length);
- //throw new ArgumentException(Environment.GetResourceString("Arg_RemoveArgNotFound"));
+ //throw new ArgumentException(SR.Arg_RemoveArgNotFound);
}
// Returns the object to synchronize on for this hash table.
@@ -975,7 +975,7 @@ namespace System.Collections
// Explicitly check to see if anyone changed the Hashtable while we
// were serializing it. That's a race condition in their code.
if (version != oldVersion)
- throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumFailedVersion));
+ throw new InvalidOperationException(SR.GetResourceString(ResId.InvalidOperation_EnumFailedVersion));
}
}
@@ -995,7 +995,7 @@ namespace System.Collections
if (siInfo == null)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidOnDeser"));
+ throw new SerializationException(SR.Serialization_InvalidOnDeser);
}
int hashsize = 0;
@@ -1052,21 +1052,21 @@ namespace System.Collections
if (serKeys == null)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_MissingKeys"));
+ throw new SerializationException(SR.Serialization_MissingKeys);
}
if (serValues == null)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_MissingValues"));
+ throw new SerializationException(SR.Serialization_MissingValues);
}
if (serKeys.Length != serValues.Length)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_KeyValueDifferentSizes"));
+ throw new SerializationException(SR.Serialization_KeyValueDifferentSizes);
}
for (int i = 0; i < serKeys.Length; i++)
{
if (serKeys[i] == null)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_NullKey"));
+ throw new SerializationException(SR.Serialization_NullKey);
}
Insert(serKeys[i], serValues[i], true);
}
@@ -1094,12 +1094,12 @@ namespace System.Collections
if (array == null)
throw new ArgumentNullException(nameof(array));
if (array.Rank != 1)
- throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
+ throw new ArgumentException(SR.Arg_RankMultiDimNotSupported);
if (arrayIndex < 0)
- throw new ArgumentOutOfRangeException(nameof(arrayIndex), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(arrayIndex), SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
if (array.Length - arrayIndex < _hashtable.count)
- throw new ArgumentException(Environment.GetResourceString("Arg_ArrayPlusOffTooSmall"));
+ throw new ArgumentException(SR.Arg_ArrayPlusOffTooSmall);
_hashtable.CopyKeys(array, arrayIndex);
}
@@ -1141,12 +1141,12 @@ namespace System.Collections
if (array == null)
throw new ArgumentNullException(nameof(array));
if (array.Rank != 1)
- throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
+ throw new ArgumentException(SR.Arg_RankMultiDimNotSupported);
if (arrayIndex < 0)
- throw new ArgumentOutOfRangeException(nameof(arrayIndex), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(arrayIndex), SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
if (array.Length - arrayIndex < _hashtable.count)
- throw new ArgumentException(Environment.GetResourceString("Arg_ArrayPlusOffTooSmall"));
+ throw new ArgumentException(SR.Arg_ArrayPlusOffTooSmall);
_hashtable.CopyValues(array, arrayIndex);
}
@@ -1273,7 +1273,7 @@ namespace System.Collections
{
if (key == null)
{
- throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
+ throw new ArgumentNullException(nameof(key), SR.ArgumentNull_Key);
}
Contract.EndContractBlock();
return _table.ContainsKey(key);
@@ -1386,14 +1386,14 @@ namespace System.Collections
{
get
{
- if (current == false) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumNotStarted));
+ if (current == false) throw new InvalidOperationException(SR.GetResourceString(ResId.InvalidOperation_EnumNotStarted));
return currentKey;
}
}
public virtual bool MoveNext()
{
- if (version != hashtable.version) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumFailedVersion));
+ if (version != hashtable.version) throw new InvalidOperationException(SR.GetResourceString(ResId.InvalidOperation_EnumFailedVersion));
while (bucket > 0)
{
bucket--;
@@ -1414,7 +1414,7 @@ namespace System.Collections
{
get
{
- if (current == false) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumOpCantHappen));
+ if (current == false) throw new InvalidOperationException(SR.GetResourceString(ResId.InvalidOperation_EnumOpCantHappen));
return new DictionaryEntry(currentKey, currentValue);
}
}
@@ -1424,7 +1424,7 @@ namespace System.Collections
{
get
{
- if (current == false) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumOpCantHappen));
+ if (current == false) throw new InvalidOperationException(SR.GetResourceString(ResId.InvalidOperation_EnumOpCantHappen));
if (getObjectRetType == Keys)
return currentKey;
@@ -1439,14 +1439,14 @@ namespace System.Collections
{
get
{
- if (current == false) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumOpCantHappen));
+ if (current == false) throw new InvalidOperationException(SR.GetResourceString(ResId.InvalidOperation_EnumOpCantHappen));
return currentValue;
}
}
public virtual void Reset()
{
- if (version != hashtable.version) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumFailedVersion));
+ if (version != hashtable.version) throw new InvalidOperationException(SR.GetResourceString(ResId.InvalidOperation_EnumFailedVersion));
current = false;
bucket = hashtable.buckets.Length;
currentKey = null;
@@ -1523,7 +1523,7 @@ namespace System.Collections
public static int GetPrime(int min)
{
if (min < 0)
- throw new ArgumentException(Environment.GetResourceString("Arg_HTCapacityOverflow"));
+ throw new ArgumentException(SR.Arg_HTCapacityOverflow);
Contract.EndContractBlock();
for (int i = 0; i < primes.Length; i++)
diff --git a/src/mscorlib/src/System/Collections/ListDictionaryInternal.cs b/src/mscorlib/src/System/Collections/ListDictionaryInternal.cs
index bfd11588f3..3f92038d4f 100644
--- a/src/mscorlib/src/System/Collections/ListDictionaryInternal.cs
+++ b/src/mscorlib/src/System/Collections/ListDictionaryInternal.cs
@@ -38,7 +38,7 @@ namespace System.Collections
{
if (key == null)
{
- throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
+ throw new ArgumentNullException(nameof(key), SR.ArgumentNull_Key);
}
Contract.EndContractBlock();
DictionaryNode node = head;
@@ -57,7 +57,7 @@ namespace System.Collections
{
if (key == null)
{
- throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
+ throw new ArgumentNullException(nameof(key), SR.ArgumentNull_Key);
}
Contract.EndContractBlock();
@@ -159,7 +159,7 @@ namespace System.Collections
{
if (key == null)
{
- throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
+ throw new ArgumentNullException(nameof(key), SR.ArgumentNull_Key);
}
Contract.EndContractBlock();
@@ -171,7 +171,7 @@ namespace System.Collections
{
if (node.key.Equals(key))
{
- throw new ArgumentException(Environment.GetResourceString("Argument_AddingDuplicate__", node.key, key));
+ throw new ArgumentException(SR.Format(SR.Argument_AddingDuplicate__, node.key, key));
}
last = node;
}
@@ -207,7 +207,7 @@ namespace System.Collections
{
if (key == null)
{
- throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
+ throw new ArgumentNullException(nameof(key), SR.ArgumentNull_Key);
}
Contract.EndContractBlock();
for (DictionaryNode node = head; node != null; node = node.next)
@@ -226,13 +226,13 @@ namespace System.Collections
throw new ArgumentNullException(nameof(array));
if (array.Rank != 1)
- throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
+ throw new ArgumentException(SR.Arg_RankMultiDimNotSupported);
if (index < 0)
- throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_NeedNonNegNum);
if (array.Length - index < this.Count)
- throw new ArgumentException(Environment.GetResourceString("ArgumentOutOfRange_Index"), nameof(index));
+ throw new ArgumentException(SR.ArgumentOutOfRange_Index, nameof(index));
Contract.EndContractBlock();
for (DictionaryNode node = head; node != null; node = node.next)
@@ -256,7 +256,7 @@ namespace System.Collections
{
if (key == null)
{
- throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
+ throw new ArgumentNullException(nameof(key), SR.ArgumentNull_Key);
}
Contract.EndContractBlock();
version++;
@@ -315,7 +315,7 @@ namespace System.Collections
{
if (current == null)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumOpCantHappen"));
+ throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
}
return new DictionaryEntry(current.key, current.value);
}
@@ -327,7 +327,7 @@ namespace System.Collections
{
if (current == null)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumOpCantHappen"));
+ throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
}
return current.key;
}
@@ -339,7 +339,7 @@ namespace System.Collections
{
if (current == null)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumOpCantHappen"));
+ throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
}
return current.value;
}
@@ -349,7 +349,7 @@ namespace System.Collections
{
if (version != list.version)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumFailedVersion"));
+ throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion);
}
if (start)
{
@@ -370,7 +370,7 @@ namespace System.Collections
{
if (version != list.version)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumFailedVersion"));
+ throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion);
}
start = true;
current = null;
@@ -394,12 +394,12 @@ namespace System.Collections
if (array == null)
throw new ArgumentNullException(nameof(array));
if (array.Rank != 1)
- throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
+ throw new ArgumentException(SR.Arg_RankMultiDimNotSupported);
if (index < 0)
- throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
if (array.Length - index < list.Count)
- throw new ArgumentException(Environment.GetResourceString("ArgumentOutOfRange_Index"), nameof(index));
+ throw new ArgumentException(SR.ArgumentOutOfRange_Index, nameof(index));
for (DictionaryNode node = list.head; node != null; node = node.next)
{
array.SetValue(isKeys ? node.key : node.value, index);
@@ -465,7 +465,7 @@ namespace System.Collections
{
if (current == null)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumOpCantHappen"));
+ throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
}
return isKeys ? current.key : current.value;
}
@@ -475,7 +475,7 @@ namespace System.Collections
{
if (version != list.version)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumFailedVersion"));
+ throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion);
}
if (start)
{
@@ -496,7 +496,7 @@ namespace System.Collections
{
if (version != list.version)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumFailedVersion"));
+ throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion);
}
start = true;
current = null;
diff --git a/src/mscorlib/src/System/Collections/ObjectModel/KeyedCollection.cs b/src/mscorlib/src/System/Collections/ObjectModel/KeyedCollection.cs
deleted file mode 100644
index f94fdd8cbe..0000000000
--- a/src/mscorlib/src/System/Collections/ObjectModel/KeyedCollection.cs
+++ /dev/null
@@ -1,299 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-//
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
-
-namespace System.Collections.ObjectModel
-{
- [Serializable]
- [DebuggerTypeProxy(typeof(Mscorlib_KeyedCollectionDebugView<,>))]
- [DebuggerDisplay("Count = {Count}")]
- public abstract class KeyedCollection<TKey, TItem> : Collection<TItem>
- {
- private const int defaultThreshold = 0;
-
- private IEqualityComparer<TKey> comparer;
- private Dictionary<TKey, TItem> dict;
- private int keyCount;
- private int threshold;
-
- protected KeyedCollection() : this(null, defaultThreshold) { }
-
- protected KeyedCollection(IEqualityComparer<TKey> comparer) : this(comparer, defaultThreshold) { }
-
-
- protected KeyedCollection(IEqualityComparer<TKey> comparer, int dictionaryCreationThreshold)
- : base(new List<TItem>())
- { // Be explicit about the use of List<T> so we can foreach over
- // Items internally without enumerator allocations.
- if (comparer == null)
- {
- comparer = EqualityComparer<TKey>.Default;
- }
-
- if (dictionaryCreationThreshold == -1)
- {
- dictionaryCreationThreshold = int.MaxValue;
- }
-
- if (dictionaryCreationThreshold < -1)
- {
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.dictionaryCreationThreshold, ExceptionResource.ArgumentOutOfRange_InvalidThreshold);
- }
-
- this.comparer = comparer;
- threshold = dictionaryCreationThreshold;
- }
-
- /// <summary>
- /// Enables the use of foreach internally without allocations using <see cref="List{T}"/>'s struct enumerator.
- /// </summary>
- new private List<TItem> Items
- {
- get
- {
- Debug.Assert(base.Items is List<TItem>);
-
- return (List<TItem>)base.Items;
- }
- }
-
- public IEqualityComparer<TKey> Comparer
- {
- get
- {
- return comparer;
- }
- }
-
- public TItem this[TKey key]
- {
- get
- {
- if (key == null)
- {
- ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
- }
-
- if (dict != null)
- {
- return dict[key];
- }
-
- foreach (TItem item in Items)
- {
- if (comparer.Equals(GetKeyForItem(item), key)) return item;
- }
-
- ThrowHelper.ThrowKeyNotFoundException();
- return default(TItem);
- }
- }
-
- public bool Contains(TKey key)
- {
- if (key == null)
- {
- ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
- }
-
- if (dict != null)
- {
- return dict.ContainsKey(key);
- }
-
- foreach (TItem item in Items)
- {
- if (comparer.Equals(GetKeyForItem(item), key)) return true;
- }
- return false;
- }
-
- private bool ContainsItem(TItem item)
- {
- TKey key;
- if ((dict == null) || ((key = GetKeyForItem(item)) == null))
- {
- return Items.Contains(item);
- }
-
- TItem itemInDict;
- bool exist = dict.TryGetValue(key, out itemInDict);
- if (exist)
- {
- return EqualityComparer<TItem>.Default.Equals(itemInDict, item);
- }
- return false;
- }
-
- public bool Remove(TKey key)
- {
- if (key == null)
- {
- ThrowHelper.ThrowArgumentNullException(ExceptionArgument.key);
- }
-
- if (dict != null)
- {
- if (dict.ContainsKey(key))
- {
- return Remove(dict[key]);
- }
-
- return false;
- }
-
- for (int i = 0; i < Items.Count; i++)
- {
- if (comparer.Equals(GetKeyForItem(Items[i]), key))
- {
- RemoveItem(i);
- return true;
- }
- }
- return false;
- }
-
- protected IDictionary<TKey, TItem> Dictionary
- {
- get { return dict; }
- }
-
- protected void ChangeItemKey(TItem item, TKey newKey)
- {
- // check if the item exists in the collection
- if (!ContainsItem(item))
- {
- ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_ItemNotExist);
- }
-
- TKey oldKey = GetKeyForItem(item);
- if (!comparer.Equals(oldKey, newKey))
- {
- if (newKey != null)
- {
- AddKey(newKey, item);
- }
-
- if (oldKey != null)
- {
- RemoveKey(oldKey);
- }
- }
- }
-
- protected override void ClearItems()
- {
- base.ClearItems();
- if (dict != null)
- {
- dict.Clear();
- }
-
- keyCount = 0;
- }
-
- protected abstract TKey GetKeyForItem(TItem item);
-
- protected override void InsertItem(int index, TItem item)
- {
- TKey key = GetKeyForItem(item);
- if (key != null)
- {
- AddKey(key, item);
- }
- base.InsertItem(index, item);
- }
-
- protected override void RemoveItem(int index)
- {
- TKey key = GetKeyForItem(Items[index]);
- if (key != null)
- {
- RemoveKey(key);
- }
- base.RemoveItem(index);
- }
-
- protected override void SetItem(int index, TItem item)
- {
- TKey newKey = GetKeyForItem(item);
- TKey oldKey = GetKeyForItem(Items[index]);
-
- if (comparer.Equals(oldKey, newKey))
- {
- if (newKey != null && dict != null)
- {
- dict[newKey] = item;
- }
- }
- else
- {
- if (newKey != null)
- {
- AddKey(newKey, item);
- }
-
- if (oldKey != null)
- {
- RemoveKey(oldKey);
- }
- }
- base.SetItem(index, item);
- }
-
- private void AddKey(TKey key, TItem item)
- {
- if (dict != null)
- {
- dict.Add(key, item);
- }
- else if (keyCount == threshold)
- {
- CreateDictionary();
- dict.Add(key, item);
- }
- else
- {
- if (Contains(key))
- {
- ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_AddingDuplicate);
- }
-
- keyCount++;
- }
- }
-
- private void CreateDictionary()
- {
- dict = new Dictionary<TKey, TItem>(comparer);
- foreach (TItem item in Items)
- {
- TKey key = GetKeyForItem(item);
- if (key != null)
- {
- dict.Add(key, item);
- }
- }
- }
-
- private void RemoveKey(TKey key)
- {
- Debug.Assert(key != null, "key shouldn't be null!");
- if (dict != null)
- {
- dict.Remove(key);
- }
- else
- {
- keyCount--;
- }
- }
- }
-}
diff --git a/src/mscorlib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs b/src/mscorlib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs
index d94d9fd944..ebf86cdc58 100644
--- a/src/mscorlib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs
+++ b/src/mscorlib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs
@@ -22,7 +22,7 @@ namespace System.Collections.ObjectModel
[Serializable]
[DebuggerTypeProxy(typeof(Mscorlib_DictionaryDebugView<,>))]
[DebuggerDisplay("Count = {Count}")]
- public class ReadOnlyDictionary<TKey, TValue> : IDictionary<TKey, TValue>, IDictionary, IReadOnlyDictionary<TKey, TValue>
+ internal class ReadOnlyDictionary<TKey, TValue> : IDictionary<TKey, TValue>, IDictionary, IReadOnlyDictionary<TKey, TValue>
{
private readonly IDictionary<TKey, TValue> m_dictionary;
[NonSerialized]
diff --git a/src/mscorlib/src/System/Collections/StructuralComparisons.cs b/src/mscorlib/src/System/Collections/StructuralComparisons.cs
deleted file mode 100644
index bcd805dc29..0000000000
--- a/src/mscorlib/src/System/Collections/StructuralComparisons.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-//
-
-using System;
-
-namespace System.Collections
-{
- public static class StructuralComparisons
- {
- private static volatile IComparer s_StructuralComparer;
- private static volatile IEqualityComparer s_StructuralEqualityComparer;
-
- public static IComparer StructuralComparer
- {
- get
- {
- IComparer comparer = s_StructuralComparer;
- if (comparer == null)
- {
- comparer = new StructuralComparer();
- s_StructuralComparer = comparer;
- }
- return comparer;
- }
- }
-
- public static IEqualityComparer StructuralEqualityComparer
- {
- get
- {
- IEqualityComparer comparer = s_StructuralEqualityComparer;
- if (comparer == null)
- {
- comparer = new StructuralEqualityComparer();
- s_StructuralEqualityComparer = comparer;
- }
- return comparer;
- }
- }
- }
-
- [Serializable]
- internal class StructuralEqualityComparer : IEqualityComparer
- {
- public new bool Equals(Object x, Object y)
- {
- if (x != null)
- {
- IStructuralEquatable seObj = x as IStructuralEquatable;
-
- if (seObj != null)
- {
- return seObj.Equals(y, this);
- }
-
- if (y != null)
- {
- return x.Equals(y);
- }
- else
- {
- return false;
- }
- }
- if (y != null) return false;
- return true;
- }
-
- public int GetHashCode(Object obj)
- {
- if (obj == null) return 0;
-
- IStructuralEquatable seObj = obj as IStructuralEquatable;
-
- if (seObj != null)
- {
- return seObj.GetHashCode(this);
- }
-
- return obj.GetHashCode();
- }
- }
-
- [Serializable]
- internal class StructuralComparer : IComparer
- {
- public int Compare(Object x, Object y)
- {
- if (x == null) return y == null ? 0 : -1;
- if (y == null) return 1;
-
- IStructuralComparable scX = x as IStructuralComparable;
-
- if (scX != null)
- {
- return scX.CompareTo(y, this);
- }
-
- return Comparer.Default.Compare(x, y);
- }
- }
-}
diff --git a/src/mscorlib/src/System/CurrentSystemTimeZone.Cache.cs b/src/mscorlib/src/System/CurrentSystemTimeZone.Cache.cs
new file mode 100644
index 0000000000..744c697124
--- /dev/null
+++ b/src/mscorlib/src/System/CurrentSystemTimeZone.Cache.cs
@@ -0,0 +1,35 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Collections;
+using System.Globalization;
+
+namespace System
+{
+ internal partial class CurrentSystemTimeZone
+ {
+ private DaylightTime GetCachedDaylightChanges(int year)
+ {
+ Object objYear = (Object)year;
+
+ if (!m_CachedDaylightChanges.Contains(objYear))
+ {
+ DaylightTime currentDaylightChanges = CreateDaylightChanges(year);
+ lock (m_CachedDaylightChanges)
+ {
+ if (!m_CachedDaylightChanges.Contains(objYear))
+ {
+ m_CachedDaylightChanges.Add(objYear, currentDaylightChanges);
+ }
+ }
+ }
+
+ return (DaylightTime)m_CachedDaylightChanges[objYear];
+ }
+
+ // The per-year information is cached in in this instance value. As a result it can
+ // be cleaned up by CultureInfo.ClearCachedData, which will clear the instance of this object
+ private readonly Hashtable m_CachedDaylightChanges = new Hashtable();
+ }
+}
diff --git a/src/mscorlib/src/System/DBNull.cs b/src/mscorlib/src/System/DBNull.cs
deleted file mode 100644
index 817f6e547f..0000000000
--- a/src/mscorlib/src/System/DBNull.cs
+++ /dev/null
@@ -1,142 +0,0 @@
-// 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.
-
-////////////////////////////////////////////////////////////////////////////////
-// Void
-// This class represents a Missing Variant
-////////////////////////////////////////////////////////////////////////////////
-
-using System;
-using System.Runtime.Remoting;
-using System.Runtime.Serialization;
-
-namespace System
-{
- [Serializable]
- public sealed class DBNull : ISerializable, IConvertible
- {
- //Package private constructor
- private DBNull()
- {
- }
-
- private DBNull(SerializationInfo info, StreamingContext context)
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DBNullSerial"));
- }
-
- public static readonly DBNull Value = new DBNull();
-
- public void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- UnitySerializationHolder.GetUnitySerializationInfo(info, UnitySerializationHolder.NullUnity, null, null);
- }
-
- public override String ToString()
- {
- return String.Empty;
- }
-
- public String ToString(IFormatProvider provider)
- {
- return String.Empty;
- }
-
- public TypeCode GetTypeCode()
- {
- return TypeCode.DBNull;
- }
-
- /// <internalonly/>
- bool IConvertible.ToBoolean(IFormatProvider provider)
- {
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
- }
-
- /// <internalonly/>
- char IConvertible.ToChar(IFormatProvider provider)
- {
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
- }
-
- /// <internalonly/>
- sbyte IConvertible.ToSByte(IFormatProvider provider)
- {
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
- }
-
- /// <internalonly/>
- byte IConvertible.ToByte(IFormatProvider provider)
- {
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
- }
-
- /// <internalonly/>
- short IConvertible.ToInt16(IFormatProvider provider)
- {
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
- }
-
- /// <internalonly/>
- ushort IConvertible.ToUInt16(IFormatProvider provider)
- {
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
- }
-
- /// <internalonly/>
- int IConvertible.ToInt32(IFormatProvider provider)
- {
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
- }
-
- /// <internalonly/>
- uint IConvertible.ToUInt32(IFormatProvider provider)
- {
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
- }
-
- /// <internalonly/>
- long IConvertible.ToInt64(IFormatProvider provider)
- {
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
- }
-
- /// <internalonly/>
- ulong IConvertible.ToUInt64(IFormatProvider provider)
- {
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
- }
-
- /// <internalonly/>
- float IConvertible.ToSingle(IFormatProvider provider)
- {
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
- }
-
- /// <internalonly/>
- double IConvertible.ToDouble(IFormatProvider provider)
- {
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
- }
-
- /// <internalonly/>
- decimal IConvertible.ToDecimal(IFormatProvider provider)
- {
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
- }
-
- /// <internalonly/>
- DateTime IConvertible.ToDateTime(IFormatProvider provider)
- {
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromDBNull"));
- }
-
- /// <internalonly/>
- Object IConvertible.ToType(Type type, IFormatProvider provider)
- {
- return Convert.DefaultToType((IConvertible)this, type, provider);
- }
- }
-}
-
diff --git a/src/mscorlib/src/System/DateTime.CoreCLR.cs b/src/mscorlib/src/System/DateTime.CoreCLR.cs
new file mode 100644
index 0000000000..69c595663b
--- /dev/null
+++ b/src/mscorlib/src/System/DateTime.CoreCLR.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Diagnostics.Contracts;
+using System.Runtime.CompilerServices;
+
+namespace System
+{
+ public partial struct DateTime
+ {
+ public static DateTime UtcNow
+ {
+ get
+ {
+ Contract.Ensures(Contract.Result<DateTime>().Kind == DateTimeKind.Utc);
+ // following code is tuned for speed. Don't change it without running benchmark.
+ long ticks = 0;
+ ticks = GetSystemTimeAsFileTime();
+
+ return new DateTime(((UInt64)(ticks + FileTimeOffset)) | KindUtc);
+ }
+ }
+
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern long GetSystemTimeAsFileTime();
+ }
+}
diff --git a/src/mscorlib/src/System/Decimal.cs b/src/mscorlib/src/System/Decimal.cs
index dedcc92e18..ce59a99334 100644
--- a/src/mscorlib/src/System/Decimal.cs
+++ b/src/mscorlib/src/System/Decimal.cs
@@ -286,7 +286,7 @@ namespace System
return;
}
}
- throw new ArgumentException(Environment.GetResourceString("Arg_DecBitCtor"));
+ throw new ArgumentException(SR.Arg_DecBitCtor);
}
// Constructs a Decimal from its constituent parts.
@@ -294,7 +294,7 @@ namespace System
public Decimal(int lo, int mid, int hi, bool isNegative, byte scale)
{
if (scale > 28)
- throw new ArgumentOutOfRangeException(nameof(scale), Environment.GetResourceString("ArgumentOutOfRange_DecimalScale"));
+ throw new ArgumentOutOfRangeException(nameof(scale), SR.ArgumentOutOfRange_DecimalScale);
Contract.EndContractBlock();
this.lo = lo;
this.mid = mid;
@@ -314,7 +314,7 @@ namespace System
}
catch (ArgumentException e)
{
- throw new SerializationException(Environment.GetResourceString("Overflow_Decimal"), e);
+ throw new SerializationException(SR.Overflow_Decimal, e);
}
}
@@ -328,7 +328,7 @@ namespace System
}
catch (ArgumentException e)
{
- throw new SerializationException(Environment.GetResourceString("Overflow_Decimal"), e);
+ throw new SerializationException(SR.Overflow_Decimal, e);
}
}
@@ -343,7 +343,7 @@ namespace System
this.flags = flags;
return;
}
- throw new ArgumentException(Environment.GetResourceString("Arg_DecBitCtor"));
+ throw new ArgumentException(SR.Arg_DecBitCtor);
}
// Returns the absolute value of the given Decimal. If d is
@@ -399,7 +399,7 @@ namespace System
if (value == null)
return 1;
if (!(value is Decimal))
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeDecimal"));
+ throw new ArgumentException(SR.Arg_MustBeDecimal);
Decimal other = (Decimal)value;
return FCallCompare(ref this, ref other);
@@ -782,10 +782,10 @@ namespace System
public static Decimal Round(Decimal d, int decimals, MidpointRounding mode)
{
if ((decimals < 0) || (decimals > 28))
- throw new ArgumentOutOfRangeException(nameof(decimals), Environment.GetResourceString("ArgumentOutOfRange_DecimalRound"));
+ throw new ArgumentOutOfRangeException(nameof(decimals), SR.ArgumentOutOfRange_DecimalRound);
if (mode < MidpointRounding.ToEven || mode > MidpointRounding.AwayFromZero)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidEnumValue", mode, nameof(MidpointRounding)), nameof(mode));
+ throw new ArgumentException(SR.Format(SR.Argument_InvalidEnumValue, mode, nameof(MidpointRounding)), nameof(mode));
}
Contract.EndContractBlock();
@@ -824,9 +824,9 @@ namespace System
}
catch (OverflowException e)
{
- throw new OverflowException(Environment.GetResourceString("Overflow_Byte"), e);
+ throw new OverflowException(SR.Overflow_Byte, e);
}
- if (temp < Byte.MinValue || temp > Byte.MaxValue) throw new OverflowException(Environment.GetResourceString("Overflow_Byte"));
+ if (temp < Byte.MinValue || temp > Byte.MaxValue) throw new OverflowException(SR.Overflow_Byte);
return (byte)temp;
}
@@ -844,9 +844,9 @@ namespace System
}
catch (OverflowException e)
{
- throw new OverflowException(Environment.GetResourceString("Overflow_SByte"), e);
+ throw new OverflowException(SR.Overflow_SByte, e);
}
- if (temp < SByte.MinValue || temp > SByte.MaxValue) throw new OverflowException(Environment.GetResourceString("Overflow_SByte"));
+ if (temp < SByte.MinValue || temp > SByte.MaxValue) throw new OverflowException(SR.Overflow_SByte);
return (sbyte)temp;
}
@@ -863,9 +863,9 @@ namespace System
}
catch (OverflowException e)
{
- throw new OverflowException(Environment.GetResourceString("Overflow_Int16"), e);
+ throw new OverflowException(SR.Overflow_Int16, e);
}
- if (temp < Int16.MinValue || temp > Int16.MaxValue) throw new OverflowException(Environment.GetResourceString("Overflow_Int16"));
+ if (temp < Int16.MinValue || temp > Int16.MaxValue) throw new OverflowException(SR.Overflow_Int16);
return (short)temp;
}
@@ -913,7 +913,7 @@ namespace System
if (i <= 0) return i;
}
}
- throw new OverflowException(Environment.GetResourceString("Overflow_Int32"));
+ throw new OverflowException(SR.Overflow_Int32);
}
// Converts a Decimal to a long. The Decimal value is rounded towards zero
@@ -936,7 +936,7 @@ namespace System
if (l <= 0) return l;
}
}
- throw new OverflowException(Environment.GetResourceString("Overflow_Int64"));
+ throw new OverflowException(SR.Overflow_Int64);
}
// Converts a Decimal to an ushort. The Decimal
@@ -953,9 +953,9 @@ namespace System
}
catch (OverflowException e)
{
- throw new OverflowException(Environment.GetResourceString("Overflow_UInt16"), e);
+ throw new OverflowException(SR.Overflow_UInt16, e);
}
- if (temp < UInt16.MinValue || temp > UInt16.MaxValue) throw new OverflowException(Environment.GetResourceString("Overflow_UInt16"));
+ if (temp < UInt16.MinValue || temp > UInt16.MaxValue) throw new OverflowException(SR.Overflow_UInt16);
return (ushort)temp;
}
@@ -973,7 +973,7 @@ namespace System
if (d.flags >= 0 || i == 0)
return i;
}
- throw new OverflowException(Environment.GetResourceString("Overflow_UInt32"));
+ throw new OverflowException(SR.Overflow_UInt32);
}
// Converts a Decimal to an unsigned long. The Decimal
@@ -990,7 +990,7 @@ namespace System
if (d.flags >= 0 || l == 0)
return l;
}
- throw new OverflowException(Environment.GetResourceString("Overflow_UInt64"));
+ throw new OverflowException(SR.Overflow_UInt64);
}
// Converts a Decimal to a float. Since a float has fewer significant
@@ -1094,7 +1094,7 @@ namespace System
}
catch (OverflowException e)
{
- throw new OverflowException(Environment.GetResourceString("Overflow_Char"), e);
+ throw new OverflowException(SR.Overflow_Char, e);
}
return (char)temp;
}
@@ -1230,92 +1230,77 @@ namespace System
return TypeCode.Decimal;
}
- /// <internalonly/>
bool IConvertible.ToBoolean(IFormatProvider provider)
{
return Convert.ToBoolean(this);
}
- /// <internalonly/>
char IConvertible.ToChar(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "Decimal", "Char"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Decimal", "Char"));
}
- /// <internalonly/>
sbyte IConvertible.ToSByte(IFormatProvider provider)
{
return Convert.ToSByte(this);
}
- /// <internalonly/>
byte IConvertible.ToByte(IFormatProvider provider)
{
return Convert.ToByte(this);
}
- /// <internalonly/>
short IConvertible.ToInt16(IFormatProvider provider)
{
return Convert.ToInt16(this);
}
- /// <internalonly/>
ushort IConvertible.ToUInt16(IFormatProvider provider)
{
return Convert.ToUInt16(this);
}
- /// <internalonly/>
int IConvertible.ToInt32(IFormatProvider provider)
{
return Convert.ToInt32(this);
}
- /// <internalonly/>
uint IConvertible.ToUInt32(IFormatProvider provider)
{
return Convert.ToUInt32(this);
}
- /// <internalonly/>
long IConvertible.ToInt64(IFormatProvider provider)
{
return Convert.ToInt64(this);
}
- /// <internalonly/>
ulong IConvertible.ToUInt64(IFormatProvider provider)
{
return Convert.ToUInt64(this);
}
- /// <internalonly/>
float IConvertible.ToSingle(IFormatProvider provider)
{
return Convert.ToSingle(this);
}
- /// <internalonly/>
double IConvertible.ToDouble(IFormatProvider provider)
{
return Convert.ToDouble(this);
}
- /// <internalonly/>
Decimal IConvertible.ToDecimal(IFormatProvider provider)
{
return this;
}
- /// <internalonly/>
DateTime IConvertible.ToDateTime(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "Decimal", "DateTime"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Decimal", "DateTime"));
}
- /// <internalonly/>
Object IConvertible.ToType(Type type, IFormatProvider provider)
{
return Convert.DefaultToType((IConvertible)this, type, provider);
diff --git a/src/mscorlib/src/System/DefaultBinder.CanConvert.cs b/src/mscorlib/src/System/DefaultBinder.CanConvert.cs
new file mode 100644
index 0000000000..09c7298a3d
--- /dev/null
+++ b/src/mscorlib/src/System/DefaultBinder.CanConvert.cs
@@ -0,0 +1,30 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+namespace System
+{
+ internal partial class DefaultBinder : Binder
+ {
+ // CanChangePrimitive
+ // This will determine if the source can be converted to the target type
+ private static bool CanChangePrimitive(Type source, Type target) => CanConvertPrimitive((RuntimeType)source, (RuntimeType)target);
+
+ // CanChangePrimitiveObjectToType
+ private static bool CanChangePrimitiveObjectToType(object source, Type type) => CanConvertPrimitiveObjectToType(source, (RuntimeType)type);
+
+ // CanConvertPrimitive
+ // This will determine if the source can be converted to the target type
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ private static extern bool CanConvertPrimitive(RuntimeType source, RuntimeType target);
+
+ // CanConvertPrimitiveObjectToType
+ // This method will determine if the primitive object can be converted
+ // to a type.
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ private static extern bool CanConvertPrimitiveObjectToType(object source, RuntimeType type);
+ }
+}
diff --git a/src/mscorlib/src/System/Delegate.cs b/src/mscorlib/src/System/Delegate.cs
index 5f017733da..de0ff6532c 100644
--- a/src/mscorlib/src/System/Delegate.cs
+++ b/src/mscorlib/src/System/Delegate.cs
@@ -57,7 +57,7 @@ namespace System
if (!BindToMethodName(target, (RuntimeType)target.GetType(), method,
DelegateBindingFlags.InstanceMethodOnly |
DelegateBindingFlags.ClosedDelegateOnly))
- throw new ArgumentException(Environment.GetResourceString("Arg_DlgtTargMeth"));
+ throw new ArgumentException(SR.Arg_DlgtTargMeth);
}
// This constructor is called from a class to generate a
@@ -69,7 +69,7 @@ namespace System
throw new ArgumentNullException(nameof(target));
if (target.IsGenericType && target.ContainsGenericParameters)
- throw new ArgumentException(Environment.GetResourceString("Arg_UnboundGenParam"), nameof(target));
+ throw new ArgumentException(SR.Arg_UnboundGenParam, nameof(target));
if (method == null)
throw new ArgumentNullException(nameof(method));
@@ -77,7 +77,7 @@ namespace System
RuntimeType rtTarget = target as RuntimeType;
if (rtTarget == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"), nameof(target));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(target));
// This API existed in v1/v1.1 and only expected to create open
// static delegates. Constrain the call to BindToMethodName to such
@@ -291,7 +291,7 @@ namespace System
return source;
if (!InternalEqualTypes(source, value))
- throw new ArgumentException(Environment.GetResourceString("Arg_DlgtTypeMis"));
+ throw new ArgumentException(SR.Arg_DlgtTypeMis);
return source.RemoveImpl(value);
}
@@ -312,7 +312,7 @@ namespace System
protected virtual Delegate CombineImpl(Delegate d)
{
- throw new MulticastNotSupportedException(Environment.GetResourceString("Multicast_Combine"));
+ throw new MulticastNotSupportedException(SR.Multicast_Combine);
}
protected virtual Delegate RemoveImpl(Delegate d)
@@ -351,9 +351,9 @@ namespace System
RuntimeType rtType = type as RuntimeType;
if (rtType == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"), nameof(type));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(type));
if (!rtType.IsDelegate())
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeDelegate"), nameof(type));
+ throw new ArgumentException(SR.Arg_MustBeDelegate, nameof(type));
Delegate d = InternalAlloc(rtType);
// This API existed in v1/v1.1 and only expected to create closed
@@ -370,7 +370,7 @@ namespace System
(ignoreCase ? DelegateBindingFlags.CaselessMatching : 0)))
{
if (throwOnBindFailure)
- throw new ArgumentException(Environment.GetResourceString("Arg_DlgtTargMeth"));
+ throw new ArgumentException(SR.Arg_DlgtTargMeth);
d = null;
}
@@ -397,7 +397,7 @@ namespace System
if (target == null)
throw new ArgumentNullException(nameof(target));
if (target.IsGenericType && target.ContainsGenericParameters)
- throw new ArgumentException(Environment.GetResourceString("Arg_UnboundGenParam"), nameof(target));
+ throw new ArgumentException(SR.Arg_UnboundGenParam, nameof(target));
if (method == null)
throw new ArgumentNullException(nameof(method));
Contract.EndContractBlock();
@@ -405,11 +405,11 @@ namespace System
RuntimeType rtType = type as RuntimeType;
RuntimeType rtTarget = target as RuntimeType;
if (rtType == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"), nameof(type));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(type));
if (rtTarget == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"), nameof(target));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(target));
if (!rtType.IsDelegate())
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeDelegate"), nameof(type));
+ throw new ArgumentException(SR.Arg_MustBeDelegate, nameof(type));
Delegate d = InternalAlloc(rtType);
// This API existed in v1/v1.1 and only expected to create open
@@ -422,7 +422,7 @@ namespace System
(ignoreCase ? DelegateBindingFlags.CaselessMatching : 0)))
{
if (throwOnBindFailure)
- throw new ArgumentException(Environment.GetResourceString("Arg_DlgtTargMeth"));
+ throw new ArgumentException(SR.Arg_DlgtTargMeth);
d = null;
}
@@ -442,14 +442,14 @@ namespace System
RuntimeType rtType = type as RuntimeType;
if (rtType == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"), nameof(type));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(type));
RuntimeMethodInfo rmi = method as RuntimeMethodInfo;
if (rmi == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeMethodInfo"), nameof(method));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeMethodInfo, nameof(method));
if (!rtType.IsDelegate())
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeDelegate"), nameof(type));
+ throw new ArgumentException(SR.Arg_MustBeDelegate, nameof(type));
// This API existed in v1/v1.1 and only expected to create closed
// instance delegates. Constrain the call to BindToMethodInfo to
@@ -468,7 +468,7 @@ namespace System
ref stackMark);
if (d == null && throwOnBindFailure)
- throw new ArgumentException(Environment.GetResourceString("Arg_DlgtTargMeth"));
+ throw new ArgumentException(SR.Arg_DlgtTargMeth);
return d;
}
@@ -492,14 +492,14 @@ namespace System
RuntimeType rtType = type as RuntimeType;
if (rtType == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"), nameof(type));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(type));
RuntimeMethodInfo rmi = method as RuntimeMethodInfo;
if (rmi == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeMethodInfo"), nameof(method));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeMethodInfo, nameof(method));
if (!rtType.IsDelegate())
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeDelegate"), nameof(type));
+ throw new ArgumentException(SR.Arg_MustBeDelegate, nameof(type));
// This API is new in Whidbey and allows the full range of delegate
// flexability (open or closed delegates binding to static or
@@ -515,7 +515,7 @@ namespace System
ref stackMark);
if (d == null && throwOnBindFailure)
- throw new ArgumentException(Environment.GetResourceString("Arg_DlgtTargMeth"));
+ throw new ArgumentException(SR.Arg_DlgtTargMeth);
return d;
}
@@ -562,10 +562,10 @@ namespace System
RuntimeType rtType = type as RuntimeType;
if (rtType == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"), nameof(type));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(type));
if (!rtType.IsDelegate())
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeDelegate"), nameof(type));
+ throw new ArgumentException(SR.Arg_MustBeDelegate, nameof(type));
// Initialize the method...
Delegate d = InternalAlloc(rtType);
@@ -578,7 +578,7 @@ namespace System
method.GetMethodInfo(),
RuntimeMethodHandle.GetDeclaringType(method.GetMethodInfo()),
DelegateBindingFlags.RelaxedSignature | DelegateBindingFlags.SkipSecurityChecks))
- throw new ArgumentException(Environment.GetResourceString("Arg_DlgtTargMeth"));
+ throw new ArgumentException(SR.Arg_DlgtTargMeth);
return d;
}
@@ -595,10 +595,10 @@ namespace System
RuntimeMethodInfo rtMethod = method as RuntimeMethodInfo;
if (rtMethod == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeMethodInfo"), nameof(method));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeMethodInfo, nameof(method));
if (!type.IsDelegate())
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeDelegate"), nameof(type));
+ throw new ArgumentException(SR.Arg_MustBeDelegate, nameof(type));
// This API is used by the formatters when deserializing a delegate.
// They pass us the specific target method (that was already the
@@ -613,7 +613,7 @@ namespace System
DelegateBindingFlags.RelaxedSignature);
if (d == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_DlgtTargMeth"));
+ throw new ArgumentException(SR.Arg_DlgtTargMeth);
return d;
}
diff --git a/src/mscorlib/src/System/DelegateSerializationHolder.cs b/src/mscorlib/src/System/DelegateSerializationHolder.cs
index 4112816ba5..5f8f0ef3f0 100644
--- a/src/mscorlib/src/System/DelegateSerializationHolder.cs
+++ b/src/mscorlib/src/System/DelegateSerializationHolder.cs
@@ -28,10 +28,10 @@ namespace System
Type c = delegateType.BaseType;
if (c == null || (c != typeof(Delegate) && c != typeof(MulticastDelegate)))
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeDelegate"), "type");
+ throw new ArgumentException(SR.Arg_MustBeDelegate, "type");
if (method.DeclaringType == null)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_GlobalMethodSerialization"));
+ throw new NotSupportedException(SR.NotSupported_GlobalMethodSerialization);
DelegateEntry de = new DelegateEntry(delegateType.FullName, delegateType.Module.Assembly.FullName, target,
method.ReflectedType.Module.Assembly.FullName, method.ReflectedType.FullName, method.Name);
@@ -170,7 +170,7 @@ namespace System
private void ThrowInsufficientState(string field)
{
throw new SerializationException(
- Environment.GetResourceString("Serialization_InsufficientDeserializationState", field));
+ SR.Format(SR.Serialization_InsufficientDeserializationState, field));
}
private DelegateEntry OldDelegateWireFormat(SerializationInfo info, StreamingContext context)
@@ -272,7 +272,7 @@ namespace System
#region ISerializable
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DelegateSerHolderSerial"));
+ throw new NotSupportedException(SR.NotSupported_DelegateSerHolderSerial);
}
#endregion
}
diff --git a/src/mscorlib/src/System/Diagnostics/Assert.cs b/src/mscorlib/src/System/Diagnostics/Assert.cs
index c0b4e4c229..67e6914aa4 100644
--- a/src/mscorlib/src/System/Diagnostics/Assert.cs
+++ b/src/mscorlib/src/System/Diagnostics/Assert.cs
@@ -67,7 +67,7 @@ namespace System.Diagnostics
if (Debugger.Launch() == false)
{
throw new InvalidOperationException(
- Environment.GetResourceString("InvalidOperation_DebuggerLaunchFailed"));
+ SR.InvalidOperation_DebuggerLaunchFailed);
}
}
}
diff --git a/src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs b/src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs
index fe1afe3fab..76b15197f2 100644
--- a/src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs
+++ b/src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs
@@ -640,7 +640,7 @@ namespace System.Diagnostics.Contracts
{
if (fromInclusive > toExclusive)
#if CORECLR
- throw new ArgumentException(Environment.GetResourceString("Argument_ToExclusiveLessThanFromExclusive"));
+ throw new ArgumentException(SR.Argument_ToExclusiveLessThanFromExclusive);
#else
throw new ArgumentException("fromInclusive must be less than or equal to toExclusive.");
#endif
@@ -700,7 +700,7 @@ namespace System.Diagnostics.Contracts
{
if (fromInclusive > toExclusive)
#if CORECLR
- throw new ArgumentException(Environment.GetResourceString("Argument_ToExclusiveLessThanFromExclusive"));
+ throw new ArgumentException(SR.Argument_ToExclusiveLessThanFromExclusive);
#else
throw new ArgumentException("fromInclusive must be less than or equal to toExclusive.");
#endif
diff --git a/src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs b/src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs
index 1e86b914e6..09d1e6baca 100644
--- a/src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs
+++ b/src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs
@@ -73,7 +73,7 @@ namespace System.Diagnostics.Contracts
if (probablyNotRewritten == null)
probablyNotRewritten = thisAssembly;
String simpleName = probablyNotRewritten.GetName().Name;
- System.Runtime.CompilerServices.ContractHelper.TriggerFailure(kind, Environment.GetResourceString("MustUseCCRewrite", contractKind, simpleName), null, null, null);
+ System.Runtime.CompilerServices.ContractHelper.TriggerFailure(kind, SR.Format(SR.MustUseCCRewrite, contractKind, simpleName), null, null, null);
_assertingMustUseRewriter = false;
}
@@ -95,7 +95,7 @@ namespace System.Diagnostics.Contracts
static partial void ReportFailure(ContractFailureKind failureKind, String userMessage, String conditionText, Exception innerException)
{
if (failureKind < ContractFailureKind.Precondition || failureKind > ContractFailureKind.Assume)
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", failureKind), nameof(failureKind));
+ throw new ArgumentException(SR.Format(SR.Arg_EnumIllegalVal, failureKind), nameof(failureKind));
Contract.EndContractBlock();
// displayMessage == null means: yes we handled it. Otherwise it is the localized failure message
@@ -308,7 +308,7 @@ namespace System.Runtime.CompilerServices
static partial void RaiseContractFailedEventImplementation(ContractFailureKind failureKind, String userMessage, String conditionText, Exception innerException, ref string resultFailureMessage)
{
if (failureKind < ContractFailureKind.Precondition || failureKind > ContractFailureKind.Assume)
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", failureKind), nameof(failureKind));
+ throw new ArgumentException(SR.Format(SR.Arg_EnumIllegalVal, failureKind), nameof(failureKind));
Contract.EndContractBlock();
string returnValue;
@@ -382,7 +382,7 @@ namespace System.Runtime.CompilerServices
// May need to rethink Assert.Fail w/ TaskDialogIndirect as a model. Window title. Main instruction. Content. Expanded info.
// Optional info like string for collapsed text vs. expanded text.
- String windowTitle = Environment.GetResourceString(GetResourceNameForFailure(kind));
+ String windowTitle = SR.GetResourceString(GetResourceNameForFailure(kind));
const int numStackFramesToSkip = 2; // To make stack traces easier to read
System.Diagnostics.Assert.Fail(conditionText, displayMessage, windowTitle, COR_E_CODECONTRACTFAILED, StackTrace.TraceFormat.Normal, numStackFramesToSkip);
// If we got here, the user selected Ignore. Continue.
@@ -440,11 +440,11 @@ namespace System.Runtime.CompilerServices
if (!String.IsNullOrEmpty(conditionText))
{
resourceName += "_Cnd";
- failureMessage = Environment.GetResourceString(resourceName, conditionText);
+ failureMessage = SR.Format(SR.GetResourceString(resourceName), conditionText);
}
else
{
- failureMessage = Environment.GetResourceString(resourceName);
+ failureMessage = SR.GetResourceString(resourceName);
}
// Now add in the user message, if present.
diff --git a/src/mscorlib/src/System/Diagnostics/Debug.Unix.cs b/src/mscorlib/src/System/Diagnostics/Debug.Unix.cs
new file mode 100644
index 0000000000..495f2f713c
--- /dev/null
+++ b/src/mscorlib/src/System/Diagnostics/Debug.Unix.cs
@@ -0,0 +1,95 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using Microsoft.Win32.SafeHandles;
+
+namespace System.Diagnostics
+{
+ public static partial class Debug
+ {
+ private static readonly bool s_shouldWriteToStdErr = Environment.GetEnvironmentVariable("COMPlus_DebugWriteToStdErr") == "1";
+
+ private static void ShowAssertDialog(string stackTrace, string message, string detailMessage)
+ {
+ if (Debugger.IsAttached)
+ {
+ Debugger.Break();
+ }
+ else
+ {
+ // In Core, we do not show a dialog.
+ // Fail in order to avoid anyone catching an exception and masking
+ // an assert failure.
+ var ex = new DebugAssertException(message, detailMessage, stackTrace);
+ Environment.FailFast(ex.Message, ex);
+ }
+ }
+
+ private static void WriteCore(string message)
+ {
+ WriteToDebugger(message);
+
+ if (s_shouldWriteToStdErr)
+ {
+ WriteToStderr(message);
+ }
+ }
+
+ private static void WriteToDebugger(string message)
+ {
+ if (Debugger.IsLogging())
+ {
+ Debugger.Log(0, null, message);
+ }
+ else
+ {
+ Interop.Sys.SysLog(Interop.Sys.SysLogPriority.LOG_USER | Interop.Sys.SysLogPriority.LOG_DEBUG, "%s", message);
+ }
+ }
+
+ private static void WriteToStderr(string message)
+ {
+ // We don't want to write UTF-16 to a file like standard error. Ideally we would transcode this
+ // to UTF8, but the downside of that is it pulls in a bunch of stuff into what is ideally
+ // a path with minimal dependencies (as to prevent re-entrency), so we'll take the strategy
+ // of just throwing away any non ASCII characters from the message and writing the rest
+
+ const int BufferLength = 256;
+
+ unsafe
+ {
+ byte* buf = stackalloc byte[BufferLength];
+ int bufCount;
+ int i = 0;
+
+ while (i < message.Length)
+ {
+ for (bufCount = 0; bufCount < BufferLength && i < message.Length; i++)
+ {
+ if (message[i] <= 0x7F)
+ {
+ buf[bufCount] = (byte)message[i];
+ bufCount++;
+ }
+ }
+
+ int totalBytesWritten = 0;
+ while (bufCount > 0)
+ {
+ int bytesWritten = Interop.Sys.Write(2 /* stderr */, buf + totalBytesWritten, bufCount);
+ if (bytesWritten < 0)
+ {
+ // On error, simply stop writing the debug output. This could commonly happen if stderr
+ // was piped to a program that ended before this program did, resulting in EPIPE errors.
+ return;
+ }
+
+ bufCount -= bytesWritten;
+ totalBytesWritten += bytesWritten;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/mscorlib/src/System/Diagnostics/Debug.Windows.cs b/src/mscorlib/src/System/Diagnostics/Debug.Windows.cs
new file mode 100644
index 0000000000..095e9b6985
--- /dev/null
+++ b/src/mscorlib/src/System/Diagnostics/Debug.Windows.cs
@@ -0,0 +1,63 @@
+// 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 System.Diagnostics
+{
+ public static partial class Debug
+ {
+ private static void ShowAssertDialog(string stackTrace, string message, string detailMessage)
+ {
+ if (Debugger.IsAttached)
+ {
+ Debugger.Break();
+ }
+ else
+ {
+ // In Core, we do not show a dialog.
+ // Fail in order to avoid anyone catching an exception and masking
+ // an assert failure.
+ var ex = new DebugAssertException(message, detailMessage, stackTrace);
+ Environment.FailFast(ex.Message, ex);
+ }
+ }
+
+ private static void WriteCore(string message)
+ {
+ // really huge messages mess up both VS and dbmon, so we chop it up into
+ // reasonable chunks if it's too big. This is the number of characters
+ // that OutputDebugstring chunks at.
+ const int WriteChunkLength = 4091;
+
+ // We don't want output from multiple threads to be interleaved.
+ lock (s_ForLock)
+ {
+ if (message == null || message.Length <= WriteChunkLength)
+ {
+ WriteToDebugger(message);
+ }
+ else
+ {
+ int offset;
+ for (offset = 0; offset < message.Length - WriteChunkLength; offset += WriteChunkLength)
+ {
+ WriteToDebugger(message.Substring(offset, WriteChunkLength));
+ }
+ WriteToDebugger(message.Substring(offset));
+ }
+ }
+ }
+
+ private static void WriteToDebugger(string message)
+ {
+ if (Debugger.IsLogging())
+ {
+ Debugger.Log(0, null, message);
+ }
+ else
+ {
+ Interop.Kernel32.OutputDebugString(message ?? string.Empty);
+ }
+ }
+ }
+}
diff --git a/src/mscorlib/src/System/Diagnostics/Debug.cs b/src/mscorlib/src/System/Diagnostics/Debug.cs
new file mode 100644
index 0000000000..59f3c378da
--- /dev/null
+++ b/src/mscorlib/src/System/Diagnostics/Debug.cs
@@ -0,0 +1,323 @@
+// 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.
+
+// Do not remove this, it is needed to retain calls to these conditional methods in release builds
+#define DEBUG
+
+namespace System.Diagnostics
+{
+ /// <summary>
+ /// Provides a set of properties and methods for debugging code.
+ /// </summary>
+ public static partial class Debug
+ {
+ private static readonly object s_lock = new object();
+
+ public static bool AutoFlush { get { return true; } set { } }
+
+ [ThreadStatic]
+ private static int s_indentLevel;
+ public static int IndentLevel
+ {
+ get
+ {
+ return s_indentLevel;
+ }
+ set
+ {
+ s_indentLevel = value < 0 ? 0 : value;
+ }
+ }
+
+ private static int s_indentSize = 4;
+ public static int IndentSize
+ {
+ get
+ {
+ return s_indentSize;
+ }
+ set
+ {
+ s_indentSize = value < 0 ? 0 : value;
+ }
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void Close() { }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void Flush() { }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void Indent()
+ {
+ IndentLevel++;
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void Unindent()
+ {
+ IndentLevel--;
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void Print(string message)
+ {
+ Write(message);
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void Print(string format, params object[] args)
+ {
+ Write(string.Format(null, format, args));
+ }
+
+ private static readonly object s_ForLock = new Object();
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void Assert(bool condition)
+ {
+ Assert(condition, string.Empty, string.Empty);
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void Assert(bool condition, string message)
+ {
+ Assert(condition, message, string.Empty);
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void Assert(bool condition, string message, string detailMessage)
+ {
+ if (!condition)
+ {
+ string stackTrace;
+
+ try
+ {
+ stackTrace = Internal.Runtime.Augments.EnvironmentAugments.StackTrace;
+ }
+ catch
+ {
+ stackTrace = "";
+ }
+
+ WriteLine(FormatAssert(stackTrace, message, detailMessage));
+ s_ShowAssertDialog(stackTrace, message, detailMessage);
+ }
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void Fail(string message)
+ {
+ Assert(false, message, string.Empty);
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void Fail(string message, string detailMessage)
+ {
+ Assert(false, message, detailMessage);
+ }
+
+ private static string FormatAssert(string stackTrace, string message, string detailMessage)
+ {
+ string newLine = GetIndentString() + Environment.NewLine;
+ return SR.DebugAssertBanner + newLine
+ + SR.DebugAssertShortMessage + newLine
+ + message + newLine
+ + SR.DebugAssertLongMessage + newLine
+ + detailMessage + newLine
+ + stackTrace;
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void Assert(bool condition, string message, string detailMessageFormat, params object[] args)
+ {
+ Assert(condition, message, string.Format(detailMessageFormat, args));
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void WriteLine(string message)
+ {
+ Write(message + Environment.NewLine);
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void Write(string message)
+ {
+ lock (s_lock)
+ {
+ if (message == null)
+ {
+ s_WriteCore(string.Empty);
+ return;
+ }
+ if (s_needIndent)
+ {
+ message = GetIndentString() + message;
+ s_needIndent = false;
+ }
+ s_WriteCore(message);
+ if (message.EndsWith(Environment.NewLine))
+ {
+ s_needIndent = true;
+ }
+ }
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void WriteLine(object value)
+ {
+ WriteLine(value?.ToString());
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void WriteLine(object value, string category)
+ {
+ WriteLine(value?.ToString(), category);
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void WriteLine(string format, params object[] args)
+ {
+ WriteLine(string.Format(null, format, args));
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void WriteLine(string message, string category)
+ {
+ if (category == null)
+ {
+ WriteLine(message);
+ }
+ else
+ {
+ WriteLine(category + ":" + message);
+ }
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void Write(object value)
+ {
+ Write(value?.ToString());
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void Write(string message, string category)
+ {
+ if (category == null)
+ {
+ Write(message);
+ }
+ else
+ {
+ Write(category + ":" + message);
+ }
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void Write(object value, string category)
+ {
+ Write(value?.ToString(), category);
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void WriteIf(bool condition, string message)
+ {
+ if (condition)
+ {
+ Write(message);
+ }
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void WriteIf(bool condition, object value)
+ {
+ if (condition)
+ {
+ Write(value);
+ }
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void WriteIf(bool condition, string message, string category)
+ {
+ if (condition)
+ {
+ Write(message, category);
+ }
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void WriteIf(bool condition, object value, string category)
+ {
+ if (condition)
+ {
+ Write(value, category);
+ }
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void WriteLineIf(bool condition, object value)
+ {
+ if (condition)
+ {
+ WriteLine(value);
+ }
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void WriteLineIf(bool condition, object value, string category)
+ {
+ if (condition)
+ {
+ WriteLine(value, category);
+ }
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void WriteLineIf(bool condition, string message)
+ {
+ if (condition)
+ {
+ WriteLine(message);
+ }
+ }
+
+ [System.Diagnostics.Conditional("DEBUG")]
+ public static void WriteLineIf(bool condition, string message, string category)
+ {
+ if (condition)
+ {
+ WriteLine(message, category);
+ }
+ }
+
+ private static bool s_needIndent;
+
+ private static string s_indentString;
+
+ private static string GetIndentString()
+ {
+ int indentCount = IndentSize * IndentLevel;
+ if (s_indentString?.Length == indentCount)
+ {
+ return s_indentString;
+ }
+ return s_indentString = new string(' ', indentCount);
+ }
+
+ private sealed class DebugAssertException : Exception
+ {
+ internal DebugAssertException(string message, string detailMessage, string stackTrace) :
+ base(message + Environment.NewLine + detailMessage + Environment.NewLine + stackTrace)
+ {
+ }
+ }
+
+ // internal and not readonly so that the tests can swap this out.
+ internal static Action<string, string, string> s_ShowAssertDialog = ShowAssertDialog;
+ internal static Action<string> s_WriteCore = WriteCore;
+ }
+}
diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/EventCounter.cs b/src/mscorlib/src/System/Diagnostics/Eventing/EventCounter.cs
index b1f946464e..2ad0581ad4 100644
--- a/src/mscorlib/src/System/Diagnostics/Eventing/EventCounter.cs
+++ b/src/mscorlib/src/System/Diagnostics/Eventing/EventCounter.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// 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.
diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs b/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs
index 3668d8cb64..1d5830ceb6 100644
--- a/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs
+++ b/src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs
@@ -1470,8 +1470,7 @@ namespace System.Diagnostics.Tracing
#if (!ES_BUILD_STANDALONE && !PROJECTN)
// API available on OS >= Win 8 and patched Win 7.
// Disable only for FrameworkEventSource to avoid recursion inside exception handling.
- var osVer = Environment.OSVersion.Version.Major * 10 + Environment.OSVersion.Version.Minor;
- if (this.Name != "System.Diagnostics.Eventing.FrameworkEventSource" || osVer >= 62)
+ if (this.Name != "System.Diagnostics.Eventing.FrameworkEventSource" || Environment.IsWindows8OrAbove)
#endif
{
int setInformationResult;
diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/EventSource_CoreCLR.cs b/src/mscorlib/src/System/Diagnostics/Eventing/EventSource_CoreCLR.cs
index 71c421231e..b691dd38b9 100644
--- a/src/mscorlib/src/System/Diagnostics/Eventing/EventSource_CoreCLR.cs
+++ b/src/mscorlib/src/System/Diagnostics/Eventing/EventSource_CoreCLR.cs
@@ -128,7 +128,7 @@ namespace System.Diagnostics.Tracing
private static string GetResourceString(string key, params object[] args)
{
- return Environment.GetResourceString(key, args);
+ return SR.Format(SR.GetResourceString(key), args);
}
private static readonly bool m_EventSourcePreventRecursion = false;
@@ -214,7 +214,7 @@ namespace System.Diagnostics.Tracing
{
internal static string GetResourceString(string key, params object[] args)
{
- return Environment.GetResourceString(key, args);
+ return SR.Format(SR.GetResourceString(key), args);
}
}
}
diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/StubEnvironment.cs b/src/mscorlib/src/System/Diagnostics/Eventing/StubEnvironment.cs
index 7b6491094b..9ed0470b03 100644
--- a/src/mscorlib/src/System/Diagnostics/Eventing/StubEnvironment.cs
+++ b/src/mscorlib/src/System/Diagnostics/Eventing/StubEnvironment.cs
@@ -344,7 +344,7 @@ namespace Microsoft.Reflection
#if ES_BUILD_PCL || PROJECTN
namespace System.Security
{
- class SuppressUnmanagedCodeSecurityAttribute : Attribute { }
+ internal class SuppressUnmanagedCodeSecurityAttribute : Attribute { }
enum SecurityAction { Demand }
}
diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventSourceActivity.cs b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventSourceActivity.cs
index 38c1767462..dcbfa6f6bd 100644
--- a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventSourceActivity.cs
+++ b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventSourceActivity.cs
@@ -77,7 +77,7 @@ namespace System.Diagnostics.Tracing
/// <summary>
/// Writes a Start event with the specified name and data. If the start event is not active (because the provider
- /// is not on or keyword-level indiates the event is off, then the returned activity is simply the 'this' poitner
+ /// is not on or keyword-level indiates the event is off, then the returned activity is simply the 'this' pointer
/// and it is effectively like the Start d
///
/// A new activityID GUID is generated and the returned
diff --git a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/PropertyValue.cs b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/PropertyValue.cs
index f95e36da42..00ffcdc9c0 100644
--- a/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/PropertyValue.cs
+++ b/src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/PropertyValue.cs
@@ -1,4 +1,4 @@
-using System.Reflection;
+using System.Reflection;
using System.Runtime.InteropServices;
using System.Diagnostics;
diff --git a/src/mscorlib/src/System/Diagnostics/LogSwitch.cs b/src/mscorlib/src/System/Diagnostics/LogSwitch.cs
index 85f4f4f646..29d6a1d4e6 100644
--- a/src/mscorlib/src/System/Diagnostics/LogSwitch.cs
+++ b/src/mscorlib/src/System/Diagnostics/LogSwitch.cs
@@ -37,7 +37,7 @@ namespace System.Diagnostics
public LogSwitch(String name, String description, LogSwitch parent)
{
if (name != null && name.Length == 0)
- throw new ArgumentOutOfRangeException(nameof(Name), Environment.GetResourceString("Argument_StringZeroLength"));
+ throw new ArgumentOutOfRangeException(nameof(Name), SR.Argument_StringZeroLength);
Contract.EndContractBlock();
if ((name != null) && (parent != null))
diff --git a/src/mscorlib/src/System/Diagnostics/Stacktrace.cs b/src/mscorlib/src/System/Diagnostics/Stacktrace.cs
index 40c2526ad1..cdedb66ed8 100644
--- a/src/mscorlib/src/System/Diagnostics/Stacktrace.cs
+++ b/src/mscorlib/src/System/Diagnostics/Stacktrace.cs
@@ -283,7 +283,7 @@ namespace System.Diagnostics
{
if (skipFrames < 0)
throw new ArgumentOutOfRangeException(nameof(skipFrames),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
m_iNumOfFrames = 0;
@@ -299,7 +299,7 @@ namespace System.Diagnostics
{
if (skipFrames < 0)
throw new ArgumentOutOfRangeException(nameof(skipFrames),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
m_iNumOfFrames = 0;
@@ -344,7 +344,7 @@ namespace System.Diagnostics
if (skipFrames < 0)
throw new ArgumentOutOfRangeException(nameof(skipFrames),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
m_iNumOfFrames = 0;
@@ -363,7 +363,7 @@ namespace System.Diagnostics
if (skipFrames < 0)
throw new ArgumentOutOfRangeException(nameof(skipFrames),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
m_iNumOfFrames = 0;
@@ -385,17 +385,6 @@ namespace System.Diagnostics
}
- // Constructs a stack trace for the given thread
- //
- [Obsolete("This constructor has been deprecated. Please use a constructor that does not require a Thread parameter. http://go.microsoft.com/fwlink/?linkid=14202")]
- public StackTrace(Thread targetThread, bool needFileInfo)
- {
- m_iNumOfFrames = 0;
- m_iMethodsToSkip = 0;
-
- CaptureStackTrace(METHODS_TO_SKIP, needFileInfo, targetThread, null);
- }
-
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern void GetStackFramesInternal(StackFrameHelper sfh, int iSkip, bool fNeedFileInfo, Exception e);
@@ -550,8 +539,8 @@ namespace System.Diagnostics
if (traceFormat != TraceFormat.NoResourceLookup)
{
- word_At = Environment.GetResourceString("Word_At");
- inFileLineNum = Environment.GetResourceString("StackTrace_InFileLineNumber");
+ word_At = SR.Word_At;
+ inFileLineNum = SR.StackTrace_InFileLineNumber;
}
bool fFirstFrame = true;
@@ -669,7 +658,7 @@ namespace System.Diagnostics
if (sf.GetIsLastFrameFromForeignExceptionStackTrace())
{
sb.Append(Environment.NewLine);
- sb.Append(Environment.GetResourceString("Exception_EndStackTraceFromPreviousThrow"));
+ sb.Append(SR.Exception_EndStackTraceFromPreviousThrow);
}
}
}
diff --git a/src/mscorlib/src/System/Diagnostics/log.cs b/src/mscorlib/src/System/Diagnostics/log.cs
index 19e062964c..b62ea493e7 100644
--- a/src/mscorlib/src/System/Diagnostics/log.cs
+++ b/src/mscorlib/src/System/Diagnostics/log.cs
@@ -14,6 +14,7 @@ namespace System.Diagnostics
using System.Diagnostics.Contracts;
using System.Diagnostics.CodeAnalysis;
+ using Console = Internal.Console;
// LogSwitchLevelHandlers are triggered when the level of a LogSwitch is modified
// NOTE: These are NOT triggered when the log switch setting is changed from the
@@ -87,7 +88,7 @@ namespace System.Diagnostics
throw new ArgumentNullException("LogSwitch");
if (level < 0)
- throw new ArgumentOutOfRangeException(nameof(level), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(level), SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// Is logging for this level for this switch enabled?
diff --git a/src/mscorlib/src/System/DllNotFoundException.cs b/src/mscorlib/src/System/DllNotFoundException.cs
index 63b263e9dd..dd0f27e7c1 100644
--- a/src/mscorlib/src/System/DllNotFoundException.cs
+++ b/src/mscorlib/src/System/DllNotFoundException.cs
@@ -21,7 +21,7 @@ namespace System
public class DllNotFoundException : TypeLoadException
{
public DllNotFoundException()
- : base(Environment.GetResourceString("Arg_DllNotFoundException"))
+ : base(SR.Arg_DllNotFoundException)
{
SetErrorCode(__HResults.COR_E_DLLNOTFOUND);
}
diff --git a/src/mscorlib/src/System/Double.cs b/src/mscorlib/src/System/Double.cs
index d7319b6c48..f2c5cec219 100644
--- a/src/mscorlib/src/System/Double.cs
+++ b/src/mscorlib/src/System/Double.cs
@@ -120,7 +120,7 @@ namespace System
else
return 1;
}
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeDouble"));
+ throw new ArgumentException(SR.Arg_MustBeDouble);
}
public int CompareTo(Double value)
@@ -321,91 +321,76 @@ namespace System
return TypeCode.Double;
}
- /// <internalonly/>
bool IConvertible.ToBoolean(IFormatProvider provider)
{
return Convert.ToBoolean(m_value);
}
- /// <internalonly/>
char IConvertible.ToChar(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "Double", "Char"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Double", "Char"));
}
- /// <internalonly/>
sbyte IConvertible.ToSByte(IFormatProvider provider)
{
return Convert.ToSByte(m_value);
}
- /// <internalonly/>
byte IConvertible.ToByte(IFormatProvider provider)
{
return Convert.ToByte(m_value);
}
- /// <internalonly/>
short IConvertible.ToInt16(IFormatProvider provider)
{
return Convert.ToInt16(m_value);
}
- /// <internalonly/>
ushort IConvertible.ToUInt16(IFormatProvider provider)
{
return Convert.ToUInt16(m_value);
}
- /// <internalonly/>
int IConvertible.ToInt32(IFormatProvider provider)
{
return Convert.ToInt32(m_value);
}
- /// <internalonly/>
uint IConvertible.ToUInt32(IFormatProvider provider)
{
return Convert.ToUInt32(m_value);
}
- /// <internalonly/>
long IConvertible.ToInt64(IFormatProvider provider)
{
return Convert.ToInt64(m_value);
}
- /// <internalonly/>
ulong IConvertible.ToUInt64(IFormatProvider provider)
{
return Convert.ToUInt64(m_value);
}
- /// <internalonly/>
float IConvertible.ToSingle(IFormatProvider provider)
{
return Convert.ToSingle(m_value);
}
- /// <internalonly/>
double IConvertible.ToDouble(IFormatProvider provider)
{
return m_value;
}
- /// <internalonly/>
Decimal IConvertible.ToDecimal(IFormatProvider provider)
{
return Convert.ToDecimal(m_value);
}
- /// <internalonly/>
DateTime IConvertible.ToDateTime(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "Double", "DateTime"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Double", "DateTime"));
}
- /// <internalonly/>
Object IConvertible.ToType(Type type, IFormatProvider provider)
{
return Convert.DefaultToType((IConvertible)this, type, provider);
diff --git a/src/mscorlib/src/System/Enum.cs b/src/mscorlib/src/System/Enum.cs
index 0f01052f31..489f36739c 100644
--- a/src/mscorlib/src/System/Enum.cs
+++ b/src/mscorlib/src/System/Enum.cs
@@ -69,7 +69,7 @@ namespace System
case CorElementType.U8:
return (*(ulong*)pValue).ToString("X16", null);
default:
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_UnknownEnumType"));
+ throw new InvalidOperationException(SR.InvalidOperation_UnknownEnumType);
}
}
}
@@ -103,7 +103,7 @@ namespace System
return ((UInt64)(Int64)value).ToString("X16", null);
// All unsigned types will be directly cast
default:
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_UnknownEnumType"));
+ throw new InvalidOperationException(SR.InvalidOperation_UnknownEnumType);
}
}
@@ -250,7 +250,7 @@ namespace System
break;
// All unsigned types will be directly cast
default:
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_UnknownEnumType"));
+ throw new InvalidOperationException(SR.InvalidOperation_UnknownEnumType);
}
return result;
@@ -316,20 +316,20 @@ namespace System
switch (m_failure)
{
case ParseFailureKind.Argument:
- return new ArgumentException(Environment.GetResourceString(m_failureMessageID));
+ return new ArgumentException(SR.GetResourceString(m_failureMessageID));
case ParseFailureKind.ArgumentNull:
return new ArgumentNullException(m_failureParameter);
case ParseFailureKind.ArgumentWithParameter:
- return new ArgumentException(Environment.GetResourceString(m_failureMessageID, m_failureMessageFormatArgument));
+ return new ArgumentException(SR.Format(SR.GetResourceString(m_failureMessageID), m_failureMessageFormatArgument));
case ParseFailureKind.UnhandledException:
return m_innerException;
default:
Debug.Assert(false, "Unknown EnumParseFailure: " + m_failure);
- return new ArgumentException(Environment.GetResourceString("Arg_EnumValueNotFound"));
+ return new ArgumentException(SR.Arg_EnumValueNotFound);
}
}
}
@@ -402,10 +402,10 @@ namespace System
RuntimeType rtType = enumType as RuntimeType;
if (rtType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(enumType));
if (!enumType.IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeEnum, nameof(enumType));
if (value == null)
{
@@ -624,7 +624,7 @@ namespace System
default:
// All unsigned types will be directly cast
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnumBaseTypeOrEnum"), nameof(value));
+ throw new ArgumentException(SR.Arg_MustBeEnumBaseTypeOrEnum, nameof(value));
}
}
@@ -644,7 +644,7 @@ namespace System
throw new ArgumentNullException(nameof(enumType));
if (!enumType.IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeEnum, nameof(enumType));
if (value == null)
throw new ArgumentNullException(nameof(value));
@@ -655,7 +655,7 @@ namespace System
RuntimeType rtType = enumType as RuntimeType;
if (rtType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(enumType));
// Check if both of them are of the same type
Type valueType = value.GetType();
@@ -666,29 +666,29 @@ namespace System
if (valueType.IsEnum)
{
if (!valueType.IsEquivalentTo(enumType))
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumAndObjectMustBeSameType", valueType.ToString(), enumType.ToString()));
+ throw new ArgumentException(SR.Format(SR.Arg_EnumAndObjectMustBeSameType, valueType.ToString(), enumType.ToString()));
if (format.Length != 1)
{
// all acceptable format string are of length 1
- throw new FormatException(Environment.GetResourceString("Format_InvalidEnumFormatSpecification"));
+ throw new FormatException(SR.Format_InvalidEnumFormatSpecification);
}
return ((Enum)value).ToString(format);
}
// The value must be of the same type as the Underlying type of the Enum
else if (valueType != underlyingType)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumFormatUnderlyingTypeAndObjectMustBeSameType", valueType.ToString(), underlyingType.ToString()));
+ throw new ArgumentException(SR.Format(SR.Arg_EnumFormatUnderlyingTypeAndObjectMustBeSameType, valueType.ToString(), underlyingType.ToString()));
}
if (format.Length != 1)
{
// all acceptable format string are of length 1
- throw new FormatException(Environment.GetResourceString("Format_InvalidEnumFormatSpecification"));
+ throw new FormatException(SR.Format_InvalidEnumFormatSpecification);
}
char formatCh = format[0];
if (formatCh == 'G' || formatCh == 'g')
- return GetEnumName(rtType, ToUInt64(value));
+ return GetEnumName(rtType, ToUInt64(value)) ?? value.ToString();
if (formatCh == 'D' || formatCh == 'd')
return value.ToString();
@@ -699,7 +699,7 @@ namespace System
if (formatCh == 'F' || formatCh == 'f')
return Enum.InternalFlagsFormat(rtType, ToUInt64(value)) ?? value.ToString();
- throw new FormatException(Environment.GetResourceString("Format_InvalidEnumFormatSpecification"));
+ throw new FormatException(SR.Format_InvalidEnumFormatSpecification);
}
#endregion
@@ -916,15 +916,14 @@ namespace System
Type thisType = this.GetType();
Type targetType = target.GetType();
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumAndObjectMustBeSameType",
- targetType.ToString(), thisType.ToString()));
+ throw new ArgumentException(SR.Format(SR.Arg_EnumAndObjectMustBeSameType, targetType.ToString(), thisType.ToString()));
}
else
{
// assert valid return code (3)
Debug.Assert(ret == retInvalidEnumType, "Enum.InternalCompareTo return code was invalid");
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_UnknownEnumType"));
+ throw new InvalidOperationException(SR.InvalidOperation_UnknownEnumType);
}
}
#endregion
@@ -936,7 +935,7 @@ namespace System
if (format == null || format.Length == 0)
formatCh = 'G';
else if (format.Length != 1)
- throw new FormatException(Environment.GetResourceString("Format_InvalidEnumFormatSpecification"));
+ throw new FormatException(SR.Format_InvalidEnumFormatSpecification);
else
formatCh = format[0];
@@ -952,7 +951,7 @@ namespace System
if (formatCh == 'F' || formatCh == 'f')
return InternalFlagsFormat((RuntimeType)GetType(), ToUInt64()) ?? GetValue().ToString();
- throw new FormatException(Environment.GetResourceString("Format_InvalidEnumFormatSpecification"));
+ throw new FormatException(SR.Format_InvalidEnumFormatSpecification);
}
[Obsolete("The provider argument is not used. Please use ToString().")]
@@ -969,7 +968,7 @@ namespace System
if (!this.GetType().IsEquivalentTo(flag.GetType()))
{
- throw new ArgumentException(Environment.GetResourceString("Argument_EnumTypeDoesNotMatch", flag.GetType(), this.GetType()));
+ throw new ArgumentException(SR.Format(SR.Argument_EnumTypeDoesNotMatch, flag.GetType(), this.GetType()));
}
return InternalHasFlag(flag);
@@ -1003,95 +1002,80 @@ namespace System
case CorElementType.U8:
return TypeCode.UInt64;
default:
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_UnknownEnumType"));
+ throw new InvalidOperationException(SR.InvalidOperation_UnknownEnumType);
}
}
- /// <internalonly/>
bool IConvertible.ToBoolean(IFormatProvider provider)
{
return Convert.ToBoolean(GetValue(), CultureInfo.CurrentCulture);
}
- /// <internalonly/>
char IConvertible.ToChar(IFormatProvider provider)
{
return Convert.ToChar(GetValue(), CultureInfo.CurrentCulture);
}
- /// <internalonly/>
sbyte IConvertible.ToSByte(IFormatProvider provider)
{
return Convert.ToSByte(GetValue(), CultureInfo.CurrentCulture);
}
- /// <internalonly/>
byte IConvertible.ToByte(IFormatProvider provider)
{
return Convert.ToByte(GetValue(), CultureInfo.CurrentCulture);
}
- /// <internalonly/>
short IConvertible.ToInt16(IFormatProvider provider)
{
return Convert.ToInt16(GetValue(), CultureInfo.CurrentCulture);
}
- /// <internalonly/>
ushort IConvertible.ToUInt16(IFormatProvider provider)
{
return Convert.ToUInt16(GetValue(), CultureInfo.CurrentCulture);
}
- /// <internalonly/>
int IConvertible.ToInt32(IFormatProvider provider)
{
return Convert.ToInt32(GetValue(), CultureInfo.CurrentCulture);
}
- /// <internalonly/>
uint IConvertible.ToUInt32(IFormatProvider provider)
{
return Convert.ToUInt32(GetValue(), CultureInfo.CurrentCulture);
}
- /// <internalonly/>
long IConvertible.ToInt64(IFormatProvider provider)
{
return Convert.ToInt64(GetValue(), CultureInfo.CurrentCulture);
}
- /// <internalonly/>
ulong IConvertible.ToUInt64(IFormatProvider provider)
{
return Convert.ToUInt64(GetValue(), CultureInfo.CurrentCulture);
}
- /// <internalonly/>
float IConvertible.ToSingle(IFormatProvider provider)
{
return Convert.ToSingle(GetValue(), CultureInfo.CurrentCulture);
}
- /// <internalonly/>
double IConvertible.ToDouble(IFormatProvider provider)
{
return Convert.ToDouble(GetValue(), CultureInfo.CurrentCulture);
}
- /// <internalonly/>
Decimal IConvertible.ToDecimal(IFormatProvider provider)
{
return Convert.ToDecimal(GetValue(), CultureInfo.CurrentCulture);
}
- /// <internalonly/>
DateTime IConvertible.ToDateTime(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "Enum", "DateTime"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Enum", "DateTime"));
}
- /// <internalonly/>
Object IConvertible.ToType(Type type, IFormatProvider provider)
{
return Convert.DefaultToType((IConvertible)this, type, provider);
@@ -1105,11 +1089,11 @@ namespace System
if (enumType == null)
throw new ArgumentNullException(nameof(enumType));
if (!enumType.IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeEnum, nameof(enumType));
Contract.EndContractBlock();
RuntimeType rtType = enumType as RuntimeType;
if (rtType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(enumType));
return InternalBoxEnum(rtType, value);
}
@@ -1118,11 +1102,11 @@ namespace System
if (enumType == null)
throw new ArgumentNullException(nameof(enumType));
if (!enumType.IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeEnum, nameof(enumType));
Contract.EndContractBlock();
RuntimeType rtType = enumType as RuntimeType;
if (rtType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(enumType));
return InternalBoxEnum(rtType, value);
}
@@ -1131,11 +1115,11 @@ namespace System
if (enumType == null)
throw new ArgumentNullException(nameof(enumType));
if (!enumType.IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeEnum, nameof(enumType));
Contract.EndContractBlock();
RuntimeType rtType = enumType as RuntimeType;
if (rtType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(enumType));
return InternalBoxEnum(rtType, value);
}
@@ -1144,11 +1128,11 @@ namespace System
if (enumType == null)
throw new ArgumentNullException(nameof(enumType));
if (!enumType.IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeEnum, nameof(enumType));
Contract.EndContractBlock();
RuntimeType rtType = enumType as RuntimeType;
if (rtType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(enumType));
return InternalBoxEnum(rtType, value);
}
@@ -1158,11 +1142,11 @@ namespace System
if (enumType == null)
throw new ArgumentNullException(nameof(enumType));
if (!enumType.IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeEnum, nameof(enumType));
Contract.EndContractBlock();
RuntimeType rtType = enumType as RuntimeType;
if (rtType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(enumType));
return InternalBoxEnum(rtType, value);
}
@@ -1172,11 +1156,11 @@ namespace System
if (enumType == null)
throw new ArgumentNullException(nameof(enumType));
if (!enumType.IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeEnum, nameof(enumType));
Contract.EndContractBlock();
RuntimeType rtType = enumType as RuntimeType;
if (rtType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(enumType));
return InternalBoxEnum(rtType, value);
}
@@ -1185,11 +1169,11 @@ namespace System
if (enumType == null)
throw new ArgumentNullException(nameof(enumType));
if (!enumType.IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeEnum, nameof(enumType));
Contract.EndContractBlock();
RuntimeType rtType = enumType as RuntimeType;
if (rtType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(enumType));
return InternalBoxEnum(rtType, value);
}
@@ -1199,11 +1183,11 @@ namespace System
if (enumType == null)
throw new ArgumentNullException(nameof(enumType));
if (!enumType.IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeEnum, nameof(enumType));
Contract.EndContractBlock();
RuntimeType rtType = enumType as RuntimeType;
if (rtType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(enumType));
return InternalBoxEnum(rtType, unchecked((long)value));
}
@@ -1212,11 +1196,11 @@ namespace System
if (enumType == null)
throw new ArgumentNullException(nameof(enumType));
if (!enumType.IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeEnum, nameof(enumType));
Contract.EndContractBlock();
RuntimeType rtType = enumType as RuntimeType;
if (rtType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(enumType));
return InternalBoxEnum(rtType, value);
}
@@ -1225,11 +1209,11 @@ namespace System
if (enumType == null)
throw new ArgumentNullException(nameof(enumType));
if (!enumType.IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeEnum, nameof(enumType));
Contract.EndContractBlock();
RuntimeType rtType = enumType as RuntimeType;
if (rtType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(enumType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(enumType));
return InternalBoxEnum(rtType, value ? 1 : 0);
}
#endregion
diff --git a/src/mscorlib/src/System/Environment.cs b/src/mscorlib/src/System/Environment.cs
index 9234dcc8aa..062e5d95d6 100644
--- a/src/mscorlib/src/System/Environment.cs
+++ b/src/mscorlib/src/System/Environment.cs
@@ -39,7 +39,7 @@ namespace System
Machine = 2,
}
- public static partial class Environment
+ internal static partial class Environment
{
// Assume the following constants include the terminating '\0' - use <, not <=
private const int MaxEnvVariableValueLength = 32767; // maximum length for environment variable name and value
@@ -50,132 +50,18 @@ namespace System
// that includes the contents of the environment variable.
private const int MaxSystemEnvVariableLength = 1024;
private const int MaxUserEnvVariableLength = 255;
+ private const int MaxMachineNameLength = 256;
- internal sealed class ResourceHelper
+ // Looks up the resource string value for key.
+ //
+ // if you change this method's signature then you must change the code that calls it
+ // in excep.cpp and probably you will have to visit mscorlib.h to add the new signature
+ // as well as metasig.h to create the new signature type
+ internal static String GetResourceStringLocal(String key)
{
- internal ResourceHelper(String name)
- {
- m_name = name;
- }
-
- private String m_name;
- private ResourceManager SystemResMgr;
-
- // To avoid infinite loops when calling GetResourceString. See comments
- // in GetResourceString for this field.
- private List<string> currentlyLoading;
-
- // process-wide state (since this is only used in one domain),
- // used to avoid the TypeInitialization infinite recusion
- // in GetResourceStringCode
- internal bool resourceManagerInited = false;
-
- // Is this thread currently doing infinite resource lookups?
- private int infinitelyRecursingCount;
-
- internal String GetResourceString(String key)
- {
- if (key == null || key.Length == 0)
- {
- Debug.Assert(false, "Environment::GetResourceString with null or empty key. Bug in caller, or weird recursive loading problem?");
- return "[Resource lookup failed - null or empty resource name]";
- }
-
- // We have a somewhat common potential for infinite
- // loops with mscorlib's ResourceManager. If "potentially dangerous"
- // code throws an exception, we will get into an infinite loop
- // inside the ResourceManager and this "potentially dangerous" code.
- // Potentially dangerous code includes the IO package, CultureInfo,
- // parts of the loader, some parts of Reflection, Security (including
- // custom user-written permissions that may parse an XML file at
- // class load time), assembly load event handlers, etc. Essentially,
- // this is not a bounded set of code, and we need to fix the problem.
- // Fortunately, this is limited to mscorlib's error lookups and is NOT
- // a general problem for all user code using the ResourceManager.
-
- // The solution is to make sure only one thread at a time can call
- // GetResourceString. Also, since resource lookups can be
- // reentrant, if the same thread comes into GetResourceString
- // twice looking for the exact same resource name before
- // returning, we're going into an infinite loop and we should
- // return a bogus string.
-
- bool lockTaken = false;
- try
- {
- Monitor.Enter(this, ref lockTaken);
-
- // Are we recursively looking up the same resource? Note - our backout code will set
- // the ResourceHelper's currentlyLoading stack to null if an exception occurs.
- if (currentlyLoading != null && currentlyLoading.Count > 0 && currentlyLoading.LastIndexOf(key) != -1)
- {
- // We can start infinitely recursing for one resource lookup,
- // then during our failure reporting, start infinitely recursing again.
- // avoid that.
- if (infinitelyRecursingCount > 0)
- {
- return "[Resource lookup failed - infinite recursion or critical failure detected.]";
- }
- infinitelyRecursingCount++;
-
- // Note: our infrastructure for reporting this exception will again cause resource lookup.
- // This is the most direct way of dealing with that problem.
- string message = $"Infinite recursion during resource lookup within {System.CoreLib.Name}. This may be a bug in {System.CoreLib.Name}, or potentially in certain extensibility points such as assembly resolve events or CultureInfo names. Resource name: {key}";
- Assert.Fail("[Recursive resource lookup bug]", message, Assert.COR_E_FAILFAST, System.Diagnostics.StackTrace.TraceFormat.NoResourceLookup);
- Environment.FailFast(message);
- }
- if (currentlyLoading == null)
- currentlyLoading = new List<string>();
-
- // Call class constructors preemptively, so that we cannot get into an infinite
- // loop constructing a TypeInitializationException. If this were omitted,
- // we could get the Infinite recursion assert above by failing type initialization
- // between the Push and Pop calls below.
- if (!resourceManagerInited)
- {
- RuntimeHelpers.RunClassConstructor(typeof(ResourceManager).TypeHandle);
- RuntimeHelpers.RunClassConstructor(typeof(ResourceReader).TypeHandle);
- RuntimeHelpers.RunClassConstructor(typeof(RuntimeResourceSet).TypeHandle);
- RuntimeHelpers.RunClassConstructor(typeof(BinaryReader).TypeHandle);
- resourceManagerInited = true;
- }
-
- currentlyLoading.Add(key); // Push
-
- if (SystemResMgr == null)
- {
- SystemResMgr = new ResourceManager(m_name, typeof(Object).Assembly);
- }
- string s = SystemResMgr.GetString(key, null);
- currentlyLoading.RemoveAt(currentlyLoading.Count - 1); // Pop
-
- Debug.Assert(s != null, "Managed resource string lookup failed. Was your resource name misspelled? Did you rebuild mscorlib after adding a resource to resources.txt? Debug this w/ cordbg and bug whoever owns the code that called Environment.GetResourceString. Resource name was: \"" + key + "\"");
- return s;
- }
- catch
- {
- if (lockTaken)
- {
- // Backout code - throw away potentially corrupt state
- SystemResMgr = null;
- currentlyLoading = null;
- }
- throw;
- }
- finally
- {
- if (lockTaken)
- {
- Monitor.Exit(this);
- }
- }
- }
+ return SR.GetResourceString(key);
}
- private static volatile ResourceHelper m_resHelper; // Doesn't need to be initialized as they're zero-init.
-
- private const int MaxMachineNameLength = 256;
-
// Private object for locking instead of locking on a public type for SQL reliability work.
private static Object s_InternalSyncObject;
private static Object InternalSyncObject
@@ -294,13 +180,6 @@ namespace System
return name;
}
- if (AppDomain.IsAppXModel() && !AppDomain.IsAppXDesignMode())
- {
- // Environment variable accessors are not approved modern API.
- // Behave as if no variables are defined in this case.
- return name;
- }
-
int currentSize = 100;
StringBuilder blob = new StringBuilder(currentSize); // A somewhat reasonable default size
@@ -347,27 +226,6 @@ namespace System
return blob.ToString();
}
- public static String MachineName
- {
- get
- {
- // UWP Debug scenarios
- if (AppDomain.IsAppXModel() && !AppDomain.IsAppXDesignMode())
- {
- // Getting Computer Name is not a supported scenario on Store apps.
- throw new PlatformNotSupportedException();
- }
-
- // In future release of operating systems, you might be able to rename a machine without
- // rebooting. Therefore, don't cache this machine name.
- StringBuilder buf = new StringBuilder(MaxMachineNameLength);
- int len = MaxMachineNameLength;
- if (Win32Native.GetComputerName(buf, ref len) == 0)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ComputerName"));
- return buf.ToString();
- }
- }
-
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
[SuppressUnmanagedCodeSecurity]
private static extern Int32 GetProcessorCount();
@@ -503,69 +361,38 @@ namespace System
}
}
- /*==================================OSVersion===================================
- **Action:
- **Returns:
- **Arguments:
- **Exceptions:
- ==============================================================================*/
- internal static OperatingSystem OSVersion
+#if !FEATURE_PAL
+ private static Lazy<bool> s_IsWindows8OrAbove = new Lazy<bool>(() =>
{
- get
- {
- Contract.Ensures(Contract.Result<OperatingSystem>() != null);
-
- if (m_os == null)
- { // We avoid the lock since we don't care if two threads will set this at the same time.
- Microsoft.Win32.Win32Native.OSVERSIONINFO osvi = new Microsoft.Win32.Win32Native.OSVERSIONINFO();
- if (!GetVersion(osvi))
- {
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_GetVersion"));
- }
-
- Microsoft.Win32.Win32Native.OSVERSIONINFOEX osviEx = new Microsoft.Win32.Win32Native.OSVERSIONINFOEX();
- if (!GetVersionEx(osviEx))
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_GetVersion"));
-
-#if PLATFORM_UNIX
- PlatformID id = PlatformID.Unix;
-#else
- PlatformID id = PlatformID.Win32NT;
-#endif // PLATFORM_UNIX
-
- Version v = new Version(osvi.MajorVersion, osvi.MinorVersion, osvi.BuildNumber, (osviEx.ServicePackMajor << 16) | osviEx.ServicePackMinor);
- m_os = new OperatingSystem(id, v, osvi.CSDVersion);
- }
- Debug.Assert(m_os != null, "m_os != null");
- return m_os;
- }
- }
-
-
- internal static bool IsWindows8OrAbove
- {
- get
- {
- return true;
- }
- }
+ ulong conditionMask = Win32Native.VerSetConditionMask(0, Win32Native.VER_MAJORVERSION, Win32Native.VER_GREATER_EQUAL);
+ conditionMask = Win32Native.VerSetConditionMask(conditionMask, Win32Native.VER_MINORVERSION, Win32Native.VER_GREATER_EQUAL);
+ conditionMask = Win32Native.VerSetConditionMask(conditionMask, Win32Native.VER_SERVICEPACKMAJOR, Win32Native.VER_GREATER_EQUAL);
+ conditionMask = Win32Native.VerSetConditionMask(conditionMask, Win32Native.VER_SERVICEPACKMINOR, Win32Native.VER_GREATER_EQUAL);
+ // Windows 8 version is 6.2
+ var version = new Win32Native.OSVERSIONINFOEX { MajorVersion = 6, MinorVersion = 2, ServicePackMajor = 0, ServicePackMinor = 0 };
+
+ return Win32Native.VerifyVersionInfoW(version,
+ Win32Native.VER_MAJORVERSION | Win32Native.VER_MINORVERSION | Win32Native.VER_SERVICEPACKMAJOR | Win32Native.VER_SERVICEPACKMINOR,
+ conditionMask);
+ });
+ internal static bool IsWindows8OrAbove => s_IsWindows8OrAbove.Value;
+#endif
+
#if FEATURE_COMINTEROP
- internal static bool IsWinRTSupported
+ // Does the current version of Windows have Windows Runtime suppport?
+ private static Lazy<bool> s_IsWinRTSupported = new Lazy<bool>(() =>
{
- get
- {
- return true;
- }
- }
-#endif // FEATURE_COMINTEROP
+ return WinRTSupported();
+ });
+ internal static bool IsWinRTSupported => s_IsWinRTSupported.Value;
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern bool GetVersion(Microsoft.Win32.Win32Native.OSVERSIONINFO osVer);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern bool GetVersionEx(Microsoft.Win32.Win32Native.OSVERSIONINFOEX osVer);
+ [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
+ [SuppressUnmanagedCodeSecurity]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ private static extern bool WinRTSupported();
+#endif // FEATURE_COMINTEROP
/*==================================StackTrace==================================
@@ -580,7 +407,7 @@ namespace System
get
{
Contract.Ensures(Contract.Result<String>() != null);
- return global::Internal.Runtime.Augments.EnvironmentAugments.StackTrace;
+ return Internal.Runtime.Augments.EnvironmentAugments.StackTrace;
}
}
@@ -600,94 +427,6 @@ namespace System
return st.ToString(System.Diagnostics.StackTrace.TraceFormat.Normal);
}
- private static void InitResourceHelper()
- {
- // Only the default AppDomain should have a ResourceHelper. All calls to
- // GetResourceString from any AppDomain delegate to GetResourceStringLocal
- // in the default AppDomain via the fcall GetResourceFromDefault.
-
- bool tookLock = false;
- RuntimeHelpers.PrepareConstrainedRegions();
- try
- {
- Monitor.Enter(Environment.InternalSyncObject, ref tookLock);
-
- if (m_resHelper == null)
- {
- ResourceHelper rh = new ResourceHelper(System.CoreLib.Name);
-
- System.Threading.Thread.MemoryBarrier();
- m_resHelper = rh;
- }
- }
- finally
- {
- if (tookLock)
- Monitor.Exit(Environment.InternalSyncObject);
- }
- }
-
- // Looks up the resource string value for key.
- //
- // if you change this method's signature then you must change the code that calls it
- // in excep.cpp and probably you will have to visit mscorlib.h to add the new signature
- // as well as metasig.h to create the new signature type
- internal static String GetResourceStringLocal(String key)
- {
- if (m_resHelper == null)
- InitResourceHelper();
-
- return m_resHelper.GetResourceString(key);
- }
-
- internal static String GetResourceString(String key)
- {
- return GetResourceStringLocal(key);
- }
-
- // The reason the following overloads exist are to reduce code bloat.
- // Since GetResourceString is basically only called when exceptions are
- // thrown, we want the code size to be as small as possible.
- // Using the params object[] overload works against this since the
- // initialization of the array is done inline in the caller at the IL
- // level. So we have overloads that simply wrap the params one.
-
- [MethodImpl(MethodImplOptions.NoInlining)]
- internal static string GetResourceString(string key, object val0)
- {
- return GetResourceStringFormatted(key, new object[] { val0 });
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
- internal static string GetResourceString(string key, object val0, object val1)
- {
- return GetResourceStringFormatted(key, new object[] { val0, val1 });
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
- internal static string GetResourceString(string key, object val0, object val1, object val2)
- {
- return GetResourceStringFormatted(key, new object[] { val0, val1, val2 });
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
- internal static string GetResourceString(string key, object val0, object val1, object val2, object val3)
- {
- return GetResourceStringFormatted(key, new object[] { val0, val1, val2, val3 });
- }
-
- [MethodImpl(MethodImplOptions.NoInlining)]
- internal static String GetResourceString(string key, params object[] values)
- {
- return GetResourceStringFormatted(key, values);
- }
-
- private static String GetResourceStringFormatted(string key, params object[] values)
- {
- string rs = GetResourceString(key);
- return String.Format(CultureInfo.CurrentCulture, rs, values);
- }
-
public static extern bool HasShutdownStarted
{
[MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -820,19 +559,19 @@ namespace System
}
if (variable.Length == 0)
{
- throw new ArgumentException(GetResourceString("Argument_StringZeroLength"), nameof(variable));
+ throw new ArgumentException(SR.Argument_StringZeroLength, nameof(variable));
}
if (variable[0] == '\0')
{
- throw new ArgumentException(GetResourceString("Argument_StringFirstCharIsZero"), nameof(variable));
+ throw new ArgumentException(SR.Argument_StringFirstCharIsZero, nameof(variable));
}
if (variable.Length >= MaxEnvVariableValueLength)
{
- throw new ArgumentException(GetResourceString("Argument_LongEnvVarValue"), nameof(variable));
+ throw new ArgumentException(SR.Argument_LongEnvVarValue, nameof(variable));
}
if (variable.IndexOf('=') != -1)
{
- throw new ArgumentException(GetResourceString("Argument_IllegalEnvVarName"), nameof(variable));
+ throw new ArgumentException(SR.Argument_IllegalEnvVarName, nameof(variable));
}
if (string.IsNullOrEmpty(value) || value[0] == '\0')
@@ -842,7 +581,7 @@ namespace System
}
else if (value.Length >= MaxEnvVariableValueLength)
{
- throw new ArgumentException(GetResourceString("Argument_LongEnvVarValue"), nameof(value));
+ throw new ArgumentException(SR.Argument_LongEnvVarValue, nameof(value));
}
}
@@ -852,7 +591,7 @@ namespace System
target != EnvironmentVariableTarget.Machine &&
target != EnvironmentVariableTarget.User)
{
- throw new ArgumentOutOfRangeException(nameof(target), target, SR.Format(GetResourceString("Arg_EnumIllegalVal"), target));
+ throw new ArgumentOutOfRangeException(nameof(target), target, SR.Format(SR.Arg_EnumIllegalVal, target));
}
}
@@ -903,13 +642,6 @@ namespace System
private static string GetEnvironmentVariableCore(string variable)
{
- if (AppDomain.IsAppXModel() && !AppDomain.IsAppXDesignMode())
- {
- // Environment variable accessors are not approved modern API.
- // Behave as if the variable was not found in this case.
- return null;
- }
-
StringBuilder sb = StringBuilderCache.Acquire(128); // A somewhat reasonable default size
int requiredSize = Win32Native.GetEnvironmentVariable(variable, sb, sb.Capacity);
@@ -953,7 +685,7 @@ namespace System
}
else
{
- throw new ArgumentException(GetResourceString("Arg_EnumIllegalVal", (int)target));
+ throw new ArgumentException(SR.Format(SR.Arg_EnumIllegalVal, (int)target));
}
using (RegistryKey environmentKey = baseKey.OpenSubKey(keyName, writable: false))
@@ -965,13 +697,6 @@ namespace System
private static IDictionary GetEnvironmentVariablesCore()
{
- if (AppDomain.IsAppXModel() && !AppDomain.IsAppXDesignMode())
- {
- // Environment variable accessors are not approved modern API.
- // Behave as if no environment variables are defined in this case.
- return new Dictionary<string, string>(0);
- }
-
return GetRawEnvironmentVariables();
}
@@ -999,7 +724,7 @@ namespace System
}
else
{
- throw new ArgumentException(GetResourceString("Arg_EnumIllegalVal", (int)target));
+ throw new ArgumentException(SR.Format(SR.Arg_EnumIllegalVal, (int)target));
}
using (RegistryKey environmentKey = baseKey.OpenSubKey(keyName, writable: false))
@@ -1023,13 +748,6 @@ namespace System
if (string.IsNullOrEmpty(value) || value[0] == '\0')
value = null;
- if (AppDomain.IsAppXModel() && !AppDomain.IsAppXDesignMode())
- {
- // Environment variable accessors are not approved modern API.
- // so we throw PlatformNotSupportedException.
- throw new PlatformNotSupportedException();
- }
-
if (!Win32Native.SetEnvironmentVariable(variable, value))
{
int errorCode = Marshal.GetLastWin32Error();
@@ -1042,7 +760,7 @@ namespace System
case Win32Native.ERROR_FILENAME_EXCED_RANGE:
// The error message from Win32 is "The filename or extension is too long",
// which is not accurate.
- throw new ArgumentException(GetResourceString("Argument_LongEnvVarValue"));
+ throw new ArgumentException(SR.Format(SR.Argument_LongEnvVarValue));
default:
throw new ArgumentException(Win32Native.GetMessage(errorCode));
}
@@ -1081,7 +799,7 @@ namespace System
const int MaxUserEnvVariableLength = 255;
if (variable.Length >= MaxUserEnvVariableLength)
{
- throw new ArgumentException(GetResourceString("Argument_LongEnvVarValue"), nameof(variable));
+ throw new ArgumentException(SR.Argument_LongEnvVarValue, nameof(variable));
}
baseKey = Registry.CurrentUser;
@@ -1089,7 +807,7 @@ namespace System
}
else
{
- throw new ArgumentException(GetResourceString("Arg_EnumIllegalVal", (int)target));
+ throw new ArgumentException(SR.Format(SR.Arg_EnumIllegalVal, (int)target));
}
using (RegistryKey environmentKey = baseKey.OpenSubKey(keyName, writable: true))
diff --git a/src/mscorlib/src/System/Exception.cs b/src/mscorlib/src/System/Exception.cs
index 6036063ca6..61e8a4175d 100644
--- a/src/mscorlib/src/System/Exception.cs
+++ b/src/mscorlib/src/System/Exception.cs
@@ -98,7 +98,7 @@ namespace System
if (_className == null || HResult == 0)
- throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientState"));
+ throw new SerializationException(SR.Serialization_InsufficientState);
// If we are constructing a new exception after a cross-appdomain call...
if (context.State == StreamingContextStates.CrossAppDomain)
@@ -130,7 +130,7 @@ namespace System
{
_className = GetClassName();
}
- return Environment.GetResourceString("Exception_WasThrown", _className);
+ return SR.Format(SR.Exception_WasThrown, _className);
}
else
{
@@ -388,7 +388,7 @@ namespace System
if (moduleBuilder != null)
rtModule = moduleBuilder.InternalModule;
else
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeReflectionObject"));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeReflectionObject);
}
_source = rtModule.GetRuntimeAssembly().GetSimpleName();
@@ -422,7 +422,7 @@ namespace System
if (_innerException != null)
{
s = s + " ---> " + _innerException.ToString(needFileLineInfo, needMessage) + Environment.NewLine +
- " " + Environment.GetResourceString("Exception_EndOfInnerExceptionStack");
+ " " + SR.Exception_EndOfInnerExceptionStack;
}
string stackTrace = GetStackTrace(needFileLineInfo);
@@ -520,8 +520,8 @@ namespace System
protected event EventHandler<SafeSerializationEventArgs> SerializeObjectState
{
- add { throw new PlatformNotSupportedException(); }
- remove { throw new PlatformNotSupportedException(); }
+ add { throw new PlatformNotSupportedException(SR.PlatformNotSupported_SecureBinarySerialization); }
+ remove { throw new PlatformNotSupportedException(SR.PlatformNotSupported_SecureBinarySerialization); }
}
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
diff --git a/src/mscorlib/src/System/GC.cs b/src/mscorlib/src/System/GC.cs
index 347bc3f511..aeb0ca5196 100644
--- a/src/mscorlib/src/System/GC.cs
+++ b/src/mscorlib/src/System/GC.cs
@@ -114,13 +114,13 @@ namespace System
if (bytesAllocated <= 0)
{
throw new ArgumentOutOfRangeException(nameof(bytesAllocated),
- Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum"));
+ SR.ArgumentOutOfRange_NeedPosNum);
}
if ((4 == IntPtr.Size) && (bytesAllocated > Int32.MaxValue))
{
throw new ArgumentOutOfRangeException("pressure",
- Environment.GetResourceString("ArgumentOutOfRange_MustBeNonNegInt32"));
+ SR.ArgumentOutOfRange_MustBeNonNegInt32);
}
Contract.EndContractBlock();
@@ -132,13 +132,13 @@ namespace System
if (bytesAllocated <= 0)
{
throw new ArgumentOutOfRangeException(nameof(bytesAllocated),
- Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum"));
+ SR.ArgumentOutOfRange_NeedPosNum);
}
if ((4 == IntPtr.Size) && (bytesAllocated > Int32.MaxValue))
{
throw new ArgumentOutOfRangeException(nameof(bytesAllocated),
- Environment.GetResourceString("ArgumentOutOfRange_MustBeNonNegInt32"));
+ SR.ArgumentOutOfRange_MustBeNonNegInt32);
}
Contract.EndContractBlock();
@@ -181,12 +181,12 @@ namespace System
{
if (generation < 0)
{
- throw new ArgumentOutOfRangeException(nameof(generation), Environment.GetResourceString("ArgumentOutOfRange_GenericPositive"));
+ throw new ArgumentOutOfRangeException(nameof(generation), SR.ArgumentOutOfRange_GenericPositive);
}
if ((mode < GCCollectionMode.Default) || (mode > GCCollectionMode.Optimized))
{
- throw new ArgumentOutOfRangeException(nameof(mode), Environment.GetResourceString("ArgumentOutOfRange_Enum"));
+ throw new ArgumentOutOfRangeException(nameof(mode), SR.ArgumentOutOfRange_Enum);
}
Contract.EndContractBlock();
@@ -217,7 +217,7 @@ namespace System
{
if (generation < 0)
{
- throw new ArgumentOutOfRangeException(nameof(generation), Environment.GetResourceString("ArgumentOutOfRange_GenericPositive"));
+ throw new ArgumentOutOfRangeException(nameof(generation), SR.ArgumentOutOfRange_GenericPositive);
}
Contract.EndContractBlock();
return _CollectionCount(generation, 0);
@@ -372,7 +372,7 @@ namespace System
throw new ArgumentOutOfRangeException(nameof(maxGenerationThreshold),
String.Format(
CultureInfo.CurrentCulture,
- Environment.GetResourceString("ArgumentOutOfRange_Bounds_Lower_Upper"),
+ SR.ArgumentOutOfRange_Bounds_Lower_Upper,
1,
99));
}
@@ -382,14 +382,14 @@ namespace System
throw new ArgumentOutOfRangeException(nameof(largeObjectHeapThreshold),
String.Format(
CultureInfo.CurrentCulture,
- Environment.GetResourceString("ArgumentOutOfRange_Bounds_Lower_Upper"),
+ SR.ArgumentOutOfRange_Bounds_Lower_Upper,
1,
99));
}
if (!_RegisterForFullGCNotification(maxGenerationThreshold, largeObjectHeapThreshold))
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotWithConcurrentGC"));
+ throw new InvalidOperationException(SR.InvalidOperation_NotWithConcurrentGC);
}
}
@@ -397,7 +397,7 @@ namespace System
{
if (!_CancelFullGCNotification())
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotWithConcurrentGC"));
+ throw new InvalidOperationException(SR.InvalidOperation_NotWithConcurrentGC);
}
}
@@ -409,7 +409,7 @@ namespace System
public static GCNotificationStatus WaitForFullGCApproach(int millisecondsTimeout)
{
if (millisecondsTimeout < -1)
- throw new ArgumentOutOfRangeException(nameof(millisecondsTimeout), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(millisecondsTimeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
return (GCNotificationStatus)_WaitForFullGCApproach(millisecondsTimeout);
}
@@ -422,7 +422,7 @@ namespace System
public static GCNotificationStatus WaitForFullGCComplete(int millisecondsTimeout)
{
if (millisecondsTimeout < -1)
- throw new ArgumentOutOfRangeException(nameof(millisecondsTimeout), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(millisecondsTimeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
return (GCNotificationStatus)_WaitForFullGCComplete(millisecondsTimeout);
}
diff --git a/src/mscorlib/src/System/Globalization/Calendar.cs b/src/mscorlib/src/System/Globalization/Calendar.cs
index 422b72a46b..c23e1088c1 100644
--- a/src/mscorlib/src/System/Globalization/Calendar.cs
+++ b/src/mscorlib/src/System/Globalization/Calendar.cs
@@ -839,7 +839,7 @@ namespace System.Globalization
CultureInfo.InvariantCulture,
SR.Format(SR.ArgumentOutOfRange_Range, 0, MillisPerSecond - 1)));
}
- return InternalGloablizationHelper.TimeToTicks(hour, minute, second) + millisecond * TicksPerMillisecond;
+ return InternalGlobalizationHelper.TimeToTicks(hour, minute, second) + millisecond * TicksPerMillisecond;
}
throw new ArgumentOutOfRangeException(null, SR.ArgumentOutOfRange_BadHourMinuteSecond);
}
diff --git a/src/mscorlib/src/System/Globalization/CalendarData.Unix.cs b/src/mscorlib/src/System/Globalization/CalendarData.Unix.cs
index 19c81f17b0..319f66ae8c 100644
--- a/src/mscorlib/src/System/Globalization/CalendarData.Unix.cs
+++ b/src/mscorlib/src/System/Globalization/CalendarData.Unix.cs
@@ -66,6 +66,8 @@ namespace System.Globalization
// Call native side to figure out which calendars are allowed
internal static int GetCalendars(string localeName, bool useUserOverride, CalendarId[] calendars)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
// NOTE: there are no 'user overrides' on Linux
int count = Interop.GlobalizationInterop.GetCalendars(localeName, calendars, calendars.Length);
@@ -88,6 +90,8 @@ namespace System.Globalization
private static bool GetCalendarInfo(string localeName, CalendarId calendarId, CalendarDataType dataType, out string calendarString)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
return Interop.CallStringMethod(
(locale, calId, type, stringBuilder) =>
Interop.GlobalizationInterop.GetCalendarInfo(
diff --git a/src/mscorlib/src/System/Globalization/CalendarData.Windows.cs b/src/mscorlib/src/System/Globalization/CalendarData.Windows.cs
index 4565dffe23..51a2727c7d 100644
--- a/src/mscorlib/src/System/Globalization/CalendarData.Windows.cs
+++ b/src/mscorlib/src/System/Globalization/CalendarData.Windows.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
+using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Diagnostics.Contracts;
@@ -22,6 +23,8 @@ namespace System.Globalization
{
private bool LoadCalendarDataFromSystem(String localeName, CalendarId calendarId)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
bool ret = true;
uint useOverrides = this.bUseUserOverrides ? 0 : CAL_NOUSEROVERRIDE;
@@ -116,6 +119,11 @@ namespace System.Globalization
// Get native two digit year max
internal static int GetTwoDigitYearMax(CalendarId calendarId)
{
+ if (GlobalizationMode.Invariant)
+ {
+ return Invariant.iTwoDigitYearMax;
+ }
+
int twoDigitYearMax = -1;
if (!CallGetCalendarInfoEx(null, calendarId, (uint)CAL_ITWODIGITYEARMAX, out twoDigitYearMax))
@@ -129,6 +137,8 @@ namespace System.Globalization
// Call native side to figure out which calendars are allowed
internal static int GetCalendars(String localeName, bool useUserOverride, CalendarId[] calendars)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
EnumCalendarsData data = new EnumCalendarsData();
data.userOverride = 0;
data.calendars = new IntList();
@@ -173,6 +183,8 @@ namespace System.Globalization
private static bool SystemSupportsTaiwaneseCalendar()
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
string data;
// Taiwanese calendar get listed as one of the optional zh-TW calendars only when having zh-TW UI
return CallGetCalendarInfoEx("zh-TW", CalendarId.TAIWAN, CAL_SCALNAME, out data);
@@ -474,6 +486,8 @@ namespace System.Globalization
private static unsafe String GetUserDefaultLocaleName()
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
const int LOCALE_NAME_MAX_LENGTH = 85;
const uint LOCALE_SNAME = 0x0000005c;
const string LOCALE_NAME_USER_DEFAULT = null;
diff --git a/src/mscorlib/src/System/Globalization/CalendarData.cs b/src/mscorlib/src/System/Globalization/CalendarData.cs
index 3a1e827906..0991149e07 100644
--- a/src/mscorlib/src/System/Globalization/CalendarData.cs
+++ b/src/mscorlib/src/System/Globalization/CalendarData.cs
@@ -101,6 +101,8 @@ namespace System.Globalization
{
this.bUseUserOverrides = bUseUserOverrides;
+ Debug.Assert(!GlobalizationMode.Invariant);
+
if (!LoadCalendarDataFromSystem(localeName, calendarId))
{
Debug.Assert(false, "[CalendarData] LoadCalendarDataFromSystem call isn't expected to fail for calendar " + calendarId + " locale " + localeName);
diff --git a/src/mscorlib/src/System/Globalization/CompareInfo.Invariant.cs b/src/mscorlib/src/System/Globalization/CompareInfo.Invariant.cs
new file mode 100644
index 0000000000..2a20de76bb
--- /dev/null
+++ b/src/mscorlib/src/System/Globalization/CompareInfo.Invariant.cs
@@ -0,0 +1,238 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Diagnostics;
+using System.Diagnostics.Contracts;
+
+namespace System.Globalization
+{
+ public partial class CompareInfo
+ {
+ internal static unsafe int InvariantIndexOf(string source, string value, int startIndex, int count, bool ignoreCase)
+ {
+ Debug.Assert(source != null);
+ Debug.Assert(value != null);
+ Debug.Assert(startIndex >= 0 && startIndex < source.Length);
+
+ fixed (char* pSource = source) fixed (char* pValue = value)
+ {
+ char* pSrc = &pSource[startIndex];
+ int index = InvariantFindString(pSrc, count, pValue, value.Length, ignoreCase, start : true);
+ if (index >= 0)
+ {
+ return index + startIndex;
+ }
+ return -1;
+ }
+ }
+
+ internal static unsafe int InvariantLastIndexOf(string source, string value, int startIndex, int count, bool ignoreCase)
+ {
+ Debug.Assert(source != null);
+ Debug.Assert(value != null);
+ Debug.Assert(startIndex >= 0 && startIndex < source.Length);
+
+ fixed (char* pSource = source) fixed (char* pValue = value)
+ {
+ char* pSrc = &pSource[startIndex - count + 1];
+ int index = InvariantFindString(pSrc, count, pValue, value.Length, ignoreCase, start : false);
+ if (index >= 0)
+ {
+ return index + startIndex - count + 1;
+ }
+ return -1;
+ }
+ }
+
+ private static unsafe int InvariantFindString(char* source, int sourceCount, char* value, int valueCount, bool ignoreCase, bool start)
+ {
+ int ctrSource = 0; // index value into source
+ int ctrValue = 0; // index value into value
+ char sourceChar; // Character for case lookup in source
+ char valueChar; // Character for case lookup in value
+ int lastSourceStart;
+
+ Debug.Assert(source != null);
+ Debug.Assert(value != null);
+ Debug.Assert(sourceCount >= 0);
+ Debug.Assert(valueCount >= 0);
+
+ if (valueCount == 0)
+ {
+ return start ? 0 : sourceCount - 1;
+ }
+
+ if (sourceCount < valueCount)
+ {
+ return -1;
+ }
+
+ if (start)
+ {
+ lastSourceStart = sourceCount - valueCount;
+ if (ignoreCase)
+ {
+ char firstValueChar = InvariantToUpper(value[0]);
+ for (ctrSource = 0; ctrSource <= lastSourceStart; ctrSource++)
+ {
+ sourceChar = InvariantToUpper(source[ctrSource]);
+ if (sourceChar != firstValueChar)
+ {
+ continue;
+ }
+
+ for (ctrValue = 1; ctrValue < valueCount; ctrValue++)
+ {
+ sourceChar = InvariantToUpper(source[ctrSource + ctrValue]);
+ valueChar = InvariantToUpper(value[ctrValue]);
+
+ if (sourceChar != valueChar)
+ {
+ break;
+ }
+ }
+
+ if (ctrValue == valueCount)
+ {
+ return ctrSource;
+ }
+ }
+ }
+ else
+ {
+ char firstValueChar = value[0];
+ for (ctrSource = 0; ctrSource <= lastSourceStart; ctrSource++)
+ {
+ sourceChar = source[ctrSource];
+ if (sourceChar != firstValueChar)
+ {
+ continue;
+ }
+
+ for (ctrValue = 1; ctrValue < valueCount; ctrValue++)
+ {
+ sourceChar = source[ctrSource + ctrValue];
+ valueChar = value[ctrValue];
+
+ if (sourceChar != valueChar)
+ {
+ break;
+ }
+ }
+
+ if (ctrValue == valueCount)
+ {
+ return ctrSource;
+ }
+ }
+ }
+ }
+ else
+ {
+ lastSourceStart = sourceCount - valueCount;
+ if (ignoreCase)
+ {
+ char firstValueChar = InvariantToUpper(value[0]);
+ for (ctrSource = lastSourceStart; ctrSource >= 0; ctrSource--)
+ {
+ sourceChar = InvariantToUpper(source[ctrSource]);
+ if (sourceChar != firstValueChar)
+ {
+ continue;
+ }
+ for (ctrValue = 1; ctrValue < valueCount; ctrValue++)
+ {
+ sourceChar = InvariantToUpper(source[ctrSource + ctrValue]);
+ valueChar = InvariantToUpper(value[ctrValue]);
+
+ if (sourceChar != valueChar)
+ {
+ break;
+ }
+ }
+
+ if (ctrValue == valueCount)
+ {
+ return ctrSource;
+ }
+ }
+ }
+ else
+ {
+ char firstValueChar = value[0];
+ for (ctrSource = lastSourceStart; ctrSource >= 0; ctrSource--)
+ {
+ sourceChar = source[ctrSource];
+ if (sourceChar != firstValueChar)
+ {
+ continue;
+ }
+
+ for (ctrValue = 1; ctrValue < valueCount; ctrValue++)
+ {
+ sourceChar = source[ctrSource + ctrValue];
+ valueChar = value[ctrValue];
+
+ if (sourceChar != valueChar)
+ {
+ break;
+ }
+ }
+
+ if (ctrValue == valueCount)
+ {
+ return ctrSource;
+ }
+ }
+ }
+ }
+
+ return -1;
+ }
+
+ private static char InvariantToUpper(char c)
+ {
+ return (uint)(c - 'a') <= (uint)('z' - 'a') ? (char)(c - 0x20) : c;
+ }
+
+ private unsafe SortKey InvariantCreateSortKey(string source, CompareOptions options)
+ {
+ if (source == null) { throw new ArgumentNullException(nameof(source)); }
+ Contract.EndContractBlock();
+
+ if ((options & ValidSortkeyCtorMaskOffFlags) != 0)
+ {
+ throw new ArgumentException(SR.Argument_InvalidFlag, nameof(options));
+ }
+
+ byte [] keyData;
+ if (source.Length == 0)
+ {
+ keyData = Array.Empty<byte>();
+ }
+ else
+ {
+ // In the invariant mode, all string comparisons are done as ordinal so when generating the sort keys we generate it according to this fact
+ keyData = new byte[source.Length * sizeof(char)];
+
+ fixed (char* pChar = source) fixed (byte* pByte = keyData)
+ {
+ if ((options & (CompareOptions.IgnoreCase | CompareOptions.OrdinalIgnoreCase)) != 0)
+ {
+ short *pShort = (short *) pByte;
+ for (int i=0; i<source.Length; i++)
+ {
+ pShort[i] = (short) InvariantToUpper(source[i]);
+ }
+ }
+ else
+ {
+ Buffer.MemoryCopy(pChar, pByte, keyData.Length, keyData.Length);
+ }
+ }
+ }
+ return new SortKey(Name, source, options, keyData);
+ }
+ }
+}
diff --git a/src/mscorlib/src/System/Globalization/CompareInfo.Unix.cs b/src/mscorlib/src/System/Globalization/CompareInfo.Unix.cs
index 4cb1d262e9..09b871f1c5 100644
--- a/src/mscorlib/src/System/Globalization/CompareInfo.Unix.cs
+++ b/src/mscorlib/src/System/Globalization/CompareInfo.Unix.cs
@@ -18,30 +18,34 @@ namespace System.Globalization
[NonSerialized]
private bool _isAsciiEqualityOrdinal;
- internal CompareInfo(CultureInfo culture)
- {
- _name = culture._name;
- InitSort(culture);
- }
-
private void InitSort(CultureInfo culture)
{
_sortName = culture.SortName;
- Interop.GlobalizationInterop.ResultCode resultCode = Interop.GlobalizationInterop.GetSortHandle(GetNullTerminatedUtf8String(_sortName), out _sortHandle);
- if (resultCode != Interop.GlobalizationInterop.ResultCode.Success)
+
+ if (_invariantMode)
{
- _sortHandle.Dispose();
-
- if (resultCode == Interop.GlobalizationInterop.ResultCode.OutOfMemory)
- throw new OutOfMemoryException();
-
- throw new ExternalException(SR.Arg_ExternalException);
+ _isAsciiEqualityOrdinal = true;
+ }
+ else
+ {
+ Interop.GlobalizationInterop.ResultCode resultCode = Interop.GlobalizationInterop.GetSortHandle(GetNullTerminatedUtf8String(_sortName), out _sortHandle);
+ if (resultCode != Interop.GlobalizationInterop.ResultCode.Success)
+ {
+ _sortHandle.Dispose();
+
+ if (resultCode == Interop.GlobalizationInterop.ResultCode.OutOfMemory)
+ throw new OutOfMemoryException();
+
+ throw new ExternalException(SR.Arg_ExternalException);
+ }
+ _isAsciiEqualityOrdinal = (_sortName == "en-US" || _sortName == "");
}
- _isAsciiEqualityOrdinal = (_sortName == "en-US" || _sortName == "");
}
- internal static unsafe int IndexOfOrdinal(string source, string value, int startIndex, int count, bool ignoreCase)
+ internal static unsafe int IndexOfOrdinalCore(string source, string value, int startIndex, int count, bool ignoreCase)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
Debug.Assert(source != null);
Debug.Assert(value != null);
@@ -84,8 +88,10 @@ namespace System.Globalization
return -1;
}
- internal static unsafe int LastIndexOfOrdinal(string source, string value, int startIndex, int count, bool ignoreCase)
+ internal static unsafe int LastIndexOfOrdinalCore(string source, string value, int startIndex, int count, bool ignoreCase)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
Debug.Assert(source != null);
Debug.Assert(value != null);
@@ -141,11 +147,15 @@ namespace System.Globalization
private static unsafe int CompareStringOrdinalIgnoreCase(char* string1, int count1, char* string2, int count2)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
return Interop.GlobalizationInterop.CompareStringOrdinalIgnoreCase(string1, count1, string2, count2);
}
private unsafe int CompareString(string string1, int offset1, int length1, string string2, int offset2, int length2, CompareOptions options)
{
+ Debug.Assert(!_invariantMode);
+
Debug.Assert(string1 != null);
Debug.Assert(string2 != null);
Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
@@ -161,6 +171,8 @@ namespace System.Globalization
internal unsafe int IndexOfCore(string source, string target, int startIndex, int count, CompareOptions options, int* matchLengthPtr)
{
+ Debug.Assert(!_invariantMode);
+
Debug.Assert(!string.IsNullOrEmpty(source));
Debug.Assert(target != null);
Debug.Assert((options & CompareOptions.OrdinalIgnoreCase) == 0);
@@ -206,6 +218,8 @@ namespace System.Globalization
private unsafe int LastIndexOfCore(string source, string target, int startIndex, int count, CompareOptions options)
{
+ Debug.Assert(!_invariantMode);
+
Debug.Assert(!string.IsNullOrEmpty(source));
Debug.Assert(target != null);
Debug.Assert((options & CompareOptions.OrdinalIgnoreCase) == 0);
@@ -217,7 +231,7 @@ namespace System.Globalization
if (options == CompareOptions.Ordinal)
{
- return LastIndexOfOrdinal(source, target, startIndex, count, ignoreCase: false);
+ return LastIndexOfOrdinalCore(source, target, startIndex, count, ignoreCase: false);
}
if (_isAsciiEqualityOrdinal && CanUseAsciiOrdinalForOptions(options) && source.IsFastSort() && target.IsFastSort())
@@ -239,6 +253,8 @@ namespace System.Globalization
private bool StartsWith(string source, string prefix, CompareOptions options)
{
+ Debug.Assert(!_invariantMode);
+
Debug.Assert(!string.IsNullOrEmpty(source));
Debug.Assert(!string.IsNullOrEmpty(prefix));
Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
@@ -253,6 +269,8 @@ namespace System.Globalization
private bool EndsWith(string source, string suffix, CompareOptions options)
{
+ Debug.Assert(!_invariantMode);
+
Debug.Assert(!string.IsNullOrEmpty(source));
Debug.Assert(!string.IsNullOrEmpty(suffix));
Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
@@ -267,12 +285,14 @@ namespace System.Globalization
private unsafe SortKey CreateSortKey(String source, CompareOptions options)
{
+ Debug.Assert(!_invariantMode);
+
if (source==null) { throw new ArgumentNullException(nameof(source)); }
Contract.EndContractBlock();
if ((options & ValidSortkeyCtorMaskOffFlags) != 0)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidFlag"), nameof(options));
+ throw new ArgumentException(SR.Argument_InvalidFlag, nameof(options));
}
byte [] keyData;
@@ -296,6 +316,8 @@ namespace System.Globalization
private unsafe static bool IsSortable(char *text, int length)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
int index = 0;
UnicodeCategory uc;
@@ -337,6 +359,8 @@ namespace System.Globalization
internal unsafe int GetHashCodeOfStringCore(string source, CompareOptions options, bool forceRandomizedHashing, long additionalEntropy)
{
+ Debug.Assert(!_invariantMode);
+
Debug.Assert(source != null);
Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
@@ -402,6 +426,8 @@ namespace System.Globalization
private SortVersion GetSortVersion()
{
+ Debug.Assert(!_invariantMode);
+
int sortVersion = Interop.GlobalizationInterop.GetSortVersion();
return new SortVersion(sortVersion, LCID, new Guid(sortVersion, 0, 0, 0, 0, 0, 0,
(byte) (LCID >> 24),
diff --git a/src/mscorlib/src/System/Globalization/CompareInfo.Windows.cs b/src/mscorlib/src/System/Globalization/CompareInfo.Windows.cs
index 0c87d9f417..d20bb9f9f3 100644
--- a/src/mscorlib/src/System/Globalization/CompareInfo.Windows.cs
+++ b/src/mscorlib/src/System/Globalization/CompareInfo.Windows.cs
@@ -12,24 +12,24 @@ namespace System.Globalization
{
public partial class CompareInfo
{
- internal unsafe CompareInfo(CultureInfo culture)
- {
- _name = culture._name;
- InitSort(culture);
- }
-
private unsafe void InitSort(CultureInfo culture)
{
_sortName = culture.SortName;
- const uint LCMAP_SORTHANDLE = 0x20000000;
-
_name = culture._name;
_sortName = culture.SortName;
- IntPtr handle;
- int ret = Interop.Kernel32.LCMapStringEx(_sortName, LCMAP_SORTHANDLE, null, 0, &handle, IntPtr.Size, null, null, IntPtr.Zero);
- _sortHandle = ret > 0 ? handle : IntPtr.Zero;
+ if (_invariantMode)
+ {
+ _sortHandle = IntPtr.Zero;
+ }
+ else
+ {
+ const uint LCMAP_SORTHANDLE = 0x20000000;
+ IntPtr handle;
+ int ret = Interop.Kernel32.LCMapStringEx(_sortName, LCMAP_SORTHANDLE, null, 0, &handle, IntPtr.Size, null, null, IntPtr.Zero);
+ _sortHandle = ret > 0 ? handle : IntPtr.Zero;
+ }
}
private static unsafe int FindStringOrdinal(
@@ -41,6 +41,8 @@ namespace System.Globalization
int cchValue,
bool bIgnoreCase)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
fixed (char* pSource = stringSource)
fixed (char* pValue = value)
{
@@ -55,16 +57,20 @@ namespace System.Globalization
}
}
- internal static int IndexOfOrdinal(string source, string value, int startIndex, int count, bool ignoreCase)
+ internal static int IndexOfOrdinalCore(string source, string value, int startIndex, int count, bool ignoreCase)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
Debug.Assert(source != null);
Debug.Assert(value != null);
return FindStringOrdinal(FIND_FROMSTART, source, startIndex, count, value, value.Length, ignoreCase);
}
- internal static int LastIndexOfOrdinal(string source, string value, int startIndex, int count, bool ignoreCase)
+ internal static int LastIndexOfOrdinalCore(string source, string value, int startIndex, int count, bool ignoreCase)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
Debug.Assert(source != null);
Debug.Assert(value != null);
@@ -73,6 +79,8 @@ namespace System.Globalization
private unsafe int GetHashCodeOfStringCore(string source, CompareOptions options)
{
+ Debug.Assert(!_invariantMode);
+
Debug.Assert(source != null);
Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
@@ -103,12 +111,16 @@ namespace System.Globalization
private static unsafe int CompareStringOrdinalIgnoreCase(char* string1, int count1, char* string2, int count2)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
// Use the OS to compare and then convert the result to expected value by subtracting 2
return Interop.Kernel32.CompareStringOrdinal(string1, count1, string2, count2, true) - 2;
}
private unsafe int CompareString(string string1, int offset1, int length1, string string2, int offset2, int length2, CompareOptions options)
{
+ Debug.Assert(!_invariantMode);
+
Debug.Assert(string1 != null);
Debug.Assert(string2 != null);
Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
@@ -150,6 +162,8 @@ namespace System.Globalization
int cchValue,
int *pcchFound)
{
+ Debug.Assert(!_invariantMode);
+
string localeName = _sortHandle != IntPtr.Zero ? null : _sortName;
fixed (char* pLocaleName = localeName)
@@ -175,6 +189,8 @@ namespace System.Globalization
internal unsafe int IndexOfCore(String source, String target, int startIndex, int count, CompareOptions options, int* matchLengthPtr)
{
+ Debug.Assert(!_invariantMode);
+
Debug.Assert(source != null);
Debug.Assert(target != null);
Debug.Assert((options & CompareOptions.OrdinalIgnoreCase) == 0);
@@ -216,6 +232,8 @@ namespace System.Globalization
private unsafe int LastIndexOfCore(string source, string target, int startIndex, int count, CompareOptions options)
{
+ Debug.Assert(!_invariantMode);
+
Debug.Assert(!string.IsNullOrEmpty(source));
Debug.Assert(target != null);
Debug.Assert((options & CompareOptions.OrdinalIgnoreCase) == 0);
@@ -245,6 +263,8 @@ namespace System.Globalization
private unsafe bool StartsWith(string source, string prefix, CompareOptions options)
{
+ Debug.Assert(!_invariantMode);
+
Debug.Assert(!string.IsNullOrEmpty(source));
Debug.Assert(!string.IsNullOrEmpty(prefix));
Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
@@ -255,6 +275,8 @@ namespace System.Globalization
private unsafe bool EndsWith(string source, string suffix, CompareOptions options)
{
+ Debug.Assert(!_invariantMode);
+
Debug.Assert(!string.IsNullOrEmpty(source));
Debug.Assert(!string.IsNullOrEmpty(suffix));
Debug.Assert((options & (CompareOptions.Ordinal | CompareOptions.OrdinalIgnoreCase)) == 0);
@@ -352,6 +374,8 @@ namespace System.Globalization
private unsafe SortKey CreateSortKey(String source, CompareOptions options)
{
+ Debug.Assert(!_invariantMode);
+
if (source == null) { throw new ArgumentNullException(nameof(source)); }
Contract.EndContractBlock();
@@ -397,6 +421,8 @@ namespace System.Globalization
private static unsafe bool IsSortable(char* text, int length)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
return Interop.Kernel32.IsNLSDefinedString(Interop.Kernel32.COMPARE_STRING, 0, IntPtr.Zero, text, length);
}
@@ -440,6 +466,8 @@ namespace System.Globalization
private unsafe SortVersion GetSortVersion()
{
+ Debug.Assert(!_invariantMode);
+
Interop.Kernel32.NlsVersionInfoEx nlsVersion = new Interop.Kernel32.NlsVersionInfoEx();
Interop.Kernel32.GetNLSVersionEx(Interop.Kernel32.COMPARE_STRING, _sortName, &nlsVersion);
return new SortVersion(
diff --git a/src/mscorlib/src/System/Globalization/CompareInfo.cs b/src/mscorlib/src/System/Globalization/CompareInfo.cs
index 94cfcad709..285a81d906 100644
--- a/src/mscorlib/src/System/Globalization/CompareInfo.cs
+++ b/src/mscorlib/src/System/Globalization/CompareInfo.cs
@@ -64,13 +64,23 @@ namespace System.Globalization
// locale, which is what SCOMPAREINFO does.
[OptionalField(VersionAdded = 2)]
- private String _name; // The name used to construct this CompareInfo
+ private string _name; // The name used to construct this CompareInfo
[NonSerialized]
- private String _sortName; // The name that defines our behavior
+ private string _sortName; // The name that defines our behavior
[OptionalField(VersionAdded = 3)]
private SortVersion _sortVersion;
+ // _invariantMode is defined for the perf reason as accessing the instance field is faster than access the static property GlobalizationMode.Invariant
+ [NonSerialized]
+ private readonly bool _invariantMode = GlobalizationMode.Invariant;
+
+ internal CompareInfo(CultureInfo culture)
+ {
+ _name = culture._name;
+ InitSort(culture);
+ }
+
/*=================================GetCompareInfo==========================
**Action: Get the CompareInfo constructed from the data table in the specified assembly for the specified culture.
** Warning: The assembly versioning mechanism is dead!
@@ -111,7 +121,7 @@ namespace System.Globalization
** ArgumentException if name is invalid.
============================================================================*/
// Assembly constructor should be deprecated, we don't act on the assembly information any more
- public static CompareInfo GetCompareInfo(String name, Assembly assembly)
+ public static CompareInfo GetCompareInfo(string name, Assembly assembly)
{
if (name == null || assembly == null)
{
@@ -157,7 +167,7 @@ namespace System.Globalization
** ArgumentException if name is invalid.
============================================================================*/
- public static CompareInfo GetCompareInfo(String name)
+ public static CompareInfo GetCompareInfo(string name)
{
if (name == null)
{
@@ -170,6 +180,10 @@ namespace System.Globalization
public static unsafe bool IsSortable(char ch)
{
+ if (GlobalizationMode.Invariant)
+ {
+ return true;
+ }
char *pChar = &ch;
return IsSortable(pChar, 1);
}
@@ -182,11 +196,16 @@ namespace System.Globalization
throw new ArgumentNullException(nameof(text));
}
- if (0 == text.Length)
+ if (text.Length == 0)
{
// A zero length string is not invalid, but it is also not sortable.
return (false);
}
+
+ if (GlobalizationMode.Invariant)
+ {
+ return true;
+ }
fixed (char *pChar = text)
{
@@ -236,7 +255,7 @@ namespace System.Globalization
//
////////////////////////////////////////////////////////////////////////
- public virtual String Name
+ public virtual string Name
{
get
{
@@ -261,12 +280,12 @@ namespace System.Globalization
//
////////////////////////////////////////////////////////////////////////
- public virtual int Compare(String string1, String string2)
+ public virtual int Compare(string string1, string string2)
{
return (Compare(string1, string2, CompareOptions.None));
}
- public unsafe virtual int Compare(String string1, String string2, CompareOptions options)
+ public unsafe virtual int Compare(string string1, string string2, CompareOptions options)
{
if (options == CompareOptions.OrdinalIgnoreCase)
{
@@ -280,6 +299,7 @@ namespace System.Globalization
{
throw new ArgumentException(SR.Argument_CompareOptionOrdinal, nameof(options));
}
+
return String.CompareOrdinal(string1, string2);
}
@@ -303,6 +323,14 @@ namespace System.Globalization
return (1); // non-null > null
}
+ if (_invariantMode)
+ {
+ if ((options & CompareOptions.IgnoreCase) != 0)
+ return CompareOrdinalIgnoreCase(string1, 0, string1.Length, string2, 0, string2.Length);
+
+ return String.CompareOrdinal(string1, string2);
+ }
+
return CompareString(string1, 0, string1.Length, string2, 0, string2.Length, options);
}
@@ -320,26 +348,26 @@ namespace System.Globalization
////////////////////////////////////////////////////////////////////////
- public unsafe virtual int Compare(String string1, int offset1, int length1, String string2, int offset2, int length2)
+ public unsafe virtual int Compare(string string1, int offset1, int length1, string string2, int offset2, int length2)
{
return Compare(string1, offset1, length1, string2, offset2, length2, 0);
}
- public unsafe virtual int Compare(String string1, int offset1, String string2, int offset2, CompareOptions options)
+ public virtual int Compare(string string1, int offset1, string string2, int offset2, CompareOptions options)
{
return Compare(string1, offset1, string1 == null ? 0 : string1.Length - offset1,
string2, offset2, string2 == null ? 0 : string2.Length - offset2, options);
}
- public unsafe virtual int Compare(String string1, int offset1, String string2, int offset2)
+ public virtual int Compare(string string1, int offset1, string string2, int offset2)
{
return Compare(string1, offset1, string2, offset2, 0);
}
- public unsafe virtual int Compare(String string1, int offset1, int length1, String string2, int offset2, int length2, CompareOptions options)
+ public virtual int Compare(string string1, int offset1, int length1, string string2, int offset2, int length2, CompareOptions options)
{
if (options == CompareOptions.OrdinalIgnoreCase)
{
@@ -400,6 +428,15 @@ namespace System.Globalization
return CompareOrdinal(string1, offset1, length1,
string2, offset2, length2);
}
+
+ if (_invariantMode)
+ {
+ if ((options & CompareOptions.IgnoreCase) != 0)
+ return CompareOrdinalIgnoreCase(string1, offset1, length1, string2, offset2, length2);
+
+ return CompareOrdinal(string1, offset1, length1, string2, offset2, length2);
+ }
+
return CompareString(string1, offset1, length1,
string2, offset2, length2,
options);
@@ -417,7 +454,7 @@ namespace System.Globalization
}
//
- // CompareOrdinalIgnoreCase compare two string oridnally with ignoring the case.
+ // CompareOrdinalIgnoreCase compare two string ordinally with ignoring the case.
// it assumes the strings are Ascii string till we hit non Ascii character in strA or strB and then we continue the comparison by
// calling the OS.
//
@@ -434,7 +471,10 @@ namespace System.Globalization
char* a = ap + indexA;
char* b = bp + indexB;
- while (length != 0 && (*a <= 0x80) && (*b <= 0x80))
+ // in InvariantMode we support all range and not only the ascii characters.
+ char maxChar = (char) (GlobalizationMode.Invariant ? 0xFFFF : 0x80);
+
+ while (length != 0 && (*a <= maxChar) && (*b <= maxChar))
{
int charA = *a;
int charB = *b;
@@ -450,7 +490,7 @@ namespace System.Globalization
if ((uint)(charA - 'a') <= (uint)('z' - 'a')) charA -= 0x20;
if ((uint)(charB - 'a') <= (uint)('z' - 'a')) charB -= 0x20;
- //Return the (case-insensitive) difference between them.
+ // Return the (case-insensitive) difference between them.
if (charA != charB)
return charA - charB;
@@ -462,6 +502,8 @@ namespace System.Globalization
if (length == 0)
return lengthA - lengthB;
+ Debug.Assert(!GlobalizationMode.Invariant);
+
range -= length;
return CompareStringOrdinalIgnoreCase(a, lengthA - range, b, lengthB - range);
@@ -476,7 +518,7 @@ namespace System.Globalization
// String.Empty, true is returned.
//
////////////////////////////////////////////////////////////////////////
- public unsafe virtual bool IsPrefix(String source, String prefix, CompareOptions options)
+ public virtual bool IsPrefix(string source, string prefix, CompareOptions options)
{
if (source == null || prefix == null)
{
@@ -510,10 +552,15 @@ namespace System.Globalization
throw new ArgumentException(SR.Argument_InvalidFlag, nameof(options));
}
+ if (_invariantMode)
+ {
+ return source.StartsWith(prefix, (options & CompareOptions.IgnoreCase) != 0 ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal);
+ }
+
return StartsWith(source, prefix, options);
}
- public virtual bool IsPrefix(String source, String prefix)
+ public virtual bool IsPrefix(string source, string prefix)
{
return (IsPrefix(source, prefix, 0));
}
@@ -526,7 +573,7 @@ namespace System.Globalization
// String.Empty, true is returned.
//
////////////////////////////////////////////////////////////////////////
- public unsafe virtual bool IsSuffix(String source, String suffix, CompareOptions options)
+ public virtual bool IsSuffix(string source, string suffix, CompareOptions options)
{
if (source == null || suffix == null)
{
@@ -560,11 +607,16 @@ namespace System.Globalization
throw new ArgumentException(SR.Argument_InvalidFlag, nameof(options));
}
+ if (_invariantMode)
+ {
+ return source.EndsWith(suffix, (options & CompareOptions.IgnoreCase) != 0 ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal);
+ }
+
return EndsWith(source, suffix, options);
}
- public virtual bool IsSuffix(String source, String suffix)
+ public virtual bool IsSuffix(string source, string suffix)
{
return (IsSuffix(source, suffix, 0));
}
@@ -583,7 +635,7 @@ namespace System.Globalization
////////////////////////////////////////////////////////////////////////
- public unsafe virtual int IndexOf(String source, char value)
+ public virtual int IndexOf(string source, char value)
{
if (source == null)
throw new ArgumentNullException(nameof(source));
@@ -593,7 +645,7 @@ namespace System.Globalization
}
- public unsafe virtual int IndexOf(String source, String value)
+ public virtual int IndexOf(string source, string value)
{
if (source == null)
throw new ArgumentNullException(nameof(source));
@@ -603,7 +655,7 @@ namespace System.Globalization
}
- public unsafe virtual int IndexOf(String source, char value, CompareOptions options)
+ public virtual int IndexOf(string source, char value, CompareOptions options)
{
if (source == null)
throw new ArgumentNullException(nameof(source));
@@ -613,7 +665,7 @@ namespace System.Globalization
}
- public unsafe virtual int IndexOf(String source, String value, CompareOptions options)
+ public virtual int IndexOf(string source, string value, CompareOptions options)
{
if (source == null)
throw new ArgumentNullException(nameof(source));
@@ -622,7 +674,7 @@ namespace System.Globalization
return IndexOf(source, value, 0, source.Length, options);
}
- public unsafe virtual int IndexOf(String source, char value, int startIndex)
+ public virtual int IndexOf(string source, char value, int startIndex)
{
if (source == null)
throw new ArgumentNullException(nameof(source));
@@ -631,7 +683,7 @@ namespace System.Globalization
return IndexOf(source, value, startIndex, source.Length - startIndex, CompareOptions.None);
}
- public unsafe virtual int IndexOf(String source, String value, int startIndex)
+ public virtual int IndexOf(string source, string value, int startIndex)
{
if (source == null)
throw new ArgumentNullException(nameof(source));
@@ -640,7 +692,7 @@ namespace System.Globalization
return IndexOf(source, value, startIndex, source.Length - startIndex, CompareOptions.None);
}
- public unsafe virtual int IndexOf(String source, char value, int startIndex, CompareOptions options)
+ public virtual int IndexOf(string source, char value, int startIndex, CompareOptions options)
{
if (source == null)
throw new ArgumentNullException(nameof(source));
@@ -650,7 +702,7 @@ namespace System.Globalization
}
- public unsafe virtual int IndexOf(String source, String value, int startIndex, CompareOptions options)
+ public virtual int IndexOf(string source, string value, int startIndex, CompareOptions options)
{
if (source == null)
throw new ArgumentNullException(nameof(source));
@@ -660,18 +712,18 @@ namespace System.Globalization
}
- public unsafe virtual int IndexOf(String source, char value, int startIndex, int count)
+ public virtual int IndexOf(string source, char value, int startIndex, int count)
{
return IndexOf(source, value, startIndex, count, CompareOptions.None);
}
- public unsafe virtual int IndexOf(String source, String value, int startIndex, int count)
+ public virtual int IndexOf(string source, string value, int startIndex, int count)
{
return IndexOf(source, value, startIndex, count, CompareOptions.None);
}
- public unsafe virtual int IndexOf(String source, char value, int startIndex, int count, CompareOptions options)
+ public unsafe virtual int IndexOf(string source, char value, int startIndex, int count, CompareOptions options)
{
// Validate inputs
if (source == null)
@@ -693,12 +745,15 @@ namespace System.Globalization
// Ordinal can't be selected with other flags
if ((options & ValidIndexMaskOffFlags) != 0 && (options != CompareOptions.Ordinal))
throw new ArgumentException(SR.Argument_InvalidFlag, nameof(options));
+
+ if (_invariantMode)
+ return IndexOfOrdinal(source, new string(value, 1), startIndex, count, ignoreCase: (options & (CompareOptions.IgnoreCase | CompareOptions.OrdinalIgnoreCase)) != 0);
return IndexOfCore(source, new string(value, 1), startIndex, count, options, null);
}
- public unsafe virtual int IndexOf(String source, String value, int startIndex, int count, CompareOptions options)
+ public unsafe virtual int IndexOf(string source, string value, int startIndex, int count, CompareOptions options)
{
// Validate inputs
if (source == null)
@@ -741,9 +796,22 @@ namespace System.Globalization
if ((options & ValidIndexMaskOffFlags) != 0 && (options != CompareOptions.Ordinal))
throw new ArgumentException(SR.Argument_InvalidFlag, nameof(options));
+ if (_invariantMode)
+ return IndexOfOrdinal(source, value, startIndex, count, ignoreCase: (options & (CompareOptions.IgnoreCase | CompareOptions.OrdinalIgnoreCase)) != 0);
+
return IndexOfCore(source, value, startIndex, count, options, null);
}
+ internal int IndexOfOrdinal(string source, string value, int startIndex, int count, bool ignoreCase)
+ {
+ if (_invariantMode)
+ {
+ return InvariantIndexOf(source, value, startIndex, count, ignoreCase);
+ }
+
+ return IndexOfOrdinalCore(source, value, startIndex, count, ignoreCase);
+ }
+
////////////////////////////////////////////////////////////////////////
//
// LastIndexOf
@@ -758,19 +826,18 @@ namespace System.Globalization
////////////////////////////////////////////////////////////////////////
- public unsafe virtual int LastIndexOf(String source, char value)
+ public virtual int LastIndexOf(String source, char value)
{
if (source == null)
throw new ArgumentNullException(nameof(source));
Contract.EndContractBlock();
// Can't start at negative index, so make sure we check for the length == 0 case.
- return LastIndexOf(source, value, source.Length - 1,
- source.Length, CompareOptions.None);
+ return LastIndexOf(source, value, source.Length - 1, source.Length, CompareOptions.None);
}
- public virtual int LastIndexOf(String source, String value)
+ public virtual int LastIndexOf(string source, string value)
{
if (source == null)
throw new ArgumentNullException(nameof(source));
@@ -782,7 +849,7 @@ namespace System.Globalization
}
- public virtual int LastIndexOf(String source, char value, CompareOptions options)
+ public virtual int LastIndexOf(string source, char value, CompareOptions options)
{
if (source == null)
throw new ArgumentNullException(nameof(source));
@@ -793,53 +860,52 @@ namespace System.Globalization
source.Length, options);
}
- public unsafe virtual int LastIndexOf(String source, String value, CompareOptions options)
+ public virtual int LastIndexOf(string source, string value, CompareOptions options)
{
if (source == null)
throw new ArgumentNullException(nameof(source));
Contract.EndContractBlock();
// Can't start at negative index, so make sure we check for the length == 0 case.
- return LastIndexOf(source, value, source.Length - 1,
- source.Length, options);
+ return LastIndexOf(source, value, source.Length - 1, source.Length, options);
}
- public unsafe virtual int LastIndexOf(String source, char value, int startIndex)
+ public virtual int LastIndexOf(string source, char value, int startIndex)
{
return LastIndexOf(source, value, startIndex, startIndex + 1, CompareOptions.None);
}
- public unsafe virtual int LastIndexOf(String source, String value, int startIndex)
+ public virtual int LastIndexOf(string source, string value, int startIndex)
{
return LastIndexOf(source, value, startIndex, startIndex + 1, CompareOptions.None);
}
- public unsafe virtual int LastIndexOf(String source, char value, int startIndex, CompareOptions options)
+ public virtual int LastIndexOf(string source, char value, int startIndex, CompareOptions options)
{
return LastIndexOf(source, value, startIndex, startIndex + 1, options);
}
- public unsafe virtual int LastIndexOf(String source, String value, int startIndex, CompareOptions options)
+ public virtual int LastIndexOf(string source, string value, int startIndex, CompareOptions options)
{
return LastIndexOf(source, value, startIndex, startIndex + 1, options);
}
- public unsafe virtual int LastIndexOf(String source, char value, int startIndex, int count)
+ public virtual int LastIndexOf(string source, char value, int startIndex, int count)
{
return LastIndexOf(source, value, startIndex, count, CompareOptions.None);
}
- public unsafe virtual int LastIndexOf(String source, String value, int startIndex, int count)
+ public virtual int LastIndexOf(string source, string value, int startIndex, int count)
{
return LastIndexOf(source, value, startIndex, count, CompareOptions.None);
}
- public unsafe virtual int LastIndexOf(String source, char value, int startIndex, int count, CompareOptions options)
+ public virtual int LastIndexOf(string source, char value, int startIndex, int count, CompareOptions options)
{
// Verify Arguments
if (source == null)
@@ -878,11 +944,14 @@ namespace System.Globalization
return source.LastIndexOf(value.ToString(), startIndex, count, StringComparison.OrdinalIgnoreCase);
}
+ if (_invariantMode)
+ return InvariantLastIndexOf(source, new string(value, 1), startIndex, count, (options & (CompareOptions.IgnoreCase | CompareOptions.OrdinalIgnoreCase)) != 0);
+
return LastIndexOfCore(source, value.ToString(), startIndex, count, options);
}
- public unsafe virtual int LastIndexOf(String source, String value, int startIndex, int count, CompareOptions options)
+ public virtual int LastIndexOf(string source, string value, int startIndex, int count, CompareOptions options)
{
// Verify Arguments
if (source == null)
@@ -927,9 +996,22 @@ namespace System.Globalization
return LastIndexOfOrdinal(source, value, startIndex, count, ignoreCase: true);
}
+ if (_invariantMode)
+ return InvariantLastIndexOf(source, value, startIndex, count, (options & (CompareOptions.IgnoreCase | CompareOptions.OrdinalIgnoreCase)) != 0);
+
return LastIndexOfCore(source, value, startIndex, count, options);
}
+ internal int LastIndexOfOrdinal(string source, string value, int startIndex, int count, bool ignoreCase)
+ {
+ if (_invariantMode)
+ {
+ return InvariantLastIndexOf(source, value, startIndex, count, ignoreCase);
+ }
+
+ return LastIndexOfOrdinalCore(source, value, startIndex, count, ignoreCase);
+ }
+
////////////////////////////////////////////////////////////////////////
//
// GetSortKey
@@ -937,14 +1019,20 @@ namespace System.Globalization
// Gets the SortKey for the given string with the given options.
//
////////////////////////////////////////////////////////////////////////
- public unsafe virtual SortKey GetSortKey(String source, CompareOptions options)
+ public virtual SortKey GetSortKey(string source, CompareOptions options)
{
+ if (_invariantMode)
+ return InvariantCreateSortKey(source, options);
+
return CreateSortKey(source, options);
}
- public unsafe virtual SortKey GetSortKey(String source)
+ public virtual SortKey GetSortKey(string source)
{
+ if (_invariantMode)
+ return InvariantCreateSortKey(source, CompareOptions.None);
+
return CreateSortKey(source, CompareOptions.None);
}
@@ -1065,7 +1153,7 @@ namespace System.Globalization
// CompareInfo.
//
////////////////////////////////////////////////////////////////////////
- public override String ToString()
+ public override string ToString()
{
return ("CompareInfo - " + this.Name);
}
@@ -1076,7 +1164,18 @@ namespace System.Globalization
{
if (_sortVersion == null)
{
- _sortVersion = GetSortVersion();
+ if (_invariantMode)
+ {
+ _sortVersion = new SortVersion(0, CultureInfo.LOCALE_INVARIANT, new Guid(0, 0, 0, 0, 0, 0, 0,
+ (byte) (CultureInfo.LOCALE_INVARIANT >> 24),
+ (byte) ((CultureInfo.LOCALE_INVARIANT & 0x00FF0000) >> 16),
+ (byte) ((CultureInfo.LOCALE_INVARIANT & 0x0000FF00) >> 8),
+ (byte) (CultureInfo.LOCALE_INVARIANT & 0xFF)));
+ }
+ else
+ {
+ _sortVersion = GetSortVersion();
+ }
}
return _sortVersion;
diff --git a/src/mscorlib/src/System/Globalization/CultureData.Unix.cs b/src/mscorlib/src/System/Globalization/CultureData.Unix.cs
index 210f772364..4f685de580 100644
--- a/src/mscorlib/src/System/Globalization/CultureData.Unix.cs
+++ b/src/mscorlib/src/System/Globalization/CultureData.Unix.cs
@@ -27,7 +27,9 @@ namespace System.Globalization
private unsafe bool InitCultureData()
{
Debug.Assert(_sRealName != null);
-
+
+ Debug.Assert(!GlobalizationMode.Invariant);
+
string alternateSortName = string.Empty;
string realNameBuffer = _sRealName;
@@ -120,6 +122,8 @@ namespace System.Globalization
private string GetLocaleInfo(LocaleStringData type)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
Debug.Assert(_sWindowsName != null, "[CultureData.GetLocaleInfo] Expected _sWindowsName to be populated already");
return GetLocaleInfo(_sWindowsName, type);
}
@@ -153,6 +157,8 @@ namespace System.Globalization
private int GetLocaleInfo(LocaleNumberData type)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
Debug.Assert(_sWindowsName != null, "[CultureData.GetLocaleInfo(LocaleNumberData)] Expected _sWindowsName to be populated already");
switch (type)
@@ -296,11 +302,15 @@ namespace System.Globalization
private static string LCIDToLocaleName(int culture)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
return LocaleData.LCIDToLocaleName(culture);
}
private static int LocaleNameToLCID(string cultureName)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
int lcid = LocaleData.GetLocaleDataNumericPart(cultureName, LocaleDataParts.Lcid);
return lcid == -1 ? CultureInfo.LOCALE_CUSTOM_UNSPECIFIED : lcid;
}
@@ -349,6 +359,8 @@ namespace System.Globalization
private static CultureInfo[] EnumCultures(CultureTypes types)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
if ((types & (CultureTypes.NeutralCultures | CultureTypes.SpecificCultures)) == 0)
{
return Array.Empty<CultureInfo>();
diff --git a/src/mscorlib/src/System/Globalization/CultureData.Windows.cs b/src/mscorlib/src/System/Globalization/CultureData.Windows.cs
index 6ce52930cf..6d2678b550 100644
--- a/src/mscorlib/src/System/Globalization/CultureData.Windows.cs
+++ b/src/mscorlib/src/System/Globalization/CultureData.Windows.cs
@@ -62,7 +62,7 @@ namespace System.Globalization
/// </summary>
private unsafe bool InitCultureData()
{
- const int LOCALE_NAME_MAX_LENGTH = 85;
+ Debug.Assert(!GlobalizationMode.Invariant);
const uint LOCALE_ILANGUAGE = 0x00000001;
const uint LOCALE_INEUTRAL = 0x00000071;
@@ -193,6 +193,8 @@ namespace System.Globalization
internal static unsafe int GetLocaleInfoEx(string lpLocaleName, uint lcType, char* lpLCData, int cchData)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
return Interop.Kernel32.GetLocaleInfoEx(lpLocaleName, lcType, (IntPtr)lpLCData, cchData);
}
@@ -665,11 +667,15 @@ namespace System.Globalization
private static int LocaleNameToLCID(string cultureName)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
return Interop.Kernel32.LocaleNameToLCID(cultureName, Interop.Kernel32.LOCALE_ALLOW_NEUTRAL_NAMES);
}
private static unsafe string LCIDToLocaleName(int culture)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
char *pBuffer = stackalloc char[Interop.Kernel32.LOCALE_NAME_MAX_LENGTH + 1]; // +1 for the null termination
int length = Interop.Kernel32.LCIDToLocaleName(culture, pBuffer, Interop.Kernel32.LOCALE_NAME_MAX_LENGTH + 1, Interop.Kernel32.LOCALE_ALLOW_NEUTRAL_NAMES);
@@ -718,6 +724,8 @@ namespace System.Globalization
private static CultureInfo[] EnumCultures(CultureTypes types)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
uint flags = 0;
#pragma warning disable 618
diff --git a/src/mscorlib/src/System/Globalization/CultureData.cs b/src/mscorlib/src/System/Globalization/CultureData.cs
index 8e176546fa..0dcebf484b 100644
--- a/src/mscorlib/src/System/Globalization/CultureData.cs
+++ b/src/mscorlib/src/System/Globalization/CultureData.cs
@@ -53,6 +53,7 @@ namespace System.Globalization
//
internal partial class CultureData
{
+ private const int LOCALE_NAME_MAX_LENGTH = 85;
private const int undef = -1;
// Override flag
@@ -159,7 +160,7 @@ namespace System.Globalization
// Region Name to Culture Name mapping table
// (In future would be nice to be in registry or something)
- //Using a property so we avoid creating the dictionary untill we need it
+ //Using a property so we avoid creating the dictionary until we need it
private static StringStringDictionary RegionNames
{
get
@@ -429,10 +430,125 @@ namespace System.Globalization
types &= (~CultureTypes.WindowsOnlyCultures);
}
+ if (GlobalizationMode.Invariant)
+ {
+ // in invariant mode we always return invariant culture only from the enumeration
+ return new CultureInfo[1] { new CultureInfo("") };
+ }
+
#pragma warning restore 618
return EnumCultures(types);
}
+ private static CultureData CreateCultureWithInvariantData()
+ {
+ // Make a new culturedata
+ CultureData invariant = new CultureData();
+
+ // Basics
+ // Note that we override the resources since this IS NOT supposed to change (by definition)
+ invariant._bUseOverrides = false;
+ invariant._sRealName = ""; // Name you passed in (ie: en-US, en, or de-DE_phoneb)
+ invariant._sWindowsName = ""; // Name OS thinks the object is (ie: de-DE_phoneb, or en-US (even if en was passed in))
+
+ // Identity
+ invariant._sName = ""; // locale name (ie: en-us)
+ invariant._sParent = ""; // Parent name (which may be a custom locale/culture)
+ invariant._bNeutral = false; // Flags for the culture (ie: neutral or not right now)
+ invariant._sEnglishDisplayName = "Invariant Language (Invariant Country)"; // English pretty name for this locale
+ invariant._sNativeDisplayName = "Invariant Language (Invariant Country)"; // Native pretty name for this locale
+ invariant._sSpecificCulture = ""; // The culture name to be used in CultureInfo.CreateSpecificCulture()
+
+ // Language
+ invariant._sISO639Language = "iv"; // ISO 639 Language Name
+ invariant._sISO639Language2 = "ivl"; // 3 char ISO 639 lang name 2
+ invariant._sLocalizedLanguage = "Invariant Language"; // Display name for this Language
+ invariant._sEnglishLanguage = "Invariant Language"; // English name for this language
+ invariant._sNativeLanguage = "Invariant Language"; // Native name of this language
+ invariant._sAbbrevLang = "IVL"; // abbreviated language name (Windows Language Name)
+ invariant._sConsoleFallbackName = ""; // The culture name for the console fallback UI culture
+ invariant._iInputLanguageHandle = 0x07F; // input language handle
+
+ // Region
+ invariant._sRegionName = "IV"; // (RegionInfo)
+ invariant._sEnglishCountry = "Invariant Country"; // english country name (RegionInfo)
+ invariant._sNativeCountry = "Invariant Country"; // native country name (Windows Only)
+ invariant._sISO3166CountryName = "IV"; // (RegionInfo), ie: US
+ invariant._sISO3166CountryName2 = "ivc"; // 3 char ISO 3166 country name 2 2(RegionInfo)
+ invariant._iGeoId = 244; // GeoId (Windows Only)
+
+ // Numbers
+ invariant._sPositiveSign = "+"; // positive sign
+ invariant._sNegativeSign = "-"; // negative sign
+ invariant._iDigits = 2; // number of fractional digits
+ invariant._iNegativeNumber = 1; // negative number format
+ invariant._waGrouping = new int[] { 3 }; // grouping of digits
+ invariant._sDecimalSeparator = "."; // decimal separator
+ invariant._sThousandSeparator = ","; // thousands separator
+ invariant._sNaN = "NaN"; // Not a Number
+ invariant._sPositiveInfinity = "Infinity"; // + Infinity
+ invariant._sNegativeInfinity = "-Infinity"; // - Infinity
+
+ // Percent
+ invariant._iNegativePercent = 0; // Negative Percent (0-3)
+ invariant._iPositivePercent = 0; // Positive Percent (0-11)
+ invariant._sPercent = "%"; // Percent (%) symbol
+ invariant._sPerMille = "\x2030"; // PerMille symbol
+
+ // Currency
+ invariant._sCurrency = "\x00a4"; // local monetary symbol: for international monetary symbol
+ invariant._sIntlMonetarySymbol = "XDR"; // international monetary symbol (RegionInfo)
+ invariant._sEnglishCurrency = "International Monetary Fund"; // English name for this currency (Windows Only)
+ invariant._sNativeCurrency = "International Monetary Fund"; // Native name for this currency (Windows Only)
+ invariant._iCurrencyDigits = 2; // # local monetary fractional digits
+ invariant._iCurrency = 0; // positive currency format
+ invariant._iNegativeCurrency = 0; // negative currency format
+ invariant._waMonetaryGrouping = new int[] { 3 }; // monetary grouping of digits
+ invariant._sMonetaryDecimal = "."; // monetary decimal separator
+ invariant._sMonetaryThousand = ","; // monetary thousands separator
+
+ // Misc
+ invariant._iMeasure = 0; // system of measurement 0=metric, 1=US (RegionInfo)
+ invariant._sListSeparator = ","; // list separator
+
+ // Time
+ invariant._sTimeSeparator = ":";
+ invariant._sAM1159 = "AM"; // AM designator
+ invariant._sPM2359 = "PM"; // PM designator
+ invariant._saLongTimes = new String[] { "HH:mm:ss" }; // time format
+ invariant._saShortTimes = new String[] { "HH:mm", "hh:mm tt", "H:mm", "h:mm tt" }; // short time format
+ invariant._saDurationFormats = new String[] { "HH:mm:ss" }; // time duration format
+
+
+ // Calendar specific data
+ invariant._iFirstDayOfWeek = 0; // first day of week
+ invariant._iFirstWeekOfYear = 0; // first week of year
+ invariant._waCalendars = new CalendarId[] { CalendarId.GREGORIAN }; // all available calendar type(s). The first one is the default calendar
+
+ // Store for specific data about each calendar
+ invariant._calendars = new CalendarData[CalendarData.MAX_CALENDARS];
+ invariant._calendars[0] = CalendarData.Invariant;
+
+ // Text information
+ invariant._iReadingLayout = 0;
+
+ // These are desktop only, not coreclr
+
+ invariant._iLanguage = CultureInfo.LOCALE_INVARIANT; // locale ID (0409) - NO sort information
+ invariant._iDefaultAnsiCodePage = 1252; // default ansi code page ID (ACP)
+ invariant._iDefaultOemCodePage = 437; // default oem code page ID (OCP or OEM)
+ invariant._iDefaultMacCodePage = 10000; // default macintosh code page
+ invariant._iDefaultEbcdicCodePage = 037; // default EBCDIC code page
+
+ if (GlobalizationMode.Invariant)
+ {
+ invariant._sLocalizedDisplayName = invariant._sNativeDisplayName;
+ invariant._sLocalizedCountry = invariant._sNativeCountry;
+ }
+
+ return invariant;
+ }
+
/////////////////////////////////////////////////////////////////////////
// Build our invariant information
//
@@ -444,104 +560,8 @@ namespace System.Globalization
{
if (s_Invariant == null)
{
- // Make a new culturedata
- CultureData invariant = new CultureData();
-
- // Basics
- // Note that we override the resources since this IS NOT supposed to change (by definition)
- invariant._bUseOverrides = false;
- invariant._sRealName = ""; // Name you passed in (ie: en-US, en, or de-DE_phoneb)
- invariant._sWindowsName = ""; // Name OS thinks the object is (ie: de-DE_phoneb, or en-US (even if en was passed in))
-
- // Identity
- invariant._sName = ""; // locale name (ie: en-us)
- invariant._sParent = ""; // Parent name (which may be a custom locale/culture)
- invariant._bNeutral = false; // Flags for the culture (ie: neutral or not right now)
- invariant._sEnglishDisplayName = "Invariant Language (Invariant Country)"; // English pretty name for this locale
- invariant._sNativeDisplayName = "Invariant Language (Invariant Country)"; // Native pretty name for this locale
- invariant._sSpecificCulture = ""; // The culture name to be used in CultureInfo.CreateSpecificCulture()
-
- // Language
- invariant._sISO639Language = "iv"; // ISO 639 Language Name
- invariant._sISO639Language2 = "ivl"; // 3 char ISO 639 lang name 2
- invariant._sLocalizedLanguage = "Invariant Language"; // Display name for this Language
- invariant._sEnglishLanguage = "Invariant Language"; // English name for this language
- invariant._sNativeLanguage = "Invariant Language"; // Native name of this language
- invariant._sAbbrevLang = "IVL"; // abbreviated language name (Windows Language Name)
- invariant._sConsoleFallbackName = ""; // The culture name for the console fallback UI culture
- invariant._iInputLanguageHandle = 0x07F; // input language handle
-
- // Region
- invariant._sRegionName = "IV"; // (RegionInfo)
- invariant._sEnglishCountry = "Invariant Country"; // english country name (RegionInfo)
- invariant._sNativeCountry = "Invariant Country"; // native country name (Windows Only)
- invariant._sISO3166CountryName = "IV"; // (RegionInfo), ie: US
- invariant._sISO3166CountryName2 = "ivc"; // 3 char ISO 3166 country name 2 2(RegionInfo)
- invariant._iGeoId = 244; // GeoId (Windows Only)
-
- // Numbers
- invariant._sPositiveSign = "+"; // positive sign
- invariant._sNegativeSign = "-"; // negative sign
- invariant._iDigits = 2; // number of fractional digits
- invariant._iNegativeNumber = 1; // negative number format
- invariant._waGrouping = new int[] { 3 }; // grouping of digits
- invariant._sDecimalSeparator = "."; // decimal separator
- invariant._sThousandSeparator = ","; // thousands separator
- invariant._sNaN = "NaN"; // Not a Number
- invariant._sPositiveInfinity = "Infinity"; // + Infinity
- invariant._sNegativeInfinity = "-Infinity"; // - Infinity
-
- // Percent
- invariant._iNegativePercent = 0; // Negative Percent (0-3)
- invariant._iPositivePercent = 0; // Positive Percent (0-11)
- invariant._sPercent = "%"; // Percent (%) symbol
- invariant._sPerMille = "\x2030"; // PerMille symbol
-
- // Currency
- invariant._sCurrency = "\x00a4"; // local monetary symbol: for international monetary symbol
- invariant._sIntlMonetarySymbol = "XDR"; // international monetary symbol (RegionInfo)
- invariant._sEnglishCurrency = "International Monetary Fund"; // English name for this currency (Windows Only)
- invariant._sNativeCurrency = "International Monetary Fund"; // Native name for this currency (Windows Only)
- invariant._iCurrencyDigits = 2; // # local monetary fractional digits
- invariant._iCurrency = 0; // positive currency format
- invariant._iNegativeCurrency = 0; // negative currency format
- invariant._waMonetaryGrouping = new int[] { 3 }; // monetary grouping of digits
- invariant._sMonetaryDecimal = "."; // monetary decimal separator
- invariant._sMonetaryThousand = ","; // monetary thousands separator
-
- // Misc
- invariant._iMeasure = 0; // system of measurement 0=metric, 1=US (RegionInfo)
- invariant._sListSeparator = ","; // list separator
-
- // Time
- invariant._sAM1159 = "AM"; // AM designator
- invariant._sPM2359 = "PM"; // PM designator
- invariant._saLongTimes = new String[] { "HH:mm:ss" }; // time format
- invariant._saShortTimes = new String[] { "HH:mm", "hh:mm tt", "H:mm", "h:mm tt" }; // short time format
- invariant._saDurationFormats = new String[] { "HH:mm:ss" }; // time duration format
-
-
- // Calendar specific data
- invariant._iFirstDayOfWeek = 0; // first day of week
- invariant._iFirstWeekOfYear = 0; // first week of year
- invariant._waCalendars = new CalendarId[] { CalendarId.GREGORIAN }; // all available calendar type(s). The first one is the default calendar
-
- // Store for specific data about each calendar
- invariant._calendars = new CalendarData[CalendarData.MAX_CALENDARS];
- invariant._calendars[0] = CalendarData.Invariant;
-
- // Text information
- invariant._iReadingLayout = 0;
-
- // These are desktop only, not coreclr
-
- invariant._iLanguage = CultureInfo.LOCALE_INVARIANT; // locale ID (0409) - NO sort information
- invariant._iDefaultAnsiCodePage = 1252; // default ansi code page ID (ACP)
- invariant._iDefaultOemCodePage = 437; // default oem code page ID (OCP or OEM)
- invariant._iDefaultMacCodePage = 10000; // default macintosh code page
- invariant._iDefaultEbcdicCodePage = 037; // default EBCDIC code page
// Remember it
- s_Invariant = invariant;
+ s_Invariant = CreateCultureWithInvariantData();
}
return s_Invariant;
}
@@ -606,8 +626,72 @@ namespace System.Globalization
return culture;
}
+ private static unsafe string NormalizeCultureName(string name, out bool isNeutralName)
+ {
+ isNeutralName = true;
+ int i = 0;
+
+ Debug.Assert(name.Length <= LOCALE_NAME_MAX_LENGTH);
+
+ char *pName = stackalloc char[LOCALE_NAME_MAX_LENGTH];
+ bool changed = false;
+
+ while (i < name.Length && name[i] != '-' && name[i] != '_')
+ {
+ if (name[i] >= 'A' && name[i] <= 'Z')
+ {
+ // lowercase characters before '-'
+ pName[i] = (char) (((int)name[i]) + 0x20);
+ changed = true;
+ }
+ else
+ {
+ pName[i] = name[i];
+ }
+ i++;
+ }
+
+ if (i < name.Length)
+ {
+ // this is not perfect to detect the non neutral cultures but it is good enough when we are running in invariant mode
+ isNeutralName = false;
+ }
+
+ while (i < name.Length)
+ {
+ if (name[i] >= 'a' && name[i] <= 'z')
+ {
+ pName[i] = (char) (((int)name[i]) - 0x20);
+ changed = true;
+ }
+ else
+ {
+ pName[i] = name[i];
+ }
+ i++;
+ }
+
+ if (changed)
+ return new string(pName, 0, name.Length);
+
+ return name;
+ }
+
private static CultureData CreateCultureData(string cultureName, bool useUserOverride)
{
+ if (GlobalizationMode.Invariant)
+ {
+ CultureInfo.VerifyCultureName(cultureName, true);
+ CultureData cd = CreateCultureWithInvariantData();
+ cd._bUseOverrides = useUserOverride;
+ cd._sName = NormalizeCultureName(cultureName, out cd._bNeutral);
+ cd._sRealName = cd._sName;
+ cd._sWindowsName = cd._sName;
+ cd._iLanguage = CultureInfo.LOCALE_CUSTOM_UNSPECIFIED;
+
+ return cd;
+ }
+
CultureData culture = new CultureData();
culture._bUseOverrides = useUserOverride;
culture._sRealName = cultureName;
@@ -665,6 +749,12 @@ namespace System.Globalization
if (culture == CultureInfo.LOCALE_INVARIANT)
return Invariant;
+
+ if (GlobalizationMode.Invariant)
+ {
+ // LCID is not supported in the InvariantMode
+ throw new CultureNotFoundException(nameof(culture), culture, SR.Argument_CultureNotSupported);
+ }
// Convert the lcid to a name, then use that
// Note that this will return neutral names (unlike Vista native API)
@@ -1412,6 +1502,8 @@ namespace System.Globalization
{
if (_saLongTimes == null)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
String[] longTimes = GetTimeFormats();
if (longTimes == null || longTimes.Length == 0)
{
@@ -1435,6 +1527,8 @@ namespace System.Globalization
{
if (_saShortTimes == null)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
// Try to get the short times from the OS/culture.dll
String[] shortTimes = null;
shortTimes = GetShortTimeFormats();
@@ -1967,6 +2061,11 @@ namespace System.Globalization
{
get
{
+ if (GlobalizationMode.Invariant)
+ {
+ return CultureInfo.GetCalendarInstance(CalendarIds[0]);
+ }
+
CalendarId defaultCalId = (CalendarId)GetLocaleInfo(LocaleNumberData.CalendarType);
if (defaultCalId == 0)
@@ -2198,7 +2297,7 @@ namespace System.Globalization
internal void GetNFIValues(NumberFormatInfo nfi)
{
- if (this.IsInvariantCulture)
+ if (GlobalizationMode.Invariant || this.IsInvariantCulture)
{
// FUTURE: NumberFormatInfo already has default values for many of these fields. Can we not do this?
nfi.positiveSign = _sPositiveSign;
diff --git a/src/mscorlib/src/System/Globalization/CultureInfo.Unix.cs b/src/mscorlib/src/System/Globalization/CultureInfo.Unix.cs
index d7950b09b4..7a8a9fd08d 100644
--- a/src/mscorlib/src/System/Globalization/CultureInfo.Unix.cs
+++ b/src/mscorlib/src/System/Globalization/CultureInfo.Unix.cs
@@ -2,6 +2,7 @@
// 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.Diagnostics;
using System.Threading;
namespace System.Globalization
@@ -15,6 +16,9 @@ namespace System.Globalization
internal static CultureInfo GetUserDefaultCulture()
{
+ if (GlobalizationMode.Invariant)
+ return CultureInfo.InvariantCulture;
+
CultureInfo cultureInfo = null;
string localeName;
if (CultureData.GetDefaultLocaleName(out localeName))
diff --git a/src/mscorlib/src/System/Globalization/CultureInfo.Windows.cs b/src/mscorlib/src/System/Globalization/CultureInfo.Windows.cs
index a7f43f249a..e33874e760 100644
--- a/src/mscorlib/src/System/Globalization/CultureInfo.Windows.cs
+++ b/src/mscorlib/src/System/Globalization/CultureInfo.Windows.cs
@@ -2,6 +2,8 @@
// 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.Diagnostics;
+
#if ENABLE_WINRT
using Internal.Runtime.Augments;
#endif
@@ -44,6 +46,9 @@ namespace System.Globalization
internal static CultureInfo GetUserDefaultCulture()
{
+ if (GlobalizationMode.Invariant)
+ return CultureInfo.InvariantCulture;
+
const uint LOCALE_SNAME = 0x0000005c;
const string LOCALE_NAME_USER_DEFAULT = null;
const string LOCALE_NAME_SYSTEM_DEFAULT = "!x-sys-default-locale";
@@ -69,6 +74,9 @@ namespace System.Globalization
private static CultureInfo GetUserDefaultUILanguage()
{
+ if (GlobalizationMode.Invariant)
+ return CultureInfo.InvariantCulture;
+
const uint MUI_LANGUAGE_NAME = 0x8; // Use ISO language (culture) name convention
uint langCount = 0;
uint bufLen = 0;
diff --git a/src/mscorlib/src/System/Globalization/CultureTypes.cs b/src/mscorlib/src/System/Globalization/CultureTypes.cs
deleted file mode 100644
index 10d92465d1..0000000000
--- a/src/mscorlib/src/System/Globalization/CultureTypes.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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.
-
-// The enumeration constants used in CultureInfo.GetCultures().
-// On Linux platforms, the only enum values used there is NeutralCultures and SpecificCultures
-// the rest are obsolete or not valid on Linux
-
-namespace System.Globalization
-{
- [Serializable]
- [Flags]
- public enum CultureTypes
- {
- NeutralCultures = 0x0001, // Neutral cultures are cultures like "en", "de", "zh", etc, for enumeration this includes ALL neutrals regardless of other flags
- SpecificCultures = 0x0002, // Non-netural cultuers. Examples are "en-us", "zh-tw", etc., for enumeration this includes ALL specifics regardless of other flags
- InstalledWin32Cultures = 0x0004, // Win32 installed cultures in the system and exists in the framework too., this is effectively all cultures
-
- AllCultures = NeutralCultures | SpecificCultures | InstalledWin32Cultures,
-
- UserCustomCulture = 0x0008, // User defined custom culture
- ReplacementCultures = 0x0010, // User defined replacement custom culture.
- [Obsolete("This value has been deprecated. Please use other values in CultureTypes.")]
- WindowsOnlyCultures = 0x0020, // this will always return empty list.
- [Obsolete("This value has been deprecated. Please use other values in CultureTypes.")]
- FrameworkCultures = 0x0040, // will return only the v2 cultures marked as Framework culture.
- }
-}
diff --git a/src/mscorlib/src/System/Globalization/EncodingDataItem.Unix.cs b/src/mscorlib/src/System/Globalization/EncodingDataItem.Unix.cs
index 408f6e681e..ffb2d46a9e 100644
--- a/src/mscorlib/src/System/Globalization/EncodingDataItem.Unix.cs
+++ b/src/mscorlib/src/System/Globalization/EncodingDataItem.Unix.cs
@@ -59,7 +59,7 @@ namespace System.Globalization
{
if (_displayNameResourceKey == null)
{
- _displayNameResourceKey = "Globalization.cp_" + CodePage;
+ _displayNameResourceKey = "Globalization_cp_" + CodePage;
}
return _displayNameResourceKey;
diff --git a/src/mscorlib/src/System/Globalization/EncodingTable.Unix.cs b/src/mscorlib/src/System/Globalization/EncodingTable.Unix.cs
index 0fce2e58fc..dc61c9f0d9 100644
--- a/src/mscorlib/src/System/Globalization/EncodingTable.Unix.cs
+++ b/src/mscorlib/src/System/Globalization/EncodingTable.Unix.cs
@@ -21,7 +21,7 @@ namespace System.Globalization
CodePageDataItem dataItem = s_encodingDataTableItems[i];
arrayEncodingInfo[i] = new EncodingInfo(dataItem.CodePage, dataItem.WebName,
- Environment.GetResourceString(dataItem.DisplayNameResourceKey));
+ SR.GetResourceString(dataItem.DisplayNameResourceKey));
}
return arrayEncodingInfo;
@@ -45,7 +45,7 @@ namespace System.Globalization
throw new ArgumentException(
string.Format(
CultureInfo.CurrentCulture,
- Environment.GetResourceString("Argument_EncodingNotSupported"), name), nameof(name));
+ SR.Argument_EncodingNotSupported, name), nameof(name));
}
internal static CodePageDataItem GetCodePageDataItem(int codepage)
diff --git a/src/mscorlib/src/System/Globalization/EncodingTable.cs b/src/mscorlib/src/System/Globalization/EncodingTable.cs
index e54dfd19b2..6d9cc3127f 100644
--- a/src/mscorlib/src/System/Globalization/EncodingTable.cs
+++ b/src/mscorlib/src/System/Globalization/EncodingTable.cs
@@ -95,7 +95,7 @@ namespace System.Globalization
throw new ArgumentException(
String.Format(
CultureInfo.CurrentCulture,
- Environment.GetResourceString("Argument_EncodingNotSupported"), name), nameof(name));
+ SR.Argument_EncodingNotSupported, name), nameof(name));
}
// Return a list of all EncodingInfo objects describing all of our encodings
@@ -117,7 +117,7 @@ namespace System.Globalization
for (i = 0; i < lastCodePageItem; i++)
{
arrayEncodingInfo[i] = new EncodingInfo(codePageDataPtr[i].codePage, CodePageDataItem.CreateString(codePageDataPtr[i].Names, 0),
- Environment.GetResourceString("Globalization.cp_" + codePageDataPtr[i].codePage));
+ SR.GetResourceString("Globalization_cp_" + codePageDataPtr[i].codePage));
}
return arrayEncodingInfo;
diff --git a/src/mscorlib/src/System/Globalization/GlobalizationMode.Unix.cs b/src/mscorlib/src/System/Globalization/GlobalizationMode.Unix.cs
new file mode 100644
index 0000000000..6896029047
--- /dev/null
+++ b/src/mscorlib/src/System/Globalization/GlobalizationMode.Unix.cs
@@ -0,0 +1,24 @@
+// 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 System.Globalization
+{
+ internal sealed partial class GlobalizationMode
+ {
+ private static bool GetGlobalizationInvariantMode()
+ {
+ bool invariantEnabled = CLRConfig.GetBoolValue(c_InvariantModeConfigSwitch);
+ if (!invariantEnabled)
+ {
+ if (Interop.GlobalizationInterop.LoadICU() == 0)
+ {
+ string message = "Couldn't find a valid ICU package installed on the system. " +
+ "Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support.";
+ Environment.FailFast(message);
+ }
+ }
+ return invariantEnabled;
+ }
+ }
+}
diff --git a/src/mscorlib/src/System/Globalization/GlobalizationMode.Windows.cs b/src/mscorlib/src/System/Globalization/GlobalizationMode.Windows.cs
new file mode 100644
index 0000000000..1be79f3507
--- /dev/null
+++ b/src/mscorlib/src/System/Globalization/GlobalizationMode.Windows.cs
@@ -0,0 +1,14 @@
+// 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 System.Globalization
+{
+ internal sealed partial class GlobalizationMode
+ {
+ private static bool GetGlobalizationInvariantMode()
+ {
+ return CLRConfig.GetBoolValue(c_InvariantModeConfigSwitch);
+ }
+ }
+}
diff --git a/src/mscorlib/src/System/Globalization/GlobalizationMode.cs b/src/mscorlib/src/System/Globalization/GlobalizationMode.cs
new file mode 100644
index 0000000000..8f8309886d
--- /dev/null
+++ b/src/mscorlib/src/System/Globalization/GlobalizationMode.cs
@@ -0,0 +1,12 @@
+// 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 System.Globalization
+{
+ internal sealed partial class GlobalizationMode
+ {
+ private const string c_InvariantModeConfigSwitch = "System.Globalization.Invariant";
+ internal static bool Invariant { get; } = GetGlobalizationInvariantMode();
+ }
+}
diff --git a/src/mscorlib/src/System/Globalization/GregorianCalendarHelper.cs b/src/mscorlib/src/System/Globalization/GregorianCalendarHelper.cs
index ee8ba13894..bdc35f0734 100644
--- a/src/mscorlib/src/System/Globalization/GregorianCalendarHelper.cs
+++ b/src/mscorlib/src/System/Globalization/GregorianCalendarHelper.cs
@@ -315,7 +315,7 @@ namespace System.Globalization
0,
MillisPerSecond - 1));
}
- return (InternalGloablizationHelper.TimeToTicks(hour, minute, second) + millisecond * TicksPerMillisecond); ;
+ return (InternalGlobalizationHelper.TimeToTicks(hour, minute, second) + millisecond * TicksPerMillisecond); ;
}
throw new ArgumentOutOfRangeException(null, SR.ArgumentOutOfRange_BadHourMinuteSecond);
}
diff --git a/src/mscorlib/src/System/Globalization/IdnMapping.Unix.cs b/src/mscorlib/src/System/Globalization/IdnMapping.Unix.cs
index 58f4ccadde..f1ad6f1d0a 100644
--- a/src/mscorlib/src/System/Globalization/IdnMapping.Unix.cs
+++ b/src/mscorlib/src/System/Globalization/IdnMapping.Unix.cs
@@ -2,12 +2,16 @@
// 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.Diagnostics;
+
namespace System.Globalization
{
sealed partial class IdnMapping
{
private unsafe string GetAsciiCore(char* unicode, int count)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
uint flags = Flags;
CheckInvalidIdnCharacters(unicode, count, flags, nameof(unicode));
@@ -48,6 +52,8 @@ namespace System.Globalization
private unsafe string GetUnicodeCore(char* ascii, int count)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
uint flags = Flags;
CheckInvalidIdnCharacters(ascii, count, flags, nameof(ascii));
@@ -69,6 +75,8 @@ namespace System.Globalization
private unsafe string GetUnicodeCore(char* ascii, int count, uint flags, char* output, int outputLength, bool reattempt)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
int realLen = Interop.GlobalizationInterop.ToUnicode(flags, ascii, count, output, outputLength);
if (realLen == 0)
diff --git a/src/mscorlib/src/System/Globalization/IdnMapping.Windows.cs b/src/mscorlib/src/System/Globalization/IdnMapping.Windows.cs
index 5950a54931..d3f05bb164 100644
--- a/src/mscorlib/src/System/Globalization/IdnMapping.Windows.cs
+++ b/src/mscorlib/src/System/Globalization/IdnMapping.Windows.cs
@@ -11,6 +11,8 @@ namespace System.Globalization
{
private unsafe string GetAsciiCore(char* unicode, int count)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
uint flags = Flags;
// Determine the required length
@@ -39,6 +41,8 @@ namespace System.Globalization
private unsafe string GetAsciiCore(char* unicode, int count, uint flags, char* output, int outputLength)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
int length = Interop.Normaliz.IdnToAscii(flags, new IntPtr(unicode), count, new IntPtr(output), outputLength);
if (length == 0)
{
@@ -50,6 +54,8 @@ namespace System.Globalization
private unsafe string GetUnicodeCore(char* ascii, int count)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
uint flags = Flags;
// Determine the required length
@@ -78,6 +84,8 @@ namespace System.Globalization
private unsafe string GetUnicodeCore(char* ascii, int count, uint flags, char* output, int outputLength)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
int length = Interop.Normaliz.IdnToUnicode(flags, new IntPtr(ascii), count, new IntPtr(output), outputLength);
if (length == 0)
{
diff --git a/src/mscorlib/src/System/Globalization/IdnMapping.cs b/src/mscorlib/src/System/Globalization/IdnMapping.cs
index 8424472751..4320e3abf5 100644
--- a/src/mscorlib/src/System/Globalization/IdnMapping.cs
+++ b/src/mscorlib/src/System/Globalization/IdnMapping.cs
@@ -24,7 +24,9 @@
// RFC 3491 - Nameprep: A Stringprep Profile for Internationalized Domain Names (IDN)
// RFC 3492 - Punycode: A Bootstring encoding of Unicode for Internationalized Domain Names in Applications (IDNA)
+using System.Diagnostics;
using System.Diagnostics.Contracts;
+using System.Text;
namespace System.Globalization
{
@@ -85,6 +87,11 @@ namespace System.Globalization
throw new ArgumentException(SR.Format(SR.Argument_InvalidCharSequence, index + count - 1), nameof(unicode));
}
+ if (GlobalizationMode.Invariant)
+ {
+ return GetAsciiInvariant(unicode, index, count);
+ }
+
unsafe
{
fixed (char* pUnicode = unicode)
@@ -126,6 +133,11 @@ namespace System.Globalization
throw new ArgumentException(SR.Argument_IdnBadPunycode, nameof(ascii));
Contract.EndContractBlock();
+ if (GlobalizationMode.Invariant)
+ {
+ return GetUnicodeInvariant(ascii, index, count);
+ }
+
unsafe
{
fixed (char* pAscii = ascii)
@@ -148,5 +160,739 @@ namespace System.Globalization
{
return (_allowUnassigned ? 100 : 200) + (_useStd3AsciiRules ? 1000 : 2000);
}
+
+ //
+ // Invariant implementation
+ //
+
+ private const char c_delimiter = '-';
+ private const string c_strAcePrefix = "xn--";
+ private const int c_labelLimit = 63; // Not including dots
+ private const int c_defaultNameLimit = 255; // Including dots
+ private const int c_initialN = 0x80;
+ private const int c_maxint = 0x7ffffff;
+ private const int c_initialBias = 72;
+ private const int c_punycodeBase = 36;
+ private const int c_tmin = 1;
+ private const int c_tmax = 26;
+ private const int c_skew = 38;
+ private const int c_damp = 700;
+
+
+ // Legal "dot" separators (i.e: . in www.microsoft.com)
+ private static char[] c_Dots = { '.', '\u3002', '\uFF0E', '\uFF61' };
+
+ private string GetAsciiInvariant(string unicode, int index, int count)
+ {
+ if (index > 0 || count < unicode.Length)
+ {
+ unicode = unicode.Substring(index, count);
+ }
+
+ // Check for ASCII only string, which will be unchanged
+ if (ValidateStd3AndAscii(unicode, UseStd3AsciiRules, true))
+ {
+ return unicode;
+ }
+
+ // Cannot be null terminated (normalization won't help us with this one, and
+ // may have returned false before checking the whole string above)
+ Debug.Assert(count >= 1, "[IdnMapping.GetAscii] Expected 0 length strings to fail before now.");
+ if (unicode[unicode.Length - 1] <= 0x1f)
+ {
+ throw new ArgumentException(SR.Format(SR.Argument_InvalidCharSequence, unicode.Length - 1), nameof(unicode));
+ }
+
+ // Have to correctly IDNA normalize the string and Unassigned flags
+ bool bHasLastDot = (unicode.Length > 0) && IsDot(unicode[unicode.Length - 1]);
+
+ // Make sure we didn't normalize away something after a last dot
+ if ((!bHasLastDot) && unicode.Length > 0 && IsDot(unicode[unicode.Length - 1]))
+ {
+ throw new ArgumentException(SR.Argument_IdnBadLabelSize, nameof(unicode));
+ }
+
+ // May need to check Std3 rules again for non-ascii
+ if (UseStd3AsciiRules)
+ {
+ ValidateStd3AndAscii(unicode, true, false);
+ }
+
+ // Go ahead and encode it
+ return PunycodeEncode(unicode);
+ }
+
+ // See if we're only ASCII
+ static bool ValidateStd3AndAscii(string unicode, bool bUseStd3, bool bCheckAscii)
+ {
+ // If its empty, then its too small
+ if (unicode.Length == 0)
+ throw new ArgumentException(SR.Argument_IdnBadLabelSize, nameof(unicode));
+
+ int iLastDot = -1;
+
+ // Loop the whole string
+ for (int i = 0; i < unicode.Length; i++)
+ {
+ // Aren't allowing control chars (or 7f, but idn tables catch that, they don't catch \0 at end though)
+ if (unicode[i] <= 0x1f)
+ {
+ throw new ArgumentException(SR.Format(SR.Argument_InvalidCharSequence, i ), nameof(unicode));
+ }
+
+ // If its Unicode or a control character, return false (non-ascii)
+ if (bCheckAscii && unicode[i] >= 0x7f)
+ return false;
+
+ // Check for dots
+ if (IsDot(unicode[i]))
+ {
+ // Can't have 2 dots in a row
+ if (i == iLastDot + 1)
+ throw new ArgumentException(SR.Argument_IdnBadLabelSize, nameof(unicode));
+
+ // If its too far between dots then fail
+ if (i - iLastDot > c_labelLimit + 1)
+ throw new ArgumentException(SR.Argument_IdnBadLabelSize, nameof(unicode));
+
+ // If validating Std3, then char before dot can't be - char
+ if (bUseStd3 && i > 0)
+ ValidateStd3(unicode[i - 1], true);
+
+ // Remember where the last dot is
+ iLastDot = i;
+ continue;
+ }
+
+ // If necessary, make sure its a valid std3 character
+ if (bUseStd3)
+ {
+ ValidateStd3(unicode[i], (i == iLastDot + 1));
+ }
+ }
+
+ // If we never had a dot, then we need to be shorter than the label limit
+ if (iLastDot == -1 && unicode.Length > c_labelLimit)
+ throw new ArgumentException(SR.Argument_IdnBadLabelSize, nameof(unicode));
+
+ // Need to validate entire string length, 1 shorter if last char wasn't a dot
+ if (unicode.Length > c_defaultNameLimit - (IsDot(unicode[unicode.Length - 1]) ? 0 : 1))
+ throw new ArgumentException(SR.Format(SR.Argument_IdnBadNameSize,
+ c_defaultNameLimit - (IsDot(unicode[unicode.Length - 1]) ? 0 : 1)), nameof(unicode));
+
+ // If last char wasn't a dot we need to check for trailing -
+ if (bUseStd3 && !IsDot(unicode[unicode.Length - 1]))
+ ValidateStd3(unicode[unicode.Length - 1], true);
+
+ return true;
+ }
+
+ /* PunycodeEncode() converts Unicode to Punycode. The input */
+ /* is represented as an array of Unicode code points (not code */
+ /* units; surrogate pairs are not allowed), and the output */
+ /* will be represented as an array of ASCII code points. The */
+ /* output string is *not* null-terminated; it will contain */
+ /* zeros if and only if the input contains zeros. (Of course */
+ /* the caller can leave room for a terminator and add one if */
+ /* needed.) The input_length is the number of code points in */
+ /* the input. The output_length is an in/out argument: the */
+ /* caller passes in the maximum number of code points that it */
+
+ /* can receive, and on successful return it will contain the */
+ /* number of code points actually output. The case_flags array */
+ /* holds input_length boolean values, where nonzero suggests that */
+ /* the corresponding Unicode character be forced to uppercase */
+ /* after being decoded (if possible), and zero suggests that */
+ /* it be forced to lowercase (if possible). ASCII code points */
+ /* are encoded literally, except that ASCII letters are forced */
+ /* to uppercase or lowercase according to the corresponding */
+ /* uppercase flags. If case_flags is a null pointer then ASCII */
+ /* letters are left as they are, and other code points are */
+ /* treated as if their uppercase flags were zero. The return */
+ /* value can be any of the punycode_status values defined above */
+ /* except punycode_bad_input; if not punycode_success, then */
+ /* output_size and output might contain garbage. */
+ static string PunycodeEncode(string unicode)
+ {
+ // 0 length strings aren't allowed
+ if (unicode.Length == 0)
+ throw new ArgumentException(SR.Argument_IdnBadLabelSize, nameof(unicode));
+
+ StringBuilder output = new StringBuilder(unicode.Length);
+ int iNextDot = 0;
+ int iAfterLastDot = 0;
+ int iOutputAfterLastDot = 0;
+
+ // Find the next dot
+ while (iNextDot < unicode.Length)
+ {
+ // Find end of this segment
+ iNextDot = unicode.IndexOfAny(c_Dots, iAfterLastDot);
+ Contract.Assert(iNextDot <= unicode.Length, "[IdnMapping.punycode_encode]IndexOfAny is broken");
+ if (iNextDot < 0)
+ iNextDot = unicode.Length;
+
+ // Only allowed to have empty . section at end (www.microsoft.com.)
+ if (iNextDot == iAfterLastDot)
+ {
+ // Only allowed to have empty sections as trailing .
+ if (iNextDot != unicode.Length)
+ throw new ArgumentException(SR.Argument_IdnBadLabelSize, nameof(unicode));
+ // Last dot, stop
+ break;
+ }
+
+ // We'll need an Ace prefix
+ output.Append(c_strAcePrefix);
+
+ // Everything resets every segment.
+ bool bRightToLeft = false;
+
+ // Check for RTL. If right-to-left, then 1st & last chars must be RTL
+ BidiCategory eBidi = CharUnicodeInfo.GetBidiCategory(unicode, iAfterLastDot);
+ if (eBidi == BidiCategory.RightToLeft || eBidi == BidiCategory.RightToLeftArabic)
+ {
+ // It has to be right to left.
+ bRightToLeft = true;
+
+ // Check last char
+ int iTest = iNextDot - 1;
+ if (Char.IsLowSurrogate(unicode, iTest))
+ {
+ iTest--;
+ }
+
+ eBidi = CharUnicodeInfo.GetBidiCategory(unicode, iTest);
+ if (eBidi != BidiCategory.RightToLeft && eBidi != BidiCategory.RightToLeftArabic)
+ {
+ // Oops, last wasn't RTL, last should be RTL if first is RTL
+ throw new ArgumentException(SR.Argument_IdnBadBidi, nameof(unicode));
+ }
+ }
+
+ // Handle the basic code points
+ int basicCount;
+ int numProcessed = 0; // Num code points that have been processed so far (this segment)
+ for (basicCount = iAfterLastDot; basicCount < iNextDot; basicCount++)
+ {
+ // Can't be lonely surrogate because it would've thrown in normalization
+ Debug.Assert(Char.IsLowSurrogate(unicode, basicCount) == false, "[IdnMapping.punycode_encode]Unexpected low surrogate");
+
+ // Double check our bidi rules
+ BidiCategory testBidi = CharUnicodeInfo.GetBidiCategory(unicode, basicCount);
+
+ // If we're RTL, we can't have LTR chars
+ if (bRightToLeft && testBidi == BidiCategory.LeftToRight)
+ {
+ // Oops, throw error
+ throw new ArgumentException(SR.Argument_IdnBadBidi, nameof(unicode));
+ }
+
+ // If we're not RTL we can't have RTL chars
+ if (!bRightToLeft && (testBidi == BidiCategory.RightToLeft || testBidi == BidiCategory.RightToLeftArabic))
+ {
+ // Oops, throw error
+ throw new ArgumentException(SR.Argument_IdnBadBidi, nameof(unicode));
+ }
+
+ // If its basic then add it
+ if (Basic(unicode[basicCount]))
+ {
+ output.Append(EncodeBasic(unicode[basicCount]));
+ numProcessed++;
+ }
+ // If its a surrogate, skip the next since our bidi category tester doesn't handle it.
+ else if (Char.IsSurrogatePair(unicode, basicCount))
+ basicCount++;
+ }
+
+ int numBasicCodePoints = numProcessed; // number of basic code points
+
+ // Stop if we ONLY had basic code points
+ if (numBasicCodePoints == iNextDot - iAfterLastDot)
+ {
+ // Get rid of xn-- and this segments done
+ output.Remove(iOutputAfterLastDot, c_strAcePrefix.Length);
+ }
+ else
+ {
+ // If it has some non-basic code points the input cannot start with xn--
+ if (unicode.Length - iAfterLastDot >= c_strAcePrefix.Length &&
+ unicode.Substring(iAfterLastDot, c_strAcePrefix.Length).Equals(
+ c_strAcePrefix, StringComparison.OrdinalIgnoreCase))
+ throw new ArgumentException(SR.Argument_IdnBadPunycode, nameof(unicode));
+
+ // Need to do ACE encoding
+ int numSurrogatePairs = 0; // number of surrogate pairs so far
+
+ // Add a delimiter (-) if we had any basic code points (between basic and encoded pieces)
+ if (numBasicCodePoints > 0)
+ {
+ output.Append(c_delimiter);
+ }
+
+ // Initialize the state
+ int n = c_initialN;
+ int delta = 0;
+ int bias = c_initialBias;
+
+ // Main loop
+ while (numProcessed < (iNextDot - iAfterLastDot))
+ {
+ /* All non-basic code points < n have been */
+ /* handled already. Find the next larger one: */
+ int j;
+ int m;
+ int test = 0;
+ for (m = c_maxint, j = iAfterLastDot;
+ j < iNextDot;
+ j += IsSupplementary(test) ? 2 : 1)
+ {
+ test = Char.ConvertToUtf32(unicode, j);
+ if (test >= n && test < m) m = test;
+ }
+
+ /* Increase delta enough to advance the decoder's */
+ /* <n,i> state to <m,0>, but guard against overflow: */
+ delta += (int)((m - n) * ((numProcessed - numSurrogatePairs) + 1));
+ Debug.Assert(delta > 0, "[IdnMapping.cs]1 punycode_encode - delta overflowed int");
+ n = m;
+
+ for (j = iAfterLastDot; j < iNextDot; j+= IsSupplementary(test) ? 2 : 1)
+ {
+ // Make sure we're aware of surrogates
+ test = Char.ConvertToUtf32(unicode, j);
+
+ // Adjust for character position (only the chars in our string already, some
+ // haven't been processed.
+
+ if (test < n)
+ {
+ delta++;
+ Contract.Assert(delta > 0, "[IdnMapping.cs]2 punycode_encode - delta overflowed int");
+ }
+
+ if (test == n)
+ {
+ // Represent delta as a generalized variable-length integer:
+ int q, k;
+ for (q = delta, k = c_punycodeBase; ; k += c_punycodeBase)
+ {
+ int t = k <= bias ? c_tmin : k >= bias + c_tmax ? c_tmax : k - bias;
+ if (q < t) break;
+ Debug.Assert(c_punycodeBase != t, "[IdnMapping.punycode_encode]Expected c_punycodeBase (36) to be != t");
+ output.Append(EncodeDigit(t + (q - t) % (c_punycodeBase - t)));
+ q = (q - t) / (c_punycodeBase - t);
+ }
+
+ output.Append(EncodeDigit(q));
+ bias = Adapt(delta, (numProcessed - numSurrogatePairs) + 1, numProcessed == numBasicCodePoints);
+ delta = 0;
+ numProcessed++;
+
+ if (IsSupplementary(m))
+ {
+ numProcessed++;
+ numSurrogatePairs++;
+ }
+ }
+ }
+ ++delta;
+ ++n;
+ Debug.Assert(delta > 0, "[IdnMapping.cs]3 punycode_encode - delta overflowed int");
+ }
+ }
+
+ // Make sure its not too big
+ if (output.Length - iOutputAfterLastDot > c_labelLimit)
+ throw new ArgumentException(SR.Argument_IdnBadLabelSize, nameof(unicode));
+
+ // Done with this segment, add dot if necessary
+ if (iNextDot != unicode.Length)
+ output.Append('.');
+
+ iAfterLastDot = iNextDot + 1;
+ iOutputAfterLastDot = output.Length;
+ }
+
+ // Throw if we're too long
+ if (output.Length > c_defaultNameLimit - (IsDot(unicode[unicode.Length-1]) ? 0 : 1))
+ throw new ArgumentException(SR.Format(SR.Argument_IdnBadNameSize,
+ c_defaultNameLimit - (IsDot(unicode[unicode.Length-1]) ? 0 : 1)), nameof(unicode));
+ // Return our output string
+ return output.ToString();
+ }
+
+ // Is it a dot?
+ // are we U+002E (., full stop), U+3002 (ideographic full stop), U+FF0E (fullwidth full stop), or
+ // U+FF61 (halfwidth ideographic full stop).
+ // Note: IDNA Normalization gets rid of dots now, but testing for last dot is before normalization
+ private static bool IsDot(char c)
+ {
+ return c == '.' || c == '\u3002' || c == '\uFF0E' || c == '\uFF61';
+ }
+
+ private static bool IsSupplementary(int cTest)
+ {
+ return cTest >= 0x10000;
+ }
+
+ private static bool Basic(uint cp)
+ {
+ // Is it in ASCII range?
+ return cp < 0x80;
+ }
+
+ // Validate Std3 rules for a character
+ private static void ValidateStd3(char c, bool bNextToDot)
+ {
+ // Check for illegal characters
+ if ((c <= ',' || c == '/' || (c >= ':' && c <= '@') || // Lots of characters not allowed
+ (c >= '[' && c <= '`') || (c >= '{' && c <= (char)0x7F)) ||
+ (c == '-' && bNextToDot))
+ throw new ArgumentException(SR.Format(SR.Argument_IdnBadStd3, c), nameof(c));
+ }
+
+ private string GetUnicodeInvariant(string ascii, int index, int count)
+ {
+ if (index > 0 || count < ascii.Length)
+ {
+ // We're only using part of the string
+ ascii = ascii.Substring(index, count);
+ }
+ // Convert Punycode to Unicode
+ string strUnicode = PunycodeDecode(ascii);
+
+ // Output name MUST obey IDNA rules & round trip (casing differences are allowed)
+ if (!ascii.Equals(GetAscii(strUnicode), StringComparison.OrdinalIgnoreCase))
+ throw new ArgumentException(SR.Argument_IdnIllegalName, nameof(ascii));
+
+ return strUnicode;
+ }
+
+ /* PunycodeDecode() converts Punycode to Unicode. The input is */
+ /* represented as an array of ASCII code points, and the output */
+ /* will be represented as an array of Unicode code points. The */
+ /* input_length is the number of code points in the input. The */
+ /* output_length is an in/out argument: the caller passes in */
+ /* the maximum number of code points that it can receive, and */
+ /* on successful return it will contain the actual number of */
+ /* code points output. The case_flags array needs room for at */
+ /* least output_length values, or it can be a null pointer if the */
+ /* case information is not needed. A nonzero flag suggests that */
+ /* the corresponding Unicode character be forced to uppercase */
+ /* by the caller (if possible), while zero suggests that it be */
+ /* forced to lowercase (if possible). ASCII code points are */
+ /* output already in the proper case, but their flags will be set */
+ /* appropriately so that applying the flags would be harmless. */
+ /* The return value can be any of the punycode_status values */
+ /* defined above; if not punycode_success, then output_length, */
+ /* output, and case_flags might contain garbage. On success, the */
+ /* decoder will never need to write an output_length greater than */
+ /* input_length, because of how the encoding is defined. */
+
+ private static string PunycodeDecode(string ascii)
+ {
+ // 0 length strings aren't allowed
+ if (ascii.Length == 0)
+ throw new ArgumentException(SR.Argument_IdnBadLabelSize, nameof(ascii));
+
+ // Throw if we're too long
+ if (ascii.Length > c_defaultNameLimit - (IsDot(ascii[ascii.Length-1]) ? 0 : 1))
+ throw new ArgumentException(SR.Format(SR.Argument_IdnBadNameSize,
+ c_defaultNameLimit - (IsDot(ascii[ascii.Length-1]) ? 0 : 1)), nameof(ascii));
+
+ // output stringbuilder
+ StringBuilder output = new StringBuilder(ascii.Length);
+
+ // Dot searching
+ int iNextDot = 0;
+ int iAfterLastDot = 0;
+ int iOutputAfterLastDot = 0;
+
+ while (iNextDot < ascii.Length)
+ {
+ // Find end of this segment
+ iNextDot = ascii.IndexOf('.', iAfterLastDot);
+ if (iNextDot < 0 || iNextDot > ascii.Length)
+ iNextDot = ascii.Length;
+
+ // Only allowed to have empty . section at end (www.microsoft.com.)
+ if (iNextDot == iAfterLastDot)
+ {
+ // Only allowed to have empty sections as trailing .
+ if (iNextDot != ascii.Length)
+ throw new ArgumentException(SR.Argument_IdnBadLabelSize, nameof(ascii));
+
+ // Last dot, stop
+ break;
+ }
+
+ // In either case it can't be bigger than segment size
+ if (iNextDot - iAfterLastDot > c_labelLimit)
+ throw new ArgumentException(SR.Argument_IdnBadLabelSize, nameof(ascii));
+
+ // See if this section's ASCII or ACE
+ if (ascii.Length < c_strAcePrefix.Length + iAfterLastDot ||
+ !ascii.Substring(iAfterLastDot,c_strAcePrefix.Length).Equals(c_strAcePrefix, StringComparison.OrdinalIgnoreCase))
+ {
+ // Its ASCII, copy it
+ output.Append(ascii.Substring(iAfterLastDot, iNextDot - iAfterLastDot));
+ }
+ else
+ {
+ // Not ASCII, bump up iAfterLastDot to be after ACE Prefix
+ iAfterLastDot += c_strAcePrefix.Length;
+
+ // Get number of basic code points (where delimiter is)
+ // numBasicCodePoints < 0 if there're no basic code points
+ int iTemp = ascii.LastIndexOf(c_delimiter, iNextDot - 1);
+
+ // Trailing - not allowed
+ if (iTemp == iNextDot - 1)
+ throw new ArgumentException(SR.Argument_IdnBadPunycode, nameof(ascii));
+
+ int numBasicCodePoints;
+ if (iTemp <= iAfterLastDot)
+ numBasicCodePoints = 0;
+ else
+ {
+ numBasicCodePoints = iTemp - iAfterLastDot;
+
+ // Copy all the basic code points, making sure they're all in the allowed range,
+ // and losing the casing for all of them.
+ for (int copyAscii = iAfterLastDot; copyAscii < iAfterLastDot + numBasicCodePoints; copyAscii++)
+ {
+ // Make sure we don't allow unicode in the ascii part
+ if (ascii[copyAscii] > 0x7f)
+ throw new ArgumentException(SR.Argument_IdnBadPunycode, nameof(ascii));
+
+ // When appending make sure they get lower cased
+ output.Append((char)(ascii[copyAscii] >= 'A' && ascii[copyAscii] <='Z' ? ascii[copyAscii] - 'A' + 'a' : ascii[copyAscii]));
+ }
+ }
+
+ // Get ready for main loop. Start at beginning if we didn't have any
+ // basic code points, otherwise start after the -.
+ // asciiIndex will be next character to read from ascii
+ int asciiIndex = iAfterLastDot + (numBasicCodePoints > 0 ? numBasicCodePoints + 1 : 0);
+
+ // initialize our state
+ int n = c_initialN;
+ int bias = c_initialBias;
+ int i = 0;
+
+ int w, k;
+
+ // no Supplementary characters yet
+ int numSurrogatePairs = 0;
+
+ // Main loop, read rest of ascii
+ while (asciiIndex < iNextDot)
+ {
+ /* Decode a generalized variable-length integer into delta, */
+ /* which gets added to i. The overflow checking is easier */
+ /* if we increase i as we go, then subtract off its starting */
+ /* value at the end to obtain delta. */
+ int oldi = i;
+
+ for (w = 1, k = c_punycodeBase; ; k += c_punycodeBase)
+ {
+ // Check to make sure we aren't overrunning our ascii string
+ if (asciiIndex >= iNextDot)
+ throw new ArgumentException(SR.Argument_IdnBadPunycode, nameof(ascii));
+
+ // decode the digit from the next char
+ int digit = DecodeDigit(ascii[asciiIndex++]);
+
+ Debug.Assert(w > 0, "[IdnMapping.punycode_decode]Expected w > 0");
+ if (digit > (c_maxint - i) / w)
+ throw new ArgumentException(SR.Argument_IdnBadPunycode, nameof(ascii));
+
+ i += (int)(digit * w);
+ int t = k <= bias ? c_tmin : k >= bias + c_tmax ? c_tmax : k - bias;
+ if (digit < t)
+ break;
+ Debug.Assert(c_punycodeBase != t, "[IdnMapping.punycode_decode]Expected t != c_punycodeBase (36)");
+ if (w > c_maxint / (c_punycodeBase - t))
+ throw new ArgumentException(SR.Argument_IdnBadPunycode, nameof(ascii));
+ w *= (c_punycodeBase - t);
+ }
+
+ bias = Adapt(i - oldi, (output.Length - iOutputAfterLastDot - numSurrogatePairs) + 1, oldi == 0);
+
+ /* i was supposed to wrap around from output.Length to 0, */
+ /* incrementing n each time, so we'll fix that now: */
+ Debug.Assert((output.Length - iOutputAfterLastDot - numSurrogatePairs) + 1 > 0,
+ "[IdnMapping.punycode_decode]Expected to have added > 0 characters this segment");
+ if (i / ((output.Length - iOutputAfterLastDot - numSurrogatePairs) + 1) > c_maxint - n)
+ throw new ArgumentException(SR.Argument_IdnBadPunycode, nameof(ascii));
+ n += (int)(i / (output.Length - iOutputAfterLastDot - numSurrogatePairs + 1));
+ i %= (output.Length - iOutputAfterLastDot - numSurrogatePairs + 1);
+
+ // Make sure n is legal
+ if ((n < 0 || n > 0x10ffff) || (n >= 0xD800 && n <= 0xDFFF))
+ throw new ArgumentException(SR.Argument_IdnBadPunycode, nameof(ascii));
+
+ // insert n at position i of the output: Really tricky if we have surrogates
+ int iUseInsertLocation;
+ String strTemp = Char.ConvertFromUtf32(n);
+
+ // If we have supplimentary characters
+ if (numSurrogatePairs > 0)
+ {
+ // Hard way, we have supplimentary characters
+ int iCount;
+ for (iCount = i, iUseInsertLocation = iOutputAfterLastDot; iCount > 0; iCount--, iUseInsertLocation++)
+ {
+ // If its a surrogate, we have to go one more
+ if (iUseInsertLocation >= output.Length)
+ throw new ArgumentException(SR.Argument_IdnBadPunycode, nameof(ascii));
+ if (Char.IsSurrogate(output[iUseInsertLocation]))
+ iUseInsertLocation++;
+ }
+ }
+ else
+ {
+ // No Supplementary chars yet, just add i
+ iUseInsertLocation = iOutputAfterLastDot + i;
+ }
+
+ // Insert it
+ output.Insert(iUseInsertLocation, strTemp);
+
+ // If it was a surrogate increment our counter
+ if (IsSupplementary(n))
+ numSurrogatePairs++;
+
+ // Index gets updated
+ i++;
+ }
+
+ // Do BIDI testing
+ bool bRightToLeft = false;
+
+ // Check for RTL. If right-to-left, then 1st & last chars must be RTL
+ BidiCategory eBidi = CharUnicodeInfo.GetBidiCategory(output.ToString(), iOutputAfterLastDot);
+ if (eBidi == BidiCategory.RightToLeft || eBidi == BidiCategory.RightToLeftArabic)
+ {
+ // It has to be right to left.
+ bRightToLeft = true;
+ }
+
+ // Check the rest of them to make sure RTL/LTR is consistent
+ for (int iTest = iOutputAfterLastDot; iTest < output.Length; iTest++)
+ {
+ // This might happen if we run into a pair
+ if (Char.IsLowSurrogate(output.ToString(), iTest))
+ continue;
+
+ // Check to see if its LTR
+ eBidi = CharUnicodeInfo.GetBidiCategory(output.ToString(), iTest);
+ if ((bRightToLeft && eBidi == BidiCategory.LeftToRight) ||
+ (!bRightToLeft && (eBidi == BidiCategory.RightToLeft || eBidi == BidiCategory.RightToLeftArabic)))
+ throw new ArgumentException(SR.Argument_IdnBadBidi, nameof(ascii));
+ }
+
+ // Its also a requirement that the last one be RTL if 1st is RTL
+ if (bRightToLeft && eBidi != BidiCategory.RightToLeft && eBidi != BidiCategory.RightToLeftArabic)
+ {
+ // Oops, last wasn't RTL, last should be RTL if first is RTL
+ throw new ArgumentException(SR.Argument_IdnBadBidi, nameof(ascii));
+ }
+ }
+
+ // See if this label was too long
+ if (iNextDot - iAfterLastDot > c_labelLimit)
+ throw new ArgumentException(SR.Argument_IdnBadLabelSize, nameof(ascii));
+
+ // Done with this segment, add dot if necessary
+ if (iNextDot != ascii.Length)
+ output.Append('.');
+
+ iAfterLastDot = iNextDot + 1;
+ iOutputAfterLastDot = output.Length;
+ }
+
+ // Throw if we're too long
+ if (output.Length > c_defaultNameLimit - (IsDot(output[output.Length-1]) ? 0 : 1))
+ throw new ArgumentException(SR.Format(SR.Argument_IdnBadNameSize, c_defaultNameLimit - (IsDot(output[output.Length-1]) ? 0 : 1)), nameof(ascii));
+
+ // Return our output string
+ return output.ToString();
+ }
+
+ // DecodeDigit(cp) returns the numeric value of a basic code */
+ // point (for use in representing integers) in the range 0 to */
+ // c_punycodeBase-1, or <0 if cp is does not represent a value. */
+
+ private static int DecodeDigit(char cp)
+ {
+ if (cp >= '0' && cp <= '9')
+ return cp - '0' + 26;
+
+ // Two flavors for case differences
+ if (cp >= 'a' && cp <= 'z')
+ return cp - 'a';
+
+ if (cp >= 'A' && cp <= 'Z')
+ return cp - 'A';
+
+ // Expected 0-9, A-Z or a-z, everything else is illegal
+ throw new ArgumentException(SR.Argument_IdnBadPunycode, nameof(cp));
+ }
+
+ private static int Adapt(int delta, int numpoints, bool firsttime)
+ {
+ uint k;
+
+ delta = firsttime ? delta / c_damp : delta / 2;
+ Debug.Assert(numpoints != 0, "[IdnMapping.adapt]Expected non-zero numpoints.");
+ delta += delta / numpoints;
+
+ for (k = 0; delta > ((c_punycodeBase - c_tmin) * c_tmax) / 2; k += c_punycodeBase)
+ {
+ delta /= c_punycodeBase - c_tmin;
+ }
+
+ Debug.Assert(delta + c_skew != 0, "[IdnMapping.adapt]Expected non-zero delta+skew.");
+ return (int)(k + (c_punycodeBase - c_tmin + 1) * delta / (delta + c_skew));
+ }
+
+ /* EncodeBasic(bcp,flag) forces a basic code point to lowercase */
+ /* if flag is false, uppercase if flag is true, and returns */
+ /* the resulting code point. The code point is unchanged if it */
+ /* is caseless. The behavior is undefined if bcp is not a basic */
+ /* code point. */
+
+ static char EncodeBasic(char bcp)
+ {
+ if (HasUpperCaseFlag(bcp))
+ bcp += (char)('a' - 'A');
+
+ return bcp;
+ }
+
+ // Return whether a punycode code point is flagged as being upper case.
+ private static bool HasUpperCaseFlag(char punychar)
+ {
+ return (punychar >= 'A' && punychar <= 'Z');
+ }
+
+ /* EncodeDigit(d,flag) returns the basic code point whose value */
+ /* (when used for representing integers) is d, which needs to be in */
+ /* the range 0 to punycodeBase-1. The lowercase form is used unless flag is */
+ /* true, in which case the uppercase form is used. */
+
+ private static char EncodeDigit(int d)
+ {
+ Debug.Assert(d >= 0 && d < c_punycodeBase, "[IdnMapping.encode_digit]Expected 0 <= d < punycodeBase");
+ // 26-35 map to ASCII 0-9
+ if (d > 25) return (char)(d - 26 + '0');
+
+ // 0-25 map to a-z or A-Z
+ return (char)(d + 'a');
+ }
+
}
}
diff --git a/src/mscorlib/src/System/Globalization/JapaneseCalendar.Unix.cs b/src/mscorlib/src/System/Globalization/JapaneseCalendar.Unix.cs
index b9bd94af6e..51ff8095a3 100644
--- a/src/mscorlib/src/System/Globalization/JapaneseCalendar.Unix.cs
+++ b/src/mscorlib/src/System/Globalization/JapaneseCalendar.Unix.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
+using System.Diagnostics;
namespace System.Globalization
{
@@ -10,6 +11,11 @@ namespace System.Globalization
{
private static EraInfo[] GetJapaneseEras()
{
+ if (GlobalizationMode.Invariant)
+ {
+ return null;
+ }
+
string[] eraNames;
if (!CalendarData.EnumCalendarInfo("ja-JP", CalendarId.JAPAN, CalendarDataType.EraNames, out eraNames))
{
@@ -66,6 +72,8 @@ namespace System.Globalization
private static bool GetJapaneseEraStartDate(int era, out DateTime dateTime)
{
+ Debug.Assert(!GlobalizationMode.Invariant);
+
dateTime = default(DateTime);
int startYear;
diff --git a/src/mscorlib/src/System/Globalization/TextInfo.Unix.cs b/src/mscorlib/src/System/Globalization/TextInfo.Unix.cs
index 67836d89d6..f7f64c684a 100644
--- a/src/mscorlib/src/System/Globalization/TextInfo.Unix.cs
+++ b/src/mscorlib/src/System/Globalization/TextInfo.Unix.cs
@@ -14,27 +14,14 @@ namespace System.Globalization
[NonSerialized]
private Tristate _needsTurkishCasing = Tristate.NotInitialized;
- //////////////////////////////////////////////////////////////////////////
- ////
- //// TextInfo Constructors
- ////
- //// Implements CultureInfo.TextInfo.
- ////
- //////////////////////////////////////////////////////////////////////////
- internal unsafe TextInfo(CultureData cultureData)
- {
- _cultureData = cultureData;
- _cultureName = _cultureData.CultureName;
- _textInfoName = _cultureData.STEXTINFO;
- FinishInitialization(_textInfoName);
- }
-
private void FinishInitialization(string textInfoName)
{
}
private unsafe string ChangeCase(string s, bool toUpper)
{
+ Debug.Assert(!_invariantMode);
+
Debug.Assert(s != null);
if (s.Length == 0)
@@ -79,6 +66,8 @@ namespace System.Globalization
private unsafe char ChangeCase(char c, bool toUpper)
{
+ Debug.Assert(!_invariantMode);
+
char dst = default(char);
ChangeCase(&c, 1, &dst, 1, toUpper);
@@ -101,6 +90,8 @@ namespace System.Globalization
internal unsafe void ChangeCase(char* src, int srcLen, char* dstBuffer, int dstBufferCapacity, bool bToUpper)
{
+ Debug.Assert(!_invariantMode);
+
if (IsInvariant)
{
Interop.GlobalizationInterop.ChangeCaseInvariant(src, srcLen, dstBuffer, dstBufferCapacity, bToUpper);
diff --git a/src/mscorlib/src/System/Globalization/TextInfo.Windows.cs b/src/mscorlib/src/System/Globalization/TextInfo.Windows.cs
index 052e95a772..cc7c4df1da 100644
--- a/src/mscorlib/src/System/Globalization/TextInfo.Windows.cs
+++ b/src/mscorlib/src/System/Globalization/TextInfo.Windows.cs
@@ -8,24 +8,14 @@ namespace System.Globalization
{
public partial class TextInfo
{
- //////////////////////////////////////////////////////////////////////////
- ////
- //// TextInfo Constructors
- ////
- //// Implements CultureInfo.TextInfo.
- ////
- //////////////////////////////////////////////////////////////////////////
- internal unsafe TextInfo(CultureData cultureData)
- {
- // This is our primary data source, we don't need most of the rest of this
- _cultureData = cultureData;
- _cultureName = _cultureData.CultureName;
- _textInfoName = _cultureData.STEXTINFO;
- FinishInitialization(_textInfoName);
- }
-
private unsafe void FinishInitialization(string textInfoName)
{
+ if (_invariantMode)
+ {
+ _sortHandle = IntPtr.Zero;
+ return;
+ }
+
const uint LCMAP_SORTHANDLE = 0x20000000;
long handle;
@@ -35,6 +25,8 @@ namespace System.Globalization
private unsafe string ChangeCase(string s, bool toUpper)
{
+ Debug.Assert(!_invariantMode);
+
Debug.Assert(s != null);
//
@@ -49,44 +41,44 @@ namespace System.Globalization
{
return s;
}
- else
+
+ int ret;
+
+ // Check for Invariant to avoid A/V in LCMapStringEx
+ uint linguisticCasing = IsInvariantLocale(_textInfoName) ? 0 : LCMAP_LINGUISTIC_CASING;
+
+ //
+ // Create the result string.
+ //
+ string result = string.FastAllocateString(nLengthInput);
+
+ fixed (char* pSource = s)
+ fixed (char* pResult = result)
+ {
+ ret = Interop.Kernel32.LCMapStringEx(_sortHandle != IntPtr.Zero ? null : _textInfoName,
+ linguisticCasing | (toUpper ? LCMAP_UPPERCASE : LCMAP_LOWERCASE),
+ pSource,
+ nLengthInput,
+ pResult,
+ nLengthInput,
+ null,
+ null,
+ _sortHandle);
+ }
+
+ if (ret == 0)
{
- int ret;
-
- // Check for Invariant to avoid A/V in LCMapStringEx
- uint linguisticCasing = IsInvariantLocale(_textInfoName) ? 0 : LCMAP_LINGUISTIC_CASING;
-
- //
- // Create the result string.
- //
- string result = string.FastAllocateString(nLengthInput);
-
- fixed (char* pSource = s)
- fixed (char* pResult = result)
- {
- ret = Interop.Kernel32.LCMapStringEx(_sortHandle != IntPtr.Zero ? null : _textInfoName,
- toUpper ? LCMAP_UPPERCASE | linguisticCasing : LCMAP_LOWERCASE | linguisticCasing,
- pSource,
- nLengthInput,
- pResult,
- nLengthInput,
- null,
- null,
- _sortHandle);
- }
-
- if (0 == ret)
- {
- throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
- }
-
- Debug.Assert(ret == nLengthInput, "Expected getting the same length of the original string");
- return result;
+ throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
}
+
+ Debug.Assert(ret == nLengthInput, "Expected getting the same length of the original string");
+ return result;
}
private unsafe char ChangeCase(char c, bool toUpper)
{
+ Debug.Assert(!_invariantMode);
+
char retVal = '\0';
// Check for Invariant to avoid A/V in LCMapStringEx
diff --git a/src/mscorlib/src/System/Globalization/TextInfo.cs b/src/mscorlib/src/System/Globalization/TextInfo.cs
index 00a416ef09..fecd2b2970 100644
--- a/src/mscorlib/src/System/Globalization/TextInfo.cs
+++ b/src/mscorlib/src/System/Globalization/TextInfo.cs
@@ -61,6 +61,10 @@ namespace System.Globalization
[NonSerialized]
private Tristate _isAsciiCasingSameAsInvariant = Tristate.NotInitialized;
+ // _invariantMode is defined for the perf reason as accessing the instance field is faster than access the static property GlobalizationMode.Invariant
+ [NonSerialized]
+ private readonly bool _invariantMode = GlobalizationMode.Invariant;
+
// Invariant text info
internal static TextInfo Invariant
{
@@ -73,6 +77,22 @@ namespace System.Globalization
}
internal volatile static TextInfo s_Invariant;
+ //////////////////////////////////////////////////////////////////////////
+ ////
+ //// TextInfo Constructors
+ ////
+ //// Implements CultureInfo.TextInfo.
+ ////
+ //////////////////////////////////////////////////////////////////////////
+ internal unsafe TextInfo(CultureData cultureData)
+ {
+ // This is our primary data source, we don't need most of the rest of this
+ _cultureData = cultureData;
+ _cultureName = _cultureData.CultureName;
+ _textInfoName = _cultureData.STEXTINFO;
+ FinishInitialization(_textInfoName);
+ }
+
[OnSerializing]
private void OnSerializing(StreamingContext ctx) { }
@@ -126,7 +146,7 @@ namespace System.Globalization
return -1;
}
- return CompareInfo.IndexOfOrdinal(source, value, startIndex, count, ignoreCase: true);
+ return CultureInfo.InvariantCulture.CompareInfo.IndexOfOrdinal(source, value, startIndex, count, ignoreCase: true);
}
// Currently we don't have native functions to do this, so we do it the hard way
@@ -137,7 +157,7 @@ namespace System.Globalization
return -1;
}
- return CompareInfo.LastIndexOfOrdinal(source, value, startIndex, count, ignoreCase: true);
+ return CultureInfo.InvariantCulture.CompareInfo.LastIndexOfOrdinal(source, value, startIndex, count, ignoreCase: true);
}
////////////////////////////////////////////////////////////////////////
@@ -311,10 +331,11 @@ namespace System.Globalization
////////////////////////////////////////////////////////////////////////
public unsafe virtual char ToLower(char c)
{
- if (IsAscii(c) && IsAsciiCasingSameAsInvariant)
+ if (_invariantMode || (IsAscii(c) && IsAsciiCasingSameAsInvariant))
{
return ToLowerAsciiInvariant(c);
}
+
return (ChangeCase(c, toUpper: false));
}
@@ -322,9 +343,106 @@ namespace System.Globalization
{
if (str == null) { throw new ArgumentNullException(nameof(str)); }
+ if (_invariantMode)
+ {
+ return ToLowerAsciiInvariant(str);
+ }
+
return ChangeCase(str, toUpper: false);
}
+ private unsafe string ToLowerAsciiInvariant(string s)
+ {
+ if (s.Length == 0)
+ {
+ return string.Empty;
+ }
+
+ fixed (char* pSource = s)
+ {
+ int i = 0;
+ while (i < s.Length)
+ {
+ if ((uint)(pSource[i] - 'A') <= (uint)('Z' - 'A'))
+ {
+ break;
+ }
+ i++;
+ }
+
+ if (i >= s.Length)
+ {
+ return s;
+ }
+
+ string result = string.FastAllocateString(s.Length);
+ fixed (char* pResult = result)
+ {
+ for (int j = 0; j < i; j++)
+ {
+ pResult[j] = pSource[j];
+ }
+
+ pResult[i] = (Char)(pSource[i] | 0x20);
+ i++;
+
+ while (i < s.Length)
+ {
+ pResult[i] = ToLowerAsciiInvariant(pSource[i]);
+ i++;
+ }
+ }
+
+ return result;
+ }
+ }
+
+ private unsafe string ToUpperAsciiInvariant(string s)
+ {
+ if (s.Length == 0)
+ {
+ return string.Empty;
+ }
+
+ fixed (char* pSource = s)
+ {
+ int i = 0;
+ while (i < s.Length)
+ {
+ if ((uint)(pSource[i] - 'a') <= (uint)('z' - 'a'))
+ {
+ break;
+ }
+ i++;
+ }
+
+ if (i >= s.Length)
+ {
+ return s;
+ }
+
+ string result = string.FastAllocateString(s.Length);
+ fixed (char* pResult = result)
+ {
+ for (int j = 0; j < i; j++)
+ {
+ pResult[j] = pSource[j];
+ }
+
+ pResult[i] = (char)(pSource[i] & ~0x20);
+ i++;
+
+ while (i < s.Length)
+ {
+ pResult[i] = ToUpperAsciiInvariant(pSource[i]);
+ i++;
+ }
+ }
+
+ return result;
+ }
+ }
+
private static Char ToLowerAsciiInvariant(Char c)
{
if ((uint)(c - 'A') <= (uint)('Z' - 'A'))
@@ -344,10 +462,11 @@ namespace System.Globalization
////////////////////////////////////////////////////////////////////////
public unsafe virtual char ToUpper(char c)
{
- if (IsAscii(c) && IsAsciiCasingSameAsInvariant)
+ if (_invariantMode || (IsAscii(c) && IsAsciiCasingSameAsInvariant))
{
return ToUpperAsciiInvariant(c);
}
+
return (ChangeCase(c, toUpper: true));
}
@@ -355,6 +474,11 @@ namespace System.Globalization
{
if (str == null) { throw new ArgumentNullException(nameof(str)); }
+ if (_invariantMode)
+ {
+ return ToUpperAsciiInvariant(str);
+ }
+
return ChangeCase(str, toUpper: true);
}
@@ -473,6 +597,8 @@ namespace System.Globalization
StringBuilder result = new StringBuilder();
string lowercaseData = null;
+ // Store if the current culture is Dutch (special case)
+ bool isDutchCulture = CultureName.StartsWith("nl-", StringComparison.OrdinalIgnoreCase);
for (int i = 0; i < str.Length; i++)
{
@@ -482,8 +608,18 @@ namespace System.Globalization
charType = CharUnicodeInfo.InternalGetUnicodeCategory(str, i, out charLen);
if (Char.CheckLetter(charType))
{
- // Do the titlecasing for the first character of the word.
- i = AddTitlecaseLetter(ref result, ref str, i, charLen) + 1;
+ // Special case to check for Dutch specific titlecasing with "IJ" characters
+ // at the beginning of a word
+ if (isDutchCulture && i < str.Length - 1 && (str[i] == 'i' || str[i] == 'I') && (str[i+1] == 'j' || str[i+1] == 'J'))
+ {
+ result.Append("IJ");
+ i += 2;
+ }
+ else
+ {
+ // Do the titlecasing for the first character of the word.
+ i = AddTitlecaseLetter(ref result, ref str, i, charLen) + 1;
+ }
//
// Convert the characters until the end of the this word
diff --git a/src/mscorlib/src/System/Globalization/TimeSpanFormat.cs b/src/mscorlib/src/System/Globalization/TimeSpanFormat.cs
index 8011c0b577..ca053eded3 100644
--- a/src/mscorlib/src/System/Globalization/TimeSpanFormat.cs
+++ b/src/mscorlib/src/System/Globalization/TimeSpanFormat.cs
@@ -62,7 +62,7 @@ namespace System.Globalization
return FormatStandard(value, false, format, pattern);
}
- throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ throw new FormatException(SR.Format_InvalidString);
}
return FormatCustomized(value, format, DateTimeFormatInfo.GetInstance(formatProvider));
@@ -191,19 +191,19 @@ namespace System.Globalization
case 'h':
tokenLen = DateTimeFormat.ParseRepeatPattern(format, i, ch);
if (tokenLen > 2)
- throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ throw new FormatException(SR.Format_InvalidString);
DateTimeFormat.FormatDigits(result, hours, tokenLen);
break;
case 'm':
tokenLen = DateTimeFormat.ParseRepeatPattern(format, i, ch);
if (tokenLen > 2)
- throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ throw new FormatException(SR.Format_InvalidString);
DateTimeFormat.FormatDigits(result, minutes, tokenLen);
break;
case 's':
tokenLen = DateTimeFormat.ParseRepeatPattern(format, i, ch);
if (tokenLen > 2)
- throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ throw new FormatException(SR.Format_InvalidString);
DateTimeFormat.FormatDigits(result, seconds, tokenLen);
break;
case 'f':
@@ -212,7 +212,7 @@ namespace System.Globalization
//
tokenLen = DateTimeFormat.ParseRepeatPattern(format, i, ch);
if (tokenLen > DateTimeFormat.MaxSecondsFractionDigits)
- throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ throw new FormatException(SR.Format_InvalidString);
tmp = (long)fraction;
tmp /= (long)Math.Pow(10, DateTimeFormat.MaxSecondsFractionDigits - tokenLen);
@@ -224,7 +224,7 @@ namespace System.Globalization
//
tokenLen = DateTimeFormat.ParseRepeatPattern(format, i, ch);
if (tokenLen > DateTimeFormat.MaxSecondsFractionDigits)
- throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ throw new FormatException(SR.Format_InvalidString);
tmp = (long)fraction;
tmp /= (long)Math.Pow(10, DateTimeFormat.MaxSecondsFractionDigits - tokenLen);
@@ -253,7 +253,7 @@ namespace System.Globalization
//
tokenLen = DateTimeFormat.ParseRepeatPattern(format, i, ch);
if (tokenLen > 8)
- throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ throw new FormatException(SR.Format_InvalidString);
DateTimeFormat.FormatDigits(result, day, tokenLen, true);
break;
case '\'':
@@ -278,7 +278,7 @@ namespace System.Globalization
// This means that '%' is at the end of the format string or
// "%%" appears in the format string.
//
- throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ throw new FormatException(SR.Format_InvalidString);
}
break;
case '\\':
@@ -296,11 +296,11 @@ namespace System.Globalization
//
// This means that '\' is at the end of the formatting string.
//
- throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ throw new FormatException(SR.Format_InvalidString);
}
break;
default:
- throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ throw new FormatException(SR.Format_InvalidString);
}
i += tokenLen;
}
diff --git a/src/mscorlib/src/System/Globalization/TimeSpanParse.cs b/src/mscorlib/src/System/Globalization/TimeSpanParse.cs
index 0be4f2f28d..a29e6c2e29 100644
--- a/src/mscorlib/src/System/Globalization/TimeSpanParse.cs
+++ b/src/mscorlib/src/System/Globalization/TimeSpanParse.cs
@@ -65,7 +65,7 @@ namespace System.Globalization
internal static void ValidateStyles(TimeSpanStyles style, String parameterName)
{
if (style != TimeSpanStyles.None && style != TimeSpanStyles.AssumeNegative)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidTimeSpanStyles"), parameterName);
+ throw new ArgumentException(SR.Argument_InvalidTimeSpanStyles, parameterName);
}
internal const int unlimitedDigits = -1;
@@ -544,20 +544,20 @@ namespace System.Globalization
switch (m_failure)
{
case ParseFailureKind.ArgumentNull:
- return new ArgumentNullException(m_failureArgumentName, Environment.GetResourceString(m_failureMessageID));
+ return new ArgumentNullException(m_failureArgumentName, SR.GetResourceString(m_failureMessageID));
case ParseFailureKind.FormatWithParameter:
- return new FormatException(Environment.GetResourceString(m_failureMessageID, m_failureMessageFormatArgument));
+ return new FormatException(SR.Format(SR.GetResourceString(m_failureMessageID), m_failureMessageFormatArgument));
case ParseFailureKind.Format:
- return new FormatException(Environment.GetResourceString(m_failureMessageID));
+ return new FormatException(SR.GetResourceString(m_failureMessageID));
case ParseFailureKind.Overflow:
- return new OverflowException(Environment.GetResourceString(m_failureMessageID));
+ return new OverflowException(SR.GetResourceString(m_failureMessageID));
default:
Debug.Assert(false, "Unknown TimeSpanParseFailure: " + m_failure);
- return new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ return new FormatException(SR.Format_InvalidString);
}
}
}
diff --git a/src/mscorlib/src/System/Guid.cs b/src/mscorlib/src/System/Guid.cs
index 0d4024b212..f64211d5d0 100644
--- a/src/mscorlib/src/System/Guid.cs
+++ b/src/mscorlib/src/System/Guid.cs
@@ -50,7 +50,7 @@ namespace System
if (b == null)
throw new ArgumentNullException(nameof(b));
if (b.Length != 16)
- throw new ArgumentException(Environment.GetResourceString("Arg_GuidArrayCtor", "16"), nameof(b));
+ throw new ArgumentException(SR.Format(SR.Arg_GuidArrayCtor, "16"), nameof(b));
Contract.EndContractBlock();
_a = ((int)b[3] << 24) | ((int)b[2] << 16) | ((int)b[1] << 8) | b[0];
@@ -91,7 +91,7 @@ namespace System
throw new ArgumentNullException(nameof(d));
// Check that array is not too big
if (d.Length != 8)
- throw new ArgumentException(Environment.GetResourceString("Arg_GuidArrayCtor", "8"), nameof(d));
+ throw new ArgumentException(SR.Format(SR.Arg_GuidArrayCtor, "8"), nameof(d));
Contract.EndContractBlock();
_a = a;
@@ -212,23 +212,23 @@ namespace System
switch (m_failure)
{
case ParseFailureKind.ArgumentNull:
- return new ArgumentNullException(m_failureArgumentName, Environment.GetResourceString(m_failureMessageID));
+ return new ArgumentNullException(m_failureArgumentName, SR.GetResourceString(m_failureMessageID));
case ParseFailureKind.FormatWithInnerException:
- return new FormatException(Environment.GetResourceString(m_failureMessageID), m_innerException);
+ return new FormatException(SR.GetResourceString(m_failureMessageID), m_innerException);
case ParseFailureKind.FormatWithParameter:
- return new FormatException(Environment.GetResourceString(m_failureMessageID, m_failureMessageFormatArgument));
+ return new FormatException(SR.Format(SR.GetResourceString(m_failureMessageID), m_failureMessageFormatArgument));
case ParseFailureKind.Format:
- return new FormatException(Environment.GetResourceString(m_failureMessageID));
+ return new FormatException(SR.GetResourceString(m_failureMessageID));
case ParseFailureKind.NativeException:
return m_innerException;
default:
Debug.Assert(false, "Unknown GuidParseFailure: " + m_failure);
- return new FormatException(Environment.GetResourceString("Format_GuidUnrecognized"));
+ return new FormatException(SR.Format_GuidUnrecognized);
}
}
}
@@ -310,7 +310,7 @@ namespace System
if (format.Length != 1)
{
// all acceptable format strings are of length 1
- throw new FormatException(Environment.GetResourceString("Format_InvalidGuidFormatSpecification"));
+ throw new FormatException(SR.Format_InvalidGuidFormatSpecification);
}
GuidStyles style;
@@ -337,7 +337,7 @@ namespace System
}
else
{
- throw new FormatException(Environment.GetResourceString("Format_InvalidGuidFormatSpecification"));
+ throw new FormatException(SR.Format_InvalidGuidFormatSpecification);
}
GuidResult result = new GuidResult();
@@ -883,7 +883,7 @@ namespace System
}
else if (parseResult.throwStyle == GuidParseThrowStyle.AllButOverflow)
{
- throw new FormatException(Environment.GetResourceString("Format_GuidUnrecognized"), ex);
+ throw new FormatException(SR.Format_GuidUnrecognized, ex);
}
else
{
@@ -935,7 +935,7 @@ namespace System
}
else if (parseResult.throwStyle == GuidParseThrowStyle.AllButOverflow)
{
- throw new FormatException(Environment.GetResourceString("Format_GuidUnrecognized"), ex);
+ throw new FormatException(SR.Format_GuidUnrecognized, ex);
}
else
{
@@ -1110,7 +1110,7 @@ namespace System
}
if (!(value is Guid))
{
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeGuid"), nameof(value));
+ throw new ArgumentException(SR.Arg_MustBeGuid, nameof(value));
}
Guid g = (Guid)value;
@@ -1285,35 +1285,40 @@ namespace System
return ToString(format, null);
}
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
private static char HexToChar(int a)
{
a = a & 0xf;
return (char)((a > 9) ? a - 10 + 0x61 : a + 0x30);
}
- unsafe private static int HexsToChars(char* guidChars, int offset, int a, int b)
+ unsafe private static int HexsToChars(char* guidChars, int a, int b)
{
- return HexsToChars(guidChars, offset, a, b, false);
+ guidChars[0] = HexToChar(a >> 4);
+ guidChars[1] = HexToChar(a);
+
+ guidChars[2] = HexToChar(b >> 4);
+ guidChars[3] = HexToChar(b);
+
+ return 4;
}
- unsafe private static int HexsToChars(char* guidChars, int offset, int a, int b, bool hex)
+ unsafe private static int HexsToCharsHexOutput(char* guidChars, int a, int b)
{
- if (hex)
- {
- guidChars[offset++] = '0';
- guidChars[offset++] = 'x';
- }
- guidChars[offset++] = HexToChar(a >> 4);
- guidChars[offset++] = HexToChar(a);
- if (hex)
- {
- guidChars[offset++] = ',';
- guidChars[offset++] = '0';
- guidChars[offset++] = 'x';
- }
- guidChars[offset++] = HexToChar(b >> 4);
- guidChars[offset++] = HexToChar(b);
- return offset;
+ guidChars[0] = '0';
+ guidChars[1] = 'x';
+
+ guidChars[2] = HexToChar(a >> 4);
+ guidChars[3] = HexToChar(a);
+
+ guidChars[4] = ',';
+ guidChars[5] = '0';
+ guidChars[6] = 'x';
+
+ guidChars[7] = HexToChar(b >> 4);
+ guidChars[8] = HexToChar(b);
+
+ return 9;
}
// IFormattable interface
@@ -1331,7 +1336,7 @@ namespace System
if (format.Length != 1)
{
// all acceptable format strings are of length 1
- throw new FormatException(Environment.GetResourceString("Format_InvalidGuidFormatSpecification"));
+ throw new FormatException(SR.Format_InvalidGuidFormatSpecification);
}
char formatCh = format[0];
@@ -1384,7 +1389,7 @@ namespace System
}
else
{
- throw new FormatException(Environment.GetResourceString("Format_InvalidGuidFormatSpecification"));
+ throw new FormatException(SR.Format_InvalidGuidFormatSpecification);
}
unsafe
@@ -1396,42 +1401,42 @@ namespace System
// {0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}}
guidChars[offset++] = '0';
guidChars[offset++] = 'x';
- offset = HexsToChars(guidChars, offset, _a >> 24, _a >> 16);
- offset = HexsToChars(guidChars, offset, _a >> 8, _a);
+ offset += HexsToChars(guidChars + offset, _a >> 24, _a >> 16);
+ offset += HexsToChars(guidChars + offset, _a >> 8, _a);
guidChars[offset++] = ',';
guidChars[offset++] = '0';
guidChars[offset++] = 'x';
- offset = HexsToChars(guidChars, offset, _b >> 8, _b);
+ offset += HexsToChars(guidChars + offset, _b >> 8, _b);
guidChars[offset++] = ',';
guidChars[offset++] = '0';
guidChars[offset++] = 'x';
- offset = HexsToChars(guidChars, offset, _c >> 8, _c);
+ offset += HexsToChars(guidChars + offset, _c >> 8, _c);
guidChars[offset++] = ',';
guidChars[offset++] = '{';
- offset = HexsToChars(guidChars, offset, _d, _e, true);
+ offset += HexsToCharsHexOutput(guidChars + offset, _d, _e);
guidChars[offset++] = ',';
- offset = HexsToChars(guidChars, offset, _f, _g, true);
+ offset += HexsToCharsHexOutput(guidChars + offset, _f, _g);
guidChars[offset++] = ',';
- offset = HexsToChars(guidChars, offset, _h, _i, true);
+ offset += HexsToCharsHexOutput(guidChars + offset, _h, _i);
guidChars[offset++] = ',';
- offset = HexsToChars(guidChars, offset, _j, _k, true);
+ offset += HexsToCharsHexOutput(guidChars + offset, _j, _k);
guidChars[offset++] = '}';
}
else
{
// [{|(]dddddddd[-]dddd[-]dddd[-]dddd[-]dddddddddddd[}|)]
- offset = HexsToChars(guidChars, offset, _a >> 24, _a >> 16);
- offset = HexsToChars(guidChars, offset, _a >> 8, _a);
+ offset += HexsToChars(guidChars + offset, _a >> 24, _a >> 16);
+ offset += HexsToChars(guidChars + offset, _a >> 8, _a);
if (dash) guidChars[offset++] = '-';
- offset = HexsToChars(guidChars, offset, _b >> 8, _b);
+ offset += HexsToChars(guidChars + offset, _b >> 8, _b);
if (dash) guidChars[offset++] = '-';
- offset = HexsToChars(guidChars, offset, _c >> 8, _c);
+ offset += HexsToChars(guidChars + offset, _c >> 8, _c);
if (dash) guidChars[offset++] = '-';
- offset = HexsToChars(guidChars, offset, _d, _e);
+ offset += HexsToChars(guidChars + offset, _d, _e);
if (dash) guidChars[offset++] = '-';
- offset = HexsToChars(guidChars, offset, _f, _g);
- offset = HexsToChars(guidChars, offset, _h, _i);
- offset = HexsToChars(guidChars, offset, _j, _k);
+ offset += HexsToChars(guidChars + offset, _f, _g);
+ offset += HexsToChars(guidChars + offset, _h, _i);
+ offset += HexsToChars(guidChars + offset, _j, _k);
}
}
}
diff --git a/src/mscorlib/src/System/IO/BinaryReader.cs b/src/mscorlib/src/System/IO/BinaryReader.cs
index 2f81b0072c..cebba6ea98 100644
--- a/src/mscorlib/src/System/IO/BinaryReader.cs
+++ b/src/mscorlib/src/System/IO/BinaryReader.cs
@@ -60,7 +60,7 @@ namespace System.IO
throw new ArgumentNullException(nameof(encoding));
}
if (!input.CanRead)
- throw new ArgumentException(Environment.GetResourceString("Argument_StreamNotReadable"));
+ throw new ArgumentException(SR.Argument_StreamNotReadable);
Contract.EndContractBlock();
m_stream = input;
m_decoder = encoding.GetDecoder();
@@ -264,7 +264,7 @@ namespace System.IO
catch (ArgumentException e)
{
// ReadDecimal cannot leak out ArgumentException
- throw new IOException(Environment.GetResourceString("Arg_DecBitCtor"), e);
+ throw new IOException(SR.Arg_DecBitCtor, e);
}
}
@@ -285,7 +285,7 @@ namespace System.IO
stringLength = Read7BitEncodedInt();
if (stringLength < 0)
{
- throw new IOException(Environment.GetResourceString("IO.IO_InvalidStringLen_Len", stringLength));
+ throw new IOException(SR.Format(SR.IO_InvalidStringLen_Len, stringLength));
}
if (stringLength == 0)
@@ -332,19 +332,19 @@ namespace System.IO
{
if (buffer == null)
{
- throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
}
if (index < 0)
{
- throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (count < 0)
{
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (buffer.Length - index < count)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
}
Contract.Ensures(Contract.Result<int>() >= 0);
Contract.Ensures(Contract.Result<int>() <= count);
@@ -524,7 +524,7 @@ namespace System.IO
{
if (count < 0)
{
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
}
Contract.Ensures(Contract.Result<char[]>() != null);
Contract.Ensures(Contract.Result<char[]>().Length <= count);
@@ -555,13 +555,13 @@ namespace System.IO
public virtual int Read(byte[] buffer, int index, int count)
{
if (buffer == null)
- throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
if (index < 0)
- throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_NeedNonNegNum);
if (count < 0)
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
if (buffer.Length - index < count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
Contract.Ensures(Contract.Result<int>() >= 0);
Contract.Ensures(Contract.Result<int>() <= count);
Contract.EndContractBlock();
@@ -572,7 +572,7 @@ namespace System.IO
public virtual byte[] ReadBytes(int count)
{
- if (count < 0) throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ if (count < 0) throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.Ensures(Contract.Result<byte[]>() != null);
Contract.Ensures(Contract.Result<byte[]>().Length <= Contract.OldValue(count));
Contract.EndContractBlock();
@@ -610,7 +610,7 @@ namespace System.IO
{
if (m_buffer != null && (numBytes < 0 || numBytes > m_buffer.Length))
{
- throw new ArgumentOutOfRangeException(nameof(numBytes), Environment.GetResourceString("ArgumentOutOfRange_BinaryReaderFillBuffer"));
+ throw new ArgumentOutOfRangeException(nameof(numBytes), SR.ArgumentOutOfRange_BinaryReaderFillBuffer);
}
int bytesRead = 0;
int n = 0;
@@ -652,7 +652,7 @@ namespace System.IO
// Check for a corrupted stream. Read a max of 5 bytes.
// In a future version, add a DataFormatException.
if (shift == 5 * 7) // 5 bytes max per Int32, shift += 7
- throw new FormatException(Environment.GetResourceString("Format_Bad7BitInt32"));
+ throw new FormatException(SR.Format_Bad7BitInt32);
// ReadByte handles end of stream cases for us.
b = ReadByte();
diff --git a/src/mscorlib/src/System/IO/BinaryWriter.cs b/src/mscorlib/src/System/IO/BinaryWriter.cs
index ffa5f6edaf..3d9839f46e 100644
--- a/src/mscorlib/src/System/IO/BinaryWriter.cs
+++ b/src/mscorlib/src/System/IO/BinaryWriter.cs
@@ -71,7 +71,7 @@ namespace System.IO
if (encoding == null)
throw new ArgumentNullException(nameof(encoding));
if (!output.CanWrite)
- throw new ArgumentException(Environment.GetResourceString("Argument_StreamNotWritable"));
+ throw new ArgumentException(SR.Argument_StreamNotWritable);
Contract.EndContractBlock();
OutStream = output;
@@ -188,7 +188,7 @@ namespace System.IO
public unsafe virtual void Write(char ch)
{
if (Char.IsSurrogate(ch))
- throw new ArgumentException(Environment.GetResourceString("Arg_SurrogatesNotAllowedAsSingleChar"));
+ throw new ArgumentException(SR.Arg_SurrogatesNotAllowedAsSingleChar);
Contract.EndContractBlock();
Debug.Assert(_encoding.GetMaxByteCount(1) <= 16, "_encoding.GetMaxByteCount(1) <= 16)");
diff --git a/src/mscorlib/src/System/IO/Directory.cs b/src/mscorlib/src/System/IO/Directory.cs
index c8c0142363..c472cdf374 100644
--- a/src/mscorlib/src/System/IO/Directory.cs
+++ b/src/mscorlib/src/System/IO/Directory.cs
@@ -55,7 +55,7 @@ namespace System.IO
if (searchPattern == null)
throw new ArgumentNullException(nameof(searchPattern));
if ((searchOption != SearchOption.TopDirectoryOnly) && (searchOption != SearchOption.AllDirectories))
- throw new ArgumentOutOfRangeException(nameof(searchOption), Environment.GetResourceString("ArgumentOutOfRange_Enum"));
+ throw new ArgumentOutOfRangeException(nameof(searchOption), SR.ArgumentOutOfRange_Enum);
Contract.Ensures(Contract.Result<IEnumerable<String>>() != null);
Contract.EndContractBlock();
@@ -135,9 +135,9 @@ namespace System.IO
if (path == null)
throw new ArgumentNullException(nameof(path));
if (path.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_PathEmpty"));
+ throw new ArgumentException(SR.Argument_PathEmpty);
if (path.Length >= Path.MaxPath)
- throw new PathTooLongException(Environment.GetResourceString("IO.PathTooLong"));
+ throw new PathTooLongException(SR.IO_PathTooLong);
String fulldestDirName = Path.GetFullPath(path);
diff --git a/src/mscorlib/src/System/IO/DirectoryNotFoundException.cs b/src/mscorlib/src/System/IO/DirectoryNotFoundException.cs
index 31b1eba6d5..1cc6cc4e58 100644
--- a/src/mscorlib/src/System/IO/DirectoryNotFoundException.cs
+++ b/src/mscorlib/src/System/IO/DirectoryNotFoundException.cs
@@ -28,7 +28,7 @@ namespace System.IO
public class DirectoryNotFoundException : IOException
{
public DirectoryNotFoundException()
- : base(Environment.GetResourceString("Arg_DirectoryNotFoundException"))
+ : base(SR.Arg_DirectoryNotFoundException)
{
SetErrorCode(__HResults.COR_E_DIRECTORYNOTFOUND);
}
diff --git a/src/mscorlib/src/System/IO/DriveNotFoundException.cs b/src/mscorlib/src/System/IO/DriveNotFoundException.cs
index 6c5bb765b2..c48d7ac359 100644
--- a/src/mscorlib/src/System/IO/DriveNotFoundException.cs
+++ b/src/mscorlib/src/System/IO/DriveNotFoundException.cs
@@ -21,7 +21,7 @@ namespace System.IO
internal class DriveNotFoundException : IOException
{
public DriveNotFoundException()
- : base(Environment.GetResourceString("Arg_DriveNotFoundException"))
+ : base(SR.Arg_DriveNotFoundException)
{
SetErrorCode(__HResults.COR_E_DIRECTORYNOTFOUND);
}
diff --git a/src/mscorlib/src/System/IO/EndOfStreamException.cs b/src/mscorlib/src/System/IO/EndOfStreamException.cs
index 3b73dff7fb..1eb1664e7f 100644
--- a/src/mscorlib/src/System/IO/EndOfStreamException.cs
+++ b/src/mscorlib/src/System/IO/EndOfStreamException.cs
@@ -22,7 +22,7 @@ namespace System.IO
public class EndOfStreamException : IOException
{
public EndOfStreamException()
- : base(Environment.GetResourceString("Arg_EndOfStreamException"))
+ : base(SR.Arg_EndOfStreamException)
{
SetErrorCode(__HResults.COR_E_ENDOFSTREAM);
}
diff --git a/src/mscorlib/src/System/IO/File.cs b/src/mscorlib/src/System/IO/File.cs
index 5c6b5fcf01..4aba1488ec 100644
--- a/src/mscorlib/src/System/IO/File.cs
+++ b/src/mscorlib/src/System/IO/File.cs
@@ -93,7 +93,7 @@ namespace System.IO
int index = 0;
long fileLength = fs.Length;
if (fileLength > Int32.MaxValue)
- throw new IOException(Environment.GetResourceString("IO.IO_FileTooLong2GB"));
+ throw new IOException(SR.IO_FileTooLong2GB);
int count = (int)fileLength;
bytes = new byte[count];
while (count > 0)
@@ -114,7 +114,7 @@ namespace System.IO
if (path == null)
throw new ArgumentNullException(nameof(path));
if (path.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
+ throw new ArgumentException(SR.Argument_EmptyPath);
Contract.EndContractBlock();
return InternalReadAllLines(path, Encoding.UTF8);
diff --git a/src/mscorlib/src/System/IO/FileLoadException.cs b/src/mscorlib/src/System/IO/FileLoadException.cs
index e55fdbb118..6c5b26871b 100644
--- a/src/mscorlib/src/System/IO/FileLoadException.cs
+++ b/src/mscorlib/src/System/IO/FileLoadException.cs
@@ -32,7 +32,7 @@ namespace System.IO
private String _fusionLog; // fusion log (when applicable)
public FileLoadException()
- : base(Environment.GetResourceString("IO.FileLoad"))
+ : base(SR.IO_FileLoad)
{
SetErrorCode(__HResults.COR_E_FILELOAD);
}
@@ -87,7 +87,7 @@ namespace System.IO
String s = GetType().FullName + ": " + Message;
if (_fileName != null && _fileName.Length != 0)
- s += Environment.NewLine + Environment.GetResourceString("IO.FileName_Name", _fileName);
+ s += Environment.NewLine + SR.Format(SR.IO_FileName_Name, _fileName);
if (InnerException != null)
s = s + " ---> " + InnerException.ToString();
diff --git a/src/mscorlib/src/System/IO/FileNotFoundException.cs b/src/mscorlib/src/System/IO/FileNotFoundException.cs
index e25667e302..987aaa9150 100644
--- a/src/mscorlib/src/System/IO/FileNotFoundException.cs
+++ b/src/mscorlib/src/System/IO/FileNotFoundException.cs
@@ -29,7 +29,7 @@ namespace System.IO
private String _fusionLog; // fusion log (when applicable)
public FileNotFoundException()
- : base(Environment.GetResourceString("IO.FileNotFound"))
+ : base(SR.IO_FileNotFound)
{
SetErrorCode(__HResults.COR_E_FILENOTFOUND);
}
@@ -74,7 +74,7 @@ namespace System.IO
{
if ((_fileName == null) &&
(HResult == System.__HResults.COR_E_EXCEPTION))
- _message = Environment.GetResourceString("IO.FileNotFound");
+ _message = SR.IO_FileNotFound;
else if (_fileName != null)
_message = FileLoadException.FormatFileLoadExceptionMessage(_fileName, HResult);
@@ -91,7 +91,7 @@ namespace System.IO
String s = GetType().FullName + ": " + Message;
if (_fileName != null && _fileName.Length != 0)
- s += Environment.NewLine + Environment.GetResourceString("IO.FileName_Name", _fileName);
+ s += Environment.NewLine + SR.Format(SR.IO_FileName_Name, _fileName);
if (InnerException != null)
s = s + " ---> " + InnerException.ToString();
diff --git a/src/mscorlib/src/System/IO/IOException.cs b/src/mscorlib/src/System/IO/IOException.cs
index c2603e6fab..a91d891d8f 100644
--- a/src/mscorlib/src/System/IO/IOException.cs
+++ b/src/mscorlib/src/System/IO/IOException.cs
@@ -33,7 +33,7 @@ namespace System.IO
private String _maybeFullPath; // For debuggers on partial trust code
public IOException()
- : base(Environment.GetResourceString("Arg_IOException"))
+ : base(SR.Arg_IOException)
{
SetErrorCode(__HResults.COR_E_IO);
}
diff --git a/src/mscorlib/src/System/IO/MemoryStream.cs b/src/mscorlib/src/System/IO/MemoryStream.cs
index 920157723e..80b3af0aee 100644
--- a/src/mscorlib/src/System/IO/MemoryStream.cs
+++ b/src/mscorlib/src/System/IO/MemoryStream.cs
@@ -64,7 +64,7 @@ namespace System.IO
{
if (capacity < 0)
{
- throw new ArgumentOutOfRangeException(nameof(capacity), Environment.GetResourceString("ArgumentOutOfRange_NegativeCapacity"));
+ throw new ArgumentOutOfRangeException(nameof(capacity), SR.ArgumentOutOfRange_NegativeCapacity);
}
Contract.EndContractBlock();
@@ -84,7 +84,7 @@ namespace System.IO
public MemoryStream(byte[] buffer, bool writable)
{
- if (buffer == null) throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
+ if (buffer == null) throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
Contract.EndContractBlock();
_buffer = buffer;
_length = _capacity = buffer.Length;
@@ -107,13 +107,13 @@ namespace System.IO
public MemoryStream(byte[] buffer, int index, int count, bool writable, bool publiclyVisible)
{
if (buffer == null)
- throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
if (index < 0)
- throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_NeedNonNegNum);
if (count < 0)
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
if (buffer.Length - index < count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
Contract.EndContractBlock();
_buffer = buffer;
@@ -173,7 +173,7 @@ namespace System.IO
{
// Check for overflow
if (value < 0)
- throw new IOException(Environment.GetResourceString("IO.IO_StreamTooLong"));
+ throw new IOException(SR.IO_StreamTooLong);
if (value > _capacity)
{
int newCapacity = value;
@@ -218,7 +218,7 @@ namespace System.IO
public virtual byte[] GetBuffer()
{
if (!_exposable)
- throw new UnauthorizedAccessException(Environment.GetResourceString("UnauthorizedAccess_MemStreamBuffer"));
+ throw new UnauthorizedAccessException(SR.UnauthorizedAccess_MemStreamBuffer);
return _buffer;
}
@@ -302,7 +302,7 @@ namespace System.IO
{
// Only update the capacity if the MS is expandable and the value is different than the current capacity.
// Special behavior if the MS isn't expandable: we don't throw if value is the same as the current capacity
- if (value < Length) throw new ArgumentOutOfRangeException(nameof(value), Environment.GetResourceString("ArgumentOutOfRange_SmallCapacity"));
+ if (value < Length) throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_SmallCapacity);
Contract.Ensures(_capacity - _origin == value);
Contract.EndContractBlock();
@@ -346,14 +346,14 @@ namespace System.IO
set
{
if (value < 0)
- throw new ArgumentOutOfRangeException(nameof(value), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.Ensures(Position == value);
Contract.EndContractBlock();
if (!_isOpen) __Error.StreamIsClosed();
if (value > MemStreamMaxLength)
- throw new ArgumentOutOfRangeException(nameof(value), Environment.GetResourceString("ArgumentOutOfRange_StreamLength"));
+ throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_StreamLength);
_position = _origin + (int)value;
}
}
@@ -361,13 +361,13 @@ namespace System.IO
public override int Read([In, Out] byte[] buffer, int offset, int count)
{
if (buffer == null)
- throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
if (offset < 0)
- throw new ArgumentOutOfRangeException(nameof(offset), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
if (count < 0)
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
if (buffer.Length - offset < count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
Contract.EndContractBlock();
if (!_isOpen) __Error.StreamIsClosed();
@@ -395,13 +395,13 @@ namespace System.IO
public override Task<int> ReadAsync(Byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
if (buffer == null)
- throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
if (offset < 0)
- throw new ArgumentOutOfRangeException(nameof(offset), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
if (count < 0)
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
if (buffer.Length - offset < count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
Contract.EndContractBlock(); // contract validation copied from Read(...)
// If cancellation was requested, bail early
@@ -513,14 +513,14 @@ namespace System.IO
if (!_isOpen) __Error.StreamIsClosed();
if (offset > MemStreamMaxLength)
- throw new ArgumentOutOfRangeException(nameof(offset), Environment.GetResourceString("ArgumentOutOfRange_StreamLength"));
+ throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_StreamLength);
switch (loc)
{
case SeekOrigin.Begin:
{
int tempPosition = unchecked(_origin + (int)offset);
if (offset < 0 || tempPosition < _origin)
- throw new IOException(Environment.GetResourceString("IO.IO_SeekBeforeBegin"));
+ throw new IOException(SR.IO_SeekBeforeBegin);
_position = tempPosition;
break;
}
@@ -528,7 +528,7 @@ namespace System.IO
{
int tempPosition = unchecked(_position + (int)offset);
if (unchecked(_position + offset) < _origin || tempPosition < _origin)
- throw new IOException(Environment.GetResourceString("IO.IO_SeekBeforeBegin"));
+ throw new IOException(SR.IO_SeekBeforeBegin);
_position = tempPosition;
break;
}
@@ -536,12 +536,12 @@ namespace System.IO
{
int tempPosition = unchecked(_length + (int)offset);
if (unchecked(_length + offset) < _origin || tempPosition < _origin)
- throw new IOException(Environment.GetResourceString("IO.IO_SeekBeforeBegin"));
+ throw new IOException(SR.IO_SeekBeforeBegin);
_position = tempPosition;
break;
}
default:
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidSeekOrigin"));
+ throw new ArgumentException(SR.Argument_InvalidSeekOrigin);
}
Debug.Assert(_position >= 0, "_position >= 0");
@@ -562,7 +562,7 @@ namespace System.IO
{
if (value < 0 || value > Int32.MaxValue)
{
- throw new ArgumentOutOfRangeException(nameof(value), Environment.GetResourceString("ArgumentOutOfRange_StreamLength"));
+ throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_StreamLength);
}
Contract.Ensures(_length - _origin == value);
Contract.EndContractBlock();
@@ -572,7 +572,7 @@ namespace System.IO
Debug.Assert(MemStreamMaxLength == Int32.MaxValue); // Check parameter validation logic in this method if this fails.
if (value > (Int32.MaxValue - _origin))
{
- throw new ArgumentOutOfRangeException(nameof(value), Environment.GetResourceString("ArgumentOutOfRange_StreamLength"));
+ throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_StreamLength);
}
int newLength = _origin + (int)value;
@@ -594,13 +594,13 @@ namespace System.IO
public override void Write(byte[] buffer, int offset, int count)
{
if (buffer == null)
- throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
if (offset < 0)
- throw new ArgumentOutOfRangeException(nameof(offset), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
if (count < 0)
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
if (buffer.Length - offset < count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
Contract.EndContractBlock();
if (!_isOpen) __Error.StreamIsClosed();
@@ -609,7 +609,7 @@ namespace System.IO
int i = _position + count;
// Check for overflow
if (i < 0)
- throw new IOException(Environment.GetResourceString("IO.IO_StreamTooLong"));
+ throw new IOException(SR.IO_StreamTooLong);
if (i > _length)
{
@@ -638,13 +638,13 @@ namespace System.IO
public override Task WriteAsync(Byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
if (buffer == null)
- throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
if (offset < 0)
- throw new ArgumentOutOfRangeException(nameof(offset), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
if (count < 0)
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
if (buffer.Length - offset < count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
Contract.EndContractBlock(); // contract validation copied from Write(...)
// If cancellation is already requested, bail early
@@ -692,7 +692,7 @@ namespace System.IO
public virtual void WriteTo(Stream stream)
{
if (stream == null)
- throw new ArgumentNullException(nameof(stream), Environment.GetResourceString("ArgumentNull_Stream"));
+ throw new ArgumentNullException(nameof(stream), SR.ArgumentNull_Stream);
Contract.EndContractBlock();
if (!_isOpen) __Error.StreamIsClosed();
diff --git a/src/mscorlib/src/System/IO/PathTooLongException.cs b/src/mscorlib/src/System/IO/PathTooLongException.cs
index 07ecb38db4..a0f176c182 100644
--- a/src/mscorlib/src/System/IO/PathTooLongException.cs
+++ b/src/mscorlib/src/System/IO/PathTooLongException.cs
@@ -23,7 +23,7 @@ namespace System.IO
public class PathTooLongException : IOException
{
public PathTooLongException()
- : base(Environment.GetResourceString("IO.PathTooLong"))
+ : base(SR.IO_PathTooLong)
{
SetErrorCode(__HResults.COR_E_PATHTOOLONG);
}
diff --git a/src/mscorlib/src/System/IO/SearchOption.cs b/src/mscorlib/src/System/IO/SearchOption.cs
index 6f3139f17f..75909d7499 100644
--- a/src/mscorlib/src/System/IO/SearchOption.cs
+++ b/src/mscorlib/src/System/IO/SearchOption.cs
@@ -21,7 +21,7 @@ using System;
namespace System.IO
{
[Serializable]
- public enum SearchOption
+ internal enum SearchOption
{
// Include only the current directory in the search operation
TopDirectoryOnly,
diff --git a/src/mscorlib/src/System/IO/Stream.cs b/src/mscorlib/src/System/IO/Stream.cs
index 585f5999a3..92fe374f19 100644
--- a/src/mscorlib/src/System/IO/Stream.cs
+++ b/src/mscorlib/src/System/IO/Stream.cs
@@ -98,11 +98,11 @@ namespace System.IO
get
{
Contract.Ensures(Contract.Result<int>() >= 0);
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_TimeoutsNotSupported"));
+ throw new InvalidOperationException(SR.InvalidOperation_TimeoutsNotSupported);
}
set
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_TimeoutsNotSupported"));
+ throw new InvalidOperationException(SR.InvalidOperation_TimeoutsNotSupported);
}
}
@@ -111,11 +111,11 @@ namespace System.IO
get
{
Contract.Ensures(Contract.Result<int>() >= 0);
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_TimeoutsNotSupported"));
+ throw new InvalidOperationException(SR.InvalidOperation_TimeoutsNotSupported);
}
set
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_TimeoutsNotSupported"));
+ throw new InvalidOperationException(SR.InvalidOperation_TimeoutsNotSupported);
}
}
@@ -382,15 +382,15 @@ namespace System.IO
if (readTask == null)
{
- throw new ArgumentException(Environment.GetResourceString("InvalidOperation_WrongAsyncResultOrEndReadCalledMultiple"));
+ throw new ArgumentException(SR.InvalidOperation_WrongAsyncResultOrEndReadCalledMultiple);
}
else if (readTask != asyncResult)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_WrongAsyncResultOrEndReadCalledMultiple"));
+ throw new InvalidOperationException(SR.InvalidOperation_WrongAsyncResultOrEndReadCalledMultiple);
}
else if (!readTask._isRead)
{
- throw new ArgumentException(Environment.GetResourceString("InvalidOperation_WrongAsyncResultOrEndReadCalledMultiple"));
+ throw new ArgumentException(SR.InvalidOperation_WrongAsyncResultOrEndReadCalledMultiple);
}
try
@@ -566,15 +566,15 @@ namespace System.IO
var writeTask = _activeReadWriteTask;
if (writeTask == null)
{
- throw new ArgumentException(Environment.GetResourceString("InvalidOperation_WrongAsyncResultOrEndWriteCalledMultiple"));
+ throw new ArgumentException(SR.InvalidOperation_WrongAsyncResultOrEndWriteCalledMultiple);
}
else if (writeTask != asyncResult)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_WrongAsyncResultOrEndWriteCalledMultiple"));
+ throw new InvalidOperationException(SR.InvalidOperation_WrongAsyncResultOrEndWriteCalledMultiple);
}
else if (writeTask._isRead)
{
- throw new ArgumentException(Environment.GetResourceString("InvalidOperation_WrongAsyncResultOrEndWriteCalledMultiple"));
+ throw new ArgumentException(SR.InvalidOperation_WrongAsyncResultOrEndWriteCalledMultiple);
}
try
diff --git a/src/mscorlib/src/System/IO/StreamReader.cs b/src/mscorlib/src/System/IO/StreamReader.cs
index 6d50347b1a..dfb928c85d 100644
--- a/src/mscorlib/src/System/IO/StreamReader.cs
+++ b/src/mscorlib/src/System/IO/StreamReader.cs
@@ -103,7 +103,7 @@ namespace System.IO
Task t = _asyncReadTask;
if (t != null && !t.IsCompleted)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_AsyncIOInProgress"));
+ throw new InvalidOperationException(SR.InvalidOperation_AsyncIOInProgress);
}
// StreamReader by default will ignore illegal UTF8 characters. We don't want to
@@ -149,9 +149,9 @@ namespace System.IO
if (stream == null || encoding == null)
throw new ArgumentNullException((stream == null ? nameof(stream) : nameof(encoding)));
if (!stream.CanRead)
- throw new ArgumentException(Environment.GetResourceString("Argument_StreamNotReadable"));
+ throw new ArgumentException(SR.Argument_StreamNotReadable);
if (bufferSize <= 0)
- throw new ArgumentOutOfRangeException(nameof(bufferSize), Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum"));
+ throw new ArgumentOutOfRangeException(nameof(bufferSize), SR.ArgumentOutOfRange_NeedPosNum);
Contract.EndContractBlock();
Init(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize, leaveOpen);
@@ -181,9 +181,9 @@ namespace System.IO
if (path==null || encoding==null)
throw new ArgumentNullException((path==null ? nameof(path) : nameof(encoding)));
if (path.Length==0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"));
+ throw new ArgumentException(SR.Argument_EmptyPath);
if (bufferSize <= 0)
- throw new ArgumentOutOfRangeException(nameof(bufferSize), Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum"));
+ throw new ArgumentOutOfRangeException(nameof(bufferSize), SR.ArgumentOutOfRange_NeedPosNum);
Contract.EndContractBlock();
Stream stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, DefaultFileStreamBufferSize, FileOptions.SequentialScan);
@@ -338,11 +338,11 @@ namespace System.IO
public override int Read([In, Out] char[] buffer, int index, int count)
{
if (buffer==null)
- throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
if (index < 0 || count < 0)
- throw new ArgumentOutOfRangeException((index < 0 ? nameof(index) : nameof(count)), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException((index < 0 ? nameof(index) : nameof(count)), SR.ArgumentOutOfRange_NeedNonNegNum);
if (buffer.Length - index < count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
Contract.EndContractBlock();
if (stream == null)
@@ -396,11 +396,11 @@ namespace System.IO
public override int ReadBlock([In, Out] char[] buffer, int index, int count)
{
if (buffer==null)
- throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
if (index < 0 || count < 0)
- throw new ArgumentOutOfRangeException((index < 0 ? nameof(index) : nameof(count)), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException((index < 0 ? nameof(index) : nameof(count)), SR.ArgumentOutOfRange_NeedNonNegNum);
if (buffer.Length - index < count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
Contract.EndContractBlock();
if (stream == null)
@@ -540,7 +540,7 @@ namespace System.IO
return sb.ToString();
}
- internal virtual int ReadBuffer() {
+ internal int ReadBuffer() {
charLen = 0;
charPos = 0;
@@ -777,16 +777,16 @@ namespace System.IO
private async Task<String> ReadLineAsyncInternal()
{
- if (CharPos_Prop == CharLen_Prop && (await ReadBufferAsync().ConfigureAwait(false)) == 0)
+ if (charPos == charLen && (await ReadBufferAsync().ConfigureAwait(false)) == 0)
return null;
StringBuilder sb = null;
do
{
- char[] tmpCharBuffer = CharBuffer_Prop;
- int tmpCharLen = CharLen_Prop;
- int tmpCharPos = CharPos_Prop;
+ char[] tmpCharBuffer = charBuffer;
+ int tmpCharLen = charLen;
+ int tmpCharPos = charPos;
int i = tmpCharPos;
do
@@ -809,13 +809,13 @@ namespace System.IO
s = new String(tmpCharBuffer, tmpCharPos, i - tmpCharPos);
}
- CharPos_Prop = tmpCharPos = i + 1;
+ charPos = tmpCharPos = i + 1;
if (ch == '\r' && (tmpCharPos < tmpCharLen || (await ReadBufferAsync().ConfigureAwait(false)) > 0))
{
- tmpCharPos = CharPos_Prop;
- if (CharBuffer_Prop[tmpCharPos] == '\n')
- CharPos_Prop = ++tmpCharPos;
+ tmpCharPos = charPos;
+ if (charBuffer[tmpCharPos] == '\n')
+ charPos = ++tmpCharPos;
}
return s;
@@ -857,14 +857,14 @@ namespace System.IO
private async Task<String> ReadToEndAsyncInternal()
{
// Call ReadBuffer, then pull data out of charBuffer.
- StringBuilder sb = AcquireSharedStringBuilder(CharLen_Prop - CharPos_Prop);
+ StringBuilder sb = AcquireSharedStringBuilder(charLen - charPos);
do
{
- int tmpCharPos = CharPos_Prop;
- sb.Append(CharBuffer_Prop, tmpCharPos, CharLen_Prop - tmpCharPos);
- CharPos_Prop = CharLen_Prop; // We consumed these characters
+ int tmpCharPos = charPos;
+ sb.Append(charBuffer, tmpCharPos, charLen - tmpCharPos);
+ charPos = charLen; // We consumed these characters
await ReadBufferAsync().ConfigureAwait(false);
- } while (CharLen_Prop > 0);
+ } while (charLen > 0);
return GetStringAndReleaseSharedStringBuilder(sb);
}
@@ -872,11 +872,11 @@ namespace System.IO
public override Task<int> ReadAsync(char[] buffer, int index, int count)
{
if (buffer==null)
- throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
if (index < 0 || count < 0)
- throw new ArgumentOutOfRangeException((index < 0 ? nameof(index) : nameof(count)), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException((index < 0 ? nameof(index) : nameof(count)), SR.ArgumentOutOfRange_NeedNonNegNum);
if (buffer.Length - index < count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
Contract.EndContractBlock();
// If we have been inherited into a subclass, the following implementation could be incorrect
@@ -899,7 +899,7 @@ namespace System.IO
internal override async Task<int> ReadAsyncInternal(char[] buffer, int index, int count)
{
- if (CharPos_Prop == CharLen_Prop && (await ReadBufferAsync().ConfigureAwait(false)) == 0)
+ if (charPos == charLen && (await ReadBufferAsync().ConfigureAwait(false)) == 0)
return 0;
int charsRead = 0;
@@ -908,24 +908,24 @@ namespace System.IO
// data read in, let's try writing directly to the user's buffer.
bool readToUserBuffer = false;
- Byte[] tmpByteBuffer = ByteBuffer_Prop;
- Stream tmpStream = Stream_Prop;
+ Byte[] tmpByteBuffer = byteBuffer;
+ Stream tmpStream = stream;
while (count > 0)
{
// n is the characters available in _charBuffer
- int n = CharLen_Prop - CharPos_Prop;
+ int n = charLen - charPos;
// charBuffer is empty, let's read from the stream
if (n == 0)
{
- CharLen_Prop = 0;
- CharPos_Prop = 0;
+ charLen = 0;
+ charPos = 0;
- if (!CheckPreamble_Prop)
- ByteLen_Prop = 0;
+ if (!_checkPreamble)
+ byteLen = 0;
- readToUserBuffer = count >= MaxCharsPerBuffer_Prop;
+ readToUserBuffer = count >= _maxCharsPerBuffer;
// We loop here so that we read in enough bytes to yield at least 1 char.
// We break out of the loop if the stream is blocked (EOF is reached).
@@ -933,10 +933,10 @@ namespace System.IO
{
Debug.Assert(n == 0);
- if (CheckPreamble_Prop)
+ if (_checkPreamble)
{
- Debug.Assert(BytePos_Prop <= Preamble_Prop.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?");
- int tmpBytePos = BytePos_Prop;
+ Debug.Assert(bytePos <= _preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?");
+ int tmpBytePos = bytePos;
int len = await tmpStream.ReadAsync(tmpByteBuffer, tmpBytePos, tmpByteBuffer.Length - tmpBytePos).ConfigureAwait(false);
Debug.Assert(len >= 0, "Stream.Read returned a negative number! This is a bug in your stream class.");
@@ -944,42 +944,42 @@ namespace System.IO
{
// EOF but we might have buffered bytes from previous
// attempts to detect preamble that needs to be decoded now
- if (ByteLen_Prop > 0)
+ if (byteLen > 0)
{
if (readToUserBuffer)
{
- n = Decoder_Prop.GetChars(tmpByteBuffer, 0, ByteLen_Prop, buffer, index + charsRead);
- CharLen_Prop = 0; // StreamReader's buffer is empty.
+ n = decoder.GetChars(tmpByteBuffer, 0, byteLen, buffer, index + charsRead);
+ charLen = 0; // StreamReader's buffer is empty.
}
else
{
- n = Decoder_Prop.GetChars(tmpByteBuffer, 0, ByteLen_Prop, CharBuffer_Prop, 0);
- CharLen_Prop += n; // Number of chars in StreamReader's buffer.
+ n = decoder.GetChars(tmpByteBuffer, 0, byteLen, charBuffer, 0);
+ charLen += n; // Number of chars in StreamReader's buffer.
}
}
// How can part of the preamble yield any chars?
Debug.Assert(n == 0);
- IsBlocked_Prop = true;
+ _isBlocked = true;
break;
}
else
{
- ByteLen_Prop += len;
+ byteLen += len;
}
}
else
{
- Debug.Assert(BytePos_Prop == 0, "_bytePos can be non zero only when we are trying to _checkPreamble. Are two threads using this StreamReader at the same time?");
+ Debug.Assert(bytePos == 0, "_bytePos can be non zero only when we are trying to _checkPreamble. Are two threads using this StreamReader at the same time?");
- ByteLen_Prop = await tmpStream.ReadAsync(tmpByteBuffer, 0, tmpByteBuffer.Length).ConfigureAwait(false);
+ byteLen = await tmpStream.ReadAsync(tmpByteBuffer, 0, tmpByteBuffer.Length).ConfigureAwait(false);
- Debug.Assert(ByteLen_Prop >= 0, "Stream.Read returned a negative number! This is a bug in your stream class.");
+ Debug.Assert(byteLen >= 0, "Stream.Read returned a negative number! This is a bug in your stream class.");
- if (ByteLen_Prop == 0) // EOF
+ if (byteLen == 0) // EOF
{
- IsBlocked_Prop = true;
+ _isBlocked = true;
break;
}
}
@@ -987,7 +987,7 @@ namespace System.IO
// _isBlocked == whether we read fewer bytes than we asked for.
// Note we must check it here because CompressBuffer or
// DetectEncoding will change _byteLen.
- IsBlocked_Prop = (ByteLen_Prop < tmpByteBuffer.Length);
+ _isBlocked = (byteLen < tmpByteBuffer.Length);
// Check for preamble before detect encoding. This is not to override the
// user suppplied Encoding for the one we implicitly detect. The user could
@@ -998,33 +998,33 @@ namespace System.IO
continue;
// On the first call to ReadBuffer, if we're supposed to detect the encoding, do it.
- if (DetectEncoding_Prop && ByteLen_Prop >= 2)
+ if (_detectEncoding && byteLen >= 2)
{
DetectEncoding();
// DetectEncoding changes some buffer state. Recompute this.
- readToUserBuffer = count >= MaxCharsPerBuffer_Prop;
+ readToUserBuffer = count >= _maxCharsPerBuffer;
}
Debug.Assert(n == 0);
- CharPos_Prop = 0;
+ charPos = 0;
if (readToUserBuffer)
{
- n += Decoder_Prop.GetChars(tmpByteBuffer, 0, ByteLen_Prop, buffer, index + charsRead);
+ n += decoder.GetChars(tmpByteBuffer, 0, byteLen, buffer, index + charsRead);
// Why did the bytes yield no chars?
Debug.Assert(n > 0);
- CharLen_Prop = 0; // StreamReader's buffer is empty.
+ charLen = 0; // StreamReader's buffer is empty.
}
else
{
- n = Decoder_Prop.GetChars(tmpByteBuffer, 0, ByteLen_Prop, CharBuffer_Prop, 0);
+ n = decoder.GetChars(tmpByteBuffer, 0, byteLen, charBuffer, 0);
// Why did the bytes yield no chars?
Debug.Assert(n > 0);
- CharLen_Prop += n; // Number of chars in StreamReader's buffer.
+ charLen += n; // Number of chars in StreamReader's buffer.
}
} while (n == 0);
@@ -1038,8 +1038,8 @@ namespace System.IO
if (!readToUserBuffer)
{
- Buffer.InternalBlockCopy(CharBuffer_Prop, CharPos_Prop * 2, buffer, (index + charsRead) * 2, n * 2);
- CharPos_Prop += n;
+ Buffer.InternalBlockCopy(charBuffer, charPos * 2, buffer, (index + charsRead) * 2, n * 2);
+ charPos += n;
}
charsRead += n;
@@ -1048,7 +1048,7 @@ namespace System.IO
// This function shouldn't block for an indefinite amount of time,
// or reading from a network stream won't work right. If we got
// fewer bytes than we requested, then we want to break right here.
- if (IsBlocked_Prop)
+ if (_isBlocked)
break;
} // while (count > 0)
@@ -1058,11 +1058,11 @@ namespace System.IO
public override Task<int> ReadBlockAsync(char[] buffer, int index, int count)
{
if (buffer==null)
- throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
if (index < 0 || count < 0)
- throw new ArgumentOutOfRangeException((index < 0 ? nameof(index) : nameof(count)), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException((index < 0 ? nameof(index) : nameof(count)), SR.ArgumentOutOfRange_NeedNonNegNum);
if (buffer.Length - index < count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
Contract.EndContractBlock();
// If we have been inherited into a subclass, the following implementation could be incorrect
@@ -1083,113 +1083,50 @@ namespace System.IO
return task;
}
- #region Private properties for async method performance
- // Access to instance fields of MarshalByRefObject-derived types requires special JIT helpers that check
- // if the instance operated on is remote. This is optimised for fields on this but if a method is Async
- // and is thus lifted to a state machine type, access will be slow.
- // As a workaround, we either cache instance fields in locals or use properties to access such fields.
-
- private Int32 CharLen_Prop {
- get { return charLen; }
- set { charLen = value; }
- }
-
- private Int32 CharPos_Prop {
- get { return charPos; }
- set { charPos = value; }
- }
-
- private Int32 ByteLen_Prop {
- get { return byteLen; }
- set { byteLen = value; }
- }
-
- private Int32 BytePos_Prop {
- get { return bytePos; }
- set { bytePos = value; }
- }
-
- private Byte[] Preamble_Prop {
- get { return _preamble; }
- }
-
- private bool CheckPreamble_Prop {
- get { return _checkPreamble; }
- }
-
- private Decoder Decoder_Prop {
- get { return decoder; }
- }
-
- private bool DetectEncoding_Prop {
- get { return _detectEncoding; }
- }
-
- private Char[] CharBuffer_Prop {
- get { return charBuffer; }
- }
-
- private Byte[] ByteBuffer_Prop {
- get { return byteBuffer; }
- }
-
- private bool IsBlocked_Prop {
- get { return _isBlocked; }
- set { _isBlocked = value; }
- }
-
- private Stream Stream_Prop {
- get { return stream; }
- }
-
- private Int32 MaxCharsPerBuffer_Prop {
- get { return _maxCharsPerBuffer; }
- }
- #endregion Private properties for async method performance
private async Task<int> ReadBufferAsync()
{
- CharLen_Prop = 0;
- CharPos_Prop = 0;
- Byte[] tmpByteBuffer = ByteBuffer_Prop;
- Stream tmpStream = Stream_Prop;
+ charLen = 0;
+ charPos = 0;
+ Byte[] tmpByteBuffer = byteBuffer;
+ Stream tmpStream = stream;
- if (!CheckPreamble_Prop)
- ByteLen_Prop = 0;
+ if (!_checkPreamble)
+ byteLen = 0;
do {
- if (CheckPreamble_Prop) {
- Debug.Assert(BytePos_Prop <= Preamble_Prop.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?");
- int tmpBytePos = BytePos_Prop;
+ if (_checkPreamble) {
+ Debug.Assert(bytePos <= _preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?");
+ int tmpBytePos = bytePos;
int len = await tmpStream.ReadAsync(tmpByteBuffer, tmpBytePos, tmpByteBuffer.Length - tmpBytePos).ConfigureAwait(false);
Debug.Assert(len >= 0, "Stream.Read returned a negative number! This is a bug in your stream class.");
if (len == 0) {
// EOF but we might have buffered bytes from previous
// attempt to detect preamble that needs to be decoded now
- if (ByteLen_Prop > 0)
+ if (byteLen > 0)
{
- CharLen_Prop += Decoder_Prop.GetChars(tmpByteBuffer, 0, ByteLen_Prop, CharBuffer_Prop, CharLen_Prop);
+ charLen += decoder.GetChars(tmpByteBuffer, 0, byteLen, charBuffer, charLen);
// Need to zero out the _byteLen after we consume these bytes so that we don't keep infinitely hitting this code path
- BytePos_Prop = 0; ByteLen_Prop = 0;
+ bytePos = 0; byteLen = 0;
}
- return CharLen_Prop;
+ return charLen;
}
- ByteLen_Prop += len;
+ byteLen += len;
}
else {
- Debug.Assert(BytePos_Prop == 0, "_bytePos can be non zero only when we are trying to _checkPreamble. Are two threads using this StreamReader at the same time?");
- ByteLen_Prop = await tmpStream.ReadAsync(tmpByteBuffer, 0, tmpByteBuffer.Length).ConfigureAwait(false);
- Debug.Assert(ByteLen_Prop >= 0, "Stream.Read returned a negative number! Bug in stream class.");
+ Debug.Assert(bytePos == 0, "_bytePos can be non zero only when we are trying to _checkPreamble. Are two threads using this StreamReader at the same time?");
+ byteLen = await tmpStream.ReadAsync(tmpByteBuffer, 0, tmpByteBuffer.Length).ConfigureAwait(false);
+ Debug.Assert(byteLen >= 0, "Stream.Read returned a negative number! Bug in stream class.");
- if (ByteLen_Prop == 0) // We're at EOF
- return CharLen_Prop;
+ if (byteLen == 0) // We're at EOF
+ return charLen;
}
// _isBlocked == whether we read fewer bytes than we asked for.
// Note we must check it here because CompressBuffer or
// DetectEncoding will change _byteLen.
- IsBlocked_Prop = (ByteLen_Prop < tmpByteBuffer.Length);
+ _isBlocked = (byteLen < tmpByteBuffer.Length);
// Check for preamble before detect encoding. This is not to override the
// user suppplied Encoding for the one we implicitly detect. The user could
@@ -1199,13 +1136,13 @@ namespace System.IO
// If we're supposed to detect the encoding and haven't done so yet,
// do it. Note this may need to be called more than once.
- if (DetectEncoding_Prop && ByteLen_Prop >= 2)
+ if (_detectEncoding && byteLen >= 2)
DetectEncoding();
- CharLen_Prop += Decoder_Prop.GetChars(tmpByteBuffer, 0, ByteLen_Prop, CharBuffer_Prop, CharLen_Prop);
- } while (CharLen_Prop == 0);
+ charLen += decoder.GetChars(tmpByteBuffer, 0, byteLen, charBuffer, charLen);
+ } while (charLen == 0);
- return CharLen_Prop;
+ return charLen;
}
#endregion
@@ -1254,12 +1191,6 @@ namespace System.IO
{
return String.Empty;
}
-
- internal override int ReadBuffer()
- {
- return 0;
- }
-
}
}
}
diff --git a/src/mscorlib/src/System/IO/TextReader.cs b/src/mscorlib/src/System/IO/TextReader.cs
index 15ba8fba7d..3da68591b0 100644
--- a/src/mscorlib/src/System/IO/TextReader.cs
+++ b/src/mscorlib/src/System/IO/TextReader.cs
@@ -93,13 +93,13 @@ namespace System.IO {
public virtual int Read([In, Out] char[] buffer, int index, int count)
{
if (buffer==null)
- throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
if (index < 0)
- throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_NeedNonNegNum);
if (count < 0)
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
if (buffer.Length - index < count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
Contract.Ensures(Contract.Result<int>() >= 0);
Contract.Ensures(Contract.Result<int>() <= Contract.OldValue(count));
Contract.EndContractBlock();
@@ -192,11 +192,11 @@ namespace System.IO {
public virtual Task<int> ReadAsync(char[] buffer, int index, int count)
{
if (buffer==null)
- throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
if (index < 0 || count < 0)
- throw new ArgumentOutOfRangeException((index < 0 ? nameof(index) : nameof(count)), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException((index < 0 ? nameof(index) : nameof(count)), SR.ArgumentOutOfRange_NeedNonNegNum);
if (buffer.Length - index < count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
Contract.EndContractBlock();
return ReadAsyncInternal(buffer, index, count);
@@ -221,11 +221,11 @@ namespace System.IO {
public virtual Task<int> ReadBlockAsync(char[] buffer, int index, int count)
{
if (buffer==null)
- throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
if (index < 0 || count < 0)
- throw new ArgumentOutOfRangeException((index < 0 ? nameof(index) : nameof(count)), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException((index < 0 ? nameof(index) : nameof(count)), SR.ArgumentOutOfRange_NeedNonNegNum);
if (buffer.Length - index < count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
Contract.EndContractBlock();
@@ -362,11 +362,11 @@ namespace System.IO {
public override Task<int> ReadBlockAsync(char[] buffer, int index, int count)
{
if (buffer==null)
- throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
if (index < 0 || count < 0)
- throw new ArgumentOutOfRangeException((index < 0 ? nameof(index) : nameof(count)), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException((index < 0 ? nameof(index) : nameof(count)), SR.ArgumentOutOfRange_NeedNonNegNum);
if (buffer.Length - index < count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
Contract.EndContractBlock();
@@ -377,11 +377,11 @@ namespace System.IO {
public override Task<int> ReadAsync(char[] buffer, int index, int count)
{
if (buffer==null)
- throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
if (index < 0 || count < 0)
- throw new ArgumentOutOfRangeException((index < 0 ? nameof(index) : nameof(count)), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException((index < 0 ? nameof(index) : nameof(count)), SR.ArgumentOutOfRange_NeedNonNegNum);
if (buffer.Length - index < count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
Contract.EndContractBlock();
return Task.FromResult(Read(buffer, index, count));
diff --git a/src/mscorlib/src/System/IO/UnmanagedMemoryAccessor.cs b/src/mscorlib/src/System/IO/UnmanagedMemoryAccessor.cs
index 731df60bba..5f6f588cbe 100644
--- a/src/mscorlib/src/System/IO/UnmanagedMemoryAccessor.cs
+++ b/src/mscorlib/src/System/IO/UnmanagedMemoryAccessor.cs
@@ -65,15 +65,15 @@ namespace System.IO
}
if (offset < 0)
{
- throw new ArgumentOutOfRangeException(nameof(offset), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (capacity < 0)
{
- throw new ArgumentOutOfRangeException(nameof(capacity), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(capacity), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (buffer.ByteLength < (UInt64)(offset + capacity))
{
- throw new ArgumentException(Environment.GetResourceString("Argument_OffsetAndCapacityOutOfBounds"));
+ throw new ArgumentException(SR.Argument_OffsetAndCapacityOutOfBounds);
}
if (access < FileAccess.Read || access > FileAccess.ReadWrite)
{
@@ -83,7 +83,7 @@ namespace System.IO
if (_isOpen)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CalledTwice"));
+ throw new InvalidOperationException(SR.InvalidOperation_CalledTwice);
}
unsafe
@@ -95,7 +95,7 @@ namespace System.IO
buffer.AcquirePointer(ref pointer);
if (((byte*)((Int64)pointer + offset + capacity)) < pointer)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_UnmanagedMemAccessorWrapAround"));
+ throw new ArgumentException(SR.Argument_UnmanagedMemAccessorWrapAround);
}
}
finally
@@ -314,7 +314,7 @@ namespace System.IO
// Check for invalid Decimal values
if (!((flags & ~(SignMask | ScaleMask)) == 0 && (flags & ScaleMask) <= (28 << 16)))
{
- throw new ArgumentException(Environment.GetResourceString("Arg_BadDecimal")); // Throw same Exception type as Decimal(int[]) ctor for compat
+ throw new ArgumentException(SR.Arg_BadDecimal); // Throw same Exception type as Decimal(int[]) ctor for compat
}
bool isNegative = (flags & SignMask) != 0;
@@ -502,17 +502,17 @@ namespace System.IO
{
if (position < 0)
{
- throw new ArgumentOutOfRangeException(nameof(position), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(position), SR.ArgumentOutOfRange_NeedNonNegNum);
}
Contract.EndContractBlock();
if (!_isOpen)
{
- throw new ObjectDisposedException("UnmanagedMemoryAccessor", Environment.GetResourceString("ObjectDisposed_ViewAccessorClosed"));
+ throw new ObjectDisposedException("UnmanagedMemoryAccessor", SR.ObjectDisposed_ViewAccessorClosed);
}
if (!CanRead)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_Reading"));
+ throw new NotSupportedException(SR.NotSupported_Reading);
}
UInt32 sizeOfT = Marshal.SizeOfType(typeof(T));
@@ -520,11 +520,11 @@ namespace System.IO
{
if (position >= _capacity)
{
- throw new ArgumentOutOfRangeException(nameof(position), Environment.GetResourceString("ArgumentOutOfRange_PositionLessThanCapacityRequired"));
+ throw new ArgumentOutOfRangeException(nameof(position), SR.ArgumentOutOfRange_PositionLessThanCapacityRequired);
}
else
{
- throw new ArgumentException(Environment.GetResourceString("Argument_NotEnoughBytesToRead", typeof(T).FullName), nameof(position));
+ throw new ArgumentException(SR.Format(SR.Argument_NotEnoughBytesToRead, typeof (T).FullName), nameof(position));
}
}
@@ -545,31 +545,31 @@ namespace System.IO
}
if (offset < 0)
{
- throw new ArgumentOutOfRangeException(nameof(offset), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (count < 0)
{
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (array.Length - offset < count)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_OffsetAndLengthOutOfBounds"));
+ throw new ArgumentException(SR.Argument_OffsetAndLengthOutOfBounds);
}
Contract.EndContractBlock();
if (!CanRead)
{
if (!_isOpen)
{
- throw new ObjectDisposedException("UnmanagedMemoryAccessor", Environment.GetResourceString("ObjectDisposed_ViewAccessorClosed"));
+ throw new ObjectDisposedException("UnmanagedMemoryAccessor", SR.ObjectDisposed_ViewAccessorClosed);
}
else
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_Reading"));
+ throw new NotSupportedException(SR.NotSupported_Reading);
}
}
if (position < 0)
{
- throw new ArgumentOutOfRangeException(nameof(position), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(position), SR.ArgumentOutOfRange_NeedNonNegNum);
}
UInt32 sizeOfT = Marshal.AlignedSizeOf<T>();
@@ -577,7 +577,7 @@ namespace System.IO
// only check position and ask for fewer Ts if count is too big
if (position >= _capacity)
{
- throw new ArgumentOutOfRangeException(nameof(position), Environment.GetResourceString("ArgumentOutOfRange_PositionLessThanCapacityRequired"));
+ throw new ArgumentOutOfRangeException(nameof(position), SR.ArgumentOutOfRange_PositionLessThanCapacityRequired);
}
int n = count;
@@ -903,17 +903,17 @@ namespace System.IO
{
if (position < 0)
{
- throw new ArgumentOutOfRangeException(nameof(position), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(position), SR.ArgumentOutOfRange_NeedNonNegNum);
}
Contract.EndContractBlock();
if (!_isOpen)
{
- throw new ObjectDisposedException("UnmanagedMemoryAccessor", Environment.GetResourceString("ObjectDisposed_ViewAccessorClosed"));
+ throw new ObjectDisposedException("UnmanagedMemoryAccessor", SR.ObjectDisposed_ViewAccessorClosed);
}
if (!CanWrite)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_Writing"));
+ throw new NotSupportedException(SR.NotSupported_Writing);
}
UInt32 sizeOfT = Marshal.SizeOfType(typeof(T));
@@ -921,11 +921,11 @@ namespace System.IO
{
if (position >= _capacity)
{
- throw new ArgumentOutOfRangeException(nameof(position), Environment.GetResourceString("ArgumentOutOfRange_PositionLessThanCapacityRequired"));
+ throw new ArgumentOutOfRangeException(nameof(position), SR.ArgumentOutOfRange_PositionLessThanCapacityRequired);
}
else
{
- throw new ArgumentException(Environment.GetResourceString("Argument_NotEnoughBytesToWrite", typeof(T).FullName), nameof(position));
+ throw new ArgumentException(SR.Format(SR.Argument_NotEnoughBytesToWrite, typeof (T).FullName), nameof(position));
}
}
@@ -943,33 +943,33 @@ namespace System.IO
}
if (offset < 0)
{
- throw new ArgumentOutOfRangeException(nameof(offset), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (count < 0)
{
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (array.Length - offset < count)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_OffsetAndLengthOutOfBounds"));
+ throw new ArgumentException(SR.Argument_OffsetAndLengthOutOfBounds);
}
if (position < 0)
{
- throw new ArgumentOutOfRangeException(nameof(position), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(position), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (position >= Capacity)
{
- throw new ArgumentOutOfRangeException(nameof(position), Environment.GetResourceString("ArgumentOutOfRange_PositionLessThanCapacityRequired"));
+ throw new ArgumentOutOfRangeException(nameof(position), SR.ArgumentOutOfRange_PositionLessThanCapacityRequired);
}
Contract.EndContractBlock();
if (!_isOpen)
{
- throw new ObjectDisposedException("UnmanagedMemoryAccessor", Environment.GetResourceString("ObjectDisposed_ViewAccessorClosed"));
+ throw new ObjectDisposedException("UnmanagedMemoryAccessor", SR.ObjectDisposed_ViewAccessorClosed);
}
if (!CanWrite)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_Writing"));
+ throw new NotSupportedException(SR.NotSupported_Writing);
}
_buffer.WriteArray<T>((UInt64)(_offset + position), array, offset, count);
@@ -1031,26 +1031,26 @@ namespace System.IO
{
if (!_isOpen)
{
- throw new ObjectDisposedException("UnmanagedMemoryAccessor", Environment.GetResourceString("ObjectDisposed_ViewAccessorClosed"));
+ throw new ObjectDisposedException("UnmanagedMemoryAccessor", SR.ObjectDisposed_ViewAccessorClosed);
}
if (!CanRead)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_Reading"));
+ throw new NotSupportedException(SR.NotSupported_Reading);
}
if (position < 0)
{
- throw new ArgumentOutOfRangeException(nameof(position), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(position), SR.ArgumentOutOfRange_NeedNonNegNum);
}
Contract.EndContractBlock();
if (position > _capacity - sizeOfType)
{
if (position >= _capacity)
{
- throw new ArgumentOutOfRangeException(nameof(position), Environment.GetResourceString("ArgumentOutOfRange_PositionLessThanCapacityRequired"));
+ throw new ArgumentOutOfRangeException(nameof(position), SR.ArgumentOutOfRange_PositionLessThanCapacityRequired);
}
else
{
- throw new ArgumentException(Environment.GetResourceString("Argument_NotEnoughBytesToRead"), nameof(position));
+ throw new ArgumentException(SR.Argument_NotEnoughBytesToRead, nameof(position));
}
}
}
@@ -1059,26 +1059,26 @@ namespace System.IO
{
if (!_isOpen)
{
- throw new ObjectDisposedException("UnmanagedMemoryAccessor", Environment.GetResourceString("ObjectDisposed_ViewAccessorClosed"));
+ throw new ObjectDisposedException("UnmanagedMemoryAccessor", SR.ObjectDisposed_ViewAccessorClosed);
}
if (!CanWrite)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_Writing"));
+ throw new NotSupportedException(SR.NotSupported_Writing);
}
if (position < 0)
{
- throw new ArgumentOutOfRangeException(nameof(position), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(position), SR.ArgumentOutOfRange_NeedNonNegNum);
}
Contract.EndContractBlock();
if (position > _capacity - sizeOfType)
{
if (position >= _capacity)
{
- throw new ArgumentOutOfRangeException(nameof(position), Environment.GetResourceString("ArgumentOutOfRange_PositionLessThanCapacityRequired"));
+ throw new ArgumentOutOfRangeException(nameof(position), SR.ArgumentOutOfRange_PositionLessThanCapacityRequired);
}
else
{
- throw new ArgumentException(Environment.GetResourceString("Argument_NotEnoughBytesToWrite", nameof(Byte)), nameof(position));
+ throw new ArgumentException(SR.Format(SR.Argument_NotEnoughBytesToWrite, nameof(Byte)), nameof(position));
}
}
}
diff --git a/src/mscorlib/src/System/IO/UnmanagedMemoryStream.cs b/src/mscorlib/src/System/IO/UnmanagedMemoryStream.cs
index 086c19bafa..f21fe47371 100644
--- a/src/mscorlib/src/System/IO/UnmanagedMemoryStream.cs
+++ b/src/mscorlib/src/System/IO/UnmanagedMemoryStream.cs
@@ -126,15 +126,15 @@ namespace System.IO
}
if (offset < 0)
{
- throw new ArgumentOutOfRangeException(nameof(offset), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (length < 0)
{
- throw new ArgumentOutOfRangeException(nameof(length), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (buffer.ByteLength < (ulong)(offset + length))
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidSafeBufferOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidSafeBufferOffLen);
}
if (access < FileAccess.Read || access > FileAccess.ReadWrite)
{
@@ -144,7 +144,7 @@ namespace System.IO
if (_isOpen)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CalledTwice"));
+ throw new InvalidOperationException(SR.InvalidOperation_CalledTwice);
}
// check for wraparound
@@ -157,7 +157,7 @@ namespace System.IO
buffer.AcquirePointer(ref pointer);
if ((pointer + offset + length) < pointer)
{
- throw new ArgumentException(Environment.GetResourceString("ArgumentOutOfRange_UnmanagedMemStreamWrapAround"));
+ throw new ArgumentException(SR.ArgumentOutOfRange_UnmanagedMemStreamWrapAround);
}
}
finally
@@ -195,17 +195,17 @@ namespace System.IO
if (pointer == null)
throw new ArgumentNullException(nameof(pointer));
if (length < 0 || capacity < 0)
- throw new ArgumentOutOfRangeException((length < 0) ? nameof(length) : nameof(capacity), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException((length < 0) ? nameof(length) : nameof(capacity), SR.ArgumentOutOfRange_NeedNonNegNum);
if (length > capacity)
- throw new ArgumentOutOfRangeException(nameof(length), Environment.GetResourceString("ArgumentOutOfRange_LengthGreaterThanCapacity"));
+ throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_LengthGreaterThanCapacity);
Contract.EndContractBlock();
// Check for wraparound.
if (((byte*)((long)pointer + capacity)) < pointer)
- throw new ArgumentOutOfRangeException(nameof(capacity), Environment.GetResourceString("ArgumentOutOfRange_UnmanagedMemStreamWrapAround"));
+ throw new ArgumentOutOfRangeException(nameof(capacity), SR.ArgumentOutOfRange_UnmanagedMemStreamWrapAround);
if (access < FileAccess.Read || access > FileAccess.ReadWrite)
- throw new ArgumentOutOfRangeException(nameof(access), Environment.GetResourceString("ArgumentOutOfRange_Enum"));
+ throw new ArgumentOutOfRangeException(nameof(access), SR.ArgumentOutOfRange_Enum);
if (_isOpen)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CalledTwice"));
+ throw new InvalidOperationException(SR.InvalidOperation_CalledTwice);
_mem = pointer;
_offset = 0;
@@ -295,7 +295,7 @@ namespace System.IO
set
{
if (value < 0)
- throw new ArgumentOutOfRangeException(nameof(value), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
if (!CanSeek) __Error.StreamIsClosed();
@@ -303,7 +303,7 @@ namespace System.IO
unsafe {
// On 32 bit machines, ensure we don't wrap around.
if (value > (long) Int32.MaxValue || _mem + value < _mem)
- throw new ArgumentOutOfRangeException(nameof(value), Environment.GetResourceString("ArgumentOutOfRange_StreamLength"));
+ throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_StreamLength);
}
#endif
Interlocked.Exchange(ref _position, value);
@@ -317,13 +317,13 @@ namespace System.IO
{
if (_buffer != null)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_UmsSafeBuffer"));
+ throw new NotSupportedException(SR.NotSupported_UmsSafeBuffer);
}
// Use a temp to avoid a race
long pos = Interlocked.Read(ref _position);
if (pos > _capacity)
- throw new IndexOutOfRangeException(Environment.GetResourceString("IndexOutOfRange_UMSPosition"));
+ throw new IndexOutOfRangeException(SR.IndexOutOfRange_UMSPosition);
byte* ptr = _mem + pos;
if (!_isOpen) __Error.StreamIsClosed();
return ptr;
@@ -331,15 +331,15 @@ namespace System.IO
set
{
if (_buffer != null)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_UmsSafeBuffer"));
+ throw new NotSupportedException(SR.NotSupported_UmsSafeBuffer);
if (!_isOpen) __Error.StreamIsClosed();
// Note: subtracting pointers returns an Int64. Working around
// to avoid hitting compiler warning CS0652 on this line.
if (new IntPtr(value - _mem).ToInt64() > UnmanagedMemStreamMaxLength)
- throw new ArgumentOutOfRangeException("offset", Environment.GetResourceString("ArgumentOutOfRange_UnmanagedMemStreamLength"));
+ throw new ArgumentOutOfRangeException("offset", SR.ArgumentOutOfRange_UnmanagedMemStreamLength);
if (value < _mem)
- throw new IOException(Environment.GetResourceString("IO.IO_SeekBeforeBegin"));
+ throw new IOException(SR.IO_SeekBeforeBegin);
Interlocked.Exchange(ref _position, value - _mem);
}
@@ -350,7 +350,7 @@ namespace System.IO
get
{
if (_buffer != null)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_UmsSafeBuffer"));
+ throw new NotSupportedException(SR.NotSupported_UmsSafeBuffer);
return _mem;
}
@@ -359,13 +359,13 @@ namespace System.IO
public override int Read([In, Out] byte[] buffer, int offset, int count)
{
if (buffer == null)
- throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
if (offset < 0)
- throw new ArgumentOutOfRangeException(nameof(offset), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
if (count < 0)
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
if (buffer.Length - offset < count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
Contract.EndContractBlock(); // Keep this in sync with contract validation in ReadAsync
if (!_isOpen) __Error.StreamIsClosed();
@@ -421,13 +421,13 @@ namespace System.IO
public override Task<Int32> ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
{
if (buffer == null)
- throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
if (offset < 0)
- throw new ArgumentOutOfRangeException(nameof(offset), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
if (count < 0)
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
if (buffer.Length - offset < count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
Contract.EndContractBlock(); // contract validation copied from Read(...)
if (cancellationToken.IsCancellationRequested)
@@ -491,31 +491,31 @@ namespace System.IO
{
if (!_isOpen) __Error.StreamIsClosed();
if (offset > UnmanagedMemStreamMaxLength)
- throw new ArgumentOutOfRangeException(nameof(offset), Environment.GetResourceString("ArgumentOutOfRange_UnmanagedMemStreamLength"));
+ throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_UnmanagedMemStreamLength);
switch (loc)
{
case SeekOrigin.Begin:
if (offset < 0)
- throw new IOException(Environment.GetResourceString("IO.IO_SeekBeforeBegin"));
+ throw new IOException(SR.IO_SeekBeforeBegin);
Interlocked.Exchange(ref _position, offset);
break;
case SeekOrigin.Current:
long pos = Interlocked.Read(ref _position);
if (offset + pos < 0)
- throw new IOException(Environment.GetResourceString("IO.IO_SeekBeforeBegin"));
+ throw new IOException(SR.IO_SeekBeforeBegin);
Interlocked.Exchange(ref _position, offset + pos);
break;
case SeekOrigin.End:
long len = Interlocked.Read(ref _length);
if (len + offset < 0)
- throw new IOException(Environment.GetResourceString("IO.IO_SeekBeforeBegin"));
+ throw new IOException(SR.IO_SeekBeforeBegin);
Interlocked.Exchange(ref _position, len + offset);
break;
default:
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidSeekOrigin"));
+ throw new ArgumentException(SR.Argument_InvalidSeekOrigin);
}
long finalPos = Interlocked.Read(ref _position);
@@ -526,15 +526,15 @@ namespace System.IO
public override void SetLength(long value)
{
if (value < 0)
- throw new ArgumentOutOfRangeException("length", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException("length", SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
if (_buffer != null)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_UmsSafeBuffer"));
+ throw new NotSupportedException(SR.NotSupported_UmsSafeBuffer);
if (!_isOpen) __Error.StreamIsClosed();
if (!CanWrite) __Error.WriteNotSupported();
if (value > _capacity)
- throw new IOException(Environment.GetResourceString("IO.IO_FixedCapacity"));
+ throw new IOException(SR.IO_FixedCapacity);
long pos = Interlocked.Read(ref _position);
long len = Interlocked.Read(ref _length);
@@ -555,13 +555,13 @@ namespace System.IO
public override void Write(byte[] buffer, int offset, int count)
{
if (buffer == null)
- throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
if (offset < 0)
- throw new ArgumentOutOfRangeException(nameof(offset), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
if (count < 0)
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
if (buffer.Length - offset < count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
Contract.EndContractBlock(); // Keep contract validation in sync with WriteAsync(..)
if (!_isOpen) __Error.StreamIsClosed();
@@ -572,11 +572,11 @@ namespace System.IO
long n = pos + count;
// Check for overflow
if (n < 0)
- throw new IOException(Environment.GetResourceString("IO.IO_StreamTooLong"));
+ throw new IOException(SR.IO_StreamTooLong);
if (n > _capacity)
{
- throw new NotSupportedException(Environment.GetResourceString("IO.IO_FixedCapacity"));
+ throw new NotSupportedException(SR.IO_FixedCapacity);
}
if (_buffer == null)
@@ -607,7 +607,7 @@ namespace System.IO
long bytesLeft = _capacity - pos;
if (bytesLeft < count)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_BufferTooSmall"));
+ throw new ArgumentException(SR.Arg_BufferTooSmall);
}
byte* pointer = null;
@@ -638,13 +638,13 @@ namespace System.IO
public override Task WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
{
if (buffer == null)
- throw new ArgumentNullException(nameof(buffer), Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
if (offset < 0)
- throw new ArgumentOutOfRangeException(nameof(offset), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_NeedNonNegNum);
if (count < 0)
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
if (buffer.Length - offset < count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
Contract.EndContractBlock(); // contract validation copied from Write(..)
if (cancellationToken.IsCancellationRequested)
@@ -675,10 +675,10 @@ namespace System.IO
{
// Check for overflow
if (n < 0)
- throw new IOException(Environment.GetResourceString("IO.IO_StreamTooLong"));
+ throw new IOException(SR.IO_StreamTooLong);
if (n > _capacity)
- throw new NotSupportedException(Environment.GetResourceString("IO.IO_FixedCapacity"));
+ throw new NotSupportedException(SR.IO_FixedCapacity);
// Check to see whether we are now expanding the stream and must
// zero any memory in the middle.
diff --git a/src/mscorlib/src/System/IO/UnmanagedMemoryStreamWrapper.cs b/src/mscorlib/src/System/IO/UnmanagedMemoryStreamWrapper.cs
index 04d5be3c5e..86e4707dfd 100644
--- a/src/mscorlib/src/System/IO/UnmanagedMemoryStreamWrapper.cs
+++ b/src/mscorlib/src/System/IO/UnmanagedMemoryStreamWrapper.cs
@@ -70,7 +70,7 @@ namespace System.IO
public override byte[] GetBuffer()
{
- throw new UnauthorizedAccessException(Environment.GetResourceString("UnauthorizedAccess_MemStreamBuffer"));
+ throw new UnauthorizedAccessException(SR.UnauthorizedAccess_MemStreamBuffer);
}
public override bool TryGetBuffer(out ArraySegment<byte> buffer)
@@ -88,7 +88,7 @@ namespace System.IO
[SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
set
{
- throw new IOException(Environment.GetResourceString("IO.IO_FixedCapacity"));
+ throw new IOException(SR.IO_FixedCapacity);
}
}
@@ -151,7 +151,7 @@ namespace System.IO
public unsafe override void WriteTo(Stream stream)
{
if (stream == null)
- throw new ArgumentNullException(nameof(stream), Environment.GetResourceString("ArgumentNull_Stream"));
+ throw new ArgumentNullException(nameof(stream), SR.ArgumentNull_Stream);
Contract.EndContractBlock();
if (!_unmanagedStream._isOpen) __Error.StreamIsClosed();
@@ -178,19 +178,19 @@ namespace System.IO
throw new ArgumentNullException(nameof(destination));
if (bufferSize <= 0)
- throw new ArgumentOutOfRangeException(nameof(bufferSize), Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum"));
+ throw new ArgumentOutOfRangeException(nameof(bufferSize), SR.ArgumentOutOfRange_NeedPosNum);
if (!CanRead && !CanWrite)
- throw new ObjectDisposedException(null, Environment.GetResourceString("ObjectDisposed_StreamClosed"));
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_StreamClosed);
if (!destination.CanRead && !destination.CanWrite)
- throw new ObjectDisposedException(nameof(destination), Environment.GetResourceString("ObjectDisposed_StreamClosed"));
+ throw new ObjectDisposedException(nameof(destination), SR.ObjectDisposed_StreamClosed);
if (!CanRead)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_UnreadableStream"));
+ throw new NotSupportedException(SR.NotSupported_UnreadableStream);
if (!destination.CanWrite)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_UnwritableStream"));
+ throw new NotSupportedException(SR.NotSupported_UnwritableStream);
Contract.EndContractBlock();
diff --git a/src/mscorlib/src/System/IO/__Error.cs b/src/mscorlib/src/System/IO/__Error.cs
index 14c8eb9f3b..70f83261ed 100644
--- a/src/mscorlib/src/System/IO/__Error.cs
+++ b/src/mscorlib/src/System/IO/__Error.cs
@@ -30,49 +30,49 @@ namespace System.IO
{
internal static void EndOfFile()
{
- throw new EndOfStreamException(Environment.GetResourceString("IO.EOF_ReadBeyondEOF"));
+ throw new EndOfStreamException(SR.IO_EOF_ReadBeyondEOF);
}
internal static void FileNotOpen()
{
- throw new ObjectDisposedException(null, Environment.GetResourceString("ObjectDisposed_FileClosed"));
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_FileClosed);
}
internal static void StreamIsClosed()
{
- throw new ObjectDisposedException(null, Environment.GetResourceString("ObjectDisposed_StreamClosed"));
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_StreamClosed);
}
internal static void MemoryStreamNotExpandable()
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_MemStreamNotExpandable"));
+ throw new NotSupportedException(SR.NotSupported_MemStreamNotExpandable);
}
internal static void ReaderClosed()
{
- throw new ObjectDisposedException(null, Environment.GetResourceString("ObjectDisposed_ReaderClosed"));
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
}
internal static void ReadNotSupported()
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_UnreadableStream"));
+ throw new NotSupportedException(SR.NotSupported_UnreadableStream);
}
internal static void WrongAsyncResult()
{
- throw new ArgumentException(Environment.GetResourceString("Arg_WrongAsyncResult"));
+ throw new ArgumentException(SR.Arg_WrongAsyncResult);
}
internal static void EndReadCalledTwice()
{
// Should ideally be InvalidOperationExc but we can't maitain parity with Stream and FileStream without some work
- throw new ArgumentException(Environment.GetResourceString("InvalidOperation_EndReadCalledMultiple"));
+ throw new ArgumentException(SR.InvalidOperation_EndReadCalledMultiple);
}
internal static void EndWriteCalledTwice()
{
// Should ideally be InvalidOperationExc but we can't maintain parity with Stream and FileStream without some work
- throw new ArgumentException(Environment.GetResourceString("InvalidOperation_EndWriteCalledMultiple"));
+ throw new ArgumentException(SR.InvalidOperation_EndWriteCalledMultiple);
}
// Given a possible fully qualified path, ensure that we have path
@@ -124,7 +124,7 @@ namespace System.IO
if (!safeToReturn)
{
if (PathInternal.IsDirectorySeparator(path[path.Length - 1]))
- path = Environment.GetResourceString("IO.IO_NoPermissionToDirectoryName");
+ path = SR.IO_NoPermissionToDirectoryName;
else
path = Path.GetFileName(path);
}
@@ -153,46 +153,46 @@ namespace System.IO
{
case Win32Native.ERROR_FILE_NOT_FOUND:
if (str.Length == 0)
- throw new FileNotFoundException(Environment.GetResourceString("IO.FileNotFound"));
+ throw new FileNotFoundException(SR.IO_FileNotFound);
else
- throw new FileNotFoundException(Environment.GetResourceString("IO.FileNotFound_FileName", str), str);
+ throw new FileNotFoundException(SR.Format(SR.IO_FileNotFound_FileName, str), str);
case Win32Native.ERROR_PATH_NOT_FOUND:
if (str.Length == 0)
- throw new DirectoryNotFoundException(Environment.GetResourceString("IO.PathNotFound_NoPathName"));
+ throw new DirectoryNotFoundException(SR.IO_PathNotFound_NoPathName);
else
- throw new DirectoryNotFoundException(Environment.GetResourceString("IO.PathNotFound_Path", str));
+ throw new DirectoryNotFoundException(SR.Format(SR.IO_PathNotFound_Path, str));
case Win32Native.ERROR_ACCESS_DENIED:
if (str.Length == 0)
- throw new UnauthorizedAccessException(Environment.GetResourceString("UnauthorizedAccess_IODenied_NoPathName"));
+ throw new UnauthorizedAccessException(SR.UnauthorizedAccess_IODenied_NoPathName);
else
- throw new UnauthorizedAccessException(Environment.GetResourceString("UnauthorizedAccess_IODenied_Path", str));
+ throw new UnauthorizedAccessException(SR.Format(SR.UnauthorizedAccess_IODenied_Path, str));
case Win32Native.ERROR_ALREADY_EXISTS:
if (str.Length == 0)
goto default;
- throw new IOException(Environment.GetResourceString("IO.IO_AlreadyExists_Name", str), Win32Native.MakeHRFromErrorCode(errorCode), maybeFullPath);
+ throw new IOException(SR.Format(SR.IO_AlreadyExists_Name, str), Win32Native.MakeHRFromErrorCode(errorCode), maybeFullPath);
case Win32Native.ERROR_FILENAME_EXCED_RANGE:
- throw new PathTooLongException(Environment.GetResourceString("IO.PathTooLong"));
+ throw new PathTooLongException(SR.IO_PathTooLong);
case Win32Native.ERROR_INVALID_DRIVE:
- throw new DriveNotFoundException(Environment.GetResourceString("IO.DriveNotFound_Drive", str));
+ throw new DriveNotFoundException(SR.Format(SR.IO_DriveNotFound_Drive, str));
case Win32Native.ERROR_INVALID_PARAMETER:
throw new IOException(Win32Native.GetMessage(errorCode), Win32Native.MakeHRFromErrorCode(errorCode), maybeFullPath);
case Win32Native.ERROR_SHARING_VIOLATION:
if (str.Length == 0)
- throw new IOException(Environment.GetResourceString("IO.IO_SharingViolation_NoFileName"), Win32Native.MakeHRFromErrorCode(errorCode), maybeFullPath);
+ throw new IOException(SR.IO_SharingViolation_NoFileName, Win32Native.MakeHRFromErrorCode(errorCode), maybeFullPath);
else
- throw new IOException(Environment.GetResourceString("IO.IO_SharingViolation_File", str), Win32Native.MakeHRFromErrorCode(errorCode), maybeFullPath);
+ throw new IOException(SR.Format(SR.IO_SharingViolation_File, str), Win32Native.MakeHRFromErrorCode(errorCode), maybeFullPath);
case Win32Native.ERROR_FILE_EXISTS:
if (str.Length == 0)
goto default;
- throw new IOException(Environment.GetResourceString("IO.IO_FileExists_Name", str), Win32Native.MakeHRFromErrorCode(errorCode), maybeFullPath);
+ throw new IOException(SR.Format(SR.IO_FileExists_Name, str), Win32Native.MakeHRFromErrorCode(errorCode), maybeFullPath);
case Win32Native.ERROR_OPERATION_ABORTED:
throw new OperationCanceledException();
@@ -204,7 +204,7 @@ namespace System.IO
internal static void WriteNotSupported()
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_UnwritableStream"));
+ throw new NotSupportedException(SR.NotSupported_UnwritableStream);
}
// From WinError.h
diff --git a/src/mscorlib/src/System/IServiceObjectProvider.cs b/src/mscorlib/src/System/IServiceObjectProvider.cs
deleted file mode 100644
index 434ee2b5f8..0000000000
--- a/src/mscorlib/src/System/IServiceObjectProvider.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace System
-{
- public interface IServiceProvider
- {
- // Interface does not need to be marked with the serializable attribute
- Object GetService(Type serviceType);
- }
-}
diff --git a/src/mscorlib/src/System/Int16.cs b/src/mscorlib/src/System/Int16.cs
index 89b081b55b..69f71af278 100644
--- a/src/mscorlib/src/System/Int16.cs
+++ b/src/mscorlib/src/System/Int16.cs
@@ -48,7 +48,7 @@ namespace System
return m_value - ((Int16)value).m_value;
}
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeInt16"));
+ throw new ArgumentException(SR.Arg_MustBeInt16);
}
public int CompareTo(Int16 value)
@@ -145,7 +145,7 @@ namespace System
}
catch (OverflowException e)
{
- throw new OverflowException(Environment.GetResourceString("Overflow_Int16"), e);
+ throw new OverflowException(SR.Overflow_Int16, e);
}
// We need this check here since we don't allow signs to specified in hex numbers. So we fixup the result
@@ -154,12 +154,12 @@ namespace System
{ // We are parsing a hexadecimal number
if ((i < 0) || (i > UInt16.MaxValue))
{
- throw new OverflowException(Environment.GetResourceString("Overflow_Int16"));
+ throw new OverflowException(SR.Overflow_Int16);
}
return (short)i;
}
- if (i < MinValue || i > MaxValue) throw new OverflowException(Environment.GetResourceString("Overflow_Int16"));
+ if (i < MinValue || i > MaxValue) throw new OverflowException(SR.Overflow_Int16);
return (short)i;
}
@@ -213,91 +213,76 @@ namespace System
}
- /// <internalonly/>
bool IConvertible.ToBoolean(IFormatProvider provider)
{
return Convert.ToBoolean(m_value);
}
- /// <internalonly/>
char IConvertible.ToChar(IFormatProvider provider)
{
return Convert.ToChar(m_value);
}
- /// <internalonly/>
sbyte IConvertible.ToSByte(IFormatProvider provider)
{
return Convert.ToSByte(m_value);
}
- /// <internalonly/>
byte IConvertible.ToByte(IFormatProvider provider)
{
return Convert.ToByte(m_value);
}
- /// <internalonly/>
short IConvertible.ToInt16(IFormatProvider provider)
{
return m_value;
}
- /// <internalonly/>
ushort IConvertible.ToUInt16(IFormatProvider provider)
{
return Convert.ToUInt16(m_value);
}
- /// <internalonly/>
int IConvertible.ToInt32(IFormatProvider provider)
{
return Convert.ToInt32(m_value);
}
- /// <internalonly/>
uint IConvertible.ToUInt32(IFormatProvider provider)
{
return Convert.ToUInt32(m_value);
}
- /// <internalonly/>
long IConvertible.ToInt64(IFormatProvider provider)
{
return Convert.ToInt64(m_value);
}
- /// <internalonly/>
ulong IConvertible.ToUInt64(IFormatProvider provider)
{
return Convert.ToUInt64(m_value);
}
- /// <internalonly/>
float IConvertible.ToSingle(IFormatProvider provider)
{
return Convert.ToSingle(m_value);
}
- /// <internalonly/>
double IConvertible.ToDouble(IFormatProvider provider)
{
return Convert.ToDouble(m_value);
}
- /// <internalonly/>
Decimal IConvertible.ToDecimal(IFormatProvider provider)
{
return Convert.ToDecimal(m_value);
}
- /// <internalonly/>
DateTime IConvertible.ToDateTime(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "Int16", "DateTime"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Int16", "DateTime"));
}
- /// <internalonly/>
Object IConvertible.ToType(Type type, IFormatProvider provider)
{
return Convert.DefaultToType((IConvertible)this, type, provider);
diff --git a/src/mscorlib/src/System/Int32.cs b/src/mscorlib/src/System/Int32.cs
index cbbd5f912b..90b70a9554 100644
--- a/src/mscorlib/src/System/Int32.cs
+++ b/src/mscorlib/src/System/Int32.cs
@@ -51,7 +51,7 @@ namespace System
if (m_value > i) return 1;
return 0;
}
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeInt32"));
+ throw new ArgumentException(SR.Arg_MustBeInt32);
}
public int CompareTo(int value)
@@ -175,91 +175,76 @@ namespace System
return TypeCode.Int32;
}
- /// <internalonly/>
bool IConvertible.ToBoolean(IFormatProvider provider)
{
return Convert.ToBoolean(m_value);
}
- /// <internalonly/>
char IConvertible.ToChar(IFormatProvider provider)
{
return Convert.ToChar(m_value);
}
- /// <internalonly/>
sbyte IConvertible.ToSByte(IFormatProvider provider)
{
return Convert.ToSByte(m_value);
}
- /// <internalonly/>
byte IConvertible.ToByte(IFormatProvider provider)
{
return Convert.ToByte(m_value);
}
- /// <internalonly/>
short IConvertible.ToInt16(IFormatProvider provider)
{
return Convert.ToInt16(m_value);
}
- /// <internalonly/>
ushort IConvertible.ToUInt16(IFormatProvider provider)
{
return Convert.ToUInt16(m_value);
}
- /// <internalonly/>
int IConvertible.ToInt32(IFormatProvider provider)
{
return m_value;
}
- /// <internalonly/>
uint IConvertible.ToUInt32(IFormatProvider provider)
{
return Convert.ToUInt32(m_value);
}
- /// <internalonly/>
long IConvertible.ToInt64(IFormatProvider provider)
{
return Convert.ToInt64(m_value);
}
- /// <internalonly/>
ulong IConvertible.ToUInt64(IFormatProvider provider)
{
return Convert.ToUInt64(m_value);
}
- /// <internalonly/>
float IConvertible.ToSingle(IFormatProvider provider)
{
return Convert.ToSingle(m_value);
}
- /// <internalonly/>
double IConvertible.ToDouble(IFormatProvider provider)
{
return Convert.ToDouble(m_value);
}
- /// <internalonly/>
Decimal IConvertible.ToDecimal(IFormatProvider provider)
{
return Convert.ToDecimal(m_value);
}
- /// <internalonly/>
DateTime IConvertible.ToDateTime(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "Int32", "DateTime"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Int32", "DateTime"));
}
- /// <internalonly/>
Object IConvertible.ToType(Type type, IFormatProvider provider)
{
return Convert.DefaultToType((IConvertible)this, type, provider);
diff --git a/src/mscorlib/src/System/Int64.cs b/src/mscorlib/src/System/Int64.cs
index 9e68c423cf..3d64362e30 100644
--- a/src/mscorlib/src/System/Int64.cs
+++ b/src/mscorlib/src/System/Int64.cs
@@ -50,7 +50,7 @@ namespace System
if (m_value > i) return 1;
return 0;
}
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeInt64"));
+ throw new ArgumentException(SR.Arg_MustBeInt64);
}
public int CompareTo(Int64 value)
@@ -154,91 +154,76 @@ namespace System
return TypeCode.Int64;
}
- /// <internalonly/>
bool IConvertible.ToBoolean(IFormatProvider provider)
{
return Convert.ToBoolean(m_value);
}
- /// <internalonly/>
char IConvertible.ToChar(IFormatProvider provider)
{
return Convert.ToChar(m_value);
}
- /// <internalonly/>
sbyte IConvertible.ToSByte(IFormatProvider provider)
{
return Convert.ToSByte(m_value);
}
- /// <internalonly/>
byte IConvertible.ToByte(IFormatProvider provider)
{
return Convert.ToByte(m_value);
}
- /// <internalonly/>
short IConvertible.ToInt16(IFormatProvider provider)
{
return Convert.ToInt16(m_value);
}
- /// <internalonly/>
ushort IConvertible.ToUInt16(IFormatProvider provider)
{
return Convert.ToUInt16(m_value);
}
- /// <internalonly/>
int IConvertible.ToInt32(IFormatProvider provider)
{
return Convert.ToInt32(m_value);
}
- /// <internalonly/>
uint IConvertible.ToUInt32(IFormatProvider provider)
{
return Convert.ToUInt32(m_value);
}
- /// <internalonly/>
long IConvertible.ToInt64(IFormatProvider provider)
{
return m_value;
}
- /// <internalonly/>
ulong IConvertible.ToUInt64(IFormatProvider provider)
{
return Convert.ToUInt64(m_value);
}
- /// <internalonly/>
float IConvertible.ToSingle(IFormatProvider provider)
{
return Convert.ToSingle(m_value);
}
- /// <internalonly/>
double IConvertible.ToDouble(IFormatProvider provider)
{
return Convert.ToDouble(m_value);
}
- /// <internalonly/>
Decimal IConvertible.ToDecimal(IFormatProvider provider)
{
return Convert.ToDecimal(m_value);
}
- /// <internalonly/>
DateTime IConvertible.ToDateTime(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "Int64", "DateTime"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Int64", "DateTime"));
}
- /// <internalonly/>
Object IConvertible.ToType(Type type, IFormatProvider provider)
{
return Convert.DefaultToType((IConvertible)this, type, provider);
diff --git a/src/mscorlib/src/System/IntPtr.cs b/src/mscorlib/src/System/IntPtr.cs
index 17a2d3864c..28f1b1baa8 100644
--- a/src/mscorlib/src/System/IntPtr.cs
+++ b/src/mscorlib/src/System/IntPtr.cs
@@ -69,7 +69,7 @@ namespace System
if (Size == 4 && (l > Int32.MaxValue || l < Int32.MinValue))
{
- throw new ArgumentException(Environment.GetResourceString("Serialization_InvalidPtrValue"));
+ throw new ArgumentException(SR.Serialization_InvalidPtrValue);
}
m_value = (void*)l;
diff --git a/src/mscorlib/src/System/Internal.cs b/src/mscorlib/src/System/Internal.cs
index 6c1b3b8243..1534326921 100644
--- a/src/mscorlib/src/System/Internal.cs
+++ b/src/mscorlib/src/System/Internal.cs
@@ -29,7 +29,7 @@ using System.Runtime.InteropServices.WindowsRuntime;
namespace System
{
- internal static class Internal
+ static class CommonlyUsedGenericInstantiations
{
// This method is purely an aid for NGen to statically deduce which
// instantiations to save in the ngen image.
@@ -45,7 +45,7 @@ namespace System
// instantiation closure process is driven by "fixup" references
// left in the final code stream.
[MethodImplAttribute(MethodImplOptions.NoOptimization)]
- private static void CommonlyUsedGenericInstantiations()
+ static CommonlyUsedGenericInstantiations()
{
// Make absolutely sure we include some of the most common
// instantiations here in mscorlib's ngen image.
diff --git a/src/mscorlib/src/System/Math.cs b/src/mscorlib/src/System/Math.cs
index 4cdb7944b2..6f7d731ab1 100644
--- a/src/mscorlib/src/System/Math.cs
+++ b/src/mscorlib/src/System/Math.cs
@@ -113,7 +113,7 @@ namespace System
public static double Round(double value, int digits)
{
if ((digits < 0) || (digits > maxRoundingDigits))
- throw new ArgumentOutOfRangeException(nameof(digits), Environment.GetResourceString("ArgumentOutOfRange_RoundingDigits"));
+ throw new ArgumentOutOfRangeException(nameof(digits), SR.ArgumentOutOfRange_RoundingDigits);
Contract.EndContractBlock();
return InternalRound(value, digits, MidpointRounding.ToEven);
}
@@ -126,10 +126,10 @@ namespace System
public static double Round(double value, int digits, MidpointRounding mode)
{
if ((digits < 0) || (digits > maxRoundingDigits))
- throw new ArgumentOutOfRangeException(nameof(digits), Environment.GetResourceString("ArgumentOutOfRange_RoundingDigits"));
+ throw new ArgumentOutOfRangeException(nameof(digits), SR.ArgumentOutOfRange_RoundingDigits);
if (mode < MidpointRounding.ToEven || mode > MidpointRounding.AwayFromZero)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidEnumValue", mode, nameof(MidpointRounding)), nameof(mode));
+ throw new ArgumentException(SR.Format(SR.Argument_InvalidEnumValue, mode, nameof(MidpointRounding)), nameof(mode));
}
Contract.EndContractBlock();
return InternalRound(value, digits, mode);
@@ -243,7 +243,7 @@ namespace System
{
Contract.Requires(value < 0, "AbsHelper should only be called for negative values! (workaround for JIT inlining)");
if (value == SByte.MinValue)
- throw new OverflowException(Environment.GetResourceString("Overflow_NegateTwosCompNum"));
+ throw new OverflowException(SR.Overflow_NegateTwosCompNum);
Contract.EndContractBlock();
return ((sbyte)(-value));
}
@@ -260,7 +260,7 @@ namespace System
{
Contract.Requires(value < 0, "AbsHelper should only be called for negative values! (workaround for JIT inlining)");
if (value == Int16.MinValue)
- throw new OverflowException(Environment.GetResourceString("Overflow_NegateTwosCompNum"));
+ throw new OverflowException(SR.Overflow_NegateTwosCompNum);
Contract.EndContractBlock();
return (short)-value;
}
@@ -277,7 +277,7 @@ namespace System
{
Contract.Requires(value < 0, "AbsHelper should only be called for negative values! (workaround for JIT inlining)");
if (value == Int32.MinValue)
- throw new OverflowException(Environment.GetResourceString("Overflow_NegateTwosCompNum"));
+ throw new OverflowException(SR.Overflow_NegateTwosCompNum);
Contract.EndContractBlock();
return -value;
}
@@ -294,7 +294,7 @@ namespace System
{
Contract.Requires(value < 0, "AbsHelper should only be called for negative values! (workaround for JIT inlining)");
if (value == Int64.MinValue)
- throw new OverflowException(Environment.GetResourceString("Overflow_NegateTwosCompNum"));
+ throw new OverflowException(SR.Overflow_NegateTwosCompNum);
Contract.EndContractBlock();
return -value;
}
@@ -631,7 +631,7 @@ namespace System
private static void ThrowMinMaxException<T>(T min, T max)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_MinMaxValue", min, max));
+ throw new ArgumentException(SR.Format(SR.Argument_MinMaxValue, min, max));
}
/*=====================================Log======================================
@@ -713,7 +713,7 @@ namespace System
return 1;
else if (value == 0)
return 0;
- throw new ArithmeticException(Environment.GetResourceString("Arithmetic_NaN"));
+ throw new ArithmeticException(SR.Arithmetic_NaN);
}
public static int Sign(double value)
@@ -724,7 +724,7 @@ namespace System
return 1;
else if (value == 0)
return 0;
- throw new ArithmeticException(Environment.GetResourceString("Arithmetic_NaN"));
+ throw new ArithmeticException(SR.Arithmetic_NaN);
}
public static int Sign(Decimal value)
diff --git a/src/mscorlib/src/System/MathF.cs b/src/mscorlib/src/System/MathF.cs
index 2abac7b5db..60669a4561 100644
--- a/src/mscorlib/src/System/MathF.cs
+++ b/src/mscorlib/src/System/MathF.cs
@@ -159,7 +159,7 @@ namespace System
{
if ((digits < 0) || (digits > maxRoundingDigits))
{
- throw new ArgumentOutOfRangeException(nameof(digits), Environment.GetResourceString("ArgumentOutOfRange_RoundingDigits"));
+ throw new ArgumentOutOfRangeException(nameof(digits), SR.ArgumentOutOfRange_RoundingDigits);
}
Contract.EndContractBlock();
@@ -170,12 +170,12 @@ namespace System
{
if ((digits < 0) || (digits > maxRoundingDigits))
{
- throw new ArgumentOutOfRangeException(nameof(digits), Environment.GetResourceString("ArgumentOutOfRange_RoundingDigits"));
+ throw new ArgumentOutOfRangeException(nameof(digits), SR.ArgumentOutOfRange_RoundingDigits);
}
if (mode < MidpointRounding.ToEven || mode > MidpointRounding.AwayFromZero)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidEnumx", mode, nameof(MidpointRounding)), nameof(mode));
+ throw new ArgumentException(SR.Format(SR.Argument_InvalidEnum, mode, nameof(MidpointRounding)), nameof(mode));
}
Contract.EndContractBlock();
@@ -186,7 +186,7 @@ namespace System
{
if (mode < MidpointRounding.ToEven || mode > MidpointRounding.AwayFromZero)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidEnumx", mode, nameof(MidpointRounding)), nameof(mode));
+ throw new ArgumentException(SR.Format(SR.Argument_InvalidEnum, mode, nameof(MidpointRounding)), nameof(mode));
}
Contract.EndContractBlock();
diff --git a/src/mscorlib/src/System/MissingFieldException.cs b/src/mscorlib/src/System/MissingFieldException.cs
index 15d1a684bc..65a97262ea 100644
--- a/src/mscorlib/src/System/MissingFieldException.cs
+++ b/src/mscorlib/src/System/MissingFieldException.cs
@@ -22,7 +22,7 @@ namespace System
public class MissingFieldException : MissingMemberException, ISerializable
{
public MissingFieldException()
- : base(Environment.GetResourceString("Arg_MissingFieldException"))
+ : base(SR.Arg_MissingFieldException)
{
SetErrorCode(__HResults.COR_E_MISSINGFIELD);
}
@@ -54,9 +54,7 @@ namespace System
else
{
// do any desired fixups to classname here.
- return Environment.GetResourceString("MissingField_Name",
- (Signature != null ? FormatSignature(Signature) + " " : "") +
- ClassName + "." + MemberName);
+ return SR.Format(SR.MissingField_Name, (Signature != null ? FormatSignature(Signature) + " " : "") + ClassName + "." + MemberName);
}
}
}
diff --git a/src/mscorlib/src/System/MissingMemberException.cs b/src/mscorlib/src/System/MissingMemberException.cs
index be5ac83743..d40aa53f96 100644
--- a/src/mscorlib/src/System/MissingMemberException.cs
+++ b/src/mscorlib/src/System/MissingMemberException.cs
@@ -26,7 +26,7 @@ namespace System
public class MissingMemberException : MemberAccessException, ISerializable
{
public MissingMemberException()
- : base(Environment.GetResourceString("Arg_MissingMemberException"))
+ : base(SR.Arg_MissingMemberException)
{
SetErrorCode(__HResults.COR_E_MISSINGMEMBER);
}
@@ -61,9 +61,7 @@ namespace System
else
{
// do any desired fixups to classname here.
- return Environment.GetResourceString("MissingMember_Name",
- ClassName + "." + MemberName +
- (Signature != null ? " " + FormatSignature(Signature) : ""));
+ return SR.Format(SR.MissingMember_Name, ClassName + "." + MemberName + (Signature != null ? " " + FormatSignature(Signature) : ""));
}
}
}
diff --git a/src/mscorlib/src/System/MissingMethodException.cs b/src/mscorlib/src/System/MissingMethodException.cs
index 81b2f61205..c17ab8ed9b 100644
--- a/src/mscorlib/src/System/MissingMethodException.cs
+++ b/src/mscorlib/src/System/MissingMethodException.cs
@@ -24,7 +24,7 @@ namespace System
public class MissingMethodException : MissingMemberException, ISerializable
{
public MissingMethodException()
- : base(Environment.GetResourceString("Arg_MissingMethodException"))
+ : base(SR.Arg_MissingMethodException)
{
SetErrorCode(__HResults.COR_E_MISSINGMETHOD);
}
@@ -56,9 +56,7 @@ namespace System
else
{
// do any desired fixups to classname here.
- return Environment.GetResourceString("MissingMethod_Name",
- ClassName + "." + MemberName +
- (Signature != null ? " " + FormatSignature(Signature) : ""));
+ return SR.Format(SR.MissingMethod_Name, ClassName + "." + MemberName + (Signature != null ? " " + FormatSignature(Signature) : ""));
}
}
}
diff --git a/src/mscorlib/src/System/MulticastDelegate.cs b/src/mscorlib/src/System/MulticastDelegate.cs
index 6d4d28891f..440c9a60bc 100644
--- a/src/mscorlib/src/System/MulticastDelegate.cs
+++ b/src/mscorlib/src/System/MulticastDelegate.cs
@@ -59,11 +59,11 @@ namespace System
// One can only create delegates on RuntimeMethodInfo and DynamicMethod.
// If it is not a RuntimeMethodInfo (must be a DynamicMethod) or if it is an unmanaged function pointer, throw
if (!(method is RuntimeMethodInfo) || IsUnmanagedFunctionPtr())
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidDelegateType"));
+ throw new SerializationException(SR.Serialization_InvalidDelegateType);
// We can't deal with secure delegates either.
if (!InvocationListLogicallyNull() && !_invocationCount.IsNull() && !_methodPtrAux.IsNull())
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidDelegateType"));
+ throw new SerializationException(SR.Serialization_InvalidDelegateType);
DelegateSerializationHolder.GetDelegateSerializationInfo(info, this.GetType(), Target, method, targetIndex);
}
@@ -91,7 +91,7 @@ namespace System
}
// if nothing was serialized it is a delegate over a DynamicMethod, so just throw
if (nextDe == null)
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidDelegateType"));
+ throw new SerializationException(SR.Serialization_InvalidDelegateType);
}
}
@@ -266,7 +266,7 @@ namespace System
// Verify that the types are the same...
if (!InternalEqualTypes(this, follow))
- throw new ArgumentException(Environment.GetResourceString("Arg_DlgtTypeMis"));
+ throw new ArgumentException(SR.Arg_DlgtTypeMis);
MulticastDelegate dFollow = (MulticastDelegate)follow;
Object[] resultList;
@@ -592,7 +592,7 @@ namespace System
[System.Diagnostics.DebuggerNonUserCode]
private void ThrowNullThisInDelegateToInstance()
{
- throw new ArgumentException(Environment.GetResourceString("Arg_DlgtNullInst"));
+ throw new ArgumentException(SR.Arg_DlgtNullInst);
}
[System.Diagnostics.DebuggerNonUserCode]
diff --git a/src/mscorlib/src/System/Number.cs b/src/mscorlib/src/System/Number.cs
index d7a1bc12e1..b30d4e643f 100644
--- a/src/mscorlib/src/System/Number.cs
+++ b/src/mscorlib/src/System/Number.cs
@@ -676,7 +676,7 @@ namespace System
if (!NumberBufferToDecimal(number.PackForNative(), ref result))
{
- throw new OverflowException(Environment.GetResourceString("Overflow_Decimal"));
+ throw new OverflowException(SR.Overflow_Decimal);
}
return result;
}
@@ -710,12 +710,12 @@ namespace System
{
return Double.NaN;
}
- throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ throw new FormatException(SR.Format_InvalidString);
}
if (!NumberBufferToDouble(number.PackForNative(), ref d))
{
- throw new OverflowException(Environment.GetResourceString("Overflow_Double"));
+ throw new OverflowException(SR.Overflow_Double);
}
return d;
@@ -733,14 +733,14 @@ namespace System
{
if (!HexNumberToInt32(ref number, ref i))
{
- throw new OverflowException(Environment.GetResourceString("Overflow_Int32"));
+ throw new OverflowException(SR.Overflow_Int32);
}
}
else
{
if (!NumberToInt32(ref number, ref i))
{
- throw new OverflowException(Environment.GetResourceString("Overflow_Int32"));
+ throw new OverflowException(SR.Overflow_Int32);
}
}
return i;
@@ -758,14 +758,14 @@ namespace System
{
if (!HexNumberToInt64(ref number, ref i))
{
- throw new OverflowException(Environment.GetResourceString("Overflow_Int64"));
+ throw new OverflowException(SR.Overflow_Int64);
}
}
else
{
if (!NumberToInt64(ref number, ref i))
{
- throw new OverflowException(Environment.GetResourceString("Overflow_Int64"));
+ throw new OverflowException(SR.Overflow_Int64);
}
}
return i;
@@ -1014,17 +1014,17 @@ namespace System
{
return Single.NaN;
}
- throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ throw new FormatException(SR.Format_InvalidString);
}
if (!NumberBufferToDouble(number.PackForNative(), ref d))
{
- throw new OverflowException(Environment.GetResourceString("Overflow_Single"));
+ throw new OverflowException(SR.Overflow_Single);
}
Single castSingle = (Single)d;
if (Single.IsInfinity(castSingle))
{
- throw new OverflowException(Environment.GetResourceString("Overflow_Single"));
+ throw new OverflowException(SR.Overflow_Single);
}
return castSingle;
}
@@ -1041,14 +1041,14 @@ namespace System
{
if (!HexNumberToUInt32(ref number, ref i))
{
- throw new OverflowException(Environment.GetResourceString("Overflow_UInt32"));
+ throw new OverflowException(SR.Overflow_UInt32);
}
}
else
{
if (!NumberToUInt32(ref number, ref i))
{
- throw new OverflowException(Environment.GetResourceString("Overflow_UInt32"));
+ throw new OverflowException(SR.Overflow_UInt32);
}
}
@@ -1066,14 +1066,14 @@ namespace System
{
if (!HexNumberToUInt64(ref number, ref i))
{
- throw new OverflowException(Environment.GetResourceString("Overflow_UInt64"));
+ throw new OverflowException(SR.Overflow_UInt64);
}
}
else
{
if (!NumberToUInt64(ref number, ref i))
{
- throw new OverflowException(Environment.GetResourceString("Overflow_UInt64"));
+ throw new OverflowException(SR.Overflow_UInt64);
}
}
return i;
@@ -1093,7 +1093,7 @@ namespace System
if (!ParseNumber(ref p, options, ref number, null, info, parseDecimal)
|| (p - stringPointer < str.Length && !TrailingZeros(str, (int)(p - stringPointer))))
{
- throw new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ throw new FormatException(SR.Format_InvalidString);
}
}
}
diff --git a/src/mscorlib/src/System/Object.cs b/src/mscorlib/src/System/Object.cs
index 643e1d933e..3c304422ac 100644
--- a/src/mscorlib/src/System/Object.cs
+++ b/src/mscorlib/src/System/Object.cs
@@ -127,7 +127,7 @@ namespace System
FieldInfo fldInfo = GetFieldInfo(typeName, fieldName);
if (fldInfo.IsInitOnly)
- throw new FieldAccessException(Environment.GetResourceString("FieldAccess_InitOnly"));
+ throw new FieldAccessException(SR.FieldAccess_InitOnly);
// Make sure that the value is compatible with the type
// of field
diff --git a/src/mscorlib/src/System/OleAutBinder.cs b/src/mscorlib/src/System/OleAutBinder.cs
index fafaa8d6ee..1db61bb30e 100644
--- a/src/mscorlib/src/System/OleAutBinder.cs
+++ b/src/mscorlib/src/System/OleAutBinder.cs
@@ -85,7 +85,7 @@ namespace System
Console.Write("Exception thrown: ");
Console.WriteLine(e);
#endif
- throw new COMException(Environment.GetResourceString("Interop.COM_TypeMismatch"), unchecked((int)0x80020005));
+ throw new COMException(SR.Interop_COM_TypeMismatch, unchecked((int)0x80020005));
}
}
}
diff --git a/src/mscorlib/src/System/OperatingSystem.cs b/src/mscorlib/src/System/OperatingSystem.cs
index d8f78d73c9..5eb1253fa5 100644
--- a/src/mscorlib/src/System/OperatingSystem.cs
+++ b/src/mscorlib/src/System/OperatingSystem.cs
@@ -35,7 +35,7 @@ namespace System
if (platform < PlatformID.Win32S || platform > PlatformID.MacOSX)
{
throw new ArgumentException(
- Environment.GetResourceString("Arg_EnumIllegalVal", (int)platform),
+ SR.Format(SR.Arg_EnumIllegalVal, (int)platform),
nameof(platform));
}
@@ -69,7 +69,7 @@ namespace System
if (_version == null)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_MissField", "_version"));
+ throw new SerializationException(SR.Format(SR.Serialization_MissField, "_version"));
}
}
diff --git a/src/mscorlib/src/System/OperationCanceledException.cs b/src/mscorlib/src/System/OperationCanceledException.cs
index 371e1c04ce..1afd59b251 100644
--- a/src/mscorlib/src/System/OperationCanceledException.cs
+++ b/src/mscorlib/src/System/OperationCanceledException.cs
@@ -30,7 +30,7 @@ namespace System
}
public OperationCanceledException()
- : base(Environment.GetResourceString("OperationCanceled"))
+ : base(SR.OperationCanceled)
{
SetErrorCode(__HResults.COR_E_OPERATIONCANCELED);
}
diff --git a/src/mscorlib/src/System/Random.cs b/src/mscorlib/src/System/Random.cs
index 507c2336c5..a81a4f4cc7 100644
--- a/src/mscorlib/src/System/Random.cs
+++ b/src/mscorlib/src/System/Random.cs
@@ -212,7 +212,7 @@ namespace System
{
if (minValue > maxValue)
{
- throw new ArgumentOutOfRangeException(nameof(minValue), Environment.GetResourceString("Argument_MinMaxValue", nameof(minValue), nameof(maxValue)));
+ throw new ArgumentOutOfRangeException(nameof(minValue), SR.Format(SR.Argument_MinMaxValue, nameof(minValue), nameof(maxValue)));
}
Contract.EndContractBlock();
@@ -237,7 +237,7 @@ namespace System
{
if (maxValue < 0)
{
- throw new ArgumentOutOfRangeException(nameof(maxValue), Environment.GetResourceString("ArgumentOutOfRange_MustBePositive", nameof(maxValue)));
+ throw new ArgumentOutOfRangeException(nameof(maxValue), SR.Format(SR.ArgumentOutOfRange_MustBePositive, nameof(maxValue)));
}
Contract.EndContractBlock();
return (int)(Sample() * maxValue);
diff --git a/src/mscorlib/src/System/ReadOnlySpan.cs b/src/mscorlib/src/System/ReadOnlySpan.cs
index ccbca3c118..8d0fbad0fc 100644
--- a/src/mscorlib/src/System/ReadOnlySpan.cs
+++ b/src/mscorlib/src/System/ReadOnlySpan.cs
@@ -114,28 +114,15 @@ namespace System
/// <summary>
/// Create a new read-only span over a portion of a regular managed object. This can be useful
- /// if part of a managed object represents a "fixed array." This is dangerous because
- /// "length" is not checked, nor is the fact that "rawPointer" actually lies within the object.
+ /// if part of a managed object represents a "fixed array." This is dangerous because neither the
+ /// <paramref name="length"/> is checked, nor <paramref name="obj"/> being null, nor the fact that
+ /// "rawPointer" actually lies within <paramref name="obj"/>.
/// </summary>
/// <param name="obj">The managed object that contains the data to span over.</param>
/// <param name="objectData">A reference to data within that object.</param>
/// <param name="length">The number of <typeparamref name="T"/> elements the memory contains.</param>
- /// <exception cref="System.ArgumentNullException">
- /// Thrown when the specified object is null.
- /// </exception>
- /// <exception cref="System.ArgumentOutOfRangeException">
- /// Thrown when the specified <paramref name="length"/> is negative.
- /// </exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ReadOnlySpan<T> DangerousCreate(object obj, ref T objectData, int length)
- {
- if (obj == null)
- ThrowHelper.ThrowArgumentNullException(ExceptionArgument.obj);
- if (length < 0)
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.length);
-
- return new ReadOnlySpan<T>(ref objectData, length);
- }
+ public static ReadOnlySpan<T> DangerousCreate(object obj, ref T objectData, int length) => new ReadOnlySpan<T>(ref objectData, length);
// Constructor for internal use only.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -244,9 +231,7 @@ namespace System
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object obj)
{
- ThrowHelper.ThrowNotSupportedException_CannotCallEqualsOnSpan();
- // Prevent compiler error CS0161: 'Span<T>.Equals(object)': not all code paths return a value
- return default(bool);
+ throw new NotSupportedException(SR.NotSupported_CannotCallEqualsOnSpan);
}
/// <summary>
@@ -259,9 +244,7 @@ namespace System
[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode()
{
- ThrowHelper.ThrowNotSupportedException_CannotCallGetHashCodeOnSpan();
- // Prevent compiler error CS0161: 'Span<T>.GetHashCode()': not all code paths return a value
- return default(int);
+ throw new NotSupportedException(SR.NotSupported_CannotCallGetHashCodeOnSpan);
}
/// <summary>
diff --git a/src/mscorlib/src/System/Reflection/AmbiguousMatchException.cs b/src/mscorlib/src/System/Reflection/AmbiguousMatchException.cs
deleted file mode 100644
index 36091d0296..0000000000
--- a/src/mscorlib/src/System/Reflection/AmbiguousMatchException.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-// 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.
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// AmbiguousMatchException is thrown when binding to a method results in more
-//
-// than one method matching the binding criteria. This exception is thrown in
-// general when something is Ambiguous.
-//
-//
-//
-//
-
-namespace System.Reflection
-{
- using System;
- using SystemException = System.SystemException;
- using System.Runtime.Serialization;
- [Serializable]
- public sealed class AmbiguousMatchException : SystemException
- {
- public AmbiguousMatchException()
- : base(Environment.GetResourceString("RFLCT.Ambiguous"))
- {
- SetErrorCode(__HResults.COR_E_AMBIGUOUSMATCH);
- }
-
- public AmbiguousMatchException(String message) : base(message)
- {
- SetErrorCode(__HResults.COR_E_AMBIGUOUSMATCH);
- }
-
- public AmbiguousMatchException(String message, Exception inner) : base(message, inner)
- {
- SetErrorCode(__HResults.COR_E_AMBIGUOUSMATCH);
- }
-
- internal AmbiguousMatchException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
- }
-}
diff --git a/src/mscorlib/src/System/Reflection/Assembly.CoreCLR.cs b/src/mscorlib/src/System/Reflection/Assembly.CoreCLR.cs
new file mode 100644
index 0000000000..82966dba60
--- /dev/null
+++ b/src/mscorlib/src/System/Reflection/Assembly.CoreCLR.cs
@@ -0,0 +1,211 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Collections.Generic;
+using System.Security.Policy;
+using System.IO;
+using System.Configuration.Assemblies;
+using StackCrawlMark = System.Threading.StackCrawlMark;
+using System.Runtime.Serialization;
+using System.Diagnostics.Contracts;
+using System.Runtime.Loader;
+
+namespace System.Reflection
+{
+ public abstract partial class Assembly : ICustomAttributeProvider, ISerializable
+ {
+ public static Assembly LoadFrom(String assemblyFile)
+ {
+ if (assemblyFile == null)
+ throw new ArgumentNullException(nameof(assemblyFile));
+ string fullPath = Path.GetFullPath(assemblyFile);
+ return AssemblyLoadContext.Default.LoadFromAssemblyPath(fullPath);
+ }
+
+ // Evidence is protected in Assembly.Load()
+ [Obsolete("This method is obsolete and will be removed in a future release of the .NET Framework. Please use an overload of LoadFrom which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
+ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
+ internal static Assembly LoadFrom(String assemblyFile,
+ Evidence securityEvidence)
+ {
+ Contract.Ensures(Contract.Result<Assembly>() != null);
+
+ StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
+
+ return RuntimeAssembly.InternalLoadFrom(
+ assemblyFile,
+ securityEvidence,
+ null, // hashValue
+ AssemblyHashAlgorithm.None,
+ false,// forIntrospection);
+ ref stackMark);
+ }
+
+ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
+ public static Assembly LoadFrom(String assemblyFile,
+ byte[] hashValue,
+ AssemblyHashAlgorithm hashAlgorithm)
+ {
+ throw new NotSupportedException(SR.NotSupported_AssemblyLoadFromHash);
+ }
+
+ // Locate an assembly by the long form of the assembly name.
+ // eg. "Toolbox.dll, version=1.1.10.1220, locale=en, publickey=1234567890123456789012345678901234567890"
+ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
+ public static Assembly Load(String assemblyString)
+ {
+ Contract.Ensures(Contract.Result<Assembly>() != null);
+ Contract.Ensures(!Contract.Result<Assembly>().ReflectionOnly);
+
+ StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
+ return RuntimeAssembly.InternalLoad(assemblyString, null, ref stackMark, false /*forIntrospection*/);
+ }
+
+ // Returns type from the assembly while keeping compatibility with Assembly.Load(assemblyString).GetType(typeName) for managed types.
+ // Calls Type.GetType for WinRT types.
+ // Note: Type.GetType fails for assembly names that start with weird characters like '['. By calling it for managed types we would
+ // break AppCompat.
+ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
+ internal static Type GetType_Compat(String assemblyString, String typeName)
+ {
+ // Normally we would get the stackMark only in public APIs. This is internal API, but it is AppCompat replacement of public API
+ // call Assembly.Load(assemblyString).GetType(typeName), therefore we take the stackMark here as well, to be fully compatible with
+ // the call sequence.
+ StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
+
+ RuntimeAssembly assembly;
+ AssemblyName assemblyName = RuntimeAssembly.CreateAssemblyName(
+ assemblyString,
+ false /*forIntrospection*/,
+ out assembly);
+
+ if (assembly == null)
+ {
+ if (assemblyName.ContentType == AssemblyContentType.WindowsRuntime)
+ {
+ return Type.GetType(typeName + ", " + assemblyString, true /*throwOnError*/, false /*ignoreCase*/);
+ }
+
+ assembly = RuntimeAssembly.InternalLoadAssemblyName(
+ assemblyName, null, null, ref stackMark,
+ true /*thrownOnFileNotFound*/, false /*forIntrospection*/);
+ }
+ return assembly.GetType(typeName, true /*throwOnError*/, false /*ignoreCase*/);
+ }
+
+ // Locate an assembly by its name. The name can be strong or
+ // weak. The assembly is loaded into the domain of the caller.
+ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
+ public static Assembly Load(AssemblyName assemblyRef)
+ {
+ Contract.Ensures(Contract.Result<Assembly>() != null);
+ Contract.Ensures(!Contract.Result<Assembly>().ReflectionOnly);
+
+ if (assemblyRef != null && assemblyRef.CodeBase != null)
+ {
+ throw new NotSupportedException(SR.NotSupported_AssemblyLoadCodeBase);
+ }
+
+ StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
+ return RuntimeAssembly.InternalLoadAssemblyName(assemblyRef, null, null, ref stackMark, true /*thrownOnFileNotFound*/, false /*forIntrospection*/);
+ }
+
+ // Locate an assembly by its name. The name can be strong or
+ // weak. The assembly is loaded into the domain of the caller.
+ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
+ internal static Assembly Load(AssemblyName assemblyRef, IntPtr ptrLoadContextBinder)
+ {
+ Contract.Ensures(Contract.Result<Assembly>() != null);
+ Contract.Ensures(!Contract.Result<Assembly>().ReflectionOnly);
+
+ if (assemblyRef != null && assemblyRef.CodeBase != null)
+ {
+ throw new NotSupportedException(SR.NotSupported_AssemblyLoadCodeBase);
+ }
+
+ StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
+ return RuntimeAssembly.InternalLoadAssemblyName(assemblyRef, null, null, ref stackMark, true /*thrownOnFileNotFound*/, false /*forIntrospection*/, ptrLoadContextBinder);
+ }
+
+ // Loads the assembly with a COFF based IMAGE containing
+ // an emitted assembly. The assembly is loaded into the domain
+ // of the caller. The second parameter is the raw bytes
+ // representing the symbol store that matches the assembly.
+ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
+ public static Assembly Load(byte[] rawAssembly,
+ byte[] rawSymbolStore)
+ {
+ Contract.Ensures(Contract.Result<Assembly>() != null);
+ Contract.Ensures(!Contract.Result<Assembly>().ReflectionOnly);
+
+ AppDomain.CheckLoadByteArraySupported();
+
+ if (rawAssembly == null)
+ throw new ArgumentNullException(nameof(rawAssembly));
+ AssemblyLoadContext alc = new IndividualAssemblyLoadContext();
+ MemoryStream assemblyStream = new MemoryStream(rawAssembly);
+ MemoryStream symbolStream = (rawSymbolStore != null) ? new MemoryStream(rawSymbolStore) : null;
+ return alc.LoadFromStream(assemblyStream, symbolStream);
+ }
+
+ private static Dictionary<string, Assembly> s_loadfile = new Dictionary<string, Assembly>();
+
+ public static Assembly LoadFile(String path)
+ {
+ Contract.Ensures(Contract.Result<Assembly>() != null);
+ Contract.Ensures(!Contract.Result<Assembly>().ReflectionOnly);
+
+ AppDomain.CheckLoadFileSupported();
+
+ Assembly result = null;
+ if (path == null)
+ throw new ArgumentNullException(nameof(path));
+
+ if (PathInternal.IsPartiallyQualified(path))
+ {
+ throw new ArgumentException(SR.Argument_AbsolutePathRequired, nameof(path));
+ }
+
+ string normalizedPath = Path.GetFullPath(path);
+
+ lock (s_loadfile)
+ {
+ if (s_loadfile.TryGetValue(normalizedPath, out result))
+ return result;
+ AssemblyLoadContext alc = new IndividualAssemblyLoadContext();
+ result = alc.LoadFromAssemblyPath(normalizedPath);
+ s_loadfile.Add(normalizedPath, result);
+ }
+ return result;
+ }
+
+ /*
+ * Get the assembly that the current code is running from.
+ */
+ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
+ public static Assembly GetExecutingAssembly()
+ {
+ StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
+ return RuntimeAssembly.GetExecutingAssembly(ref stackMark);
+ }
+
+ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
+ public static Assembly GetCallingAssembly()
+ {
+ // LookForMyCallersCaller is not guarantee to return the correct stack frame
+ // because of inlining, tail calls, etc. As a result GetCallingAssembly is not
+ // ganranteed to return the correct result. We should document it as such.
+ StackCrawlMark stackMark = StackCrawlMark.LookForMyCallersCaller;
+ return RuntimeAssembly.GetExecutingAssembly(ref stackMark);
+ }
+
+ public static Assembly GetEntryAssembly()
+ {
+ AppDomainManager domainManager = AppDomain.CurrentDomain.DomainManager;
+ if (domainManager == null)
+ domainManager = new AppDomainManager();
+ return domainManager.EntryAssembly;
+ }
+ }
+}
diff --git a/src/mscorlib/src/System/Reflection/AssemblyAttributes.cs b/src/mscorlib/src/System/Reflection/AssemblyAttributes.cs
deleted file mode 100644
index fc1d025240..0000000000
--- a/src/mscorlib/src/System/Reflection/AssemblyAttributes.cs
+++ /dev/null
@@ -1,389 +0,0 @@
-// 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: For Assembly-related custom attributes.
-**
-**
-=============================================================================*/
-
-
-using System;
-using System.Configuration.Assemblies;
-using System.Diagnostics.Contracts;
-
-namespace System.Reflection
-{
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
- public sealed class AssemblyCopyrightAttribute : Attribute
- {
- private String m_copyright;
-
- public AssemblyCopyrightAttribute(String copyright)
- {
- m_copyright = copyright;
- }
-
- public String Copyright
- {
- get { return m_copyright; }
- }
- }
-
-
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
- public sealed class AssemblyTrademarkAttribute : Attribute
- {
- private String m_trademark;
-
- public AssemblyTrademarkAttribute(String trademark)
- {
- m_trademark = trademark;
- }
-
- public String Trademark
- {
- get { return m_trademark; }
- }
- }
-
-
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
- public sealed class AssemblyProductAttribute : Attribute
- {
- private String m_product;
-
- public AssemblyProductAttribute(String product)
- {
- m_product = product;
- }
-
- public String Product
- {
- get { return m_product; }
- }
- }
-
-
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
- public sealed class AssemblyCompanyAttribute : Attribute
- {
- private String m_company;
-
- public AssemblyCompanyAttribute(String company)
- {
- m_company = company;
- }
-
- public String Company
- {
- get { return m_company; }
- }
- }
-
-
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
- public sealed class AssemblyDescriptionAttribute : Attribute
- {
- private String m_description;
-
- public AssemblyDescriptionAttribute(String description)
- {
- m_description = description;
- }
-
- public String Description
- {
- get { return m_description; }
- }
- }
-
-
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
- public sealed class AssemblyTitleAttribute : Attribute
- {
- private String m_title;
-
- public AssemblyTitleAttribute(String title)
- {
- m_title = title;
- }
-
- public String Title
- {
- get { return m_title; }
- }
- }
-
-
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
- public sealed class AssemblyConfigurationAttribute : Attribute
- {
- private String m_configuration;
-
- public AssemblyConfigurationAttribute(String configuration)
- {
- m_configuration = configuration;
- }
-
- public String Configuration
- {
- get { return m_configuration; }
- }
- }
-
-
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
- public sealed class AssemblyDefaultAliasAttribute : Attribute
- {
- private String m_defaultAlias;
-
- public AssemblyDefaultAliasAttribute(String defaultAlias)
- {
- m_defaultAlias = defaultAlias;
- }
-
- public String DefaultAlias
- {
- get { return m_defaultAlias; }
- }
- }
-
-
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
- public sealed class AssemblyInformationalVersionAttribute : Attribute
- {
- private String m_informationalVersion;
-
- public AssemblyInformationalVersionAttribute(String informationalVersion)
- {
- m_informationalVersion = informationalVersion;
- }
-
- public String InformationalVersion
- {
- get { return m_informationalVersion; }
- }
- }
-
-
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
- public sealed class AssemblyFileVersionAttribute : Attribute
- {
- private String _version;
-
- public AssemblyFileVersionAttribute(String version)
- {
- if (version == null)
- throw new ArgumentNullException(nameof(version));
- Contract.EndContractBlock();
- _version = version;
- }
-
- public String Version
- {
- get { return _version; }
- }
- }
-
-
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
- public unsafe sealed class AssemblyCultureAttribute : Attribute
- {
- private String m_culture;
-
- public AssemblyCultureAttribute(String culture)
- {
- m_culture = culture;
- }
-
- public String Culture
- {
- get { return m_culture; }
- }
- }
-
-
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
- public unsafe sealed class AssemblyVersionAttribute : Attribute
- {
- private String m_version;
-
- public AssemblyVersionAttribute(String version)
- {
- m_version = version;
- }
-
- public String Version
- {
- get { return m_version; }
- }
- }
-
-
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
- public sealed class AssemblyKeyFileAttribute : Attribute
- {
- private String m_keyFile;
-
- public AssemblyKeyFileAttribute(String keyFile)
- {
- m_keyFile = keyFile;
- }
-
- public String KeyFile
- {
- get { return m_keyFile; }
- }
- }
-
-
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
- public sealed class AssemblyDelaySignAttribute : Attribute
- {
- private bool m_delaySign;
-
- public AssemblyDelaySignAttribute(bool delaySign)
- {
- m_delaySign = delaySign;
- }
-
- public bool DelaySign
- {
- get
- { return m_delaySign; }
- }
- }
-
-
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
- public unsafe sealed class AssemblyAlgorithmIdAttribute : Attribute
- {
- private uint m_algId;
-
- public AssemblyAlgorithmIdAttribute(AssemblyHashAlgorithm algorithmId)
- {
- m_algId = (uint)algorithmId;
- }
-
- [CLSCompliant(false)]
- public AssemblyAlgorithmIdAttribute(uint algorithmId)
- {
- m_algId = algorithmId;
- }
-
- [CLSCompliant(false)]
- public uint AlgorithmId
- {
- get { return m_algId; }
- }
- }
-
-
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
- public unsafe sealed class AssemblyFlagsAttribute : Attribute
- {
- private AssemblyNameFlags m_flags;
-
- [Obsolete("This constructor has been deprecated. Please use AssemblyFlagsAttribute(AssemblyNameFlags) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
- [CLSCompliant(false)]
- public AssemblyFlagsAttribute(uint flags)
- {
- m_flags = (AssemblyNameFlags)flags;
- }
-
- [Obsolete("This property has been deprecated. Please use AssemblyFlags instead. http://go.microsoft.com/fwlink/?linkid=14202")]
- [CLSCompliant(false)]
- public uint Flags
- {
- get { return (uint)m_flags; }
- }
-
- // This, of course, should be typed as AssemblyNameFlags. The compat police don't allow such changes.
- public int AssemblyFlags
- {
- get { return (int)m_flags; }
- }
-
- [Obsolete("This constructor has been deprecated. Please use AssemblyFlagsAttribute(AssemblyNameFlags) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
- public AssemblyFlagsAttribute(int assemblyFlags)
- {
- m_flags = (AssemblyNameFlags)assemblyFlags;
- }
-
-
- public AssemblyFlagsAttribute(AssemblyNameFlags assemblyFlags)
- {
- m_flags = assemblyFlags;
- }
- }
-
- [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
- public sealed class AssemblyMetadataAttribute : Attribute
- {
- private String m_key;
- private String m_value;
-
- public AssemblyMetadataAttribute(string key, string value)
- {
- m_key = key;
- m_value = value;
- }
-
- public string Key
- {
- get { return m_key; }
- }
-
- public string Value
- {
- get { return m_value; }
- }
- }
-
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)]
- public sealed class AssemblySignatureKeyAttribute : Attribute
- {
- private String _publicKey;
- private String _countersignature;
-
- public AssemblySignatureKeyAttribute(String publicKey, String countersignature)
- {
- _publicKey = publicKey;
- _countersignature = countersignature;
- }
-
- public String PublicKey
- {
- get { return _publicKey; }
- }
-
- public String Countersignature
- {
- get { return _countersignature; }
- }
- }
-
- [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
- public sealed class AssemblyKeyNameAttribute : Attribute
- {
- private String m_keyName;
-
- public AssemblyKeyNameAttribute(String keyName)
- {
- m_keyName = keyName;
- }
-
- public String KeyName
- {
- get { return m_keyName; }
- }
- }
-}
-
diff --git a/src/mscorlib/src/System/Reflection/AssemblyName.cs b/src/mscorlib/src/System/Reflection/AssemblyName.cs
index 202bd07655..a1b9034391 100644
--- a/src/mscorlib/src/System/Reflection/AssemblyName.cs
+++ b/src/mscorlib/src/System/Reflection/AssemblyName.cs
@@ -366,7 +366,7 @@ namespace System.Reflection
Contract.EndContractBlock();
if ((assemblyName.Length == 0) ||
(assemblyName[0] == '\0'))
- throw new ArgumentException(Environment.GetResourceString("Format_StringZeroLength"));
+ throw new ArgumentException(SR.Format_StringZeroLength);
_Name = assemblyName;
nInit();
@@ -545,7 +545,7 @@ namespace System.Reflection
{
// Should be a rare case where the app tries to feed an invalid Unicode surrogates pair
if (count == 1 || count == end - i)
- throw new FormatException(Environment.GetResourceString("Arg_FormatException"));
+ throw new FormatException(SR.Arg_FormatException);
// need to grab one more char as a Surrogate except when it's a bogus input
++count;
}
@@ -561,7 +561,7 @@ namespace System.Reflection
// This is the only exception that built in UriParser can throw after a Uri ctor.
// Should not happen unless the app tries to feed an invalid Unicode String
if (numberOfBytes == 0)
- throw new FormatException(Environment.GetResourceString("Arg_FormatException"));
+ throw new FormatException(SR.Arg_FormatException);
i += (count - 1);
diff --git a/src/mscorlib/src/System/Reflection/Binder.cs b/src/mscorlib/src/System/Reflection/Binder.cs
deleted file mode 100644
index 002e9e1d41..0000000000
--- a/src/mscorlib/src/System/Reflection/Binder.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-// 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.
-
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-// This interface defines a set of methods which interact with reflection
-// during the binding process. This control allows systems to apply language
-// specific semantics to the binding and invocation process.
-//
-//
-
-namespace System.Reflection
-{
- using System;
- using System.Runtime.InteropServices;
- using CultureInfo = System.Globalization.CultureInfo;
-
- [Serializable]
- public abstract class Binder
- {
- // Given a set of methods that match the basic criteria, select a method to
- // invoke. When this method is finished, we should have
- public abstract MethodBase BindToMethod(BindingFlags bindingAttr, MethodBase[] match, ref Object[] args,
- ParameterModifier[] modifiers, CultureInfo culture, String[] names, out Object state);
-
- // Given a set of methods that match the basic criteria, select a method to
- // invoke. When this method is finished, we should have
- public abstract FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo[] match,
- Object value, CultureInfo culture);
-
- // Given a set of methods that match the base criteria, select a method based
- // upon an array of types. This method should return null if no method matchs
- // the criteria.
- public abstract MethodBase SelectMethod(BindingFlags bindingAttr, MethodBase[] match,
- Type[] types, ParameterModifier[] modifiers);
-
-
- // Given a set of propreties that match the base criteria, select one.
- public abstract PropertyInfo SelectProperty(BindingFlags bindingAttr, PropertyInfo[] match,
- Type returnType, Type[] indexes, ParameterModifier[] modifiers);
-
- // ChangeType
- // This method will convert the value into the property type.
- // It throws a cast exception if this fails.
- public abstract Object ChangeType(Object value, Type type, CultureInfo culture);
-
- public abstract void ReorderArgumentArray(ref Object[] args, Object state);
- }
-}
diff --git a/src/mscorlib/src/System/Reflection/ConstructorInfo.CoreCLR.cs b/src/mscorlib/src/System/Reflection/ConstructorInfo.CoreCLR.cs
new file mode 100644
index 0000000000..c96bfb5ac1
--- /dev/null
+++ b/src/mscorlib/src/System/Reflection/ConstructorInfo.CoreCLR.cs
@@ -0,0 +1,11 @@
+// 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 System.Reflection
+{
+ public abstract partial class ConstructorInfo : MethodBase
+ {
+ internal virtual Type GetReturnType() { throw new NotImplementedException(); }
+ }
+}
diff --git a/src/mscorlib/src/System/Reflection/CustomAttribute.cs b/src/mscorlib/src/System/Reflection/CustomAttribute.cs
index c12187d7c8..0c8271b9a9 100644
--- a/src/mscorlib/src/System/Reflection/CustomAttribute.cs
+++ b/src/mscorlib/src/System/Reflection/CustomAttribute.cs
@@ -268,7 +268,7 @@ namespace System.Reflection
if (type.IsValueType)
return CustomAttributeEncoding.Undefined;
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidKindOfTypeForCA"), nameof(type));
+ throw new ArgumentException(SR.Argument_InvalidKindOfTypeForCA, nameof(type));
}
private static CustomAttributeType InitCustomAttributeType(RuntimeType parameterType)
{
@@ -604,7 +604,7 @@ namespace System.Reflection
else if (property != null)
type = property.PropertyType;
else
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidMemberForNamedArgument"));
+ throw new ArgumentException(SR.Argument_InvalidMemberForNamedArgument);
m_memberInfo = memberInfo;
m_value = new CustomAttributeTypedArgument(type, value);
@@ -730,7 +730,7 @@ namespace System.Reflection
return typeof(object);
default:
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)encodedType), nameof(encodedType));
+ throw new ArgumentException(SR.Format(SR.Arg_EnumIllegalVal, (int)encodedType), nameof(encodedType));
}
}
@@ -775,7 +775,7 @@ namespace System.Reflection
unsafe { return *(double*)&val; }
default:
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)val), nameof(val));
+ throw new ArgumentException(SR.Format(SR.Arg_EnumIllegalVal, (int)val), nameof(val));
}
}
private static RuntimeType ResolveType(RuntimeModule scope, string typeName)
@@ -784,7 +784,7 @@ namespace System.Reflection
if (type == null)
throw new InvalidOperationException(
- String.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString("Arg_CATypeResolutionFailed"), typeName));
+ String.Format(CultureInfo.CurrentUICulture, SR.Arg_CATypeResolutionFailed, typeName));
return type;
}
@@ -1524,7 +1524,7 @@ namespace System.Reflection
RuntimeModule decoratedModule, int decoratedMetadataToken, RuntimeType attributeFilterType, int attributeCtorToken, bool mustBeInheritable)
{
if (decoratedModule.Assembly.ReflectionOnly)
- throw new InvalidOperationException(Environment.GetResourceString("Arg_ReflectionOnlyCA"));
+ throw new InvalidOperationException(SR.Arg_ReflectionOnlyCA);
Contract.EndContractBlock();
CustomAttributeRecord[] car = CustomAttributeData.GetCustomAttributeRecords(decoratedModule, decoratedMetadataToken);
@@ -1580,7 +1580,7 @@ namespace System.Reflection
RuntimeType attributeFilterType, bool mustBeInheritable, IList derivedAttributes, bool isDecoratedTargetSecurityTransparent)
{
if (decoratedModule.Assembly.ReflectionOnly)
- throw new InvalidOperationException(Environment.GetResourceString("Arg_ReflectionOnlyCA"));
+ throw new InvalidOperationException(SR.Arg_ReflectionOnlyCA);
Contract.EndContractBlock();
MetadataImport scope = decoratedModule.MetadataImport;
@@ -1700,8 +1700,8 @@ namespace System.Reflection
if (property == null)
{
throw new CustomAttributeFormatException(
- String.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString(
- isProperty ? "RFLCT.InvalidPropFail" : "RFLCT.InvalidFieldFail"), name));
+ String.Format(CultureInfo.CurrentUICulture,
+ isProperty ? SR.RFLCT_InvalidPropFail : SR.RFLCT_InvalidFieldFail, name));
}
RuntimeMethodInfo setMethod = property.GetSetMethod(true) as RuntimeMethodInfo;
@@ -1731,8 +1731,8 @@ namespace System.Reflection
catch (Exception e)
{
throw new CustomAttributeFormatException(
- String.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString(
- isProperty ? "RFLCT.InvalidPropFail" : "RFLCT.InvalidFieldFail"), name), e);
+ String.Format(CultureInfo.CurrentUICulture,
+ isProperty ? SR.RFLCT_InvalidPropFail : SR.RFLCT_InvalidFieldFail, name), e);
}
#endregion
}
@@ -1905,7 +1905,7 @@ namespace System.Reflection
if (attributeUsageAttribute != null)
throw new FormatException(String.Format(
- CultureInfo.CurrentUICulture, Environment.GetResourceString("Format_AttributeUsage"), attributeType));
+ CultureInfo.CurrentUICulture, SR.Format_AttributeUsage, attributeType));
AttributeTargets targets;
bool inherited, allowMultiple;
diff --git a/src/mscorlib/src/System/Reflection/CustomAttributeFormatException.cs b/src/mscorlib/src/System/Reflection/CustomAttributeFormatException.cs
deleted file mode 100644
index 83ef54138e..0000000000
--- a/src/mscorlib/src/System/Reflection/CustomAttributeFormatException.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-// 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.
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// CustomAttributeFormatException is thrown when the binary format of a
-//
-// custom attribute is invalid.
-//
-//
-
-namespace System.Reflection
-{
- using System;
- using ApplicationException = System.ApplicationException;
- using System.Runtime.Serialization;
- [Serializable]
- public class CustomAttributeFormatException : FormatException
- {
- public CustomAttributeFormatException()
- : base(Environment.GetResourceString("Arg_CustomAttributeFormatException"))
- {
- SetErrorCode(__HResults.COR_E_CUSTOMATTRIBUTEFORMAT);
- }
-
- public CustomAttributeFormatException(String message) : base(message)
- {
- SetErrorCode(__HResults.COR_E_CUSTOMATTRIBUTEFORMAT);
- }
-
- public CustomAttributeFormatException(String message, Exception inner) : base(message, inner)
- {
- SetErrorCode(__HResults.COR_E_CUSTOMATTRIBUTEFORMAT);
- }
-
- protected CustomAttributeFormatException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
- }
-}
diff --git a/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilder.cs b/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilder.cs
index 2ff87a02ac..6d9cb0db2f 100644
--- a/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilder.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilder.cs
@@ -94,39 +94,39 @@ namespace System.Reflection.Emit
#region Methods inherited from Assembly
public override String[] GetManifestResourceNames()
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicAssembly"));
+ throw new NotSupportedException(SR.NotSupported_DynamicAssembly);
}
public override FileStream GetFile(String name)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicAssembly"));
+ throw new NotSupportedException(SR.NotSupported_DynamicAssembly);
}
public override FileStream[] GetFiles(bool getResourceModules)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicAssembly"));
+ throw new NotSupportedException(SR.NotSupported_DynamicAssembly);
}
public override Stream GetManifestResourceStream(Type type, String name)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicAssembly"));
+ throw new NotSupportedException(SR.NotSupported_DynamicAssembly);
}
public override Stream GetManifestResourceStream(String name)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicAssembly"));
+ throw new NotSupportedException(SR.NotSupported_DynamicAssembly);
}
public override ManifestResourceInfo GetManifestResourceInfo(String resourceName)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicAssembly"));
+ throw new NotSupportedException(SR.NotSupported_DynamicAssembly);
}
public override String Location
{
get
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicAssembly"));
+ throw new NotSupportedException(SR.NotSupported_DynamicAssembly);
}
}
@@ -134,13 +134,13 @@ namespace System.Reflection.Emit
{
get
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicAssembly"));
+ throw new NotSupportedException(SR.NotSupported_DynamicAssembly);
}
}
public override Type[] GetExportedTypes()
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicAssembly"));
+ throw new NotSupportedException(SR.NotSupported_DynamicAssembly);
}
public override String ImageRuntimeVersion
@@ -231,7 +231,7 @@ namespace System.Reflection.Emit
&& access != AssemblyBuilderAccess.RunAndCollect
)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)access), nameof(access));
+ throw new ArgumentException(SR.Format(SR.Arg_EnumIllegalVal, (int)access), nameof(access));
}
if (securityContextSource < SecurityContextSource.CurrentAppDomain ||
@@ -441,9 +441,9 @@ namespace System.Reflection.Emit
if (name == null)
throw new ArgumentNullException(nameof(name));
if (name.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(name));
+ throw new ArgumentException(SR.Argument_EmptyName, nameof(name));
if (name[0] == '\0')
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidName"), nameof(name));
+ throw new ArgumentException(SR.Argument_InvalidName, nameof(name));
Contract.Ensures(Contract.Result<ModuleBuilder>() != null);
Contract.EndContractBlock();
@@ -457,7 +457,7 @@ namespace System.Reflection.Emit
// create the dynamic module- only one ModuleBuilder per AssemblyBuilder can be created
if (m_fManifestModuleUsedAsDefinedModule == true)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NoMultiModuleAssembly"));
+ throw new InvalidOperationException(SR.InvalidOperation_NoMultiModuleAssembly);
// Init(...) has already been called on m_manifestModuleBuilder in InitManifestModule()
dynModule = m_manifestModuleBuilder;
@@ -511,16 +511,16 @@ namespace System.Reflection.Emit
continue;
if (type.Module == null || type.Module.Assembly == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_TypeNotValid"));
+ throw new ArgumentException(SR.Argument_TypeNotValid);
if (type.Module.Assembly == typeof(object).Module.Assembly)
continue;
if (type.Module.Assembly.ReflectionOnly && !ReflectionOnly)
- throw new InvalidOperationException(Environment.GetResourceString("Arugment_EmitMixedContext1", type.AssemblyQualifiedName));
+ throw new InvalidOperationException(SR.Format(SR.Arugment_EmitMixedContext1, type.AssemblyQualifiedName));
if (!type.Module.Assembly.ReflectionOnly && ReflectionOnly)
- throw new InvalidOperationException(Environment.GetResourceString("Arugment_EmitMixedContext2", type.AssemblyQualifiedName));
+ throw new InvalidOperationException(SR.Format(SR.Arugment_EmitMixedContext2, type.AssemblyQualifiedName));
}
}
@@ -742,7 +742,7 @@ namespace System.Reflection.Emit
if (name == null)
throw new ArgumentNullException(nameof(name));
if (name.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(name));
+ throw new ArgumentException(SR.Argument_EmptyName, nameof(name));
Contract.EndContractBlock();
BCLDebug.Log("DYNIL", "## DYNIL LOGGING: AssemblyBuilder.GetDynamicModule( " + name + " )");
diff --git a/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs b/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs
index a2fb2b602c..529ba54514 100644
--- a/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs
@@ -120,7 +120,7 @@ namespace System.Reflection.Emit
// if (enclosingType == null && m_assembly.GetType(strTypeName, false, false) != null)
// {
// // Cannot have two types with the same name
- // throw new ArgumentException(Environment.GetResourceString("Argument_DuplicateTypeName"));
+ // throw new ArgumentException(SR.Argument_DuplicateTypeName);
// }
}
diff --git a/src/mscorlib/src/System/Reflection/Emit/ConstructorBuilder.cs b/src/mscorlib/src/System/Reflection/Emit/ConstructorBuilder.cs
index 185d2041a2..3ca9b2eb9d 100644
--- a/src/mscorlib/src/System/Reflection/Emit/ConstructorBuilder.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/ConstructorBuilder.cs
@@ -102,7 +102,7 @@ namespace System.Reflection.Emit
#region MethodBase Overrides
public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
[Pure]
@@ -132,7 +132,7 @@ namespace System.Reflection.Emit
#region ConstructorInfo Overrides
public override Object Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
#endregion
@@ -175,7 +175,7 @@ namespace System.Reflection.Emit
public ILGenerator GetILGenerator()
{
if (m_isDefaultConstructor)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_DefaultConstructorILGen"));
+ throw new InvalidOperationException(SR.InvalidOperation_DefaultConstructorILGen);
return m_methodBuilder.GetILGenerator();
}
@@ -183,7 +183,7 @@ namespace System.Reflection.Emit
public ILGenerator GetILGenerator(int streamSize)
{
if (m_isDefaultConstructor)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_DefaultConstructorILGen"));
+ throw new InvalidOperationException(SR.InvalidOperation_DefaultConstructorILGen);
return m_methodBuilder.GetILGenerator(streamSize);
}
diff --git a/src/mscorlib/src/System/Reflection/Emit/CustomAttributeBuilder.cs b/src/mscorlib/src/System/Reflection/Emit/CustomAttributeBuilder.cs
index cbc73455ed..cf5bd11de6 100644
--- a/src/mscorlib/src/System/Reflection/Emit/CustomAttributeBuilder.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/CustomAttributeBuilder.cs
@@ -118,17 +118,17 @@ namespace System.Reflection.Emit
if (fieldValues == null)
throw new ArgumentNullException(nameof(fieldValues));
if (namedProperties.Length != propertyValues.Length)
- throw new ArgumentException(Environment.GetResourceString("Arg_ArrayLengthsDiffer"), "namedProperties, propertyValues");
+ throw new ArgumentException(SR.Arg_ArrayLengthsDiffer, "namedProperties, propertyValues");
if (namedFields.Length != fieldValues.Length)
- throw new ArgumentException(Environment.GetResourceString("Arg_ArrayLengthsDiffer"), "namedFields, fieldValues");
+ throw new ArgumentException(SR.Arg_ArrayLengthsDiffer, "namedFields, fieldValues");
Contract.EndContractBlock();
if ((con.Attributes & MethodAttributes.Static) == MethodAttributes.Static ||
(con.Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Private)
- throw new ArgumentException(Environment.GetResourceString("Argument_BadConstructor"));
+ throw new ArgumentException(SR.Argument_BadConstructor);
if ((con.CallingConvention & CallingConventions.Standard) != CallingConventions.Standard)
- throw new ArgumentException(Environment.GetResourceString("Argument_BadConstructorCallConv"));
+ throw new ArgumentException(SR.Argument_BadConstructorCallConv);
// Cache information used elsewhere.
m_con = con;
@@ -143,12 +143,12 @@ namespace System.Reflection.Emit
// Since we're guaranteed a non-var calling convention, the number of arguments must equal the number of parameters.
if (paramTypes.Length != constructorArgs.Length)
- throw new ArgumentException(Environment.GetResourceString("Argument_BadParameterCountsForConstructor"));
+ throw new ArgumentException(SR.Argument_BadParameterCountsForConstructor);
// Verify that the constructor has a valid signature (custom attributes only support a subset of our type system).
for (i = 0; i < paramTypes.Length; i++)
if (!ValidateType(paramTypes[i]))
- throw new ArgumentException(Environment.GetResourceString("Argument_BadTypeInCustomAttribute"));
+ throw new ArgumentException(SR.Argument_BadTypeInCustomAttribute);
// Now verify that the types of the actual parameters are compatible with the types of the formal parameters.
for (i = 0; i < paramTypes.Length; i++)
@@ -195,11 +195,11 @@ namespace System.Reflection.Emit
// Validate property type.
if (!ValidateType(propType))
- throw new ArgumentException(Environment.GetResourceString("Argument_BadTypeInCustomAttribute"));
+ throw new ArgumentException(SR.Argument_BadTypeInCustomAttribute);
// Property has to be writable.
if (!property.CanWrite)
- throw new ArgumentException(Environment.GetResourceString("Argument_NotAWritableProperty"));
+ throw new ArgumentException(SR.Argument_NotAWritableProperty);
// Property has to be from the same class or base class as ConstructorInfo.
if (property.DeclaringType != con.DeclaringType
@@ -217,7 +217,7 @@ namespace System.Reflection.Emit
// type is one.
if (!(property.DeclaringType is TypeBuilder) ||
!con.DeclaringType.IsSubclassOf(((TypeBuilder)property.DeclaringType).BakedRuntimeType))
- throw new ArgumentException(Environment.GetResourceString("Argument_BadPropertyForConstructorBuilder"));
+ throw new ArgumentException(SR.Argument_BadPropertyForConstructorBuilder);
}
}
@@ -253,7 +253,7 @@ namespace System.Reflection.Emit
// Validate field type.
if (!ValidateType(fldType))
- throw new ArgumentException(Environment.GetResourceString("Argument_BadTypeInCustomAttribute"));
+ throw new ArgumentException(SR.Argument_BadTypeInCustomAttribute);
// Field has to be from the same class or base class as ConstructorInfo.
if (namedField.DeclaringType != con.DeclaringType
@@ -271,7 +271,7 @@ namespace System.Reflection.Emit
// type is one.
if (!(namedField.DeclaringType is TypeBuilder) ||
!con.DeclaringType.IsSubclassOf(((TypeBuilder)namedFields[i].DeclaringType).BakedRuntimeType))
- throw new ArgumentException(Environment.GetResourceString("Argument_BadFieldForConstructorBuilder"));
+ throw new ArgumentException(SR.Argument_BadFieldForConstructorBuilder);
}
}
@@ -299,11 +299,11 @@ namespace System.Reflection.Emit
{
if (type != typeof(object) && Type.GetTypeCode(passedType) != Type.GetTypeCode(type))
{
- throw new ArgumentException(Environment.GetResourceString("Argument_ConstantDoesntMatch"));
+ throw new ArgumentException(SR.Argument_ConstantDoesntMatch);
}
if (passedType == typeof(IntPtr) || passedType == typeof(UIntPtr))
{
- throw new ArgumentException(Environment.GetResourceString("Argument_BadParameterTypeForCAB"), paramName);
+ throw new ArgumentException(SR.Argument_BadParameterTypeForCAB, paramName);
}
}
@@ -453,8 +453,7 @@ namespace System.Reflection.Emit
{
String typeName = TypeNameBuilder.ToString((Type)value, TypeNameBuilder.Format.AssemblyQualifiedName);
if (typeName == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidTypeForCA",
- value.GetType()));
+ throw new ArgumentException(SR.Format(SR.Argument_InvalidTypeForCA, value.GetType()));
EmitString(writer, typeName);
}
}
@@ -527,7 +526,7 @@ namespace System.Reflection.Emit
// value cannot be a "System.Object" object.
// If we allow this we will get into an infinite recursion
if (ot == typeof(object))
- throw new ArgumentException(Environment.GetResourceString("Argument_BadParameterTypeForCAB", ot.ToString()));
+ throw new ArgumentException(SR.Format(SR.Argument_BadParameterTypeForCAB, ot.ToString()));
EmitType(writer, ot);
EmitValue(writer, ot, value);
@@ -539,7 +538,7 @@ namespace System.Reflection.Emit
if (value != null)
typename = value.GetType().ToString();
- throw new ArgumentException(Environment.GetResourceString("Argument_BadParameterTypeForCAB", typename));
+ throw new ArgumentException(SR.Format(SR.Argument_BadParameterTypeForCAB, typename));
}
}
diff --git a/src/mscorlib/src/System/Reflection/Emit/DynamicILGenerator.cs b/src/mscorlib/src/System/Reflection/Emit/DynamicILGenerator.cs
index ec725acad7..b592053f9f 100644
--- a/src/mscorlib/src/System/Reflection/Emit/DynamicILGenerator.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/DynamicILGenerator.cs
@@ -54,7 +54,7 @@ namespace System.Reflection.Emit
RuntimeType rtType = localType as RuntimeType;
if (rtType == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeType);
localBuilder = new LocalBuilder(m_localCount, localType, m_methodBuilder);
// add the localType to local signature
@@ -81,7 +81,7 @@ namespace System.Reflection.Emit
{
RuntimeMethodInfo rtMeth = meth as RuntimeMethodInfo;
if (rtMeth == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeMethodInfo"), nameof(meth));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeMethodInfo, nameof(meth));
RuntimeType declaringType = rtMeth.GetRuntimeType();
if (declaringType != null && (declaringType.IsGenericType || declaringType.IsArray))
@@ -94,7 +94,7 @@ namespace System.Reflection.Emit
// rule out not allowed operations on DynamicMethods
if (opcode.Equals(OpCodes.Ldtoken) || opcode.Equals(OpCodes.Ldftn) || opcode.Equals(OpCodes.Ldvirtftn))
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOpCodeOnDynamicMethod"));
+ throw new ArgumentException(SR.Argument_InvalidOpCodeOnDynamicMethod);
}
token = GetTokenFor(dynMeth);
}
@@ -132,7 +132,7 @@ namespace System.Reflection.Emit
RuntimeConstructorInfo rtConstructor = con as RuntimeConstructorInfo;
if (rtConstructor == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeMethodInfo"), nameof(con));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeMethodInfo, nameof(con));
RuntimeType declaringType = rtConstructor.GetRuntimeType();
int token;
@@ -161,7 +161,7 @@ namespace System.Reflection.Emit
RuntimeType rtType = type as RuntimeType;
if (rtType == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeType);
int token = GetTokenFor(rtType);
EnsureCapacity(7);
@@ -177,7 +177,7 @@ namespace System.Reflection.Emit
RuntimeFieldInfo runtimeField = field as RuntimeFieldInfo;
if (runtimeField == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeFieldInfo"), nameof(field));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeFieldInfo, nameof(field));
int token;
if (field.DeclaringType == null)
@@ -218,7 +218,7 @@ namespace System.Reflection.Emit
if (optionalParameterTypes != null)
if ((callingConvention & CallingConventions.VarArgs) == 0)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotAVarArgCallingConvention"));
+ throw new InvalidOperationException(SR.InvalidOperation_NotAVarArgCallingConvention);
sig = GetMemberRefSignature(callingConvention,
returnType,
@@ -254,13 +254,13 @@ namespace System.Reflection.Emit
throw new ArgumentNullException(nameof(methodInfo));
if (!(opcode.Equals(OpCodes.Call) || opcode.Equals(OpCodes.Callvirt) || opcode.Equals(OpCodes.Newobj)))
- throw new ArgumentException(Environment.GetResourceString("Argument_NotMethodCallOpcode"), nameof(opcode));
+ throw new ArgumentException(SR.Argument_NotMethodCallOpcode, nameof(opcode));
if (methodInfo.ContainsGenericParameters)
- throw new ArgumentException(Environment.GetResourceString("Argument_GenericsInvalid"), nameof(methodInfo));
+ throw new ArgumentException(SR.Argument_GenericsInvalid, nameof(methodInfo));
if (methodInfo.DeclaringType != null && methodInfo.DeclaringType.ContainsGenericParameters)
- throw new ArgumentException(Environment.GetResourceString("Argument_GenericsInvalid"), nameof(methodInfo));
+ throw new ArgumentException(SR.Argument_GenericsInvalid, nameof(methodInfo));
Contract.EndContractBlock();
int tk;
@@ -328,7 +328,7 @@ namespace System.Reflection.Emit
// Begins an exception filter block. Emits a branch instruction to the end of the current exception block.
if (CurrExcStackCount == 0)
- throw new NotSupportedException(Environment.GetResourceString("Argument_NotInExceptionBlock"));
+ throw new NotSupportedException(SR.Argument_NotInExceptionBlock);
__ExceptionInfo current = CurrExcStack[CurrExcStackCount - 1];
@@ -342,7 +342,7 @@ namespace System.Reflection.Emit
public override void BeginCatchBlock(Type exceptionType)
{
if (CurrExcStackCount == 0)
- throw new NotSupportedException(Environment.GetResourceString("Argument_NotInExceptionBlock"));
+ throw new NotSupportedException(SR.Argument_NotInExceptionBlock);
Contract.EndContractBlock();
__ExceptionInfo current = CurrExcStack[CurrExcStackCount - 1];
@@ -353,7 +353,7 @@ namespace System.Reflection.Emit
{
if (exceptionType != null)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_ShouldNotSpecifyExceptionType"));
+ throw new ArgumentException(SR.Argument_ShouldNotSpecifyExceptionType);
}
this.Emit(OpCodes.Endfilter);
@@ -367,7 +367,7 @@ namespace System.Reflection.Emit
throw new ArgumentNullException(nameof(exceptionType));
if (rtType == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeType);
Label endLabel = current.GetEndLabel();
this.Emit(OpCodes.Leave, endLabel);
@@ -392,7 +392,7 @@ namespace System.Reflection.Emit
[SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
public override void UsingNamespace(String ns)
{
- throw new NotSupportedException(Environment.GetResourceString("InvalidOperation_NotAllowedInDynamicMethod"));
+ throw new NotSupportedException(SR.InvalidOperation_NotAllowedInDynamicMethod);
}
[SuppressMessage("Microsoft.Contracts", "CC1055")] // Skip extra error checking to avoid *potential* AppCompat problems.
@@ -402,17 +402,17 @@ namespace System.Reflection.Emit
int endLine,
int endColumn)
{
- throw new NotSupportedException(Environment.GetResourceString("InvalidOperation_NotAllowedInDynamicMethod"));
+ throw new NotSupportedException(SR.InvalidOperation_NotAllowedInDynamicMethod);
}
public override void BeginScope()
{
- throw new NotSupportedException(Environment.GetResourceString("InvalidOperation_NotAllowedInDynamicMethod"));
+ throw new NotSupportedException(SR.InvalidOperation_NotAllowedInDynamicMethod);
}
public override void EndScope()
{
- throw new NotSupportedException(Environment.GetResourceString("InvalidOperation_NotAllowedInDynamicMethod"));
+ throw new NotSupportedException(SR.InvalidOperation_NotAllowedInDynamicMethod);
}
private int GetMemberRefToken(MethodBase methodInfo, Type[] optionalParameterTypes)
@@ -420,13 +420,13 @@ namespace System.Reflection.Emit
Type[] parameterTypes;
if (optionalParameterTypes != null && (methodInfo.CallingConvention & CallingConventions.VarArgs) == 0)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotAVarArgCallingConvention"));
+ throw new InvalidOperationException(SR.InvalidOperation_NotAVarArgCallingConvention);
RuntimeMethodInfo rtMeth = methodInfo as RuntimeMethodInfo;
DynamicMethod dm = methodInfo as DynamicMethod;
if (rtMeth == null && dm == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeMethodInfo"), nameof(methodInfo));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeMethodInfo, nameof(methodInfo));
ParameterInfo[] paramInfo = methodInfo.GetParametersNoCopy();
if (paramInfo != null && paramInfo.Length != 0)
@@ -953,7 +953,7 @@ namespace System.Reflection.Emit
Type t = m.DeclaringType.GetGenericTypeDefinition();
throw new ArgumentException(String.Format(
- CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_MethodDeclaringTypeGenericLcg"), m, t));
+ CultureInfo.CurrentCulture, SR.Argument_MethodDeclaringTypeGenericLcg, m, t));
}
}
diff --git a/src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs b/src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs
index 540a5b73dc..ef4d1ca833 100644
--- a/src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs
@@ -217,18 +217,18 @@ namespace System.Reflection.Emit
{
// only static public for method attributes
if ((attributes & ~MethodAttributes.MemberAccessMask) != MethodAttributes.Static)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicMethodFlags"));
+ throw new NotSupportedException(SR.NotSupported_DynamicMethodFlags);
if ((attributes & MethodAttributes.MemberAccessMask) != MethodAttributes.Public)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicMethodFlags"));
+ throw new NotSupportedException(SR.NotSupported_DynamicMethodFlags);
Contract.EndContractBlock();
// only standard or varargs supported
if (callingConvention != CallingConventions.Standard && callingConvention != CallingConventions.VarArgs)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicMethodFlags"));
+ throw new NotSupportedException(SR.NotSupported_DynamicMethodFlags);
// vararg is not supported at the moment
if (callingConvention == CallingConventions.VarArgs)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicMethodFlags"));
+ throw new NotSupportedException(SR.NotSupported_DynamicMethodFlags);
}
// We create a transparent assembly to host DynamicMethods. Since the assembly does not have any
@@ -288,10 +288,10 @@ namespace System.Reflection.Emit
for (int i = 0; i < signature.Length; i++)
{
if (signature[i] == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_InvalidTypeInSignature"));
+ throw new ArgumentException(SR.Arg_InvalidTypeInSignature);
m_parameterTypes[i] = signature[i].UnderlyingSystemType as RuntimeType;
if (m_parameterTypes[i] == null || !(m_parameterTypes[i] is RuntimeType) || m_parameterTypes[i] == (RuntimeType)typeof(void))
- throw new ArgumentException(Environment.GetResourceString("Arg_InvalidTypeInSignature"));
+ throw new ArgumentException(SR.Arg_InvalidTypeInSignature);
}
}
else
@@ -302,7 +302,7 @@ namespace System.Reflection.Emit
// check and store the return value
m_returnType = (returnType == null) ? (RuntimeType)typeof(void) : returnType.UnderlyingSystemType as RuntimeType;
if ((m_returnType == null) || !(m_returnType is RuntimeType) || m_returnType.IsByRef)
- throw new NotSupportedException(Environment.GetResourceString("Arg_InvalidTypeInRetType"));
+ throw new NotSupportedException(SR.Arg_InvalidTypeInRetType);
if (transparentMethod)
{
@@ -331,7 +331,7 @@ namespace System.Reflection.Emit
{
if (rtOwner.HasElementType || rtOwner.ContainsGenericParameters
|| rtOwner.IsGenericParameter || rtOwner.IsInterface)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidTypeForDynamicMethod"));
+ throw new ArgumentException(SR.Argument_InvalidTypeForDynamicMethod);
m_typeOwner = rtOwner;
m_module = rtOwner.GetRuntimeModule();
@@ -400,7 +400,7 @@ namespace System.Reflection.Emit
else
{
if (m_ilGenerator == null || m_ilGenerator.ILOffset == 0)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadEmptyMethodBody", Name));
+ throw new InvalidOperationException(SR.Format(SR.InvalidOperation_BadEmptyMethodBody, Name));
m_ilGenerator.GetCallableMethod(m_module, this);
}
@@ -425,7 +425,7 @@ namespace System.Reflection.Emit
public override Module Module { get { return m_dynMethod.Module; } }
// we cannot return a MethodHandle because we cannot track it via GC so this method is off limits
- public override RuntimeMethodHandle MethodHandle { get { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotAllowedInDynamicMethod")); } }
+ public override RuntimeMethodHandle MethodHandle { get { throw new InvalidOperationException(SR.InvalidOperation_NotAllowedInDynamicMethod); } }
public override MethodAttributes Attributes { get { return m_dynMethod.Attributes; } }
@@ -465,7 +465,7 @@ namespace System.Reflection.Emit
public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
{
if ((CallingConvention & CallingConventions.VarArgs) == CallingConventions.VarArgs)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_CallToVarArg"));
+ throw new NotSupportedException(SR.NotSupported_CallToVarArg);
Contract.EndContractBlock();
//
@@ -486,7 +486,7 @@ namespace System.Reflection.Emit
int formalCount = sig.Arguments.Length;
int actualCount = (parameters != null) ? parameters.Length : 0;
if (formalCount != actualCount)
- throw new TargetParameterCountException(Environment.GetResourceString("Arg_ParmCnt"));
+ throw new TargetParameterCountException(SR.Arg_ParmCnt);
// if we are here we passed all the previous checks. Time to look at the arguments
Object retValue = null;
@@ -529,12 +529,12 @@ namespace System.Reflection.Emit
public ParameterBuilder DefineParameter(int position, ParameterAttributes attributes, String parameterName)
{
if (position < 0 || position > m_parameterTypes.Length)
- throw new ArgumentOutOfRangeException(Environment.GetResourceString("ArgumentOutOfRange_ParamSequence"));
+ throw new ArgumentOutOfRangeException(SR.ArgumentOutOfRange_ParamSequence);
position--; // it's 1 based. 0 is the return value
if (position >= 0)
{
- ParameterInfo[] parameters = m_dynMethod.LoadParameters();
+ RuntimeParameterInfo[] parameters = m_dynMethod.LoadParameters();
parameters[position].SetName(parameterName);
parameters[position].SetAttributes(attributes);
}
@@ -583,7 +583,7 @@ namespace System.Reflection.Emit
internal class RTDynamicMethod : MethodInfo
{
internal DynamicMethod m_owner;
- private ParameterInfo[] m_parameters;
+ private RuntimeParameterInfo[] m_parameters;
private String m_name;
private MethodAttributes m_attributes;
private CallingConventions m_callingConvention;
@@ -631,7 +631,7 @@ namespace System.Reflection.Emit
public override RuntimeMethodHandle MethodHandle
{
- get { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotAllowedInDynamicMethod")); }
+ get { throw new InvalidOperationException(SR.InvalidOperation_NotAllowedInDynamicMethod); }
}
public override MethodAttributes Attributes
@@ -671,7 +671,7 @@ namespace System.Reflection.Emit
// If we allowed use of RTDynamicMethod, the creator of the DynamicMethod would
// not be able to bound access to the DynamicMethod. Hence, we do not allow
// direct use of RTDynamicMethod.
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeMethodInfo"), "this");
+ throw new ArgumentException(SR.Argument_MustBeRuntimeMethodInfo, "this");
}
public override Object[] GetCustomAttributes(Type attributeType, bool inherit)
@@ -741,12 +741,12 @@ namespace System.Reflection.Emit
// private implementation
//
- internal ParameterInfo[] LoadParameters()
+ internal RuntimeParameterInfo[] LoadParameters()
{
if (m_parameters == null)
{
Type[] parameterTypes = m_owner.m_parameterTypes;
- ParameterInfo[] parameters = new ParameterInfo[parameterTypes.Length];
+ RuntimeParameterInfo[] parameters = new RuntimeParameterInfo[parameterTypes.Length];
for (int i = 0; i < parameterTypes.Length; i++)
parameters[i] = new RuntimeParameterInfo(this, null, parameterTypes[i], i);
if (m_parameters == null)
diff --git a/src/mscorlib/src/System/Reflection/Emit/EnumBuilder.cs b/src/mscorlib/src/System/Reflection/Emit/EnumBuilder.cs
index aae90c2ed4..55aa5c5a8f 100644
--- a/src/mscorlib/src/System/Reflection/Emit/EnumBuilder.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/EnumBuilder.cs
@@ -199,7 +199,7 @@ namespace System.Reflection.Emit
protected override PropertyInfo GetPropertyImpl(String name, BindingFlags bindingAttr, Binder binder,
Type returnType, Type[] types, ParameterModifier[] modifiers)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
public override PropertyInfo[] GetProperties(BindingFlags bindingAttr)
@@ -410,7 +410,7 @@ namespace System.Reflection.Emit
{
// Client should not set any bits other than the visibility bits.
if ((visibility & ~TypeAttributes.VisibilityMask) != 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_ShouldOnlySetVisibilityFlags"), nameof(name));
+ throw new ArgumentException(SR.Argument_ShouldOnlySetVisibilityFlags, nameof(name));
m_typeBuilder = new TypeBuilder(name, visibility | TypeAttributes.Sealed, typeof(System.Enum), null, module, PackingSize.Unspecified, TypeBuilder.UnspecifiedTypeSize, null);
// Define the underlying field for the enum. It will be a non-static, private field with special name bit set.
diff --git a/src/mscorlib/src/System/Reflection/Emit/FieldBuilder.cs b/src/mscorlib/src/System/Reflection/Emit/FieldBuilder.cs
index ae28212732..d0e9d3483c 100644
--- a/src/mscorlib/src/System/Reflection/Emit/FieldBuilder.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/FieldBuilder.cs
@@ -31,16 +31,16 @@ namespace System.Reflection.Emit
throw new ArgumentNullException(nameof(fieldName));
if (fieldName.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(fieldName));
+ throw new ArgumentException(SR.Argument_EmptyName, nameof(fieldName));
if (fieldName[0] == '\0')
- throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), nameof(fieldName));
+ throw new ArgumentException(SR.Argument_IllegalName, nameof(fieldName));
if (type == null)
throw new ArgumentNullException(nameof(type));
if (type == typeof(void))
- throw new ArgumentException(Environment.GetResourceString("Argument_BadFieldType"));
+ throw new ArgumentException(SR.Argument_BadFieldType);
Contract.EndContractBlock();
m_fieldName = fieldName;
@@ -121,7 +121,7 @@ namespace System.Reflection.Emit
// a NotSupportedException for Save-only dynamic assemblies.
// Otherwise, it could cause the .cctor to be executed.
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
public override void SetValue(Object obj, Object val, BindingFlags invokeAttr, Binder binder, CultureInfo culture)
@@ -130,12 +130,12 @@ namespace System.Reflection.Emit
// a NotSupportedException for Save-only dynamic assemblies.
// Otherwise, it could cause the .cctor to be executed.
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
public override RuntimeFieldHandle FieldHandle
{
- get { throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule")); }
+ get { throw new NotSupportedException(SR.NotSupported_DynamicModule); }
}
public override FieldAttributes Attributes
@@ -148,17 +148,17 @@ namespace System.Reflection.Emit
#region ICustomAttributeProvider Implementation
public override Object[] GetCustomAttributes(bool inherit)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
public override Object[] GetCustomAttributes(Type attributeType, bool inherit)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
public override bool IsDefined(Type attributeType, bool inherit)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
#endregion
diff --git a/src/mscorlib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs b/src/mscorlib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs
index 4538988c28..dd5ffa92a9 100644
--- a/src/mscorlib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs
@@ -192,7 +192,7 @@ namespace System.Reflection.Emit
public override Type GetGenericTypeDefinition() { throw new InvalidOperationException(); }
- public override Type MakeGenericType(params Type[] typeArguments) { throw new InvalidOperationException(Environment.GetResourceString("Arg_NotGenericTypeDefinition")); }
+ public override Type MakeGenericType(params Type[] typeArguments) { throw new InvalidOperationException(SR.Arg_NotGenericTypeDefinition); }
protected override bool IsValueTypeImpl() { return false; }
diff --git a/src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs b/src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs
index fe32417b2e..4021410a33 100644
--- a/src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs
@@ -233,7 +233,7 @@ namespace System.Reflection.Emit
if (m_currExcStackCount != 0)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_UnclosedExceptionBlock"));
+ throw new ArgumentException(SR.Argument_UnclosedExceptionBlock);
}
if (m_length == 0)
return null;
@@ -261,7 +261,7 @@ namespace System.Reflection.Emit
//Verify that our one-byte arg will fit into a Signed Byte.
if (updateAddr < SByte.MinValue || updateAddr > SByte.MaxValue)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_IllegalOneByteBranch", m_fixupData[i].m_fixupPos, updateAddr));
+ throw new NotSupportedException(SR.Format(SR.NotSupported_IllegalOneByteBranch, m_fixupData[i].m_fixupPos, updateAddr));
}
//Place the one-byte arg
@@ -288,7 +288,7 @@ namespace System.Reflection.Emit
__ExceptionInfo[] temp;
if (m_currExcStackCount != 0)
{
- throw new NotSupportedException(Environment.GetResourceString(ResId.Argument_UnclosedExceptionBlock));
+ throw new NotSupportedException(SR.GetResourceString(ResId.Argument_UnclosedExceptionBlock));
}
if (m_exceptionCount == 0)
@@ -342,10 +342,10 @@ namespace System.Reflection.Emit
int index = lbl.GetLabelValue();
if (index < 0 || index >= m_labelCount)
- throw new ArgumentException(Environment.GetResourceString("Argument_BadLabel"));
+ throw new ArgumentException(SR.Argument_BadLabel);
if (m_labelList[index] < 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_BadLabelContent"));
+ throw new ArgumentException(SR.Argument_BadLabelContent);
return m_labelList[index];
}
@@ -503,7 +503,7 @@ namespace System.Reflection.Emit
if ((callingConvention & CallingConventions.VarArgs) == 0)
{
// Client should not supply optional parameter in default calling convention
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotAVarArgCallingConvention"));
+ throw new InvalidOperationException(SR.InvalidOperation_NotAVarArgCallingConvention);
}
}
@@ -542,7 +542,7 @@ namespace System.Reflection.Emit
throw new ArgumentNullException(nameof(methodInfo));
if (!(opcode.Equals(OpCodes.Call) || opcode.Equals(OpCodes.Callvirt) || opcode.Equals(OpCodes.Newobj)))
- throw new ArgumentException(Environment.GetResourceString("Argument_NotMethodCallOpcode"), nameof(opcode));
+ throw new ArgumentException(SR.Argument_NotMethodCallOpcode, nameof(opcode));
Contract.EndContractBlock();
@@ -804,7 +804,7 @@ namespace System.Reflection.Emit
int tempVal = local.GetLocalIndex();
if (local.GetMethodBuilder() != m_methodBuilder)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_UnmatchedMethodForLocal"), nameof(local));
+ throw new ArgumentException(SR.Argument_UnmatchedMethodForLocal, nameof(local));
}
// If the instruction is a ldloc, ldloca a stloc, morph it to the optimal form.
if (opcode.Equals(OpCodes.Ldloc))
@@ -872,7 +872,7 @@ namespace System.Reflection.Emit
//Handle stloc_1, ldloc_1
if (tempVal > Byte.MaxValue)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadInstructionOrIndexOutOfBound"));
+ throw new InvalidOperationException(SR.InvalidOperation_BadInstructionOrIndexOutOfBound);
}
m_ILStream[m_length++] = (byte)tempVal;
}
@@ -930,7 +930,7 @@ namespace System.Reflection.Emit
{
if (m_currExcStackCount == 0)
{
- throw new NotSupportedException(Environment.GetResourceString("Argument_NotInExceptionBlock"));
+ throw new NotSupportedException(SR.Argument_NotInExceptionBlock);
}
// Pop the current exception block
@@ -944,7 +944,7 @@ namespace System.Reflection.Emit
if (state == __ExceptionInfo.State_Filter ||
state == __ExceptionInfo.State_Try)
{
- throw new InvalidOperationException(Environment.GetResourceString("Argument_BadExceptionCodeGen"));
+ throw new InvalidOperationException(SR.Argument_BadExceptionCodeGen);
}
if (state == __ExceptionInfo.State_Catch)
@@ -975,7 +975,7 @@ namespace System.Reflection.Emit
// Begins an exception filter block. Emits a branch instruction to the end of the current exception block.
if (m_currExcStackCount == 0)
- throw new NotSupportedException(Environment.GetResourceString("Argument_NotInExceptionBlock"));
+ throw new NotSupportedException(SR.Argument_NotInExceptionBlock);
__ExceptionInfo current = m_currExcStack[m_currExcStackCount - 1];
@@ -991,7 +991,7 @@ namespace System.Reflection.Emit
if (m_currExcStackCount == 0)
{
- throw new NotSupportedException(Environment.GetResourceString("Argument_NotInExceptionBlock"));
+ throw new NotSupportedException(SR.Argument_NotInExceptionBlock);
}
__ExceptionInfo current = m_currExcStack[m_currExcStackCount - 1];
@@ -999,7 +999,7 @@ namespace System.Reflection.Emit
{
if (exceptionType != null)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_ShouldNotSpecifyExceptionType"));
+ throw new ArgumentException(SR.Argument_ShouldNotSpecifyExceptionType);
}
this.Emit(OpCodes.Endfilter);
@@ -1023,7 +1023,7 @@ namespace System.Reflection.Emit
{
if (m_currExcStackCount == 0)
{
- throw new NotSupportedException(Environment.GetResourceString("Argument_NotInExceptionBlock"));
+ throw new NotSupportedException(SR.Argument_NotInExceptionBlock);
}
__ExceptionInfo current = m_currExcStack[m_currExcStackCount - 1];
@@ -1038,7 +1038,7 @@ namespace System.Reflection.Emit
{
if (m_currExcStackCount == 0)
{
- throw new NotSupportedException(Environment.GetResourceString("Argument_NotInExceptionBlock"));
+ throw new NotSupportedException(SR.Argument_NotInExceptionBlock);
}
__ExceptionInfo current = m_currExcStack[m_currExcStackCount - 1];
int state = current.GetCurrentState();
@@ -1097,12 +1097,12 @@ namespace System.Reflection.Emit
//This should never happen.
if (labelIndex < 0 || labelIndex >= m_labelList.Length)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidLabel"));
+ throw new ArgumentException(SR.Argument_InvalidLabel);
}
if (m_labelList[labelIndex] != -1)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_RedefinedLabel"));
+ throw new ArgumentException(SR.Argument_RedefinedLabel);
}
m_labelList[labelIndex] = m_length;
@@ -1122,13 +1122,13 @@ namespace System.Reflection.Emit
if (!excType.IsSubclassOf(typeof(Exception)) && excType != typeof(Exception))
{
- throw new ArgumentException(Environment.GetResourceString("Argument_NotExceptionType"));
+ throw new ArgumentException(SR.Argument_NotExceptionType);
}
Contract.EndContractBlock();
ConstructorInfo con = excType.GetConstructor(Type.EmptyTypes);
if (con == null)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_MissingDefaultConstructor"));
+ throw new ArgumentException(SR.Argument_MissingDefaultConstructor);
}
this.Emit(OpCodes.Newobj, con);
this.Emit(OpCodes.Throw);
@@ -1162,7 +1162,7 @@ namespace System.Reflection.Emit
Object cls;
if (m_methodBuilder == null)
{
- throw new ArgumentException(Environment.GetResourceString("InvalidOperation_BadILGeneratorUsage"));
+ throw new ArgumentException(SR.InvalidOperation_BadILGeneratorUsage);
}
MethodInfo prop = GetConsoleType().GetMethod("get_Out");
@@ -1172,13 +1172,13 @@ namespace System.Reflection.Emit
cls = localBuilder.LocalType;
if (cls is TypeBuilder || cls is EnumBuilder)
{
- throw new ArgumentException(Environment.GetResourceString("NotSupported_OutputStreamUsingTypeBuilder"));
+ throw new ArgumentException(SR.NotSupported_OutputStreamUsingTypeBuilder);
}
parameterTypes[0] = (Type)cls;
MethodInfo mi = prop.ReturnType.GetMethod("WriteLine", parameterTypes);
if (mi == null)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_EmitWriteLineType"), nameof(localBuilder));
+ throw new ArgumentException(SR.Argument_EmitWriteLineType, nameof(localBuilder));
}
Emit(OpCodes.Callvirt, mi);
@@ -1215,13 +1215,13 @@ namespace System.Reflection.Emit
cls = fld.FieldType;
if (cls is TypeBuilder || cls is EnumBuilder)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_OutputStreamUsingTypeBuilder"));
+ throw new NotSupportedException(SR.NotSupported_OutputStreamUsingTypeBuilder);
}
parameterTypes[0] = (Type)cls;
MethodInfo mi = prop.ReturnType.GetMethod("WriteLine", parameterTypes);
if (mi == null)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_EmitWriteLineType"), nameof(fld));
+ throw new ArgumentException(SR.Argument_EmitWriteLineType, nameof(fld));
}
Emit(OpCodes.Callvirt, mi);
}
@@ -1248,7 +1248,7 @@ namespace System.Reflection.Emit
if (methodBuilder.IsTypeCreated())
{
// cannot change method after its containing type has been created
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_TypeHasBeenCreated"));
+ throw new InvalidOperationException(SR.InvalidOperation_TypeHasBeenCreated);
}
if (localType == null)
@@ -1258,7 +1258,7 @@ namespace System.Reflection.Emit
if (methodBuilder.m_bIsBaked)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_MethodBaked"));
+ throw new InvalidOperationException(SR.InvalidOperation_MethodBaked);
}
// add the localType to local signature
@@ -1278,7 +1278,7 @@ namespace System.Reflection.Emit
throw new ArgumentNullException(nameof(usingNamespace));
if (usingNamespace.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(usingNamespace));
+ throw new ArgumentException(SR.Argument_EmptyName, nameof(usingNamespace));
Contract.EndContractBlock();
int index;
@@ -1477,7 +1477,7 @@ namespace System.Reflection.Emit
{
if (m_endFinally != -1)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_TooManyFinallyClause"));
+ throw new ArgumentException(SR.Argument_TooManyFinallyClause);
}
else
{
@@ -1680,7 +1680,7 @@ namespace System.Reflection.Emit
{
if (sa == ScopeAction.Close && m_iOpenScopeCount <= 0)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_UnmatchingSymScope"));
+ throw new ArgumentException(SR.Argument_UnmatchingSymScope);
}
Contract.EndContractBlock();
diff --git a/src/mscorlib/src/System/Reflection/Emit/LocalBuilder.cs b/src/mscorlib/src/System/Reflection/Emit/LocalBuilder.cs
index 42165075b4..c04c3c8434 100644
--- a/src/mscorlib/src/System/Reflection/Emit/LocalBuilder.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/LocalBuilder.cs
@@ -76,14 +76,14 @@ namespace System.Reflection.Emit
if (methodBuilder.IsTypeCreated())
{
// cannot change method after its containing type has been created
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_TypeHasBeenCreated"));
+ throw new InvalidOperationException(SR.InvalidOperation_TypeHasBeenCreated);
}
// set the name and range of offset for the local
if (dynMod.GetSymWriter() == null)
{
// cannot set local name if not debug module
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotADebugModule"));
+ throw new InvalidOperationException(SR.InvalidOperation_NotADebugModule);
}
sigHelp = SignatureHelper.GetFieldSigHelper(dynMod);
diff --git a/src/mscorlib/src/System/Reflection/Emit/MethodBuilder.cs b/src/mscorlib/src/System/Reflection/Emit/MethodBuilder.cs
index ee4c68ebf4..73882584a5 100644
--- a/src/mscorlib/src/System/Reflection/Emit/MethodBuilder.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/MethodBuilder.cs
@@ -84,10 +84,10 @@ namespace System.Reflection.Emit
throw new ArgumentNullException(nameof(name));
if (name.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(name));
+ throw new ArgumentException(SR.Argument_EmptyName, nameof(name));
if (name[0] == '\0')
- throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), nameof(name));
+ throw new ArgumentException(SR.Argument_IllegalName, nameof(name));
if (mod == null)
throw new ArgumentNullException(nameof(mod));
@@ -124,7 +124,7 @@ namespace System.Reflection.Emit
else if ((attributes & MethodAttributes.Virtual) != 0)
{
// A method can't be both static and virtual
- throw new ArgumentException(Environment.GetResourceString("Arg_NoStaticVirtual"));
+ throw new ArgumentException(SR.Arg_NoStaticVirtual);
}
if ((attributes & MethodAttributes.SpecialName) != MethodAttributes.SpecialName)
@@ -135,7 +135,7 @@ namespace System.Reflection.Emit
if ((attributes & (MethodAttributes.Abstract | MethodAttributes.Virtual)) !=
(MethodAttributes.Abstract | MethodAttributes.Virtual) &&
(attributes & MethodAttributes.Static) == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_BadAttributeOnInterfaceMethod"));
+ throw new ArgumentException(SR.Argument_BadAttributeOnInterfaceMethod);
}
}
@@ -212,7 +212,7 @@ namespace System.Reflection.Emit
if (m_bIsBaked)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_MethodHasBody"));
+ throw new InvalidOperationException(SR.InvalidOperation_MethodHasBody);
}
if (il.m_methodBuilder != this && il.m_methodBuilder != null)
@@ -221,7 +221,7 @@ namespace System.Reflection.Emit
// through MethodBuilder::GetILGenerator.
//
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadILGeneratorUsage"));
+ throw new InvalidOperationException(SR.InvalidOperation_BadILGeneratorUsage);
}
ThrowIfShouldNotHaveBody();
@@ -229,7 +229,7 @@ namespace System.Reflection.Emit
if (il.m_ScopeTree.m_iOpenScopeCount != 0)
{
// There are still unclosed local scope
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_OpenLocalVariableScope"));
+ throw new InvalidOperationException(SR.InvalidOperation_OpenLocalVariableScope);
}
@@ -559,7 +559,7 @@ namespace System.Reflection.Emit
#region MethodBase Overrides
public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
public override MethodImplAttributes GetMethodImplementationFlags()
@@ -579,7 +579,7 @@ namespace System.Reflection.Emit
public override RuntimeMethodHandle MethodHandle
{
- get { throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule")); }
+ get { throw new NotSupportedException(SR.NotSupported_DynamicModule); }
}
public override bool IsSecurityCritical
@@ -616,7 +616,7 @@ namespace System.Reflection.Emit
public override ParameterInfo[] GetParameters()
{
if (!m_bIsBaked || m_containingType == null || m_containingType.BakedRuntimeType == null)
- throw new NotSupportedException(Environment.GetResourceString("InvalidOperation_TypeNotCreated"));
+ throw new NotSupportedException(SR.InvalidOperation_TypeNotCreated);
MethodInfo rmi = m_containingType.GetMethod(m_strName, m_parameterTypes);
@@ -628,7 +628,7 @@ namespace System.Reflection.Emit
get
{
if (!m_bIsBaked || m_containingType == null || m_containingType.BakedRuntimeType == null)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_TypeNotCreated"));
+ throw new InvalidOperationException(SR.InvalidOperation_TypeNotCreated);
MethodInfo rmi = m_containingType.GetMethod(m_strName, m_parameterTypes);
@@ -640,17 +640,17 @@ namespace System.Reflection.Emit
#region ICustomAttributeProvider Implementation
public override Object[] GetCustomAttributes(bool inherit)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
public override Object[] GetCustomAttributes(Type attributeType, bool inherit)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
public override bool IsDefined(Type attributeType, bool inherit)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
#endregion
@@ -678,18 +678,18 @@ namespace System.Reflection.Emit
throw new ArgumentNullException(nameof(names));
if (names.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Arg_EmptyArray"), nameof(names));
+ throw new ArgumentException(SR.Arg_EmptyArray, nameof(names));
Contract.EndContractBlock();
if (m_inst != null)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_GenericParametersAlreadySet"));
+ throw new InvalidOperationException(SR.InvalidOperation_GenericParametersAlreadySet);
for (int i = 0; i < names.Length; i++)
if (names[i] == null)
throw new ArgumentNullException(nameof(names));
if (m_tkMethod.Token != 0)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_MethodBuilderBaked"));
+ throw new InvalidOperationException(SR.InvalidOperation_MethodBuilderBaked);
m_bIsGenMethDef = true;
m_inst = new GenericTypeParameterBuilder[names.Length];
@@ -824,14 +824,14 @@ namespace System.Reflection.Emit
public ParameterBuilder DefineParameter(int position, ParameterAttributes attributes, String strParamName)
{
if (position < 0)
- throw new ArgumentOutOfRangeException(Environment.GetResourceString("ArgumentOutOfRange_ParamSequence"));
+ throw new ArgumentOutOfRangeException(SR.ArgumentOutOfRange_ParamSequence);
Contract.EndContractBlock();
ThrowIfGeneric();
m_containingType.ThrowIfCreated();
if (position > 0 && (m_parameterTypes == null || position > m_parameterTypes.Length))
- throw new ArgumentOutOfRangeException(Environment.GetResourceString("ArgumentOutOfRange_ParamSequence"));
+ throw new ArgumentOutOfRangeException(SR.ArgumentOutOfRange_ParamSequence);
attributes = attributes & ~ParameterAttributes.ReservedMask;
return new ParameterBuilder(this, position, attributes, strParamName);
@@ -890,7 +890,7 @@ namespace System.Reflection.Emit
{
// cannot attach method body if methodimpl is marked not marked as managed IL
//
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ShouldNotHaveMethodBody"));
+ throw new InvalidOperationException(SR.InvalidOperation_ShouldNotHaveMethodBody);
}
}
diff --git a/src/mscorlib/src/System/Reflection/Emit/MethodBuilderInstantiation.cs b/src/mscorlib/src/System/Reflection/Emit/MethodBuilderInstantiation.cs
index ad5cc70a30..2d0a9b41dd 100644
--- a/src/mscorlib/src/System/Reflection/Emit/MethodBuilderInstantiation.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/MethodBuilderInstantiation.cs
@@ -59,7 +59,7 @@ namespace System.Reflection.Emit
[Pure]
public override ParameterInfo[] GetParameters() { throw new NotSupportedException(); }
public override MethodImplAttributes GetMethodImplementationFlags() { return m_method.GetMethodImplementationFlags(); }
- public override RuntimeMethodHandle MethodHandle { get { throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule")); } }
+ public override RuntimeMethodHandle MethodHandle { get { throw new NotSupportedException(SR.NotSupported_DynamicModule); } }
public override MethodAttributes Attributes { get { return m_method.Attributes; } }
public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
{
@@ -88,7 +88,7 @@ namespace System.Reflection.Emit
public override MethodInfo MakeGenericMethod(params Type[] arguments)
{
- throw new InvalidOperationException(Environment.GetResourceString("Arg_NotGenericMethodDefinition"));
+ throw new InvalidOperationException(SR.Arg_NotGenericMethodDefinition);
}
public override bool IsGenericMethod { get { return true; } }
diff --git a/src/mscorlib/src/System/Reflection/Emit/ModuleBuilder.cs b/src/mscorlib/src/System/Reflection/Emit/ModuleBuilder.cs
index 2dc9f51837..d92d8220b8 100644
--- a/src/mscorlib/src/System/Reflection/Emit/ModuleBuilder.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/ModuleBuilder.cs
@@ -120,7 +120,7 @@ namespace System.Reflection.Emit
object.ReferenceEquals(foundType.DeclaringType, enclosingType))
{
// Cannot have two types with the same name
- throw new ArgumentException(Environment.GetResourceString("Argument_DuplicateTypeName"));
+ throw new ArgumentException(SR.Argument_DuplicateTypeName);
}
}
@@ -308,7 +308,7 @@ namespace System.Reflection.Emit
// go through the slower code path, i.e. retrieve parameters and form signature helper.
ParameterInfo[] parameters = con.GetParameters();
if (parameters == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidConstructorInfo"));
+ throw new ArgumentException(SR.Argument_InvalidConstructorInfo);
Type[] parameterTypes = new Type[parameters.Length];
Type[][] requiredCustomModifiers = new Type[parameters.Length][];
@@ -317,7 +317,7 @@ namespace System.Reflection.Emit
for (int i = 0; i < parameters.Length; i++)
{
if (parameters[i] == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidConstructorInfo"));
+ throw new ArgumentException(SR.Argument_InvalidConstructorInfo);
parameterTypes[i] = parameters[i].ParameterType;
requiredCustomModifiers[i] = parameters[i].GetRequiredCustomModifiers();
@@ -368,7 +368,7 @@ namespace System.Reflection.Emit
}
}
- internal override ModuleHandle GetModuleHandle()
+ protected override ModuleHandle GetModuleHandleImpl()
{
return new ModuleHandle(GetNativeHandle());
}
@@ -409,7 +409,7 @@ namespace System.Reflection.Emit
if ((method.CallingConvention & CallingConventions.VarArgs) == 0)
{
// Client should not supply optional parameter in default calling convention
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotAVarArgCallingConvention"));
+ throw new InvalidOperationException(SR.InvalidOperation_NotAVarArgCallingConvention);
}
}
@@ -1010,16 +1010,16 @@ namespace System.Reflection.Emit
Type[] parameterTypes, Type[][] requiredParameterTypeCustomModifiers, Type[][] optionalParameterTypeCustomModifiers)
{
if (m_moduleData.m_fGlobalBeenCreated == true)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_GlobalsHaveBeenCreated"));
+ throw new InvalidOperationException(SR.InvalidOperation_GlobalsHaveBeenCreated);
if (name == null)
throw new ArgumentNullException(nameof(name));
if (name.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(name));
+ throw new ArgumentException(SR.Argument_EmptyName, nameof(name));
if ((attributes & MethodAttributes.Static) == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_GlobalFunctionHasToBeStatic"));
+ throw new ArgumentException(SR.Argument_GlobalFunctionHasToBeStatic);
Contract.Ensures(Contract.Result<MethodBuilder>() != null);
Contract.EndContractBlock();
@@ -1048,7 +1048,7 @@ namespace System.Reflection.Emit
if (m_moduleData.m_fGlobalBeenCreated)
{
// cannot create globals twice
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotADebugModule"));
+ throw new InvalidOperationException(SR.InvalidOperation_NotADebugModule);
}
m_moduleData.m_globalTypeBuilder.CreateType();
m_moduleData.m_fGlobalBeenCreated = true;
@@ -1078,7 +1078,7 @@ namespace System.Reflection.Emit
// will be the signature for the Field.
if (m_moduleData.m_fGlobalBeenCreated == true)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_GlobalsHaveBeenCreated"));
+ throw new InvalidOperationException(SR.InvalidOperation_GlobalsHaveBeenCreated);
}
Contract.Ensures(Contract.Result<FieldBuilder>() != null);
Contract.EndContractBlock();
@@ -1105,7 +1105,7 @@ namespace System.Reflection.Emit
if (m_moduleData.m_fGlobalBeenCreated == true)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_GlobalsHaveBeenCreated"));
+ throw new InvalidOperationException(SR.InvalidOperation_GlobalsHaveBeenCreated);
}
Contract.Ensures(Contract.Result<FieldBuilder>() != null);
Contract.EndContractBlock();
@@ -1158,7 +1158,7 @@ namespace System.Reflection.Emit
// We should also be aware of multiple dynamic modules and multiple implementation of Type!!!
if (type.IsByRef)
- throw new ArgumentException(Environment.GetResourceString("Argument_CannotGetTypeTokenForByRef"));
+ throw new ArgumentException(SR.Argument_CannotGetTypeTokenForByRef);
if ((type.IsGenericType && (!type.IsGenericTypeDefinition || !getGenericDefinition)) ||
type.IsGenericParameter ||
@@ -1275,7 +1275,7 @@ namespace System.Reflection.Emit
return new MethodToken(methodToken);
if (method.DeclaringType == null)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotImportGlobalFromDifferentModule"));
+ throw new InvalidOperationException(SR.InvalidOperation_CannotImportGlobalFromDifferentModule);
// method is defined in a different module
tr = getGenericTypeDefinition ? GetTypeToken(method.DeclaringType).Token : GetTypeTokenInternal(method.DeclaringType).Token;
@@ -1299,7 +1299,7 @@ namespace System.Reflection.Emit
// We need to get the TypeRef tokens
if (declaringType == null)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotImportGlobalFromDifferentModule"));
+ throw new InvalidOperationException(SR.InvalidOperation_CannotImportGlobalFromDifferentModule);
RuntimeMethodInfo rtMeth = null;
@@ -1448,10 +1448,10 @@ namespace System.Reflection.Emit
throw new ArgumentNullException(nameof(methodName));
if (methodName.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(methodName));
+ throw new ArgumentException(SR.Argument_EmptyName, nameof(methodName));
if (arrayClass.IsArray == false)
- throw new ArgumentException(Environment.GetResourceString("Argument_HasToBeArrayClass"));
+ throw new ArgumentException(SR.Argument_HasToBeArrayClass);
Contract.EndContractBlock();
CheckContext(returnType, arrayClass);
@@ -1537,7 +1537,7 @@ namespace System.Reflection.Emit
// field is defined in a different module
if (field.DeclaringType == null)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotImportGlobalFromDifferentModule"));
+ throw new InvalidOperationException(SR.InvalidOperation_CannotImportGlobalFromDifferentModule);
}
tr = GetTypeTokenInternal(field.DeclaringType).Token;
mr = GetMemberRef(field.ReflectedType.Module, tr, fdBuilder.GetToken().Token);
@@ -1550,7 +1550,7 @@ namespace System.Reflection.Emit
// We need to get the TypeRef tokens
if (field.DeclaringType == null)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotImportGlobalFromDifferentModule"));
+ throw new InvalidOperationException(SR.InvalidOperation_CannotImportGlobalFromDifferentModule);
}
if (field.DeclaringType != null && field.DeclaringType.IsGenericType)
@@ -1718,7 +1718,7 @@ namespace System.Reflection.Emit
if (m_iSymWriter == null)
{
// Cannot DefineDocument when it is not a debug module
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotADebugModule"));
+ throw new InvalidOperationException(SR.InvalidOperation_NotADebugModule);
}
return m_iSymWriter.DefineDocument(url, language, languageVendor, documentType);
diff --git a/src/mscorlib/src/System/Reflection/Emit/ModuleBuilderData.cs b/src/mscorlib/src/System/Reflection/Emit/ModuleBuilderData.cs
index c0af6ba7db..4f1b8eb713 100644
--- a/src/mscorlib/src/System/Reflection/Emit/ModuleBuilderData.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/ModuleBuilderData.cs
@@ -46,7 +46,7 @@ namespace System.Reflection.Emit
if (strExtension == null || strExtension == String.Empty)
{
// This is required by our loader. It cannot load module file that does not have file extension.
- throw new ArgumentException(Environment.GetResourceString("Argument_NoModuleFileExtension", strFileName));
+ throw new ArgumentException(SR.Format(SR.Argument_NoModuleFileExtension, strFileName));
}
m_strFileName = strFileName;
}
diff --git a/src/mscorlib/src/System/Reflection/Emit/PropertyBuilder.cs b/src/mscorlib/src/System/Reflection/Emit/PropertyBuilder.cs
index da087dcea7..6dbcba251f 100644
--- a/src/mscorlib/src/System/Reflection/Emit/PropertyBuilder.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/PropertyBuilder.cs
@@ -44,9 +44,9 @@ namespace System.Reflection.Emit
if (name == null)
throw new ArgumentNullException(nameof(name));
if (name.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(name));
+ throw new ArgumentException(SR.Argument_EmptyName, nameof(name));
if (name[0] == '\0')
- throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), nameof(name));
+ throw new ArgumentException(SR.Argument_IllegalName, nameof(name));
Contract.EndContractBlock();
m_name = name;
@@ -153,27 +153,27 @@ namespace System.Reflection.Emit
// Not supported functions in dynamic module.
public override Object GetValue(Object obj, Object[] index)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
public override Object GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
public override void SetValue(Object obj, Object value, Object[] index)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
public override void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
public override MethodInfo[] GetAccessors(bool nonPublic)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
public override MethodInfo GetGetMethod(bool nonPublic)
@@ -198,7 +198,7 @@ namespace System.Reflection.Emit
public override ParameterInfo[] GetIndexParameters()
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
public override Type PropertyType
@@ -223,17 +223,17 @@ namespace System.Reflection.Emit
public override Object[] GetCustomAttributes(bool inherit)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
public override Object[] GetCustomAttributes(Type attributeType, bool inherit)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
public override bool IsDefined(Type attributeType, bool inherit)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
public override String Name
diff --git a/src/mscorlib/src/System/Reflection/Emit/SignatureHelper.cs b/src/mscorlib/src/System/Reflection/Emit/SignatureHelper.cs
index eb5df8c8db..fd1a8e70fe 100644
--- a/src/mscorlib/src/System/Reflection/Emit/SignatureHelper.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/SignatureHelper.cs
@@ -114,7 +114,7 @@ namespace System.Reflection.Emit
}
else
{
- throw new ArgumentException(Environment.GetResourceString("Argument_UnknownUnmanagedCallConv"), nameof(unmanagedCallConv));
+ throw new ArgumentException(SR.Argument_UnknownUnmanagedCallConv, nameof(unmanagedCallConv));
}
sigHelp = new SignatureHelper(mod, intCall, returnType, null, null);
@@ -217,7 +217,7 @@ namespace System.Reflection.Emit
Init(mod, callingConvention, cGenericParameters);
if (callingConvention == MdSigCallingConvention.Field)
- throw new ArgumentException(Environment.GetResourceString("Argument_BadFieldSig"));
+ throw new ArgumentException(SR.Argument_BadFieldSig);
AddOneArgTypeHelper(returnType, requiredCustomModifiers, optionalCustomModifiers);
}
@@ -245,7 +245,7 @@ namespace System.Reflection.Emit
m_sizeLoc = NO_SIZE_IN_SIG;
if (m_module == null && mod != null)
- throw new ArgumentException(Environment.GetResourceString("NotSupported_MustBeModuleBuilder"));
+ throw new ArgumentException(SR.NotSupported_MustBeModuleBuilder);
}
private void Init(Module mod, MdSigCallingConvention callingConvention)
@@ -302,10 +302,10 @@ namespace System.Reflection.Emit
throw new ArgumentNullException(nameof(optionalCustomModifiers));
if (t.HasElementType)
- throw new ArgumentException(Environment.GetResourceString("Argument_ArraysInvalid"), nameof(optionalCustomModifiers));
+ throw new ArgumentException(SR.Argument_ArraysInvalid, nameof(optionalCustomModifiers));
if (t.ContainsGenericParameters)
- throw new ArgumentException(Environment.GetResourceString("Argument_GenericsInvalid"), nameof(optionalCustomModifiers));
+ throw new ArgumentException(SR.Argument_GenericsInvalid, nameof(optionalCustomModifiers));
AddElementType(CorElementType.CModOpt);
@@ -325,10 +325,10 @@ namespace System.Reflection.Emit
throw new ArgumentNullException(nameof(requiredCustomModifiers));
if (t.HasElementType)
- throw new ArgumentException(Environment.GetResourceString("Argument_ArraysInvalid"), nameof(requiredCustomModifiers));
+ throw new ArgumentException(SR.Argument_ArraysInvalid, nameof(requiredCustomModifiers));
if (t.ContainsGenericParameters)
- throw new ArgumentException(Environment.GetResourceString("Argument_GenericsInvalid"), nameof(requiredCustomModifiers));
+ throw new ArgumentException(SR.Argument_GenericsInvalid, nameof(requiredCustomModifiers));
AddElementType(CorElementType.CModReqd);
@@ -510,7 +510,7 @@ namespace System.Reflection.Emit
}
else
{
- throw new ArgumentException(Environment.GetResourceString("Argument_LargeInteger"));
+ throw new ArgumentException(SR.Argument_LargeInteger);
}
}
@@ -535,7 +535,7 @@ namespace System.Reflection.Emit
if (rid > 0x3FFFFFF)
{
// token is too big to be compressed
- throw new ArgumentException(Environment.GetResourceString("Argument_LargeInteger"));
+ throw new ArgumentException(SR.Argument_LargeInteger);
}
rid = (rid << 2);
@@ -755,7 +755,7 @@ namespace System.Reflection.Emit
temp[sigCopyIndex++] = (byte)((argCount) & 0xFF);
}
else
- throw new ArgumentException(Environment.GetResourceString("Argument_LargeInteger"));
+ throw new ArgumentException(SR.Argument_LargeInteger);
// copy the sig part of the sig
Buffer.BlockCopy(m_signature, 2, temp, sigCopyIndex, currSigLength - 2);
// mark the end of sig
@@ -784,10 +784,10 @@ namespace System.Reflection.Emit
public void AddArguments(Type[] arguments, Type[][] requiredCustomModifiers, Type[][] optionalCustomModifiers)
{
if (requiredCustomModifiers != null && (arguments == null || requiredCustomModifiers.Length != arguments.Length))
- throw new ArgumentException(Environment.GetResourceString("Argument_MismatchedArrays", nameof(requiredCustomModifiers), nameof(arguments)));
+ throw new ArgumentException(SR.Format(SR.Argument_MismatchedArrays, nameof(requiredCustomModifiers), nameof(arguments)));
if (optionalCustomModifiers != null && (arguments == null || optionalCustomModifiers.Length != arguments.Length))
- throw new ArgumentException(Environment.GetResourceString("Argument_MismatchedArrays", nameof(optionalCustomModifiers), nameof(arguments)));
+ throw new ArgumentException(SR.Format(SR.Argument_MismatchedArrays, nameof(optionalCustomModifiers), nameof(arguments)));
if (arguments != null)
{
@@ -803,7 +803,7 @@ namespace System.Reflection.Emit
public void AddArgument(Type argument, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers)
{
if (m_sigDone)
- throw new ArgumentException(Environment.GetResourceString("Argument_SigIsFinalized"));
+ throw new ArgumentException(SR.Argument_SigIsFinalized);
if (argument == null)
throw new ArgumentNullException(nameof(argument));
diff --git a/src/mscorlib/src/System/Reflection/Emit/SymbolMethod.cs b/src/mscorlib/src/System/Reflection/Emit/SymbolMethod.cs
index d82e271672..4c4cd15922 100644
--- a/src/mscorlib/src/System/Reflection/Emit/SymbolMethod.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/SymbolMethod.cs
@@ -99,17 +99,17 @@ namespace System.Reflection.Emit
[Pure]
public override ParameterInfo[] GetParameters()
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_SymbolMethod"));
+ throw new NotSupportedException(SR.NotSupported_SymbolMethod);
}
public override MethodImplAttributes GetMethodImplementationFlags()
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_SymbolMethod"));
+ throw new NotSupportedException(SR.NotSupported_SymbolMethod);
}
public override MethodAttributes Attributes
{
- get { throw new NotSupportedException(Environment.GetResourceString("NotSupported_SymbolMethod")); }
+ get { throw new NotSupportedException(SR.NotSupported_SymbolMethod); }
}
public override CallingConventions CallingConvention
@@ -119,7 +119,7 @@ namespace System.Reflection.Emit
public override RuntimeMethodHandle MethodHandle
{
- get { throw new NotSupportedException(Environment.GetResourceString("NotSupported_SymbolMethod")); }
+ get { throw new NotSupportedException(SR.NotSupported_SymbolMethod); }
}
#endregion
@@ -140,7 +140,7 @@ namespace System.Reflection.Emit
public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_SymbolMethod"));
+ throw new NotSupportedException(SR.NotSupported_SymbolMethod);
}
public override MethodInfo GetBaseDefinition()
@@ -152,17 +152,17 @@ namespace System.Reflection.Emit
#region ICustomAttributeProvider Implementation
public override Object[] GetCustomAttributes(bool inherit)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_SymbolMethod"));
+ throw new NotSupportedException(SR.NotSupported_SymbolMethod);
}
public override Object[] GetCustomAttributes(Type attributeType, bool inherit)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_SymbolMethod"));
+ throw new NotSupportedException(SR.NotSupported_SymbolMethod);
}
public override bool IsDefined(Type attributeType, bool inherit)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_SymbolMethod"));
+ throw new NotSupportedException(SR.NotSupported_SymbolMethod);
}
#endregion
diff --git a/src/mscorlib/src/System/Reflection/Emit/SymbolType.cs b/src/mscorlib/src/System/Reflection/Emit/SymbolType.cs
index bfe9ce0fe5..16848b43dd 100644
--- a/src/mscorlib/src/System/Reflection/Emit/SymbolType.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/SymbolType.cs
@@ -66,7 +66,7 @@ namespace System.Reflection.Emit
if (curIndex != format.Length)
// ByRef has to be the last char!!
- throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
+ throw new ArgumentException(SR.Argument_BadSigFormat);
symbolType.SetElementType(baseType);
return symbolType;
@@ -128,7 +128,7 @@ namespace System.Reflection.Emit
if (format[curIndex] != '.')
{
// bad format!! Throw exception
- throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
+ throw new ArgumentException(SR.Argument_BadSigFormat);
}
curIndex++;
@@ -158,7 +158,7 @@ namespace System.Reflection.Emit
{
// User specified upper bound less than lower bound, this is an error.
// Throw error exception.
- throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
+ throw new ArgumentException(SR.Argument_BadSigFormat);
}
}
}
@@ -176,7 +176,7 @@ namespace System.Reflection.Emit
}
else if (format[curIndex] != ']')
{
- throw new ArgumentException(Environment.GetResourceString("Argument_BadSigFormat"));
+ throw new ArgumentException(SR.Argument_BadSigFormat);
}
}
@@ -313,7 +313,7 @@ namespace System.Reflection.Emit
public override int GetArrayRank()
{
if (!IsArray)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_SubclassOverride"));
+ throw new NotSupportedException(SR.NotSupported_SubclassOverride);
Contract.EndContractBlock();
return m_cRank;
@@ -321,13 +321,13 @@ namespace System.Reflection.Emit
public override Guid GUID
{
- get { throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType")); }
+ get { throw new NotSupportedException(SR.NotSupported_NonReflectedType); }
}
public override Object InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target,
Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType"));
+ throw new NotSupportedException(SR.NotSupported_NonReflectedType);
}
public override Module Module
@@ -355,7 +355,7 @@ namespace System.Reflection.Emit
public override RuntimeTypeHandle TypeHandle
{
- get { throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType")); }
+ get { throw new NotSupportedException(SR.NotSupported_NonReflectedType); }
}
public override String Name
@@ -406,94 +406,94 @@ namespace System.Reflection.Emit
protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder binder,
CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType"));
+ throw new NotSupportedException(SR.NotSupported_NonReflectedType);
}
public override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType"));
+ throw new NotSupportedException(SR.NotSupported_NonReflectedType);
}
protected override MethodInfo GetMethodImpl(String name, BindingFlags bindingAttr, Binder binder,
CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType"));
+ throw new NotSupportedException(SR.NotSupported_NonReflectedType);
}
public override MethodInfo[] GetMethods(BindingFlags bindingAttr)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType"));
+ throw new NotSupportedException(SR.NotSupported_NonReflectedType);
}
public override FieldInfo GetField(String name, BindingFlags bindingAttr)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType"));
+ throw new NotSupportedException(SR.NotSupported_NonReflectedType);
}
public override FieldInfo[] GetFields(BindingFlags bindingAttr)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType"));
+ throw new NotSupportedException(SR.NotSupported_NonReflectedType);
}
public override Type GetInterface(String name, bool ignoreCase)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType"));
+ throw new NotSupportedException(SR.NotSupported_NonReflectedType);
}
public override Type[] GetInterfaces()
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType"));
+ throw new NotSupportedException(SR.NotSupported_NonReflectedType);
}
public override EventInfo GetEvent(String name, BindingFlags bindingAttr)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType"));
+ throw new NotSupportedException(SR.NotSupported_NonReflectedType);
}
public override EventInfo[] GetEvents()
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType"));
+ throw new NotSupportedException(SR.NotSupported_NonReflectedType);
}
protected override PropertyInfo GetPropertyImpl(String name, BindingFlags bindingAttr, Binder binder,
Type returnType, Type[] types, ParameterModifier[] modifiers)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType"));
+ throw new NotSupportedException(SR.NotSupported_NonReflectedType);
}
public override PropertyInfo[] GetProperties(BindingFlags bindingAttr)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType"));
+ throw new NotSupportedException(SR.NotSupported_NonReflectedType);
}
public override Type[] GetNestedTypes(BindingFlags bindingAttr)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType"));
+ throw new NotSupportedException(SR.NotSupported_NonReflectedType);
}
public override Type GetNestedType(String name, BindingFlags bindingAttr)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType"));
+ throw new NotSupportedException(SR.NotSupported_NonReflectedType);
}
public override MemberInfo[] GetMember(String name, MemberTypes type, BindingFlags bindingAttr)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType"));
+ throw new NotSupportedException(SR.NotSupported_NonReflectedType);
}
public override MemberInfo[] GetMembers(BindingFlags bindingAttr)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType"));
+ throw new NotSupportedException(SR.NotSupported_NonReflectedType);
}
public override InterfaceMapping GetInterfaceMap(Type interfaceType)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType"));
+ throw new NotSupportedException(SR.NotSupported_NonReflectedType);
}
public override EventInfo[] GetEvents(BindingFlags bindingAttr)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType"));
+ throw new NotSupportedException(SR.NotSupported_NonReflectedType);
}
protected override TypeAttributes GetAttributeFlagsImpl()
@@ -559,17 +559,17 @@ namespace System.Reflection.Emit
public override Object[] GetCustomAttributes(bool inherit)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType"));
+ throw new NotSupportedException(SR.NotSupported_NonReflectedType);
}
public override Object[] GetCustomAttributes(Type attributeType, bool inherit)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType"));
+ throw new NotSupportedException(SR.NotSupported_NonReflectedType);
}
public override bool IsDefined(Type attributeType, bool inherit)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonReflectedType"));
+ throw new NotSupportedException(SR.NotSupported_NonReflectedType);
}
#endregion
}
diff --git a/src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs b/src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs
index b4cba17668..bfd2c96064 100644
--- a/src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs
@@ -90,7 +90,7 @@ namespace System.Reflection.Emit
public static MethodInfo GetMethod(Type type, MethodInfo method)
{
if (!(type is TypeBuilder) && !(type is TypeBuilderInstantiation))
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeTypeBuilder"));
+ throw new ArgumentException(SR.Argument_MustBeTypeBuilder);
// The following checks establishes invariants that more simply put require type to be generic and
// method to be a generic method definition declared on the generic type definition of type.
@@ -100,13 +100,13 @@ namespace System.Reflection.Emit
// if we wanted to but that just complicates things so these checks are designed to prevent that scenario.
if (method.IsGenericMethod && !method.IsGenericMethodDefinition)
- throw new ArgumentException(Environment.GetResourceString("Argument_NeedGenericMethodDefinition"), nameof(method));
+ throw new ArgumentException(SR.Argument_NeedGenericMethodDefinition, nameof(method));
if (method.DeclaringType == null || !method.DeclaringType.IsGenericTypeDefinition)
- throw new ArgumentException(Environment.GetResourceString("Argument_MethodNeedGenericDeclaringType"), nameof(method));
+ throw new ArgumentException(SR.Argument_MethodNeedGenericDeclaringType, nameof(method));
if (type.GetGenericTypeDefinition() != method.DeclaringType)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidMethodDeclaringType"), nameof(type));
+ throw new ArgumentException(SR.Argument_InvalidMethodDeclaringType, nameof(type));
Contract.EndContractBlock();
// The following converts from Type or TypeBuilder of G<T> to TypeBuilderInstantiation G<T>. These types
@@ -116,49 +116,49 @@ namespace System.Reflection.Emit
type = type.MakeGenericType(type.GetGenericArguments());
if (!(type is TypeBuilderInstantiation))
- throw new ArgumentException(Environment.GetResourceString("Argument_NeedNonGenericType"), nameof(type));
+ throw new ArgumentException(SR.Argument_NeedNonGenericType, nameof(type));
return MethodOnTypeBuilderInstantiation.GetMethod(method, type as TypeBuilderInstantiation);
}
public static ConstructorInfo GetConstructor(Type type, ConstructorInfo constructor)
{
if (!(type is TypeBuilder) && !(type is TypeBuilderInstantiation))
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeTypeBuilder"));
+ throw new ArgumentException(SR.Argument_MustBeTypeBuilder);
if (!constructor.DeclaringType.IsGenericTypeDefinition)
- throw new ArgumentException(Environment.GetResourceString("Argument_ConstructorNeedGenericDeclaringType"), nameof(constructor));
+ throw new ArgumentException(SR.Argument_ConstructorNeedGenericDeclaringType, nameof(constructor));
Contract.EndContractBlock();
if (!(type is TypeBuilderInstantiation))
- throw new ArgumentException(Environment.GetResourceString("Argument_NeedNonGenericType"), nameof(type));
+ throw new ArgumentException(SR.Argument_NeedNonGenericType, nameof(type));
// TypeBuilder G<T> ==> TypeBuilderInstantiation G<T>
if (type is TypeBuilder && type.IsGenericTypeDefinition)
type = type.MakeGenericType(type.GetGenericArguments());
if (type.GetGenericTypeDefinition() != constructor.DeclaringType)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidConstructorDeclaringType"), nameof(type));
+ throw new ArgumentException(SR.Argument_InvalidConstructorDeclaringType, nameof(type));
return ConstructorOnTypeBuilderInstantiation.GetConstructor(constructor, type as TypeBuilderInstantiation);
}
public static FieldInfo GetField(Type type, FieldInfo field)
{
if (!(type is TypeBuilder) && !(type is TypeBuilderInstantiation))
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeTypeBuilder"));
+ throw new ArgumentException(SR.Argument_MustBeTypeBuilder);
if (!field.DeclaringType.IsGenericTypeDefinition)
- throw new ArgumentException(Environment.GetResourceString("Argument_FieldNeedGenericDeclaringType"), nameof(field));
+ throw new ArgumentException(SR.Argument_FieldNeedGenericDeclaringType, nameof(field));
Contract.EndContractBlock();
if (!(type is TypeBuilderInstantiation))
- throw new ArgumentException(Environment.GetResourceString("Argument_NeedNonGenericType"), nameof(type));
+ throw new ArgumentException(SR.Argument_NeedNonGenericType, nameof(type));
// TypeBuilder G<T> ==> TypeBuilderInstantiation G<T>
if (type is TypeBuilder && type.IsGenericTypeDefinition)
type = type.MakeGenericType(type.GetGenericArguments());
if (type.GetGenericTypeDefinition() != field.DeclaringType)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidFieldDeclaringType"), nameof(type));
+ throw new ArgumentException(SR.Argument_InvalidFieldDeclaringType, nameof(type));
return FieldOnTypeBuilderInstantiation.GetField(field, type as TypeBuilderInstantiation);
}
@@ -351,7 +351,7 @@ namespace System.Reflection.Emit
// The constant value supplied should match either the baked enum type or its underlying type
// we don't need to compare it with the EnumBuilder itself because you can never have an object of that type
if (type != enumBldr.m_typeBuilder.m_bakedRuntimeType && type != underlyingType)
- throw new ArgumentException(Environment.GetResourceString("Argument_ConstantDoesntMatch"));
+ throw new ArgumentException(SR.Argument_ConstantDoesntMatch);
}
else if ((typeBldr = destType as TypeBuilder) != null)
{
@@ -360,7 +360,7 @@ namespace System.Reflection.Emit
// The constant value supplied should match either the baked enum type or its underlying type
// typeBldr.m_enumUnderlyingType is null if the user hasn't created a "value__" field on the enum
if (underlyingType == null || (type != typeBldr.UnderlyingSystemType && type != underlyingType))
- throw new ArgumentException(Environment.GetResourceString("Argument_ConstantDoesntMatch"));
+ throw new ArgumentException(SR.Argument_ConstantDoesntMatch);
}
else // must be a runtime Enum Type
{
@@ -370,7 +370,7 @@ namespace System.Reflection.Emit
// The constant value supplied should match either the enum itself or its underlying type
if (type != destType && type != underlyingType)
- throw new ArgumentException(Environment.GetResourceString("Argument_ConstantDoesntMatch"));
+ throw new ArgumentException(SR.Argument_ConstantDoesntMatch);
}
type = underlyingType;
@@ -379,7 +379,7 @@ namespace System.Reflection.Emit
{
// Note that it is non CLS compliant if destType != type. But RefEmit never guarantees CLS-Compliance.
if (!destType.IsAssignableFrom(type))
- throw new ArgumentException(Environment.GetResourceString("Argument_ConstantDoesntMatch"));
+ throw new ArgumentException(SR.Argument_ConstantDoesntMatch);
}
CorElementType corType = RuntimeTypeHandle.GetCorElementType((RuntimeType)type);
@@ -416,7 +416,7 @@ namespace System.Reflection.Emit
}
else
{
- throw new ArgumentException(Environment.GetResourceString("Argument_ConstantNotSupported", type.ToString()));
+ throw new ArgumentException(SR.Format(SR.Argument_ConstantNotSupported, type.ToString()));
}
break;
}
@@ -427,7 +427,7 @@ namespace System.Reflection.Emit
{
// nullable types can hold null value.
if (!(destType.IsGenericType && destType.GetGenericTypeDefinition() == typeof(Nullable<>)))
- throw new ArgumentException(Environment.GetResourceString("Argument_ConstantNull"));
+ throw new ArgumentException(SR.Argument_ConstantNull);
}
SetConstantValue(module.GetNativeHandle(), tk, (int)CorElementType.Class, null);
@@ -527,14 +527,14 @@ namespace System.Reflection.Emit
throw new ArgumentNullException(nameof(fullname));
if (fullname.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(fullname));
+ throw new ArgumentException(SR.Argument_EmptyName, nameof(fullname));
if (fullname[0] == '\0')
- throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), nameof(fullname));
+ throw new ArgumentException(SR.Argument_IllegalName, nameof(fullname));
if (fullname.Length > 1023)
- throw new ArgumentException(Environment.GetResourceString("Argument_TypeNameTooLong"), nameof(fullname));
+ throw new ArgumentException(SR.Argument_TypeNameTooLong, nameof(fullname));
Contract.EndContractBlock();
int i;
@@ -550,7 +550,7 @@ namespace System.Reflection.Emit
// Nested Type should have nested attribute set.
// If we are renumbering TypeAttributes' bit, we need to change the logic here.
if (((attr & TypeAttributes.VisibilityMask) == TypeAttributes.Public) || ((attr & TypeAttributes.VisibilityMask) == TypeAttributes.NotPublic))
- throw new ArgumentException(Environment.GetResourceString("Argument_BadNestedTypeFlags"), nameof(attr));
+ throw new ArgumentException(SR.Argument_BadNestedTypeFlags, nameof(attr));
}
int[] interfaceTokens = null;
@@ -631,10 +631,10 @@ namespace System.Reflection.Emit
throw new ArgumentNullException(nameof(name));
if (name.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(name));
+ throw new ArgumentException(SR.Argument_EmptyName, nameof(name));
if (size <= 0 || size >= 0x003f0000)
- throw new ArgumentException(Environment.GetResourceString("Argument_BadSizeForData"));
+ throw new ArgumentException(SR.Argument_BadSizeForData);
Contract.EndContractBlock();
ThrowIfCreated();
@@ -670,7 +670,7 @@ namespace System.Reflection.Emit
// Not a nested class.
if (((attr & TypeAttributes.VisibilityMask) != TypeAttributes.NotPublic) && ((attr & TypeAttributes.VisibilityMask) != TypeAttributes.Public))
{
- throw new ArgumentException(Environment.GetResourceString("Argument_BadTypeAttrNestedVisibilityOnNonNestedType"));
+ throw new ArgumentException(SR.Argument_BadTypeAttrNestedVisibilityOnNonNestedType);
}
}
else
@@ -678,20 +678,20 @@ namespace System.Reflection.Emit
// Nested class.
if (((attr & TypeAttributes.VisibilityMask) == TypeAttributes.NotPublic) || ((attr & TypeAttributes.VisibilityMask) == TypeAttributes.Public))
{
- throw new ArgumentException(Environment.GetResourceString("Argument_BadTypeAttrNonNestedVisibilityNestedType"));
+ throw new ArgumentException(SR.Argument_BadTypeAttrNonNestedVisibilityNestedType);
}
}
// Verify that the layout mask is valid.
if (((attr & TypeAttributes.LayoutMask) != TypeAttributes.AutoLayout) && ((attr & TypeAttributes.LayoutMask) != TypeAttributes.SequentialLayout) && ((attr & TypeAttributes.LayoutMask) != TypeAttributes.ExplicitLayout))
{
- throw new ArgumentException(Environment.GetResourceString("Argument_BadTypeAttrInvalidLayout"));
+ throw new ArgumentException(SR.Argument_BadTypeAttrInvalidLayout);
}
// Check if the user attempted to set any reserved bits.
if ((attr & TypeAttributes.ReservedMask) != 0)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_BadTypeAttrReservedBitsSet"));
+ throw new ArgumentException(SR.Argument_BadTypeAttrReservedBitsSet);
}
}
@@ -723,7 +723,7 @@ namespace System.Reflection.Emit
internal void ThrowIfCreated()
{
if (IsCreated())
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_TypeHasBeenCreated"));
+ throw new InvalidOperationException(SR.InvalidOperation_TypeHasBeenCreated);
}
internal object SyncRoot
@@ -825,7 +825,7 @@ namespace System.Reflection.Emit
get
{
if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
+ throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated);
Contract.EndContractBlock();
return m_bakedRuntimeType.GUID;
@@ -836,7 +836,7 @@ namespace System.Reflection.Emit
Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters)
{
if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
+ throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated);
Contract.EndContractBlock();
return m_bakedRuntimeType.InvokeMember(name, invokeAttr, binder, target, args, modifiers, culture, namedParameters);
@@ -849,7 +849,7 @@ namespace System.Reflection.Emit
public override RuntimeTypeHandle TypeHandle
{
- get { throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule")); }
+ get { throw new NotSupportedException(SR.NotSupported_DynamicModule); }
}
public override String FullName
@@ -885,7 +885,7 @@ namespace System.Reflection.Emit
CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
{
if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
+ throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated);
Contract.EndContractBlock();
return m_bakedRuntimeType.GetConstructor(bindingAttr, binder, callConvention, types, modifiers);
@@ -894,7 +894,7 @@ namespace System.Reflection.Emit
public override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr)
{
if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
+ throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated);
Contract.EndContractBlock();
return m_bakedRuntimeType.GetConstructors(bindingAttr);
@@ -904,7 +904,7 @@ namespace System.Reflection.Emit
CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
{
if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
+ throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated);
Contract.EndContractBlock();
if (types == null)
@@ -920,7 +920,7 @@ namespace System.Reflection.Emit
public override MethodInfo[] GetMethods(BindingFlags bindingAttr)
{
if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
+ throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated);
Contract.EndContractBlock();
return m_bakedRuntimeType.GetMethods(bindingAttr);
@@ -929,7 +929,7 @@ namespace System.Reflection.Emit
public override FieldInfo GetField(String name, BindingFlags bindingAttr)
{
if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
+ throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated);
Contract.EndContractBlock();
return m_bakedRuntimeType.GetField(name, bindingAttr);
@@ -938,7 +938,7 @@ namespace System.Reflection.Emit
public override FieldInfo[] GetFields(BindingFlags bindingAttr)
{
if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
+ throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated);
Contract.EndContractBlock();
return m_bakedRuntimeType.GetFields(bindingAttr);
@@ -947,7 +947,7 @@ namespace System.Reflection.Emit
public override Type GetInterface(String name, bool ignoreCase)
{
if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
+ throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated);
Contract.EndContractBlock();
return m_bakedRuntimeType.GetInterface(name, ignoreCase);
@@ -971,7 +971,7 @@ namespace System.Reflection.Emit
public override EventInfo GetEvent(String name, BindingFlags bindingAttr)
{
if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
+ throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated);
Contract.EndContractBlock();
return m_bakedRuntimeType.GetEvent(name, bindingAttr);
@@ -980,7 +980,7 @@ namespace System.Reflection.Emit
public override EventInfo[] GetEvents()
{
if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
+ throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated);
Contract.EndContractBlock();
return m_bakedRuntimeType.GetEvents();
@@ -989,13 +989,13 @@ namespace System.Reflection.Emit
protected override PropertyInfo GetPropertyImpl(String name, BindingFlags bindingAttr, Binder binder,
Type returnType, Type[] types, ParameterModifier[] modifiers)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
public override PropertyInfo[] GetProperties(BindingFlags bindingAttr)
{
if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
+ throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated);
Contract.EndContractBlock();
return m_bakedRuntimeType.GetProperties(bindingAttr);
@@ -1004,7 +1004,7 @@ namespace System.Reflection.Emit
public override Type[] GetNestedTypes(BindingFlags bindingAttr)
{
if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
+ throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated);
Contract.EndContractBlock();
return m_bakedRuntimeType.GetNestedTypes(bindingAttr);
@@ -1013,7 +1013,7 @@ namespace System.Reflection.Emit
public override Type GetNestedType(String name, BindingFlags bindingAttr)
{
if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
+ throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated);
Contract.EndContractBlock();
return m_bakedRuntimeType.GetNestedType(name, bindingAttr);
@@ -1022,7 +1022,7 @@ namespace System.Reflection.Emit
public override MemberInfo[] GetMember(String name, MemberTypes type, BindingFlags bindingAttr)
{
if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
+ throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated);
Contract.EndContractBlock();
return m_bakedRuntimeType.GetMember(name, type, bindingAttr);
@@ -1031,7 +1031,7 @@ namespace System.Reflection.Emit
public override InterfaceMapping GetInterfaceMap(Type interfaceType)
{
if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
+ throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated);
Contract.EndContractBlock();
return m_bakedRuntimeType.GetInterfaceMap(interfaceType);
@@ -1040,7 +1040,7 @@ namespace System.Reflection.Emit
public override EventInfo[] GetEvents(BindingFlags bindingAttr)
{
if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
+ throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated);
Contract.EndContractBlock();
return m_bakedRuntimeType.GetEvents(bindingAttr);
@@ -1049,7 +1049,7 @@ namespace System.Reflection.Emit
public override MemberInfo[] GetMembers(BindingFlags bindingAttr)
{
if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
+ throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated);
Contract.EndContractBlock();
return m_bakedRuntimeType.GetMembers(bindingAttr);
@@ -1136,7 +1136,7 @@ namespace System.Reflection.Emit
public override Type GetElementType()
{
// You will never have to deal with a TypeBuilder if you are just referring to arrays.
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
}
protected override bool HasElementTypeImpl()
@@ -1190,7 +1190,7 @@ namespace System.Reflection.Emit
if (IsEnum)
{
if (m_enumUnderlyingType == null)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NoUnderlyingTypeOnEnum"));
+ throw new InvalidOperationException(SR.InvalidOperation_NoUnderlyingTypeOnEnum);
return m_enumUnderlyingType;
}
@@ -1243,7 +1243,7 @@ namespace System.Reflection.Emit
public override Object[] GetCustomAttributes(bool inherit)
{
if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
+ throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated);
Contract.EndContractBlock();
return CustomAttribute.GetCustomAttributes(m_bakedRuntimeType, typeof(object) as RuntimeType, inherit);
@@ -1252,7 +1252,7 @@ namespace System.Reflection.Emit
public override Object[] GetCustomAttributes(Type attributeType, bool inherit)
{
if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
+ throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated);
if (attributeType == null)
throw new ArgumentNullException(nameof(attributeType));
@@ -1261,7 +1261,7 @@ namespace System.Reflection.Emit
RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
if (attributeRuntimeType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(attributeType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));
return CustomAttribute.GetCustomAttributes(m_bakedRuntimeType, attributeRuntimeType, inherit);
}
@@ -1269,7 +1269,7 @@ namespace System.Reflection.Emit
public override bool IsDefined(Type attributeType, bool inherit)
{
if (!IsCreated())
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_TypeNotYetCreated"));
+ throw new NotSupportedException(SR.NotSupported_TypeNotYetCreated);
if (attributeType == null)
throw new ArgumentNullException(nameof(attributeType));
@@ -1278,7 +1278,7 @@ namespace System.Reflection.Emit
RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
if (attributeRuntimeType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(attributeType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));
return CustomAttribute.IsDefined(m_bakedRuntimeType, attributeRuntimeType, inherit);
}
@@ -1368,7 +1368,7 @@ namespace System.Reflection.Emit
if (!object.ReferenceEquals(methodInfoBody.DeclaringType, this))
// Loader restriction: body method has to be from this class
- throw new ArgumentException(Environment.GetResourceString("ArgumentException_BadMethodImplBody"));
+ throw new ArgumentException(SR.ArgumentException_BadMethodImplBody);
MethodToken tkBody;
MethodToken tkDecl;
@@ -1430,7 +1430,7 @@ namespace System.Reflection.Emit
throw new ArgumentNullException(nameof(name));
if (name.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(name));
+ throw new ArgumentException(SR.Argument_EmptyName, nameof(name));
Contract.Ensures(Contract.Result<MethodBuilder>() != null);
Contract.EndContractBlock();
@@ -1442,10 +1442,10 @@ namespace System.Reflection.Emit
if (parameterTypes != null)
{
if (parameterTypeOptionalCustomModifiers != null && parameterTypeOptionalCustomModifiers.Length != parameterTypes.Length)
- throw new ArgumentException(Environment.GetResourceString("Argument_MismatchedArrays", nameof(parameterTypeOptionalCustomModifiers), nameof(parameterTypes)));
+ throw new ArgumentException(SR.Format(SR.Argument_MismatchedArrays, nameof(parameterTypeOptionalCustomModifiers), nameof(parameterTypes)));
if (parameterTypeRequiredCustomModifiers != null && parameterTypeRequiredCustomModifiers.Length != parameterTypes.Length)
- throw new ArgumentException(Environment.GetResourceString("Argument_MismatchedArrays", nameof(parameterTypeRequiredCustomModifiers), nameof(parameterTypes)));
+ throw new ArgumentException(SR.Format(SR.Argument_MismatchedArrays, nameof(parameterTypeRequiredCustomModifiers), nameof(parameterTypes)));
}
ThrowIfCreated();
@@ -1454,7 +1454,7 @@ namespace System.Reflection.Emit
{
if (((m_iAttr & TypeAttributes.ClassSemanticsMask) == TypeAttributes.Interface) &&
(attributes & MethodAttributes.Abstract) == 0 && (attributes & MethodAttributes.Static) == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_BadAttributeOnInterfaceMethod"));
+ throw new ArgumentException(SR.Argument_BadAttributeOnInterfaceMethod);
}
// pass in Method attributes
@@ -1506,7 +1506,7 @@ namespace System.Reflection.Emit
{
if ((m_iAttr & TypeAttributes.Interface) == TypeAttributes.Interface)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ConstructorNotAllowedOnInterface"));
+ throw new InvalidOperationException(SR.InvalidOperation_ConstructorNotAllowedOnInterface);
}
lock (SyncRoot)
@@ -1535,7 +1535,7 @@ namespace System.Reflection.Emit
genericTypeDefinition = ((TypeBuilder)genericTypeDefinition).m_bakedRuntimeType;
if (genericTypeDefinition == null)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
+ throw new NotSupportedException(SR.NotSupported_DynamicModule);
Type inst = genericTypeDefinition.MakeGenericType(m_typeParent.GetGenericArguments());
@@ -1553,7 +1553,7 @@ namespace System.Reflection.Emit
}
if (con == null)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NoParentDefaultConstructor"));
+ throw new NotSupportedException(SR.NotSupported_NoParentDefaultConstructor);
// Define the constructor Builder
constBuilder = DefineConstructor(attributes, CallingConventions.Standard, null);
@@ -1579,7 +1579,7 @@ namespace System.Reflection.Emit
{
if ((m_iAttr & TypeAttributes.Interface) == TypeAttributes.Interface && (attributes & MethodAttributes.Static) != MethodAttributes.Static)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ConstructorNotAllowedOnInterface"));
+ throw new InvalidOperationException(SR.InvalidOperation_ConstructorNotAllowedOnInterface);
}
lock (SyncRoot)
@@ -1802,7 +1802,7 @@ namespace System.Reflection.Emit
if (name == null)
throw new ArgumentNullException(nameof(name));
if (name.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(name));
+ throw new ArgumentException(SR.Argument_EmptyName, nameof(name));
Contract.EndContractBlock();
CheckContext(returnType);
@@ -1857,9 +1857,9 @@ namespace System.Reflection.Emit
if (name == null)
throw new ArgumentNullException(nameof(name));
if (name.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(name));
+ throw new ArgumentException(SR.Argument_EmptyName, nameof(name));
if (name[0] == '\0')
- throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), nameof(name));
+ throw new ArgumentException(SR.Argument_IllegalName, nameof(name));
Contract.EndContractBlock();
int tkType;
@@ -2023,7 +2023,7 @@ namespace System.Reflection.Emit
// Check that they haven't declared an abstract method on a non-abstract class
if (((methodAttrs & MethodAttributes.Abstract) != 0) && ((m_iAttr & TypeAttributes.Abstract) == 0))
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadTypeAttributesNotAbstract"));
+ throw new InvalidOperationException(SR.InvalidOperation_BadTypeAttributesNotAbstract);
}
body = meth.GetBody();
@@ -2038,7 +2038,7 @@ namespace System.Reflection.Emit
//((m_iAttr & TypeAttributes.ClassSemanticsMask) == TypeAttributes.Interface))
if (body != null)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadMethodBody"));
+ throw new InvalidOperationException(SR.InvalidOperation_BadMethodBody);
}
else if (body == null || body.Length == 0)
{
@@ -2053,7 +2053,7 @@ namespace System.Reflection.Emit
if ((body == null || body.Length == 0) && !meth.m_canBeRuntimeImpl)
throw new InvalidOperationException(
- Environment.GetResourceString("InvalidOperation_BadEmptyMethodBody", meth.Name));
+ SR.Format(SR.InvalidOperation_BadEmptyMethodBody, meth.Name));
}
int maxStack = meth.GetMaxStack();
@@ -2121,7 +2121,7 @@ namespace System.Reflection.Emit
CheckContext(parent);
if (parent.IsInterface)
- throw new ArgumentException(Environment.GetResourceString("Argument_CannotSetParentToInterface"));
+ throw new ArgumentException(SR.Argument_CannotSetParentToInterface);
m_typeParent = parent;
}
@@ -2134,7 +2134,7 @@ namespace System.Reflection.Emit
else
{
if ((m_iAttr & TypeAttributes.Abstract) == 0)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadInterfaceNotAbstract"));
+ throw new InvalidOperationException(SR.InvalidOperation_BadInterfaceNotAbstract);
// there is no extends for interface class
m_typeParent = null;
diff --git a/src/mscorlib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs b/src/mscorlib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs
index 06d8384c10..6d46362f91 100644
--- a/src/mscorlib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs
@@ -221,7 +221,7 @@ namespace System.Reflection.Emit
}
public override MethodBase DeclaringMethod { get { return null; } }
public override Type GetGenericTypeDefinition() { return m_type; }
- public override Type MakeGenericType(params Type[] inst) { throw new InvalidOperationException(Environment.GetResourceString("Arg_NotGenericTypeDefinition")); }
+ public override Type MakeGenericType(params Type[] inst) { throw new InvalidOperationException(SR.Arg_NotGenericTypeDefinition); }
public override bool IsAssignableFrom(Type c) { throw new NotSupportedException(); }
[Pure]
diff --git a/src/mscorlib/src/System/Reflection/Emit/XXXOnTypeBuilderInstantiation.cs b/src/mscorlib/src/System/Reflection/Emit/XXXOnTypeBuilderInstantiation.cs
index 6c9bc81323..78238c02b7 100644
--- a/src/mscorlib/src/System/Reflection/Emit/XXXOnTypeBuilderInstantiation.cs
+++ b/src/mscorlib/src/System/Reflection/Emit/XXXOnTypeBuilderInstantiation.cs
@@ -72,7 +72,7 @@ namespace System.Reflection.Emit
public override MethodInfo MakeGenericMethod(params Type[] typeArgs)
{
if (!IsGenericMethodDefinition)
- throw new InvalidOperationException(Environment.GetResourceString("Arg_NotGenericMethodDefinition"));
+ throw new InvalidOperationException(SR.Arg_NotGenericMethodDefinition);
Contract.EndContractBlock();
return MethodBuilderInstantiation.MakeGenericMethod(this, typeArgs);
diff --git a/src/mscorlib/src/System/Reflection/ExceptionHandlingClause.cs b/src/mscorlib/src/System/Reflection/ExceptionHandlingClause.cs
new file mode 100644
index 0000000000..9bb45aebb2
--- /dev/null
+++ b/src/mscorlib/src/System/Reflection/ExceptionHandlingClause.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Globalization;
+using System.Diagnostics.Contracts;
+
+namespace System.Reflection
+{
+ public class ExceptionHandlingClause
+ {
+ #region costructor
+ // This class can only be created from inside the EE.
+ protected ExceptionHandlingClause() { }
+ #endregion
+
+ #region Private Data Members
+ private MethodBody m_methodBody;
+ [ContractPublicPropertyName("Flags")]
+ private ExceptionHandlingClauseOptions m_flags;
+ private int m_tryOffset;
+ private int m_tryLength;
+ private int m_handlerOffset;
+ private int m_handlerLength;
+ private int m_catchMetadataToken;
+ private int m_filterOffset;
+ #endregion
+
+ #region Public Members
+ public virtual ExceptionHandlingClauseOptions Flags { get { return m_flags; } }
+ public virtual int TryOffset { get { return m_tryOffset; } }
+ public virtual int TryLength { get { return m_tryLength; } }
+ public virtual int HandlerOffset { get { return m_handlerOffset; } }
+ public virtual int HandlerLength { get { return m_handlerLength; } }
+
+ public virtual int FilterOffset
+ {
+ get
+ {
+ if (m_flags != ExceptionHandlingClauseOptions.Filter)
+ throw new InvalidOperationException(SR.Arg_EHClauseNotFilter);
+
+ return m_filterOffset;
+ }
+ }
+
+ public virtual Type CatchType
+ {
+ get
+ {
+ if (m_flags != ExceptionHandlingClauseOptions.Clause)
+ throw new InvalidOperationException(SR.Arg_EHClauseNotClause);
+
+ Type type = null;
+
+ if (!MetadataToken.IsNullToken(m_catchMetadataToken))
+ {
+ Type declaringType = m_methodBody.m_methodBase.DeclaringType;
+ Module module = (declaringType == null) ? m_methodBody.m_methodBase.Module : declaringType.Module;
+ type = module.ResolveType(m_catchMetadataToken, (declaringType == null) ? null : declaringType.GetGenericArguments(),
+ m_methodBody.m_methodBase is MethodInfo ? m_methodBody.m_methodBase.GetGenericArguments() : null);
+ }
+
+ return type;
+ }
+ }
+ #endregion
+
+ #region Object Overrides
+ public override string ToString()
+ {
+ if (Flags == ExceptionHandlingClauseOptions.Clause)
+ {
+ return String.Format(CultureInfo.CurrentUICulture,
+ "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}, CatchType={5}",
+ Flags, TryOffset, TryLength, HandlerOffset, HandlerLength, CatchType);
+ }
+
+ if (Flags == ExceptionHandlingClauseOptions.Filter)
+ {
+ return String.Format(CultureInfo.CurrentUICulture,
+ "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}, FilterOffset={5}",
+ Flags, TryOffset, TryLength, HandlerOffset, HandlerLength, FilterOffset);
+ }
+
+ return String.Format(CultureInfo.CurrentUICulture,
+ "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}",
+ Flags, TryOffset, TryLength, HandlerOffset, HandlerLength);
+ }
+ #endregion
+ }
+}
+
diff --git a/src/mscorlib/src/System/Reflection/FieldInfo.CoreCLR.cs b/src/mscorlib/src/System/Reflection/FieldInfo.CoreCLR.cs
new file mode 100644
index 0000000000..bcda3418fa
--- /dev/null
+++ b/src/mscorlib/src/System/Reflection/FieldInfo.CoreCLR.cs
@@ -0,0 +1,35 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Globalization;
+
+namespace System.Reflection
+{
+ public abstract partial class FieldInfo : MemberInfo
+ {
+ public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle)
+ {
+ if (handle.IsNullHandle())
+ throw new ArgumentException(SR.Argument_InvalidHandle, nameof(handle));
+
+ FieldInfo f = RuntimeType.GetFieldInfo(handle.GetRuntimeFieldInfo());
+
+ Type declaringType = f.DeclaringType;
+ if (declaringType != null && declaringType.IsGenericType)
+ throw new ArgumentException(String.Format(
+ CultureInfo.CurrentCulture, SR.Argument_FieldDeclaringTypeGeneric,
+ f.Name, declaringType.GetGenericTypeDefinition()));
+
+ return f;
+ }
+
+ public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle, RuntimeTypeHandle declaringType)
+ {
+ if (handle.IsNullHandle())
+ throw new ArgumentException(SR.Argument_InvalidHandle);
+
+ return RuntimeType.GetFieldInfo(declaringType.GetRuntimeType(), handle.GetRuntimeFieldInfo());
+ }
+ }
+}
diff --git a/src/mscorlib/src/System/Reflection/FieldInfo.cs b/src/mscorlib/src/System/Reflection/FieldInfo.cs
deleted file mode 100644
index 511fef5202..0000000000
--- a/src/mscorlib/src/System/Reflection/FieldInfo.cs
+++ /dev/null
@@ -1,815 +0,0 @@
-// 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 System.Reflection
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Diagnostics.Contracts;
- using System.Globalization;
- using System.Runtime;
- using System.Runtime.CompilerServices;
- using System.Runtime.ConstrainedExecution;
- using System.Runtime.InteropServices;
- using System.Runtime.Serialization;
- using System.Threading;
- using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache;
-
- [Serializable]
- public abstract class FieldInfo : MemberInfo
- {
- #region Static Members
- public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle)
- {
- if (handle.IsNullHandle())
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle"), nameof(handle));
-
- FieldInfo f = RuntimeType.GetFieldInfo(handle.GetRuntimeFieldInfo());
-
- Type declaringType = f.DeclaringType;
- if (declaringType != null && declaringType.IsGenericType)
- throw new ArgumentException(String.Format(
- CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_FieldDeclaringTypeGeneric"),
- f.Name, declaringType.GetGenericTypeDefinition()));
-
- return f;
- }
-
- public static FieldInfo GetFieldFromHandle(RuntimeFieldHandle handle, RuntimeTypeHandle declaringType)
- {
- if (handle.IsNullHandle())
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle"));
-
- return RuntimeType.GetFieldInfo(declaringType.GetRuntimeType(), handle.GetRuntimeFieldInfo());
- }
- #endregion
-
- #region Constructor
- protected FieldInfo() { }
- #endregion
-
- public static bool operator ==(FieldInfo left, FieldInfo right)
- {
- if (ReferenceEquals(left, right))
- return true;
-
- if ((object)left == null || (object)right == null ||
- left is RuntimeFieldInfo || right is RuntimeFieldInfo)
- {
- return false;
- }
- return left.Equals(right);
- }
-
- public static bool operator !=(FieldInfo left, FieldInfo right)
- {
- return !(left == right);
- }
-
- public override bool Equals(object obj)
- {
- return base.Equals(obj);
- }
-
- public override int GetHashCode()
- {
- return base.GetHashCode();
- }
-
- #region MemberInfo Overrides
- public override MemberTypes MemberType { get { return System.Reflection.MemberTypes.Field; } }
- #endregion
-
- #region Public Abstract\Virtual Members
-
- public virtual Type[] GetRequiredCustomModifiers()
- {
- throw new NotImplementedException();
- }
-
- public virtual Type[] GetOptionalCustomModifiers()
- {
- throw new NotImplementedException();
- }
-
- [CLSCompliant(false)]
- public virtual void SetValueDirect(TypedReference obj, Object value)
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_AbstractNonCLS"));
- }
-
- [CLSCompliant(false)]
- public virtual Object GetValueDirect(TypedReference obj)
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_AbstractNonCLS"));
- }
-
- public abstract RuntimeFieldHandle FieldHandle { get; }
-
- public abstract Type FieldType { get; }
-
- public abstract Object GetValue(Object obj);
-
- public virtual Object GetRawConstantValue() { throw new NotSupportedException(Environment.GetResourceString("NotSupported_AbstractNonCLS")); }
-
- public abstract void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture);
-
- public abstract FieldAttributes Attributes { get; }
- #endregion
-
- #region Public Members
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- public void SetValue(Object obj, Object value)
- {
- // Theoretically we should set up a LookForMyCaller stack mark here and pass that along.
- // But to maintain backward compatibility we can't switch to calling an
- // internal overload that takes a stack mark.
- // Fortunately the stack walker skips all the reflection invocation frames including this one.
- // So this method will never be returned by the stack walker as the caller.
- // See SystemDomain::CallersMethodCallbackWithStackMark in AppDomain.cpp.
- SetValue(obj, value, BindingFlags.Default, Type.DefaultBinder, null);
- }
-
- public bool IsPublic { get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Public; } }
-
- public bool IsPrivate { get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Private; } }
-
- public bool IsFamily { get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Family; } }
-
- public bool IsAssembly { get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.Assembly; } }
-
- public bool IsFamilyAndAssembly { get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.FamANDAssem; } }
-
- public bool IsFamilyOrAssembly { get { return (Attributes & FieldAttributes.FieldAccessMask) == FieldAttributes.FamORAssem; } }
-
- public bool IsStatic { get { return (Attributes & FieldAttributes.Static) != 0; } }
-
- public bool IsInitOnly { get { return (Attributes & FieldAttributes.InitOnly) != 0; } }
-
- public bool IsLiteral { get { return (Attributes & FieldAttributes.Literal) != 0; } }
-
- public bool IsNotSerialized { get { return (Attributes & FieldAttributes.NotSerialized) != 0; } }
-
- public bool IsSpecialName { get { return (Attributes & FieldAttributes.SpecialName) != 0; } }
-
- public bool IsPinvokeImpl { get { return (Attributes & FieldAttributes.PinvokeImpl) != 0; } }
-
- public virtual bool IsSecurityCritical
- {
- get { return FieldHandle.IsSecurityCritical(); }
- }
-
- public virtual bool IsSecuritySafeCritical
- {
- get { return FieldHandle.IsSecuritySafeCritical(); }
- }
-
- public virtual bool IsSecurityTransparent
- {
- get { return FieldHandle.IsSecurityTransparent(); }
- }
-
- #endregion
- }
-
- [Serializable]
- internal abstract class RuntimeFieldInfo : FieldInfo, ISerializable
- {
- #region Private Data Members
- private BindingFlags m_bindingFlags;
- protected RuntimeTypeCache m_reflectedTypeCache;
- protected RuntimeType m_declaringType;
- #endregion
-
- #region Constructor
- protected RuntimeFieldInfo()
- {
- // Used for dummy head node during population
- }
- protected RuntimeFieldInfo(RuntimeTypeCache reflectedTypeCache, RuntimeType declaringType, BindingFlags bindingFlags)
- {
- m_bindingFlags = bindingFlags;
- m_declaringType = declaringType;
- m_reflectedTypeCache = reflectedTypeCache;
- }
- #endregion
-
- #region NonPublic Members
- internal BindingFlags BindingFlags { get { return m_bindingFlags; } }
- private RuntimeType ReflectedTypeInternal
- {
- get
- {
- return m_reflectedTypeCache.GetRuntimeType();
- }
- }
-
- internal RuntimeType GetDeclaringTypeInternal()
- {
- return m_declaringType;
- }
-
- internal RuntimeType GetRuntimeType() { return m_declaringType; }
- internal abstract RuntimeModule GetRuntimeModule();
- #endregion
-
- #region MemberInfo Overrides
- public override MemberTypes MemberType { get { return MemberTypes.Field; } }
- public override Type ReflectedType
- {
- get
- {
- return m_reflectedTypeCache.IsGlobal ? null : ReflectedTypeInternal;
- }
- }
-
- public override Type DeclaringType
- {
- get
- {
- return m_reflectedTypeCache.IsGlobal ? null : m_declaringType;
- }
- }
-
- public override Module Module { get { return GetRuntimeModule(); } }
- #endregion
-
- #region Object Overrides
- public unsafe override String ToString()
- {
- return FieldType.FormatTypeName() + " " + Name;
- }
- #endregion
-
- #region ICustomAttributeProvider
- public override Object[] GetCustomAttributes(bool inherit)
- {
- return CustomAttribute.GetCustomAttributes(this, typeof(object) as RuntimeType);
- }
-
- public override Object[] GetCustomAttributes(Type attributeType, bool inherit)
- {
- if (attributeType == null)
- throw new ArgumentNullException(nameof(attributeType));
- Contract.EndContractBlock();
-
- RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
-
- if (attributeRuntimeType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(attributeType));
-
- return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
- }
-
- public override bool IsDefined(Type attributeType, bool inherit)
- {
- if (attributeType == null)
- throw new ArgumentNullException(nameof(attributeType));
- Contract.EndContractBlock();
-
- RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
-
- if (attributeRuntimeType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(attributeType));
-
- return CustomAttribute.IsDefined(this, attributeRuntimeType);
- }
-
- public override IList<CustomAttributeData> GetCustomAttributesData()
- {
- return CustomAttributeData.GetCustomAttributesInternal(this);
- }
- #endregion
-
- #region FieldInfo Overrides
- // All implemented on derived classes
- #endregion
-
- #region ISerializable Implementation
- public void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- if (info == null)
- throw new ArgumentNullException(nameof(info));
- Contract.EndContractBlock();
- MemberInfoSerializationHolder.GetSerializationInfo(
- info,
- Name,
- ReflectedTypeInternal,
- ToString(),
- MemberTypes.Field);
- }
- #endregion
- }
-
- [Serializable]
- internal unsafe sealed class RtFieldInfo : RuntimeFieldInfo, IRuntimeFieldInfo
- {
- #region FCalls
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- static private extern void PerformVisibilityCheckOnField(IntPtr field, Object target, RuntimeType declaringType, FieldAttributes attr, uint invocationFlags);
- #endregion
-
- #region Private Data Members
- // agressive caching
- private IntPtr m_fieldHandle;
- private FieldAttributes m_fieldAttributes;
- // lazy caching
- private string m_name;
- private RuntimeType m_fieldType;
- private INVOCATION_FLAGS m_invocationFlags;
-
- internal INVOCATION_FLAGS InvocationFlags
- {
- get
- {
- if ((m_invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_INITIALIZED) == 0)
- {
- Type declaringType = DeclaringType;
- bool fIsReflectionOnlyType = (declaringType is ReflectionOnlyType);
-
- INVOCATION_FLAGS invocationFlags = 0;
-
- // first take care of all the NO_INVOKE cases
- if (
- (declaringType != null && declaringType.ContainsGenericParameters) ||
- (declaringType == null && Module.Assembly.ReflectionOnly) ||
- (fIsReflectionOnlyType)
- )
- {
- invocationFlags |= INVOCATION_FLAGS.INVOCATION_FLAGS_NO_INVOKE;
- }
-
- // If the invocationFlags are still 0, then
- // this should be an usable field, determine the other flags
- if (invocationFlags == 0)
- {
- if ((m_fieldAttributes & FieldAttributes.InitOnly) != (FieldAttributes)0)
- invocationFlags |= INVOCATION_FLAGS.INVOCATION_FLAGS_SPECIAL_FIELD;
-
- if ((m_fieldAttributes & FieldAttributes.HasFieldRVA) != (FieldAttributes)0)
- invocationFlags |= INVOCATION_FLAGS.INVOCATION_FLAGS_SPECIAL_FIELD;
-
- // A public field is inaccesible to Transparent code if the field is Critical.
- bool needsTransparencySecurityCheck = IsSecurityCritical && !IsSecuritySafeCritical;
- bool needsVisibilitySecurityCheck = ((m_fieldAttributes & FieldAttributes.FieldAccessMask) != FieldAttributes.Public) ||
- (declaringType != null && declaringType.NeedsReflectionSecurityCheck);
- if (needsTransparencySecurityCheck || needsVisibilitySecurityCheck)
- invocationFlags |= INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY;
-
- // find out if the field type is one of the following: Primitive, Enum or Pointer
- Type fieldType = FieldType;
- if (fieldType.IsPointer || fieldType.IsEnum || fieldType.IsPrimitive)
- invocationFlags |= INVOCATION_FLAGS.INVOCATION_FLAGS_FIELD_SPECIAL_CAST;
- }
-
- // must be last to avoid threading problems
- m_invocationFlags = invocationFlags | INVOCATION_FLAGS.INVOCATION_FLAGS_INITIALIZED;
- }
-
- return m_invocationFlags;
- }
- }
- #endregion
-
- private RuntimeAssembly GetRuntimeAssembly() { return m_declaringType.GetRuntimeAssembly(); }
-
- #region Constructor
- internal RtFieldInfo(
- RuntimeFieldHandleInternal handle, RuntimeType declaringType, RuntimeTypeCache reflectedTypeCache, BindingFlags bindingFlags)
- : base(reflectedTypeCache, declaringType, bindingFlags)
- {
- m_fieldHandle = handle.Value;
- m_fieldAttributes = RuntimeFieldHandle.GetAttributes(handle);
- }
- #endregion
-
- #region Private Members
- RuntimeFieldHandleInternal IRuntimeFieldInfo.Value
- {
- get
- {
- return new RuntimeFieldHandleInternal(m_fieldHandle);
- }
- }
-
- #endregion
-
- #region Internal Members
- internal void CheckConsistency(Object target)
- {
- // only test instance fields
- if ((m_fieldAttributes & FieldAttributes.Static) != FieldAttributes.Static)
- {
- if (!m_declaringType.IsInstanceOfType(target))
- {
- if (target == null)
- {
- throw new TargetException(Environment.GetResourceString("RFLCT.Targ_StatFldReqTarg"));
- }
- else
- {
- throw new ArgumentException(
- String.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString("Arg_FieldDeclTarget"),
- Name, m_declaringType, target.GetType()));
- }
- }
- }
- }
-
- internal override bool CacheEquals(object o)
- {
- RtFieldInfo m = o as RtFieldInfo;
-
- if ((object)m == null)
- return false;
-
- return m.m_fieldHandle == m_fieldHandle;
- }
-
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- internal void InternalSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, ref StackCrawlMark stackMark)
- {
- INVOCATION_FLAGS invocationFlags = InvocationFlags;
- RuntimeType declaringType = DeclaringType as RuntimeType;
-
- if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NO_INVOKE) != 0)
- {
- if (declaringType != null && declaringType.ContainsGenericParameters)
- throw new InvalidOperationException(Environment.GetResourceString("Arg_UnboundGenField"));
-
- if ((declaringType == null && Module.Assembly.ReflectionOnly) || declaringType is ReflectionOnlyType)
- throw new InvalidOperationException(Environment.GetResourceString("Arg_ReflectionOnlyField"));
-
- throw new FieldAccessException();
- }
-
- CheckConsistency(obj);
-
- RuntimeType fieldType = (RuntimeType)FieldType;
- value = fieldType.CheckValue(value, binder, culture, invokeAttr);
-
- #region Security Check
- if ((invocationFlags & (INVOCATION_FLAGS.INVOCATION_FLAGS_SPECIAL_FIELD | INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY)) != 0)
- PerformVisibilityCheckOnField(m_fieldHandle, obj, m_declaringType, m_fieldAttributes, (uint)m_invocationFlags);
- #endregion
-
- bool domainInitialized = false;
- if (declaringType == null)
- {
- RuntimeFieldHandle.SetValue(this, obj, value, fieldType, m_fieldAttributes, null, ref domainInitialized);
- }
- else
- {
- domainInitialized = declaringType.DomainInitialized;
- RuntimeFieldHandle.SetValue(this, obj, value, fieldType, m_fieldAttributes, declaringType, ref domainInitialized);
- declaringType.DomainInitialized = domainInitialized;
- }
- }
-
- // UnsafeSetValue doesn't perform any consistency or visibility check.
- // It is the caller's responsibility to ensure the operation is safe.
- // When the caller needs to perform visibility checks they should call
- // InternalSetValue() instead. When the caller needs to perform
- // consistency checks they should call CheckConsistency() before
- // calling this method.
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- internal void UnsafeSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture)
- {
- RuntimeType declaringType = DeclaringType as RuntimeType;
- RuntimeType fieldType = (RuntimeType)FieldType;
- value = fieldType.CheckValue(value, binder, culture, invokeAttr);
-
- bool domainInitialized = false;
- if (declaringType == null)
- {
- RuntimeFieldHandle.SetValue(this, obj, value, fieldType, m_fieldAttributes, null, ref domainInitialized);
- }
- else
- {
- domainInitialized = declaringType.DomainInitialized;
- RuntimeFieldHandle.SetValue(this, obj, value, fieldType, m_fieldAttributes, declaringType, ref domainInitialized);
- declaringType.DomainInitialized = domainInitialized;
- }
- }
-
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- internal Object InternalGetValue(Object obj, ref StackCrawlMark stackMark)
- {
- INVOCATION_FLAGS invocationFlags = InvocationFlags;
- RuntimeType declaringType = DeclaringType as RuntimeType;
-
- if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NO_INVOKE) != 0)
- {
- if (declaringType != null && DeclaringType.ContainsGenericParameters)
- throw new InvalidOperationException(Environment.GetResourceString("Arg_UnboundGenField"));
-
- if ((declaringType == null && Module.Assembly.ReflectionOnly) || declaringType is ReflectionOnlyType)
- throw new InvalidOperationException(Environment.GetResourceString("Arg_ReflectionOnlyField"));
-
- throw new FieldAccessException();
- }
-
- CheckConsistency(obj);
-
- RuntimeType fieldType = (RuntimeType)FieldType;
- if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY) != 0)
- PerformVisibilityCheckOnField(m_fieldHandle, obj, m_declaringType, m_fieldAttributes, (uint)(m_invocationFlags & ~INVOCATION_FLAGS.INVOCATION_FLAGS_SPECIAL_FIELD));
-
- return UnsafeGetValue(obj);
- }
-
- // UnsafeGetValue doesn't perform any consistency or visibility check.
- // It is the caller's responsibility to ensure the operation is safe.
- // When the caller needs to perform visibility checks they should call
- // InternalGetValue() instead. When the caller needs to perform
- // consistency checks they should call CheckConsistency() before
- // calling this method.
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- internal Object UnsafeGetValue(Object obj)
- {
- RuntimeType declaringType = DeclaringType as RuntimeType;
-
- RuntimeType fieldType = (RuntimeType)FieldType;
-
- bool domainInitialized = false;
- if (declaringType == null)
- {
- return RuntimeFieldHandle.GetValue(this, obj, fieldType, null, ref domainInitialized);
- }
- else
- {
- domainInitialized = declaringType.DomainInitialized;
- object retVal = RuntimeFieldHandle.GetValue(this, obj, fieldType, declaringType, ref domainInitialized);
- declaringType.DomainInitialized = domainInitialized;
- return retVal;
- }
- }
-
- #endregion
-
- #region MemberInfo Overrides
- public override String Name
- {
- get
- {
- if (m_name == null)
- m_name = RuntimeFieldHandle.GetName(this);
-
- return m_name;
- }
- }
-
- internal String FullName
- {
- get
- {
- return String.Format("{0}.{1}", DeclaringType.FullName, Name);
- }
- }
-
- public override int MetadataToken
- {
- get { return RuntimeFieldHandle.GetToken(this); }
- }
-
- internal override RuntimeModule GetRuntimeModule()
- {
- return RuntimeTypeHandle.GetModule(RuntimeFieldHandle.GetApproxDeclaringType(this));
- }
-
- #endregion
-
- #region FieldInfo Overrides
- public override Object GetValue(Object obj)
- {
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- return InternalGetValue(obj, ref stackMark);
- }
-
- public override object GetRawConstantValue() { throw new InvalidOperationException(); }
-
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- public override Object GetValueDirect(TypedReference obj)
- {
- if (obj.IsNull)
- throw new ArgumentException(Environment.GetResourceString("Arg_TypedReference_Null"));
- Contract.EndContractBlock();
-
- unsafe
- {
- // Passing TypedReference by reference is easier to make correct in native code
- return RuntimeFieldHandle.GetValueDirect(this, (RuntimeType)FieldType, &obj, (RuntimeType)DeclaringType);
- }
- }
-
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- public override void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture)
- {
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- InternalSetValue(obj, value, invokeAttr, binder, culture, ref stackMark);
- }
-
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- public override void SetValueDirect(TypedReference obj, Object value)
- {
- if (obj.IsNull)
- throw new ArgumentException(Environment.GetResourceString("Arg_TypedReference_Null"));
- Contract.EndContractBlock();
-
- unsafe
- {
- // Passing TypedReference by reference is easier to make correct in native code
- RuntimeFieldHandle.SetValueDirect(this, (RuntimeType)FieldType, &obj, value, (RuntimeType)DeclaringType);
- }
- }
-
- public override RuntimeFieldHandle FieldHandle
- {
- get
- {
- Type declaringType = DeclaringType;
- if ((declaringType == null && Module.Assembly.ReflectionOnly) || declaringType is ReflectionOnlyType)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotAllowedInReflectionOnly"));
- return new RuntimeFieldHandle(this);
- }
- }
-
- internal IntPtr GetFieldHandle()
- {
- return m_fieldHandle;
- }
-
- public override FieldAttributes Attributes
- {
- get
- {
- return m_fieldAttributes;
- }
- }
-
- public override Type FieldType
- {
- get
- {
- if (m_fieldType == null)
- m_fieldType = new Signature(this, m_declaringType).FieldType;
-
- return m_fieldType;
- }
- }
-
- public override Type[] GetRequiredCustomModifiers()
- {
- return new Signature(this, m_declaringType).GetCustomModifiers(1, true);
- }
-
- public override Type[] GetOptionalCustomModifiers()
- {
- return new Signature(this, m_declaringType).GetCustomModifiers(1, false);
- }
-
- #endregion
- }
-
- [Serializable]
- internal sealed unsafe class MdFieldInfo : RuntimeFieldInfo, ISerializable
- {
- #region Private Data Members
- private int m_tkField;
- private string m_name;
- private RuntimeType m_fieldType;
- private FieldAttributes m_fieldAttributes;
- #endregion
-
- #region Constructor
- internal MdFieldInfo(
- int tkField, FieldAttributes fieldAttributes, RuntimeTypeHandle declaringTypeHandle, RuntimeTypeCache reflectedTypeCache, BindingFlags bindingFlags)
- : base(reflectedTypeCache, declaringTypeHandle.GetRuntimeType(), bindingFlags)
- {
- m_tkField = tkField;
- m_name = null;
- m_fieldAttributes = fieldAttributes;
- }
- #endregion
-
- #region Internal Members
- internal override bool CacheEquals(object o)
- {
- MdFieldInfo m = o as MdFieldInfo;
-
- if ((object)m == null)
- return false;
-
- return m.m_tkField == m_tkField &&
- m_declaringType.GetTypeHandleInternal().GetModuleHandle().Equals(
- m.m_declaringType.GetTypeHandleInternal().GetModuleHandle());
- }
- #endregion
-
- #region MemberInfo Overrides
- public override String Name
- {
- get
- {
- if (m_name == null)
- m_name = GetRuntimeModule().MetadataImport.GetName(m_tkField).ToString();
-
- return m_name;
- }
- }
-
- public override int MetadataToken { get { return m_tkField; } }
- internal override RuntimeModule GetRuntimeModule() { return m_declaringType.GetRuntimeModule(); }
- #endregion
-
- #region FieldInfo Overrides
- public override RuntimeFieldHandle FieldHandle { get { throw new NotSupportedException(); } }
- public override FieldAttributes Attributes { get { return m_fieldAttributes; } }
-
- public override bool IsSecurityCritical { get { return DeclaringType.IsSecurityCritical; } }
- public override bool IsSecuritySafeCritical { get { return DeclaringType.IsSecuritySafeCritical; } }
- public override bool IsSecurityTransparent { get { return DeclaringType.IsSecurityTransparent; } }
-
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- public override Object GetValueDirect(TypedReference obj)
- {
- return GetValue(null);
- }
-
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- public override void SetValueDirect(TypedReference obj, Object value)
- {
- throw new FieldAccessException(Environment.GetResourceString("Acc_ReadOnly"));
- }
-
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- public unsafe override Object GetValue(Object obj)
- {
- return GetValue(false);
- }
-
- public unsafe override Object GetRawConstantValue() { return GetValue(true); }
-
- private unsafe Object GetValue(bool raw)
- {
- // Cannot cache these because they could be user defined non-agile enumerations
-
- Object value = MdConstant.GetValue(GetRuntimeModule().MetadataImport, m_tkField, FieldType.GetTypeHandleInternal(), raw);
-
- if (value == DBNull.Value)
- throw new NotSupportedException(Environment.GetResourceString("Arg_EnumLitValueNotFound"));
-
- return value;
- }
-
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- public override void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture)
- {
- throw new FieldAccessException(Environment.GetResourceString("Acc_ReadOnly"));
- }
-
- public override Type FieldType
- {
- get
- {
- if (m_fieldType == null)
- {
- ConstArray fieldMarshal = GetRuntimeModule().MetadataImport.GetSigOfFieldDef(m_tkField);
-
- m_fieldType = new Signature(fieldMarshal.Signature.ToPointer(),
- (int)fieldMarshal.Length, m_declaringType).FieldType;
- }
-
- return m_fieldType;
- }
- }
-
- public override Type[] GetRequiredCustomModifiers()
- {
- return EmptyArray<Type>.Value;
- }
-
- public override Type[] GetOptionalCustomModifiers()
- {
- return EmptyArray<Type>.Value;
- }
-
- #endregion
- }
-}
diff --git a/src/mscorlib/src/System/Reflection/ICustomAttributeProvider.cs b/src/mscorlib/src/System/Reflection/ICustomAttributeProvider.cs
deleted file mode 100644
index 1e3f675126..0000000000
--- a/src/mscorlib/src/System/Reflection/ICustomAttributeProvider.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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.
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// ICustomAttributeProvider is an interface that is implemented by reflection
-//
-// objects which support custom attributes.
-//
-//
-
-using System;
-
-namespace System.Reflection
-{
- // Interface does not need to be marked with the serializable attribute
- public interface ICustomAttributeProvider
- {
- // Return an array of custom attributes identified by Type
- Object[] GetCustomAttributes(Type attributeType, bool inherit);
-
-
- // Return an array of all of the custom attributes (named attributes are not included)
- Object[] GetCustomAttributes(bool inherit);
-
-
- // Returns true if one or more instance of attributeType is defined on this member.
- bool IsDefined(Type attributeType, bool inherit);
- }
-}
diff --git a/src/mscorlib/src/System/Reflection/INVOCATION_FLAGS.cs b/src/mscorlib/src/System/Reflection/INVOCATION_FLAGS.cs
new file mode 100644
index 0000000000..6ffc3e968b
--- /dev/null
+++ b/src/mscorlib/src/System/Reflection/INVOCATION_FLAGS.cs
@@ -0,0 +1,38 @@
+// 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 System.Reflection
+{
+ //
+ // Invocation cached flags. Those are used in unmanaged code as well
+ // so be careful if you change them
+ //
+ [Flags]
+ internal enum INVOCATION_FLAGS : uint
+ {
+ INVOCATION_FLAGS_UNKNOWN = 0x00000000,
+ INVOCATION_FLAGS_INITIALIZED = 0x00000001,
+ // it's used for both method and field to signify that no access is allowed
+ INVOCATION_FLAGS_NO_INVOKE = 0x00000002,
+ INVOCATION_FLAGS_NEED_SECURITY = 0x00000004,
+ // Set for static ctors and ctors on abstract types, which
+ // can be invoked only if the "this" object is provided (even if it's null).
+ INVOCATION_FLAGS_NO_CTOR_INVOKE = 0x00000008,
+ // because field and method are different we can reuse the same bits
+ // method
+ INVOCATION_FLAGS_IS_CTOR = 0x00000010,
+ INVOCATION_FLAGS_RISKY_METHOD = 0x00000020,
+ /* unused 0x00000040 */
+ INVOCATION_FLAGS_IS_DELEGATE_CTOR = 0x00000080,
+ INVOCATION_FLAGS_CONTAINS_STACK_POINTERS = 0x00000100,
+ // field
+ INVOCATION_FLAGS_SPECIAL_FIELD = 0x00000010,
+ INVOCATION_FLAGS_FIELD_SPECIAL_CAST = 0x00000020,
+
+ // temporary flag used for flagging invocation of method vs ctor
+ // this flag never appears on the instance m_invocationFlag and is simply
+ // passed down from within ConstructorInfo.Invoke()
+ INVOCATION_FLAGS_CONSTRUCTOR_INVOKE = 0x10000000,
+ }
+}
diff --git a/src/mscorlib/src/System/Reflection/InterfaceMapping.cs b/src/mscorlib/src/System/Reflection/InterfaceMapping.cs
deleted file mode 100644
index a1fdbde8f6..0000000000
--- a/src/mscorlib/src/System/Reflection/InterfaceMapping.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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.
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-// Interface Map. This struct returns the mapping of an interface into the actual methods on a class
-// that implement that interface.
-//
-//
-
-using System;
-
-namespace System.Reflection
-{
- public struct InterfaceMapping
- {
- public Type TargetType; // The type implementing the interface
- public Type InterfaceType; // The type representing the interface
- public MethodInfo[] TargetMethods; // The methods implementing the interface
- public MethodInfo[] InterfaceMethods; // The methods defined on the interface
- }
-}
diff --git a/src/mscorlib/src/System/Reflection/InvalidFilterCriteriaException.cs b/src/mscorlib/src/System/Reflection/InvalidFilterCriteriaException.cs
deleted file mode 100644
index d3333df8e1..0000000000
--- a/src/mscorlib/src/System/Reflection/InvalidFilterCriteriaException.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-// 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.
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// InvalidFilterCriteriaException is thrown in FindMembers when the
-//
-// filter criteria is not valid for the type of filter being used.
-//
-//
-//
-//
-
-namespace System.Reflection
-{
- using System;
- using System.Runtime.Serialization;
- using ApplicationException = System.ApplicationException;
- [Serializable]
- public class InvalidFilterCriteriaException : ApplicationException
- {
- public InvalidFilterCriteriaException()
- : base(Environment.GetResourceString("Arg_InvalidFilterCriteriaException"))
- {
- SetErrorCode(__HResults.COR_E_INVALIDFILTERCRITERIA);
- }
-
- public InvalidFilterCriteriaException(String message) : base(message)
- {
- SetErrorCode(__HResults.COR_E_INVALIDFILTERCRITERIA);
- }
-
- public InvalidFilterCriteriaException(String message, Exception inner) : base(message, inner)
- {
- SetErrorCode(__HResults.COR_E_INVALIDFILTERCRITERIA);
- }
-
- protected InvalidFilterCriteriaException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
- }
-}
diff --git a/src/mscorlib/src/System/Reflection/LocalVariableInfo.cs b/src/mscorlib/src/System/Reflection/LocalVariableInfo.cs
new file mode 100644
index 0000000000..241a3c4de6
--- /dev/null
+++ b/src/mscorlib/src/System/Reflection/LocalVariableInfo.cs
@@ -0,0 +1,40 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Diagnostics;
+
+namespace System.Reflection
+{
+ public class LocalVariableInfo
+ {
+ #region Private Data Members
+ private RuntimeType m_type;
+ private int m_isPinned;
+ private int m_localIndex;
+ #endregion
+
+ #region Constructor
+ protected LocalVariableInfo() { }
+ #endregion
+
+ #region Object Overrides
+ public override string ToString()
+ {
+ string toString = LocalType.ToString() + " (" + LocalIndex + ")";
+
+ if (IsPinned)
+ toString += " (pinned)";
+
+ return toString;
+ }
+ #endregion
+
+ #region Public Members
+ public virtual Type LocalType { get { Debug.Assert(m_type != null, "type must be set!"); return m_type; } }
+ public virtual bool IsPinned { get { return m_isPinned != 0; } }
+ public virtual int LocalIndex { get { return m_localIndex; } }
+ #endregion
+ }
+}
+
diff --git a/src/mscorlib/src/System/Reflection/ManifestResourceInfo.cs b/src/mscorlib/src/System/Reflection/ManifestResourceInfo.cs
deleted file mode 100644
index 792d054d44..0000000000
--- a/src/mscorlib/src/System/Reflection/ManifestResourceInfo.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-// 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: For info regarding a manifest resource's topology.
-**
-**
-=============================================================================*/
-
-using System;
-
-namespace System.Reflection
-{
- public class ManifestResourceInfo
- {
- private Assembly _containingAssembly;
- private String _containingFileName;
- private ResourceLocation _resourceLocation;
-
- public ManifestResourceInfo(Assembly containingAssembly,
- String containingFileName,
- ResourceLocation resourceLocation)
- {
- _containingAssembly = containingAssembly;
- _containingFileName = containingFileName;
- _resourceLocation = resourceLocation;
- }
-
- public virtual Assembly ReferencedAssembly
- {
- get
- {
- return _containingAssembly;
- }
- }
-
- public virtual String FileName
- {
- get
- {
- return _containingFileName;
- }
- }
-
- public virtual ResourceLocation ResourceLocation
- {
- get
- {
- return _resourceLocation;
- }
- }
- }
-
- // The ResourceLocation is a combination of these flags, set or not.
- // Linked means not Embedded.
- [Serializable]
- [Flags]
- public enum ResourceLocation
- {
- Embedded = 0x1,
- ContainedInAnotherAssembly = 0x2,
- ContainedInManifestFile = 0x4
- }
-}
diff --git a/src/mscorlib/src/System/Reflection/MdConstant.cs b/src/mscorlib/src/System/Reflection/MdConstant.cs
index 43c5556ed8..8e5b65724d 100644
--- a/src/mscorlib/src/System/Reflection/MdConstant.cs
+++ b/src/mscorlib/src/System/Reflection/MdConstant.cs
@@ -69,7 +69,7 @@ namespace System.Reflection
break;
default:
- throw new FormatException(Environment.GetResourceString("Arg_BadLiteralFormat"));
+ throw new FormatException(SR.Arg_BadLiteralFormat);
#endregion
}
@@ -95,7 +95,7 @@ namespace System.Reflection
break;
default:
- throw new FormatException(Environment.GetResourceString("Arg_BadLiteralFormat"));
+ throw new FormatException(SR.Arg_BadLiteralFormat);
#endregion
}
@@ -158,7 +158,7 @@ namespace System.Reflection
return null;
default:
- throw new FormatException(Environment.GetResourceString("Arg_BadLiteralFormat"));
+ throw new FormatException(SR.Arg_BadLiteralFormat);
#endregion
}
}
diff --git a/src/mscorlib/src/System/Reflection/MdFieldInfo.cs b/src/mscorlib/src/System/Reflection/MdFieldInfo.cs
new file mode 100644
index 0000000000..2ec6abd713
--- /dev/null
+++ b/src/mscorlib/src/System/Reflection/MdFieldInfo.cs
@@ -0,0 +1,141 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Diagnostics;
+using System.Globalization;
+using System.Runtime.Serialization;
+using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache;
+
+namespace System.Reflection
+{
+ [Serializable]
+ internal sealed unsafe class MdFieldInfo : RuntimeFieldInfo, ISerializable
+ {
+ #region Private Data Members
+ private int m_tkField;
+ private string m_name;
+ private RuntimeType m_fieldType;
+ private FieldAttributes m_fieldAttributes;
+ #endregion
+
+ #region Constructor
+ internal MdFieldInfo(
+ int tkField, FieldAttributes fieldAttributes, RuntimeTypeHandle declaringTypeHandle, RuntimeTypeCache reflectedTypeCache, BindingFlags bindingFlags)
+ : base(reflectedTypeCache, declaringTypeHandle.GetRuntimeType(), bindingFlags)
+ {
+ m_tkField = tkField;
+ m_name = null;
+ m_fieldAttributes = fieldAttributes;
+ }
+ #endregion
+
+ #region Internal Members
+ internal override bool CacheEquals(object o)
+ {
+ MdFieldInfo m = o as MdFieldInfo;
+
+ if ((object)m == null)
+ return false;
+
+ return m.m_tkField == m_tkField &&
+ m_declaringType.GetTypeHandleInternal().GetModuleHandle().Equals(
+ m.m_declaringType.GetTypeHandleInternal().GetModuleHandle());
+ }
+ #endregion
+
+ #region MemberInfo Overrides
+ public override String Name
+ {
+ get
+ {
+ if (m_name == null)
+ m_name = GetRuntimeModule().MetadataImport.GetName(m_tkField).ToString();
+
+ return m_name;
+ }
+ }
+
+ public override int MetadataToken { get { return m_tkField; } }
+ internal override RuntimeModule GetRuntimeModule() { return m_declaringType.GetRuntimeModule(); }
+ #endregion
+
+ #region FieldInfo Overrides
+ public override RuntimeFieldHandle FieldHandle { get { throw new NotSupportedException(); } }
+ public override FieldAttributes Attributes { get { return m_fieldAttributes; } }
+
+ public override bool IsSecurityCritical { get { return DeclaringType.IsSecurityCritical; } }
+ public override bool IsSecuritySafeCritical { get { return DeclaringType.IsSecuritySafeCritical; } }
+ public override bool IsSecurityTransparent { get { return DeclaringType.IsSecurityTransparent; } }
+
+ [DebuggerStepThroughAttribute]
+ [Diagnostics.DebuggerHidden]
+ public override Object GetValueDirect(TypedReference obj)
+ {
+ return GetValue(null);
+ }
+
+ [DebuggerStepThroughAttribute]
+ [Diagnostics.DebuggerHidden]
+ public override void SetValueDirect(TypedReference obj, Object value)
+ {
+ throw new FieldAccessException(SR.Acc_ReadOnly);
+ }
+
+ [DebuggerStepThroughAttribute]
+ [Diagnostics.DebuggerHidden]
+ public unsafe override Object GetValue(Object obj)
+ {
+ return GetValue(false);
+ }
+
+ public unsafe override Object GetRawConstantValue() { return GetValue(true); }
+
+ private unsafe Object GetValue(bool raw)
+ {
+ // Cannot cache these because they could be user defined non-agile enumerations
+
+ Object value = MdConstant.GetValue(GetRuntimeModule().MetadataImport, m_tkField, FieldType.GetTypeHandleInternal(), raw);
+
+ if (value == DBNull.Value)
+ throw new NotSupportedException(SR.Arg_EnumLitValueNotFound);
+
+ return value;
+ }
+
+ [DebuggerStepThroughAttribute]
+ [Diagnostics.DebuggerHidden]
+ public override void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture)
+ {
+ throw new FieldAccessException(SR.Acc_ReadOnly);
+ }
+
+ public override Type FieldType
+ {
+ get
+ {
+ if (m_fieldType == null)
+ {
+ ConstArray fieldMarshal = GetRuntimeModule().MetadataImport.GetSigOfFieldDef(m_tkField);
+
+ m_fieldType = new Signature(fieldMarshal.Signature.ToPointer(),
+ (int)fieldMarshal.Length, m_declaringType).FieldType;
+ }
+
+ return m_fieldType;
+ }
+ }
+
+ public override Type[] GetRequiredCustomModifiers()
+ {
+ return EmptyArray<Type>.Value;
+ }
+
+ public override Type[] GetOptionalCustomModifiers()
+ {
+ return EmptyArray<Type>.Value;
+ }
+
+ #endregion
+ }
+}
diff --git a/src/mscorlib/src/System/Reflection/MemberFilter.cs b/src/mscorlib/src/System/Reflection/MemberFilter.cs
deleted file mode 100644
index 707ce9b584..0000000000
--- a/src/mscorlib/src/System/Reflection/MemberFilter.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-// 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.
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// MemberFilter is a delegate used to filter Members. This delegate is used
-//
-// as a callback from Type.FindMembers.
-//
-//
-
-namespace System.Reflection
-{
- // Define the delegate
- [Serializable]
- public delegate bool MemberFilter(MemberInfo m, Object filterCriteria);
-}
diff --git a/src/mscorlib/src/System/Reflection/MemberSerializationStringGenerator.cs b/src/mscorlib/src/System/Reflection/MemberSerializationStringGenerator.cs
new file mode 100644
index 0000000000..d25c746a85
--- /dev/null
+++ b/src/mscorlib/src/System/Reflection/MemberSerializationStringGenerator.cs
@@ -0,0 +1,39 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Text;
+using System.Reflection;
+using System.Diagnostics;
+using System.Collections.Generic;
+
+namespace System
+{
+ internal static class MemberSerializationStringGenerator
+ {
+ //
+ // Generate the "Signature2" binary serialization string for PropertyInfos
+ //
+ // Because the string is effectively a file format for serialized Reflection objects, it must be exactly correct. If missing
+ // metadata prevents generating the string, this method throws a MissingMetadata exception.
+ //
+ public static string SerializationToString(this PropertyInfo property) => ((RuntimePropertyInfo)property).SerializationToString();
+
+ //
+ // Generate the "Signature2" binary serialization string for ConstructorInfos
+ //
+ // Because the string is effectively a file format for serialized Reflection objects, it must be exactly correct. If missing
+ // metadata prevents generating the string, this method throws a MissingMetadata exception.
+ //
+ public static string SerializationToString(this ConstructorInfo constructor) => ((RuntimeConstructorInfo)constructor).SerializationToString();
+
+ //
+ // Generate the "Signature2" binary serialization string for MethodInfos
+ //
+ // Because the string is effectively a file format for serialized Reflection objects, it must be exactly correct. If missing
+ // metadata prevents generating the string, this method throws a MissingMetadata exception.
+ //
+ public static string SerializationToString(this MethodInfo method) => ((RuntimeMethodInfo)method).SerializationToString();
+ }
+}
diff --git a/src/mscorlib/src/System/Reflection/MethodBase.CoreCLR.cs b/src/mscorlib/src/System/Reflection/MethodBase.CoreCLR.cs
new file mode 100644
index 0000000000..3afd396471
--- /dev/null
+++ b/src/mscorlib/src/System/Reflection/MethodBase.CoreCLR.cs
@@ -0,0 +1,157 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Diagnostics;
+using System.Globalization;
+using System.Text;
+using System.Threading;
+
+namespace System.Reflection
+{
+ public abstract partial class MethodBase : MemberInfo
+ {
+ #region Static Members
+ public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle)
+ {
+ if (handle.IsNullHandle())
+ throw new ArgumentException(SR.Argument_InvalidHandle);
+
+ MethodBase m = RuntimeType.GetMethodBase(handle.GetMethodInfo());
+
+ Type declaringType = m.DeclaringType;
+ if (declaringType != null && declaringType.IsGenericType)
+ throw new ArgumentException(String.Format(
+ CultureInfo.CurrentCulture, SR.Argument_MethodDeclaringTypeGeneric,
+ m, declaringType.GetGenericTypeDefinition()));
+
+ return m;
+ }
+
+ public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle, RuntimeTypeHandle declaringType)
+ {
+ if (handle.IsNullHandle())
+ throw new ArgumentException(SR.Argument_InvalidHandle);
+
+ return RuntimeType.GetMethodBase(declaringType.GetRuntimeType(), handle.GetMethodInfo());
+ }
+
+ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
+ public static MethodBase GetCurrentMethod()
+ {
+ StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
+ return RuntimeMethodInfo.InternalGetCurrentMethod(ref stackMark);
+ }
+ #endregion
+
+ #region Internal Members
+ // used by EE
+ private IntPtr GetMethodDesc() { return MethodHandle.Value; }
+
+ internal virtual ParameterInfo[] GetParametersNoCopy() { return GetParameters(); }
+ #endregion
+
+ #region Internal Methods
+ // helper method to construct the string representation of the parameter list
+
+ internal static string ConstructParameters(Type[] parameterTypes, CallingConventions callingConvention, bool serialization)
+ {
+ StringBuilder sbParamList = new StringBuilder();
+ string comma = "";
+
+ for (int i = 0; i < parameterTypes.Length; i++)
+ {
+ Type t = parameterTypes[i];
+
+ sbParamList.Append(comma);
+
+ string typeName = t.FormatTypeName(serialization);
+
+ // Legacy: Why use "ByRef" for by ref parameters? What language is this?
+ // VB uses "ByRef" but it should precede (not follow) the parameter name.
+ // Why don't we just use "&"?
+ if (t.IsByRef && !serialization)
+ {
+ sbParamList.Append(typeName.TrimEnd('&'));
+ sbParamList.Append(" ByRef");
+ }
+ else
+ {
+ sbParamList.Append(typeName);
+ }
+
+ comma = ", ";
+ }
+
+ if ((callingConvention & CallingConventions.VarArgs) == CallingConventions.VarArgs)
+ {
+ sbParamList.Append(comma);
+ sbParamList.Append("...");
+ }
+
+ return sbParamList.ToString();
+ }
+
+ internal string FullName
+ {
+ get
+ {
+ return String.Format("{0}.{1}", DeclaringType.FullName, FormatNameAndSig());
+ }
+ }
+ internal string FormatNameAndSig()
+ {
+ return FormatNameAndSig(false);
+ }
+
+ internal virtual string FormatNameAndSig(bool serialization)
+ {
+ // Serialization uses ToString to resolve MethodInfo overloads.
+ StringBuilder sbName = new StringBuilder(Name);
+
+ sbName.Append("(");
+ sbName.Append(ConstructParameters(GetParameterTypes(), CallingConvention, serialization));
+ sbName.Append(")");
+
+ return sbName.ToString();
+ }
+
+ internal virtual Type[] GetParameterTypes()
+ {
+ ParameterInfo[] paramInfo = GetParametersNoCopy();
+
+ Type[] parameterTypes = new Type[paramInfo.Length];
+ for (int i = 0; i < paramInfo.Length; i++)
+ parameterTypes[i] = paramInfo[i].ParameterType;
+
+ return parameterTypes;
+ }
+
+ internal Object[] CheckArguments(Object[] parameters, Binder binder,
+ BindingFlags invokeAttr, CultureInfo culture, Signature sig)
+ {
+ // copy the arguments in a different array so we detach from any user changes
+ Object[] copyOfParameters = new Object[parameters.Length];
+
+ ParameterInfo[] p = null;
+ for (int i = 0; i < parameters.Length; i++)
+ {
+ Object arg = parameters[i];
+ RuntimeType argRT = sig.Arguments[i];
+
+ if (arg == Type.Missing)
+ {
+ if (p == null)
+ p = GetParametersNoCopy();
+ if (p[i].DefaultValue == System.DBNull.Value)
+ throw new ArgumentException(SR.Arg_VarMissNull, nameof(parameters));
+ arg = p[i].DefaultValue;
+ }
+ copyOfParameters[i] = argRT.CheckValue(arg, binder, culture, invokeAttr);
+ }
+
+ return copyOfParameters;
+ }
+ #endregion
+ }
+}
diff --git a/src/mscorlib/src/System/Reflection/MethodBase.cs b/src/mscorlib/src/System/Reflection/MethodBase.cs
deleted file mode 100644
index afccf27dd7..0000000000
--- a/src/mscorlib/src/System/Reflection/MethodBase.cs
+++ /dev/null
@@ -1,333 +0,0 @@
-// 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 System.Reflection
-{
- using System;
- using System.Diagnostics;
- using System.Globalization;
- using System.Runtime.CompilerServices;
- using System.Runtime.InteropServices;
- using System.Text;
- using System.Threading;
-
- //
- // Invocation cached flags. Those are used in unmanaged code as well
- // so be careful if you change them
- //
- [Flags]
- internal enum INVOCATION_FLAGS : uint
- {
- INVOCATION_FLAGS_UNKNOWN = 0x00000000,
- INVOCATION_FLAGS_INITIALIZED = 0x00000001,
- // it's used for both method and field to signify that no access is allowed
- INVOCATION_FLAGS_NO_INVOKE = 0x00000002,
- INVOCATION_FLAGS_NEED_SECURITY = 0x00000004,
- // Set for static ctors and ctors on abstract types, which
- // can be invoked only if the "this" object is provided (even if it's null).
- INVOCATION_FLAGS_NO_CTOR_INVOKE = 0x00000008,
- // because field and method are different we can reuse the same bits
- // method
- INVOCATION_FLAGS_IS_CTOR = 0x00000010,
- INVOCATION_FLAGS_RISKY_METHOD = 0x00000020,
- /* unused 0x00000040 */
- INVOCATION_FLAGS_IS_DELEGATE_CTOR = 0x00000080,
- INVOCATION_FLAGS_CONTAINS_STACK_POINTERS = 0x00000100,
- // field
- INVOCATION_FLAGS_SPECIAL_FIELD = 0x00000010,
- INVOCATION_FLAGS_FIELD_SPECIAL_CAST = 0x00000020,
-
- // temporary flag used for flagging invocation of method vs ctor
- // this flag never appears on the instance m_invocationFlag and is simply
- // passed down from within ConstructorInfo.Invoke()
- INVOCATION_FLAGS_CONSTRUCTOR_INVOKE = 0x10000000,
- }
-
- [Serializable]
- public abstract class MethodBase : MemberInfo
- {
- #region Static Members
- public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle)
- {
- if (handle.IsNullHandle())
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle"));
-
- MethodBase m = RuntimeType.GetMethodBase(handle.GetMethodInfo());
-
- Type declaringType = m.DeclaringType;
- if (declaringType != null && declaringType.IsGenericType)
- throw new ArgumentException(String.Format(
- CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_MethodDeclaringTypeGeneric"),
- m, declaringType.GetGenericTypeDefinition()));
-
- return m;
- }
-
- public static MethodBase GetMethodFromHandle(RuntimeMethodHandle handle, RuntimeTypeHandle declaringType)
- {
- if (handle.IsNullHandle())
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidHandle"));
-
- return RuntimeType.GetMethodBase(declaringType.GetRuntimeType(), handle.GetMethodInfo());
- }
-
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
- public static MethodBase GetCurrentMethod()
- {
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- return RuntimeMethodInfo.InternalGetCurrentMethod(ref stackMark);
- }
- #endregion
-
- #region Constructor
- protected MethodBase() { }
- #endregion
-
- public static bool operator ==(MethodBase left, MethodBase right)
- {
- if (ReferenceEquals(left, right))
- return true;
-
- if ((object)left == null || (object)right == null)
- return false;
-
- MethodInfo method1, method2;
- ConstructorInfo constructor1, constructor2;
-
- if ((method1 = left as MethodInfo) != null && (method2 = right as MethodInfo) != null)
- return method1 == method2;
- else if ((constructor1 = left as ConstructorInfo) != null && (constructor2 = right as ConstructorInfo) != null)
- return constructor1 == constructor2;
-
- return false;
- }
-
- public static bool operator !=(MethodBase left, MethodBase right)
- {
- return !(left == right);
- }
-
- public override bool Equals(object obj)
- {
- return base.Equals(obj);
- }
-
- public override int GetHashCode()
- {
- return base.GetHashCode();
- }
-
- #region Internal Members
- // used by EE
- private IntPtr GetMethodDesc() { return MethodHandle.Value; }
-
-#if FEATURE_APPX
-#endif
- #endregion
-
- #region Public Abstract\Virtual Members
- internal virtual ParameterInfo[] GetParametersNoCopy() { return GetParameters(); }
-
- [System.Diagnostics.Contracts.Pure]
- public abstract ParameterInfo[] GetParameters();
-
- public virtual MethodImplAttributes MethodImplementationFlags
- {
- get
- {
- return GetMethodImplementationFlags();
- }
- }
-
- public abstract MethodImplAttributes GetMethodImplementationFlags();
-
- public abstract RuntimeMethodHandle MethodHandle { get; }
-
- public abstract MethodAttributes Attributes { get; }
-
- public abstract Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture);
-
- public virtual CallingConventions CallingConvention { get { return CallingConventions.Standard; } }
-
- public virtual Type[] GetGenericArguments() { throw new NotSupportedException(Environment.GetResourceString("NotSupported_SubclassOverride")); }
-
- public virtual bool IsGenericMethodDefinition { get { return false; } }
-
- public virtual bool ContainsGenericParameters { get { return false; } }
-
- public virtual bool IsGenericMethod { get { return false; } }
-
- public virtual bool IsSecurityCritical { get { throw new NotImplementedException(); } }
-
- public virtual bool IsSecuritySafeCritical { get { throw new NotImplementedException(); } }
-
- public virtual bool IsSecurityTransparent { get { throw new NotImplementedException(); } }
-
- #endregion
-
- #region Public Members
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- public Object Invoke(Object obj, Object[] parameters)
- {
- // Theoretically we should set up a LookForMyCaller stack mark here and pass that along.
- // But to maintain backward compatibility we can't switch to calling an
- // internal overload that takes a stack mark.
- // Fortunately the stack walker skips all the reflection invocation frames including this one.
- // So this method will never be returned by the stack walker as the caller.
- // See SystemDomain::CallersMethodCallbackWithStackMark in AppDomain.cpp.
- return Invoke(obj, BindingFlags.Default, null, parameters, null);
- }
-
- public bool IsPublic { get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Public; } }
-
- public bool IsPrivate { get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Private; } }
-
- public bool IsFamily { get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Family; } }
-
- public bool IsAssembly { get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.Assembly; } }
-
- public bool IsFamilyAndAssembly { get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.FamANDAssem; } }
-
- public bool IsFamilyOrAssembly { get { return (Attributes & MethodAttributes.MemberAccessMask) == MethodAttributes.FamORAssem; } }
-
- public bool IsStatic { get { return (Attributes & MethodAttributes.Static) != 0; } }
-
- public bool IsFinal
- {
- get { return (Attributes & MethodAttributes.Final) != 0; }
- }
- public bool IsVirtual
- {
- get { return (Attributes & MethodAttributes.Virtual) != 0; }
- }
- public bool IsHideBySig { get { return (Attributes & MethodAttributes.HideBySig) != 0; } }
-
- public bool IsAbstract { get { return (Attributes & MethodAttributes.Abstract) != 0; } }
-
- public bool IsSpecialName { get { return (Attributes & MethodAttributes.SpecialName) != 0; } }
-
- public bool IsConstructor
- {
- get
- {
- // To be backward compatible we only return true for instance RTSpecialName ctors.
- return (this is ConstructorInfo &&
- !IsStatic &&
- ((Attributes & MethodAttributes.RTSpecialName) == MethodAttributes.RTSpecialName));
- }
- }
-
- public virtual MethodBody GetMethodBody()
- {
- throw new InvalidOperationException();
- }
- #endregion
-
- #region Internal Methods
- // helper method to construct the string representation of the parameter list
-
- internal static string ConstructParameters(Type[] parameterTypes, CallingConventions callingConvention, bool serialization)
- {
- StringBuilder sbParamList = new StringBuilder();
- string comma = "";
-
- for (int i = 0; i < parameterTypes.Length; i++)
- {
- Type t = parameterTypes[i];
-
- sbParamList.Append(comma);
-
- string typeName = t.FormatTypeName(serialization);
-
- // Legacy: Why use "ByRef" for by ref parameters? What language is this?
- // VB uses "ByRef" but it should precede (not follow) the parameter name.
- // Why don't we just use "&"?
- if (t.IsByRef && !serialization)
- {
- sbParamList.Append(typeName.TrimEnd('&'));
- sbParamList.Append(" ByRef");
- }
- else
- {
- sbParamList.Append(typeName);
- }
-
- comma = ", ";
- }
-
- if ((callingConvention & CallingConventions.VarArgs) == CallingConventions.VarArgs)
- {
- sbParamList.Append(comma);
- sbParamList.Append("...");
- }
-
- return sbParamList.ToString();
- }
-
- internal string FullName
- {
- get
- {
- return String.Format("{0}.{1}", DeclaringType.FullName, FormatNameAndSig());
- }
- }
- internal string FormatNameAndSig()
- {
- return FormatNameAndSig(false);
- }
-
- internal virtual string FormatNameAndSig(bool serialization)
- {
- // Serialization uses ToString to resolve MethodInfo overloads.
- StringBuilder sbName = new StringBuilder(Name);
-
- sbName.Append("(");
- sbName.Append(ConstructParameters(GetParameterTypes(), CallingConvention, serialization));
- sbName.Append(")");
-
- return sbName.ToString();
- }
-
- internal virtual Type[] GetParameterTypes()
- {
- ParameterInfo[] paramInfo = GetParametersNoCopy();
-
- Type[] parameterTypes = new Type[paramInfo.Length];
- for (int i = 0; i < paramInfo.Length; i++)
- parameterTypes[i] = paramInfo[i].ParameterType;
-
- return parameterTypes;
- }
-
- internal Object[] CheckArguments(Object[] parameters, Binder binder,
- BindingFlags invokeAttr, CultureInfo culture, Signature sig)
- {
- // copy the arguments in a different array so we detach from any user changes
- Object[] copyOfParameters = new Object[parameters.Length];
-
- ParameterInfo[] p = null;
- for (int i = 0; i < parameters.Length; i++)
- {
- Object arg = parameters[i];
- RuntimeType argRT = sig.Arguments[i];
-
- if (arg == Type.Missing)
- {
- if (p == null)
- p = GetParametersNoCopy();
- if (p[i].DefaultValue == System.DBNull.Value)
- throw new ArgumentException(Environment.GetResourceString("Arg_VarMissNull"), nameof(parameters));
- arg = p[i].DefaultValue;
- }
- copyOfParameters[i] = argRT.CheckValue(arg, binder, culture, invokeAttr);
- }
-
- return copyOfParameters;
- }
- #endregion
- }
-}
diff --git a/src/mscorlib/src/System/Reflection/MethodBody.cs b/src/mscorlib/src/System/Reflection/MethodBody.cs
index b245b5406b..4335177efb 100644
--- a/src/mscorlib/src/System/Reflection/MethodBody.cs
+++ b/src/mscorlib/src/System/Reflection/MethodBody.cs
@@ -2,108 +2,10 @@
// 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.Collections.Generic;
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
namespace System.Reflection
{
- [Flags()]
- public enum ExceptionHandlingClauseOptions : int
- {
- Clause = 0x0,
- Filter = 0x1,
- Finally = 0x2,
- Fault = 0x4,
- }
-
- public class ExceptionHandlingClause
- {
- #region costructor
- // This class can only be created from inside the EE.
- protected ExceptionHandlingClause() { }
- #endregion
-
- #region Private Data Members
- private MethodBody m_methodBody;
- [ContractPublicPropertyName("Flags")]
- private ExceptionHandlingClauseOptions m_flags;
- private int m_tryOffset;
- private int m_tryLength;
- private int m_handlerOffset;
- private int m_handlerLength;
- private int m_catchMetadataToken;
- private int m_filterOffset;
- #endregion
-
- #region Public Members
- public virtual ExceptionHandlingClauseOptions Flags { get { return m_flags; } }
- public virtual int TryOffset { get { return m_tryOffset; } }
- public virtual int TryLength { get { return m_tryLength; } }
- public virtual int HandlerOffset { get { return m_handlerOffset; } }
- public virtual int HandlerLength { get { return m_handlerLength; } }
-
- public virtual int FilterOffset
- {
- get
- {
- if (m_flags != ExceptionHandlingClauseOptions.Filter)
- throw new InvalidOperationException(Environment.GetResourceString("Arg_EHClauseNotFilter"));
-
- return m_filterOffset;
- }
- }
-
- public virtual Type CatchType
- {
- get
- {
- if (m_flags != ExceptionHandlingClauseOptions.Clause)
- throw new InvalidOperationException(Environment.GetResourceString("Arg_EHClauseNotClause"));
-
- Type type = null;
-
- if (!MetadataToken.IsNullToken(m_catchMetadataToken))
- {
- Type declaringType = m_methodBody.m_methodBase.DeclaringType;
- Module module = (declaringType == null) ? m_methodBody.m_methodBase.Module : declaringType.Module;
- type = module.ResolveType(m_catchMetadataToken, (declaringType == null) ? null : declaringType.GetGenericArguments(),
- m_methodBody.m_methodBase is MethodInfo ? m_methodBody.m_methodBase.GetGenericArguments() : null);
- }
-
- return type;
- }
- }
- #endregion
-
- #region Object Overrides
- public override string ToString()
- {
- if (Flags == ExceptionHandlingClauseOptions.Clause)
- {
- return String.Format(CultureInfo.CurrentUICulture,
- "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}, CatchType={5}",
- Flags, TryOffset, TryLength, HandlerOffset, HandlerLength, CatchType);
- }
-
- if (Flags == ExceptionHandlingClauseOptions.Filter)
- {
- return String.Format(CultureInfo.CurrentUICulture,
- "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}, FilterOffset={5}",
- Flags, TryOffset, TryLength, HandlerOffset, HandlerLength, FilterOffset);
- }
-
- return String.Format(CultureInfo.CurrentUICulture,
- "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}",
- Flags, TryOffset, TryLength, HandlerOffset, HandlerLength);
- }
- #endregion
- }
-
public class MethodBody
{
#region costructor
@@ -130,36 +32,5 @@ namespace System.Reflection
public virtual IList<ExceptionHandlingClause> ExceptionHandlingClauses { get { return Array.AsReadOnly(m_exceptionHandlingClauses); } }
#endregion
}
-
- public class LocalVariableInfo
- {
- #region Private Data Members
- private RuntimeType m_type;
- private int m_isPinned;
- private int m_localIndex;
- #endregion
-
- #region Constructor
- protected LocalVariableInfo() { }
- #endregion
-
- #region Object Overrides
- public override string ToString()
- {
- string toString = LocalType.ToString() + " (" + LocalIndex + ")";
-
- if (IsPinned)
- toString += " (pinned)";
-
- return toString;
- }
- #endregion
-
- #region Public Members
- public virtual Type LocalType { get { Debug.Assert(m_type != null, "type must be set!"); return m_type; } }
- public virtual bool IsPinned { get { return m_isPinned != 0; } }
- public virtual int LocalIndex { get { return m_localIndex; } }
- #endregion
- }
}
diff --git a/src/mscorlib/src/System/Reflection/Module.cs b/src/mscorlib/src/System/Reflection/Module.cs
deleted file mode 100644
index 79ab705b9a..0000000000
--- a/src/mscorlib/src/System/Reflection/Module.cs
+++ /dev/null
@@ -1,1123 +0,0 @@
-// 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 System.Reflection
-{
- using System;
- using System.Diagnostics.SymbolStore;
- using System.Runtime.Remoting;
- using System.Runtime.InteropServices;
- using System.Runtime.Serialization;
- using System.Collections;
- using System.Collections.Generic;
- using System.Threading;
- using System.Runtime.CompilerServices;
- using System.Security;
- using System.IO;
- using System.Globalization;
- using System.Runtime.Versioning;
- using System.Diagnostics.Contracts;
-
- [Serializable]
- [Flags]
- public enum PortableExecutableKinds
- {
- NotAPortableExecutableImage = 0x0,
-
- ILOnly = 0x1,
-
- Required32Bit = 0x2,
-
- PE32Plus = 0x4,
-
- Unmanaged32Bit = 0x8,
-
- Preferred32Bit = 0x10,
- }
-
- [Serializable]
- public enum ImageFileMachine
- {
- I386 = 0x014c,
-
- IA64 = 0x0200,
-
- AMD64 = 0x8664,
-
- ARM = 0x01c4,
- }
-
- [Serializable]
- public abstract class Module : ISerializable, ICustomAttributeProvider
- {
- #region Static Constructor
- static Module()
- {
- __Filters _fltObj;
- _fltObj = new __Filters();
- FilterTypeName = new TypeFilter(_fltObj.FilterTypeName);
- FilterTypeNameIgnoreCase = new TypeFilter(_fltObj.FilterTypeNameIgnoreCase);
- }
- #endregion
-
- #region Constructor
- protected Module()
- {
- }
- #endregion
-
- #region Public Statics
- public static readonly TypeFilter FilterTypeName;
- public static readonly TypeFilter FilterTypeNameIgnoreCase;
-
- public static bool operator ==(Module left, Module right)
- {
- if (ReferenceEquals(left, right))
- return true;
-
- if ((object)left == null || (object)right == null ||
- left is RuntimeModule || right is RuntimeModule)
- {
- return false;
- }
-
- return left.Equals(right);
- }
-
- public static bool operator !=(Module left, Module right)
- {
- return !(left == right);
- }
-
- public override bool Equals(object o)
- {
- return base.Equals(o);
- }
-
- public override int GetHashCode()
- {
- return base.GetHashCode();
- }
- #endregion
-
- #region Literals
- private const BindingFlags DefaultLookup = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public;
- #endregion
-
- #region object overrides
- public override String ToString()
- {
- return ScopeName;
- }
- #endregion
-
- public virtual IEnumerable<CustomAttributeData> CustomAttributes
- {
- get
- {
- return GetCustomAttributesData();
- }
- }
- #region ICustomAttributeProvider Members
- public virtual Object[] GetCustomAttributes(bool inherit)
- {
- throw new NotImplementedException();
- }
-
- public virtual Object[] GetCustomAttributes(Type attributeType, bool inherit)
- {
- throw new NotImplementedException();
- }
-
- public virtual bool IsDefined(Type attributeType, bool inherit)
- {
- throw new NotImplementedException();
- }
-
- public virtual IList<CustomAttributeData> GetCustomAttributesData()
- {
- throw new NotImplementedException();
- }
- #endregion
-
- #region public instances members
- public MethodBase ResolveMethod(int metadataToken)
- {
- return ResolveMethod(metadataToken, null, null);
- }
-
- public virtual MethodBase ResolveMethod(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- // This API was made virtual in V4. Code compiled against V2 might use
- // "call" rather than "callvirt" to call it.
- // This makes sure those code still works.
- RuntimeModule rtModule = this as RuntimeModule;
- if (rtModule != null)
- return rtModule.ResolveMethod(metadataToken, genericTypeArguments, genericMethodArguments);
-
- throw new NotImplementedException();
- }
-
- public FieldInfo ResolveField(int metadataToken)
- {
- return ResolveField(metadataToken, null, null);
- }
-
- public virtual FieldInfo ResolveField(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- // This API was made virtual in V4. Code compiled against V2 might use
- // "call" rather than "callvirt" to call it.
- // This makes sure those code still works.
- RuntimeModule rtModule = this as RuntimeModule;
- if (rtModule != null)
- return rtModule.ResolveField(metadataToken, genericTypeArguments, genericMethodArguments);
-
- throw new NotImplementedException();
- }
-
- public Type ResolveType(int metadataToken)
- {
- return ResolveType(metadataToken, null, null);
- }
-
- public virtual Type ResolveType(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- // This API was made virtual in V4. Code compiled against V2 might use
- // "call" rather than "callvirt" to call it.
- // This makes sure those code still works.
- RuntimeModule rtModule = this as RuntimeModule;
- if (rtModule != null)
- return rtModule.ResolveType(metadataToken, genericTypeArguments, genericMethodArguments);
-
- throw new NotImplementedException();
- }
-
- public MemberInfo ResolveMember(int metadataToken)
- {
- return ResolveMember(metadataToken, null, null);
- }
-
- public virtual MemberInfo ResolveMember(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- // This API was made virtual in V4. Code compiled against V2 might use
- // "call" rather than "callvirt" to call it.
- // This makes sure those code still works.
- RuntimeModule rtModule = this as RuntimeModule;
- if (rtModule != null)
- return rtModule.ResolveMember(metadataToken, genericTypeArguments, genericMethodArguments);
-
- throw new NotImplementedException();
- }
-
- public virtual byte[] ResolveSignature(int metadataToken)
- {
- // This API was made virtual in V4. Code compiled against V2 might use
- // "call" rather than "callvirt" to call it.
- // This makes sure those code still works.
- RuntimeModule rtModule = this as RuntimeModule;
- if (rtModule != null)
- return rtModule.ResolveSignature(metadataToken);
-
- throw new NotImplementedException();
- }
-
- public virtual string ResolveString(int metadataToken)
- {
- // This API was made virtual in V4. Code compiled against V2 might use
- // "call" rather than "callvirt" to call it.
- // This makes sure those code still works.
- RuntimeModule rtModule = this as RuntimeModule;
- if (rtModule != null)
- return rtModule.ResolveString(metadataToken);
-
- throw new NotImplementedException();
- }
-
- public virtual void GetPEKind(out PortableExecutableKinds peKind, out ImageFileMachine machine)
- {
- // This API was made virtual in V4. Code compiled against V2 might use
- // "call" rather than "callvirt" to call it.
- // This makes sure those code still works.
- RuntimeModule rtModule = this as RuntimeModule;
- if (rtModule != null)
- rtModule.GetPEKind(out peKind, out machine);
-
- throw new NotImplementedException();
- }
-
- public virtual int MDStreamVersion
- {
- get
- {
- // This API was made virtual in V4. Code compiled against V2 might use
- // "call" rather than "callvirt" to call it.
- // This makes sure those code still works.
- RuntimeModule rtModule = this as RuntimeModule;
- if (rtModule != null)
- return rtModule.MDStreamVersion;
-
- throw new NotImplementedException();
- }
- }
-
- public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- throw new NotImplementedException();
- }
-
- public virtual Type GetType(String className, bool ignoreCase)
- {
- return GetType(className, false, ignoreCase);
- }
-
- public virtual Type GetType(String className)
- {
- return GetType(className, false, false);
- }
-
- public virtual Type GetType(String className, bool throwOnError, bool ignoreCase)
- {
- throw new NotImplementedException();
- }
-
- public virtual String FullyQualifiedName
- {
- get
- {
- throw new NotImplementedException();
- }
- }
-
- public virtual Type[] FindTypes(TypeFilter filter, Object filterCriteria)
- {
- Type[] c = GetTypes();
- int cnt = 0;
- for (int i = 0; i < c.Length; i++)
- {
- if (filter != null && !filter(c[i], filterCriteria))
- c[i] = null;
- else
- cnt++;
- }
- if (cnt == c.Length)
- return c;
-
- Type[] ret = new Type[cnt];
- cnt = 0;
- for (int i = 0; i < c.Length; i++)
- {
- if (c[i] != null)
- ret[cnt++] = c[i];
- }
- return ret;
- }
-
- public virtual Type[] GetTypes()
- {
- throw new NotImplementedException();
- }
-
- public virtual Guid ModuleVersionId
- {
- get
- {
- // This API was made virtual in V4. Code compiled against V2 might use
- // "call" rather than "callvirt" to call it.
- // This makes sure those code still works.
- RuntimeModule rtModule = this as RuntimeModule;
- if (rtModule != null)
- return rtModule.ModuleVersionId;
-
- throw new NotImplementedException();
- }
- }
-
- public virtual int MetadataToken
- {
- get
- {
- // This API was made virtual in V4. Code compiled against V2 might use
- // "call" rather than "callvirt" to call it.
- // This makes sure those code still works.
- RuntimeModule rtModule = this as RuntimeModule;
- if (rtModule != null)
- return rtModule.MetadataToken;
-
- throw new NotImplementedException();
- }
- }
-
- public virtual bool IsResource()
- {
- // This API was made virtual in V4. Code compiled against V2 might use
- // "call" rather than "callvirt" to call it.
- // This makes sure those code still works.
- RuntimeModule rtModule = this as RuntimeModule;
- if (rtModule != null)
- return rtModule.IsResource();
-
- throw new NotImplementedException();
- }
-
- public FieldInfo[] GetFields()
- {
- return GetFields(Module.DefaultLookup);
- }
-
- public virtual FieldInfo[] GetFields(BindingFlags bindingFlags)
- {
- // This API was made virtual in V4. Code compiled against V2 might use
- // "call" rather than "callvirt" to call it.
- // This makes sure those code still works.
- RuntimeModule rtModule = this as RuntimeModule;
- if (rtModule != null)
- return rtModule.GetFields(bindingFlags);
-
- throw new NotImplementedException();
- }
-
- public FieldInfo GetField(String name)
- {
- return GetField(name, Module.DefaultLookup);
- }
-
- public virtual FieldInfo GetField(String name, BindingFlags bindingAttr)
- {
- // This API was made virtual in V4. Code compiled against V2 might use
- // "call" rather than "callvirt" to call it.
- // This makes sure those code still works.
- RuntimeModule rtModule = this as RuntimeModule;
- if (rtModule != null)
- return rtModule.GetField(name, bindingAttr);
-
- throw new NotImplementedException();
- }
-
- public MethodInfo[] GetMethods()
- {
- return GetMethods(Module.DefaultLookup);
- }
-
- public virtual MethodInfo[] GetMethods(BindingFlags bindingFlags)
- {
- // This API was made virtual in V4. Code compiled against V2 might use
- // "call" rather than "callvirt" to call it.
- // This makes sure those code still works.
- RuntimeModule rtModule = this as RuntimeModule;
- if (rtModule != null)
- return rtModule.GetMethods(bindingFlags);
-
- throw new NotImplementedException();
- }
-
- public MethodInfo GetMethod(
- String name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
- {
- if (name == null)
- throw new ArgumentNullException(nameof(name));
-
- if (types == null)
- throw new ArgumentNullException(nameof(types));
- Contract.EndContractBlock();
-
- for (int i = 0; i < types.Length; i++)
- {
- if (types[i] == null)
- throw new ArgumentNullException(nameof(types));
- }
-
- return GetMethodImpl(name, bindingAttr, binder, callConvention, types, modifiers);
- }
-
- public MethodInfo GetMethod(String name, Type[] types)
- {
- if (name == null)
- throw new ArgumentNullException(nameof(name));
-
- if (types == null)
- throw new ArgumentNullException(nameof(types));
- Contract.EndContractBlock();
-
- for (int i = 0; i < types.Length; i++)
- {
- if (types[i] == null)
- throw new ArgumentNullException(nameof(types));
- }
-
- return GetMethodImpl(name, Module.DefaultLookup, null, CallingConventions.Any, types, null);
- }
-
- public MethodInfo GetMethod(String name)
- {
- if (name == null)
- throw new ArgumentNullException(nameof(name));
- Contract.EndContractBlock();
-
- return GetMethodImpl(name, Module.DefaultLookup, null, CallingConventions.Any,
- null, null);
- }
-
- protected virtual MethodInfo GetMethodImpl(String name, BindingFlags bindingAttr, Binder binder,
- CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
- {
- throw new NotImplementedException();
- }
-
- public virtual String ScopeName
- {
- get
- {
- // This API was made virtual in V4. Code compiled against V2 might use
- // "call" rather than "callvirt" to call it.
- // This makes sure those code still works.
- RuntimeModule rtModule = this as RuntimeModule;
- if (rtModule != null)
- return rtModule.ScopeName;
-
- throw new NotImplementedException();
- }
- }
-
- public virtual String Name
- {
- get
- {
- // This API was made virtual in V4. Code compiled against V2 might use
- // "call" rather than "callvirt" to call it.
- // This makes sure those code still works.
- RuntimeModule rtModule = this as RuntimeModule;
- if (rtModule != null)
- return rtModule.Name;
-
- throw new NotImplementedException();
- }
- }
-
- public virtual Assembly Assembly
- {
- [Pure]
- get
- {
- // This API was made virtual in V4. Code compiled against V2 might use
- // "call" rather than "callvirt" to call it.
- // This makes sure those code still works.
- RuntimeModule rtModule = this as RuntimeModule;
- if (rtModule != null)
- return rtModule.Assembly;
-
- throw new NotImplementedException();
- }
- }
-
- // This API never fails, it will return an empty handle for non-runtime handles and
- // a valid handle for reflection only modules.
- public ModuleHandle ModuleHandle
- {
- get
- {
- return GetModuleHandle();
- }
- }
-
- // Used to provide implementation and overriding point for ModuleHandle.
- // To get a module handle inside mscorlib, use GetNativeHandle instead.
- internal virtual ModuleHandle GetModuleHandle()
- {
- return ModuleHandle.EmptyHandle;
- }
- #endregion
- }
-
- [Serializable]
- internal class RuntimeModule : Module
- {
- internal RuntimeModule() { throw new NotSupportedException(); }
-
- #region FCalls
- [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
- [SuppressUnmanagedCodeSecurity]
- private extern static void GetType(RuntimeModule module, String className, bool ignoreCase, bool throwOnError, ObjectHandleOnStack type, ObjectHandleOnStack keepAlive);
-
- [DllImport(JitHelpers.QCall)]
- [SuppressUnmanagedCodeSecurity]
- private static extern bool nIsTransientInternal(RuntimeModule module);
-
- [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
- [SuppressUnmanagedCodeSecurity]
- private extern static void GetScopeName(RuntimeModule module, StringHandleOnStack retString);
-
- [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
- [SuppressUnmanagedCodeSecurity]
- private extern static void GetFullyQualifiedName(RuntimeModule module, StringHandleOnStack retString);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern static RuntimeType[] GetTypes(RuntimeModule module);
-
- internal RuntimeType[] GetDefinedTypes()
- {
- return GetTypes(GetNativeHandle());
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern static bool IsResource(RuntimeModule module);
- #endregion
-
- #region Module overrides
- private static RuntimeTypeHandle[] ConvertToTypeHandleArray(Type[] genericArguments)
- {
- if (genericArguments == null)
- return null;
-
- int size = genericArguments.Length;
- RuntimeTypeHandle[] typeHandleArgs = new RuntimeTypeHandle[size];
- for (int i = 0; i < size; i++)
- {
- Type typeArg = genericArguments[i];
- if (typeArg == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidGenericInstArray"));
- typeArg = typeArg.UnderlyingSystemType;
- if (typeArg == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidGenericInstArray"));
- if (!(typeArg is RuntimeType))
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidGenericInstArray"));
- typeHandleArgs[i] = typeArg.GetTypeHandleInternal();
- }
- return typeHandleArgs;
- }
-
- public override byte[] ResolveSignature(int metadataToken)
- {
- MetadataToken tk = new MetadataToken(metadataToken);
-
- if (!MetadataImport.IsValidToken(tk))
- throw new ArgumentOutOfRangeException(nameof(metadataToken),
- Environment.GetResourceString("Argument_InvalidToken", tk, this));
-
- if (!tk.IsMemberRef && !tk.IsMethodDef && !tk.IsTypeSpec && !tk.IsSignature && !tk.IsFieldDef)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidToken", tk, this),
- nameof(metadataToken));
-
- ConstArray signature;
- if (tk.IsMemberRef)
- signature = MetadataImport.GetMemberRefProps(metadataToken);
- else
- signature = MetadataImport.GetSignatureFromToken(metadataToken);
-
- byte[] sig = new byte[signature.Length];
-
- for (int i = 0; i < signature.Length; i++)
- sig[i] = signature[i];
-
- return sig;
- }
-
- public override MethodBase ResolveMethod(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- MetadataToken tk = new MetadataToken(metadataToken);
-
- if (!MetadataImport.IsValidToken(tk))
- throw new ArgumentOutOfRangeException(nameof(metadataToken),
- Environment.GetResourceString("Argument_InvalidToken", tk, this));
-
- RuntimeTypeHandle[] typeArgs = ConvertToTypeHandleArray(genericTypeArguments);
- RuntimeTypeHandle[] methodArgs = ConvertToTypeHandleArray(genericMethodArguments);
-
- try
- {
- if (!tk.IsMethodDef && !tk.IsMethodSpec)
- {
- if (!tk.IsMemberRef)
- throw new ArgumentException(Environment.GetResourceString("Argument_ResolveMethod", tk, this),
- nameof(metadataToken));
-
- unsafe
- {
- ConstArray sig = MetadataImport.GetMemberRefProps(tk);
-
- if (*(MdSigCallingConvention*)sig.Signature.ToPointer() == MdSigCallingConvention.Field)
- throw new ArgumentException(Environment.GetResourceString("Argument_ResolveMethod", tk, this),
- nameof(metadataToken));
- }
- }
-
- IRuntimeMethodInfo methodHandle = ModuleHandle.ResolveMethodHandleInternal(GetNativeHandle(), tk, typeArgs, methodArgs);
- Type declaringType = RuntimeMethodHandle.GetDeclaringType(methodHandle);
-
- if (declaringType.IsGenericType || declaringType.IsArray)
- {
- MetadataToken tkDeclaringType = new MetadataToken(MetadataImport.GetParentToken(tk));
-
- if (tk.IsMethodSpec)
- tkDeclaringType = new MetadataToken(MetadataImport.GetParentToken(tkDeclaringType));
-
- declaringType = ResolveType(tkDeclaringType, genericTypeArguments, genericMethodArguments);
- }
-
- return System.RuntimeType.GetMethodBase(declaringType as RuntimeType, methodHandle);
- }
- catch (BadImageFormatException e)
- {
- throw new ArgumentException(Environment.GetResourceString("Argument_BadImageFormatExceptionResolve"), e);
- }
- }
-
- private FieldInfo ResolveLiteralField(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- MetadataToken tk = new MetadataToken(metadataToken);
-
- if (!MetadataImport.IsValidToken(tk) || !tk.IsFieldDef)
- throw new ArgumentOutOfRangeException(nameof(metadataToken),
- String.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString("Argument_InvalidToken", tk, this)));
-
- int tkDeclaringType;
- string fieldName;
-
- fieldName = MetadataImport.GetName(tk).ToString();
- tkDeclaringType = MetadataImport.GetParentToken(tk);
-
- Type declaringType = ResolveType(tkDeclaringType, genericTypeArguments, genericMethodArguments);
-
- declaringType.GetFields();
-
- try
- {
- return declaringType.GetField(fieldName,
- BindingFlags.Static | BindingFlags.Instance |
- BindingFlags.Public | BindingFlags.NonPublic |
- BindingFlags.DeclaredOnly);
- }
- catch
- {
- throw new ArgumentException(Environment.GetResourceString("Argument_ResolveField", tk, this), nameof(metadataToken));
- }
- }
-
- public override FieldInfo ResolveField(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- MetadataToken tk = new MetadataToken(metadataToken);
-
- if (!MetadataImport.IsValidToken(tk))
- throw new ArgumentOutOfRangeException(nameof(metadataToken),
- Environment.GetResourceString("Argument_InvalidToken", tk, this));
-
- RuntimeTypeHandle[] typeArgs = ConvertToTypeHandleArray(genericTypeArguments);
- RuntimeTypeHandle[] methodArgs = ConvertToTypeHandleArray(genericMethodArguments);
-
- try
- {
- IRuntimeFieldInfo fieldHandle = null;
-
- if (!tk.IsFieldDef)
- {
- if (!tk.IsMemberRef)
- throw new ArgumentException(Environment.GetResourceString("Argument_ResolveField", tk, this),
- nameof(metadataToken));
-
- unsafe
- {
- ConstArray sig = MetadataImport.GetMemberRefProps(tk);
-
- if (*(MdSigCallingConvention*)sig.Signature.ToPointer() != MdSigCallingConvention.Field)
- throw new ArgumentException(Environment.GetResourceString("Argument_ResolveField", tk, this),
- nameof(metadataToken));
- }
-
- fieldHandle = ModuleHandle.ResolveFieldHandleInternal(GetNativeHandle(), tk, typeArgs, methodArgs);
- }
-
- fieldHandle = ModuleHandle.ResolveFieldHandleInternal(GetNativeHandle(), metadataToken, typeArgs, methodArgs);
- RuntimeType declaringType = RuntimeFieldHandle.GetApproxDeclaringType(fieldHandle.Value);
-
- if (declaringType.IsGenericType || declaringType.IsArray)
- {
- int tkDeclaringType = ModuleHandle.GetMetadataImport(GetNativeHandle()).GetParentToken(metadataToken);
- declaringType = (RuntimeType)ResolveType(tkDeclaringType, genericTypeArguments, genericMethodArguments);
- }
-
- return System.RuntimeType.GetFieldInfo(declaringType, fieldHandle);
- }
- catch (MissingFieldException)
- {
- return ResolveLiteralField(tk, genericTypeArguments, genericMethodArguments);
- }
- catch (BadImageFormatException e)
- {
- throw new ArgumentException(Environment.GetResourceString("Argument_BadImageFormatExceptionResolve"), e);
- }
- }
-
- public override Type ResolveType(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- MetadataToken tk = new MetadataToken(metadataToken);
-
- if (tk.IsGlobalTypeDefToken)
- throw new ArgumentException(Environment.GetResourceString("Argument_ResolveModuleType", tk), nameof(metadataToken));
-
- if (!MetadataImport.IsValidToken(tk))
- throw new ArgumentOutOfRangeException(nameof(metadataToken),
- Environment.GetResourceString("Argument_InvalidToken", tk, this));
-
- if (!tk.IsTypeDef && !tk.IsTypeSpec && !tk.IsTypeRef)
- throw new ArgumentException(Environment.GetResourceString("Argument_ResolveType", tk, this), nameof(metadataToken));
-
- RuntimeTypeHandle[] typeArgs = ConvertToTypeHandleArray(genericTypeArguments);
- RuntimeTypeHandle[] methodArgs = ConvertToTypeHandleArray(genericMethodArguments);
-
- try
- {
- Type t = GetModuleHandle().ResolveTypeHandle(metadataToken, typeArgs, methodArgs).GetRuntimeType();
-
- if (t == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_ResolveType", tk, this), nameof(metadataToken));
-
- return t;
- }
- catch (BadImageFormatException e)
- {
- throw new ArgumentException(Environment.GetResourceString("Argument_BadImageFormatExceptionResolve"), e);
- }
- }
-
- public override MemberInfo ResolveMember(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
- {
- MetadataToken tk = new MetadataToken(metadataToken);
-
- if (tk.IsProperty)
- throw new ArgumentException(Environment.GetResourceString("InvalidOperation_PropertyInfoNotAvailable"));
-
- if (tk.IsEvent)
- throw new ArgumentException(Environment.GetResourceString("InvalidOperation_EventInfoNotAvailable"));
-
- if (tk.IsMethodSpec || tk.IsMethodDef)
- return ResolveMethod(metadataToken, genericTypeArguments, genericMethodArguments);
-
- if (tk.IsFieldDef)
- return ResolveField(metadataToken, genericTypeArguments, genericMethodArguments);
-
- if (tk.IsTypeRef || tk.IsTypeDef || tk.IsTypeSpec)
- return ResolveType(metadataToken, genericTypeArguments, genericMethodArguments);
-
- if (tk.IsMemberRef)
- {
- if (!MetadataImport.IsValidToken(tk))
- throw new ArgumentOutOfRangeException(nameof(metadataToken),
- Environment.GetResourceString("Argument_InvalidToken", tk, this));
-
- ConstArray sig = MetadataImport.GetMemberRefProps(tk);
-
- unsafe
- {
- if (*(MdSigCallingConvention*)sig.Signature.ToPointer() == MdSigCallingConvention.Field)
- {
- return ResolveField(tk, genericTypeArguments, genericMethodArguments);
- }
- else
- {
- return ResolveMethod(tk, genericTypeArguments, genericMethodArguments);
- }
- }
- }
-
- throw new ArgumentException(Environment.GetResourceString("Argument_ResolveMember", tk, this),
- nameof(metadataToken));
- }
-
- public override string ResolveString(int metadataToken)
- {
- MetadataToken tk = new MetadataToken(metadataToken);
- if (!tk.IsString)
- throw new ArgumentException(
- String.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString("Argument_ResolveString"), metadataToken, ToString()));
-
- if (!MetadataImport.IsValidToken(tk))
- throw new ArgumentOutOfRangeException(nameof(metadataToken),
- String.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString("Argument_InvalidToken", tk, this)));
-
- string str = MetadataImport.GetUserString(metadataToken);
-
- if (str == null)
- throw new ArgumentException(
- String.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString("Argument_ResolveString"), metadataToken, ToString()));
-
- return str;
- }
-
- public override void GetPEKind(out PortableExecutableKinds peKind, out ImageFileMachine machine)
- {
- ModuleHandle.GetPEKind(GetNativeHandle(), out peKind, out machine);
- }
-
- public override int MDStreamVersion
- {
- get
- {
- return ModuleHandle.GetMDStreamVersion(GetNativeHandle());
- }
- }
- #endregion
-
- #region Data Members
-#pragma warning disable 169
- // If you add any data members, you need to update the native declaration ReflectModuleBaseObject.
- private RuntimeType m_runtimeType;
- private RuntimeAssembly m_runtimeAssembly;
- private IntPtr m_pRefClass;
- private IntPtr m_pData;
- private IntPtr m_pGlobals;
- private IntPtr m_pFields;
-#pragma warning restore 169
- #endregion
-
- #region Protected Virtuals
- protected override MethodInfo GetMethodImpl(String name, BindingFlags bindingAttr, Binder binder,
- CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
- {
- return GetMethodInternal(name, bindingAttr, binder, callConvention, types, modifiers);
- }
-
- internal MethodInfo GetMethodInternal(String name, BindingFlags bindingAttr, Binder binder,
- CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
- {
- if (RuntimeType == null)
- return null;
-
- if (types == null)
- {
- return RuntimeType.GetMethod(name, bindingAttr);
- }
- else
- {
- return RuntimeType.GetMethod(name, bindingAttr, binder, callConvention, types, modifiers);
- }
- }
- #endregion
-
- #region Internal Members
- internal RuntimeType RuntimeType
- {
- get
- {
- if (m_runtimeType == null)
- m_runtimeType = ModuleHandle.GetModuleType(GetNativeHandle());
-
- return m_runtimeType;
- }
- }
-
- internal bool IsTransientInternal()
- {
- return RuntimeModule.nIsTransientInternal(this.GetNativeHandle());
- }
-
- internal MetadataImport MetadataImport
- {
- get
- {
- unsafe
- {
- return ModuleHandle.GetMetadataImport(GetNativeHandle());
- }
- }
- }
- #endregion
-
- #region ICustomAttributeProvider Members
- public override Object[] GetCustomAttributes(bool inherit)
- {
- return CustomAttribute.GetCustomAttributes(this, typeof(object) as RuntimeType);
- }
-
- public override Object[] GetCustomAttributes(Type attributeType, bool inherit)
- {
- if (attributeType == null)
- throw new ArgumentNullException(nameof(attributeType));
- Contract.EndContractBlock();
-
- RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
-
- if (attributeRuntimeType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(attributeType));
-
- return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
- }
-
- public override bool IsDefined(Type attributeType, bool inherit)
- {
- if (attributeType == null)
- throw new ArgumentNullException(nameof(attributeType));
- Contract.EndContractBlock();
-
- RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
-
- if (attributeRuntimeType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(attributeType));
-
- return CustomAttribute.IsDefined(this, attributeRuntimeType);
- }
-
- public override IList<CustomAttributeData> GetCustomAttributesData()
- {
- return CustomAttributeData.GetCustomAttributesInternal(this);
- }
- #endregion
-
- #region Public Virtuals
- public override void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- if (info == null)
- {
- throw new ArgumentNullException(nameof(info));
- }
- Contract.EndContractBlock();
- UnitySerializationHolder.GetUnitySerializationInfo(info, UnitySerializationHolder.ModuleUnity, this.ScopeName, this.GetRuntimeAssembly());
- }
-
- public override Type GetType(String className, bool throwOnError, bool ignoreCase)
- {
- // throw on null strings regardless of the value of "throwOnError"
- if (className == null)
- throw new ArgumentNullException(nameof(className));
-
- RuntimeType retType = null;
- Object keepAlive = null;
- GetType(GetNativeHandle(), className, throwOnError, ignoreCase, JitHelpers.GetObjectHandleOnStack(ref retType), JitHelpers.GetObjectHandleOnStack(ref keepAlive));
- GC.KeepAlive(keepAlive);
- return retType;
- }
-
- internal string GetFullyQualifiedName()
- {
- String fullyQualifiedName = null;
- GetFullyQualifiedName(GetNativeHandle(), JitHelpers.GetStringHandleOnStack(ref fullyQualifiedName));
- return fullyQualifiedName;
- }
-
- public override String FullyQualifiedName
- {
- get
- {
- return GetFullyQualifiedName();
- }
- }
-
- public override Type[] GetTypes()
- {
- return GetTypes(GetNativeHandle());
- }
-
- #endregion
-
- #region Public Members
-
- public override Guid ModuleVersionId
- {
- get
- {
- unsafe
- {
- Guid mvid;
- MetadataImport.GetScopeProps(out mvid);
- return mvid;
- }
- }
- }
-
- public override int MetadataToken
- {
- get
- {
- return ModuleHandle.GetToken(GetNativeHandle());
- }
- }
-
- public override bool IsResource()
- {
- return IsResource(GetNativeHandle());
- }
-
- public override FieldInfo[] GetFields(BindingFlags bindingFlags)
- {
- if (RuntimeType == null)
- return new FieldInfo[0];
-
- return RuntimeType.GetFields(bindingFlags);
- }
-
- public override FieldInfo GetField(String name, BindingFlags bindingAttr)
- {
- if (name == null)
- throw new ArgumentNullException(nameof(name));
-
- if (RuntimeType == null)
- return null;
-
- return RuntimeType.GetField(name, bindingAttr);
- }
-
- public override MethodInfo[] GetMethods(BindingFlags bindingFlags)
- {
- if (RuntimeType == null)
- return new MethodInfo[0];
-
- return RuntimeType.GetMethods(bindingFlags);
- }
-
- public override String ScopeName
- {
- get
- {
- string scopeName = null;
- GetScopeName(GetNativeHandle(), JitHelpers.GetStringHandleOnStack(ref scopeName));
- return scopeName;
- }
- }
-
- public override String Name
- {
- get
- {
- String s = GetFullyQualifiedName();
-
-#if !FEATURE_PAL
- int i = s.LastIndexOf('\\');
-#else
- int i = s.LastIndexOf(System.IO.Path.DirectorySeparatorChar);
-#endif
- if (i == -1)
- return s;
-
- return s.Substring(i + 1);
- }
- }
-
- public override Assembly Assembly
- {
- [Pure]
- get
- {
- return GetRuntimeAssembly();
- }
- }
-
- internal RuntimeAssembly GetRuntimeAssembly()
- {
- return m_runtimeAssembly;
- }
-
-
- internal override ModuleHandle GetModuleHandle()
- {
- return new ModuleHandle(this);
- }
-
- internal RuntimeModule GetNativeHandle()
- {
- return this;
- }
- #endregion
- }
-}
diff --git a/src/mscorlib/src/System/Reflection/Pointer.cs b/src/mscorlib/src/System/Reflection/Pointer.cs
deleted file mode 100644
index 91e205e3a7..0000000000
--- a/src/mscorlib/src/System/Reflection/Pointer.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-// 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.
-
-////////////////////////////////////////////////////////////////////////////////
-//
-// This is a wrapper class for Pointers
-//
-//
-//
-//
-//
-
-namespace System.Reflection
-{
- using System;
- using CultureInfo = System.Globalization.CultureInfo;
- using System.Runtime.Serialization;
- using System.Security;
- using System.Diagnostics.Contracts;
-
- [CLSCompliant(false)]
- [Serializable]
- public sealed class Pointer : ISerializable
- {
- unsafe private void* _ptr;
- private RuntimeType _ptrType;
-
- private Pointer() { }
-
- private unsafe Pointer(SerializationInfo info, StreamingContext context)
- {
- _ptr = ((IntPtr)(info.GetValue("_ptr", typeof(IntPtr)))).ToPointer();
- _ptrType = (RuntimeType)info.GetValue("_ptrType", typeof(RuntimeType));
- }
-
- // This method will box an pointer. We save both the
- // value and the type so we can access it from the native code
- // during an Invoke.
- public static unsafe Object Box(void* ptr, Type type)
- {
- if (type == null)
- throw new ArgumentNullException(nameof(type));
- if (!type.IsPointer)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBePointer"), nameof(ptr));
- Contract.EndContractBlock();
-
- RuntimeType rt = type as RuntimeType;
- if (rt == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBePointer"), nameof(ptr));
-
- Pointer x = new Pointer();
- x._ptr = ptr;
- x._ptrType = rt;
- return x;
- }
-
- // Returned the stored pointer.
- public static unsafe void* Unbox(Object ptr)
- {
- if (!(ptr is Pointer))
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBePointer"), nameof(ptr));
- return ((Pointer)ptr)._ptr;
- }
-
- internal RuntimeType GetPointerType()
- {
- return _ptrType;
- }
-
- internal unsafe Object GetPointerValue()
- {
- return (IntPtr)_ptr;
- }
-
- unsafe void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
- {
- info.AddValue("_ptr", new IntPtr(_ptr));
- info.AddValue("_ptrType", _ptrType);
- }
- }
-}
diff --git a/src/mscorlib/src/System/Reflection/ReflectionTypeLoadException.cs b/src/mscorlib/src/System/Reflection/ReflectionTypeLoadException.cs
deleted file mode 100644
index 908b79513d..0000000000
--- a/src/mscorlib/src/System/Reflection/ReflectionTypeLoadException.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-// 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.
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// ReflectionTypeLoadException is thrown when multiple TypeLoadExceptions may occur.
-//
-// Specifically, when you call Module.GetTypes() this causes multiple class loads to occur.
-// If there are failures, we continue to load classes and build an array of the successfully
-// loaded classes. We also build an array of the errors that occur. Then we throw this exception
-// which exposes both the array of classes and the array of TypeLoadExceptions.
-//
-//
-//
-//
-
-using System;
-using System.Runtime.Serialization;
-using System.Diagnostics.Contracts;
-
-namespace System.Reflection
-{
- [Serializable]
- public sealed class ReflectionTypeLoadException : SystemException, ISerializable
- {
- private Type[] _classes;
- private Exception[] _exceptions;
-
- // private constructor. This is not called.
- private ReflectionTypeLoadException()
- : base(Environment.GetResourceString("ReflectionTypeLoad_LoadFailed"))
- {
- SetErrorCode(__HResults.COR_E_REFLECTIONTYPELOAD);
- }
-
- public ReflectionTypeLoadException(Type[] classes, Exception[] exceptions) : base(null)
- {
- _classes = classes;
- _exceptions = exceptions;
- SetErrorCode(__HResults.COR_E_REFLECTIONTYPELOAD);
- }
-
- public ReflectionTypeLoadException(Type[] classes, Exception[] exceptions, String message) : base(message)
- {
- _classes = classes;
- _exceptions = exceptions;
- SetErrorCode(__HResults.COR_E_REFLECTIONTYPELOAD);
- }
-
- internal ReflectionTypeLoadException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- _classes = (Type[])(info.GetValue("Types", typeof(Type[])));
- _exceptions = (Exception[])(info.GetValue("Exceptions", typeof(Exception[])));
- }
-
- public Type[] Types
- {
- get { return _classes; }
- }
-
- public Exception[] LoaderExceptions
- {
- get { return _exceptions; }
- }
-
- public override void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- if (info == null)
- {
- throw new ArgumentNullException(nameof(info));
- }
- Contract.EndContractBlock();
- base.GetObjectData(info, context);
- info.AddValue("Types", _classes, typeof(Type[]));
- info.AddValue("Exceptions", _exceptions, typeof(Exception[]));
- }
- }
-}
diff --git a/src/mscorlib/src/System/Reflection/ResourceAttributes.cs b/src/mscorlib/src/System/Reflection/ResourceAttributes.cs
deleted file mode 100644
index d751a54278..0000000000
--- a/src/mscorlib/src/System/Reflection/ResourceAttributes.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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.
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// ResourceAttributes is an enum which defines the attributes that may be associated
-//
-// with a manifest resource. The values here are defined in Corhdr.h.
-//
-//
-
-using System;
-
-namespace System.Reflection
-{
- [Serializable]
- [Flags]
- public enum ResourceAttributes
- {
- Public = 0x0001,
- Private = 0x0002,
- }
-}
diff --git a/src/mscorlib/src/System/Reflection/RtFieldInfo.cs b/src/mscorlib/src/System/Reflection/RtFieldInfo.cs
new file mode 100644
index 0000000000..20d6e6392f
--- /dev/null
+++ b/src/mscorlib/src/System/Reflection/RtFieldInfo.cs
@@ -0,0 +1,390 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Diagnostics;
+using System.Diagnostics.Contracts;
+using System.Globalization;
+using System.Runtime.CompilerServices;
+using System.Threading;
+using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache;
+
+namespace System.Reflection
+{
+ [Serializable]
+ internal unsafe sealed class RtFieldInfo : RuntimeFieldInfo, IRuntimeFieldInfo
+ {
+ #region FCalls
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static private extern void PerformVisibilityCheckOnField(IntPtr field, Object target, RuntimeType declaringType, FieldAttributes attr, uint invocationFlags);
+ #endregion
+
+ #region Private Data Members
+ // agressive caching
+ private IntPtr m_fieldHandle;
+ private FieldAttributes m_fieldAttributes;
+ // lazy caching
+ private string m_name;
+ private RuntimeType m_fieldType;
+ private INVOCATION_FLAGS m_invocationFlags;
+
+ internal INVOCATION_FLAGS InvocationFlags
+ {
+ get
+ {
+ if ((m_invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_INITIALIZED) == 0)
+ {
+ Type declaringType = DeclaringType;
+ bool fIsReflectionOnlyType = (declaringType is ReflectionOnlyType);
+
+ INVOCATION_FLAGS invocationFlags = 0;
+
+ // first take care of all the NO_INVOKE cases
+ if (
+ (declaringType != null && declaringType.ContainsGenericParameters) ||
+ (declaringType == null && Module.Assembly.ReflectionOnly) ||
+ (fIsReflectionOnlyType)
+ )
+ {
+ invocationFlags |= INVOCATION_FLAGS.INVOCATION_FLAGS_NO_INVOKE;
+ }
+
+ // If the invocationFlags are still 0, then
+ // this should be an usable field, determine the other flags
+ if (invocationFlags == 0)
+ {
+ if ((m_fieldAttributes & FieldAttributes.InitOnly) != (FieldAttributes)0)
+ invocationFlags |= INVOCATION_FLAGS.INVOCATION_FLAGS_SPECIAL_FIELD;
+
+ if ((m_fieldAttributes & FieldAttributes.HasFieldRVA) != (FieldAttributes)0)
+ invocationFlags |= INVOCATION_FLAGS.INVOCATION_FLAGS_SPECIAL_FIELD;
+
+ // A public field is inaccesible to Transparent code if the field is Critical.
+ bool needsTransparencySecurityCheck = IsSecurityCritical && !IsSecuritySafeCritical;
+ bool needsVisibilitySecurityCheck = ((m_fieldAttributes & FieldAttributes.FieldAccessMask) != FieldAttributes.Public) ||
+ (declaringType != null && declaringType.NeedsReflectionSecurityCheck);
+ if (needsTransparencySecurityCheck || needsVisibilitySecurityCheck)
+ invocationFlags |= INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY;
+
+ // find out if the field type is one of the following: Primitive, Enum or Pointer
+ Type fieldType = FieldType;
+ if (fieldType.IsPointer || fieldType.IsEnum || fieldType.IsPrimitive)
+ invocationFlags |= INVOCATION_FLAGS.INVOCATION_FLAGS_FIELD_SPECIAL_CAST;
+ }
+
+ // must be last to avoid threading problems
+ m_invocationFlags = invocationFlags | INVOCATION_FLAGS.INVOCATION_FLAGS_INITIALIZED;
+ }
+
+ return m_invocationFlags;
+ }
+ }
+ #endregion
+
+ private RuntimeAssembly GetRuntimeAssembly() { return m_declaringType.GetRuntimeAssembly(); }
+
+ #region Constructor
+ internal RtFieldInfo(
+ RuntimeFieldHandleInternal handle, RuntimeType declaringType, RuntimeTypeCache reflectedTypeCache, BindingFlags bindingFlags)
+ : base(reflectedTypeCache, declaringType, bindingFlags)
+ {
+ m_fieldHandle = handle.Value;
+ m_fieldAttributes = RuntimeFieldHandle.GetAttributes(handle);
+ }
+ #endregion
+
+ #region Private Members
+ RuntimeFieldHandleInternal IRuntimeFieldInfo.Value
+ {
+ get
+ {
+ return new RuntimeFieldHandleInternal(m_fieldHandle);
+ }
+ }
+
+ #endregion
+
+ #region Internal Members
+ internal void CheckConsistency(Object target)
+ {
+ // only test instance fields
+ if ((m_fieldAttributes & FieldAttributes.Static) != FieldAttributes.Static)
+ {
+ if (!m_declaringType.IsInstanceOfType(target))
+ {
+ if (target == null)
+ {
+ throw new TargetException(SR.RFLCT_Targ_StatFldReqTarg);
+ }
+ else
+ {
+ throw new ArgumentException(
+ String.Format(CultureInfo.CurrentUICulture, SR.Arg_FieldDeclTarget,
+ Name, m_declaringType, target.GetType()));
+ }
+ }
+ }
+ }
+
+ internal override bool CacheEquals(object o)
+ {
+ RtFieldInfo m = o as RtFieldInfo;
+
+ if ((object)m == null)
+ return false;
+
+ return m.m_fieldHandle == m_fieldHandle;
+ }
+
+ [DebuggerStepThroughAttribute]
+ [Diagnostics.DebuggerHidden]
+ internal void InternalSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture, ref StackCrawlMark stackMark)
+ {
+ INVOCATION_FLAGS invocationFlags = InvocationFlags;
+ RuntimeType declaringType = DeclaringType as RuntimeType;
+
+ if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NO_INVOKE) != 0)
+ {
+ if (declaringType != null && declaringType.ContainsGenericParameters)
+ throw new InvalidOperationException(SR.Arg_UnboundGenField);
+
+ if ((declaringType == null && Module.Assembly.ReflectionOnly) || declaringType is ReflectionOnlyType)
+ throw new InvalidOperationException(SR.Arg_ReflectionOnlyField);
+
+ throw new FieldAccessException();
+ }
+
+ CheckConsistency(obj);
+
+ RuntimeType fieldType = (RuntimeType)FieldType;
+ value = fieldType.CheckValue(value, binder, culture, invokeAttr);
+
+ #region Security Check
+ if ((invocationFlags & (INVOCATION_FLAGS.INVOCATION_FLAGS_SPECIAL_FIELD | INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY)) != 0)
+ PerformVisibilityCheckOnField(m_fieldHandle, obj, m_declaringType, m_fieldAttributes, (uint)m_invocationFlags);
+ #endregion
+
+ bool domainInitialized = false;
+ if (declaringType == null)
+ {
+ RuntimeFieldHandle.SetValue(this, obj, value, fieldType, m_fieldAttributes, null, ref domainInitialized);
+ }
+ else
+ {
+ domainInitialized = declaringType.DomainInitialized;
+ RuntimeFieldHandle.SetValue(this, obj, value, fieldType, m_fieldAttributes, declaringType, ref domainInitialized);
+ declaringType.DomainInitialized = domainInitialized;
+ }
+ }
+
+ // UnsafeSetValue doesn't perform any consistency or visibility check.
+ // It is the caller's responsibility to ensure the operation is safe.
+ // When the caller needs to perform visibility checks they should call
+ // InternalSetValue() instead. When the caller needs to perform
+ // consistency checks they should call CheckConsistency() before
+ // calling this method.
+ [DebuggerStepThroughAttribute]
+ [Diagnostics.DebuggerHidden]
+ internal void UnsafeSetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture)
+ {
+ RuntimeType declaringType = DeclaringType as RuntimeType;
+ RuntimeType fieldType = (RuntimeType)FieldType;
+ value = fieldType.CheckValue(value, binder, culture, invokeAttr);
+
+ bool domainInitialized = false;
+ if (declaringType == null)
+ {
+ RuntimeFieldHandle.SetValue(this, obj, value, fieldType, m_fieldAttributes, null, ref domainInitialized);
+ }
+ else
+ {
+ domainInitialized = declaringType.DomainInitialized;
+ RuntimeFieldHandle.SetValue(this, obj, value, fieldType, m_fieldAttributes, declaringType, ref domainInitialized);
+ declaringType.DomainInitialized = domainInitialized;
+ }
+ }
+
+ [DebuggerStepThroughAttribute]
+ [Diagnostics.DebuggerHidden]
+ internal Object InternalGetValue(Object obj, ref StackCrawlMark stackMark)
+ {
+ INVOCATION_FLAGS invocationFlags = InvocationFlags;
+ RuntimeType declaringType = DeclaringType as RuntimeType;
+
+ if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NO_INVOKE) != 0)
+ {
+ if (declaringType != null && DeclaringType.ContainsGenericParameters)
+ throw new InvalidOperationException(SR.Arg_UnboundGenField);
+
+ if ((declaringType == null && Module.Assembly.ReflectionOnly) || declaringType is ReflectionOnlyType)
+ throw new InvalidOperationException(SR.Arg_ReflectionOnlyField);
+
+ throw new FieldAccessException();
+ }
+
+ CheckConsistency(obj);
+
+ RuntimeType fieldType = (RuntimeType)FieldType;
+ if ((invocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NEED_SECURITY) != 0)
+ PerformVisibilityCheckOnField(m_fieldHandle, obj, m_declaringType, m_fieldAttributes, (uint)(m_invocationFlags & ~INVOCATION_FLAGS.INVOCATION_FLAGS_SPECIAL_FIELD));
+
+ return UnsafeGetValue(obj);
+ }
+
+ // UnsafeGetValue doesn't perform any consistency or visibility check.
+ // It is the caller's responsibility to ensure the operation is safe.
+ // When the caller needs to perform visibility checks they should call
+ // InternalGetValue() instead. When the caller needs to perform
+ // consistency checks they should call CheckConsistency() before
+ // calling this method.
+ [DebuggerStepThroughAttribute]
+ [Diagnostics.DebuggerHidden]
+ internal Object UnsafeGetValue(Object obj)
+ {
+ RuntimeType declaringType = DeclaringType as RuntimeType;
+
+ RuntimeType fieldType = (RuntimeType)FieldType;
+
+ bool domainInitialized = false;
+ if (declaringType == null)
+ {
+ return RuntimeFieldHandle.GetValue(this, obj, fieldType, null, ref domainInitialized);
+ }
+ else
+ {
+ domainInitialized = declaringType.DomainInitialized;
+ object retVal = RuntimeFieldHandle.GetValue(this, obj, fieldType, declaringType, ref domainInitialized);
+ declaringType.DomainInitialized = domainInitialized;
+ return retVal;
+ }
+ }
+
+ #endregion
+
+ #region MemberInfo Overrides
+ public override String Name
+ {
+ get
+ {
+ if (m_name == null)
+ m_name = RuntimeFieldHandle.GetName(this);
+
+ return m_name;
+ }
+ }
+
+ internal String FullName
+ {
+ get
+ {
+ return String.Format("{0}.{1}", DeclaringType.FullName, Name);
+ }
+ }
+
+ public override int MetadataToken
+ {
+ get { return RuntimeFieldHandle.GetToken(this); }
+ }
+
+ internal override RuntimeModule GetRuntimeModule()
+ {
+ return RuntimeTypeHandle.GetModule(RuntimeFieldHandle.GetApproxDeclaringType(this));
+ }
+
+ #endregion
+
+ #region FieldInfo Overrides
+ public override Object GetValue(Object obj)
+ {
+ StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
+ return InternalGetValue(obj, ref stackMark);
+ }
+
+ public override object GetRawConstantValue() { throw new InvalidOperationException(); }
+
+ [DebuggerStepThroughAttribute]
+ [Diagnostics.DebuggerHidden]
+ public override Object GetValueDirect(TypedReference obj)
+ {
+ if (obj.IsNull)
+ throw new ArgumentException(SR.Arg_TypedReference_Null);
+ Contract.EndContractBlock();
+
+ unsafe
+ {
+ // Passing TypedReference by reference is easier to make correct in native code
+ return RuntimeFieldHandle.GetValueDirect(this, (RuntimeType)FieldType, &obj, (RuntimeType)DeclaringType);
+ }
+ }
+
+ [DebuggerStepThroughAttribute]
+ [Diagnostics.DebuggerHidden]
+ public override void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture)
+ {
+ StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
+ InternalSetValue(obj, value, invokeAttr, binder, culture, ref stackMark);
+ }
+
+ [DebuggerStepThroughAttribute]
+ [Diagnostics.DebuggerHidden]
+ public override void SetValueDirect(TypedReference obj, Object value)
+ {
+ if (obj.IsNull)
+ throw new ArgumentException(SR.Arg_TypedReference_Null);
+ Contract.EndContractBlock();
+
+ unsafe
+ {
+ // Passing TypedReference by reference is easier to make correct in native code
+ RuntimeFieldHandle.SetValueDirect(this, (RuntimeType)FieldType, &obj, value, (RuntimeType)DeclaringType);
+ }
+ }
+
+ public override RuntimeFieldHandle FieldHandle
+ {
+ get
+ {
+ Type declaringType = DeclaringType;
+ if ((declaringType == null && Module.Assembly.ReflectionOnly) || declaringType is ReflectionOnlyType)
+ throw new InvalidOperationException(SR.InvalidOperation_NotAllowedInReflectionOnly);
+ return new RuntimeFieldHandle(this);
+ }
+ }
+
+ internal IntPtr GetFieldHandle()
+ {
+ return m_fieldHandle;
+ }
+
+ public override FieldAttributes Attributes
+ {
+ get
+ {
+ return m_fieldAttributes;
+ }
+ }
+
+ public override Type FieldType
+ {
+ get
+ {
+ if (m_fieldType == null)
+ m_fieldType = new Signature(this, m_declaringType).FieldType;
+
+ return m_fieldType;
+ }
+ }
+
+ public override Type[] GetRequiredCustomModifiers()
+ {
+ return new Signature(this, m_declaringType).GetCustomModifiers(1, true);
+ }
+
+ public override Type[] GetOptionalCustomModifiers()
+ {
+ return new Signature(this, m_declaringType).GetCustomModifiers(1, false);
+ }
+
+ #endregion
+ }
+}
diff --git a/src/mscorlib/src/System/Reflection/Assembly.cs b/src/mscorlib/src/System/Reflection/RuntimeAssembly.cs
index 57ea5cabed..1cca9e1d55 100644
--- a/src/mscorlib/src/System/Reflection/Assembly.cs
+++ b/src/mscorlib/src/System/Reflection/RuntimeAssembly.cs
@@ -2,765 +2,22 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*=============================================================================
-**
-**
-**
-**
-**
-**
-** Purpose: For Assembly-related stuff.
-**
-**
-=============================================================================*/
+using System.Collections.Generic;
+using CultureInfo = System.Globalization.CultureInfo;
+using System.Security;
+using System.Security.Policy;
+using System.IO;
+using StringBuilder = System.Text.StringBuilder;
+using System.Configuration.Assemblies;
+using StackCrawlMark = System.Threading.StackCrawlMark;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+using System.Runtime.Serialization;
+using System.Threading;
+using System.Diagnostics.Contracts;
namespace System.Reflection
{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using CultureInfo = System.Globalization.CultureInfo;
- using System.Security;
- using System.Security.Policy;
- using System.IO;
- using StringBuilder = System.Text.StringBuilder;
- using System.Configuration.Assemblies;
- using StackCrawlMark = System.Threading.StackCrawlMark;
- using System.Runtime.InteropServices;
- using System.Runtime.CompilerServices;
- using System.Runtime.Serialization;
- using Microsoft.Win32;
- using System.Threading;
- using __HResults = System.__HResults;
- using System.Runtime.Versioning;
- using System.Diagnostics.Contracts;
- using System.Runtime.Loader;
-
- [Serializable]
- public delegate Module ModuleResolveEventHandler(Object sender, ResolveEventArgs e);
-
-
- [Serializable]
- public abstract class Assembly : ICustomAttributeProvider, ISerializable
- {
- protected Assembly() { }
-
- #region public static methods
-
- public static String CreateQualifiedName(String assemblyName, String typeName)
- {
- return typeName + ", " + assemblyName;
- }
-
- public static Assembly GetAssembly(Type type)
- {
- if (type == null)
- throw new ArgumentNullException(nameof(type));
- Contract.EndContractBlock();
-
- Module m = type.Module;
- if (m == null)
- return null;
- else
- return m.Assembly;
- }
-
- public static bool operator ==(Assembly left, Assembly right)
- {
- if (ReferenceEquals(left, right))
- return true;
-
- if ((object)left == null || (object)right == null ||
- left is RuntimeAssembly || right is RuntimeAssembly)
- {
- return false;
- }
- return left.Equals(right);
- }
-
- public static bool operator !=(Assembly left, Assembly right)
- {
- return !(left == right);
- }
-
- public override bool Equals(object o)
- {
- return base.Equals(o);
- }
-
- public override int GetHashCode()
- {
- return base.GetHashCode();
- }
-
- public static Assembly LoadFrom(String assemblyFile)
- {
- if (assemblyFile == null)
- throw new ArgumentNullException(nameof(assemblyFile));
- string fullPath = Path.GetFullPath(assemblyFile);
- return AssemblyLoadContext.Default.LoadFromAssemblyPath(fullPath);
- }
-
- // Locate an assembly for reflection by the name of the file containing the manifest.
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
- public static Assembly ReflectionOnlyLoadFrom(String assemblyFile)
- {
- if (assemblyFile == null)
- throw new ArgumentNullException(nameof(assemblyFile));
- if (assemblyFile.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Format_StringZeroLength"));
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_ReflectionOnlyLoad"));
- }
-
- // Evidence is protected in Assembly.Load()
- [Obsolete("This method is obsolete and will be removed in a future release of the .NET Framework. Please use an overload of LoadFrom which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
- internal static Assembly LoadFrom(String assemblyFile,
- Evidence securityEvidence)
- {
- Contract.Ensures(Contract.Result<Assembly>() != null);
-
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
-
- return RuntimeAssembly.InternalLoadFrom(
- assemblyFile,
- securityEvidence,
- null, // hashValue
- AssemblyHashAlgorithm.None,
- false,// forIntrospection);
- ref stackMark);
- }
-
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
- public static Assembly LoadFrom(String assemblyFile,
- byte[] hashValue,
- AssemblyHashAlgorithm hashAlgorithm)
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_AssemblyLoadFromHash"));
- }
-
- public static Assembly UnsafeLoadFrom(string assemblyFile)
- {
- return LoadFrom(assemblyFile);
- }
-
- // Locate an assembly by the long form of the assembly name.
- // eg. "Toolbox.dll, version=1.1.10.1220, locale=en, publickey=1234567890123456789012345678901234567890"
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
- public static Assembly Load(String assemblyString)
- {
- Contract.Ensures(Contract.Result<Assembly>() != null);
- Contract.Ensures(!Contract.Result<Assembly>().ReflectionOnly);
-
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- return RuntimeAssembly.InternalLoad(assemblyString, null, ref stackMark, false /*forIntrospection*/);
- }
-
- // Returns type from the assembly while keeping compatibility with Assembly.Load(assemblyString).GetType(typeName) for managed types.
- // Calls Type.GetType for WinRT types.
- // Note: Type.GetType fails for assembly names that start with weird characters like '['. By calling it for managed types we would
- // break AppCompat.
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
- internal static Type GetType_Compat(String assemblyString, String typeName)
- {
- // Normally we would get the stackMark only in public APIs. This is internal API, but it is AppCompat replacement of public API
- // call Assembly.Load(assemblyString).GetType(typeName), therefore we take the stackMark here as well, to be fully compatible with
- // the call sequence.
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
-
- RuntimeAssembly assembly;
- AssemblyName assemblyName = RuntimeAssembly.CreateAssemblyName(
- assemblyString,
- false /*forIntrospection*/,
- out assembly);
-
- if (assembly == null)
- {
- if (assemblyName.ContentType == AssemblyContentType.WindowsRuntime)
- {
- return Type.GetType(typeName + ", " + assemblyString, true /*throwOnError*/, false /*ignoreCase*/);
- }
-
- assembly = RuntimeAssembly.InternalLoadAssemblyName(
- assemblyName, null, null, ref stackMark,
- true /*thrownOnFileNotFound*/, false /*forIntrospection*/);
- }
- return assembly.GetType(typeName, true /*throwOnError*/, false /*ignoreCase*/);
- }
-
- // Locate an assembly for reflection by the long form of the assembly name.
- // eg. "Toolbox.dll, version=1.1.10.1220, locale=en, publickey=1234567890123456789012345678901234567890"
- //
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
- public static Assembly ReflectionOnlyLoad(String assemblyString)
- {
- if (assemblyString == null)
- throw new ArgumentNullException(nameof(assemblyString));
- if (assemblyString.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Format_StringZeroLength"));
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_ReflectionOnlyLoad"));
- }
-
- // Locate an assembly by its name. The name can be strong or
- // weak. The assembly is loaded into the domain of the caller.
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
- public static Assembly Load(AssemblyName assemblyRef)
- {
- Contract.Ensures(Contract.Result<Assembly>() != null);
- Contract.Ensures(!Contract.Result<Assembly>().ReflectionOnly);
-
- if (assemblyRef != null && assemblyRef.CodeBase != null)
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_AssemblyLoadCodeBase"));
- }
-
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- return RuntimeAssembly.InternalLoadAssemblyName(assemblyRef, null, null, ref stackMark, true /*thrownOnFileNotFound*/, false /*forIntrospection*/);
- }
-
- // Locate an assembly by its name. The name can be strong or
- // weak. The assembly is loaded into the domain of the caller.
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
- internal static Assembly Load(AssemblyName assemblyRef, IntPtr ptrLoadContextBinder)
- {
- Contract.Ensures(Contract.Result<Assembly>() != null);
- Contract.Ensures(!Contract.Result<Assembly>().ReflectionOnly);
-
- if (assemblyRef != null && assemblyRef.CodeBase != null)
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_AssemblyLoadCodeBase"));
- }
-
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- return RuntimeAssembly.InternalLoadAssemblyName(assemblyRef, null, null, ref stackMark, true /*thrownOnFileNotFound*/, false /*forIntrospection*/, ptrLoadContextBinder);
- }
-
- [Obsolete("This method has been deprecated. Please use Assembly.Load() instead. http://go.microsoft.com/fwlink/?linkid=14202")]
- public static Assembly LoadWithPartialName(String partialName)
- {
- if (partialName == null)
- throw new ArgumentNullException(nameof(partialName));
- return Load(partialName);
- }
-
- // Loads the assembly with a COFF based IMAGE containing
- // an emitted assembly. The assembly is loaded into the domain
- // of the caller.
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
- public static Assembly Load(byte[] rawAssembly)
- {
- Contract.Ensures(Contract.Result<Assembly>() != null);
- Contract.Ensures(!Contract.Result<Assembly>().ReflectionOnly);
-
- AppDomain.CheckLoadByteArraySupported();
-
- return Load(rawAssembly, null);
- }
-
- // Loads the assembly for reflection with a COFF based IMAGE containing
- // an emitted assembly. The assembly is loaded into the domain
- // of the caller.
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
- public static Assembly ReflectionOnlyLoad(byte[] rawAssembly)
- {
- if (rawAssembly == null)
- throw new ArgumentNullException(nameof(rawAssembly));
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_ReflectionOnlyLoad"));
- }
-
- // Loads the assembly with a COFF based IMAGE containing
- // an emitted assembly. The assembly is loaded into the domain
- // of the caller. The second parameter is the raw bytes
- // representing the symbol store that matches the assembly.
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
- public static Assembly Load(byte[] rawAssembly,
- byte[] rawSymbolStore)
- {
- Contract.Ensures(Contract.Result<Assembly>() != null);
- Contract.Ensures(!Contract.Result<Assembly>().ReflectionOnly);
-
- AppDomain.CheckLoadByteArraySupported();
-
- if (rawAssembly == null)
- throw new ArgumentNullException(nameof(rawAssembly));
- AssemblyLoadContext alc = new IndividualAssemblyLoadContext();
- MemoryStream assemblyStream = new MemoryStream(rawAssembly);
- MemoryStream symbolStream = (rawSymbolStore != null) ? new MemoryStream(rawSymbolStore) : null;
- return alc.LoadFromStream(assemblyStream, symbolStream);
- }
-
- private static Dictionary<string, Assembly> s_loadfile = new Dictionary<string, Assembly>();
-
- public static Assembly LoadFile(String path)
- {
- Contract.Ensures(Contract.Result<Assembly>() != null);
- Contract.Ensures(!Contract.Result<Assembly>().ReflectionOnly);
-
- AppDomain.CheckLoadFileSupported();
-
- Assembly result = null;
- if (path == null)
- throw new ArgumentNullException(nameof(path));
-
- if (PathInternal.IsPartiallyQualified(path))
- {
- throw new ArgumentException(Environment.GetResourceString("Argument_AbsolutePathRequired"), nameof(path));
- }
-
- string normalizedPath = Path.GetFullPath(path);
-
- lock (s_loadfile)
- {
- if (s_loadfile.TryGetValue(normalizedPath, out result))
- return result;
- AssemblyLoadContext alc = new IndividualAssemblyLoadContext();
- result = alc.LoadFromAssemblyPath(normalizedPath);
- s_loadfile.Add(normalizedPath, result);
- }
- return result;
- }
-
- /*
- * Get the assembly that the current code is running from.
- */
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
- public static Assembly GetExecutingAssembly()
- {
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- return RuntimeAssembly.GetExecutingAssembly(ref stackMark);
- }
-
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
- public static Assembly GetCallingAssembly()
- {
- // LookForMyCallersCaller is not guarantee to return the correct stack frame
- // because of inlining, tail calls, etc. As a result GetCallingAssembly is not
- // ganranteed to return the correct result. We should document it as such.
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCallersCaller;
- return RuntimeAssembly.GetExecutingAssembly(ref stackMark);
- }
-
- public static Assembly GetEntryAssembly()
- {
- AppDomainManager domainManager = AppDomain.CurrentDomain.DomainManager;
- if (domainManager == null)
- domainManager = new AppDomainManager();
- return domainManager.EntryAssembly;
- }
-
- #endregion // public static methods
-
- #region public methods
- public virtual event ModuleResolveEventHandler ModuleResolve
- {
- add
- {
- throw new NotImplementedException();
- }
- remove
- {
- throw new NotImplementedException();
- }
- }
-
- public virtual String CodeBase
- {
- get
- {
- throw new NotImplementedException();
- }
- }
-
- public virtual String EscapedCodeBase
- {
- get
- {
- return AssemblyName.EscapeCodeBase(CodeBase);
- }
- }
-
- public virtual AssemblyName GetName()
- {
- return GetName(false);
- }
-
- public virtual AssemblyName GetName(bool copiedName)
- {
- throw new NotImplementedException();
- }
-
- public virtual String FullName
- {
- get
- {
- throw new NotImplementedException();
- }
- }
-
- public virtual MethodInfo EntryPoint
- {
- get
- {
- throw new NotImplementedException();
- }
- }
-
- public virtual Type GetType(String name)
- {
- return GetType(name, false, false);
- }
-
- public virtual Type GetType(String name, bool throwOnError)
- {
- return GetType(name, throwOnError, false);
- }
-
- public virtual Type GetType(String name, bool throwOnError, bool ignoreCase)
- {
- throw new NotImplementedException();
- }
-
- public virtual IEnumerable<Type> ExportedTypes
- {
- get
- {
- return GetExportedTypes();
- }
- }
-
- public virtual Type[] GetExportedTypes()
- {
- throw new NotImplementedException();
- }
-
- public virtual IEnumerable<TypeInfo> DefinedTypes
- {
- get
- {
- Type[] types = GetTypes();
-
- TypeInfo[] typeinfos = new TypeInfo[types.Length];
-
- for (int i = 0; i < types.Length; i++)
- {
- TypeInfo typeinfo = types[i].GetTypeInfo();
- if (typeinfo == null)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NoTypeInfo", types[i].FullName));
-
- typeinfos[i] = typeinfo;
- }
-
- return typeinfos;
- }
- }
-
- public virtual Type[] GetTypes()
- {
- Module[] m = GetModules(false);
-
- int iFinalLength = 0;
- Type[][] ModuleTypes = new Type[m.Length][];
-
- for (int i = 0; i < ModuleTypes.Length; i++)
- {
- ModuleTypes[i] = m[i].GetTypes();
- iFinalLength += ModuleTypes[i].Length;
- }
-
- int iCurrent = 0;
- Type[] ret = new Type[iFinalLength];
- for (int i = 0; i < ModuleTypes.Length; i++)
- {
- int iLength = ModuleTypes[i].Length;
- Array.Copy(ModuleTypes[i], 0, ret, iCurrent, iLength);
- iCurrent += iLength;
- }
-
- return ret;
- }
-
- // Load a resource based on the NameSpace of the type.
- public virtual Stream GetManifestResourceStream(Type type, String name)
- {
- throw new NotImplementedException();
- }
-
- public virtual Stream GetManifestResourceStream(String name)
- {
- throw new NotImplementedException();
- }
-
- public virtual Assembly GetSatelliteAssembly(CultureInfo culture)
- {
- throw new NotImplementedException();
- }
-
- // Useful for binding to a very specific version of a satellite assembly
- public virtual Assembly GetSatelliteAssembly(CultureInfo culture, Version version)
- {
- throw new NotImplementedException();
- }
-
- public bool IsFullyTrusted
- {
- get
- {
- return true;
- }
- }
-
- public virtual SecurityRuleSet SecurityRuleSet
- {
- get
- {
- return SecurityRuleSet.None;
- }
- }
-
- // ISerializable implementation
- public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- throw new NotImplementedException();
- }
-
- public virtual Module ManifestModule
- {
- get
- {
- // This API was made virtual in V4. Code compiled against V2 might use
- // "call" rather than "callvirt" to call it.
- // This makes sure those code still works.
- RuntimeAssembly rtAssembly = this as RuntimeAssembly;
- if (rtAssembly != null)
- return rtAssembly.ManifestModule;
-
- throw new NotImplementedException();
- }
- }
-
- public virtual IEnumerable<CustomAttributeData> CustomAttributes
- {
- get
- {
- return GetCustomAttributesData();
- }
- }
- public virtual Object[] GetCustomAttributes(bool inherit)
- {
- Contract.Ensures(Contract.Result<Object[]>() != null);
- throw new NotImplementedException();
- }
-
- public virtual Object[] GetCustomAttributes(Type attributeType, bool inherit)
- {
- Contract.Ensures(Contract.Result<Object[]>() != null);
- throw new NotImplementedException();
- }
-
- public virtual bool IsDefined(Type attributeType, bool inherit)
- {
- throw new NotImplementedException();
- }
-
- public virtual IList<CustomAttributeData> GetCustomAttributesData()
- {
- throw new NotImplementedException();
- }
-
- public virtual bool ReflectionOnly
- {
- get
- {
- throw new NotImplementedException();
- }
- }
-
- public Module LoadModule(String moduleName,
- byte[] rawModule)
- {
- return LoadModule(moduleName, rawModule, null);
- }
-
- public virtual Module LoadModule(String moduleName,
- byte[] rawModule,
- byte[] rawSymbolStore)
- {
- throw new NotImplementedException();
- }
-
- //
- // Locates a type from this assembly and creates an instance of it using
- // the system activator.
- //
- public Object CreateInstance(String typeName)
- {
- return CreateInstance(typeName,
- false, // ignore case
- BindingFlags.Public | BindingFlags.Instance,
- null, // binder
- null, // args
- null, // culture
- null); // activation attributes
- }
-
- public Object CreateInstance(String typeName,
- bool ignoreCase)
- {
- return CreateInstance(typeName,
- ignoreCase,
- BindingFlags.Public | BindingFlags.Instance,
- null, // binder
- null, // args
- null, // culture
- null); // activation attributes
- }
-
- public virtual Object CreateInstance(String typeName,
- bool ignoreCase,
- BindingFlags bindingAttr,
- Binder binder,
- Object[] args,
- CultureInfo culture,
- Object[] activationAttributes)
- {
- Type t = GetType(typeName, false, ignoreCase);
- if (t == null) return null;
- return Activator.CreateInstance(t,
- bindingAttr,
- binder,
- args,
- culture,
- activationAttributes);
- }
-
- public virtual IEnumerable<Module> Modules
- {
- get
- {
- return GetLoadedModules(true);
- }
- }
-
- public Module[] GetLoadedModules()
- {
- return GetLoadedModules(false);
- }
-
- public virtual Module[] GetLoadedModules(bool getResourceModules)
- {
- throw new NotImplementedException();
- }
-
- public Module[] GetModules()
- {
- return GetModules(false);
- }
-
- public virtual Module[] GetModules(bool getResourceModules)
- {
- throw new NotImplementedException();
- }
-
- public virtual Module GetModule(String name)
- {
- throw new NotImplementedException();
- }
-
- // Returns the file in the File table of the manifest that matches the
- // given name. (Name should not include path.)
- public virtual FileStream GetFile(String name)
- {
- throw new NotImplementedException();
- }
-
- public virtual FileStream[] GetFiles()
- {
- return GetFiles(false);
- }
-
- public virtual FileStream[] GetFiles(bool getResourceModules)
- {
- throw new NotImplementedException();
- }
-
- // Returns the names of all the resources
- public virtual String[] GetManifestResourceNames()
- {
- throw new NotImplementedException();
- }
-
- public virtual AssemblyName[] GetReferencedAssemblies()
- {
- throw new NotImplementedException();
- }
-
- public virtual ManifestResourceInfo GetManifestResourceInfo(String resourceName)
- {
- throw new NotImplementedException();
- }
-
- public override String ToString()
- {
- String displayName = FullName;
- if (displayName == null)
- return base.ToString();
- else
- return displayName;
- }
-
- public virtual String Location
- {
- get
- {
- throw new NotImplementedException();
- }
- }
-
- public virtual String ImageRuntimeVersion
- {
- get
- {
- throw new NotImplementedException();
- }
- }
-
- /*
- Returns true if the assembly was loaded from the global assembly cache.
- */
- public virtual bool GlobalAssemblyCache
- {
- get
- {
- throw new NotImplementedException();
- }
- }
-
- public virtual Int64 HostContext
- {
- get
- {
- // This API was made virtual in V4. Code compiled against V2 might use
- // "call" rather than "callvirt" to call it.
- // This makes sure those code still works.
- RuntimeAssembly rtAssembly = this as RuntimeAssembly;
- if (rtAssembly != null)
- return rtAssembly.HostContext;
-
- throw new NotImplementedException();
- }
- }
-
- public virtual bool IsDynamic
- {
- get
- {
- return false;
- }
- }
- #endregion // public methods
-
- }
-
[Serializable]
internal class RuntimeAssembly : Assembly
{
@@ -1039,7 +296,7 @@ namespace System.Reflection
RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
if (attributeRuntimeType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(attributeType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));
return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
}
@@ -1053,7 +310,7 @@ namespace System.Reflection
RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
if (attributeRuntimeType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(attributeType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));
return CustomAttribute.IsDefined(this, attributeRuntimeType);
}
@@ -1125,7 +382,7 @@ namespace System.Reflection
if ((assemblyString.Length == 0) ||
(assemblyString[0] == '\0'))
- throw new ArgumentException(Environment.GetResourceString("Format_StringZeroLength"));
+ throw new ArgumentException(SR.Format_StringZeroLength);
if (forIntrospection)
AppDomain.CheckReflectionOnlyLoadSupported();
@@ -1458,7 +715,7 @@ namespace System.Reflection
{
//Console.WriteLine("Creating an unmanaged memory stream of length "+length);
if (length > Int64.MaxValue)
- throw new NotImplementedException(Environment.GetResourceString("NotImplemented_ResourcesLongerThan2^63"));
+ throw new NotImplementedException(SR.NotImplemented_ResourcesLongerThanInt64Max);
return new UnmanagedMemoryStream(pbInMemoryResource, (long)length, (long)length, FileAccess.Read);
}
@@ -1634,7 +891,7 @@ namespace System.Reflection
if (retAssembly == this || (retAssembly == null && throwOnFileNotFound))
{
- throw new FileNotFoundException(String.Format(culture, Environment.GetResourceString("IO.FileNotFound_FileName"), an.Name));
+ throw new FileNotFoundException(String.Format(culture, SR.IO_FileNotFound_FileName, an.Name));
}
return retAssembly;
diff --git a/src/mscorlib/src/System/Reflection/ConstructorInfo.cs b/src/mscorlib/src/System/Reflection/RuntimeConstructorInfo.cs
index 284134a5c0..8c3b1fce98 100644
--- a/src/mscorlib/src/System/Reflection/ConstructorInfo.cs
+++ b/src/mscorlib/src/System/Reflection/RuntimeConstructorInfo.cs
@@ -2,94 +2,15 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-//
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Diagnostics.Contracts;
+using System.Globalization;
+using System.Runtime.Serialization;
+using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache;
namespace System.Reflection
{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Diagnostics.Contracts;
- using System.Globalization;
- using System.Runtime;
- using System.Runtime.ConstrainedExecution;
- using System.Runtime.InteropServices;
- using System.Runtime.Serialization;
- using System.Security;
- using System.Threading;
- using MemberListType = System.RuntimeType.MemberListType;
- using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache;
- using System.Runtime.CompilerServices;
-
- [Serializable]
- public abstract class ConstructorInfo : MethodBase
- {
- #region Static Members
- public readonly static String ConstructorName = ".ctor";
-
- public readonly static String TypeConstructorName = ".cctor";
- #endregion
-
- #region Constructor
- protected ConstructorInfo() { }
- #endregion
-
- public static bool operator ==(ConstructorInfo left, ConstructorInfo right)
- {
- if (ReferenceEquals(left, right))
- return true;
-
- if ((object)left == null || (object)right == null ||
- left is RuntimeConstructorInfo || right is RuntimeConstructorInfo)
- {
- return false;
- }
- return left.Equals(right);
- }
-
- public static bool operator !=(ConstructorInfo left, ConstructorInfo right)
- {
- return !(left == right);
- }
-
- public override bool Equals(object obj)
- {
- return base.Equals(obj);
- }
-
- public override int GetHashCode()
- {
- return base.GetHashCode();
- }
-
- #region Internal Members
- internal virtual Type GetReturnType() { throw new NotImplementedException(); }
- #endregion
-
- #region MemberInfo Overrides
- public override MemberTypes MemberType { get { return System.Reflection.MemberTypes.Constructor; } }
- #endregion
-
- #region Public Abstract\Virtual Members
- public abstract Object Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture);
- #endregion
-
- #region Public Members
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- public Object Invoke(Object[] parameters)
- {
- // Theoretically we should set up a LookForMyCaller stack mark here and pass that along.
- // But to maintain backward compatibility we can't switch to calling an
- // internal overload that takes a stack mark.
- // Fortunately the stack walker skips all the reflection invocation frames including this one.
- // So this method will never be returned by the stack walker as the caller.
- // See SystemDomain::CallersMethodCallbackWithStackMark in AppDomain.cpp.
- return Invoke(BindingFlags.Default, null, parameters, null);
- }
- #endregion
- }
-
[Serializable]
internal sealed class RuntimeConstructorInfo : ConstructorInfo, ISerializable, IRuntimeMethodInfo
{
@@ -221,9 +142,9 @@ namespace System.Reflection
if (!m_declaringType.IsInstanceOfType(target))
{
if (target == null)
- throw new TargetException(Environment.GetResourceString("RFLCT.Targ_StatMethReqTarg"));
+ throw new TargetException(SR.RFLCT_Targ_StatMethReqTarg);
- throw new TargetException(Environment.GetResourceString("RFLCT.Targ_ITargMismatch"));
+ throw new TargetException(SR.RFLCT_Targ_ITargMismatch);
}
}
@@ -256,7 +177,7 @@ namespace System.Reflection
RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
if (attributeRuntimeType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(attributeType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));
return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
}
@@ -270,7 +191,7 @@ namespace System.Reflection
RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
if (attributeRuntimeType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(attributeType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));
return CustomAttribute.IsDefined(this, attributeRuntimeType);
}
@@ -356,7 +277,7 @@ namespace System.Reflection
{
Type declaringType = DeclaringType;
if ((declaringType == null && Module.Assembly.ReflectionOnly) || declaringType is ReflectionOnlyType)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotAllowedInReflectionOnly"));
+ throw new InvalidOperationException(SR.InvalidOperation_NotAllowedInReflectionOnly);
return new RuntimeMethodHandle(this);
}
}
@@ -385,17 +306,17 @@ namespace System.Reflection
// ctor is ReflectOnly
if (declaringType is ReflectionOnlyType)
- throw new InvalidOperationException(Environment.GetResourceString("Arg_ReflectionOnlyInvoke"));
+ throw new InvalidOperationException(SR.Arg_ReflectionOnlyInvoke);
// ctor is declared on interface class
else if (declaringType.IsInterface)
throw new MemberAccessException(
- String.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString("Acc_CreateInterfaceEx"), declaringType));
+ String.Format(CultureInfo.CurrentUICulture, SR.Acc_CreateInterfaceEx, declaringType));
// ctor is on an abstract class
else if (declaringType.IsAbstract)
throw new MemberAccessException(
- String.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString("Acc_CreateAbstEx"), declaringType));
+ String.Format(CultureInfo.CurrentUICulture, SR.Acc_CreateAbstEx, declaringType));
// ctor is on a class that contains stack pointers
else if (declaringType.GetRootElementType() == typeof(ArgIterator))
@@ -409,12 +330,12 @@ namespace System.Reflection
else if (declaringType.ContainsGenericParameters)
{
throw new MemberAccessException(
- String.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString("Acc_CreateGenericEx"), declaringType));
+ String.Format(CultureInfo.CurrentUICulture, SR.Acc_CreateGenericEx, declaringType));
}
// ctor is declared on System.Void
else if (declaringType == typeof(void))
- throw new MemberAccessException(Environment.GetResourceString("Access_Void"));
+ throw new MemberAccessException(SR.Access_Void);
}
internal void ThrowNoInvokeException()
@@ -423,7 +344,7 @@ namespace System.Reflection
// ctor is .cctor
if ((Attributes & MethodAttributes.Static) == MethodAttributes.Static)
- throw new MemberAccessException(Environment.GetResourceString("Acc_NotClassInit"));
+ throw new MemberAccessException(SR.Acc_NotClassInit);
throw new TargetException();
}
@@ -455,7 +376,7 @@ namespace System.Reflection
int formalCount = sig.Arguments.Length;
int actualCount = (parameters != null) ? parameters.Length : 0;
if (formalCount != actualCount)
- throw new TargetParameterCountException(Environment.GetResourceString("Arg_ParmCnt"));
+ throw new TargetParameterCountException(SR.Arg_ParmCnt);
// if we are here we passed all the previous checks. Time to look at the arguments
if (actualCount > 0)
@@ -522,7 +443,7 @@ namespace System.Reflection
int formalCount = sig.Arguments.Length;
int actualCount = (parameters != null) ? parameters.Length : 0;
if (formalCount != actualCount)
- throw new TargetParameterCountException(Environment.GetResourceString("Arg_ParmCnt"));
+ throw new TargetParameterCountException(SR.Arg_ParmCnt);
// We don't need to explicitly invoke the class constructor here,
// JIT/NGen will insert the call to .cctor in the instance ctor.
@@ -547,14 +468,7 @@ namespace System.Reflection
if (info == null)
throw new ArgumentNullException(nameof(info));
Contract.EndContractBlock();
- MemberInfoSerializationHolder.GetSerializationInfo(
- info,
- Name,
- ReflectedTypeInternal,
- ToString(),
- SerializationToString(),
- MemberTypes.Constructor,
- null);
+ MemberInfoSerializationHolder.GetSerializationInfo(info, this);
}
internal string SerializationToString()
diff --git a/src/mscorlib/src/System/Reflection/EventInfo.cs b/src/mscorlib/src/System/Reflection/RuntimeEventInfo.cs
index 1e2691ae75..930e1820bd 100644
--- a/src/mscorlib/src/System/Reflection/EventInfo.cs
+++ b/src/mscorlib/src/System/Reflection/RuntimeEventInfo.cs
@@ -2,189 +2,14 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-//
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Diagnostics.Contracts;
+using System.Runtime.Serialization;
+using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache;
namespace System.Reflection
{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Diagnostics.Contracts;
- using System.Runtime.InteropServices;
- using System.Runtime.Serialization;
- using System.Runtime.ConstrainedExecution;
- using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache;
-
- [Serializable]
- public abstract class EventInfo : MemberInfo
- {
- #region Constructor
- protected EventInfo() { }
- #endregion
-
- public static bool operator ==(EventInfo left, EventInfo right)
- {
- if (ReferenceEquals(left, right))
- return true;
-
- if ((object)left == null || (object)right == null ||
- left is RuntimeEventInfo || right is RuntimeEventInfo)
- {
- return false;
- }
- return left.Equals(right);
- }
-
- public static bool operator !=(EventInfo left, EventInfo right)
- {
- return !(left == right);
- }
-
- public override bool Equals(object obj)
- {
- return base.Equals(obj);
- }
-
- public override int GetHashCode()
- {
- return base.GetHashCode();
- }
-
- #region MemberInfo Overrides
- public override MemberTypes MemberType { get { return MemberTypes.Event; } }
- #endregion
-
- #region Public Abstract\Virtual Members
- public virtual MethodInfo[] GetOtherMethods(bool nonPublic)
- {
- throw new NotImplementedException();
- }
-
- public abstract MethodInfo GetAddMethod(bool nonPublic);
-
- public abstract MethodInfo GetRemoveMethod(bool nonPublic);
-
- public abstract MethodInfo GetRaiseMethod(bool nonPublic);
-
- public abstract EventAttributes Attributes { get; }
- #endregion
-
- #region Public Members
- public virtual MethodInfo AddMethod
- {
- get
- {
- return GetAddMethod(true);
- }
- }
-
- public virtual MethodInfo RemoveMethod
- {
- get
- {
- return GetRemoveMethod(true);
- }
- }
-
- public virtual MethodInfo RaiseMethod
- {
- get
- {
- return GetRaiseMethod(true);
- }
- }
-
- public MethodInfo[] GetOtherMethods() { return GetOtherMethods(false); }
-
- public MethodInfo GetAddMethod() { return GetAddMethod(false); }
-
- public MethodInfo GetRemoveMethod() { return GetRemoveMethod(false); }
-
- public MethodInfo GetRaiseMethod() { return GetRaiseMethod(false); }
-
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- public virtual void AddEventHandler(Object target, Delegate handler)
- {
- MethodInfo addMethod = GetAddMethod();
-
- if (addMethod == null)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NoPublicAddMethod"));
-
-#if FEATURE_COMINTEROP
- if (addMethod.ReturnType == typeof(System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken))
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotSupportedOnWinRTEvent"));
-
- // Must be a normal non-WinRT event
- Debug.Assert(addMethod.ReturnType == typeof(void));
-#endif // FEATURE_COMINTEROP
-
- addMethod.Invoke(target, new object[] { handler });
- }
-
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- public virtual void RemoveEventHandler(Object target, Delegate handler)
- {
- MethodInfo removeMethod = GetRemoveMethod();
-
- if (removeMethod == null)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NoPublicRemoveMethod"));
-
-#if FEATURE_COMINTEROP
- ParameterInfo[] parameters = removeMethod.GetParametersNoCopy();
- Debug.Assert(parameters != null && parameters.Length == 1);
-
- if (parameters[0].ParameterType == typeof(System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken))
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotSupportedOnWinRTEvent"));
-
- // Must be a normal non-WinRT event
- Debug.Assert(parameters[0].ParameterType.BaseType == typeof(MulticastDelegate));
-#endif // FEATURE_COMINTEROP
-
- removeMethod.Invoke(target, new object[] { handler });
- }
-
- public virtual Type EventHandlerType
- {
- get
- {
- MethodInfo m = GetAddMethod(true);
-
- ParameterInfo[] p = m.GetParametersNoCopy();
-
- Type del = typeof(Delegate);
-
- for (int i = 0; i < p.Length; i++)
- {
- Type c = p[i].ParameterType;
-
- if (c.IsSubclassOf(del))
- return c;
- }
- return null;
- }
- }
- public bool IsSpecialName
- {
- get
- {
- return (Attributes & EventAttributes.SpecialName) != 0;
- }
- }
-
- public virtual bool IsMulticast
- {
- get
- {
- Type cl = EventHandlerType;
- Type mc = typeof(MulticastDelegate);
- return mc.IsAssignableFrom(cl);
- }
- }
- #endregion
- }
-
[Serializable]
internal unsafe sealed class RuntimeEventInfo : EventInfo, ISerializable
{
@@ -251,7 +76,7 @@ namespace System.Reflection
public override String ToString()
{
if (m_addMethod == null || m_addMethod.GetParametersNoCopy().Length == 0)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NoPublicAddMethod"));
+ throw new InvalidOperationException(SR.InvalidOperation_NoPublicAddMethod);
return m_addMethod.GetParametersNoCopy()[0].ParameterType.FormatTypeName() + " " + Name;
}
@@ -272,7 +97,7 @@ namespace System.Reflection
RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
if (attributeRuntimeType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(attributeType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));
return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
}
@@ -286,7 +111,7 @@ namespace System.Reflection
RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
if (attributeRuntimeType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(attributeType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));
return CustomAttribute.IsDefined(this, attributeRuntimeType);
}
@@ -338,12 +163,7 @@ namespace System.Reflection
throw new ArgumentNullException(nameof(info));
Contract.EndContractBlock();
- MemberInfoSerializationHolder.GetSerializationInfo(
- info,
- Name,
- ReflectedTypeInternal,
- null,
- MemberTypes.Event);
+ MemberInfoSerializationHolder.GetSerializationInfo(info, this);
}
#endregion
diff --git a/src/mscorlib/src/System/Reflection/RuntimeFieldInfo.cs b/src/mscorlib/src/System/Reflection/RuntimeFieldInfo.cs
new file mode 100644
index 0000000000..29cc97d225
--- /dev/null
+++ b/src/mscorlib/src/System/Reflection/RuntimeFieldInfo.cs
@@ -0,0 +1,136 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Collections.Generic;
+using System.Diagnostics.Contracts;
+using System.Runtime.Serialization;
+using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache;
+
+namespace System.Reflection
+{
+ [Serializable]
+ internal abstract class RuntimeFieldInfo : FieldInfo, ISerializable
+ {
+ #region Private Data Members
+ private BindingFlags m_bindingFlags;
+ protected RuntimeTypeCache m_reflectedTypeCache;
+ protected RuntimeType m_declaringType;
+ #endregion
+
+ #region Constructor
+ protected RuntimeFieldInfo()
+ {
+ // Used for dummy head node during population
+ }
+ protected RuntimeFieldInfo(RuntimeTypeCache reflectedTypeCache, RuntimeType declaringType, BindingFlags bindingFlags)
+ {
+ m_bindingFlags = bindingFlags;
+ m_declaringType = declaringType;
+ m_reflectedTypeCache = reflectedTypeCache;
+ }
+ #endregion
+
+ #region NonPublic Members
+ internal BindingFlags BindingFlags { get { return m_bindingFlags; } }
+ private RuntimeType ReflectedTypeInternal
+ {
+ get
+ {
+ return m_reflectedTypeCache.GetRuntimeType();
+ }
+ }
+
+ internal RuntimeType GetDeclaringTypeInternal()
+ {
+ return m_declaringType;
+ }
+
+ internal RuntimeType GetRuntimeType() { return m_declaringType; }
+ internal abstract RuntimeModule GetRuntimeModule();
+ #endregion
+
+ #region MemberInfo Overrides
+ public override MemberTypes MemberType { get { return MemberTypes.Field; } }
+ public override Type ReflectedType
+ {
+ get
+ {
+ return m_reflectedTypeCache.IsGlobal ? null : ReflectedTypeInternal;
+ }
+ }
+
+ public override Type DeclaringType
+ {
+ get
+ {
+ return m_reflectedTypeCache.IsGlobal ? null : m_declaringType;
+ }
+ }
+
+ public override Module Module { get { return GetRuntimeModule(); } }
+ #endregion
+
+ #region Object Overrides
+ public unsafe override String ToString()
+ {
+ return FieldType.FormatTypeName() + " " + Name;
+ }
+ #endregion
+
+ #region ICustomAttributeProvider
+ public override Object[] GetCustomAttributes(bool inherit)
+ {
+ return CustomAttribute.GetCustomAttributes(this, typeof(object) as RuntimeType);
+ }
+
+ public override Object[] GetCustomAttributes(Type attributeType, bool inherit)
+ {
+ if (attributeType == null)
+ throw new ArgumentNullException(nameof(attributeType));
+ Contract.EndContractBlock();
+
+ RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
+
+ if (attributeRuntimeType == null)
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));
+
+ return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
+ }
+
+ public override bool IsDefined(Type attributeType, bool inherit)
+ {
+ if (attributeType == null)
+ throw new ArgumentNullException(nameof(attributeType));
+ Contract.EndContractBlock();
+
+ RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
+
+ if (attributeRuntimeType == null)
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));
+
+ return CustomAttribute.IsDefined(this, attributeRuntimeType);
+ }
+
+ public override IList<CustomAttributeData> GetCustomAttributesData()
+ {
+ return CustomAttributeData.GetCustomAttributesInternal(this);
+ }
+ #endregion
+
+ #region FieldInfo Overrides
+ // All implemented on derived classes
+ #endregion
+
+ #region ISerializable Implementation
+ public void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ if (info == null)
+ throw new ArgumentNullException(nameof(info));
+ Contract.EndContractBlock();
+
+ MemberInfoSerializationHolder.GetSerializationInfo(info, this);
+ }
+ #endregion
+ }
+}
diff --git a/src/mscorlib/src/System/Reflection/MethodInfo.cs b/src/mscorlib/src/System/Reflection/RuntimeMethodInfo.cs
index 2205ddac32..372d4f8d8e 100644
--- a/src/mscorlib/src/System/Reflection/MethodInfo.cs
+++ b/src/mscorlib/src/System/Reflection/RuntimeMethodInfo.cs
@@ -2,85 +2,18 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-//
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Diagnostics.Contracts;
+using System.Globalization;
+using System.Runtime.Serialization;
+using System.Security;
+using System.Text;
+using System.Threading;
+using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache;
namespace System.Reflection
{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Diagnostics.Contracts;
- using System.Globalization;
- using System.Runtime;
- using System.Runtime.InteropServices;
- using System.Runtime.ConstrainedExecution;
- using System.Runtime.Serialization;
- using System.Security;
- using System.Text;
- using System.Threading;
- using MemberListType = System.RuntimeType.MemberListType;
- using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache;
- using System.Runtime.CompilerServices;
-
- [Serializable]
- public abstract class MethodInfo : MethodBase
- {
- #region Constructor
- protected MethodInfo() { }
- #endregion
-
- public static bool operator ==(MethodInfo left, MethodInfo right)
- {
- if (ReferenceEquals(left, right))
- return true;
-
- if ((object)left == null || (object)right == null ||
- left is RuntimeMethodInfo || right is RuntimeMethodInfo)
- {
- return false;
- }
- return left.Equals(right);
- }
-
- public static bool operator !=(MethodInfo left, MethodInfo right)
- {
- return !(left == right);
- }
-
- public override bool Equals(object obj)
- {
- return base.Equals(obj);
- }
-
- public override int GetHashCode()
- {
- return base.GetHashCode();
- }
-
- #region MemberInfo Overrides
- public override MemberTypes MemberType { get { return System.Reflection.MemberTypes.Method; } }
- #endregion
-
- #region Public Abstract\Virtual Members
- public virtual Type ReturnType { get { throw new NotImplementedException(); } }
-
- public virtual ParameterInfo ReturnParameter { get { throw new NotImplementedException(); } }
-
- public abstract ICustomAttributeProvider ReturnTypeCustomAttributes { get; }
-
- public abstract MethodInfo GetBaseDefinition();
-
- public override Type[] GetGenericArguments() { throw new NotSupportedException(Environment.GetResourceString("NotSupported_SubclassOverride")); }
-
- public virtual MethodInfo GetGenericMethodDefinition() { throw new NotSupportedException(Environment.GetResourceString("NotSupported_SubclassOverride")); }
-
- public virtual MethodInfo MakeGenericMethod(params Type[] typeArguments) { throw new NotSupportedException(Environment.GetResourceString("NotSupported_SubclassOverride")); }
-
- 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
- }
-
[Serializable]
internal sealed class RuntimeMethodInfo : MethodInfo, ISerializable, IRuntimeMethodInfo
{
@@ -354,7 +287,7 @@ namespace System.Reflection
RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
if (attributeRuntimeType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(attributeType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));
return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType, inherit);
}
@@ -368,7 +301,7 @@ namespace System.Reflection
RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
if (attributeRuntimeType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(attributeType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));
return CustomAttribute.IsDefined(this, attributeRuntimeType, inherit);
}
@@ -471,7 +404,7 @@ namespace System.Reflection
{
Type declaringType = DeclaringType;
if ((declaringType == null && Module.Assembly.ReflectionOnly) || declaringType is ReflectionOnlyType)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotAllowedInReflectionOnly"));
+ throw new InvalidOperationException(SR.InvalidOperation_NotAllowedInReflectionOnly);
return new RuntimeMethodHandle(this);
}
}
@@ -504,9 +437,9 @@ namespace System.Reflection
if (!m_declaringType.IsInstanceOfType(target))
{
if (target == null)
- throw new TargetException(Environment.GetResourceString("RFLCT.Targ_StatMethReqTarg"));
+ throw new TargetException(SR.RFLCT_Targ_StatMethReqTarg);
else
- throw new TargetException(Environment.GetResourceString("RFLCT.Targ_ITargMismatch"));
+ throw new TargetException(SR.RFLCT_Targ_ITargMismatch);
}
}
}
@@ -517,7 +450,7 @@ namespace System.Reflection
Type declaringType = DeclaringType;
if ((declaringType == null && Module.Assembly.ReflectionOnly) || declaringType is ReflectionOnlyType)
{
- throw new InvalidOperationException(Environment.GetResourceString("Arg_ReflectionOnlyInvoke"));
+ throw new InvalidOperationException(SR.Arg_ReflectionOnlyInvoke);
}
// method is on a class that contains stack pointers
else if ((InvocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_CONTAINS_STACK_POINTERS) != 0)
@@ -532,7 +465,7 @@ namespace System.Reflection
// method is generic or on a generic class
else if (DeclaringType.ContainsGenericParameters || ContainsGenericParameters)
{
- throw new InvalidOperationException(Environment.GetResourceString("Arg_UnboundGenParam"));
+ throw new InvalidOperationException(SR.Arg_UnboundGenParam);
}
// method is abstract class
else if (IsAbstract)
@@ -542,7 +475,7 @@ namespace System.Reflection
// ByRef return are not allowed in reflection
else if (ReturnType.IsByRef)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_ByRefReturn"));
+ throw new NotSupportedException(SR.NotSupported_ByRefReturn);
}
throw new TargetException();
@@ -607,7 +540,7 @@ namespace System.Reflection
CheckConsistency(obj);
if (formalCount != actualCount)
- throw new TargetParameterCountException(Environment.GetResourceString("Arg_ParmCnt"));
+ throw new TargetParameterCountException(SR.Arg_ParmCnt);
if (actualCount != 0)
return CheckArguments(parameters, binder, invokeAttr, culture, sig);
@@ -709,15 +642,15 @@ namespace System.Reflection
RuntimeType rtType = delegateType as RuntimeType;
if (rtType == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"), nameof(delegateType));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(delegateType));
if (!rtType.IsDelegate())
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeDelegate"), nameof(delegateType));
+ throw new ArgumentException(SR.Arg_MustBeDelegate, nameof(delegateType));
Delegate d = Delegate.CreateDelegateInternal(rtType, this, firstArgument, bindingFlags, ref stackMark);
if (d == null)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_DlgtTargMeth"));
+ throw new ArgumentException(SR.Arg_DlgtTargMeth);
}
return d;
@@ -736,7 +669,7 @@ namespace System.Reflection
if (!IsGenericMethodDefinition)
throw new InvalidOperationException(
- Environment.GetResourceString("Arg_NotGenericMethodDefinition", this));
+ SR.Format(SR.Arg_NotGenericMethodDefinition, this));
for (int i = 0; i < methodInstantiation.Length; i++)
{
@@ -844,16 +777,9 @@ namespace System.Reflection
Contract.EndContractBlock();
if (m_reflectedTypeCache.IsGlobal)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_GlobalMethodSerialization"));
-
- MemberInfoSerializationHolder.GetSerializationInfo(
- info,
- Name,
- ReflectedTypeInternal,
- ToString(),
- SerializationToString(),
- MemberTypes.Method,
- IsGenericMethod & !IsGenericMethodDefinition ? GetGenericArguments() : null);
+ throw new NotSupportedException(SR.NotSupported_GlobalMethodSerialization);
+
+ MemberInfoSerializationHolder.GetSerializationInfo(info, this);
}
internal string SerializationToString()
diff --git a/src/mscorlib/src/System/Reflection/RuntimeModule.cs b/src/mscorlib/src/System/Reflection/RuntimeModule.cs
new file mode 100644
index 0000000000..4e77e8f8c4
--- /dev/null
+++ b/src/mscorlib/src/System/Reflection/RuntimeModule.cs
@@ -0,0 +1,602 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.InteropServices;
+using System.Runtime.Serialization;
+using System.Collections.Generic;
+using System.Runtime.CompilerServices;
+using System.Security;
+using System.Globalization;
+using System.Diagnostics.Contracts;
+
+namespace System.Reflection
+{
+ [Serializable]
+ internal class RuntimeModule : Module
+ {
+ internal RuntimeModule() { throw new NotSupportedException(); }
+
+ #region FCalls
+ [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
+ [SuppressUnmanagedCodeSecurity]
+ private extern static void GetType(RuntimeModule module, String className, bool ignoreCase, bool throwOnError, ObjectHandleOnStack type, ObjectHandleOnStack keepAlive);
+
+ [DllImport(JitHelpers.QCall)]
+ [SuppressUnmanagedCodeSecurity]
+ private static extern bool nIsTransientInternal(RuntimeModule module);
+
+ [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
+ [SuppressUnmanagedCodeSecurity]
+ private extern static void GetScopeName(RuntimeModule module, StringHandleOnStack retString);
+
+ [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
+ [SuppressUnmanagedCodeSecurity]
+ private extern static void GetFullyQualifiedName(RuntimeModule module, StringHandleOnStack retString);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static RuntimeType[] GetTypes(RuntimeModule module);
+
+ internal RuntimeType[] GetDefinedTypes()
+ {
+ return GetTypes(GetNativeHandle());
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private extern static bool IsResource(RuntimeModule module);
+ #endregion
+
+ #region Module overrides
+ private static RuntimeTypeHandle[] ConvertToTypeHandleArray(Type[] genericArguments)
+ {
+ if (genericArguments == null)
+ return null;
+
+ int size = genericArguments.Length;
+ RuntimeTypeHandle[] typeHandleArgs = new RuntimeTypeHandle[size];
+ for (int i = 0; i < size; i++)
+ {
+ Type typeArg = genericArguments[i];
+ if (typeArg == null)
+ throw new ArgumentException(SR.Argument_InvalidGenericInstArray);
+ typeArg = typeArg.UnderlyingSystemType;
+ if (typeArg == null)
+ throw new ArgumentException(SR.Argument_InvalidGenericInstArray);
+ if (!(typeArg is RuntimeType))
+ throw new ArgumentException(SR.Argument_InvalidGenericInstArray);
+ typeHandleArgs[i] = typeArg.GetTypeHandleInternal();
+ }
+ return typeHandleArgs;
+ }
+
+ public override byte[] ResolveSignature(int metadataToken)
+ {
+ MetadataToken tk = new MetadataToken(metadataToken);
+
+ if (!MetadataImport.IsValidToken(tk))
+ throw new ArgumentOutOfRangeException(nameof(metadataToken),
+ SR.Format(SR.Argument_InvalidToken, tk, this));
+
+ if (!tk.IsMemberRef && !tk.IsMethodDef && !tk.IsTypeSpec && !tk.IsSignature && !tk.IsFieldDef)
+ throw new ArgumentException(SR.Format(SR.Argument_InvalidToken, tk, this),
+ nameof(metadataToken));
+
+ ConstArray signature;
+ if (tk.IsMemberRef)
+ signature = MetadataImport.GetMemberRefProps(metadataToken);
+ else
+ signature = MetadataImport.GetSignatureFromToken(metadataToken);
+
+ byte[] sig = new byte[signature.Length];
+
+ for (int i = 0; i < signature.Length; i++)
+ sig[i] = signature[i];
+
+ return sig;
+ }
+
+ public override MethodBase ResolveMethod(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
+ {
+ MetadataToken tk = new MetadataToken(metadataToken);
+
+ if (!MetadataImport.IsValidToken(tk))
+ throw new ArgumentOutOfRangeException(nameof(metadataToken),
+ SR.Format(SR.Argument_InvalidToken, tk, this));
+
+ RuntimeTypeHandle[] typeArgs = ConvertToTypeHandleArray(genericTypeArguments);
+ RuntimeTypeHandle[] methodArgs = ConvertToTypeHandleArray(genericMethodArguments);
+
+ try
+ {
+ if (!tk.IsMethodDef && !tk.IsMethodSpec)
+ {
+ if (!tk.IsMemberRef)
+ throw new ArgumentException(SR.Format(SR.Argument_ResolveMethod, tk, this),
+ nameof(metadataToken));
+
+ unsafe
+ {
+ ConstArray sig = MetadataImport.GetMemberRefProps(tk);
+
+ if (*(MdSigCallingConvention*)sig.Signature.ToPointer() == MdSigCallingConvention.Field)
+ throw new ArgumentException(SR.Format(SR.Argument_ResolveMethod, tk, this),
+ nameof(metadataToken));
+ }
+ }
+
+ IRuntimeMethodInfo methodHandle = ModuleHandle.ResolveMethodHandleInternal(GetNativeHandle(), tk, typeArgs, methodArgs);
+ Type declaringType = RuntimeMethodHandle.GetDeclaringType(methodHandle);
+
+ if (declaringType.IsGenericType || declaringType.IsArray)
+ {
+ MetadataToken tkDeclaringType = new MetadataToken(MetadataImport.GetParentToken(tk));
+
+ if (tk.IsMethodSpec)
+ tkDeclaringType = new MetadataToken(MetadataImport.GetParentToken(tkDeclaringType));
+
+ declaringType = ResolveType(tkDeclaringType, genericTypeArguments, genericMethodArguments);
+ }
+
+ return System.RuntimeType.GetMethodBase(declaringType as RuntimeType, methodHandle);
+ }
+ catch (BadImageFormatException e)
+ {
+ throw new ArgumentException(SR.Argument_BadImageFormatExceptionResolve, e);
+ }
+ }
+
+ private FieldInfo ResolveLiteralField(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
+ {
+ MetadataToken tk = new MetadataToken(metadataToken);
+
+ if (!MetadataImport.IsValidToken(tk) || !tk.IsFieldDef)
+ throw new ArgumentOutOfRangeException(nameof(metadataToken),
+ String.Format(CultureInfo.CurrentUICulture, SR.Format(SR.Argument_InvalidToken, tk, this)));
+
+ int tkDeclaringType;
+ string fieldName;
+
+ fieldName = MetadataImport.GetName(tk).ToString();
+ tkDeclaringType = MetadataImport.GetParentToken(tk);
+
+ Type declaringType = ResolveType(tkDeclaringType, genericTypeArguments, genericMethodArguments);
+
+ declaringType.GetFields();
+
+ try
+ {
+ return declaringType.GetField(fieldName,
+ BindingFlags.Static | BindingFlags.Instance |
+ BindingFlags.Public | BindingFlags.NonPublic |
+ BindingFlags.DeclaredOnly);
+ }
+ catch
+ {
+ throw new ArgumentException(SR.Format(SR.Argument_ResolveField, tk, this), nameof(metadataToken));
+ }
+ }
+
+ public override FieldInfo ResolveField(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
+ {
+ MetadataToken tk = new MetadataToken(metadataToken);
+
+ if (!MetadataImport.IsValidToken(tk))
+ throw new ArgumentOutOfRangeException(nameof(metadataToken),
+ SR.Format(SR.Argument_InvalidToken, tk, this));
+
+ RuntimeTypeHandle[] typeArgs = ConvertToTypeHandleArray(genericTypeArguments);
+ RuntimeTypeHandle[] methodArgs = ConvertToTypeHandleArray(genericMethodArguments);
+
+ try
+ {
+ IRuntimeFieldInfo fieldHandle = null;
+
+ if (!tk.IsFieldDef)
+ {
+ if (!tk.IsMemberRef)
+ throw new ArgumentException(SR.Format(SR.Argument_ResolveField, tk, this),
+ nameof(metadataToken));
+
+ unsafe
+ {
+ ConstArray sig = MetadataImport.GetMemberRefProps(tk);
+
+ if (*(MdSigCallingConvention*)sig.Signature.ToPointer() != MdSigCallingConvention.Field)
+ throw new ArgumentException(SR.Format(SR.Argument_ResolveField, tk, this),
+ nameof(metadataToken));
+ }
+
+ fieldHandle = ModuleHandle.ResolveFieldHandleInternal(GetNativeHandle(), tk, typeArgs, methodArgs);
+ }
+
+ fieldHandle = ModuleHandle.ResolveFieldHandleInternal(GetNativeHandle(), metadataToken, typeArgs, methodArgs);
+ RuntimeType declaringType = RuntimeFieldHandle.GetApproxDeclaringType(fieldHandle.Value);
+
+ if (declaringType.IsGenericType || declaringType.IsArray)
+ {
+ int tkDeclaringType = ModuleHandle.GetMetadataImport(GetNativeHandle()).GetParentToken(metadataToken);
+ declaringType = (RuntimeType)ResolveType(tkDeclaringType, genericTypeArguments, genericMethodArguments);
+ }
+
+ return System.RuntimeType.GetFieldInfo(declaringType, fieldHandle);
+ }
+ catch (MissingFieldException)
+ {
+ return ResolveLiteralField(tk, genericTypeArguments, genericMethodArguments);
+ }
+ catch (BadImageFormatException e)
+ {
+ throw new ArgumentException(SR.Argument_BadImageFormatExceptionResolve, e);
+ }
+ }
+
+ public override Type ResolveType(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
+ {
+ MetadataToken tk = new MetadataToken(metadataToken);
+
+ if (tk.IsGlobalTypeDefToken)
+ throw new ArgumentException(SR.Format(SR.Argument_ResolveModuleType, tk), nameof(metadataToken));
+
+ if (!MetadataImport.IsValidToken(tk))
+ throw new ArgumentOutOfRangeException(nameof(metadataToken),
+ SR.Format(SR.Argument_InvalidToken, tk, this));
+
+ if (!tk.IsTypeDef && !tk.IsTypeSpec && !tk.IsTypeRef)
+ throw new ArgumentException(SR.Format(SR.Argument_ResolveType, tk, this), nameof(metadataToken));
+
+ RuntimeTypeHandle[] typeArgs = ConvertToTypeHandleArray(genericTypeArguments);
+ RuntimeTypeHandle[] methodArgs = ConvertToTypeHandleArray(genericMethodArguments);
+
+ try
+ {
+ Type t = GetModuleHandleImpl().ResolveTypeHandle(metadataToken, typeArgs, methodArgs).GetRuntimeType();
+
+ if (t == null)
+ throw new ArgumentException(SR.Format(SR.Argument_ResolveType, tk, this), nameof(metadataToken));
+
+ return t;
+ }
+ catch (BadImageFormatException e)
+ {
+ throw new ArgumentException(SR.Argument_BadImageFormatExceptionResolve, e);
+ }
+ }
+
+ public override MemberInfo ResolveMember(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
+ {
+ MetadataToken tk = new MetadataToken(metadataToken);
+
+ if (tk.IsProperty)
+ throw new ArgumentException(SR.InvalidOperation_PropertyInfoNotAvailable);
+
+ if (tk.IsEvent)
+ throw new ArgumentException(SR.InvalidOperation_EventInfoNotAvailable);
+
+ if (tk.IsMethodSpec || tk.IsMethodDef)
+ return ResolveMethod(metadataToken, genericTypeArguments, genericMethodArguments);
+
+ if (tk.IsFieldDef)
+ return ResolveField(metadataToken, genericTypeArguments, genericMethodArguments);
+
+ if (tk.IsTypeRef || tk.IsTypeDef || tk.IsTypeSpec)
+ return ResolveType(metadataToken, genericTypeArguments, genericMethodArguments);
+
+ if (tk.IsMemberRef)
+ {
+ if (!MetadataImport.IsValidToken(tk))
+ throw new ArgumentOutOfRangeException(nameof(metadataToken),
+ SR.Format(SR.Argument_InvalidToken, tk, this));
+
+ ConstArray sig = MetadataImport.GetMemberRefProps(tk);
+
+ unsafe
+ {
+ if (*(MdSigCallingConvention*)sig.Signature.ToPointer() == MdSigCallingConvention.Field)
+ {
+ return ResolveField(tk, genericTypeArguments, genericMethodArguments);
+ }
+ else
+ {
+ return ResolveMethod(tk, genericTypeArguments, genericMethodArguments);
+ }
+ }
+ }
+
+ throw new ArgumentException(SR.Format(SR.Argument_ResolveMember, tk, this),
+ nameof(metadataToken));
+ }
+
+ public override string ResolveString(int metadataToken)
+ {
+ MetadataToken tk = new MetadataToken(metadataToken);
+ if (!tk.IsString)
+ throw new ArgumentException(
+ String.Format(CultureInfo.CurrentUICulture, SR.Argument_ResolveString, metadataToken, ToString()));
+
+ if (!MetadataImport.IsValidToken(tk))
+ throw new ArgumentOutOfRangeException(nameof(metadataToken),
+ String.Format(CultureInfo.CurrentUICulture, SR.Format(SR.Argument_InvalidToken, tk, this)));
+
+ string str = MetadataImport.GetUserString(metadataToken);
+
+ if (str == null)
+ throw new ArgumentException(
+ String.Format(CultureInfo.CurrentUICulture, SR.Argument_ResolveString, metadataToken, ToString()));
+
+ return str;
+ }
+
+ public override void GetPEKind(out PortableExecutableKinds peKind, out ImageFileMachine machine)
+ {
+ ModuleHandle.GetPEKind(GetNativeHandle(), out peKind, out machine);
+ }
+
+ public override int MDStreamVersion
+ {
+ get
+ {
+ return ModuleHandle.GetMDStreamVersion(GetNativeHandle());
+ }
+ }
+ #endregion
+
+ #region Data Members
+#pragma warning disable 169
+ // If you add any data members, you need to update the native declaration ReflectModuleBaseObject.
+ private RuntimeType m_runtimeType;
+ private RuntimeAssembly m_runtimeAssembly;
+ private IntPtr m_pRefClass;
+ private IntPtr m_pData;
+ private IntPtr m_pGlobals;
+ private IntPtr m_pFields;
+#pragma warning restore 169
+ #endregion
+
+ #region Protected Virtuals
+ protected override MethodInfo GetMethodImpl(String name, BindingFlags bindingAttr, Binder binder,
+ CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
+ {
+ return GetMethodInternal(name, bindingAttr, binder, callConvention, types, modifiers);
+ }
+
+ internal MethodInfo GetMethodInternal(String name, BindingFlags bindingAttr, Binder binder,
+ CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
+ {
+ if (RuntimeType == null)
+ return null;
+
+ if (types == null)
+ {
+ return RuntimeType.GetMethod(name, bindingAttr);
+ }
+ else
+ {
+ return RuntimeType.GetMethod(name, bindingAttr, binder, callConvention, types, modifiers);
+ }
+ }
+ #endregion
+
+ #region Internal Members
+ internal RuntimeType RuntimeType
+ {
+ get
+ {
+ if (m_runtimeType == null)
+ m_runtimeType = ModuleHandle.GetModuleType(GetNativeHandle());
+
+ return m_runtimeType;
+ }
+ }
+
+ internal bool IsTransientInternal()
+ {
+ return RuntimeModule.nIsTransientInternal(this.GetNativeHandle());
+ }
+
+ internal MetadataImport MetadataImport
+ {
+ get
+ {
+ unsafe
+ {
+ return ModuleHandle.GetMetadataImport(GetNativeHandle());
+ }
+ }
+ }
+ #endregion
+
+ #region ICustomAttributeProvider Members
+ public override Object[] GetCustomAttributes(bool inherit)
+ {
+ return CustomAttribute.GetCustomAttributes(this, typeof(object) as RuntimeType);
+ }
+
+ public override Object[] GetCustomAttributes(Type attributeType, bool inherit)
+ {
+ if (attributeType == null)
+ throw new ArgumentNullException(nameof(attributeType));
+ Contract.EndContractBlock();
+
+ RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
+
+ if (attributeRuntimeType == null)
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));
+
+ return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
+ }
+
+ public override bool IsDefined(Type attributeType, bool inherit)
+ {
+ if (attributeType == null)
+ throw new ArgumentNullException(nameof(attributeType));
+ Contract.EndContractBlock();
+
+ RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
+
+ if (attributeRuntimeType == null)
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));
+
+ return CustomAttribute.IsDefined(this, attributeRuntimeType);
+ }
+
+ public override IList<CustomAttributeData> GetCustomAttributesData()
+ {
+ return CustomAttributeData.GetCustomAttributesInternal(this);
+ }
+ #endregion
+
+ #region Public Virtuals
+ public override void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ if (info == null)
+ {
+ throw new ArgumentNullException(nameof(info));
+ }
+ Contract.EndContractBlock();
+ UnitySerializationHolder.GetUnitySerializationInfo(info, UnitySerializationHolder.ModuleUnity, this.ScopeName, this.GetRuntimeAssembly());
+ }
+
+ public override Type GetType(String className, bool throwOnError, bool ignoreCase)
+ {
+ // throw on null strings regardless of the value of "throwOnError"
+ if (className == null)
+ throw new ArgumentNullException(nameof(className));
+
+ RuntimeType retType = null;
+ Object keepAlive = null;
+ GetType(GetNativeHandle(), className, throwOnError, ignoreCase, JitHelpers.GetObjectHandleOnStack(ref retType), JitHelpers.GetObjectHandleOnStack(ref keepAlive));
+ GC.KeepAlive(keepAlive);
+ return retType;
+ }
+
+ internal string GetFullyQualifiedName()
+ {
+ String fullyQualifiedName = null;
+ GetFullyQualifiedName(GetNativeHandle(), JitHelpers.GetStringHandleOnStack(ref fullyQualifiedName));
+ return fullyQualifiedName;
+ }
+
+ public override String FullyQualifiedName
+ {
+ get
+ {
+ return GetFullyQualifiedName();
+ }
+ }
+
+ public override Type[] GetTypes()
+ {
+ return GetTypes(GetNativeHandle());
+ }
+
+ #endregion
+
+ #region Public Members
+
+ public override Guid ModuleVersionId
+ {
+ get
+ {
+ unsafe
+ {
+ Guid mvid;
+ MetadataImport.GetScopeProps(out mvid);
+ return mvid;
+ }
+ }
+ }
+
+ public override int MetadataToken
+ {
+ get
+ {
+ return ModuleHandle.GetToken(GetNativeHandle());
+ }
+ }
+
+ public override bool IsResource()
+ {
+ return IsResource(GetNativeHandle());
+ }
+
+ public override FieldInfo[] GetFields(BindingFlags bindingFlags)
+ {
+ if (RuntimeType == null)
+ return new FieldInfo[0];
+
+ return RuntimeType.GetFields(bindingFlags);
+ }
+
+ public override FieldInfo GetField(String name, BindingFlags bindingAttr)
+ {
+ if (name == null)
+ throw new ArgumentNullException(nameof(name));
+
+ if (RuntimeType == null)
+ return null;
+
+ return RuntimeType.GetField(name, bindingAttr);
+ }
+
+ public override MethodInfo[] GetMethods(BindingFlags bindingFlags)
+ {
+ if (RuntimeType == null)
+ return new MethodInfo[0];
+
+ return RuntimeType.GetMethods(bindingFlags);
+ }
+
+ public override String ScopeName
+ {
+ get
+ {
+ string scopeName = null;
+ GetScopeName(GetNativeHandle(), JitHelpers.GetStringHandleOnStack(ref scopeName));
+ return scopeName;
+ }
+ }
+
+ public override String Name
+ {
+ get
+ {
+ String s = GetFullyQualifiedName();
+
+#if !FEATURE_PAL
+ int i = s.LastIndexOf('\\');
+#else
+ int i = s.LastIndexOf(System.IO.Path.DirectorySeparatorChar);
+#endif
+ if (i == -1)
+ return s;
+
+ return s.Substring(i + 1);
+ }
+ }
+
+ public override Assembly Assembly
+ {
+ [Pure]
+ get
+ {
+ return GetRuntimeAssembly();
+ }
+ }
+
+ internal RuntimeAssembly GetRuntimeAssembly()
+ {
+ return m_runtimeAssembly;
+ }
+
+ protected override ModuleHandle GetModuleHandleImpl()
+ {
+ return new ModuleHandle(this);
+ }
+
+ internal RuntimeModule GetNativeHandle()
+ {
+ return this;
+ }
+ #endregion
+ }
+}
diff --git a/src/mscorlib/src/System/Reflection/ParameterInfo.cs b/src/mscorlib/src/System/Reflection/RuntimeParameterInfo.cs
index 373201f634..a8d62408eb 100644
--- a/src/mscorlib/src/System/Reflection/ParameterInfo.cs
+++ b/src/mscorlib/src/System/Reflection/RuntimeParameterInfo.cs
@@ -2,234 +2,15 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-//
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Diagnostics.Contracts;
+using System.Runtime.Serialization;
+using System.Runtime.CompilerServices;
+using MdToken = System.Reflection.MetadataToken;
namespace System.Reflection
{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Diagnostics.Contracts;
- using System.Runtime.InteropServices;
- using System.Runtime.Serialization;
- using System.Runtime.CompilerServices;
- using System.Threading;
- using MdToken = System.Reflection.MetadataToken;
-
- [Serializable]
- public class ParameterInfo : ICustomAttributeProvider, IObjectReference
- {
- #region Legacy Protected Members
- protected String NameImpl;
- protected Type ClassImpl;
- protected int PositionImpl;
- protected ParameterAttributes AttrsImpl;
- protected Object DefaultValueImpl; // cannot cache this as it may be non agile user defined enum
- protected MemberInfo MemberImpl;
- #endregion
-
- #region Legacy Private Members
- // These are here only for backwards compatibility -- they are not set
- // until this instance is serialized, so don't rely on their values from
- // arbitrary code.
-#pragma warning disable 169
- [OptionalField]
- private IntPtr _importer;
- [OptionalField]
- private int _token;
- [OptionalField]
- private bool bExtraConstChecked;
-#pragma warning restore 169
- #endregion
-
- #region Constructor
- protected ParameterInfo()
- {
- }
- #endregion
-
- #region Internal Members
- // this is an internal api for DynamicMethod. A better solution is to change the relationship
- // between ParameterInfo and ParameterBuilder so that a ParameterBuilder can be seen as a writer
- // api over a ParameterInfo. However that is a possible breaking change so it needs to go through some process first
- internal void SetName(String name)
- {
- NameImpl = name;
- }
-
- internal void SetAttributes(ParameterAttributes attributes)
- {
- AttrsImpl = attributes;
- }
- #endregion
-
- #region Public Methods
- public virtual Type ParameterType
- {
- get
- {
- return ClassImpl;
- }
- }
-
- public virtual String Name
- {
- get
- {
- return NameImpl;
- }
- }
-
- public virtual bool HasDefaultValue { get { throw new NotImplementedException(); } }
-
- public virtual Object DefaultValue { get { throw new NotImplementedException(); } }
- public virtual Object RawDefaultValue { get { throw new NotImplementedException(); } }
-
- public virtual int Position { get { return PositionImpl; } }
- public virtual ParameterAttributes Attributes { get { return AttrsImpl; } }
-
- public virtual MemberInfo Member
- {
- get
- {
- Contract.Ensures(Contract.Result<MemberInfo>() != null);
- return MemberImpl;
- }
- }
-
- public bool IsIn { get { return ((Attributes & ParameterAttributes.In) != 0); } }
- public bool IsOut { get { return ((Attributes & ParameterAttributes.Out) != 0); } }
- public bool IsLcid { get { return ((Attributes & ParameterAttributes.Lcid) != 0); } }
- public bool IsRetval { get { return ((Attributes & ParameterAttributes.Retval) != 0); } }
- public bool IsOptional { get { return ((Attributes & ParameterAttributes.Optional) != 0); } }
-
- public virtual int MetadataToken
- {
- get
- {
- // This API was made virtual in V4. Code compiled against V2 might use
- // "call" rather than "callvirt" to call it.
- // This makes sure those code still works.
- RuntimeParameterInfo rtParam = this as RuntimeParameterInfo;
- if (rtParam != null)
- return rtParam.MetadataToken;
-
- // return a null token
- return (int)MetadataTokenType.ParamDef;
- }
- }
-
- public virtual Type[] GetRequiredCustomModifiers()
- {
- return EmptyArray<Type>.Value;
- }
-
- public virtual Type[] GetOptionalCustomModifiers()
- {
- return EmptyArray<Type>.Value;
- }
- #endregion
-
- #region Object Overrides
- public override String ToString()
- {
- return ParameterType.FormatTypeName() + " " + Name;
- }
- #endregion
-
- public virtual IEnumerable<CustomAttributeData> CustomAttributes
- {
- get
- {
- return GetCustomAttributesData();
- }
- }
- #region ICustomAttributeProvider
- public virtual Object[] GetCustomAttributes(bool inherit)
- {
- return EmptyArray<Object>.Value;
- }
-
- public virtual Object[] GetCustomAttributes(Type attributeType, bool inherit)
- {
- if (attributeType == null)
- throw new ArgumentNullException(nameof(attributeType));
- Contract.EndContractBlock();
-
- return EmptyArray<Object>.Value;
- }
-
- public virtual bool IsDefined(Type attributeType, bool inherit)
- {
- if (attributeType == null)
- throw new ArgumentNullException(nameof(attributeType));
- Contract.EndContractBlock();
-
- return false;
- }
-
- public virtual IList<CustomAttributeData> GetCustomAttributesData()
- {
- throw new NotImplementedException();
- }
- #endregion
-
- #region _ParameterInfo implementation
-
- #endregion
-
- #region IObjectReference
- // In V4 RuntimeParameterInfo is introduced.
- // To support deserializing ParameterInfo instances serialized in earlier versions
- // we need to implement IObjectReference.
- public object GetRealObject(StreamingContext context)
- {
- Contract.Ensures(Contract.Result<Object>() != null);
-
- // Once all the serializable fields have come in we can set up the real
- // instance based on just two of them (MemberImpl and PositionImpl).
-
- if (MemberImpl == null)
- throw new SerializationException(Environment.GetResourceString(ResId.Serialization_InsufficientState));
-
- ParameterInfo[] args = null;
-
- switch (MemberImpl.MemberType)
- {
- case MemberTypes.Constructor:
- case MemberTypes.Method:
- if (PositionImpl == -1)
- {
- if (MemberImpl.MemberType == MemberTypes.Method)
- return ((MethodInfo)MemberImpl).ReturnParameter;
- else
- throw new SerializationException(Environment.GetResourceString(ResId.Serialization_BadParameterInfo));
- }
- else
- {
- args = ((MethodBase)MemberImpl).GetParametersNoCopy();
-
- if (args != null && PositionImpl < args.Length)
- return args[PositionImpl];
- else
- throw new SerializationException(Environment.GetResourceString(ResId.Serialization_BadParameterInfo));
- }
-
- case MemberTypes.Property:
- args = ((RuntimePropertyInfo)MemberImpl).GetIndexParametersNoCopy();
-
- if (args != null && PositionImpl > -1 && PositionImpl < args.Length)
- return args[PositionImpl];
- else
- throw new SerializationException(Environment.GetResourceString(ResId.Serialization_BadParameterInfo));
-
- default:
- throw new SerializationException(Environment.GetResourceString(ResId.Serialization_NoParameterInfo));
- }
- }
- #endregion
- }
-
[Serializable]
internal unsafe sealed class RuntimeParameterInfo : ParameterInfo, ISerializable
{
@@ -275,7 +56,7 @@ namespace System.Reflection
// Not all parameters have tokens. Parameters may have no token
// if they have no name and no attributes.
if (cParamDefs > sigArgCount + 1 /* return type */)
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ParameterSignatureMismatch"));
+ throw new BadImageFormatException(SR.BadImageFormat_ParameterSignatureMismatch);
for (int i = 0; i < cParamDefs; i++)
{
@@ -291,7 +72,7 @@ namespace System.Reflection
{
// more than one return parameter?
if (returnParameter != null)
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ParameterSignatureMismatch"));
+ throw new BadImageFormatException(SR.BadImageFormat_ParameterSignatureMismatch);
returnParameter = new RuntimeParameterInfo(sig, scope, tkParamDef, position, attr, member);
}
@@ -299,7 +80,7 @@ namespace System.Reflection
{
// position beyong sigArgCount?
if (position >= sigArgCount)
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ParameterSignatureMismatch"));
+ throw new BadImageFormatException(SR.BadImageFormat_ParameterSignatureMismatch);
args[position] = new RuntimeParameterInfo(sig, scope, tkParamDef, position, attr, member);
}
@@ -368,6 +149,18 @@ namespace System.Reflection
}
#endregion
+ #region Internal Methods
+ internal void SetName(string name)
+ {
+ NameImpl = name;
+ }
+
+ internal void SetAttributes(ParameterAttributes attributes)
+ {
+ AttrsImpl = attributes;
+ }
+ #endregion
+
#region VTS magic to serialize/deserialized to/from pre-Whidbey endpoints.
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
@@ -704,7 +497,7 @@ namespace System.Reflection
RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
if (attributeRuntimeType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(attributeType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));
return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
}
@@ -721,7 +514,7 @@ namespace System.Reflection
RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
if (attributeRuntimeType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(attributeType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));
return CustomAttribute.IsDefined(this, attributeRuntimeType);
}
diff --git a/src/mscorlib/src/System/Reflection/PropertyInfo.cs b/src/mscorlib/src/System/Reflection/RuntimePropertyInfo.cs
index 3438b967f1..b6a4792e4f 100644
--- a/src/mscorlib/src/System/Reflection/PropertyInfo.cs
+++ b/src/mscorlib/src/System/Reflection/RuntimePropertyInfo.cs
@@ -2,152 +2,16 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-//
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Diagnostics.Contracts;
+using System.Globalization;
+using System.Runtime.Serialization;
+using System.Text;
+using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache;
namespace System.Reflection
{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Diagnostics.Contracts;
- using System.Globalization;
- using System.Runtime;
- using System.Runtime.ConstrainedExecution;
- using System.Runtime.InteropServices;
- using System.Runtime.Serialization;
- using System.Text;
- using RuntimeTypeCache = System.RuntimeType.RuntimeTypeCache;
-
- [Serializable]
- public abstract class PropertyInfo : MemberInfo
- {
- #region Constructor
- protected PropertyInfo() { }
- #endregion
-
- public static bool operator ==(PropertyInfo left, PropertyInfo right)
- {
- if (ReferenceEquals(left, right))
- return true;
-
- if ((object)left == null || (object)right == null ||
- left is RuntimePropertyInfo || right is RuntimePropertyInfo)
- {
- return false;
- }
- return left.Equals(right);
- }
-
- public static bool operator !=(PropertyInfo left, PropertyInfo right)
- {
- return !(left == right);
- }
-
- public override bool Equals(object obj)
- {
- return base.Equals(obj);
- }
-
- public override int GetHashCode()
- {
- return base.GetHashCode();
- }
-
- #region MemberInfo Overrides
- public override MemberTypes MemberType { get { return System.Reflection.MemberTypes.Property; } }
- #endregion
-
- #region Public Abstract\Virtual Members
- public virtual object GetConstantValue()
- {
- throw new NotImplementedException();
- }
-
- public virtual object GetRawConstantValue()
- {
- throw new NotImplementedException();
- }
-
- public abstract Type PropertyType { get; }
-
- public abstract void SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture);
-
- public abstract MethodInfo[] GetAccessors(bool nonPublic);
-
- public abstract MethodInfo GetGetMethod(bool nonPublic);
-
- public abstract MethodInfo GetSetMethod(bool nonPublic);
-
- public abstract ParameterInfo[] GetIndexParameters();
-
- public abstract PropertyAttributes Attributes { get; }
-
- public abstract bool CanRead { get; }
-
- public abstract bool CanWrite { get; }
-
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- public Object GetValue(Object obj)
- {
- return GetValue(obj, null);
- }
-
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- public virtual Object GetValue(Object obj, Object[] index)
- {
- return GetValue(obj, BindingFlags.Default, null, index, null);
- }
-
- public abstract Object GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture);
-
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- public void SetValue(Object obj, Object value)
- {
- SetValue(obj, value, null);
- }
-
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- public virtual void SetValue(Object obj, Object value, Object[] index)
- {
- SetValue(obj, value, BindingFlags.Default, null, index, null);
- }
- #endregion
-
- #region Public Members
- public virtual Type[] GetRequiredCustomModifiers() { return EmptyArray<Type>.Value; }
-
- public virtual Type[] GetOptionalCustomModifiers() { return EmptyArray<Type>.Value; }
-
- public MethodInfo[] GetAccessors() { return GetAccessors(false); }
-
- public virtual MethodInfo GetMethod
- {
- get
- {
- return GetGetMethod(true);
- }
- }
-
- public virtual MethodInfo SetMethod
- {
- get
- {
- return GetSetMethod(true);
- }
- }
-
- public MethodInfo GetGetMethod() { return GetGetMethod(false); }
-
- public MethodInfo GetSetMethod() { return GetSetMethod(false); }
-
- public bool IsSpecialName { get { return (Attributes & PropertyAttributes.SpecialName) != 0; } }
- #endregion
- }
-
[Serializable]
internal unsafe sealed class RuntimePropertyInfo : PropertyInfo, ISerializable
{
@@ -298,7 +162,7 @@ namespace System.Reflection
RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
if (attributeRuntimeType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(attributeType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));
return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType);
}
@@ -312,7 +176,7 @@ namespace System.Reflection
RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
if (attributeRuntimeType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(attributeType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));
return CustomAttribute.IsDefined(this, attributeRuntimeType);
}
@@ -385,7 +249,7 @@ namespace System.Reflection
if (defaultValue == DBNull.Value)
// Arg_EnumLitValueNotFound -> "Literal value was not found."
- throw new InvalidOperationException(Environment.GetResourceString("Arg_EnumLitValueNotFound"));
+ throw new InvalidOperationException(SR.Arg_EnumLitValueNotFound);
return defaultValue;
}
@@ -536,7 +400,7 @@ namespace System.Reflection
{
MethodInfo m = GetGetMethod(true);
if (m == null)
- throw new ArgumentException(System.Environment.GetResourceString("Arg_GetMethNotFnd"));
+ throw new ArgumentException(System.SR.Arg_GetMethNotFnd);
return m.Invoke(obj, invokeAttr, binder, index, null);
}
@@ -559,7 +423,7 @@ namespace System.Reflection
MethodInfo m = GetSetMethod(true);
if (m == null)
- throw new ArgumentException(System.Environment.GetResourceString("Arg_SetMethNotFnd"));
+ throw new ArgumentException(System.SR.Arg_SetMethNotFnd);
Object[] args = null;
@@ -591,14 +455,7 @@ namespace System.Reflection
throw new ArgumentNullException(nameof(info));
Contract.EndContractBlock();
- MemberInfoSerializationHolder.GetSerializationInfo(
- info,
- Name,
- ReflectedTypeInternal,
- ToString(),
- SerializationToString(),
- MemberTypes.Property,
- null);
+ MemberInfoSerializationHolder.GetSerializationInfo(info, this);
}
internal string SerializationToString()
diff --git a/src/mscorlib/src/System/Reflection/RuntimeReflectionExtensions.cs b/src/mscorlib/src/System/Reflection/RuntimeReflectionExtensions.cs
deleted file mode 100644
index 9423ee2dc8..0000000000
--- a/src/mscorlib/src/System/Reflection/RuntimeReflectionExtensions.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Collections.Generic;
-
-namespace System.Reflection
-{
- public static class RuntimeReflectionExtensions
- {
- private const BindingFlags everything = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static;
-
- private static void CheckAndThrow(Type type)
- {
- if (type == null) throw new ArgumentNullException(nameof(type));
- if (!(type is RuntimeType)) throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"));
- }
-
- private static void CheckAndThrow(MethodInfo method)
- {
- if (method == null) throw new ArgumentNullException(nameof(method));
- if (!(method is RuntimeMethodInfo)) throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeMethodInfo"));
- }
-
- public static IEnumerable<PropertyInfo> GetRuntimeProperties(this Type type)
- {
- CheckAndThrow(type);
- return type.GetProperties(everything);
- }
- public static IEnumerable<EventInfo> GetRuntimeEvents(this Type type)
- {
- CheckAndThrow(type);
- return type.GetEvents(everything);
- }
-
- public static IEnumerable<MethodInfo> GetRuntimeMethods(this Type type)
- {
- CheckAndThrow(type);
- return type.GetMethods(everything);
- }
-
- public static IEnumerable<FieldInfo> GetRuntimeFields(this Type type)
- {
- CheckAndThrow(type);
- return type.GetFields(everything);
- }
-
- public static PropertyInfo GetRuntimeProperty(this Type type, string name)
- {
- CheckAndThrow(type);
- return type.GetProperty(name);
- }
- public static EventInfo GetRuntimeEvent(this Type type, string name)
- {
- CheckAndThrow(type);
- return type.GetEvent(name);
- }
- public static MethodInfo GetRuntimeMethod(this Type type, string name, Type[] parameters)
- {
- CheckAndThrow(type);
- return type.GetMethod(name, parameters);
- }
- public static FieldInfo GetRuntimeField(this Type type, string name)
- {
- CheckAndThrow(type);
- return type.GetField(name);
- }
- public static MethodInfo GetRuntimeBaseDefinition(this MethodInfo method)
- {
- CheckAndThrow(method);
- return method.GetBaseDefinition();
- }
-
- public static InterfaceMapping GetRuntimeInterfaceMap(this TypeInfo typeInfo, Type interfaceType)
- {
- if (typeInfo == null) throw new ArgumentNullException(nameof(typeInfo));
- if (!(typeInfo is RuntimeType)) throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"));
-
- return typeInfo.GetInterfaceMap(interfaceType);
- }
-
- public static MethodInfo GetMethodInfo(this Delegate del)
- {
- if (del == null) throw new ArgumentNullException(nameof(del));
-
- return del.Method;
- }
- }
-}
diff --git a/src/mscorlib/src/System/Reflection/TargetException.cs b/src/mscorlib/src/System/Reflection/TargetException.cs
deleted file mode 100644
index 537d1680f4..0000000000
--- a/src/mscorlib/src/System/Reflection/TargetException.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-// 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.
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// TargetException is thrown when the target to an Invoke is invalid. This may
-//
-// occur because the caller doesn't have access to the member, or the target doesn't
-// define the member, etc.
-//
-//
-//
-//
-
-using System;
-using System.Runtime.Serialization;
-
-namespace System.Reflection
-{
- [Serializable]
- public class TargetException : ApplicationException
- {
- public TargetException() : base()
- {
- SetErrorCode(__HResults.COR_E_TARGET);
- }
-
- public TargetException(String message) : base(message)
- {
- SetErrorCode(__HResults.COR_E_TARGET);
- }
-
- public TargetException(String message, Exception inner) : base(message, inner)
- {
- SetErrorCode(__HResults.COR_E_TARGET);
- }
-
- protected TargetException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
- }
-}
diff --git a/src/mscorlib/src/System/Reflection/TargetInvocationException.cs b/src/mscorlib/src/System/Reflection/TargetInvocationException.cs
deleted file mode 100644
index 326b571e18..0000000000
--- a/src/mscorlib/src/System/Reflection/TargetInvocationException.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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.
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// TargetInvocationException is used to report an exception that was thrown
-//
-// by the target of an invocation.
-//
-//
-//
-//
-
-
-using System;
-using System.Runtime.Serialization;
-
-namespace System.Reflection
-{
- [Serializable]
- public sealed class TargetInvocationException : ApplicationException
- {
- // This exception is not creatable without specifying the
- // inner exception.
- private TargetInvocationException()
- : base(Environment.GetResourceString("Arg_TargetInvocationException"))
- {
- SetErrorCode(__HResults.COR_E_TARGETINVOCATION);
- }
-
- // This is called from within the runtime.
- private TargetInvocationException(String message) : base(message)
- {
- SetErrorCode(__HResults.COR_E_TARGETINVOCATION);
- }
-
- public TargetInvocationException(System.Exception inner)
- : base(Environment.GetResourceString("Arg_TargetInvocationException"), inner)
- {
- SetErrorCode(__HResults.COR_E_TARGETINVOCATION);
- }
-
- public TargetInvocationException(String message, Exception inner) : base(message, inner)
- {
- SetErrorCode(__HResults.COR_E_TARGETINVOCATION);
- }
-
- internal TargetInvocationException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
- }
-}
diff --git a/src/mscorlib/src/System/Reflection/TargetParameterCountException.cs b/src/mscorlib/src/System/Reflection/TargetParameterCountException.cs
deleted file mode 100644
index 3e2bce4b26..0000000000
--- a/src/mscorlib/src/System/Reflection/TargetParameterCountException.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-// 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.
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// TargetParameterCountException is thrown when the number of parameter to an
-//
-// invocation doesn't match the number expected.
-//
-//
-//
-//
-
-namespace System.Reflection
-{
- using System;
- using SystemException = System.SystemException;
- using System.Runtime.Serialization;
- [Serializable]
- public sealed class TargetParameterCountException : ApplicationException
- {
- public TargetParameterCountException()
- : base(Environment.GetResourceString("Arg_TargetParameterCountException"))
- {
- SetErrorCode(__HResults.COR_E_TARGETPARAMCOUNT);
- }
-
- public TargetParameterCountException(String message)
- : base(message)
- {
- SetErrorCode(__HResults.COR_E_TARGETPARAMCOUNT);
- }
-
- public TargetParameterCountException(String message, Exception inner)
- : base(message, inner)
- {
- SetErrorCode(__HResults.COR_E_TARGETPARAMCOUNT);
- }
-
- internal TargetParameterCountException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
- }
-}
diff --git a/src/mscorlib/src/System/Reflection/TypeFilter.cs b/src/mscorlib/src/System/Reflection/TypeFilter.cs
deleted file mode 100644
index 97a089978a..0000000000
--- a/src/mscorlib/src/System/Reflection/TypeFilter.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-// 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.
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// TypeFilter defines a delegate that is as a callback function for filtering
-//
-// a list of Types.
-//
-//
-
-namespace System.Reflection
-{
- // Define the delegate
- [Serializable]
- public delegate bool TypeFilter(Type m, Object filterCriteria);
-}
diff --git a/src/mscorlib/src/System/Reflection/TypeInfo.cs b/src/mscorlib/src/System/Reflection/TypeInfo.cs
deleted file mode 100644
index aaf5c731b3..0000000000
--- a/src/mscorlib/src/System/Reflection/TypeInfo.cs
+++ /dev/null
@@ -1,201 +0,0 @@
-// 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: Notion of a type definition
-**
-**
-=============================================================================*/
-
-using System;
-using System.Runtime.CompilerServices;
-using System.Collections.Generic;
-using System.Diagnostics.Contracts;
-
-namespace System.Reflection
-{
- //all today's runtime Type derivations derive now from TypeInfo
- //we make TypeInfo implement IRCT - simplifies work
- [Serializable]
- public abstract class TypeInfo : Type, IReflectableType
- {
- [FriendAccessAllowed]
- internal TypeInfo() { }
-
- TypeInfo IReflectableType.GetTypeInfo()
- {
- return this;
- }
- public virtual Type AsType()
- {
- return (Type)this;
- }
-
- public virtual Type[] GenericTypeParameters
- {
- get
- {
- if (IsGenericTypeDefinition)
- {
- return GetGenericArguments();
- }
- else
- {
- return Type.EmptyTypes;
- }
- }
- }
- //a re-implementation of ISAF from Type, skipping the use of UnderlyingType
- [Pure]
- public virtual bool IsAssignableFrom(TypeInfo typeInfo)
- {
- if (typeInfo == null)
- return false;
-
- if (this == typeInfo)
- return true;
-
- // If c is a subclass of this class, then c can be cast to this type.
- if (typeInfo.IsSubclassOf(this))
- return true;
-
- if (this.IsInterface)
- {
- return typeInfo.ImplementInterface(this);
- }
- else if (IsGenericParameter)
- {
- Type[] constraints = GetGenericParameterConstraints();
- for (int i = 0; i < constraints.Length; i++)
- if (!constraints[i].IsAssignableFrom(typeInfo))
- return false;
-
- return true;
- }
-
- return false;
- }
- #region moved over from Type
- // Fields
-
- public virtual EventInfo GetDeclaredEvent(String name)
- {
- return GetEvent(name, Type.DeclaredOnlyLookup);
- }
- public virtual FieldInfo GetDeclaredField(String name)
- {
- return GetField(name, Type.DeclaredOnlyLookup);
- }
- public virtual MethodInfo GetDeclaredMethod(String name)
- {
- return GetMethod(name, Type.DeclaredOnlyLookup);
- }
-
- public virtual IEnumerable<MethodInfo> GetDeclaredMethods(String name)
- {
- foreach (MethodInfo method in GetMethods(Type.DeclaredOnlyLookup))
- {
- if (method.Name == name)
- yield return method;
- }
- }
- public virtual System.Reflection.TypeInfo GetDeclaredNestedType(String name)
- {
- var nt = GetNestedType(name, Type.DeclaredOnlyLookup);
- if (nt == null)
- {
- return null; //the extension method GetTypeInfo throws for null
- }
- else
- {
- return nt.GetTypeInfo();
- }
- }
- public virtual PropertyInfo GetDeclaredProperty(String name)
- {
- return GetProperty(name, Type.DeclaredOnlyLookup);
- }
-
-
-
-
-
- // Properties
-
- public virtual IEnumerable<ConstructorInfo> DeclaredConstructors
- {
- get
- {
- return GetConstructors(Type.DeclaredOnlyLookup);
- }
- }
-
- public virtual IEnumerable<EventInfo> DeclaredEvents
- {
- get
- {
- return GetEvents(Type.DeclaredOnlyLookup);
- }
- }
-
- public virtual IEnumerable<FieldInfo> DeclaredFields
- {
- get
- {
- return GetFields(Type.DeclaredOnlyLookup);
- }
- }
-
- public virtual IEnumerable<MemberInfo> DeclaredMembers
- {
- get
- {
- return GetMembers(Type.DeclaredOnlyLookup);
- }
- }
-
- public virtual IEnumerable<MethodInfo> DeclaredMethods
- {
- get
- {
- return GetMethods(Type.DeclaredOnlyLookup);
- }
- }
- public virtual IEnumerable<System.Reflection.TypeInfo> DeclaredNestedTypes
- {
- get
- {
- foreach (var t in GetNestedTypes(Type.DeclaredOnlyLookup))
- {
- yield return t.GetTypeInfo();
- }
- }
- }
-
- public virtual IEnumerable<PropertyInfo> DeclaredProperties
- {
- get
- {
- return GetProperties(Type.DeclaredOnlyLookup);
- }
- }
-
-
- public virtual IEnumerable<Type> ImplementedInterfaces
- {
- get
- {
- return GetInterfaces();
- }
- }
-
- #endregion
- }
-}
-
diff --git a/src/mscorlib/src/System/Reflection/__Filters.cs b/src/mscorlib/src/System/Reflection/__Filters.cs
deleted file mode 100644
index 582fb5a873..0000000000
--- a/src/mscorlib/src/System/Reflection/__Filters.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-// 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.
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-// This class defines the delegate methods for the COM+ implemented filters.
-// This is the reflection version of these. There is also a _Filters class in
-// runtime which is related to this.
-//
-//
-//
-//
-
-using System;
-using System.Globalization;
-
-namespace System.Reflection
-{
- [Serializable]
- internal class __Filters
- {
- // FilterTypeName
- // This method will filter the class based upon the name. It supports
- // a trailing wild card.
- public virtual bool FilterTypeName(Type cls, Object filterCriteria)
- {
- // Check that the criteria object is a String object
- if (filterCriteria == null || !(filterCriteria is String))
- throw new InvalidFilterCriteriaException(System.Environment.GetResourceString("RFLCT.FltCritString"));
-
- String str = (String)filterCriteria;
- //str = str.Trim();
-
- // Check to see if this is a prefix or exact match requirement
- if (str.Length > 0 && str[str.Length - 1] == '*')
- {
- str = str.Substring(0, str.Length - 1);
- return cls.Name.StartsWith(str, StringComparison.Ordinal);
- }
-
- return cls.Name.Equals(str);
- }
-
- // FilterFieldNameIgnoreCase
- // This method filter the Type based upon name, it ignores case.
- public virtual bool FilterTypeNameIgnoreCase(Type cls, Object filterCriteria)
- {
- // Check that the criteria object is a String object
- if (filterCriteria == null || !(filterCriteria is String))
- throw new InvalidFilterCriteriaException(System.Environment.GetResourceString("RFLCT.FltCritString"));
-
- String str = (String)filterCriteria;
- //str = str.Trim();
-
- // Check to see if this is a prefix or exact match requirement
- if (str.Length > 0 && str[str.Length - 1] == '*')
- {
- str = str.Substring(0, str.Length - 1);
- String name = cls.Name;
- if (name.Length >= str.Length)
- return (String.Compare(name, 0, str, 0, str.Length, StringComparison.OrdinalIgnoreCase) == 0);
- else
- return false;
- }
- return (String.Compare(str, cls.Name, StringComparison.OrdinalIgnoreCase) == 0);
- }
- }
-}
diff --git a/src/mscorlib/src/System/Resources/FileBasedResourceGroveler.cs b/src/mscorlib/src/System/Resources/FileBasedResourceGroveler.cs
index da4ee812a6..e1bbd2814a 100644
--- a/src/mscorlib/src/System/Resources/FileBasedResourceGroveler.cs
+++ b/src/mscorlib/src/System/Resources/FileBasedResourceGroveler.cs
@@ -62,7 +62,7 @@ namespace System.Resources
{
// We really don't think this should happen - we always
// expect the neutral locale's resources to be present.
- throw new MissingManifestResourceException(Environment.GetResourceString("MissingManifestResource_NoNeutralDisk") + Environment.NewLine + "baseName: " + _mediator.BaseNameField + " locationInfo: " + (_mediator.LocationInfo == null ? "<null>" : _mediator.LocationInfo.FullName) + " fileName: " + _mediator.GetResourceFileName(culture));
+ throw new MissingManifestResourceException(SR.MissingManifestResource_NoNeutralDisk + Environment.NewLine + "baseName: " + _mediator.BaseNameField + " locationInfo: " + (_mediator.LocationInfo == null ? "<null>" : _mediator.LocationInfo.FullName) + " fileName: " + _mediator.GetResourceFileName(culture));
}
}
}
@@ -142,7 +142,7 @@ namespace System.Resources
}
catch (MissingMethodException e)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ResMgrBadResSet_Type", _mediator.UserResourceSet.AssemblyQualifiedName), e);
+ throw new InvalidOperationException(SR.Format(SR.InvalidOperation_ResMgrBadResSet_Type, _mediator.UserResourceSet.AssemblyQualifiedName), e);
}
}
}
diff --git a/src/mscorlib/src/System/Resources/LooselyLinkedResourceReference.cs b/src/mscorlib/src/System/Resources/LooselyLinkedResourceReference.cs
index 9287ae4590..3179df09b7 100644
--- a/src/mscorlib/src/System/Resources/LooselyLinkedResourceReference.cs
+++ b/src/mscorlib/src/System/Resources/LooselyLinkedResourceReference.cs
@@ -39,9 +39,9 @@ namespace System.Resources {
if (typeName == null)
throw new ArgumentNullException(nameof(typeName));
if (looselyLinkedResourceName.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(looselyLinkedResourceName));
+ throw new ArgumentException(SR.Argument_EmptyName, nameof(looselyLinkedResourceName));
if (typeName.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(typeName));
+ throw new ArgumentException(SR.Argument_EmptyName, nameof(typeName));
Contract.EndContractBlock();
_manifestResourceName = looselyLinkedResourceName;
@@ -64,7 +64,7 @@ namespace System.Resources {
Stream data = assembly.GetManifestResourceStream(_manifestResourceName);
if (data == null)
- throw new MissingManifestResourceException(Environment.GetResourceString("MissingManifestResource_LooselyLinked", _manifestResourceName, assembly.FullName));
+ throw new MissingManifestResourceException(SR.Format(SR.MissingManifestResource_LooselyLinked, _manifestResourceName, assembly.FullName));
Type type = Type.GetType(_typeName, true);
diff --git a/src/mscorlib/src/System/Resources/ManifestBasedResourceGroveler.cs b/src/mscorlib/src/System/Resources/ManifestBasedResourceGroveler.cs
index 3ef0066e7e..0e9666b2b1 100644
--- a/src/mscorlib/src/System/Resources/ManifestBasedResourceGroveler.cs
+++ b/src/mscorlib/src/System/Resources/ManifestBasedResourceGroveler.cs
@@ -159,7 +159,7 @@ namespace System.Resources
{
if ((UltimateResourceFallbackLocation)fallback < UltimateResourceFallbackLocation.MainAssembly || (UltimateResourceFallbackLocation)fallback > UltimateResourceFallbackLocation.Satellite)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_InvalidNeutralResourcesLanguage_FallbackLoc", fallback));
+ throw new ArgumentException(SR.Format(SR.Arg_InvalidNeutralResourcesLanguage_FallbackLoc, fallback));
}
fallbackLocation = (UltimateResourceFallbackLocation)fallback;
}
@@ -185,7 +185,7 @@ namespace System.Resources
return CultureInfo.InvariantCulture;
}
- throw new ArgumentException(Environment.GetResourceString("Arg_InvalidNeutralResourcesLanguage_Asm_Culture", a.ToString(), cultureName), e);
+ throw new ArgumentException(SR.Format(SR.Arg_InvalidNeutralResourcesLanguage_Asm_Culture, a.ToString(), cultureName), e);
}
}
@@ -238,7 +238,7 @@ namespace System.Resources
// resMgrHeaderVersion is older than this ResMgr version.
// We should add in backwards compatibility support here.
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_ObsoleteResourcesFile", _mediator.MainAssembly.GetSimpleName()));
+ throw new NotSupportedException(SR.Format(SR.NotSupported_ObsoleteResourcesFile, _mediator.MainAssembly.GetSimpleName()));
}
store.Position = startPos;
@@ -334,7 +334,7 @@ namespace System.Resources
}
catch (MissingMethodException e)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ResMgrBadResSet_Type", _mediator.UserResourceSet.AssemblyQualifiedName), e);
+ throw new InvalidOperationException(SR.Format(SR.InvalidOperation_ResMgrBadResSet_Type, _mediator.UserResourceSet.AssemblyQualifiedName), e);
}
}
}
@@ -394,7 +394,7 @@ namespace System.Resources
}
else
{
- throw new MissingManifestResourceException(Environment.GetResourceString("MissingManifestResource_MultipleBlobs", givenName, satellite.ToString()));
+ throw new MissingManifestResourceException(SR.Format(SR.MissingManifestResource_MultipleBlobs, givenName, satellite.ToString()));
}
}
}
@@ -521,7 +521,7 @@ namespace System.Resources
{
missingCultureName = "<invariant>";
}
- throw new MissingSatelliteAssemblyException(Environment.GetResourceString("MissingSatelliteAssembly_Culture_Name", _mediator.NeutralResourcesCulture, satAssemName), missingCultureName);
+ throw new MissingSatelliteAssemblyException(SR.Format(SR.MissingSatelliteAssembly_Culture_Name, _mediator.NeutralResourcesCulture, satAssemName), missingCultureName);
}
private void HandleResourceStreamMissing(String fileName)
@@ -542,7 +542,7 @@ namespace System.Resources
if (_mediator.LocationInfo != null && _mediator.LocationInfo.Namespace != null)
resName = _mediator.LocationInfo.Namespace + Type.Delimiter;
resName += fileName;
- throw new MissingManifestResourceException(Environment.GetResourceString("MissingManifestResource_NoNeutralAsm", resName, _mediator.MainAssembly.GetSimpleName()));
+ throw new MissingManifestResourceException(SR.Format(SR.MissingManifestResource_NoNeutralAsm, resName, _mediator.MainAssembly.GetSimpleName()));
}
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
diff --git a/src/mscorlib/src/System/Resources/MissingManifestResourceException.cs b/src/mscorlib/src/System/Resources/MissingManifestResourceException.cs
index 9401806134..fd3c5b97fd 100644
--- a/src/mscorlib/src/System/Resources/MissingManifestResourceException.cs
+++ b/src/mscorlib/src/System/Resources/MissingManifestResourceException.cs
@@ -22,7 +22,7 @@ namespace System.Resources
public class MissingManifestResourceException : SystemException
{
public MissingManifestResourceException()
- : base(Environment.GetResourceString("Arg_MissingManifestResourceException"))
+ : base(SR.Arg_MissingManifestResourceException)
{
SetErrorCode(System.__HResults.COR_E_MISSINGMANIFESTRESOURCE);
}
diff --git a/src/mscorlib/src/System/Resources/MissingSatelliteAssemblyException.cs b/src/mscorlib/src/System/Resources/MissingSatelliteAssemblyException.cs
index f1f1494290..5f927f4259 100644
--- a/src/mscorlib/src/System/Resources/MissingSatelliteAssemblyException.cs
+++ b/src/mscorlib/src/System/Resources/MissingSatelliteAssemblyException.cs
@@ -26,7 +26,7 @@ namespace System.Resources
private String _cultureName;
public MissingSatelliteAssemblyException()
- : base(Environment.GetResourceString("MissingSatelliteAssembly_Default"))
+ : base(SR.MissingSatelliteAssembly_Default)
{
SetErrorCode(System.__HResults.COR_E_MISSINGSATELLITEASSEMBLY);
}
diff --git a/src/mscorlib/src/System/Resources/NeutralResourcesLanguageAttribute.cs b/src/mscorlib/src/System/Resources/NeutralResourcesLanguageAttribute.cs
index 83fb51d139..d124389b02 100644
--- a/src/mscorlib/src/System/Resources/NeutralResourcesLanguageAttribute.cs
+++ b/src/mscorlib/src/System/Resources/NeutralResourcesLanguageAttribute.cs
@@ -47,7 +47,7 @@ namespace System.Resources
if (cultureName == null)
throw new ArgumentNullException(nameof(cultureName));
if (!Enum.IsDefined(typeof(UltimateResourceFallbackLocation), location))
- throw new ArgumentException(Environment.GetResourceString("Arg_InvalidNeutralResourcesLanguage_FallbackLoc", location));
+ throw new ArgumentException(SR.Format(SR.Arg_InvalidNeutralResourcesLanguage_FallbackLoc, location));
Contract.EndContractBlock();
_culture = cultureName;
diff --git a/src/mscorlib/src/System/Resources/ResourceManager.cs b/src/mscorlib/src/System/Resources/ResourceManager.cs
index c60e8222fe..993efddbfc 100644
--- a/src/mscorlib/src/System/Resources/ResourceManager.cs
+++ b/src/mscorlib/src/System/Resources/ResourceManager.cs
@@ -310,7 +310,7 @@ namespace System.Resources
Contract.EndContractBlock();
if (!(assembly is RuntimeAssembly))
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeAssembly"));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeAssembly);
MainAssembly = assembly;
BaseNameField = baseName;
@@ -340,13 +340,13 @@ namespace System.Resources
Contract.EndContractBlock();
if (!(assembly is RuntimeAssembly))
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeAssembly"));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeAssembly);
MainAssembly = assembly;
BaseNameField = baseName;
if (usingResourceSet != null && (usingResourceSet != _minResourceSet) && !(usingResourceSet.IsSubclassOf(_minResourceSet)))
- throw new ArgumentException(Environment.GetResourceString("Arg_ResMgrNotResSet"), nameof(usingResourceSet));
+ throw new ArgumentException(SR.Arg_ResMgrNotResSet, nameof(usingResourceSet));
_userResourceSet = usingResourceSet;
CommonAssemblyInit();
@@ -367,7 +367,7 @@ namespace System.Resources
Contract.EndContractBlock();
if (!(resourceSource is RuntimeType))
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeType);
_locationInfo = resourceSource;
MainAssembly = _locationInfo.Assembly;
@@ -758,7 +758,7 @@ namespace System.Resources
// Ensure that the assembly reference is not null
if (a == null)
{
- throw new ArgumentNullException(nameof(a), Environment.GetResourceString("ArgumentNull_Assembly"));
+ throw new ArgumentNullException(nameof(a), SR.ArgumentNull_Assembly);
}
Contract.EndContractBlock();
@@ -1120,9 +1120,9 @@ namespace System.Resources
// Always throw if we did not fully succeed in initializing the WinRT Resource Manager.
if (_PRIExceptionInfo != null && _PRIExceptionInfo._PackageSimpleName != null && _PRIExceptionInfo._ResWFile != null)
- throw new MissingManifestResourceException(Environment.GetResourceString("MissingManifestResource_ResWFileNotLoaded", _PRIExceptionInfo._ResWFile, _PRIExceptionInfo._PackageSimpleName));
+ throw new MissingManifestResourceException(SR.Format(SR.MissingManifestResource_ResWFileNotLoaded, _PRIExceptionInfo._ResWFile, _PRIExceptionInfo._PackageSimpleName));
- throw new MissingManifestResourceException(Environment.GetResourceString("MissingManifestResource_NoPRIresources"));
+ throw new MissingManifestResourceException(SR.MissingManifestResource_NoPRIresources);
}
// Throws WinRT hresults.
@@ -1299,7 +1299,7 @@ namespace System.Resources
Object obj = GetObject(name, culture, false);
UnmanagedMemoryStream ums = obj as UnmanagedMemoryStream;
if (ums == null && obj != null)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ResourceNotStream_Name", name));
+ throw new InvalidOperationException(SR.Format(SR.InvalidOperation_ResourceNotStream_Name, name));
return ums;
}
diff --git a/src/mscorlib/src/System/Resources/ResourceReader.cs b/src/mscorlib/src/System/Resources/ResourceReader.cs
index 49795d8f6f..9734343f92 100644
--- a/src/mscorlib/src/System/Resources/ResourceReader.cs
+++ b/src/mscorlib/src/System/Resources/ResourceReader.cs
@@ -133,7 +133,7 @@ namespace System.Resources
if (stream == null)
throw new ArgumentNullException(nameof(stream));
if (!stream.CanRead)
- throw new ArgumentException(Environment.GetResourceString("Argument_StreamNotReadable"));
+ throw new ArgumentException(SR.Argument_StreamNotReadable);
Contract.EndContractBlock();
_resCache = new Dictionary<String, ResourceLocator>(FastResourceComparer.Default);
@@ -211,7 +211,7 @@ namespace System.Resources
int stringLength = _store.Read7BitEncodedInt();
if (stringLength < 0)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_NegativeStringLength"));
+ throw new BadImageFormatException(SR.BadImageFormat_NegativeStringLength);
}
_store.BaseStream.Seek(stringLength, SeekOrigin.Current);
}
@@ -239,7 +239,7 @@ namespace System.Resources
r = ReadUnalignedI4(&_namePositionsPtr[index]);
if (r < 0 || r > _dataSectionOffset - _nameSectionOffset)
{
- throw new FormatException(Environment.GetResourceString("BadImageFormat_ResourcesNameInvalidOffset", r));
+ throw new FormatException(SR.Format(SR.BadImageFormat_ResourcesNameInvalidOffset, r));
}
return r;
}
@@ -252,7 +252,7 @@ namespace System.Resources
public IDictionaryEnumerator GetEnumerator()
{
if (_resCache == null)
- throw new InvalidOperationException(Environment.GetResourceString("ResourceReaderIsClosed"));
+ throw new InvalidOperationException(SR.ResourceReaderIsClosed);
return new ResourceEnumerator(this);
}
@@ -341,7 +341,7 @@ namespace System.Resources
int dataPos = _store.ReadInt32();
if (dataPos < 0 || dataPos >= _store.BaseStream.Length - _dataSectionOffset)
{
- throw new FormatException(Environment.GetResourceString("BadImageFormat_ResourcesDataInvalidOffset", dataPos));
+ throw new FormatException(SR.Format(SR.BadImageFormat_ResourcesDataInvalidOffset, dataPos));
}
return dataPos;
}
@@ -361,7 +361,7 @@ namespace System.Resources
int byteLen = _store.Read7BitEncodedInt();
if (byteLen < 0)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_NegativeStringLength"));
+ throw new BadImageFormatException(SR.BadImageFormat_NegativeStringLength);
}
if (_ums != null)
{
@@ -370,7 +370,7 @@ namespace System.Resources
_ums.Seek(byteLen, SeekOrigin.Current);
if (_ums.Position > _ums.Length)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourcesNameTooLong"));
+ throw new BadImageFormatException(SR.BadImageFormat_ResourcesNameTooLong);
}
// On 64-bit machines, these char*'s may be misaligned. Use a
@@ -387,7 +387,7 @@ namespace System.Resources
{
int n = _store.Read(bytes, byteLen - numBytesToRead, numBytesToRead);
if (n == 0)
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourceNameCorrupted"));
+ throw new BadImageFormatException(SR.BadImageFormat_ResourceNameCorrupted);
numBytesToRead -= n;
}
return FastResourceComparer.CompareOrdinal(bytes, byteLen / 2, name) == 0;
@@ -410,13 +410,13 @@ namespace System.Resources
byteLen = _store.Read7BitEncodedInt();
if (byteLen < 0)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_NegativeStringLength"));
+ throw new BadImageFormatException(SR.BadImageFormat_NegativeStringLength);
}
if (_ums != null)
{
if (_ums.Position > _ums.Length - byteLen)
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourcesIndexTooLong", index));
+ throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResourcesIndexTooLong, index));
String s = null;
char* charPtr = (char*)_ums.PositionPointer;
@@ -438,7 +438,7 @@ namespace System.Resources
dataOffset = _store.ReadInt32();
if (dataOffset < 0 || dataOffset >= _store.BaseStream.Length - _dataSectionOffset)
{
- throw new FormatException(Environment.GetResourceString("BadImageFormat_ResourcesDataInvalidOffset", dataOffset));
+ throw new FormatException(SR.Format(SR.BadImageFormat_ResourcesDataInvalidOffset, dataOffset));
}
return s;
}
@@ -452,13 +452,13 @@ namespace System.Resources
{
int n = _store.Read(bytes, byteLen - count, count);
if (n == 0)
- throw new EndOfStreamException(Environment.GetResourceString("BadImageFormat_ResourceNameCorrupted_NameIndex", index));
+ throw new EndOfStreamException(SR.Format(SR.BadImageFormat_ResourceNameCorrupted_NameIndex, index));
count -= n;
}
dataOffset = _store.ReadInt32();
if (dataOffset < 0 || dataOffset >= _store.BaseStream.Length - _dataSectionOffset)
{
- throw new FormatException(Environment.GetResourceString("BadImageFormat_ResourcesDataInvalidOffset", dataOffset));
+ throw new FormatException(SR.Format(SR.BadImageFormat_ResourcesDataInvalidOffset, dataOffset));
}
}
return Encoding.Unicode.GetString(bytes, 0, byteLen);
@@ -479,7 +479,7 @@ namespace System.Resources
int dataPos = _store.ReadInt32();
if (dataPos < 0 || dataPos >= _store.BaseStream.Length - _dataSectionOffset)
{
- throw new FormatException(Environment.GetResourceString("BadImageFormat_ResourcesDataInvalidOffset", dataPos));
+ throw new FormatException(SR.Format(SR.BadImageFormat_ResourcesDataInvalidOffset, dataPos));
}
BCLDebug.Log("RESMGRFILEFORMAT", "GetValueForNameIndex: dataPos: " + dataPos);
ResourceTypeCode junk;
@@ -505,7 +505,7 @@ namespace System.Resources
if (typeIndex == -1)
return null;
if (FindType(typeIndex) != typeof(String))
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ResourceNotString_Type", FindType(typeIndex).FullName));
+ throw new InvalidOperationException(SR.Format(SR.InvalidOperation_ResourceNotString_Type, FindType(typeIndex).FullName));
s = _store.ReadString();
}
else
@@ -518,7 +518,7 @@ namespace System.Resources
typeString = typeCode.ToString();
else
typeString = FindType(typeCode - ResourceTypeCode.StartOfUserTypes).FullName;
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ResourceNotString_Type", typeString));
+ throw new InvalidOperationException(SR.Format(SR.InvalidOperation_ResourceNotString_Type, typeString));
}
if (typeCode == ResourceTypeCode.String) // ignore Null
s = _store.ReadString();
@@ -564,11 +564,11 @@ namespace System.Resources
}
catch (EndOfStreamException eof)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_TypeMismatch"), eof);
+ throw new BadImageFormatException(SR.BadImageFormat_TypeMismatch, eof);
}
catch (ArgumentOutOfRangeException e)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_TypeMismatch"), e);
+ throw new BadImageFormatException(SR.BadImageFormat_TypeMismatch, e);
}
}
@@ -623,7 +623,7 @@ namespace System.Resources
}
else
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_ResourceObjectSerialization"));
+ throw new NotSupportedException(SR.NotSupported_ResourceObjectSerialization);
}
}
@@ -640,11 +640,11 @@ namespace System.Resources
}
catch (EndOfStreamException eof)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_TypeMismatch"), eof);
+ throw new BadImageFormatException(SR.BadImageFormat_TypeMismatch, eof);
}
catch (ArgumentOutOfRangeException e)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_TypeMismatch"), e);
+ throw new BadImageFormatException(SR.BadImageFormat_TypeMismatch, e);
}
}
@@ -717,21 +717,21 @@ namespace System.Resources
int len = _store.ReadInt32();
if (len < 0)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourceDataLengthInvalid", len));
+ throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len));
}
if (_ums == null)
{
if (len > _store.BaseStream.Length)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourceDataLengthInvalid", len));
+ throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len));
}
return _store.ReadBytes(len);
}
if (len > _ums.Length - _ums.Position)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourceDataLengthInvalid", len));
+ throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len));
}
byte[] bytes = new byte[len];
@@ -745,7 +745,7 @@ namespace System.Resources
int len = _store.ReadInt32();
if (len < 0)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourceDataLengthInvalid", len));
+ throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len));
}
if (_ums == null)
{
@@ -757,7 +757,7 @@ namespace System.Resources
// make sure we don't create an UnmanagedMemoryStream that is longer than the resource stream.
if (len > _ums.Length - _ums.Position)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourceDataLengthInvalid", len));
+ throw new BadImageFormatException(SR.Format(SR.BadImageFormat_ResourceDataLengthInvalid, len));
}
// For the case that we've memory mapped in the .resources
@@ -771,13 +771,13 @@ namespace System.Resources
default:
if (typeCode < ResourceTypeCode.StartOfUserTypes)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_TypeMismatch"));
+ throw new BadImageFormatException(SR.BadImageFormat_TypeMismatch);
}
break;
}
// Normal serialized objects
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_ResourceObjectSerialization"));
+ throw new NotSupportedException(SR.NotSupported_ResourceObjectSerialization);
}
@@ -797,11 +797,11 @@ namespace System.Resources
}
catch (EndOfStreamException eof)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourcesHeaderCorrupted"), eof);
+ throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted, eof);
}
catch (IndexOutOfRangeException e)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourcesHeaderCorrupted"), e);
+ throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted, e);
}
}
@@ -811,7 +811,7 @@ namespace System.Resources
// Check for magic number
int magicNum = _store.ReadInt32();
if (magicNum != ResourceManager.MagicNumber)
- throw new ArgumentException(Environment.GetResourceString("Resources_StreamNotValid"));
+ throw new ArgumentException(SR.Resources_StreamNotValid);
// Assuming this is ResourceManager header V1 or greater, hopefully
// after the version number there is a number of bytes to skip
// to bypass the rest of the ResMgr header. For V2 or greater, we
@@ -820,7 +820,7 @@ namespace System.Resources
int numBytesToSkip = _store.ReadInt32();
if (numBytesToSkip < 0 || resMgrHeaderVersion < 0)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourcesHeaderCorrupted"));
+ throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted);
}
if (resMgrHeaderVersion > 1)
{
@@ -839,7 +839,7 @@ namespace System.Resources
AssemblyName mscorlib = new AssemblyName(ResourceManager.MscorlibName);
if (!ResourceManager.CompareNames(readerType, ResourceManager.ResReaderTypeName, mscorlib))
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_WrongResourceReader_Type", readerType));
+ throw new NotSupportedException(SR.Format(SR.NotSupported_WrongResourceReader_Type, readerType));
// Skip over type name for a suitable ResourceSet
SkipString();
@@ -849,7 +849,7 @@ namespace System.Resources
// Do file version check
int version = _store.ReadInt32();
if (version != RuntimeResourceSet.Version && version != 1)
- throw new ArgumentException(Environment.GetResourceString("Arg_ResourceFileUnsupportedVersion", RuntimeResourceSet.Version, version));
+ throw new ArgumentException(SR.Format(SR.Arg_ResourceFileUnsupportedVersion, RuntimeResourceSet.Version, version));
_version = version;
#if RESOURCE_FILE_FORMAT_DEBUG
@@ -875,7 +875,7 @@ namespace System.Resources
_numResources = _store.ReadInt32();
if (_numResources < 0)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourcesHeaderCorrupted"));
+ throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted);
}
BCLDebug.Log("RESMGRFILEFORMAT", "ReadResources: Expecting " + _numResources + " resources.");
#if RESOURCE_FILE_FORMAT_DEBUG
@@ -888,7 +888,7 @@ namespace System.Resources
int numTypes = _store.ReadInt32();
if (numTypes < 0)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourcesHeaderCorrupted"));
+ throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted);
}
_typeTable = new RuntimeType[numTypes];
_typeNamePositions = new int[numTypes];
@@ -942,7 +942,7 @@ namespace System.Resources
int seekPos = unchecked(4 * _numResources);
if (seekPos < 0)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourcesHeaderCorrupted"));
+ throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted);
}
unsafe
{
@@ -969,7 +969,7 @@ namespace System.Resources
int namePosition = _store.ReadInt32();
if (namePosition < 0)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourcesHeaderCorrupted"));
+ throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted);
}
_namePositions[i] = namePosition;
@@ -980,7 +980,7 @@ namespace System.Resources
int seekPos = unchecked(4 * _numResources);
if (seekPos < 0)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourcesHeaderCorrupted"));
+ throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted);
}
unsafe
{
@@ -996,7 +996,7 @@ namespace System.Resources
_dataSectionOffset = _store.ReadInt32();
if (_dataSectionOffset < 0)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourcesHeaderCorrupted"));
+ throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted);
}
// Store current location as start of name section
@@ -1005,7 +1005,7 @@ namespace System.Resources
// _nameSectionOffset should be <= _dataSectionOffset; if not, it's corrupt
if (_dataSectionOffset < _nameSectionOffset)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_ResourcesHeaderCorrupted"));
+ throw new BadImageFormatException(SR.BadImageFormat_ResourcesHeaderCorrupted);
}
BCLDebug.Log("RESMGRFILEFORMAT", String.Format(CultureInfo.InvariantCulture, "ReadResources: _nameOffset = 0x{0:x} _dataOffset = 0x{1:x}", _nameSectionOffset, _dataSectionOffset));
@@ -1018,7 +1018,7 @@ namespace System.Resources
{
if (typeIndex < 0 || typeIndex >= _typeTable.Length)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_InvalidType"));
+ throw new BadImageFormatException(SR.BadImageFormat_InvalidType);
}
if (_typeTable[typeIndex] == null)
{
@@ -1041,7 +1041,7 @@ namespace System.Resources
// getting to Type.GetType -- this is costly with v1 resource formats.
catch (FileNotFoundException)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_ResourceObjectSerialization"));
+ throw new NotSupportedException(SR.NotSupported_ResourceObjectSerialization);
}
finally
{
@@ -1059,7 +1059,7 @@ namespace System.Resources
throw new ArgumentNullException(nameof(resourceName));
Contract.EndContractBlock();
if (_resCache == null)
- throw new InvalidOperationException(Environment.GetResourceString("ResourceReaderIsClosed"));
+ throw new InvalidOperationException(SR.ResourceReaderIsClosed);
// Get the type information from the data section. Also,
// sort all of the data section's indexes to compute length of
@@ -1069,7 +1069,7 @@ namespace System.Resources
int dataPos = FindPosForResource(resourceName);
if (dataPos == -1)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_ResourceNameNotExist", resourceName));
+ throw new ArgumentException(SR.Format(SR.Arg_ResourceNameNotExist, resourceName));
}
lock (this)
@@ -1082,14 +1082,14 @@ namespace System.Resources
int numBytesToSkip = _store.Read7BitEncodedInt();
if (numBytesToSkip < 0)
{
- throw new FormatException(Environment.GetResourceString("BadImageFormat_ResourcesNameInvalidOffset", numBytesToSkip));
+ throw new FormatException(SR.Format(SR.BadImageFormat_ResourcesNameInvalidOffset, numBytesToSkip));
}
_store.BaseStream.Position += numBytesToSkip;
int dPos = _store.ReadInt32();
if (dPos < 0 || dPos >= _store.BaseStream.Length - _dataSectionOffset)
{
- throw new FormatException(Environment.GetResourceString("BadImageFormat_ResourcesDataInvalidOffset", dPos));
+ throw new FormatException(SR.Format(SR.BadImageFormat_ResourcesDataInvalidOffset, dPos));
}
sortedDataPositions[i] = dPos;
}
@@ -1106,7 +1106,7 @@ namespace System.Resources
ResourceTypeCode typeCode = (ResourceTypeCode)_store.Read7BitEncodedInt();
if (typeCode < 0 || typeCode >= ResourceTypeCode.StartOfUserTypes + _typeTable.Length)
{
- throw new BadImageFormatException(Environment.GetResourceString("BadImageFormat_InvalidType"));
+ throw new BadImageFormatException(SR.BadImageFormat_InvalidType);
}
resourceType = TypeNameFromTypeCode(typeCode);
@@ -1115,7 +1115,7 @@ namespace System.Resources
len -= (int)(_store.BaseStream.Position - (_dataSectionOffset + dataPos));
byte[] bytes = _store.ReadBytes(len);
if (bytes.Length != len)
- throw new FormatException(Environment.GetResourceString("BadImageFormat_ResourceNameCorrupted"));
+ throw new FormatException(SR.BadImageFormat_ResourceNameCorrupted);
resourceData = bytes;
}
}
@@ -1181,9 +1181,9 @@ namespace System.Resources
{
get
{
- if (_currentName == ENUM_DONE) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumEnded));
- if (!_currentIsValid) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumNotStarted));
- if (_reader._resCache == null) throw new InvalidOperationException(Environment.GetResourceString("ResourceReaderIsClosed"));
+ if (_currentName == ENUM_DONE) throw new InvalidOperationException(SR.GetResourceString(ResId.InvalidOperation_EnumEnded));
+ if (!_currentIsValid) throw new InvalidOperationException(SR.GetResourceString(ResId.InvalidOperation_EnumNotStarted));
+ if (_reader._resCache == null) throw new InvalidOperationException(SR.ResourceReaderIsClosed);
return _reader.AllocateStringForNameIndex(_currentName, out _dataPosition);
}
@@ -1210,9 +1210,9 @@ namespace System.Resources
{
get
{
- if (_currentName == ENUM_DONE) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumEnded));
- if (!_currentIsValid) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumNotStarted));
- if (_reader._resCache == null) throw new InvalidOperationException(Environment.GetResourceString("ResourceReaderIsClosed"));
+ if (_currentName == ENUM_DONE) throw new InvalidOperationException(SR.GetResourceString(ResId.InvalidOperation_EnumEnded));
+ if (!_currentIsValid) throw new InvalidOperationException(SR.GetResourceString(ResId.InvalidOperation_EnumNotStarted));
+ if (_reader._resCache == null) throw new InvalidOperationException(SR.ResourceReaderIsClosed);
String key;
Object value = null;
@@ -1248,9 +1248,9 @@ namespace System.Resources
{
get
{
- if (_currentName == ENUM_DONE) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumEnded));
- if (!_currentIsValid) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumNotStarted));
- if (_reader._resCache == null) throw new InvalidOperationException(Environment.GetResourceString("ResourceReaderIsClosed"));
+ if (_currentName == ENUM_DONE) throw new InvalidOperationException(SR.GetResourceString(ResId.InvalidOperation_EnumEnded));
+ if (!_currentIsValid) throw new InvalidOperationException(SR.GetResourceString(ResId.InvalidOperation_EnumNotStarted));
+ if (_reader._resCache == null) throw new InvalidOperationException(SR.ResourceReaderIsClosed);
// Consider using _resCache here, eventually, if
// this proves to be an interesting perf scenario.
@@ -1262,7 +1262,7 @@ namespace System.Resources
public void Reset()
{
- if (_reader._resCache == null) throw new InvalidOperationException(Environment.GetResourceString("ResourceReaderIsClosed"));
+ if (_reader._resCache == null) throw new InvalidOperationException(SR.ResourceReaderIsClosed);
_currentIsValid = false;
_currentName = ENUM_NOT_STARTED;
}
diff --git a/src/mscorlib/src/System/Resources/ResourceSet.cs b/src/mscorlib/src/System/Resources/ResourceSet.cs
index 0fac0a9abc..8775f6411a 100644
--- a/src/mscorlib/src/System/Resources/ResourceSet.cs
+++ b/src/mscorlib/src/System/Resources/ResourceSet.cs
@@ -186,7 +186,6 @@ namespace System.Resources
return GetEnumeratorHelper();
}
- /// <internalonly/>
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumeratorHelper();
@@ -196,7 +195,7 @@ namespace System.Resources
{
Hashtable copyOfTable = Table; // Avoid a race with Dispose
if (copyOfTable == null)
- throw new ObjectDisposedException(null, Environment.GetResourceString("ObjectDisposed_ResourceSet"));
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_ResourceSet);
return copyOfTable.GetEnumerator();
}
@@ -211,7 +210,7 @@ namespace System.Resources
}
catch (InvalidCastException)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ResourceNotString_Name", name));
+ throw new InvalidOperationException(SR.Format(SR.InvalidOperation_ResourceNotString_Name, name));
}
}
@@ -228,7 +227,7 @@ namespace System.Resources
}
catch (InvalidCastException)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ResourceNotString_Name", name));
+ throw new InvalidOperationException(SR.Format(SR.InvalidOperation_ResourceNotString_Name, name));
}
// case-sensitive lookup succeeded
@@ -245,7 +244,7 @@ namespace System.Resources
}
catch (InvalidCastException)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ResourceNotString_Name", name));
+ throw new InvalidOperationException(SR.Format(SR.InvalidOperation_ResourceNotString_Name, name));
}
}
@@ -293,7 +292,7 @@ namespace System.Resources
Hashtable copyOfTable = Table; // Avoid a race with Dispose
if (copyOfTable == null)
- throw new ObjectDisposedException(null, Environment.GetResourceString("ObjectDisposed_ResourceSet"));
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_ResourceSet);
return copyOfTable[name];
}
@@ -303,7 +302,7 @@ namespace System.Resources
Hashtable copyOfTable = Table; // Avoid a race with Dispose
if (copyOfTable == null)
- throw new ObjectDisposedException(null, Environment.GetResourceString("ObjectDisposed_ResourceSet"));
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_ResourceSet);
Hashtable caseTable = _caseInsensitiveTable; // Avoid a race condition with Close
if (caseTable == null)
diff --git a/src/mscorlib/src/System/Resources/RuntimeResourceSet.cs b/src/mscorlib/src/System/Resources/RuntimeResourceSet.cs
index 202fe50637..e9c038a498 100644
--- a/src/mscorlib/src/System/Resources/RuntimeResourceSet.cs
+++ b/src/mscorlib/src/System/Resources/RuntimeResourceSet.cs
@@ -259,7 +259,7 @@ namespace System.Resources
{
IResourceReader copyOfReader = Reader;
if (copyOfReader == null || _resCache == null)
- throw new ObjectDisposedException(null, Environment.GetResourceString("ObjectDisposed_ResourceSet"));
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_ResourceSet);
return copyOfReader.GetEnumerator();
}
@@ -292,7 +292,7 @@ namespace System.Resources
if (key == null)
throw new ArgumentNullException(nameof(key));
if (Reader == null || _resCache == null)
- throw new ObjectDisposedException(null, Environment.GetResourceString("ObjectDisposed_ResourceSet"));
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_ResourceSet);
Contract.EndContractBlock();
Object value = null;
@@ -301,7 +301,7 @@ namespace System.Resources
lock (Reader)
{
if (Reader == null)
- throw new ObjectDisposedException(null, Environment.GetResourceString("ObjectDisposed_ResourceSet"));
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_ResourceSet);
if (_defaultReader != null)
{
diff --git a/src/mscorlib/src/System/RtType.cs b/src/mscorlib/src/System/RtType.cs
index 9a3d9ab42f..678e46f716 100644
--- a/src/mscorlib/src/System/RtType.cs
+++ b/src/mscorlib/src/System/RtType.cs
@@ -1832,7 +1832,7 @@ namespace System
if (!loaderAssuredCompatible)
throw new ArgumentException(String.Format(
- CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_ResolveMethodHandle"),
+ CultureInfo.CurrentCulture, SR.Argument_ResolveMethodHandle,
reflectedType.ToString(), declaredType.ToString()));
}
// Action<in string> is assignable from, but not a subclass of Action<in object>.
@@ -1860,7 +1860,7 @@ namespace System
{
// ignoring instantiation is the ReflectedType is not a subtype of the DeclaringType
throw new ArgumentException(String.Format(
- CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_ResolveMethodHandle"),
+ CultureInfo.CurrentCulture, SR.Argument_ResolveMethodHandle,
reflectedType.ToString(), declaredType.ToString()));
}
@@ -1882,7 +1882,7 @@ namespace System
{
// declaredType is not Array, not generic, and not assignable from reflectedType
throw new ArgumentException(String.Format(
- CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_ResolveMethodHandle"),
+ CultureInfo.CurrentCulture, SR.Argument_ResolveMethodHandle,
reflectedType.ToString(), declaredType.ToString()));
}
}
@@ -1950,7 +1950,7 @@ namespace System
!RuntimeTypeHandle.CompareCanonicalHandles(declaredType, reflectedType))
{
throw new ArgumentException(String.Format(
- CultureInfo.CurrentCulture, Environment.GetResourceString("Argument_ResolveFieldHandle"),
+ CultureInfo.CurrentCulture, SR.Argument_ResolveFieldHandle,
reflectedType.ToString(),
declaredType.ToString()));
}
@@ -1984,7 +1984,7 @@ namespace System
{
if (type.IsPointer || type.IsByRef || type == typeof(void))
throw new ArgumentException(
- Environment.GetResourceString("Argument_NeverValidGenericArgument", type.ToString()));
+ SR.Format(SR.Argument_NeverValidGenericArgument, type.ToString()));
}
@@ -2004,7 +2004,7 @@ namespace System
if (genericArguments.Length != genericParamters.Length)
throw new ArgumentException(
- Environment.GetResourceString("Argument_NotEnoughGenArguments", genericArguments.Length, genericParamters.Length));
+ SR.Format(SR.Argument_NotEnoughGenArguments, genericArguments.Length, genericParamters.Length));
}
internal static void ValidateGenericArguments(MemberInfo definition, RuntimeType[] genericArguments, Exception e)
@@ -2041,8 +2041,7 @@ namespace System
typeContext, methodContext, genericArgument.GetTypeHandleInternal().GetTypeChecked()))
{
throw new ArgumentException(
- Environment.GetResourceString("Argument_GenConstraintViolation",
- i.ToString(CultureInfo.CurrentCulture), genericArgument.ToString(), definition.ToString(), genericParameter.ToString()), e);
+ SR.Format(SR.Argument_GenConstraintViolation, i.ToString(CultureInfo.CurrentCulture), genericArgument.ToString(), definition.ToString(), genericParameter.ToString()), e);
}
}
}
@@ -2482,24 +2481,6 @@ namespace System
}
}
- internal bool IsSpecialSerializableType()
- {
- RuntimeType rt = this;
- do
- {
- // In all sane cases we only need to compare the direct level base type with
- // System.Enum and System.MulticastDelegate. However, a generic argument can
- // have a base type constraint that is Delegate or even a real delegate type.
- // Let's maintain compatibility and return true for them.
- if (rt == RuntimeType.DelegateType || rt == RuntimeType.EnumType)
- return true;
-
- rt = rt.GetBaseType();
- } while (rt != null);
-
- return false;
- }
-
private string GetDefaultMemberName()
{
return Cache.GetDefaultMemberName();
@@ -2731,7 +2712,7 @@ namespace System
public override InterfaceMapping GetInterfaceMap(Type ifaceType)
{
if (IsGenericParameter)
- throw new InvalidOperationException(Environment.GetResourceString("Arg_GenericParameter"));
+ throw new InvalidOperationException(SR.Arg_GenericParameter);
if ((object)ifaceType == null)
throw new ArgumentNullException(nameof(ifaceType));
@@ -2740,7 +2721,7 @@ namespace System
RuntimeType ifaceRtType = ifaceType as RuntimeType;
if (ifaceRtType == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"), nameof(ifaceType));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(ifaceType));
RuntimeTypeHandle ifaceRtTypeHandle = ifaceRtType.GetTypeHandleInternal();
@@ -2751,7 +2732,7 @@ namespace System
// SZArrays implement the methods on IList`1, IEnumerable`1, and ICollection`1 with
// SZArrayHelper and some runtime magic. We don't have accurate interface maps for them.
if (IsSZArray && ifaceType.IsGenericType)
- throw new ArgumentException(Environment.GetResourceString("Argument_ArrayGetInterfaceMap"));
+ throw new ArgumentException(SR.Argument_ArrayGetInterfaceMap);
int ifaceInstanceMethodCount = RuntimeTypeHandle.GetNumVirtuals(ifaceRtType);
@@ -2811,9 +2792,9 @@ namespace System
for (int j = 1; j < candidates.Count; j++)
{
MethodInfo methodInfo = candidates[j];
- if (!System.DefaultBinder.CompareMethodSigAndName(methodInfo, firstCandidate))
+ if (!System.DefaultBinder.CompareMethodSig(methodInfo, firstCandidate))
{
- throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException"));
+ throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException);
}
}
@@ -2886,7 +2867,7 @@ namespace System
{
if ((object)returnType == null)
// if we are here we have no args or property type to select over and we have more than one property with that name
- throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException"));
+ throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException);
}
}
@@ -2920,7 +2901,7 @@ namespace System
if ((bindingAttr & eventInfo.BindingFlags) == eventInfo.BindingFlags)
{
if (match != null)
- throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException"));
+ throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException);
match = eventInfo;
}
@@ -2952,7 +2933,7 @@ namespace System
if (match != null)
{
if (Object.ReferenceEquals(fieldInfo.DeclaringType, match.DeclaringType))
- throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException"));
+ throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException);
if ((match.DeclaringType.IsInterface == true) && (fieldInfo.DeclaringType.IsInterface == true))
multipleStaticFieldMatches = true;
@@ -2964,7 +2945,7 @@ namespace System
}
if (multipleStaticFieldMatches && match.DeclaringType.IsInterface)
- throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException"));
+ throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException);
return match;
}
@@ -2996,7 +2977,7 @@ namespace System
if (RuntimeType.FilterApplyType(iface, bindingAttr, name, false, ns))
{
if (match != null)
- throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException"));
+ throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException);
match = iface;
}
@@ -3027,7 +3008,7 @@ namespace System
if (RuntimeType.FilterApplyType(nestedType, bindingAttr, name, false, ns))
{
if (match != null)
- throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException"));
+ throw new AmbiguousMatchException(SR.Arg_AmbiguousMatchException);
match = nestedType;
}
@@ -3231,7 +3212,7 @@ namespace System
get
{
if (!IsGenericParameter)
- throw new InvalidOperationException(Environment.GetResourceString("Arg_NotGenericParameter"));
+ throw new InvalidOperationException(SR.Arg_NotGenericParameter);
Contract.EndContractBlock();
IRuntimeMethodInfo declaringMethod = RuntimeTypeHandle.GetDeclaringMethod(this);
@@ -3516,7 +3497,7 @@ namespace System
get
{
if (!IsGenericParameter)
- throw new InvalidOperationException(Environment.GetResourceString("Arg_NotGenericParameter"));
+ throw new InvalidOperationException(SR.Arg_NotGenericParameter);
Contract.EndContractBlock();
GenericParameterAttributes attributes;
@@ -3558,7 +3539,7 @@ namespace System
public override int GetArrayRank()
{
if (!IsArrayImpl())
- throw new ArgumentException(Environment.GetResourceString("Argument_HasToBeArrayClass"));
+ throw new ArgumentException(SR.Argument_HasToBeArrayClass);
return RuntimeTypeHandle.GetArrayRank(this);
}
@@ -3573,7 +3554,7 @@ namespace System
public override string[] GetEnumNames()
{
if (!IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
+ throw new ArgumentException(SR.Arg_MustBeEnum, "enumType");
Contract.EndContractBlock();
String[] ret = Enum.InternalGetNames(this);
@@ -3589,7 +3570,7 @@ namespace System
public override Array GetEnumValues()
{
if (!IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
+ throw new ArgumentException(SR.Arg_MustBeEnum, "enumType");
Contract.EndContractBlock();
// Get all of the values
@@ -3610,7 +3591,7 @@ namespace System
public override Type GetEnumUnderlyingType()
{
if (!IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
+ throw new ArgumentException(SR.Arg_MustBeEnum, "enumType");
Contract.EndContractBlock();
return Enum.InternalGetUnderlyingType(this);
@@ -3629,7 +3610,7 @@ namespace System
if (valueType.IsEnum)
{
if (!valueType.IsEquivalentTo(this))
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumAndObjectMustBeSameType", valueType.ToString(), this.ToString()));
+ throw new ArgumentException(SR.Format(SR.Arg_EnumAndObjectMustBeSameType, valueType.ToString(), this.ToString()));
valueType = (RuntimeType)valueType.GetEnumUnderlyingType();
}
@@ -3650,7 +3631,7 @@ namespace System
{
RuntimeType underlyingType = Enum.InternalGetUnderlyingType(this);
if (underlyingType != valueType)
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumUnderlyingTypeAndObjectMustBeSameType", valueType.ToString(), underlyingType.ToString()));
+ throw new ArgumentException(SR.Format(SR.Arg_EnumUnderlyingTypeAndObjectMustBeSameType, valueType.ToString(), underlyingType.ToString()));
ulong[] ulValues = Enum.InternalGetValues(this);
ulong ulValue = Enum.ToUInt64(value);
@@ -3659,7 +3640,7 @@ namespace System
}
else
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_UnknownEnumType"));
+ throw new InvalidOperationException(SR.InvalidOperation_UnknownEnumType);
}
}
@@ -3672,7 +3653,7 @@ namespace System
Type valueType = value.GetType();
if (!(valueType.IsEnum || IsIntegerType(valueType)))
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnumBaseTypeOrEnum"), nameof(value));
+ throw new ArgumentException(SR.Arg_MustBeEnumBaseTypeOrEnum, nameof(value));
ulong ulValue = Enum.ToUInt64(value);
@@ -3706,10 +3687,10 @@ namespace System
if (!IsGenericTypeDefinition)
throw new InvalidOperationException(
- Environment.GetResourceString("Arg_NotGenericTypeDefinition", this));
+ SR.Format(SR.Arg_NotGenericTypeDefinition, this));
if (GetGenericArguments().Length != instantiation.Length)
- throw new ArgumentException(Environment.GetResourceString("Argument_GenericArgsCount"), nameof(instantiation));
+ throw new ArgumentException(SR.Argument_GenericArgsCount, nameof(instantiation));
for (int i = 0; i < instantiation.Length; i++)
{
@@ -3764,7 +3745,7 @@ namespace System
get
{
if (!IsGenericParameter)
- throw new InvalidOperationException(Environment.GetResourceString("Arg_NotGenericParameter"));
+ throw new InvalidOperationException(SR.Arg_NotGenericParameter);
Contract.EndContractBlock();
return new RuntimeTypeHandle(this).GetGenericVariableIndex();
@@ -3774,7 +3755,7 @@ namespace System
public override Type GetGenericTypeDefinition()
{
if (!IsGenericType)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotGenericType"));
+ throw new InvalidOperationException(SR.InvalidOperation_NotGenericType);
Contract.EndContractBlock();
return RuntimeTypeHandle.GetGenericTypeDefinition(this);
@@ -3798,7 +3779,7 @@ namespace System
public override Type[] GetGenericParameterConstraints()
{
if (!IsGenericParameter)
- throw new InvalidOperationException(Environment.GetResourceString("Arg_NotGenericParameter"));
+ throw new InvalidOperationException(SR.Arg_NotGenericParameter);
Contract.EndContractBlock();
Type[] constraints = new RuntimeTypeHandle(this).GetConstraints();
@@ -3900,7 +3881,7 @@ namespace System
RuntimeType valueType;
Pointer pointer = value as Pointer;
if (pointer != null)
- valueType = pointer.GetPointerType();
+ valueType = (RuntimeType)pointer.GetPointerType();
else
valueType = (RuntimeType)value.GetType();
@@ -3914,7 +3895,7 @@ namespace System
}
if ((invokeAttr & BindingFlags.ExactBinding) == BindingFlags.ExactBinding)
- throw new ArgumentException(String.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString("Arg_ObjObjEx"), value.GetType(), this));
+ throw new ArgumentException(String.Format(CultureInfo.CurrentUICulture, SR.Arg_ObjObjEx, value.GetType(), this));
return TryChangeType(value, binder, culture, needsSpecialCast);
}
@@ -3941,7 +3922,7 @@ namespace System
RuntimeType valueType;
Pointer pointer = value as Pointer;
if (pointer != null)
- valueType = pointer.GetPointerType();
+ valueType = (RuntimeType)pointer.GetPointerType();
else
valueType = (RuntimeType)value.GetType();
@@ -3955,7 +3936,7 @@ namespace System
}
}
- throw new ArgumentException(String.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString("Arg_ObjObjEx"), value.GetType(), this));
+ throw new ArgumentException(String.Format(CultureInfo.CurrentUICulture, SR.Arg_ObjObjEx, value.GetType(), this));
}
// GetDefaultMembers
@@ -3986,13 +3967,13 @@ namespace System
Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
{
if (IsGenericParameter)
- throw new InvalidOperationException(Environment.GetResourceString("Arg_GenericParameter"));
+ throw new InvalidOperationException(SR.Arg_GenericParameter);
Contract.EndContractBlock();
#region Preconditions
if ((bindingFlags & InvocationMask) == 0)
// "Must specify binding flags describing the invoke operation required."
- throw new ArgumentException(Environment.GetResourceString("Arg_NoAccessSpec"), nameof(bindingFlags));
+ throw new ArgumentException(SR.Arg_NoAccessSpec, nameof(bindingFlags));
// Provide a default binding mask if none is provided
if ((bindingFlags & MemberBindingMask) == 0)
@@ -4010,13 +3991,13 @@ namespace System
{
if (namedParams.Length > providedArgs.Length)
// "Named parameter array can not be bigger than argument array."
- throw new ArgumentException(Environment.GetResourceString("Arg_NamedParamTooBig"), nameof(namedParams));
+ throw new ArgumentException(SR.Arg_NamedParamTooBig, nameof(namedParams));
}
else
{
if (namedParams.Length != 0)
// "Named parameter array can not be bigger than argument array."
- throw new ArgumentException(Environment.GetResourceString("Arg_NamedParamTooBig"), nameof(namedParams));
+ throw new ArgumentException(SR.Arg_NamedParamTooBig, nameof(namedParams));
}
}
#endregion
@@ -4027,22 +4008,22 @@ namespace System
{
#region Preconditions
if ((bindingFlags & ClassicBindingMask) == 0)
- throw new ArgumentException(Environment.GetResourceString("Arg_COMAccess"), nameof(bindingFlags));
+ throw new ArgumentException(SR.Arg_COMAccess, nameof(bindingFlags));
if ((bindingFlags & BindingFlags.GetProperty) != 0 && (bindingFlags & ClassicBindingMask & ~(BindingFlags.GetProperty | BindingFlags.InvokeMethod)) != 0)
- throw new ArgumentException(Environment.GetResourceString("Arg_PropSetGet"), nameof(bindingFlags));
+ throw new ArgumentException(SR.Arg_PropSetGet, nameof(bindingFlags));
if ((bindingFlags & BindingFlags.InvokeMethod) != 0 && (bindingFlags & ClassicBindingMask & ~(BindingFlags.GetProperty | BindingFlags.InvokeMethod)) != 0)
- throw new ArgumentException(Environment.GetResourceString("Arg_PropSetInvoke"), nameof(bindingFlags));
+ throw new ArgumentException(SR.Arg_PropSetInvoke, nameof(bindingFlags));
if ((bindingFlags & BindingFlags.SetProperty) != 0 && (bindingFlags & ClassicBindingMask & ~BindingFlags.SetProperty) != 0)
- throw new ArgumentException(Environment.GetResourceString("Arg_COMPropSetPut"), nameof(bindingFlags));
+ throw new ArgumentException(SR.Arg_COMPropSetPut, nameof(bindingFlags));
if ((bindingFlags & BindingFlags.PutDispProperty) != 0 && (bindingFlags & ClassicBindingMask & ~BindingFlags.PutDispProperty) != 0)
- throw new ArgumentException(Environment.GetResourceString("Arg_COMPropSetPut"), nameof(bindingFlags));
+ throw new ArgumentException(SR.Arg_COMPropSetPut, nameof(bindingFlags));
if ((bindingFlags & BindingFlags.PutRefDispProperty) != 0 && (bindingFlags & ClassicBindingMask & ~BindingFlags.PutRefDispProperty) != 0)
- throw new ArgumentException(Environment.GetResourceString("Arg_COMPropSetPut"), nameof(bindingFlags));
+ throw new ArgumentException(SR.Arg_COMPropSetPut, nameof(bindingFlags));
#endregion
{
@@ -4065,7 +4046,7 @@ namespace System
#region Check that any named paramters are not null
if (namedParams != null && Array.IndexOf(namedParams, null) != -1)
// "Named parameter value must not be null."
- throw new ArgumentException(Environment.GetResourceString("Arg_NamedParamNull"), nameof(namedParams));
+ throw new ArgumentException(SR.Arg_NamedParamNull, nameof(namedParams));
#endregion
int argCnt = (providedArgs != null) ? providedArgs.Length : 0;
@@ -4082,7 +4063,7 @@ namespace System
{
if ((bindingFlags & BindingFlags.CreateInstance) != 0 && (bindingFlags & BinderNonCreateInstance) != 0)
// "Can not specify both CreateInstance and another access type."
- throw new ArgumentException(Environment.GetResourceString("Arg_CreatInstAccess"), nameof(bindingFlags));
+ throw new ArgumentException(SR.Arg_CreatInstAccess, nameof(bindingFlags));
return Activator.CreateInstance(this, bindingFlags, binder, providedArgs, culture);
}
@@ -4119,11 +4100,11 @@ namespace System
{
if (IsSetField)
// "Can not specify both Get and Set on a field."
- throw new ArgumentException(Environment.GetResourceString("Arg_FldSetGet"), nameof(bindingFlags));
+ throw new ArgumentException(SR.Arg_FldSetGet, nameof(bindingFlags));
if ((bindingFlags & BindingFlags.SetProperty) != 0)
// "Can not specify both GetField and SetProperty."
- throw new ArgumentException(Environment.GetResourceString("Arg_FldGetPropSet"), nameof(bindingFlags));
+ throw new ArgumentException(SR.Arg_FldGetPropSet, nameof(bindingFlags));
}
else
{
@@ -4134,11 +4115,11 @@ namespace System
if ((bindingFlags & BindingFlags.GetProperty) != 0)
// "Can not specify both SetField and GetProperty."
- throw new ArgumentException(Environment.GetResourceString("Arg_FldSetPropGet"), nameof(bindingFlags));
+ throw new ArgumentException(SR.Arg_FldSetPropGet, nameof(bindingFlags));
if ((bindingFlags & BindingFlags.InvokeMethod) != 0)
// "Can not specify Set on a Field and Invoke on a method."
- throw new ArgumentException(Environment.GetResourceString("Arg_FldSetInvoke"), nameof(bindingFlags));
+ throw new ArgumentException(SR.Arg_FldSetInvoke, nameof(bindingFlags));
}
#endregion
@@ -4187,7 +4168,7 @@ namespace System
}
catch (InvalidCastException)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_IndexMustBeInt"));
+ throw new ArgumentException(SR.Arg_IndexMustBeInt);
}
}
@@ -4212,7 +4193,7 @@ namespace System
{
#region Get the field value
if (argCnt != 0)
- throw new ArgumentException(Environment.GetResourceString("Arg_FldGetArgErr"), nameof(bindingFlags));
+ throw new ArgumentException(SR.Arg_FldGetArgErr, nameof(bindingFlags));
return selFld.GetValue(target);
#endregion
@@ -4221,7 +4202,7 @@ namespace System
{
#region Set the field Value
if (argCnt != 1)
- throw new ArgumentException(Environment.GetResourceString("Arg_FldSetArgErr"), nameof(bindingFlags));
+ throw new ArgumentException(SR.Arg_FldSetArgErr, nameof(bindingFlags));
selFld.SetValue(target, providedArgs[0], bindingFlags, binder, culture);
@@ -4272,7 +4253,7 @@ namespace System
Debug.Assert(!IsSetField);
if (isSetProperty)
- throw new ArgumentException(Environment.GetResourceString("Arg_PropSetGet"), nameof(bindingFlags));
+ throw new ArgumentException(SR.Arg_PropSetGet, nameof(bindingFlags));
}
else
{
@@ -4281,7 +4262,7 @@ namespace System
Debug.Assert(!IsGetField);
if ((bindingFlags & BindingFlags.InvokeMethod) != 0)
- throw new ArgumentException(Environment.GetResourceString("Arg_PropSetInvoke"), nameof(bindingFlags));
+ throw new ArgumentException(SR.Arg_PropSetInvoke, nameof(bindingFlags));
}
#endregion
}
@@ -4486,7 +4467,7 @@ namespace System
RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
if (attributeRuntimeType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(attributeType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));
return CustomAttribute.GetCustomAttributes(this, attributeRuntimeType, inherit);
}
@@ -4500,7 +4481,7 @@ namespace System
RuntimeType attributeRuntimeType = attributeType.UnderlyingSystemType as RuntimeType;
if (attributeRuntimeType == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(attributeType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(attributeType));
return CustomAttribute.IsDefined(this, attributeRuntimeType, inherit);
}
@@ -4603,20 +4584,20 @@ namespace System
private void CreateInstanceCheckThis()
{
if (this is ReflectionOnlyType)
- throw new ArgumentException(Environment.GetResourceString("Arg_ReflectionOnlyInvoke"));
+ throw new ArgumentException(SR.Arg_ReflectionOnlyInvoke);
if (ContainsGenericParameters)
throw new ArgumentException(
- Environment.GetResourceString("Acc_CreateGenericEx", this));
+ SR.Format(SR.Acc_CreateGenericEx, this));
Contract.EndContractBlock();
Type elementType = this.GetRootElementType();
if (Object.ReferenceEquals(elementType, typeof(ArgIterator)))
- throw new NotSupportedException(Environment.GetResourceString("Acc_CreateArgIterator"));
+ throw new NotSupportedException(SR.Acc_CreateArgIterator);
if (Object.ReferenceEquals(elementType, typeof(void)))
- throw new NotSupportedException(Environment.GetResourceString("Acc_CreateVoid"));
+ throw new NotSupportedException(SR.Acc_CreateVoid);
}
internal Object CreateInstanceImpl(
@@ -4670,7 +4651,7 @@ namespace System
if (cons == null)
{
- throw new MissingMethodException(Environment.GetResourceString("MissingConstructor_Name", FullName));
+ throw new MissingMethodException(SR.Format(SR.MissingConstructor_Name, FullName));
}
MethodBase invokeMethod;
@@ -4684,7 +4665,7 @@ namespace System
if (invokeMethod == null)
{
- throw new MissingMethodException(Environment.GetResourceString("MissingConstructor_Name", FullName));
+ throw new MissingMethodException(SR.Format(SR.MissingConstructor_Name, FullName));
}
if (invokeMethod.GetParametersNoCopy().Length == 0)
@@ -4694,7 +4675,7 @@ namespace System
Debug.Assert((invokeMethod.CallingConvention & CallingConventions.VarArgs) ==
CallingConventions.VarArgs);
throw new NotSupportedException(String.Format(CultureInfo.CurrentCulture,
- Environment.GetResourceString("NotSupported_CallToVarArg")));
+ SR.NotSupported_CallToVarArg));
}
// fast path??
@@ -4834,7 +4815,7 @@ namespace System
internal Object CreateInstanceDefaultCtor(bool publicOnly, bool skipCheckThis, bool fillCache, ref StackCrawlMark stackMark)
{
if (GetType() == typeof(ReflectionOnlyType))
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotAllowedInReflectionOnly"));
+ throw new InvalidOperationException(SR.InvalidOperation_NotAllowedInReflectionOnly);
ActivatorCache activatorCache = s_ActivatorCache;
if (activatorCache != null)
@@ -4847,7 +4828,7 @@ namespace System
if (ace.m_ctor != null &&
(ace.m_ctorAttributes & MethodAttributes.MemberAccessMask) != MethodAttributes.Public)
{
- throw new MissingMethodException(Environment.GetResourceString("Arg_NoDefCTor"));
+ throw new MissingMethodException(SR.Arg_NoDefCTor);
}
}
@@ -4944,7 +4925,7 @@ namespace System
{
get
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotAllowedInReflectionOnly"));
+ throw new InvalidOperationException(SR.InvalidOperation_NotAllowedInReflectionOnly);
}
}
}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/AssemblySettingAttributes.cs b/src/mscorlib/src/System/Runtime/CompilerServices/AssemblySettingAttributes.cs
deleted file mode 100644
index 37592a475d..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/AssemblySettingAttributes.cs
+++ /dev/null
@@ -1,94 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace System.Runtime.CompilerServices
-{
- /*
- NGenHint is not supported in Whidbey
-
- [Serializable]
- public enum NGenHint
- {
- Default = 0x0000, // No preference specified
-
- Eager = 0x0001, // NGen at install time
- Lazy = 0x0002, // NGen after install time
- Never = 0x0003, // Assembly should not be ngened
- }
- */
-
- [Serializable]
- public enum LoadHint
- {
- Default = 0x0000, // No preference specified
-
- Always = 0x0001, // Dependency is always loaded
- Sometimes = 0x0002, // Dependency is sometimes loaded
- //Never = 0x0003, // Dependency is never loaded
- }
-
- [Serializable]
- [AttributeUsage(AttributeTargets.Assembly)]
- public sealed class DefaultDependencyAttribute : Attribute
- {
- private LoadHint loadHint;
-
- public DefaultDependencyAttribute(
- LoadHint loadHintArgument
- )
- {
- loadHint = loadHintArgument;
- }
-
- public LoadHint LoadHint
- {
- get
- {
- return loadHint;
- }
- }
- }
-
-
- [Serializable]
- [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
- public sealed class DependencyAttribute : Attribute
- {
- private String dependentAssembly;
- private LoadHint loadHint;
-
- public DependencyAttribute(
- String dependentAssemblyArgument,
- LoadHint loadHintArgument
- )
- {
- dependentAssembly = dependentAssemblyArgument;
- loadHint = loadHintArgument;
- }
-
- public String DependentAssembly
- {
- get
- {
- return dependentAssembly;
- }
- }
-
- public LoadHint LoadHint
- {
- get
- {
- return loadHint;
- }
- }
- }
-}
-
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/CompilationRelaxations.cs b/src/mscorlib/src/System/Runtime/CompilerServices/CompilationRelaxations.cs
index 05c43ac631..9fda9c7191 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/CompilationRelaxations.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/CompilationRelaxations.cs
@@ -10,16 +10,6 @@ using System;
namespace System.Runtime.CompilerServices
{
- /// IMPORTANT: Keep this in sync with corhdr.h
- [Serializable]
- [Flags]
- public enum CompilationRelaxations : int
- {
- NoStringInterning = 0x0008, // Start in 0x0008, we had other non public flags in this enum before,
- // so we'll start here just in case somebody used them. This flag is only
- // valid when set for Assemblies.
- };
-
[Serializable]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Method)]
public class CompilationRelaxationsAttribute : Attribute
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/CompilerMarshalOverride.cs b/src/mscorlib/src/System/Runtime/CompilerServices/CompilerMarshalOverride.cs
deleted file mode 100644
index a7b4aca480..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/CompilerMarshalOverride.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-// 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 System.Runtime.CompilerServices
-{
- // The CLR data marshaler has some behaviors that are incompatible with
- // C++. Specifically, C++ treats boolean variables as byte size, whereas
- // the marshaller treats them as 4-byte size. Similarly, C++ treats
- // wchar_t variables as 4-byte size, whereas the marshaller treats them
- // as single byte size under certain conditions. In order to work around
- // such issues, the C++ compiler will emit a type that the marshaller will
- // marshal using the correct sizes. In addition, the compiler will place
- // this modopt onto the variables to indicate that the specified type is
- // not the true type. Any compiler that needed to deal with similar
- // marshalling incompatibilities could use this attribute as well.
- //
- // Indicates that the modified instance differs from its true type for
- // correct marshalling.
- public static class CompilerMarshalOverride
- {
- }
-}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs b/src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs
index eed21cf6fb..f32cc2b510 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs
@@ -61,6 +61,7 @@
using System.Collections;
using System.Collections.Generic;
+using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;
@@ -973,7 +974,7 @@ namespace System.Runtime.CompilerServices
{
if (_invalid)
{
- throw new InvalidOperationException(Environment.GetResourceString("CollectionCorrupted"));
+ throw new InvalidOperationException(SR.InvalidOperation_CollectionCorrupted);
}
}
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/MethodImplAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/MethodImplAttribute.cs
index 89bb5e6ee5..b24018cf78 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/MethodImplAttribute.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/MethodImplAttribute.cs
@@ -11,31 +11,6 @@ namespace System.Runtime.CompilerServices
// This Enum matchs the miImpl flags defined in corhdr.h. It is used to specify
// certain method properties.
- [Serializable]
- [Flags]
- public enum MethodImplOptions
- {
- Unmanaged = System.Reflection.MethodImplAttributes.Unmanaged,
- ForwardRef = System.Reflection.MethodImplAttributes.ForwardRef,
- PreserveSig = System.Reflection.MethodImplAttributes.PreserveSig,
- InternalCall = System.Reflection.MethodImplAttributes.InternalCall,
- Synchronized = System.Reflection.MethodImplAttributes.Synchronized,
- NoInlining = System.Reflection.MethodImplAttributes.NoInlining,
- AggressiveInlining = System.Reflection.MethodImplAttributes.AggressiveInlining,
- NoOptimization = System.Reflection.MethodImplAttributes.NoOptimization,
- // **** If you add something, update internal MethodImplAttribute(MethodImplAttributes methodImplAttributes)! ****
- }
-
- [Serializable]
- public enum MethodCodeType
- {
- IL = System.Reflection.MethodImplAttributes.IL,
- Native = System.Reflection.MethodImplAttributes.Native,
- /// <internalonly/>
- OPTIL = System.Reflection.MethodImplAttributes.OPTIL,
- Runtime = System.Reflection.MethodImplAttributes.Runtime
- }
-
// Custom attribute to specify additional method properties.
[Serializable]
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor, Inherited = false)]
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs b/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs
index abb5a8f656..dc27a65c43 100644
--- a/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs
+++ b/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs
@@ -22,7 +22,7 @@ namespace System.Runtime.CompilerServices
public sealed class RuntimeWrappedException : Exception
{
private RuntimeWrappedException(Object thrownObject)
- : base(Environment.GetResourceString("RuntimeWrappedException"))
+ : base(SR.RuntimeWrappedException)
{
SetErrorCode(System.__HResults.COR_E_RUNTIMEWRAPPED);
m_wrappedException = thrownObject;
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/SpecialNameAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/SpecialNameAttribute.cs
deleted file mode 100644
index a6f3c01618..0000000000
--- a/src/mscorlib/src/System/Runtime/CompilerServices/SpecialNameAttribute.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-
-using System;
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-namespace System.Runtime.CompilerServices
-{
- [AttributeUsage(AttributeTargets.Class |
- AttributeTargets.Method |
- AttributeTargets.Property |
- AttributeTargets.Field |
- AttributeTargets.Event |
- AttributeTargets.Struct)]
-
-
- public sealed class SpecialNameAttribute : Attribute
- {
- public SpecialNameAttribute() { }
- }
-}
-
-
-
diff --git a/src/mscorlib/src/System/Runtime/ExceptionServices/ExceptionNotification.cs b/src/mscorlib/src/System/Runtime/ExceptionServices/ExceptionNotification.cs
index 70b9418263..d986ea9c24 100644
--- a/src/mscorlib/src/System/Runtime/ExceptionServices/ExceptionNotification.cs
+++ b/src/mscorlib/src/System/Runtime/ExceptionServices/ExceptionNotification.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// 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.
/*=============================================================================
diff --git a/src/mscorlib/src/System/Runtime/ExceptionServices/ExceptionServicesCommon.cs b/src/mscorlib/src/System/Runtime/ExceptionServices/ExceptionServicesCommon.cs
index 4666611278..8d5ced089f 100644
--- a/src/mscorlib/src/System/Runtime/ExceptionServices/ExceptionServicesCommon.cs
+++ b/src/mscorlib/src/System/Runtime/ExceptionServices/ExceptionServicesCommon.cs
@@ -101,7 +101,7 @@ namespace System.Runtime.ExceptionServices
{
if (source == null)
{
- throw new ArgumentNullException(nameof(source), Environment.GetResourceString("ArgumentNull_Obj"));
+ throw new ArgumentNullException(nameof(source), SR.ArgumentNull_Obj);
}
return new ExceptionDispatchInfo(source);
@@ -129,5 +129,9 @@ namespace System.Runtime.ExceptionServices
m_Exception.RestoreExceptionDispatchInfo(this);
throw m_Exception;
}
+
+ // Throws the source exception, maintaining the original bucketing details and augmenting
+ // rather than replacing the original stack trace.
+ public static void Throw(Exception source) => Capture(source).Throw();
}
}
diff --git a/src/mscorlib/src/System/Runtime/GcSettings.cs b/src/mscorlib/src/System/Runtime/GcSettings.cs
index 834307190b..993a24f986 100644
--- a/src/mscorlib/src/System/Runtime/GcSettings.cs
+++ b/src/mscorlib/src/System/Runtime/GcSettings.cs
@@ -50,7 +50,7 @@ namespace System.Runtime
{
if ((value < GCLatencyMode.Batch) || (value > GCLatencyMode.SustainedLowLatency))
{
- throw new ArgumentOutOfRangeException(Environment.GetResourceString("ArgumentOutOfRange_Enum"));
+ throw new ArgumentOutOfRangeException(SR.ArgumentOutOfRange_Enum);
}
Contract.EndContractBlock();
@@ -72,7 +72,7 @@ namespace System.Runtime
if ((value < GCLargeObjectHeapCompactionMode.Default) ||
(value > GCLargeObjectHeapCompactionMode.CompactOnce))
{
- throw new ArgumentOutOfRangeException(Environment.GetResourceString("ArgumentOutOfRange_Enum"));
+ throw new ArgumentOutOfRangeException(SR.ArgumentOutOfRange_Enum);
}
Contract.EndContractBlock();
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/COMException.cs b/src/mscorlib/src/System/Runtime/InteropServices/COMException.cs
index 82a0f098a1..f8fcfb5826 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/COMException.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/COMException.cs
@@ -26,7 +26,7 @@ namespace System.Runtime.InteropServices
public class COMException : ExternalException
{
public COMException()
- : base(Environment.GetResourceString("Arg_COMException"))
+ : base(SR.Arg_COMException)
{
SetErrorCode(__HResults.E_FAIL);
}
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/CurrencyWrapper.cs b/src/mscorlib/src/System/Runtime/InteropServices/CurrencyWrapper.cs
index 51c379f369..4b436825e8 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/CurrencyWrapper.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/CurrencyWrapper.cs
@@ -27,7 +27,7 @@ namespace System.Runtime.InteropServices
public CurrencyWrapper(Object obj)
{
if (!(obj is Decimal))
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeDecimal"), nameof(obj));
+ throw new ArgumentException(SR.Arg_MustBeDecimal, nameof(obj));
m_WrappedObject = (Decimal)obj;
}
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/ErrorWrapper.cs b/src/mscorlib/src/System/Runtime/InteropServices/ErrorWrapper.cs
index ff96aeff61..73be2c5777 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/ErrorWrapper.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/ErrorWrapper.cs
@@ -27,7 +27,7 @@ namespace System.Runtime.InteropServices
public ErrorWrapper(Object errorCode)
{
if (!(errorCode is int))
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeInt32"), nameof(errorCode));
+ throw new ArgumentException(SR.Arg_MustBeInt32, nameof(errorCode));
m_ErrorCode = (int)errorCode;
}
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/ExternalException.cs b/src/mscorlib/src/System/Runtime/InteropServices/ExternalException.cs
index 8aea9b2a1b..323a9a666a 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/ExternalException.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/ExternalException.cs
@@ -26,7 +26,7 @@ namespace System.Runtime.InteropServices
public class ExternalException : SystemException
{
public ExternalException()
- : base(Environment.GetResourceString("Arg_ExternalException"))
+ : base(SR.Arg_ExternalException)
{
SetErrorCode(__HResults.E_FAIL);
}
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/GCHandleCookieTable.cs b/src/mscorlib/src/System/Runtime/InteropServices/GCHandleCookieTable.cs
index 304f369879..9e813d9bd9 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/GCHandleCookieTable.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/GCHandleCookieTable.cs
@@ -91,7 +91,7 @@ namespace System.Runtime.InteropServices
}
if (cookie == GCHandleCookie.Zero)
- throw new OutOfMemoryException(Environment.GetResourceString("OutOfMemory_GCHandleMDA"));
+ throw new OutOfMemoryException(SR.OutOfMemory_GCHandleMDA);
// This handle hasn't been added to the map yet so add it.
m_HandleToCookieMap.Add(handle, cookie);
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/GcHandle.cs b/src/mscorlib/src/System/Runtime/InteropServices/GcHandle.cs
index 4cf21401fd..dcb9e24258 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/GcHandle.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/GcHandle.cs
@@ -140,7 +140,7 @@ namespace System.Runtime.InteropServices
ValidateHandle();
// You can only get the address of pinned handles.
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_HandleIsNotPinned"));
+ throw new InvalidOperationException(SR.InvalidOperation_HandleIsNotPinned);
}
// Get the address.
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/InvalidComObjectException.cs b/src/mscorlib/src/System/Runtime/InteropServices/InvalidComObjectException.cs
index b7fb686a39..5e26352090 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/InvalidComObjectException.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/InvalidComObjectException.cs
@@ -21,7 +21,7 @@ namespace System.Runtime.InteropServices
public class InvalidComObjectException : SystemException
{
public InvalidComObjectException()
- : base(Environment.GetResourceString("Arg_InvalidComObjectException"))
+ : base(SR.Arg_InvalidComObjectException)
{
SetErrorCode(__HResults.COR_E_INVALIDCOMOBJECT);
}
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/InvalidOleVariantTypeException.cs b/src/mscorlib/src/System/Runtime/InteropServices/InvalidOleVariantTypeException.cs
index 8ce8bb2a06..6e644181ec 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/InvalidOleVariantTypeException.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/InvalidOleVariantTypeException.cs
@@ -20,7 +20,7 @@ namespace System.Runtime.InteropServices
public class InvalidOleVariantTypeException : SystemException
{
public InvalidOleVariantTypeException()
- : base(Environment.GetResourceString("Arg_InvalidOleVariantTypeException"))
+ : base(SR.Arg_InvalidOleVariantTypeException)
{
SetErrorCode(__HResults.COR_E_INVALIDOLEVARIANTTYPE);
}
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs b/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs
index 142389e29d..248e0d5778 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs
@@ -240,9 +240,9 @@ namespace System.Runtime.InteropServices
if (t == null)
throw new ArgumentNullException(nameof(t));
if (!(t is RuntimeType))
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"), nameof(t));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(t));
if (t.IsGenericType)
- throw new ArgumentException(Environment.GetResourceString("Argument_NeedNonGenericType"), nameof(t));
+ throw new ArgumentException(SR.Argument_NeedNonGenericType, nameof(t));
Contract.EndContractBlock();
return SizeOfHelper(t, true);
@@ -296,10 +296,10 @@ namespace System.Runtime.InteropServices
FieldInfo f = t.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (f == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_OffsetOfFieldNotFound", t.FullName), nameof(fieldName));
+ throw new ArgumentException(SR.Format(SR.Argument_OffsetOfFieldNotFound, t.FullName), nameof(fieldName));
RtFieldInfo rtField = f as RtFieldInfo;
if (rtField == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeFieldInfo"), nameof(fieldName));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeFieldInfo, nameof(fieldName));
return OffsetOfHelper(rtField);
}
@@ -408,7 +408,7 @@ namespace System.Runtime.InteropServices
//====================================================================
public static byte ReadByte([MarshalAs(UnmanagedType.AsAny), In] Object ptr, int ofs)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(); // https://github.com/dotnet/coreclr/issues/10442
}
public static unsafe byte ReadByte(IntPtr ptr, int ofs)
@@ -432,7 +432,7 @@ namespace System.Runtime.InteropServices
public static short ReadInt16([MarshalAs(UnmanagedType.AsAny), In] Object ptr, int ofs)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(); // https://github.com/dotnet/coreclr/issues/10442
}
public static unsafe short ReadInt16(IntPtr ptr, int ofs)
@@ -469,7 +469,7 @@ namespace System.Runtime.InteropServices
public static int ReadInt32([MarshalAs(UnmanagedType.AsAny), In] Object ptr, int ofs)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(); // https://github.com/dotnet/coreclr/issues/10442
}
public static unsafe int ReadInt32(IntPtr ptr, int ofs)
@@ -535,7 +535,7 @@ namespace System.Runtime.InteropServices
public static long ReadInt64([MarshalAs(UnmanagedType.AsAny), In] Object ptr, int ofs)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(); // https://github.com/dotnet/coreclr/issues/10442
}
public static unsafe long ReadInt64(IntPtr ptr, int ofs)
@@ -596,7 +596,7 @@ namespace System.Runtime.InteropServices
public static void WriteByte([MarshalAs(UnmanagedType.AsAny), In, Out] Object ptr, int ofs, byte val)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(); // https://github.com/dotnet/coreclr/issues/10442
}
public static void WriteByte(IntPtr ptr, byte val)
@@ -631,7 +631,7 @@ namespace System.Runtime.InteropServices
public static void WriteInt16([MarshalAs(UnmanagedType.AsAny), In, Out] Object ptr, int ofs, short val)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(); // https://github.com/dotnet/coreclr/issues/10442
}
public static void WriteInt16(IntPtr ptr, short val)
@@ -683,7 +683,7 @@ namespace System.Runtime.InteropServices
public static void WriteInt32([MarshalAs(UnmanagedType.AsAny), In, Out] Object ptr, int ofs, int val)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(); // https://github.com/dotnet/coreclr/issues/10442
}
public static void WriteInt32(IntPtr ptr, int val)
@@ -751,7 +751,7 @@ namespace System.Runtime.InteropServices
public static void WriteInt64([MarshalAs(UnmanagedType.AsAny), In, Out] Object ptr, int ofs, long val)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(); // https://github.com/dotnet/coreclr/issues/10442
}
public static void WriteInt64(IntPtr ptr, long val)
@@ -799,7 +799,7 @@ namespace System.Runtime.InteropServices
RuntimeMethodInfo rmi = m as RuntimeMethodInfo;
if (rmi == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeMethodInfo"));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeMethodInfo);
InternalPrelink(rmi);
}
@@ -866,12 +866,12 @@ namespace System.Runtime.InteropServices
throw new ArgumentNullException(nameof(structureType));
if (structureType.IsGenericType)
- throw new ArgumentException(Environment.GetResourceString("Argument_NeedNonGenericType"), nameof(structureType));
+ throw new ArgumentException(SR.Argument_NeedNonGenericType, nameof(structureType));
RuntimeType rt = structureType.UnderlyingSystemType as RuntimeType;
if (rt == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(structureType));
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(structureType));
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -925,7 +925,7 @@ namespace System.Runtime.InteropServices
}
if (rtModule == null)
- throw new ArgumentNullException(nameof(m), Environment.GetResourceString("Argument_MustBeRuntimeModule"));
+ throw new ArgumentNullException(nameof(m), SR.Argument_MustBeRuntimeModule);
return GetHINSTANCE(rtModule.GetNativeHandle());
}
@@ -1424,7 +1424,7 @@ namespace System.Runtime.InteropServices
}
catch (InvalidCastException)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_ObjNotComObject"), nameof(o));
+ throw new ArgumentException(SR.Argument_ObjNotComObject, nameof(o));
}
return co.ReleaseSelf();
@@ -1453,7 +1453,7 @@ namespace System.Runtime.InteropServices
}
catch (InvalidCastException)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_ObjNotComObject"), nameof(o));
+ throw new ArgumentException(SR.Argument_ObjNotComObject, nameof(o));
}
co.FinalReleaseSelf();
@@ -1470,7 +1470,7 @@ namespace System.Runtime.InteropServices
//====================================================================
public static Object GetComObjectData(Object obj, Object key)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.Arg_PlatformNotSupported);
}
//====================================================================
@@ -1481,7 +1481,7 @@ namespace System.Runtime.InteropServices
//====================================================================
public static bool SetComObjectData(Object obj, Object key, Object data)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.Arg_PlatformNotSupported);
}
#if FEATURE_COMINTEROP
@@ -1495,13 +1495,13 @@ namespace System.Runtime.InteropServices
if (t == null)
throw new ArgumentNullException(nameof(t));
if (!t.IsCOMObject)
- throw new ArgumentException(Environment.GetResourceString("Argument_TypeNotComObject"), nameof(t));
+ throw new ArgumentException(SR.Argument_TypeNotComObject, nameof(t));
if (t.IsGenericType)
- throw new ArgumentException(Environment.GetResourceString("Argument_NeedNonGenericType"), nameof(t));
+ throw new ArgumentException(SR.Argument_NeedNonGenericType, nameof(t));
Contract.EndContractBlock();
if (t.IsWindowsRuntimeObject)
- throw new ArgumentException(Environment.GetResourceString("Argument_TypeIsWinRTType"), nameof(t));
+ throw new ArgumentException(SR.Argument_TypeIsWinRTType, nameof(t));
// Check for the null case.
if (o == null)
@@ -1509,9 +1509,9 @@ namespace System.Runtime.InteropServices
// Make sure the object is a COM object.
if (!o.GetType().IsCOMObject)
- throw new ArgumentException(Environment.GetResourceString("Argument_ObjNotComObject"), nameof(o));
+ throw new ArgumentException(SR.Argument_ObjNotComObject, nameof(o));
if (o.GetType().IsWindowsRuntimeObject)
- throw new ArgumentException(Environment.GetResourceString("Argument_ObjIsWinRTObject"), nameof(o));
+ throw new ArgumentException(SR.Argument_ObjIsWinRTObject, nameof(o));
// Check to see if the type of the object is the requested type.
if (o.GetType() == t)
@@ -1621,9 +1621,9 @@ namespace System.Runtime.InteropServices
if (type == null)
throw new ArgumentNullException(nameof(type));
if (type.IsImport)
- throw new ArgumentException(Environment.GetResourceString("Argument_TypeMustNotBeComImport"), nameof(type));
+ throw new ArgumentException(SR.Argument_TypeMustNotBeComImport, nameof(type));
if (type.IsGenericType)
- throw new ArgumentException(Environment.GetResourceString("Argument_NeedNonGenericType"), nameof(type));
+ throw new ArgumentException(SR.Argument_NeedNonGenericType, nameof(type));
Contract.EndContractBlock();
IList<CustomAttributeData> cas = CustomAttributeData.GetCustomAttributes(type);
@@ -1724,14 +1724,14 @@ namespace System.Runtime.InteropServices
Contract.EndContractBlock();
if ((t as RuntimeType) == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"), nameof(t));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(t));
if (t.IsGenericType)
- throw new ArgumentException(Environment.GetResourceString("Argument_NeedNonGenericType"), nameof(t));
+ throw new ArgumentException(SR.Argument_NeedNonGenericType, nameof(t));
Type c = t.BaseType;
if (c == null || (c != typeof(Delegate) && c != typeof(MulticastDelegate)))
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeDelegate"), nameof(t));
+ throw new ArgumentException(SR.Arg_MustBeDelegate, nameof(t));
return GetDelegateForFunctionPointerInternal(ptr, t);
}
@@ -1772,7 +1772,7 @@ namespace System.Runtime.InteropServices
#if FEATURE_COMINTEROP
return s.MarshalToBSTR();
#else
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(); // https://github.com/dotnet/coreclr/issues/10443
#endif
}
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/MarshalDirectiveException.cs b/src/mscorlib/src/System/Runtime/InteropServices/MarshalDirectiveException.cs
index 8240e299cb..4634ea893c 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/MarshalDirectiveException.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/MarshalDirectiveException.cs
@@ -21,7 +21,7 @@ namespace System.Runtime.InteropServices
public class MarshalDirectiveException : SystemException
{
public MarshalDirectiveException()
- : base(Environment.GetResourceString("Arg_MarshalDirectiveException"))
+ : base(SR.Arg_MarshalDirectiveException)
{
SetErrorCode(__HResults.COR_E_MARSHALDIRECTIVE);
}
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/NonPortable.cs b/src/mscorlib/src/System/Runtime/InteropServices/NonPortable.cs
index ae974460f7..7b7c5efb90 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/NonPortable.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/NonPortable.cs
@@ -15,7 +15,7 @@ namespace System.Runtime.InteropServices
public static int AddRef(System.IntPtr pUnk)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static bool AreComObjectsAvailableForCleanup()
@@ -25,12 +25,12 @@ namespace System.Runtime.InteropServices
public static System.IntPtr CreateAggregatedObject(System.IntPtr pOuter, object o)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static Object BindToMoniker(String monikerName)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static void CleanupUnusedObjectsInCurrentContext()
@@ -40,42 +40,42 @@ namespace System.Runtime.InteropServices
public static System.IntPtr CreateAggregatedObject<T>(System.IntPtr pOuter, T o)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static object CreateWrapperOfType(object o, System.Type t)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static TWrapper CreateWrapperOfType<T, TWrapper>(T o)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static void ChangeWrapperHandleStrength(Object otp, bool fIsWeak)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static int FinalReleaseComObject(object o)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static System.IntPtr GetComInterfaceForObject(object o, System.Type T)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static System.IntPtr GetComInterfaceForObject(object o, System.Type T, System.Runtime.InteropServices.CustomQueryInterfaceMode mode)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static System.IntPtr GetComInterfaceForObject<T, TInterface>(T o)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static System.IntPtr GetHINSTANCE(System.Reflection.Module m)
@@ -89,67 +89,67 @@ namespace System.Runtime.InteropServices
public static System.IntPtr GetIUnknownForObject(object o)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static void GetNativeVariantForObject(object obj, System.IntPtr pDstNativeVariant)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static void GetNativeVariantForObject<T>(T obj, System.IntPtr pDstNativeVariant)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static Object GetTypedObjectForIUnknown(System.IntPtr pUnk, System.Type t)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static object GetObjectForIUnknown(System.IntPtr pUnk)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static object GetObjectForNativeVariant(System.IntPtr pSrcNativeVariant)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static T GetObjectForNativeVariant<T>(System.IntPtr pSrcNativeVariant)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static object[] GetObjectsForNativeVariants(System.IntPtr aSrcNativeVariant, int cVars)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static T[] GetObjectsForNativeVariants<T>(System.IntPtr aSrcNativeVariant, int cVars)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static int GetStartComSlot(System.Type t)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static System.Type GetTypeFromCLSID(System.Guid clsid)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static string GetTypeInfoName(System.Runtime.InteropServices.ComTypes.ITypeInfo typeInfo)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static object GetUniqueObjectForIUnknown(System.IntPtr unknown)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static bool IsComObject(object o)
@@ -159,22 +159,22 @@ namespace System.Runtime.InteropServices
public static int QueryInterface(System.IntPtr pUnk, ref System.Guid iid, out System.IntPtr ppv)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static int Release(System.IntPtr pUnk)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static int ReleaseComObject(object o)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static void ZeroFreeBSTR(System.IntPtr s)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
}
@@ -182,14 +182,14 @@ namespace System.Runtime.InteropServices
{
public DispatchWrapper(object obj)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public object WrappedObject
{
get
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
}
}
@@ -198,12 +198,12 @@ namespace System.Runtime.InteropServices
{
public static void Combine(object rcw, System.Guid iid, int dispid, System.Delegate d)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
public static System.Delegate Remove(object rcw, System.Guid iid, int dispid, System.Delegate d)
{
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_ComInterop);
}
}
}
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/SafeArrayRankMismatchException.cs b/src/mscorlib/src/System/Runtime/InteropServices/SafeArrayRankMismatchException.cs
index ad64e5e927..96bbdd7b59 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/SafeArrayRankMismatchException.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/SafeArrayRankMismatchException.cs
@@ -20,7 +20,7 @@ namespace System.Runtime.InteropServices
public class SafeArrayRankMismatchException : SystemException
{
public SafeArrayRankMismatchException()
- : base(Environment.GetResourceString("Arg_SafeArrayRankMismatchException"))
+ : base(SR.Arg_SafeArrayRankMismatchException)
{
SetErrorCode(__HResults.COR_E_SAFEARRAYRANKMISMATCH);
}
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/SafeArrayTypeMismatchException.cs b/src/mscorlib/src/System/Runtime/InteropServices/SafeArrayTypeMismatchException.cs
index d541cf41b5..2ec2f9e80a 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/SafeArrayTypeMismatchException.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/SafeArrayTypeMismatchException.cs
@@ -21,7 +21,7 @@ namespace System.Runtime.InteropServices
public class SafeArrayTypeMismatchException : SystemException
{
public SafeArrayTypeMismatchException()
- : base(Environment.GetResourceString("Arg_SafeArrayTypeMismatchException"))
+ : base(SR.Arg_SafeArrayTypeMismatchException)
{
SetErrorCode(__HResults.COR_E_SAFEARRAYTYPEMISMATCH);
}
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/SafeBuffer.cs b/src/mscorlib/src/System/Runtime/InteropServices/SafeBuffer.cs
index 7fb3e4e5e8..aba25e94a3 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/SafeBuffer.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/SafeBuffer.cs
@@ -99,13 +99,13 @@ namespace System.Runtime.InteropServices
public void Initialize(ulong numBytes)
{
if (numBytes < 0)
- throw new ArgumentOutOfRangeException(nameof(numBytes), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(numBytes), SR.ArgumentOutOfRange_NeedNonNegNum);
if (IntPtr.Size == 4 && numBytes > UInt32.MaxValue)
- throw new ArgumentOutOfRangeException(nameof(numBytes), Environment.GetResourceString("ArgumentOutOfRange_AddressSpace"));
+ throw new ArgumentOutOfRangeException(nameof(numBytes), SR.ArgumentOutOfRange_AddressSpace);
Contract.EndContractBlock();
if (numBytes >= (ulong)Uninitialized)
- throw new ArgumentOutOfRangeException(nameof(numBytes), Environment.GetResourceString("ArgumentOutOfRange_UIntPtrMax-1"));
+ throw new ArgumentOutOfRangeException(nameof(numBytes), SR.ArgumentOutOfRange_UIntPtrMax);
_numBytes = (UIntPtr)numBytes;
}
@@ -118,16 +118,16 @@ namespace System.Runtime.InteropServices
public void Initialize(uint numElements, uint sizeOfEachElement)
{
if (numElements < 0)
- throw new ArgumentOutOfRangeException(nameof(numElements), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(numElements), SR.ArgumentOutOfRange_NeedNonNegNum);
if (sizeOfEachElement < 0)
- throw new ArgumentOutOfRangeException(nameof(sizeOfEachElement), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(sizeOfEachElement), SR.ArgumentOutOfRange_NeedNonNegNum);
if (IntPtr.Size == 4 && numElements * sizeOfEachElement > UInt32.MaxValue)
- throw new ArgumentOutOfRangeException("numBytes", Environment.GetResourceString("ArgumentOutOfRange_AddressSpace"));
+ throw new ArgumentOutOfRangeException("numBytes", SR.ArgumentOutOfRange_AddressSpace);
Contract.EndContractBlock();
if (numElements * sizeOfEachElement >= (ulong)Uninitialized)
- throw new ArgumentOutOfRangeException(nameof(numElements), Environment.GetResourceString("ArgumentOutOfRange_UIntPtrMax-1"));
+ throw new ArgumentOutOfRangeException(nameof(numElements), SR.ArgumentOutOfRange_UIntPtrMax);
_numBytes = checked((UIntPtr)(numElements * sizeOfEachElement));
}
@@ -240,13 +240,13 @@ namespace System.Runtime.InteropServices
where T : struct
{
if (array == null)
- throw new ArgumentNullException(nameof(array), Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(array), SR.ArgumentNull_Buffer);
if (index < 0)
- throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_NeedNonNegNum);
if (count < 0)
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
if (array.Length - index < count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
Contract.EndContractBlock();
if (_numBytes == Uninitialized)
@@ -311,13 +311,13 @@ namespace System.Runtime.InteropServices
where T : struct
{
if (array == null)
- throw new ArgumentNullException(nameof(array), Environment.GetResourceString("ArgumentNull_Buffer"));
+ throw new ArgumentNullException(nameof(array), SR.ArgumentNull_Buffer);
if (index < 0)
- throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_NeedNonNegNum);
if (count < 0)
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
if (array.Length - index < count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen"));
+ throw new ArgumentException(SR.Argument_InvalidOffLen);
Contract.EndContractBlock();
if (_numBytes == Uninitialized)
@@ -372,13 +372,13 @@ namespace System.Runtime.InteropServices
private static void NotEnoughRoom()
{
- throw new ArgumentException(Environment.GetResourceString("Arg_BufferTooSmall"));
+ throw new ArgumentException(SR.Arg_BufferTooSmall);
}
private static InvalidOperationException NotInitialized()
{
Debug.Assert(false, "Uninitialized SafeBuffer! Someone needs to call Initialize before using this instance!");
- return new InvalidOperationException(Environment.GetResourceString("InvalidOperation_MustCallInitialize"));
+ return new InvalidOperationException(SR.InvalidOperation_MustCallInitialize);
}
// FCALL limitations mean we can't have generic FCALL methods. However, we can pass
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToCollectionAdapter.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToCollectionAdapter.cs
index 2d0e9a799c..350920564a 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToCollectionAdapter.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToCollectionAdapter.cs
@@ -39,7 +39,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
uint size = _this.Size;
if (((uint)Int32.MaxValue) < size)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingListTooLarge"));
+ throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge);
}
return (int)size;
@@ -68,7 +68,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// ICollection expects the destination array to be single-dimensional.
if (array.Rank != 1)
- throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
+ throw new ArgumentException(SR.Arg_RankMultiDimNotSupported);
int destLB = array.GetLowerBound(0);
@@ -88,10 +88,10 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// list.CopyTo(items, 0);
if (srcLen > (destLen - (arrayIndex - destLB)))
- throw new ArgumentException(Environment.GetResourceString("Argument_InsufficientSpaceToCopyCollection"));
+ throw new ArgumentException(SR.Argument_InsufficientSpaceToCopyCollection);
if (arrayIndex - destLB > destLen)
- throw new ArgumentException(Environment.GetResourceString("Argument_IndexOutOfArrayBounds"));
+ throw new ArgumentException(SR.Argument_IndexOutOfArrayBounds);
// We need to verify the index as we;
IBindableVector _this = JitHelpers.UnsafeCast<IBindableVector>(this);
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToListAdapter.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToListAdapter.cs
index d6e50f5164..539b8020b8 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToListAdapter.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToListAdapter.cs
@@ -60,7 +60,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
uint size = _this.Size;
if (((uint)Int32.MaxValue) < size)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingListTooLarge"));
+ throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge);
}
return (int)(size - 1);
@@ -109,7 +109,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
if (((uint)Int32.MaxValue) < index)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingListTooLarge"));
+ throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge);
}
return (int)index;
@@ -137,7 +137,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
{
if (((uint)Int32.MaxValue) < index)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingListTooLarge"));
+ throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge);
}
RemoveAtHelper(_this, index);
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIPropertyValueImpl.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIPropertyValueImpl.cs
index 8fd30438ad..aa0f3ba056 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIPropertyValueImpl.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIPropertyValueImpl.cs
@@ -134,7 +134,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
public char GetChar16()
{
if (this.Type != PropertyType.Char16)
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueElement", this.Type, "Char16"), __HResults.TYPE_E_TYPEMISMATCH);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, this.Type, "Char16"), __HResults.TYPE_E_TYPEMISMATCH);
Contract.EndContractBlock();
return (char)_data;
}
@@ -143,7 +143,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
public Boolean GetBoolean()
{
if (this.Type != PropertyType.Boolean)
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueElement", this.Type, "Boolean"), __HResults.TYPE_E_TYPEMISMATCH);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, this.Type, "Boolean"), __HResults.TYPE_E_TYPEMISMATCH);
Contract.EndContractBlock();
return (bool)_data;
}
@@ -166,7 +166,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
public DateTimeOffset GetDateTime()
{
if (this.Type != PropertyType.DateTime)
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueElement", this.Type, "DateTime"), __HResults.TYPE_E_TYPEMISMATCH);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, this.Type, "DateTime"), __HResults.TYPE_E_TYPEMISMATCH);
Contract.EndContractBlock();
return (DateTimeOffset)_data;
}
@@ -175,7 +175,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
public TimeSpan GetTimeSpan()
{
if (this.Type != PropertyType.TimeSpan)
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueElement", this.Type, "TimeSpan"), __HResults.TYPE_E_TYPEMISMATCH);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, this.Type, "TimeSpan"), __HResults.TYPE_E_TYPEMISMATCH);
Contract.EndContractBlock();
return (TimeSpan)_data;
}
@@ -184,7 +184,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
public Point GetPoint()
{
if (this.Type != PropertyType.Point)
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueElement", this.Type, "Point"), __HResults.TYPE_E_TYPEMISMATCH);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, this.Type, "Point"), __HResults.TYPE_E_TYPEMISMATCH);
Contract.EndContractBlock();
return Unbox<Point>(IReferenceFactory.s_pointType);
@@ -194,7 +194,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
public Size GetSize()
{
if (this.Type != PropertyType.Size)
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueElement", this.Type, "Size"), __HResults.TYPE_E_TYPEMISMATCH);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, this.Type, "Size"), __HResults.TYPE_E_TYPEMISMATCH);
Contract.EndContractBlock();
return Unbox<Size>(IReferenceFactory.s_sizeType);
@@ -204,7 +204,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
public Rect GetRect()
{
if (this.Type != PropertyType.Rect)
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueElement", this.Type, "Rect"), __HResults.TYPE_E_TYPEMISMATCH);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, this.Type, "Rect"), __HResults.TYPE_E_TYPEMISMATCH);
Contract.EndContractBlock();
return Unbox<Rect>(IReferenceFactory.s_rectType);
@@ -268,7 +268,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
public char[] GetChar16Array()
{
if (this.Type != PropertyType.Char16Array)
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueElement", this.Type, "Char16[]"), __HResults.TYPE_E_TYPEMISMATCH);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, this.Type, "Char16[]"), __HResults.TYPE_E_TYPEMISMATCH);
Contract.EndContractBlock();
return (char[])_data;
}
@@ -277,7 +277,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
public Boolean[] GetBooleanArray()
{
if (this.Type != PropertyType.BooleanArray)
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueElement", this.Type, "Boolean[]"), __HResults.TYPE_E_TYPEMISMATCH);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, this.Type, "Boolean[]"), __HResults.TYPE_E_TYPEMISMATCH);
Contract.EndContractBlock();
return (bool[])_data;
}
@@ -292,7 +292,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
public Object[] GetInspectableArray()
{
if (this.Type != PropertyType.InspectableArray)
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueElement", this.Type, "Inspectable[]"), __HResults.TYPE_E_TYPEMISMATCH);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, this.Type, "Inspectable[]"), __HResults.TYPE_E_TYPEMISMATCH);
Contract.EndContractBlock();
return (Object[])_data;
}
@@ -307,7 +307,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
public DateTimeOffset[] GetDateTimeArray()
{
if (this.Type != PropertyType.DateTimeArray)
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueElement", this.Type, "DateTimeOffset[]"), __HResults.TYPE_E_TYPEMISMATCH);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, this.Type, "DateTimeOffset[]"), __HResults.TYPE_E_TYPEMISMATCH);
Contract.EndContractBlock();
return (DateTimeOffset[])_data;
}
@@ -316,7 +316,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
public TimeSpan[] GetTimeSpanArray()
{
if (this.Type != PropertyType.TimeSpanArray)
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueElement", this.Type, "TimeSpan[]"), __HResults.TYPE_E_TYPEMISMATCH);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, this.Type, "TimeSpan[]"), __HResults.TYPE_E_TYPEMISMATCH);
Contract.EndContractBlock();
return (TimeSpan[])_data;
}
@@ -325,7 +325,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
public Point[] GetPointArray()
{
if (this.Type != PropertyType.PointArray)
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueElement", this.Type, "Point[]"), __HResults.TYPE_E_TYPEMISMATCH);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, this.Type, "Point[]"), __HResults.TYPE_E_TYPEMISMATCH);
Contract.EndContractBlock();
return UnboxArray<Point>(IReferenceFactory.s_pointType);
@@ -335,7 +335,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
public Size[] GetSizeArray()
{
if (this.Type != PropertyType.SizeArray)
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueElement", this.Type, "Size[]"), __HResults.TYPE_E_TYPEMISMATCH);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, this.Type, "Size[]"), __HResults.TYPE_E_TYPEMISMATCH);
Contract.EndContractBlock();
@@ -346,7 +346,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
public Rect[] GetRectArray()
{
if (this.Type != PropertyType.RectArray)
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueElement", this.Type, "Rect[]"), __HResults.TYPE_E_TYPEMISMATCH);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, this.Type, "Rect[]"), __HResults.TYPE_E_TYPEMISMATCH);
Contract.EndContractBlock();
return UnboxArray<Rect>(IReferenceFactory.s_rectType);
@@ -364,7 +364,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
Array dataArray = _data as Array;
if (dataArray == null)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueElement", this.Type, typeof(T).MakeArrayType().Name), __HResults.TYPE_E_TYPEMISMATCH);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, this.Type, typeof (T).MakeArrayType().Name), __HResults.TYPE_E_TYPEMISMATCH);
}
// Array types are 1024 larger than their equivilent scalar counterpart
@@ -382,7 +382,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
}
catch (InvalidCastException elementCastException)
{
- Exception e = new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueArrayCoersion", this.Type, typeof(T).MakeArrayType().Name, i, elementCastException.Message), elementCastException);
+ Exception e = new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueArrayCoersion, this.Type, typeof (T).MakeArrayType().Name, i, elementCastException.Message), elementCastException);
e.SetErrorCode(elementCastException._HResult);
throw e;
}
@@ -408,7 +408,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// should not attempt coersion, even if the underlying value is technically convertable
if (!IsCoercable(type, value) && type != PropertyType.Inspectable)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueElement", type, typeof(T).Name), __HResults.TYPE_E_TYPEMISMATCH);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, type, typeof (T).Name), __HResults.TYPE_E_TYPEMISMATCH);
}
try
@@ -438,15 +438,15 @@ namespace System.Runtime.InteropServices.WindowsRuntime
}
catch (FormatException)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueElement", type, typeof(T).Name), __HResults.TYPE_E_TYPEMISMATCH);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, type, typeof (T).Name), __HResults.TYPE_E_TYPEMISMATCH);
}
catch (InvalidCastException)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueElement", type, typeof(T).Name), __HResults.TYPE_E_TYPEMISMATCH);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, type, typeof (T).Name), __HResults.TYPE_E_TYPEMISMATCH);
}
catch (OverflowException)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueCoersion", type, value, typeof(T).Name), __HResults.DISP_E_OVERFLOW);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueCoersion, type, value, typeof (T).Name), __HResults.DISP_E_OVERFLOW);
}
// If the property type is IInspectable, and we have a nested IPropertyValue, then we need
@@ -497,7 +497,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
}
// Otherwise, this is an invalid coersion
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueElement", type, typeof(T).Name), __HResults.TYPE_E_TYPEMISMATCH);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, type, typeof (T).Name), __HResults.TYPE_E_TYPEMISMATCH);
}
private static bool IsCoercable(PropertyType type, object data)
@@ -539,7 +539,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
if (_data.GetType() != expectedBoxedType)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueElement", _data.GetType(), expectedBoxedType.Name), __HResults.TYPE_E_TYPEMISMATCH);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, _data.GetType(), expectedBoxedType.Name), __HResults.TYPE_E_TYPEMISMATCH);
}
T unboxed = new T();
@@ -563,7 +563,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
Array dataArray = _data as Array;
if (dataArray == null || _data.GetType().GetElementType() != expectedArrayElementType)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_WinRTIPropertyValueElement", _data.GetType(), expectedArrayElementType.MakeArrayType().Name), __HResults.TYPE_E_TYPEMISMATCH);
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_WinRTIPropertyValueElement, _data.GetType(), expectedArrayElementType.MakeArrayType().Name), __HResults.TYPE_E_TYPEMISMATCH);
}
T[] converted = new T[dataArray.Length];
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ConstantSplittableMap.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ConstantSplittableMap.cs
index 0e9140f41b..4549a407e0 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ConstantSplittableMap.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ConstantSplittableMap.cs
@@ -102,7 +102,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
if (!found)
{
- Exception e = new KeyNotFoundException(Environment.GetResourceString("Arg_KeyNotFound"));
+ Exception e = new KeyNotFoundException(SR.Arg_KeyNotFound);
e.SetErrorCode(__HResults.E_BOUNDS);
throw e;
}
@@ -205,8 +205,8 @@ namespace System.Runtime.InteropServices.WindowsRuntime
{
get
{
- if (_current < _start) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumNotStarted));
- if (_current > _end) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumEnded));
+ if (_current < _start) throw new InvalidOperationException(SR.GetResourceString(ResId.InvalidOperation_EnumNotStarted));
+ if (_current > _end) throw new InvalidOperationException(SR.GetResourceString(ResId.InvalidOperation_EnumEnded));
return new CLRIKeyValuePairImpl<TKey, TValue>(ref _array[_current]);
}
}
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CustomPropertyImpl.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CustomPropertyImpl.cs
index fe1ecff161..63565a39b8 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CustomPropertyImpl.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CustomPropertyImpl.cs
@@ -107,19 +107,19 @@ namespace System.Runtime.InteropServices.WindowsRuntime
MethodInfo accessor = getValue ? m_property.GetGetMethod(true) : m_property.GetSetMethod(true);
if (accessor == null)
- throw new ArgumentException(System.Environment.GetResourceString(getValue ? "Arg_GetMethNotFnd" : "Arg_SetMethNotFnd"));
+ throw new ArgumentException(getValue ? SR.Arg_GetMethNotFnd : SR.Arg_SetMethNotFnd);
if (!accessor.IsPublic)
throw new MethodAccessException(
String.Format(
CultureInfo.CurrentCulture,
- Environment.GetResourceString("Arg_MethodAccessException_WithMethodName"),
+ SR.Arg_MethodAccessException_WithMethodName,
accessor.ToString(),
accessor.DeclaringType.FullName));
RuntimeMethodInfo rtMethod = accessor as RuntimeMethodInfo;
if (rtMethod == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeMethodInfo"));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeMethodInfo);
// We can safely skip access check because this is only used in full trust scenarios.
// And we have already verified that the property accessor is public.
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryKeyCollection.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryKeyCollection.cs
index 9f33b2f946..2a34aba717 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryKeyCollection.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryKeyCollection.cs
@@ -30,9 +30,9 @@ namespace System.Runtime.InteropServices.WindowsRuntime
if (index < 0)
throw new ArgumentOutOfRangeException(nameof(index));
if (array.Length <= index && this.Count > 0)
- throw new ArgumentException(Environment.GetResourceString("Arg_IndexOutOfRangeException"));
+ throw new ArgumentException(SR.Arg_IndexOutOfRangeException);
if (array.Length - index < dictionary.Count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InsufficientSpaceToCopyCollection"));
+ throw new ArgumentException(SR.Argument_InsufficientSpaceToCopyCollection);
int i = index;
foreach (KeyValuePair<TKey, TValue> mapping in dictionary)
@@ -53,12 +53,12 @@ namespace System.Runtime.InteropServices.WindowsRuntime
void ICollection<TKey>.Add(TKey item)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_KeyCollectionSet"));
+ throw new NotSupportedException(SR.NotSupported_KeyCollectionSet);
}
void ICollection<TKey>.Clear()
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_KeyCollectionSet"));
+ throw new NotSupportedException(SR.NotSupported_KeyCollectionSet);
}
public bool Contains(TKey item)
@@ -68,7 +68,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
bool ICollection<TKey>.Remove(TKey item)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_KeyCollectionSet"));
+ throw new NotSupportedException(SR.NotSupported_KeyCollectionSet);
}
IEnumerator IEnumerable.GetEnumerator()
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryToMapAdapter.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryToMapAdapter.cs
index b1a4042419..bb54d49b60 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryToMapAdapter.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryToMapAdapter.cs
@@ -41,7 +41,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
if (!keyFound)
{
- Exception e = new KeyNotFoundException(Environment.GetResourceString("Arg_KeyNotFound"));
+ Exception e = new KeyNotFoundException(SR.Arg_KeyNotFound);
e.SetErrorCode(__HResults.E_BOUNDS);
throw e;
}
@@ -96,7 +96,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
if (!removed)
{
- Exception e = new KeyNotFoundException(Environment.GetResourceString("Arg_KeyNotFound"));
+ Exception e = new KeyNotFoundException(SR.Arg_KeyNotFound);
e.SetErrorCode(__HResults.E_BOUNDS);
throw e;
}
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryValueCollection.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryValueCollection.cs
index d599d24aa3..083b0ffcb1 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryValueCollection.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryValueCollection.cs
@@ -34,9 +34,9 @@ namespace System.Runtime.InteropServices.WindowsRuntime
if (index < 0)
throw new ArgumentOutOfRangeException(nameof(index));
if (array.Length <= index && this.Count > 0)
- throw new ArgumentException(Environment.GetResourceString("Arg_IndexOutOfRangeException"));
+ throw new ArgumentException(SR.Arg_IndexOutOfRangeException);
if (array.Length - index < dictionary.Count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InsufficientSpaceToCopyCollection"));
+ throw new ArgumentException(SR.Argument_InsufficientSpaceToCopyCollection);
int i = index;
foreach (KeyValuePair<TKey, TValue> mapping in dictionary)
@@ -57,12 +57,12 @@ namespace System.Runtime.InteropServices.WindowsRuntime
void ICollection<TValue>.Add(TValue item)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_ValueCollectionSet"));
+ throw new NotSupportedException(SR.NotSupported_ValueCollectionSet);
}
void ICollection<TValue>.Clear()
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_ValueCollectionSet"));
+ throw new NotSupportedException(SR.NotSupported_ValueCollectionSet);
}
public bool Contains(TValue item)
@@ -76,7 +76,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
bool ICollection<TValue>.Remove(TValue item)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_ValueCollectionSet"));
+ throw new NotSupportedException(SR.NotSupported_ValueCollectionSet);
}
IEnumerator IEnumerable.GetEnumerator()
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/EventRegistrationTokenTable.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/EventRegistrationTokenTable.cs
index 03b17d9261..974da48a42 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/EventRegistrationTokenTable.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/EventRegistrationTokenTable.cs
@@ -28,7 +28,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// static check at construction time
if (!typeof(Delegate).IsAssignableFrom(typeof(T)))
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EventTokenTableRequiresDelegate", typeof(T)));
+ throw new InvalidOperationException(SR.Format(SR.InvalidOperation_EventTokenTableRequiresDelegate, typeof (T)));
}
}
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IMapViewToIReadOnlyDictionaryAdapter.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IMapViewToIReadOnlyDictionaryAdapter.cs
index 55f8a1e862..e06364dcae 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IMapViewToIReadOnlyDictionaryAdapter.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IMapViewToIReadOnlyDictionaryAdapter.cs
@@ -114,7 +114,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
catch (Exception ex)
{
if (__HResults.E_BOUNDS == ex._HResult)
- throw new KeyNotFoundException(Environment.GetResourceString("Arg_KeyNotFound"));
+ throw new KeyNotFoundException(SR.Arg_KeyNotFound);
throw;
}
}
@@ -145,9 +145,9 @@ namespace System.Runtime.InteropServices.WindowsRuntime
if (index < 0)
throw new ArgumentOutOfRangeException(nameof(index));
if (array.Length <= index && this.Count > 0)
- throw new ArgumentException(Environment.GetResourceString("Arg_IndexOutOfRangeException"));
+ throw new ArgumentException(SR.Arg_IndexOutOfRangeException);
if (array.Length - index < dictionary.Count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InsufficientSpaceToCopyCollection"));
+ throw new ArgumentException(SR.Argument_InsufficientSpaceToCopyCollection);
int i = index;
foreach (KeyValuePair<TKey, TValue> mapping in dictionary)
@@ -242,9 +242,9 @@ namespace System.Runtime.InteropServices.WindowsRuntime
if (index < 0)
throw new ArgumentOutOfRangeException(nameof(index));
if (array.Length <= index && this.Count > 0)
- throw new ArgumentException(Environment.GetResourceString("Arg_IndexOutOfRangeException"));
+ throw new ArgumentException(SR.Arg_IndexOutOfRangeException);
if (array.Length - index < dictionary.Count)
- throw new ArgumentException(Environment.GetResourceString("Argument_InsufficientSpaceToCopyCollection"));
+ throw new ArgumentException(SR.Argument_InsufficientSpaceToCopyCollection);
int i = index;
foreach (KeyValuePair<TKey, TValue> mapping in dictionary)
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyDictionaryToIMapViewAdapter.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyDictionaryToIMapViewAdapter.cs
index 2fac36b23f..73daf876cd 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyDictionaryToIMapViewAdapter.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyDictionaryToIMapViewAdapter.cs
@@ -40,7 +40,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
if (!keyFound)
{
- Exception e = new KeyNotFoundException(Environment.GetResourceString("Arg_KeyNotFound"));
+ Exception e = new KeyNotFoundException(SR.Arg_KeyNotFound);
e.SetErrorCode(__HResults.E_BOUNDS);
throw e;
}
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyListToIVectorViewAdapter.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyListToIVectorViewAdapter.cs
index b902ded9c0..5dce7dfc8d 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyListToIVectorViewAdapter.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyListToIVectorViewAdapter.cs
@@ -126,7 +126,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// that Size > Int32.MaxValue:
if (((uint)Int32.MaxValue) <= index || index >= (uint)listCapacity)
{
- Exception e = new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_IndexLargerThanMaxValue"));
+ Exception e = new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_IndexLargerThanMaxValue);
e.SetErrorCode(__HResults.E_BOUNDS);
throw e;
}
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorAdapter.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorAdapter.cs
index 6010eec6c8..5f12322ea8 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorAdapter.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorAdapter.cs
@@ -146,7 +146,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
IList _this = JitHelpers.UnsafeCast<IList>(this);
if (_this.Count == 0)
{
- Exception e = new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotRemoveLastFromEmptyCollection"));
+ Exception e = new InvalidOperationException(SR.InvalidOperation_CannotRemoveLastFromEmptyCollection);
e.SetErrorCode(__HResults.E_BOUNDS);
throw e;
}
@@ -170,7 +170,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// that Size > Int32.MaxValue:
if (((uint)Int32.MaxValue) <= index || index >= (uint)listCapacity)
{
- Exception e = new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_IndexLargerThanMaxValue"));
+ Exception e = new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_IndexLargerThanMaxValue);
e.SetErrorCode(__HResults.E_BOUNDS);
throw e;
}
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorViewAdapter.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorViewAdapter.cs
index 0503b726dd..fc02bedfa6 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorViewAdapter.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorViewAdapter.cs
@@ -38,7 +38,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// that Size > Int32.MaxValue:
if (((uint)Int32.MaxValue) <= index || index >= (uint)listCapacity)
{
- Exception e = new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_IndexLargerThanMaxValue"));
+ Exception e = new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_IndexLargerThanMaxValue);
e.SetErrorCode(__HResults.E_BOUNDS);
throw e;
}
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToVectorAdapter.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToVectorAdapter.cs
index 8373885284..87330e2559 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToVectorAdapter.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToVectorAdapter.cs
@@ -155,7 +155,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
IList<T> _this = JitHelpers.UnsafeCast<IList<T>>(this);
if (_this.Count == 0)
{
- Exception e = new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotRemoveLastFromEmptyCollection"));
+ Exception e = new InvalidOperationException(SR.InvalidOperation_CannotRemoveLastFromEmptyCollection);
e.SetErrorCode(__HResults.E_BOUNDS);
throw e;
}
@@ -201,7 +201,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// that Size > Int32.MaxValue:
if (((uint)Int32.MaxValue) <= index || index >= (uint)listCapacity)
{
- Exception e = new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_IndexLargerThanMaxValue"));
+ Exception e = new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_IndexLargerThanMaxValue);
e.SetErrorCode(__HResults.E_BOUNDS);
throw e;
}
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ManagedActivationFactory.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ManagedActivationFactory.cs
index cace2047d9..12b13ac79b 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ManagedActivationFactory.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ManagedActivationFactory.cs
@@ -41,7 +41,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
// Check whether the type is "exported to WinRT", i.e. it is declared in a managed .winmd and is decorated
// with at least one ActivatableAttribute or StaticAttribute.
if (!(type is RuntimeType) || !type.IsExportedToWindowsRuntime)
- throw new ArgumentException(Environment.GetResourceString("Argument_TypeNotActivatableViaWindowsRuntime", type), nameof(type));
+ throw new ArgumentException(SR.Format(SR.Argument_TypeNotActivatableViaWindowsRuntime, type), nameof(type));
m_type = type;
}
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToCollectionAdapter.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToCollectionAdapter.cs
index f11260eb4a..6b6c1719c3 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToCollectionAdapter.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToCollectionAdapter.cs
@@ -46,7 +46,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
if (((uint)Int32.MaxValue) < size)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingDictionaryTooLarge"));
+ throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingDictionaryTooLarge);
}
return (int)size;
@@ -58,7 +58,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
if (((uint)Int32.MaxValue) < size)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingListTooLarge"));
+ throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge);
}
return (int)size;
@@ -140,10 +140,10 @@ namespace System.Runtime.InteropServices.WindowsRuntime
throw new ArgumentOutOfRangeException(nameof(arrayIndex));
if (array.Length <= arrayIndex && Count<K, V>() > 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_IndexOutOfArrayBounds"));
+ throw new ArgumentException(SR.Argument_IndexOutOfArrayBounds);
if (array.Length - arrayIndex < Count<K, V>())
- throw new ArgumentException(Environment.GetResourceString("Argument_InsufficientSpaceToCopyCollection"));
+ throw new ArgumentException(SR.Argument_InsufficientSpaceToCopyCollection);
Contract.EndContractBlock();
@@ -175,7 +175,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
if (((uint)Int32.MaxValue) < index)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingListTooLarge"));
+ throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge);
}
VectorToListAdapter.RemoveAtHelper<KeyValuePair<K, V>>(_this_vector, index);
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToDictionaryAdapter.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToDictionaryAdapter.cs
index a8a13c6912..224a266b07 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToDictionaryAdapter.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToDictionaryAdapter.cs
@@ -88,7 +88,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
throw new ArgumentNullException(nameof(key));
if (ContainsKey<K, V>(key))
- throw new ArgumentException(Environment.GetResourceString("Argument_AddingDuplicate"));
+ throw new ArgumentException(SR.Argument_AddingDuplicate);
Contract.EndContractBlock();
@@ -158,7 +158,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
catch (Exception ex)
{
if (__HResults.E_BOUNDS == ex._HResult)
- throw new KeyNotFoundException(Environment.GetResourceString("Arg_KeyNotFound"));
+ throw new KeyNotFoundException(SR.Arg_KeyNotFound);
throw;
}
}
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapViewToReadOnlyCollectionAdapter.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapViewToReadOnlyCollectionAdapter.cs
index a3715da0b0..5d509549d3 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapViewToReadOnlyCollectionAdapter.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapViewToReadOnlyCollectionAdapter.cs
@@ -46,7 +46,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
if (((uint)Int32.MaxValue) < size)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingDictionaryTooLarge"));
+ throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingDictionaryTooLarge);
}
return (int)size;
@@ -58,7 +58,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
if (((uint)Int32.MaxValue) < size)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingListTooLarge"));
+ throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge);
}
return (int)size;
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToCollectionAdapter.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToCollectionAdapter.cs
index 898f1a68a0..3065b83c30 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToCollectionAdapter.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToCollectionAdapter.cs
@@ -38,7 +38,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
uint size = _this.Size;
if (((uint)Int32.MaxValue) < size)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingListTooLarge"));
+ throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge);
}
return (int)size;
@@ -83,10 +83,10 @@ namespace System.Runtime.InteropServices.WindowsRuntime
throw new ArgumentOutOfRangeException(nameof(arrayIndex));
if (array.Length <= arrayIndex && Count<T>() > 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_IndexOutOfArrayBounds"));
+ throw new ArgumentException(SR.Argument_IndexOutOfArrayBounds);
if (array.Length - arrayIndex < Count<T>())
- throw new ArgumentException(Environment.GetResourceString("Argument_InsufficientSpaceToCopyCollection"));
+ throw new ArgumentException(SR.Argument_InsufficientSpaceToCopyCollection);
Contract.EndContractBlock();
@@ -111,7 +111,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
if (((uint)Int32.MaxValue) < index)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingListTooLarge"));
+ throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge);
}
VectorToListAdapter.RemoveAtHelper<T>(_this, index);
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToListAdapter.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToListAdapter.cs
index 3e3324864d..56e62a25e7 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToListAdapter.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToListAdapter.cs
@@ -63,7 +63,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
if (((uint)Int32.MaxValue) < index)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingListTooLarge"));
+ throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge);
}
return (int)index;
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorViewToReadOnlyCollectionAdapter.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorViewToReadOnlyCollectionAdapter.cs
index 6b7785d2dc..84c12f8a5c 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorViewToReadOnlyCollectionAdapter.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorViewToReadOnlyCollectionAdapter.cs
@@ -38,7 +38,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
uint size = _this.Size;
if (((uint)Int32.MaxValue) < size)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CollectionBackingListTooLarge"));
+ throw new InvalidOperationException(SR.InvalidOperation_CollectionBackingListTooLarge);
}
return (int)size;
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshal.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshal.cs
index 00dad37a2a..0b7ba10d62 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshal.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshal.cs
@@ -1054,13 +1054,13 @@ namespace System.Runtime.InteropServices.WindowsRuntime
string message = innerException.Message;
if (message == null && messageResource != null)
{
- message = Environment.GetResourceString(messageResource);
+ message = SR.GetResourceString(messageResource);
}
e = new Exception(message, innerException);
}
else
{
- string message = (messageResource != null ? Environment.GetResourceString(messageResource) : null);
+ string message = (messageResource != null ? SR.GetResourceString(messageResource): null);
e = new Exception(message);
}
@@ -1234,7 +1234,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
public static IntPtr StringToHString(String s)
{
if (!Environment.IsWinRTSupported)
- throw new PlatformNotSupportedException(Environment.GetResourceString("PlatformNotSupported_WinRT"));
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_WinRT);
if (s == null)
throw new ArgumentNullException(nameof(s));
@@ -1252,7 +1252,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
{
if (!Environment.IsWinRTSupported)
{
- throw new PlatformNotSupportedException(Environment.GetResourceString("PlatformNotSupported_WinRT"));
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_WinRT);
}
return HStringToString(ptr);
@@ -1261,7 +1261,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
public static void FreeHString(IntPtr ptr)
{
if (!Environment.IsWinRTSupported)
- throw new PlatformNotSupportedException(Environment.GetResourceString("PlatformNotSupported_WinRT"));
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_WinRT);
if (ptr != IntPtr.Zero)
{
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMetadata.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMetadata.cs
index b772a2252b..0f28d3b080 100644
--- a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMetadata.cs
+++ b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMetadata.cs
@@ -42,7 +42,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
{
if (String.IsNullOrEmpty(assemblyFile))
{ // DesignerNamespaceResolve event returned null or empty file name - that is not allowed
- throw new ArgumentException(Environment.GetResourceString("Arg_EmptyOrNullString"), "DesignerNamespaceResolveEventArgs.ResolvedAssemblyFiles");
+ throw new ArgumentException(SR.Arg_EmptyOrNullString, "DesignerNamespaceResolveEventArgs.ResolvedAssemblyFiles");
}
retAssemblyFiles[retIndex] = assemblyFile;
retIndex++;
diff --git a/src/mscorlib/src/System/Runtime/Loader/AssemblyLoadContext.cs b/src/mscorlib/src/System/Runtime/Loader/AssemblyLoadContext.cs
index d8935ffda0..de8137f1ec 100644
--- a/src/mscorlib/src/System/Runtime/Loader/AssemblyLoadContext.cs
+++ b/src/mscorlib/src/System/Runtime/Loader/AssemblyLoadContext.cs
@@ -93,7 +93,7 @@ namespace System.Runtime.Loader
if (PathInternal.IsPartiallyQualified(assemblyPath))
{
- throw new ArgumentException(Environment.GetResourceString("Argument_AbsolutePathRequired"), nameof(assemblyPath));
+ throw new ArgumentException(SR.Argument_AbsolutePathRequired, nameof(assemblyPath));
}
RuntimeAssembly loadedAssembly = null;
@@ -110,12 +110,12 @@ namespace System.Runtime.Loader
if (PathInternal.IsPartiallyQualified(nativeImagePath))
{
- throw new ArgumentException(Environment.GetResourceString("Argument_AbsolutePathRequired"), nameof(nativeImagePath));
+ throw new ArgumentException(SR.Argument_AbsolutePathRequired, nameof(nativeImagePath));
}
if (assemblyPath != null && PathInternal.IsPartiallyQualified(assemblyPath))
{
- throw new ArgumentException(Environment.GetResourceString("Argument_AbsolutePathRequired"), nameof(assemblyPath));
+ throw new ArgumentException(SR.Argument_AbsolutePathRequired, nameof(assemblyPath));
}
// Basic validation has succeeded - lets try to load the NI image.
@@ -137,6 +137,11 @@ namespace System.Runtime.Loader
throw new ArgumentNullException(nameof(assembly));
}
+ if (assembly.Length <= 0)
+ {
+ throw new BadImageFormatException(SR.BadImageFormat_BadILFormat);
+ }
+
int iAssemblyStreamLength = (int)assembly.Length;
int iSymbolLength = 0;
@@ -231,7 +236,7 @@ namespace System.Runtime.Loader
// The simple names should match at the very least
if (String.IsNullOrEmpty(loadedSimpleName) || (!requestedSimpleName.Equals(loadedSimpleName, StringComparison.InvariantCultureIgnoreCase)))
- throw new InvalidOperationException(Environment.GetResourceString("Argument_CustomAssemblyLoadContextRequestedNameMismatch"));
+ throw new InvalidOperationException(SR.Argument_CustomAssemblyLoadContextRequestedNameMismatch);
return assembly;
}
@@ -264,7 +269,7 @@ namespace System.Runtime.Loader
// throw an exception if we do not find any assembly.
if (assembly == null)
{
- throw new FileNotFoundException(Environment.GetResourceString("IO.FileLoad"), simpleName);
+ throw new FileNotFoundException(SR.IO_FileLoad, simpleName);
}
return assembly;
@@ -292,11 +297,11 @@ namespace System.Runtime.Loader
}
if (unmanagedDllPath.Length == 0)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyPath"), nameof(unmanagedDllPath));
+ throw new ArgumentException(SR.Argument_EmptyPath, nameof(unmanagedDllPath));
}
if (PathInternal.IsPartiallyQualified(unmanagedDllPath))
{
- throw new ArgumentException(Environment.GetResourceString("Argument_AbsolutePathRequired"), nameof(unmanagedDllPath));
+ throw new ArgumentException(SR.Argument_AbsolutePathRequired, nameof(unmanagedDllPath));
}
return InternalLoadUnmanagedDllFromPath(unmanagedDllPath);
@@ -343,11 +348,6 @@ namespace System.Runtime.Loader
}
}
- // This call opens and closes the file, but does not add the
- // assembly to the domain.
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- static internal extern AssemblyName nGetFileInformation(String s);
-
// Helper to return AssemblyName corresponding to the path of an IL assembly
public static AssemblyName GetAssemblyName(string assemblyPath)
{
@@ -356,10 +356,9 @@ namespace System.Runtime.Loader
throw new ArgumentNullException(nameof(assemblyPath));
}
- string fullPath = Path.GetFullPath(assemblyPath);
- return nGetFileInformation(fullPath);
+ return AssemblyName.GetAssemblyName(assemblyPath);
}
-
+
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
[SuppressUnmanagedCodeSecurity]
private static extern IntPtr GetLoadContextForAssembly(RuntimeAssembly assembly);
diff --git a/src/mscorlib/src/System/Runtime/MemoryFailPoint.cs b/src/mscorlib/src/System/Runtime/MemoryFailPoint.cs
index 2785942712..f9f87bc928 100644
--- a/src/mscorlib/src/System/Runtime/MemoryFailPoint.cs
+++ b/src/mscorlib/src/System/Runtime/MemoryFailPoint.cs
@@ -155,7 +155,7 @@ namespace System.Runtime
public MemoryFailPoint(int sizeInMegabytes)
{
if (sizeInMegabytes <= 0)
- throw new ArgumentOutOfRangeException(nameof(sizeInMegabytes), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(sizeInMegabytes), SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
#if !FEATURE_PAL // Remove this when CheckForAvailableMemory is able to provide legitimate estimates
@@ -170,7 +170,7 @@ namespace System.Runtime
// heap, and to check both the normal & large object heaps.
ulong segmentSize = (ulong)(Math.Ceiling((double)size / GCSegmentSize) * GCSegmentSize);
if (segmentSize >= TopOfMemory)
- throw new InsufficientMemoryException(Environment.GetResourceString("InsufficientMemory_MemFailPoint_TooBig"));
+ throw new InsufficientMemoryException(SR.InsufficientMemory_MemFailPoint_TooBig);
ulong requestedSizeRounded = (ulong)(Math.Ceiling((double)sizeInMegabytes / MemoryCheckGranularity) * MemoryCheckGranularity);
//re-convert into bytes
@@ -266,7 +266,7 @@ namespace System.Runtime
// state.
if (needPageFile || needAddressSpace)
{
- InsufficientMemoryException e = new InsufficientMemoryException(Environment.GetResourceString("InsufficientMemory_MemFailPoint"));
+ InsufficientMemoryException e = new InsufficientMemoryException(SR.InsufficientMemory_MemFailPoint);
#if _DEBUG
e.Data["MemFailPointState"] = new MemoryFailPointState(sizeInMegabytes, segmentSize,
needPageFile, needAddressSpace, needContiguousVASpace,
@@ -278,7 +278,7 @@ namespace System.Runtime
if (needContiguousVASpace)
{
- InsufficientMemoryException e = new InsufficientMemoryException(Environment.GetResourceString("InsufficientMemory_MemFailPoint_VAFrag"));
+ InsufficientMemoryException e = new InsufficientMemoryException(SR.InsufficientMemory_MemFailPoint_VAFrag);
#if _DEBUG
e.Data["MemFailPointState"] = new MemoryFailPointState(sizeInMegabytes, segmentSize,
needPageFile, needAddressSpace, needContiguousVASpace,
@@ -349,7 +349,7 @@ namespace System.Runtime
LastTimeCheckingAddressSpace = Environment.TickCount;
if (freeSpaceAfterGCHeap < size && shouldThrow)
- throw new InsufficientMemoryException(Environment.GetResourceString("InsufficientMemory_MemFailPoint_VAFrag"));
+ throw new InsufficientMemoryException(SR.InsufficientMemory_MemFailPoint_VAFrag);
return freeSpaceAfterGCHeap >= size;
}
diff --git a/src/mscorlib/src/System/Runtime/RuntimeImports.cs b/src/mscorlib/src/System/Runtime/RuntimeImports.cs
index 17a2602cd4..16d41d3951 100644
--- a/src/mscorlib/src/System/Runtime/RuntimeImports.cs
+++ b/src/mscorlib/src/System/Runtime/RuntimeImports.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// 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.
diff --git a/src/mscorlib/src/System/Runtime/Serialization/FormatterServices.cs b/src/mscorlib/src/System/Runtime/Serialization/FormatterServices.cs
index d1669b976f..18139324a3 100644
--- a/src/mscorlib/src/System/Runtime/Serialization/FormatterServices.cs
+++ b/src/mscorlib/src/System/Runtime/Serialization/FormatterServices.cs
@@ -29,7 +29,9 @@ using System.Diagnostics.Contracts;
namespace System.Runtime.Serialization
{
- public static class FormatterServices
+ // This class duplicates a class on CoreFX. We are keeping it here -- just this one method --
+ // as it was widely invoked by reflection to workaround it being missing in .NET Core 1.0
+ internal static class FormatterServices
{
// Gets a new instance of the object. The entire object is initalized to 0 and no
// constructors have been run. **THIS MEANS THAT THE OBJECT MAY NOT BE IN A STATE
@@ -48,7 +50,7 @@ namespace System.Runtime.Serialization
if (!(type is RuntimeType))
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidType", type.ToString()));
+ throw new SerializationException(SR.Format(SR.Serialization_InvalidType, type.ToString()));
}
return nativeGetUninitializedObject((RuntimeType)type);
@@ -56,28 +58,6 @@ namespace System.Runtime.Serialization
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern Object nativeGetUninitializedObject(RuntimeType type);
- private static Binder s_binder = Type.DefaultBinder;
-
- /*============================LoadAssemblyFromString============================
- **Action: Loads an assembly from a given string. The current assembly loading story
- ** is quite confusing. If the assembly is in the fusion cache, we can load it
- ** using the stringized-name which we transmitted over the wire. If that fails,
- ** we try for a lookup of the assembly using the simple name which is the first
- ** part of the assembly name. If we can't find it that way, we'll return null
- ** as our failure result.
- **Returns: The loaded assembly or null if it can't be found.
- **Arguments: assemblyName -- The stringized assembly name.
- **Exceptions: None
- ==============================================================================*/
- internal static Assembly LoadAssemblyFromString(String assemblyName)
- {
- //
- // Try using the stringized assembly name to load from the fusion cache.
- //
- BCLDebug.Trace("SER", "[LoadAssemblyFromString]Looking for assembly: ", assemblyName);
- Assembly found = Assembly.Load(assemblyName);
- return found;
- }
}
}
diff --git a/src/mscorlib/src/System/Runtime/Serialization/SerializationAttributes.cs b/src/mscorlib/src/System/Runtime/Serialization/SerializationAttributes.cs
index 435ca279e4..be9f4aefee 100644
--- a/src/mscorlib/src/System/Runtime/Serialization/SerializationAttributes.cs
+++ b/src/mscorlib/src/System/Runtime/Serialization/SerializationAttributes.cs
@@ -32,7 +32,7 @@ namespace System.Runtime.Serialization
set
{
if (value < 1)
- throw new ArgumentException(Environment.GetResourceString("Serialization_OptionalFieldVersionValue"));
+ throw new ArgumentException(SR.Serialization_OptionalFieldVersionValue);
Contract.EndContractBlock();
versionAdded = value;
}
diff --git a/src/mscorlib/src/System/Runtime/Serialization/SerializationException.cs b/src/mscorlib/src/System/Runtime/Serialization/SerializationException.cs
index 65db0e930a..7f2d2755bc 100644
--- a/src/mscorlib/src/System/Runtime/Serialization/SerializationException.cs
+++ b/src/mscorlib/src/System/Runtime/Serialization/SerializationException.cs
@@ -21,7 +21,7 @@ namespace System.Runtime.Serialization
[Serializable]
public class SerializationException : SystemException
{
- private static String _nullMessage = Environment.GetResourceString("Arg_SerializationException");
+ private static String _nullMessage = SR.Arg_SerializationException;
// Creates a new SerializationException with its message
// string set to a default message.
diff --git a/src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs b/src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs
index d024361985..7fc3ce27d9 100644
--- a/src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs
+++ b/src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs
@@ -331,7 +331,7 @@ namespace System.Runtime.Serialization
if (m_nameToIndex.ContainsKey(name))
{
BCLDebug.Trace("SER", "[SerializationInfo.AddValue]Tried to add ", name, " twice to the SI.");
- throw new SerializationException(Environment.GetResourceString("Serialization_SameNameTwice"));
+ throw new SerializationException(SR.Serialization_SameNameTwice);
}
m_nameToIndex.Add(name, m_currMember);
@@ -415,7 +415,7 @@ namespace System.Runtime.Serialization
int index = FindElement(name);
if (index == -1)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_NotFound", name));
+ throw new SerializationException(SR.Format(SR.Serialization_NotFound, name));
}
Debug.Assert(index < m_data.Length, "[SerializationInfo.GetElement]index<m_data.Length");
@@ -458,7 +458,7 @@ namespace System.Runtime.Serialization
RuntimeType rt = type as RuntimeType;
if (rt == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeType);
Type foundType;
Object value;
diff --git a/src/mscorlib/src/System/Runtime/Serialization/SerializationInfoEnumerator.cs b/src/mscorlib/src/System/Runtime/Serialization/SerializationInfoEnumerator.cs
index b7857dece2..791f7a8c73 100644
--- a/src/mscorlib/src/System/Runtime/Serialization/SerializationInfoEnumerator.cs
+++ b/src/mscorlib/src/System/Runtime/Serialization/SerializationInfoEnumerator.cs
@@ -109,14 +109,13 @@ namespace System.Runtime.Serialization
return m_current;
}
- /// <internalonly/>
Object IEnumerator.Current
{ //Actually returns a SerializationEntry
get
{
if (m_current == false)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumOpCantHappen"));
+ throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
}
return (Object)(new SerializationEntry(m_members[m_currItem], m_data[m_currItem], m_types[m_currItem]));
}
@@ -128,7 +127,7 @@ namespace System.Runtime.Serialization
{
if (m_current == false)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumOpCantHappen"));
+ throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
}
return (new SerializationEntry(m_members[m_currItem], m_data[m_currItem], m_types[m_currItem]));
}
@@ -146,7 +145,7 @@ namespace System.Runtime.Serialization
{
if (m_current == false)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumOpCantHappen"));
+ throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
}
return m_members[m_currItem];
}
@@ -157,7 +156,7 @@ namespace System.Runtime.Serialization
{
if (m_current == false)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumOpCantHappen"));
+ throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
}
return m_data[m_currItem];
}
@@ -168,7 +167,7 @@ namespace System.Runtime.Serialization
{
if (m_current == false)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_EnumOpCantHappen"));
+ throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen);
}
return m_types[m_currItem];
}
diff --git a/src/mscorlib/src/System/RuntimeHandles.cs b/src/mscorlib/src/System/RuntimeHandles.cs
index dcf8cd6500..37db526aee 100644
--- a/src/mscorlib/src/System/RuntimeHandles.cs
+++ b/src/mscorlib/src/System/RuntimeHandles.cs
@@ -32,7 +32,7 @@ namespace System
// Create local copy to avoid a race condition
RuntimeType type = m_type;
if (type == null)
- throw new ArgumentNullException(null, Environment.GetResourceString("Arg_InvalidHandle"));
+ throw new ArgumentNullException(null, SR.Arg_InvalidHandle);
return new RuntimeTypeHandle(type);
}
@@ -42,7 +42,7 @@ namespace System
// Create local copy to avoid a race condition
RuntimeType type = m_type;
if (type == null)
- throw new ArgumentNullException(null, Environment.GetResourceString("Arg_InvalidHandle"));
+ throw new ArgumentNullException(null, SR.Arg_InvalidHandle);
return type;
}
@@ -462,7 +462,7 @@ namespace System
if (name == null || name.Length == 0)
{
if (throwOnError)
- throw new TypeLoadException(Environment.GetResourceString("Arg_TypeLoadNullStr"));
+ throw new TypeLoadException(SR.Arg_TypeLoadNullStr);
return null;
}
@@ -611,7 +611,7 @@ namespace System
RuntimeType type = GetTypeChecked();
if (!IsGenericVariable(type))
- throw new InvalidOperationException(Environment.GetResourceString("Arg_NotGenericParameter"));
+ throw new InvalidOperationException(SR.Arg_NotGenericParameter);
return GetGenericVariableIndex(type);
}
@@ -664,7 +664,7 @@ namespace System
m_type = m;
if (m_type == null)
- throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientState"));
+ throw new SerializationException(SR.Serialization_InsufficientState);
}
public void GetObjectData(SerializationInfo info, StreamingContext context)
@@ -674,7 +674,7 @@ namespace System
Contract.EndContractBlock();
if (m_type == null)
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidFieldState"));
+ throw new SerializationException(SR.Serialization_InvalidFieldState);
info.AddValue("TypeObj", m_type, typeof(RuntimeType));
}
@@ -773,7 +773,7 @@ namespace System
internal static IRuntimeMethodInfo EnsureNonNullMethodInfo(IRuntimeMethodInfo method)
{
if (method == null)
- throw new ArgumentNullException(null, Environment.GetResourceString("Arg_InvalidHandle"));
+ throw new ArgumentNullException(null, SR.Arg_InvalidHandle);
return method;
}
@@ -807,7 +807,7 @@ namespace System
m_value = m.MethodHandle.m_value;
if (m_value == null)
- throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientState"));
+ throw new SerializationException(SR.Serialization_InsufficientState);
}
public void GetObjectData(SerializationInfo info, StreamingContext context)
@@ -817,7 +817,7 @@ namespace System
Contract.EndContractBlock();
if (m_value == null)
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidFieldState"));
+ throw new SerializationException(SR.Serialization_InvalidFieldState);
// This is either a RuntimeMethodInfo or a RuntimeConstructorInfo
MethodBase methodInfo = RuntimeType.GetMethodBase(m_value);
@@ -1158,7 +1158,7 @@ namespace System
// Create local copy to avoid a race condition
IRuntimeFieldInfo field = m_ptr;
if (field == null)
- throw new ArgumentNullException(null, Environment.GetResourceString("Arg_InvalidHandle"));
+ throw new ArgumentNullException(null, SR.Arg_InvalidHandle);
return new RuntimeFieldHandle(field);
}
@@ -1306,12 +1306,12 @@ namespace System
FieldInfo f = (RuntimeFieldInfo)info.GetValue("FieldObj", typeof(RuntimeFieldInfo));
if (f == null)
- throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientState"));
+ throw new SerializationException(SR.Serialization_InsufficientState);
m_ptr = f.FieldHandle.m_ptr;
if (m_ptr == null)
- throw new SerializationException(Environment.GetResourceString("Serialization_InsufficientState"));
+ throw new SerializationException(SR.Serialization_InsufficientState);
}
public void GetObjectData(SerializationInfo info, StreamingContext context)
@@ -1321,7 +1321,7 @@ namespace System
Contract.EndContractBlock();
if (m_ptr == null)
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidFieldState"));
+ throw new SerializationException(SR.Serialization_InvalidFieldState);
RuntimeFieldInfo fldInfo = (RuntimeFieldInfo)RuntimeType.GetFieldInfo(this.GetRuntimeFieldInfo());
@@ -1399,7 +1399,7 @@ namespace System
{
// Make sure we have a valid Module to resolve against.
if (module == null)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NullModuleHandle"));
+ throw new InvalidOperationException(SR.InvalidOperation_NullModuleHandle);
}
// SQL-CLR LKG9 Compiler dependency
@@ -1418,7 +1418,7 @@ namespace System
ValidateModulePointer(module);
if (!ModuleHandle.GetMetadataImport(module).IsValidToken(typeToken))
throw new ArgumentOutOfRangeException(nameof(typeToken),
- Environment.GetResourceString("Argument_InvalidToken", typeToken, new ModuleHandle(module)));
+ SR.Format(SR.Argument_InvalidToken, typeToken, new ModuleHandle(module)));
int typeInstCount, methodInstCount;
IntPtr[] typeInstantiationContextHandles = RuntimeTypeHandle.CopyRuntimeTypeHandles(typeInstantiationContext, out typeInstCount);
@@ -1472,7 +1472,7 @@ namespace System
ValidateModulePointer(module);
if (!ModuleHandle.GetMetadataImport(module.GetNativeHandle()).IsValidToken(methodToken))
throw new ArgumentOutOfRangeException(nameof(methodToken),
- Environment.GetResourceString("Argument_InvalidToken", methodToken, new ModuleHandle(module)));
+ SR.Format(SR.Argument_InvalidToken, methodToken, new ModuleHandle(module)));
fixed (IntPtr* typeInstArgs = typeInstantiationContext, methodInstArgs = methodInstantiationContext)
{
@@ -1500,7 +1500,7 @@ namespace System
ValidateModulePointer(module);
if (!ModuleHandle.GetMetadataImport(module.GetNativeHandle()).IsValidToken(fieldToken))
throw new ArgumentOutOfRangeException(nameof(fieldToken),
- Environment.GetResourceString("Argument_InvalidToken", fieldToken, new ModuleHandle(module)));
+ SR.Format(SR.Argument_InvalidToken, fieldToken, new ModuleHandle(module)));
// defensive copy to be sure array is not mutated from the outside during processing
int typeInstCount, methodInstCount;
diff --git a/src/mscorlib/src/System/SByte.cs b/src/mscorlib/src/System/SByte.cs
index b85093d72f..2f1b2da947 100644
--- a/src/mscorlib/src/System/SByte.cs
+++ b/src/mscorlib/src/System/SByte.cs
@@ -47,7 +47,7 @@ namespace System
}
if (!(obj is SByte))
{
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeSByte"));
+ throw new ArgumentException(SR.Arg_MustBeSByte);
}
return m_value - ((SByte)obj).m_value;
}
@@ -156,19 +156,19 @@ namespace System
}
catch (OverflowException e)
{
- throw new OverflowException(Environment.GetResourceString("Overflow_SByte"), e);
+ throw new OverflowException(SR.Overflow_SByte, e);
}
if ((style & NumberStyles.AllowHexSpecifier) != 0)
{ // We are parsing a hexadecimal number
if ((i < 0) || i > Byte.MaxValue)
{
- throw new OverflowException(Environment.GetResourceString("Overflow_SByte"));
+ throw new OverflowException(SR.Overflow_SByte);
}
return (sbyte)i;
}
- if (i < MinValue || i > MaxValue) throw new OverflowException(Environment.GetResourceString("Overflow_SByte"));
+ if (i < MinValue || i > MaxValue) throw new OverflowException(SR.Overflow_SByte);
return (sbyte)i;
}
@@ -222,91 +222,76 @@ namespace System
}
- /// <internalonly/>
bool IConvertible.ToBoolean(IFormatProvider provider)
{
return Convert.ToBoolean(m_value);
}
- /// <internalonly/>
char IConvertible.ToChar(IFormatProvider provider)
{
return Convert.ToChar(m_value);
}
- /// <internalonly/>
sbyte IConvertible.ToSByte(IFormatProvider provider)
{
return m_value;
}
- /// <internalonly/>
byte IConvertible.ToByte(IFormatProvider provider)
{
return Convert.ToByte(m_value);
}
- /// <internalonly/>
short IConvertible.ToInt16(IFormatProvider provider)
{
return Convert.ToInt16(m_value);
}
- /// <internalonly/>
ushort IConvertible.ToUInt16(IFormatProvider provider)
{
return Convert.ToUInt16(m_value);
}
- /// <internalonly/>
int IConvertible.ToInt32(IFormatProvider provider)
{
return m_value;
}
- /// <internalonly/>
uint IConvertible.ToUInt32(IFormatProvider provider)
{
return Convert.ToUInt32(m_value);
}
- /// <internalonly/>
long IConvertible.ToInt64(IFormatProvider provider)
{
return Convert.ToInt64(m_value);
}
- /// <internalonly/>
ulong IConvertible.ToUInt64(IFormatProvider provider)
{
return Convert.ToUInt64(m_value);
}
- /// <internalonly/>
float IConvertible.ToSingle(IFormatProvider provider)
{
return Convert.ToSingle(m_value);
}
- /// <internalonly/>
double IConvertible.ToDouble(IFormatProvider provider)
{
return Convert.ToDouble(m_value);
}
- /// <internalonly/>
Decimal IConvertible.ToDecimal(IFormatProvider provider)
{
return Convert.ToDecimal(m_value);
}
- /// <internalonly/>
DateTime IConvertible.ToDateTime(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "SByte", "DateTime"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "SByte", "DateTime"));
}
- /// <internalonly/>
Object IConvertible.ToType(Type type, IFormatProvider provider)
{
return Convert.DefaultToType((IConvertible)this, type, provider);
diff --git a/src/mscorlib/src/System/Security/SafeBSTRHandle.cs b/src/mscorlib/src/System/Security/SafeBSTRHandle.cs
index 19d63d41e4..a1164dce91 100644
--- a/src/mscorlib/src/System/Security/SafeBSTRHandle.cs
+++ b/src/mscorlib/src/System/Security/SafeBSTRHandle.cs
@@ -13,7 +13,7 @@ namespace System.Security
internal static SafeBSTRHandle Allocate(uint lenInChars)
{
- uint lenInBytes = lenInChars * sizeof(char);
+ ulong lenInBytes = (ulong)lenInChars * sizeof(char);
SafeBSTRHandle bstr = Interop.OleAut32.SysAllocStringLen(IntPtr.Zero, lenInChars);
if (bstr.IsInvalid) // SysAllocStringLen returns a NULL ptr when there's insufficient memory
{
diff --git a/src/mscorlib/src/System/Security/SecurityException.cs b/src/mscorlib/src/System/Security/SecurityException.cs
deleted file mode 100644
index 90fe053394..0000000000
--- a/src/mscorlib/src/System/Security/SecurityException.cs
+++ /dev/null
@@ -1,110 +0,0 @@
-// 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: Exception class for security
-**
-**
-=============================================================================*/
-
-using System.Security;
-using System;
-using System.Runtime.Serialization;
-using System.Reflection;
-using System.Text;
-using System.Security.Policy;
-using System.IO;
-using System.Globalization;
-using System.Diagnostics.Contracts;
-
-namespace System.Security
-{
- [Serializable]
- public class SecurityException : SystemException
- {
- internal static string GetResString(string sResourceName)
- {
- return Environment.GetResourceString(sResourceName);
- }
-
-#pragma warning disable 618
- internal static Exception MakeSecurityException(AssemblyName asmName, Evidence asmEvidence, RuntimeMethodHandleInternal rmh, Object demand)
-#pragma warning restore 618
- {
- return new SecurityException(GetResString("Arg_SecurityException"));
- }
-
- public SecurityException()
- : base(GetResString("Arg_SecurityException"))
- {
- SetErrorCode(System.__HResults.COR_E_SECURITY);
- }
-
- public SecurityException(String message)
- : base(message)
- {
- // This is the constructor that gets called if you Assert but don't have permission to Assert. (So don't assert in here.)
- SetErrorCode(System.__HResults.COR_E_SECURITY);
- }
-
- public SecurityException(String message, Exception inner)
- : base(message, inner)
- {
- SetErrorCode(System.__HResults.COR_E_SECURITY);
- }
-
- protected SecurityException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- if (info == null)
- throw new ArgumentNullException(nameof(info));
- Contract.EndContractBlock();
- }
-
- public override String ToString()
- {
- return base.ToString();
- }
-
- public override void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- if (info == null)
- throw new ArgumentNullException(nameof(info));
- Contract.EndContractBlock();
-
- base.GetObjectData(info, context);
- }
-
- // Stubs for surface area compatibility only
- public SecurityException(String message, Type type)
- : base(message)
- {
- SetErrorCode(System.__HResults.COR_E_SECURITY);
- PermissionType = type;
- }
-
- public SecurityException(string message, System.Type type, string state)
- : base(message)
- {
- SetErrorCode(System.__HResults.COR_E_SECURITY);
- PermissionType = type;
- PermissionState = state;
- }
-
- public object Demanded { get; set; }
- public object DenySetInstance { get; set; }
- public System.Reflection.AssemblyName FailedAssemblyInfo { get; set; }
- public string GrantedSet { get; set; }
- public System.Reflection.MethodInfo Method { get; set; }
- public string PermissionState { get; set; }
- public System.Type PermissionType { get; set; }
- public object PermitOnlySetInstance { get; set; }
- public string RefusedSet { get; set; }
- public string Url { get; set; }
- }
-}
diff --git a/src/mscorlib/src/System/Security/SecurityState.cs b/src/mscorlib/src/System/Security/SecurityState.cs
deleted file mode 100644
index 11c67d95f0..0000000000
--- a/src/mscorlib/src/System/Security/SecurityState.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Security;
-
-namespace System.Security
-{
- public abstract class SecurityState
- {
- protected SecurityState() { }
-
- public bool IsStateAvailable()
- {
- AppDomainManager domainManager = AppDomainManager.CurrentAppDomainManager;
-
- // 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;
- }
- // override this function and throw the appropriate
- public abstract void EnsureState();
- }
-}
diff --git a/src/mscorlib/src/System/Security/Util/URLString.cs b/src/mscorlib/src/System/Security/Util/URLString.cs
index d694acbba8..33aac6f034 100644
--- a/src/mscorlib/src/System/Security/Util/URLString.cs
+++ b/src/mscorlib/src/System/Security/Util/URLString.cs
@@ -131,7 +131,7 @@ namespace System.Security.Util
PathInternal.MaxLongPath))
#endif
{
- throw new PathTooLongException(Environment.GetResourceString("IO.PathTooLong"));
+ throw new PathTooLongException(SR.IO_PathTooLong);
}
}
}
diff --git a/src/mscorlib/src/System/Security/VerificationException.cs b/src/mscorlib/src/System/Security/VerificationException.cs
index d07b76f6ad..6f70dcd35b 100644
--- a/src/mscorlib/src/System/Security/VerificationException.cs
+++ b/src/mscorlib/src/System/Security/VerificationException.cs
@@ -14,7 +14,7 @@ namespace System.Security
public class VerificationException : SystemException
{
public VerificationException()
- : base(Environment.GetResourceString("Verification_Exception"))
+ : base(SR.Verification_Exception)
{
SetErrorCode(__HResults.COR_E_VERIFICATION);
}
diff --git a/src/mscorlib/src/System/Single.cs b/src/mscorlib/src/System/Single.cs
index f3ed5b8b06..1c39df7d94 100644
--- a/src/mscorlib/src/System/Single.cs
+++ b/src/mscorlib/src/System/Single.cs
@@ -98,7 +98,7 @@ namespace System
else // f is NaN.
return 1;
}
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeSingle"));
+ throw new ArgumentException(SR.Arg_MustBeSingle);
}
@@ -297,91 +297,76 @@ namespace System
}
- /// <internalonly/>
bool IConvertible.ToBoolean(IFormatProvider provider)
{
return Convert.ToBoolean(m_value);
}
- /// <internalonly/>
char IConvertible.ToChar(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "Single", "Char"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Single", "Char"));
}
- /// <internalonly/>
sbyte IConvertible.ToSByte(IFormatProvider provider)
{
return Convert.ToSByte(m_value);
}
- /// <internalonly/>
byte IConvertible.ToByte(IFormatProvider provider)
{
return Convert.ToByte(m_value);
}
- /// <internalonly/>
short IConvertible.ToInt16(IFormatProvider provider)
{
return Convert.ToInt16(m_value);
}
- /// <internalonly/>
ushort IConvertible.ToUInt16(IFormatProvider provider)
{
return Convert.ToUInt16(m_value);
}
- /// <internalonly/>
int IConvertible.ToInt32(IFormatProvider provider)
{
return Convert.ToInt32(m_value);
}
- /// <internalonly/>
uint IConvertible.ToUInt32(IFormatProvider provider)
{
return Convert.ToUInt32(m_value);
}
- /// <internalonly/>
long IConvertible.ToInt64(IFormatProvider provider)
{
return Convert.ToInt64(m_value);
}
- /// <internalonly/>
ulong IConvertible.ToUInt64(IFormatProvider provider)
{
return Convert.ToUInt64(m_value);
}
- /// <internalonly/>
float IConvertible.ToSingle(IFormatProvider provider)
{
return m_value;
}
- /// <internalonly/>
double IConvertible.ToDouble(IFormatProvider provider)
{
return Convert.ToDouble(m_value);
}
- /// <internalonly/>
Decimal IConvertible.ToDecimal(IFormatProvider provider)
{
return Convert.ToDecimal(m_value);
}
- /// <internalonly/>
DateTime IConvertible.ToDateTime(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "Single", "DateTime"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Single", "DateTime"));
}
- /// <internalonly/>
Object IConvertible.ToType(Type type, IFormatProvider provider)
{
return Convert.DefaultToType((IConvertible)this, type, provider);
diff --git a/src/mscorlib/src/System/Span.cs b/src/mscorlib/src/System/Span.cs
index 94d5c4e895..4211083def 100644
--- a/src/mscorlib/src/System/Span.cs
+++ b/src/mscorlib/src/System/Span.cs
@@ -131,28 +131,15 @@ namespace System
/// <summary>
/// Create a new span over a portion of a regular managed object. This can be useful
- /// if part of a managed object represents a "fixed array." This is dangerous because
- /// "length" is not checked, nor is the fact that "rawPointer" actually lies within the object.
+ /// if part of a managed object represents a "fixed array." This is dangerous because neither the
+ /// <paramref name="length"/> is checked, nor <paramref name="obj"/> being null, nor the fact that
+ /// "rawPointer" actually lies within <paramref name="obj"/>.
/// </summary>
/// <param name="obj">The managed object that contains the data to span over.</param>
/// <param name="objectData">A reference to data within that object.</param>
/// <param name="length">The number of <typeparamref name="T"/> elements the memory contains.</param>
- /// <exception cref="System.ArgumentNullException">
- /// Thrown when the specified object is null.
- /// </exception>
- /// <exception cref="System.ArgumentOutOfRangeException">
- /// Thrown when the specified <paramref name="length"/> is negative.
- /// </exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static Span<T> DangerousCreate(object obj, ref T objectData, int length)
- {
- if (obj == null)
- ThrowHelper.ThrowArgumentNullException(ExceptionArgument.obj);
- if (length < 0)
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.length);
-
- return new Span<T>(ref objectData, length);
- }
+ public static Span<T> DangerousCreate(object obj, ref T objectData, int length) => new Span<T>(ref objectData, length);
// Constructor for internal use only.
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -329,9 +316,7 @@ namespace System
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object obj)
{
- ThrowHelper.ThrowNotSupportedException_CannotCallEqualsOnSpan();
- // Prevent compiler error CS0161: 'Span<T>.Equals(object)': not all code paths return a value
- return default(bool);
+ throw new NotSupportedException(SR.NotSupported_CannotCallEqualsOnSpan);
}
/// <summary>
@@ -344,9 +329,7 @@ namespace System
[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode()
{
- ThrowHelper.ThrowNotSupportedException_CannotCallGetHashCodeOnSpan();
- // Prevent compiler error CS0161: 'Span<T>.GetHashCode()': not all code paths return a value
- return default(int);
+ throw new NotSupportedException(SR.NotSupported_CannotCallGetHashCodeOnSpan);
}
/// <summary>
@@ -520,56 +503,13 @@ namespace System
/// <exception cref="System.ArgumentNullException">Thrown when <paramref name="text"/> is a null
/// reference (Nothing in Visual Basic).</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ReadOnlySpan<char> Slice(this string text)
+ public static ReadOnlySpan<char> AsSpan(this string text)
{
if (text == null)
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.text);
return new ReadOnlySpan<char>(ref text.GetFirstCharRef(), text.Length);
}
-
- /// <summary>
- /// Creates a new readonly span over the portion of the target string, beginning at 'start'.
- /// </summary>
- /// <param name="text">The target string.</param>
- /// <param name="start">The index at which to begin this slice.</param>
- /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="text"/> is a null
- /// reference (Nothing in Visual Basic).</exception>
- /// <exception cref="System.ArgumentOutOfRangeException">
- /// Thrown when the specified <paramref name="start"/> index is not in range (&lt;0 or &gt;Length).
- /// </exception>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ReadOnlySpan<char> Slice(this string text, int start)
- {
- if (text == null)
- ThrowHelper.ThrowArgumentNullException(ExceptionArgument.text);
- if ((uint)start > (uint)text.Length)
- ThrowHelper.ThrowArgumentOutOfRangeException();
-
- return new ReadOnlySpan<char>(ref Unsafe.Add(ref text.GetFirstCharRef(), start), text.Length - start);
- }
-
- /// <summary>
- /// Creates a new readonly span over the portion of the target string, beginning at <paramref name="start"/>, of given <paramref name="length"/>.
- /// </summary>
- /// <param name="text">The target string.</param>
- /// <param name="start">The index at which to begin this slice.</param>
- /// <param name="length">The number of items in the span.</param>
- /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="text"/> is a null
- /// reference (Nothing in Visual Basic).</exception>
- /// <exception cref="System.ArgumentOutOfRangeException">
- /// Thrown when the specified <paramref name="start"/> or end index is not in range (&lt;0 or &gt;&eq;Length).
- /// </exception>
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static ReadOnlySpan<char> Slice(this string text, int start, int length)
- {
- if (text == null)
- ThrowHelper.ThrowArgumentNullException(ExceptionArgument.text);
- if ((uint)start > (uint)text.Length || (uint)length > (uint)(text.Length - start))
- ThrowHelper.ThrowArgumentOutOfRangeException();
-
- return new ReadOnlySpan<char>(ref Unsafe.Add(ref text.GetFirstCharRef(), start), length);
- }
}
internal static class SpanHelper
@@ -617,7 +557,7 @@ namespace System
if (byteLength > 4096) goto PInvoke;
Unsafe.InitBlockUnaligned(ref b, 0, (uint)byteLength);
return;
-#endif // AMD64
+#else // AMD64
// TODO: Optimize this method on X86 machine
// Note: It's important that this switch handles lengths at least up to 22.
// See notes below near the main loop for why.
@@ -920,6 +860,7 @@ namespace System
}
return;
+#endif // AMD64
PInvoke:
RuntimeImports.RhZeroMemory(ref b, byteLength);
diff --git a/src/mscorlib/src/System/String.Comparison.cs b/src/mscorlib/src/System/String.Comparison.cs
index bc7800068b..c2c3a8709a 100644
--- a/src/mscorlib/src/System/String.Comparison.cs
+++ b/src/mscorlib/src/System/String.Comparison.cs
@@ -386,7 +386,7 @@ namespace System
// Single comparison to check if comparisonType is within [CurrentCulture .. OrdinalIgnoreCase]
if ((uint)(comparisonType - StringComparison.CurrentCulture) > (uint)(StringComparison.OrdinalIgnoreCase - StringComparison.CurrentCulture))
{
- throw new ArgumentException(Environment.GetResourceString("NotSupported_StringComparison"), nameof(comparisonType));
+ throw new ArgumentException(SR.NotSupported_StringComparison, nameof(comparisonType));
}
Contract.EndContractBlock();
@@ -439,7 +439,7 @@ namespace System
return CompareInfo.CompareOrdinalIgnoreCase(strA, 0, strA.Length, strB, 0, strB.Length);
default:
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_StringComparison"));
+ throw new NotSupportedException(SR.NotSupported_StringComparison);
}
}
@@ -572,7 +572,7 @@ namespace System
{
if (comparisonType < StringComparison.CurrentCulture || comparisonType > StringComparison.OrdinalIgnoreCase)
{
- throw new ArgumentException(Environment.GetResourceString("NotSupported_StringComparison"), nameof(comparisonType));
+ throw new ArgumentException(SR.NotSupported_StringComparison, nameof(comparisonType));
}
Contract.EndContractBlock();
@@ -589,19 +589,19 @@ namespace System
if (length < 0)
{
- throw new ArgumentOutOfRangeException(nameof(length), Environment.GetResourceString("ArgumentOutOfRange_NegativeLength"));
+ throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_NegativeLength);
}
if (indexA < 0 || indexB < 0)
{
string paramName = indexA < 0 ? nameof(indexA) : nameof(indexB);
- throw new ArgumentOutOfRangeException(paramName, Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(paramName, SR.ArgumentOutOfRange_Index);
}
if (strA.Length - indexA < 0 || strB.Length - indexB < 0)
{
string paramName = strA.Length - indexA < 0 ? nameof(indexA) : nameof(indexB);
- throw new ArgumentOutOfRangeException(paramName, Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(paramName, SR.ArgumentOutOfRange_Index);
}
if (length == 0 || (object.ReferenceEquals(strA, strB) && indexA == indexB))
@@ -633,7 +633,7 @@ namespace System
return (CompareInfo.CompareOrdinalIgnoreCase(strA, indexA, lengthA, strB, indexB, lengthB));
default:
- throw new ArgumentException(Environment.GetResourceString("NotSupported_StringComparison"));
+ throw new ArgumentException(SR.NotSupported_StringComparison);
}
}
@@ -689,13 +689,13 @@ namespace System
if (length < 0)
{
- throw new ArgumentOutOfRangeException(nameof(length), Environment.GetResourceString("ArgumentOutOfRange_NegativeCount"));
+ throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_NegativeCount);
}
if (indexA < 0 || indexB < 0)
{
string paramName = indexA < 0 ? nameof(indexA) : nameof(indexB);
- throw new ArgumentOutOfRangeException(paramName, Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(paramName, SR.ArgumentOutOfRange_Index);
}
int lengthA = Math.Min(length, strA.Length - indexA);
@@ -704,7 +704,7 @@ namespace System
if (lengthA < 0 || lengthB < 0)
{
string paramName = lengthA < 0 ? nameof(indexA) : nameof(indexB);
- throw new ArgumentOutOfRangeException(paramName, Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(paramName, SR.ArgumentOutOfRange_Index);
}
if (length == 0 || (object.ReferenceEquals(strA, strB) && indexA == indexB))
@@ -731,7 +731,7 @@ namespace System
if (other == null)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeString"));
+ throw new ArgumentException(SR.Arg_MustBeString);
}
return CompareTo(other); // will call the string-based overload
@@ -766,7 +766,7 @@ namespace System
if (comparisonType < StringComparison.CurrentCulture || comparisonType > StringComparison.OrdinalIgnoreCase)
{
- throw new ArgumentException(Environment.GetResourceString("NotSupported_StringComparison"), nameof(comparisonType));
+ throw new ArgumentException(SR.NotSupported_StringComparison, nameof(comparisonType));
}
Contract.EndContractBlock();
@@ -800,7 +800,7 @@ namespace System
case StringComparison.OrdinalIgnoreCase:
return this.Length < value.Length ? false : (CompareInfo.CompareOrdinalIgnoreCase(this, this.Length - value.Length, value.Length, value, 0, value.Length) == 0);
default:
- throw new ArgumentException(Environment.GetResourceString("NotSupported_StringComparison"), nameof(comparisonType));
+ throw new ArgumentException(SR.NotSupported_StringComparison, nameof(comparisonType));
}
}
@@ -874,7 +874,7 @@ namespace System
public bool Equals(String value, StringComparison comparisonType)
{
if (comparisonType < StringComparison.CurrentCulture || comparisonType > StringComparison.OrdinalIgnoreCase)
- throw new ArgumentException(Environment.GetResourceString("NotSupported_StringComparison"), nameof(comparisonType));
+ throw new ArgumentException(SR.NotSupported_StringComparison, nameof(comparisonType));
Contract.EndContractBlock();
if ((Object)this == (Object)value)
@@ -919,7 +919,7 @@ namespace System
return (CompareInfo.CompareOrdinalIgnoreCase(this, 0, this.Length, value, 0, value.Length) == 0);
default:
- throw new ArgumentException(Environment.GetResourceString("NotSupported_StringComparison"), nameof(comparisonType));
+ throw new ArgumentException(SR.NotSupported_StringComparison, nameof(comparisonType));
}
}
@@ -945,7 +945,7 @@ namespace System
public static bool Equals(String a, String b, StringComparison comparisonType)
{
if (comparisonType < StringComparison.CurrentCulture || comparisonType > StringComparison.OrdinalIgnoreCase)
- throw new ArgumentException(Environment.GetResourceString("NotSupported_StringComparison"), nameof(comparisonType));
+ throw new ArgumentException(SR.NotSupported_StringComparison, nameof(comparisonType));
Contract.EndContractBlock();
if ((Object)a == (Object)b)
@@ -994,7 +994,7 @@ namespace System
}
default:
- throw new ArgumentException(Environment.GetResourceString("NotSupported_StringComparison"), nameof(comparisonType));
+ throw new ArgumentException(SR.NotSupported_StringComparison, nameof(comparisonType));
}
}
@@ -1123,7 +1123,7 @@ namespace System
if (comparisonType < StringComparison.CurrentCulture || comparisonType > StringComparison.OrdinalIgnoreCase)
{
- throw new ArgumentException(Environment.GetResourceString("NotSupported_StringComparison"), nameof(comparisonType));
+ throw new ArgumentException(SR.NotSupported_StringComparison, nameof(comparisonType));
}
Contract.EndContractBlock();
@@ -1169,7 +1169,7 @@ namespace System
return (CompareInfo.CompareOrdinalIgnoreCase(this, 0, value.Length, value, 0, value.Length) == 0);
default:
- throw new ArgumentException(Environment.GetResourceString("NotSupported_StringComparison"), nameof(comparisonType));
+ throw new ArgumentException(SR.NotSupported_StringComparison, nameof(comparisonType));
}
}
diff --git a/src/mscorlib/src/System/String.Manipulation.cs b/src/mscorlib/src/System/String.Manipulation.cs
index 90ec773bf7..4a59ec4c22 100644
--- a/src/mscorlib/src/System/String.Manipulation.cs
+++ b/src/mscorlib/src/System/String.Manipulation.cs
@@ -763,15 +763,15 @@ namespace System
}
if (startIndex < 0)
{
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_StartIndex"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_StartIndex);
}
if (count < 0)
{
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NegativeCount"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NegativeCount);
}
if (startIndex > value.Length - count)
{
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_IndexCountBuffer"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_IndexCountBuffer);
}
if (count <= 1)
@@ -871,7 +871,7 @@ namespace System
public String PadLeft(int totalWidth, char paddingChar)
{
if (totalWidth < 0)
- throw new ArgumentOutOfRangeException(nameof(totalWidth), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(totalWidth), SR.ArgumentOutOfRange_NeedNonNegNum);
int oldLength = Length;
int count = totalWidth - oldLength;
if (count <= 0)
@@ -902,7 +902,7 @@ namespace System
public String PadRight(int totalWidth, char paddingChar)
{
if (totalWidth < 0)
- throw new ArgumentOutOfRangeException(nameof(totalWidth), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(totalWidth), SR.ArgumentOutOfRange_NeedNonNegNum);
int oldLength = Length;
int count = totalWidth - oldLength;
if (count <= 0)
@@ -927,13 +927,13 @@ namespace System
{
if (startIndex < 0)
throw new ArgumentOutOfRangeException(nameof(startIndex),
- Environment.GetResourceString("ArgumentOutOfRange_StartIndex"));
+ SR.ArgumentOutOfRange_StartIndex);
if (count < 0)
throw new ArgumentOutOfRangeException(nameof(count),
- Environment.GetResourceString("ArgumentOutOfRange_NegativeCount"));
+ SR.ArgumentOutOfRange_NegativeCount);
if (count > Length - startIndex)
throw new ArgumentOutOfRangeException(nameof(count),
- Environment.GetResourceString("ArgumentOutOfRange_IndexCount"));
+ SR.ArgumentOutOfRange_IndexCount);
Contract.Ensures(Contract.Result<String>() != null);
Contract.Ensures(Contract.Result<String>().Length == this.Length - count);
Contract.EndContractBlock();
@@ -965,13 +965,13 @@ namespace System
if (startIndex < 0)
{
throw new ArgumentOutOfRangeException(nameof(startIndex),
- Environment.GetResourceString("ArgumentOutOfRange_StartIndex"));
+ SR.ArgumentOutOfRange_StartIndex);
}
if (startIndex >= Length)
{
throw new ArgumentOutOfRangeException(nameof(startIndex),
- Environment.GetResourceString("ArgumentOutOfRange_StartIndexLessThanLength"));
+ SR.ArgumentOutOfRange_StartIndexLessThanLength);
}
Contract.Ensures(Contract.Result<String>() != null);
@@ -1014,7 +1014,7 @@ namespace System
return ReplaceCore(oldValue, newValue, CultureInfo.InvariantCulture, CompareOptions.OrdinalIgnoreCase);
default:
- throw new ArgumentException(Environment.GetResourceString("NotSupported_StringComparison"), nameof(comparisonType));
+ throw new ArgumentException(SR.NotSupported_StringComparison, nameof(comparisonType));
}
}
@@ -1223,10 +1223,10 @@ namespace System
{
if (count < 0)
throw new ArgumentOutOfRangeException(nameof(count),
- Environment.GetResourceString("ArgumentOutOfRange_NegativeCount"));
+ SR.ArgumentOutOfRange_NegativeCount);
if (options < StringSplitOptions.None || options > StringSplitOptions.RemoveEmptyEntries)
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", options));
+ throw new ArgumentException(SR.Format(SR.Arg_EnumIllegalVal, options));
Contract.Ensures(Contract.Result<String[]>() != null);
Contract.EndContractBlock();
@@ -1290,12 +1290,12 @@ namespace System
if (count < 0)
{
throw new ArgumentOutOfRangeException(nameof(count),
- Environment.GetResourceString("ArgumentOutOfRange_NegativeCount"));
+ SR.ArgumentOutOfRange_NegativeCount);
}
if (options < StringSplitOptions.None || options > StringSplitOptions.RemoveEmptyEntries)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)options));
+ throw new ArgumentException(SR.Format(SR.Arg_EnumIllegalVal, (int)options));
}
Contract.EndContractBlock();
@@ -1591,22 +1591,22 @@ namespace System
//Bounds Checking.
if (startIndex < 0)
{
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_StartIndex"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_StartIndex);
}
if (startIndex > Length)
{
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_StartIndexLargerThanLength"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_StartIndexLargerThanLength);
}
if (length < 0)
{
- throw new ArgumentOutOfRangeException(nameof(length), Environment.GetResourceString("ArgumentOutOfRange_NegativeLength"));
+ throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_NegativeLength);
}
if (startIndex > Length - length)
{
- throw new ArgumentOutOfRangeException(nameof(length), Environment.GetResourceString("ArgumentOutOfRange_IndexLength"));
+ throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_IndexLength);
}
Contract.EndContractBlock();
diff --git a/src/mscorlib/src/System/String.Searching.cs b/src/mscorlib/src/System/String.Searching.cs
index 426bf21bec..411a45c1a7 100644
--- a/src/mscorlib/src/System/String.Searching.cs
+++ b/src/mscorlib/src/System/String.Searching.cs
@@ -35,10 +35,10 @@ namespace System
public unsafe int IndexOf(char value, int startIndex, int count)
{
if (startIndex < 0 || startIndex > Length)
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_Index);
if (count < 0 || count > Length - startIndex)
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_Count"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_Count);
fixed (char* pChars = &m_firstChar)
{
@@ -124,12 +124,12 @@ namespace System
{
if (startIndex < 0 || startIndex > this.Length)
{
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_Index);
}
if (count < 0 || count > this.Length - startIndex)
{
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_Count"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_Count);
}
Contract.EndContractBlock();
@@ -156,10 +156,10 @@ namespace System
throw new ArgumentNullException(nameof(value));
if (startIndex < 0 || startIndex > this.Length)
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_Index);
if (count < 0 || startIndex > this.Length - count)
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_Count"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_Count);
Contract.EndContractBlock();
switch (comparisonType)
@@ -186,7 +186,7 @@ namespace System
return TextInfo.IndexOfStringOrdinalIgnoreCase(this, value, startIndex, count);
default:
- throw new ArgumentException(Environment.GetResourceString("NotSupported_StringComparison"), nameof(comparisonType));
+ throw new ArgumentException(SR.NotSupported_StringComparison, nameof(comparisonType));
}
}
@@ -214,10 +214,10 @@ namespace System
return -1;
if (startIndex < 0 || startIndex >= Length)
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_Index);
if (count < 0 || count - 1 > startIndex)
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_Count"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_Count);
fixed (char* pChars = &m_firstChar)
{
@@ -300,7 +300,7 @@ namespace System
{
if (count < 0)
{
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_Count"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_Count);
}
Contract.EndContractBlock();
@@ -332,7 +332,7 @@ namespace System
// Now after handling empty strings, make sure we're not out of range
if (startIndex < 0 || startIndex > this.Length)
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_Index);
// Make sure that we allow startIndex == this.Length
if (startIndex == this.Length)
@@ -348,7 +348,7 @@ namespace System
// 2nd half of this also catches when startIndex == MAXINT, so MAXINT - 0 + 1 == -1, which is < 0.
if (count < 0 || startIndex - count + 1 < 0)
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_Count"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_Count);
switch (comparisonType)
@@ -373,7 +373,7 @@ namespace System
else
return TextInfo.LastIndexOfStringOrdinalIgnoreCase(this, value, startIndex, count);
default:
- throw new ArgumentException(Environment.GetResourceString("NotSupported_StringComparison"), nameof(comparisonType));
+ throw new ArgumentException(SR.NotSupported_StringComparison, nameof(comparisonType));
}
}
}
diff --git a/src/mscorlib/src/System/String.cs b/src/mscorlib/src/System/String.cs
index eb4d7921e5..f3a4d0f197 100644
--- a/src/mscorlib/src/System/String.cs
+++ b/src/mscorlib/src/System/String.cs
@@ -118,13 +118,13 @@ namespace System
if (destination == null)
throw new ArgumentNullException(nameof(destination));
if (count < 0)
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NegativeCount"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NegativeCount);
if (sourceIndex < 0)
- throw new ArgumentOutOfRangeException(nameof(sourceIndex), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(sourceIndex), SR.ArgumentOutOfRange_Index);
if (count > Length - sourceIndex)
- throw new ArgumentOutOfRangeException(nameof(sourceIndex), Environment.GetResourceString("ArgumentOutOfRange_IndexCount"));
+ throw new ArgumentOutOfRangeException(nameof(sourceIndex), SR.ArgumentOutOfRange_IndexCount);
if (destinationIndex > destination.Length - count || destinationIndex < 0)
- throw new ArgumentOutOfRangeException(nameof(destinationIndex), Environment.GetResourceString("ArgumentOutOfRange_IndexCount"));
+ throw new ArgumentOutOfRangeException(nameof(destinationIndex), SR.ArgumentOutOfRange_IndexCount);
Contract.EndContractBlock();
// Note: fixed does not like empty arrays
@@ -159,9 +159,9 @@ namespace System
{
// Range check everything.
if (startIndex < 0 || startIndex > Length || startIndex > Length - length)
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_Index);
if (length < 0)
- throw new ArgumentOutOfRangeException(nameof(length), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_Index);
Contract.EndContractBlock();
if (length > 0)
@@ -232,13 +232,13 @@ namespace System
return new String(value, startIndex, length); // default to ANSI
if (length < 0)
- throw new ArgumentOutOfRangeException(nameof(length), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_NeedNonNegNum);
if (startIndex < 0)
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_StartIndex"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_StartIndex);
if ((value + startIndex) < value)
{
// overflow check
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_PartialWCHAR"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_PartialWCHAR);
}
byte[] b = new byte[length];
@@ -252,7 +252,7 @@ namespace System
// If we got a NullReferencException. It means the pointer or
// the index is out of range
throw new ArgumentOutOfRangeException(nameof(value),
- Environment.GetResourceString("ArgumentOutOfRange_PartialWCHAR"));
+ SR.ArgumentOutOfRange_PartialWCHAR);
}
return enc.GetString(b);
@@ -332,7 +332,7 @@ namespace System
if (0 != DefaultCharUsed)
{
- throw new ArgumentException(Environment.GetResourceString("Interop_Marshal_Unmappable_Char"));
+ throw new ArgumentException(SR.Interop_Marshal_Unmappable_Char);
}
pbNativeBuffer[nb] = 0;
@@ -428,13 +428,13 @@ namespace System
throw new ArgumentNullException(nameof(value));
if (startIndex < 0)
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_StartIndex"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_StartIndex);
if (length < 0)
- throw new ArgumentOutOfRangeException(nameof(length), Environment.GetResourceString("ArgumentOutOfRange_NegativeLength"));
+ throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_NegativeLength);
if (startIndex > value.Length - length)
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_Index);
Contract.EndContractBlock();
if (length > 0)
@@ -498,10 +498,10 @@ namespace System
else if (count == 0)
return String.Empty;
else
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_MustBeNonNegNum", nameof(count)));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.Format(SR.ArgumentOutOfRange_MustBeNonNegNum, nameof(count)));
}
- private static unsafe int wcslen(char* ptr)
+ internal static unsafe int wcslen(char* ptr)
{
char* end = ptr;
@@ -602,7 +602,7 @@ namespace System
#if !FEATURE_PAL
if (ptr < (char*)64000)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeStringPtrNotAtom"));
+ throw new ArgumentException(SR.Arg_MustBeStringPtrNotAtom);
#endif // FEATURE_PAL
Debug.Assert(this == null, "this == null"); // this is the string constructor, we allocate it
@@ -620,7 +620,7 @@ namespace System
}
catch (NullReferenceException)
{
- throw new ArgumentOutOfRangeException(nameof(ptr), Environment.GetResourceString("ArgumentOutOfRange_PartialWCHAR"));
+ throw new ArgumentOutOfRangeException(nameof(ptr), SR.ArgumentOutOfRange_PartialWCHAR);
}
}
@@ -628,12 +628,12 @@ namespace System
{
if (length < 0)
{
- throw new ArgumentOutOfRangeException(nameof(length), Environment.GetResourceString("ArgumentOutOfRange_NegativeLength"));
+ throw new ArgumentOutOfRangeException(nameof(length), SR.ArgumentOutOfRange_NegativeLength);
}
if (startIndex < 0)
{
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_StartIndex"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_StartIndex);
}
Contract.EndContractBlock();
Debug.Assert(this == null, "this == null"); // this is the string constructor, we allocate it
@@ -642,7 +642,7 @@ namespace System
if (pFrom < ptr)
{
// This means that the pointer operation has had an overflow
- throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_PartialWCHAR"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), SR.ArgumentOutOfRange_PartialWCHAR);
}
if (length == 0)
@@ -658,7 +658,7 @@ namespace System
}
catch (NullReferenceException)
{
- throw new ArgumentOutOfRangeException(nameof(ptr), Environment.GetResourceString("ArgumentOutOfRange_PartialWCHAR"));
+ throw new ArgumentOutOfRangeException(nameof(ptr), SR.ArgumentOutOfRange_PartialWCHAR);
}
}
@@ -747,91 +747,76 @@ namespace System
return TypeCode.String;
}
- /// <internalonly/>
bool IConvertible.ToBoolean(IFormatProvider provider)
{
return Convert.ToBoolean(this, provider);
}
- /// <internalonly/>
char IConvertible.ToChar(IFormatProvider provider)
{
return Convert.ToChar(this, provider);
}
- /// <internalonly/>
sbyte IConvertible.ToSByte(IFormatProvider provider)
{
return Convert.ToSByte(this, provider);
}
- /// <internalonly/>
byte IConvertible.ToByte(IFormatProvider provider)
{
return Convert.ToByte(this, provider);
}
- /// <internalonly/>
short IConvertible.ToInt16(IFormatProvider provider)
{
return Convert.ToInt16(this, provider);
}
- /// <internalonly/>
ushort IConvertible.ToUInt16(IFormatProvider provider)
{
return Convert.ToUInt16(this, provider);
}
- /// <internalonly/>
int IConvertible.ToInt32(IFormatProvider provider)
{
return Convert.ToInt32(this, provider);
}
- /// <internalonly/>
uint IConvertible.ToUInt32(IFormatProvider provider)
{
return Convert.ToUInt32(this, provider);
}
- /// <internalonly/>
long IConvertible.ToInt64(IFormatProvider provider)
{
return Convert.ToInt64(this, provider);
}
- /// <internalonly/>
ulong IConvertible.ToUInt64(IFormatProvider provider)
{
return Convert.ToUInt64(this, provider);
}
- /// <internalonly/>
float IConvertible.ToSingle(IFormatProvider provider)
{
return Convert.ToSingle(this, provider);
}
- /// <internalonly/>
double IConvertible.ToDouble(IFormatProvider provider)
{
return Convert.ToDouble(this, provider);
}
- /// <internalonly/>
Decimal IConvertible.ToDecimal(IFormatProvider provider)
{
return Convert.ToDecimal(this, provider);
}
- /// <internalonly/>
DateTime IConvertible.ToDateTime(IFormatProvider provider)
{
return Convert.ToDateTime(this, provider);
}
- /// <internalonly/>
Object IConvertible.ToType(Type type, IFormatProvider provider)
{
return Convert.DefaultToType((IConvertible)this, type, provider);
@@ -870,7 +855,6 @@ namespace System
return new CharEnumerator(this);
}
- /// <internalonly/>
IEnumerator IEnumerable.GetEnumerator()
{
Contract.Ensures(Contract.Result<IEnumerator>() != null);
diff --git a/src/mscorlib/src/System/StubHelpers.cs b/src/mscorlib/src/System/StubHelpers.cs
index 7497cbffbb..f584ece6fc 100644
--- a/src/mscorlib/src/System/StubHelpers.cs
+++ b/src/mscorlib/src/System/StubHelpers.cs
@@ -532,7 +532,7 @@ namespace System.StubHelpers
internal static unsafe IntPtr ConvertToNative(string managed)
{
if (!Environment.IsWinRTSupported)
- throw new PlatformNotSupportedException(Environment.GetResourceString("PlatformNotSupported_WinRT"));
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_WinRT);
if (managed == null)
throw new ArgumentNullException(); // We don't have enough information to get the argument name
@@ -552,7 +552,7 @@ namespace System.StubHelpers
[Out] HSTRING_HEADER* hstringHeader)
{
if (!Environment.IsWinRTSupported)
- throw new PlatformNotSupportedException(Environment.GetResourceString("PlatformNotSupported_WinRT"));
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_WinRT);
if (managed == null)
throw new ArgumentNullException(); // We don't have enough information to get the argument name
@@ -571,7 +571,7 @@ namespace System.StubHelpers
{
if (!Environment.IsWinRTSupported)
{
- throw new PlatformNotSupportedException(Environment.GetResourceString("PlatformNotSupported_WinRT"));
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_WinRT);
}
return WindowsRuntimeMarshal.HStringToString(hstring);
@@ -1003,7 +1003,7 @@ namespace System.StubHelpers
}
default:
- throw new ArgumentException(Environment.GetResourceString("Arg_NDirectBadObject"));
+ throw new ArgumentException(SR.Arg_NDirectBadObject);
}
// marshal the object as C-style array (UnmanagedType.LPArray)
@@ -1170,7 +1170,7 @@ namespace System.StubHelpers
return IntPtr.Zero;
if (pManagedHome is ArrayWithOffset)
- throw new ArgumentException(Environment.GetResourceString("Arg_MarshalAsAnyRestriction"));
+ throw new ArgumentException(SR.Arg_MarshalAsAnyRestriction);
IntPtr pNativeHome;
@@ -1202,7 +1202,7 @@ namespace System.StubHelpers
else
{
// this type is not supported for AsAny marshaling
- throw new ArgumentException(Environment.GetResourceString("Arg_NDirectBadObject"));
+ throw new ArgumentException(SR.Arg_NDirectBadObject);
}
}
@@ -1328,7 +1328,7 @@ namespace System.StubHelpers
{
if (!Environment.IsWinRTSupported)
{
- throw new PlatformNotSupportedException(Environment.GetResourceString("PlatformNotSupported_WinRT"));
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_WinRT);
}
string typeName;
@@ -1336,7 +1336,7 @@ namespace System.StubHelpers
{
if (managedType.GetType() != typeof(System.RuntimeType))
{ // The type should be exactly System.RuntimeType (and not its child System.ReflectionOnlyType, or other System.Type children)
- throw new ArgumentException(Environment.GetResourceString("Argument_WinRTSystemRuntimeType", managedType.GetType().ToString()));
+ throw new ArgumentException(SR.Format(SR.Argument_WinRTSystemRuntimeType, managedType.GetType().ToString()));
}
bool isPrimitive;
@@ -1371,7 +1371,7 @@ namespace System.StubHelpers
{
if (!Environment.IsWinRTSupported)
{
- throw new PlatformNotSupportedException(Environment.GetResourceString("PlatformNotSupported_WinRT"));
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_WinRT);
}
string typeName = WindowsRuntimeMarshal.HStringToString(pNativeType->typeName);
@@ -1392,7 +1392,7 @@ namespace System.StubHelpers
// TypeSource must match
if (isPrimitive != (pNativeType->typeKind == TypeKind.Primitive))
- throw new ArgumentException(Environment.GetResourceString("Argument_Unexpected_TypeSource"));
+ throw new ArgumentException(SR.Argument_Unexpected_TypeSource);
}
}
@@ -1414,7 +1414,7 @@ namespace System.StubHelpers
{
if (!Environment.IsWinRTSupported)
{
- throw new PlatformNotSupportedException(Environment.GetResourceString("PlatformNotSupported_WinRT"));
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_WinRT);
}
if (ex == null)
@@ -1429,7 +1429,7 @@ namespace System.StubHelpers
if (!Environment.IsWinRTSupported)
{
- throw new PlatformNotSupportedException(Environment.GetResourceString("PlatformNotSupported_WinRT"));
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_WinRT);
}
Exception e = null;
@@ -1722,7 +1722,7 @@ namespace System.StubHelpers
{
if (length > 0x7ffffff0)
{
- throw new MarshalDirectiveException(Environment.GetResourceString("Marshaler_StringTooLong"));
+ throw new MarshalDirectiveException(SR.Marshaler_StringTooLong);
}
}
diff --git a/src/mscorlib/src/System/Text/ASCIIEncoding.cs b/src/mscorlib/src/System/Text/ASCIIEncoding.cs
index a3107ebd64..f42a1c407b 100644
--- a/src/mscorlib/src/System/Text/ASCIIEncoding.cs
+++ b/src/mscorlib/src/System/Text/ASCIIEncoding.cs
@@ -178,8 +178,7 @@ namespace System.Text
// We always need the fallback buffer in get bytes so we can flush any remaining ones if necessary
fallbackBuffer = encoder.FallbackBuffer;
if (fallbackBuffer.Remaining > 0 && encoder.m_throwOnOverflow)
- throw new ArgumentException(Environment.GetResourceString("Argument_EncoderFallbackNotEmpty",
- this.EncodingName, encoder.Fallback.GetType()));
+ throw new ArgumentException(SR.Format(SR.Argument_EncoderFallbackNotEmpty, this.EncodingName, encoder.Fallback.GetType()));
// Set our internal fallback interesting things.
fallbackBuffer.InternalInitialize(chars, charEnd, encoder, false);
@@ -319,8 +318,7 @@ namespace System.Text
// We always need the fallback buffer in get bytes so we can flush any remaining ones if necessary
fallbackBuffer = encoder.FallbackBuffer;
if (fallbackBuffer.Remaining > 0 && encoder.m_throwOnOverflow)
- throw new ArgumentException(Environment.GetResourceString("Argument_EncoderFallbackNotEmpty",
- this.EncodingName, encoder.Fallback.GetType()));
+ throw new ArgumentException(SR.Format(SR.Argument_EncoderFallbackNotEmpty, this.EncodingName, encoder.Fallback.GetType()));
// Set our internal fallback interesting things.
fallbackBuffer.InternalInitialize(charStart, charEnd, encoder, true);
@@ -714,7 +712,7 @@ namespace System.Text
{
if (charCount < 0)
throw new ArgumentOutOfRangeException(nameof(charCount),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// Characters would be # of characters + 1 in case high surrogate is ? * max fallback
@@ -726,7 +724,7 @@ namespace System.Text
// 1 to 1 for most characters. Only surrogates with fallbacks have less.
if (byteCount > 0x7fffffff)
- throw new ArgumentOutOfRangeException(nameof(charCount), Environment.GetResourceString("ArgumentOutOfRange_GetByteCountOverflow"));
+ throw new ArgumentOutOfRangeException(nameof(charCount), SR.ArgumentOutOfRange_GetByteCountOverflow);
return (int)byteCount;
}
@@ -735,7 +733,7 @@ namespace System.Text
{
if (byteCount < 0)
throw new ArgumentOutOfRangeException(nameof(byteCount),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// Just return length, SBCS stay the same length because they don't map to surrogate
@@ -746,7 +744,7 @@ namespace System.Text
charCount *= DecoderFallback.MaxCharCount;
if (charCount > 0x7fffffff)
- throw new ArgumentOutOfRangeException(nameof(byteCount), Environment.GetResourceString("ArgumentOutOfRange_GetCharCountOverflow"));
+ throw new ArgumentOutOfRangeException(nameof(byteCount), SR.ArgumentOutOfRange_GetCharCountOverflow);
return (int)charCount;
}
diff --git a/src/mscorlib/src/System/Text/Decoder.cs b/src/mscorlib/src/System/Text/Decoder.cs
index e8b9128bd6..a52c9ba700 100644
--- a/src/mscorlib/src/System/Text/Decoder.cs
+++ b/src/mscorlib/src/System/Text/Decoder.cs
@@ -55,7 +55,7 @@ namespace System.Text
// Can't change fallback if buffer is wrong
if (m_fallbackBuffer != null && m_fallbackBuffer.Remaining > 0)
throw new ArgumentException(
- Environment.GetResourceString("Argument_FallbackBufferNotEmpty"), nameof(value));
+ SR.Argument_FallbackBufferNotEmpty, nameof(value));
m_fallback = value;
m_fallbackBuffer = null;
@@ -127,11 +127,11 @@ namespace System.Text
// Validate input parameters
if (bytes == null)
throw new ArgumentNullException(nameof(bytes),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (count < 0)
throw new ArgumentOutOfRangeException(nameof(count),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
byte[] arrbyte = new byte[count];
@@ -191,11 +191,11 @@ namespace System.Text
// Validate input parameters
if (chars == null || bytes == null)
throw new ArgumentNullException(chars == null ? nameof(chars) : nameof(bytes),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (byteCount < 0 || charCount < 0)
throw new ArgumentOutOfRangeException((byteCount < 0 ? nameof(byteCount) : nameof(charCount)),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// Get the byte array to convert
@@ -249,23 +249,23 @@ namespace System.Text
// Validate parameters
if (bytes == null || chars == null)
throw new ArgumentNullException((bytes == null ? nameof(bytes) : nameof(chars)),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (byteIndex < 0 || byteCount < 0)
throw new ArgumentOutOfRangeException((byteIndex < 0 ? nameof(byteIndex) : nameof(byteCount)),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
if (charIndex < 0 || charCount < 0)
throw new ArgumentOutOfRangeException((charIndex < 0 ? nameof(charIndex) : nameof(charCount)),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
if (bytes.Length - byteIndex < byteCount)
throw new ArgumentOutOfRangeException(nameof(bytes),
- Environment.GetResourceString("ArgumentOutOfRange_IndexCountBuffer"));
+ SR.ArgumentOutOfRange_IndexCountBuffer);
if (chars.Length - charIndex < charCount)
throw new ArgumentOutOfRangeException(nameof(chars),
- Environment.GetResourceString("ArgumentOutOfRange_IndexCountBuffer"));
+ SR.ArgumentOutOfRange_IndexCountBuffer);
Contract.EndContractBlock();
bytesUsed = byteCount;
@@ -287,7 +287,7 @@ namespace System.Text
}
// Oops, we didn't have anything, we'll have to throw an overflow
- throw new ArgumentException(Environment.GetResourceString("Argument_ConversionOverflow"));
+ throw new ArgumentException(SR.Argument_ConversionOverflow);
}
// This is the version that uses *.
@@ -306,11 +306,11 @@ namespace System.Text
// Validate input parameters
if (chars == null || bytes == null)
throw new ArgumentNullException(chars == null ? nameof(chars) : nameof(bytes),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (byteCount < 0 || charCount < 0)
throw new ArgumentOutOfRangeException((byteCount < 0 ? nameof(byteCount) : nameof(charCount)),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// Get ready to do it
@@ -333,7 +333,7 @@ namespace System.Text
}
// Oops, we didn't have anything, we'll have to throw an overflow
- throw new ArgumentException(Environment.GetResourceString("Argument_ConversionOverflow"));
+ throw new ArgumentException(SR.Argument_ConversionOverflow);
}
}
}
diff --git a/src/mscorlib/src/System/Text/DecoderExceptionFallback.cs b/src/mscorlib/src/System/Text/DecoderExceptionFallback.cs
index b709dcde57..e319e153dc 100644
--- a/src/mscorlib/src/System/Text/DecoderExceptionFallback.cs
+++ b/src/mscorlib/src/System/Text/DecoderExceptionFallback.cs
@@ -94,8 +94,7 @@ namespace System.Text
// Known index
throw new DecoderFallbackException(
- Environment.GetResourceString("Argument_InvalidCodePageBytesIndex",
- strBytes, index), bytesUnknown, index);
+ SR.Format(SR.Argument_InvalidCodePageBytesIndex, strBytes, index), bytesUnknown, index);
}
}
@@ -107,7 +106,7 @@ namespace System.Text
private int index = 0;
public DecoderFallbackException()
- : base(Environment.GetResourceString("Arg_ArgumentException"))
+ : base(SR.Arg_ArgumentException)
{
SetErrorCode(__HResults.COR_E_ARGUMENT);
}
diff --git a/src/mscorlib/src/System/Text/DecoderFallback.cs b/src/mscorlib/src/System/Text/DecoderFallback.cs
index e7b57bdff4..9311cda585 100644
--- a/src/mscorlib/src/System/Text/DecoderFallback.cs
+++ b/src/mscorlib/src/System/Text/DecoderFallback.cs
@@ -160,14 +160,14 @@ namespace System.Text
{
// High Surrogate
if (bHighSurrogate)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidCharSequenceNoIndex"));
+ throw new ArgumentException(SR.Argument_InvalidCharSequenceNoIndex);
bHighSurrogate = true;
}
else
{
// Low surrogate
if (bHighSurrogate == false)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidCharSequenceNoIndex"));
+ throw new ArgumentException(SR.Argument_InvalidCharSequenceNoIndex);
bHighSurrogate = false;
}
}
@@ -183,7 +183,7 @@ namespace System.Text
// Need to make sure that bHighSurrogate isn't true
if (bHighSurrogate)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidCharSequenceNoIndex"));
+ throw new ArgumentException(SR.Argument_InvalidCharSequenceNoIndex);
// Now we aren't going to be false, so its OK to update chars
chars = charTemp;
@@ -220,14 +220,14 @@ namespace System.Text
{
// High Surrogate
if (bHighSurrogate)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidCharSequenceNoIndex"));
+ throw new ArgumentException(SR.Argument_InvalidCharSequenceNoIndex);
bHighSurrogate = true;
}
else
{
// Low surrogate
if (bHighSurrogate == false)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidCharSequenceNoIndex"));
+ throw new ArgumentException(SR.Argument_InvalidCharSequenceNoIndex);
bHighSurrogate = false;
}
}
@@ -237,7 +237,7 @@ namespace System.Text
// Need to make sure that bHighSurrogate isn't true
if (bHighSurrogate)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidCharSequenceNoIndex"));
+ throw new ArgumentException(SR.Argument_InvalidCharSequenceNoIndex);
return count;
}
@@ -264,8 +264,7 @@ namespace System.Text
// Throw it, using our complete bytes
throw new ArgumentException(
- Environment.GetResourceString("Argument_RecursiveFallbackBytes",
- strBytes.ToString()), nameof(bytesUnknown));
+ SR.Format(SR.Argument_RecursiveFallbackBytes, strBytes.ToString()), nameof(bytesUnknown));
}
}
}
diff --git a/src/mscorlib/src/System/Text/DecoderNLS.cs b/src/mscorlib/src/System/Text/DecoderNLS.cs
index c2f5e47e1d..6fcfc79140 100644
--- a/src/mscorlib/src/System/Text/DecoderNLS.cs
+++ b/src/mscorlib/src/System/Text/DecoderNLS.cs
@@ -38,7 +38,7 @@ namespace System.Text
throw new NotSupportedException(
String.Format(
System.Globalization.CultureInfo.CurrentCulture,
- Environment.GetResourceString("NotSupported_TypeCannotDeserialized"), this.GetType()));
+ SR.NotSupported_TypeCannotDeserialized, this.GetType()));
}
// ISerializable implementation. called during serialization.
@@ -81,15 +81,15 @@ namespace System.Text
// Validate Parameters
if (bytes == null)
throw new ArgumentNullException(nameof(bytes),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (index < 0 || count < 0)
throw new ArgumentOutOfRangeException((index < 0 ? nameof(index) : nameof(count)),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
if (bytes.Length - index < count)
throw new ArgumentOutOfRangeException(nameof(bytes),
- Environment.GetResourceString("ArgumentOutOfRange_IndexCountBuffer"));
+ SR.ArgumentOutOfRange_IndexCountBuffer);
Contract.EndContractBlock();
@@ -107,11 +107,11 @@ namespace System.Text
// Validate parameters
if (bytes == null)
throw new ArgumentNullException(nameof(bytes),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (count < 0)
throw new ArgumentOutOfRangeException(nameof(count),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// Remember the flush
@@ -134,19 +134,19 @@ namespace System.Text
// Validate Parameters
if (bytes == null || chars == null)
throw new ArgumentNullException(bytes == null ? nameof(bytes) : nameof(chars),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (byteIndex < 0 || byteCount < 0)
throw new ArgumentOutOfRangeException((byteIndex < 0 ? nameof(byteIndex) : nameof(byteCount)),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
if (bytes.Length - byteIndex < byteCount)
throw new ArgumentOutOfRangeException(nameof(bytes),
- Environment.GetResourceString("ArgumentOutOfRange_IndexCountBuffer"));
+ SR.ArgumentOutOfRange_IndexCountBuffer);
if (charIndex < 0 || charIndex > chars.Length)
throw new ArgumentOutOfRangeException(nameof(charIndex),
- Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ SR.ArgumentOutOfRange_Index);
Contract.EndContractBlock();
@@ -172,11 +172,11 @@ namespace System.Text
// Validate parameters
if (chars == null || bytes == null)
throw new ArgumentNullException((chars == null ? nameof(chars) : nameof(bytes)),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (byteCount < 0 || charCount < 0)
throw new ArgumentOutOfRangeException((byteCount < 0 ? nameof(byteCount) : nameof(charCount)),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// Remember our flush
@@ -196,23 +196,23 @@ namespace System.Text
// Validate parameters
if (bytes == null || chars == null)
throw new ArgumentNullException((bytes == null ? nameof(bytes) : nameof(chars)),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (byteIndex < 0 || byteCount < 0)
throw new ArgumentOutOfRangeException((byteIndex < 0 ? nameof(byteIndex) : nameof(byteCount)),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
if (charIndex < 0 || charCount < 0)
throw new ArgumentOutOfRangeException((charIndex < 0 ? nameof(charIndex) : nameof(charCount)),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
if (bytes.Length - byteIndex < byteCount)
throw new ArgumentOutOfRangeException(nameof(bytes),
- Environment.GetResourceString("ArgumentOutOfRange_IndexCountBuffer"));
+ SR.ArgumentOutOfRange_IndexCountBuffer);
if (chars.Length - charIndex < charCount)
throw new ArgumentOutOfRangeException(nameof(chars),
- Environment.GetResourceString("ArgumentOutOfRange_IndexCountBuffer"));
+ SR.ArgumentOutOfRange_IndexCountBuffer);
Contract.EndContractBlock();
@@ -242,11 +242,11 @@ namespace System.Text
// Validate input parameters
if (chars == null || bytes == null)
throw new ArgumentNullException(chars == null ? nameof(chars) : nameof(bytes),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (byteCount < 0 || charCount < 0)
throw new ArgumentOutOfRangeException((byteCount < 0 ? nameof(byteCount) : nameof(charCount)),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// We don't want to throw
diff --git a/src/mscorlib/src/System/Text/DecoderReplacementFallback.cs b/src/mscorlib/src/System/Text/DecoderReplacementFallback.cs
index 8147da5583..b27469156d 100644
--- a/src/mscorlib/src/System/Text/DecoderReplacementFallback.cs
+++ b/src/mscorlib/src/System/Text/DecoderReplacementFallback.cs
@@ -59,7 +59,7 @@ namespace System.Text
break;
}
if (bFoundHigh)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidCharSequenceNoIndex", nameof(replacement)));
+ throw new ArgumentException(SR.Format(SR.Argument_InvalidCharSequenceNoIndex, nameof(replacement)));
strDefault = replacement;
}
diff --git a/src/mscorlib/src/System/Text/Encoder.cs b/src/mscorlib/src/System/Text/Encoder.cs
index 9ec8231b50..82eb2ad899 100644
--- a/src/mscorlib/src/System/Text/Encoder.cs
+++ b/src/mscorlib/src/System/Text/Encoder.cs
@@ -55,7 +55,7 @@ namespace System.Text
// Can't change fallback if buffer is wrong
if (m_fallbackBuffer != null && m_fallbackBuffer.Remaining > 0)
throw new ArgumentException(
- Environment.GetResourceString("Argument_FallbackBufferNotEmpty"), nameof(value));
+ SR.Argument_FallbackBufferNotEmpty, nameof(value));
m_fallback = value;
m_fallbackBuffer = null;
@@ -124,11 +124,11 @@ namespace System.Text
// Validate input parameters
if (chars == null)
throw new ArgumentNullException(nameof(chars),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (count < 0)
throw new ArgumentOutOfRangeException(nameof(count),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
char[] arrChar = new char[count];
@@ -185,11 +185,11 @@ namespace System.Text
// Validate input parameters
if (bytes == null || chars == null)
throw new ArgumentNullException(bytes == null ? nameof(bytes) : nameof(chars),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (charCount < 0 || byteCount < 0)
throw new ArgumentOutOfRangeException((charCount < 0 ? nameof(charCount) : nameof(byteCount)),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// Get the char array to convert
@@ -242,23 +242,23 @@ namespace System.Text
// Validate parameters
if (chars == null || bytes == null)
throw new ArgumentNullException((chars == null ? nameof(chars) : nameof(bytes)),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (charIndex < 0 || charCount < 0)
throw new ArgumentOutOfRangeException((charIndex < 0 ? nameof(charIndex) : nameof(charCount)),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
if (byteIndex < 0 || byteCount < 0)
throw new ArgumentOutOfRangeException((byteIndex < 0 ? nameof(byteIndex) : nameof(byteCount)),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
if (chars.Length - charIndex < charCount)
throw new ArgumentOutOfRangeException(nameof(chars),
- Environment.GetResourceString("ArgumentOutOfRange_IndexCountBuffer"));
+ SR.ArgumentOutOfRange_IndexCountBuffer);
if (bytes.Length - byteIndex < byteCount)
throw new ArgumentOutOfRangeException(nameof(bytes),
- Environment.GetResourceString("ArgumentOutOfRange_IndexCountBuffer"));
+ SR.ArgumentOutOfRange_IndexCountBuffer);
Contract.EndContractBlock();
charsUsed = charCount;
@@ -282,7 +282,7 @@ namespace System.Text
}
// Oops, we didn't have anything, we'll have to throw an overflow
- throw new ArgumentException(Environment.GetResourceString("Argument_ConversionOverflow"));
+ throw new ArgumentException(SR.Argument_ConversionOverflow);
}
// Same thing, but using pointers
@@ -300,10 +300,10 @@ namespace System.Text
// Validate input parameters
if (bytes == null || chars == null)
throw new ArgumentNullException(bytes == null ? nameof(bytes) : nameof(chars),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (charCount < 0 || byteCount < 0)
throw new ArgumentOutOfRangeException((charCount < 0 ? nameof(charCount) : nameof(byteCount)),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// Get ready to do it
@@ -326,7 +326,7 @@ namespace System.Text
}
// Oops, we didn't have anything, we'll have to throw an overflow
- throw new ArgumentException(Environment.GetResourceString("Argument_ConversionOverflow"));
+ throw new ArgumentException(SR.Argument_ConversionOverflow);
}
}
}
diff --git a/src/mscorlib/src/System/Text/EncoderBestFitFallback.cs b/src/mscorlib/src/System/Text/EncoderBestFitFallback.cs
index 153155da69..eb3165526b 100644
--- a/src/mscorlib/src/System/Text/EncoderBestFitFallback.cs
+++ b/src/mscorlib/src/System/Text/EncoderBestFitFallback.cs
@@ -16,7 +16,7 @@ using System.Diagnostics.Contracts;
namespace System.Text
{
[Serializable]
- internal class InternalEncoderBestFitFallback : EncoderFallback
+ internal sealed class InternalEncoderBestFitFallback : EncoderFallback
{
// Our variables
internal Encoding encoding = null;
@@ -120,13 +120,11 @@ namespace System.Text
// Double check input surrogate pair
if (!Char.IsHighSurrogate(charUnknownHigh))
throw new ArgumentOutOfRangeException(nameof(charUnknownHigh),
- Environment.GetResourceString("ArgumentOutOfRange_Range",
- 0xD800, 0xDBFF));
+ SR.Format(SR.ArgumentOutOfRange_Range, 0xD800, 0xDBFF));
if (!Char.IsLowSurrogate(charUnknownLow))
throw new ArgumentOutOfRangeException(nameof(charUnknownLow),
- Environment.GetResourceString("ArgumentOutOfRange_Range",
- 0xDC00, 0xDFFF));
+ SR.Format(SR.ArgumentOutOfRange_Range, 0xDC00, 0xDFFF));
Contract.EndContractBlock();
// If we had a buffer already we're being recursive, throw, it's probably at the suspect
diff --git a/src/mscorlib/src/System/Text/EncoderExceptionFallback.cs b/src/mscorlib/src/System/Text/EncoderExceptionFallback.cs
index b64e19e598..251b4b440c 100644
--- a/src/mscorlib/src/System/Text/EncoderExceptionFallback.cs
+++ b/src/mscorlib/src/System/Text/EncoderExceptionFallback.cs
@@ -54,8 +54,7 @@ namespace System.Text
{
// Fall back our char
throw new EncoderFallbackException(
- Environment.GetResourceString("Argument_InvalidCodePageConversionIndex",
- (int)charUnknown, index), charUnknown, index);
+ SR.Format(SR.Argument_InvalidCodePageConversionIndex, (int)charUnknown, index), charUnknown, index);
}
public override bool Fallback(char charUnknownHigh, char charUnknownLow, int index)
@@ -63,14 +62,12 @@ namespace System.Text
if (!Char.IsHighSurrogate(charUnknownHigh))
{
throw new ArgumentOutOfRangeException(nameof(charUnknownHigh),
- Environment.GetResourceString("ArgumentOutOfRange_Range",
- 0xD800, 0xDBFF));
+ SR.Format(SR.ArgumentOutOfRange_Range, 0xD800, 0xDBFF));
}
if (!Char.IsLowSurrogate(charUnknownLow))
{
throw new ArgumentOutOfRangeException(nameof(charUnknownLow),
- Environment.GetResourceString("ArgumentOutOfRange_Range",
- 0xDC00, 0xDFFF));
+ SR.Format(SR.ArgumentOutOfRange_Range, 0xDC00, 0xDFFF));
}
Contract.EndContractBlock();
@@ -78,8 +75,7 @@ namespace System.Text
// Fall back our char
throw new EncoderFallbackException(
- Environment.GetResourceString("Argument_InvalidCodePageConversionIndex",
- iTemp, index), charUnknownHigh, charUnknownLow, index);
+ SR.Format(SR.Argument_InvalidCodePageConversionIndex, iTemp, index), charUnknownHigh, charUnknownLow, index);
}
public override char GetNextChar()
@@ -112,7 +108,7 @@ namespace System.Text
private int index;
public EncoderFallbackException()
- : base(Environment.GetResourceString("Arg_ArgumentException"))
+ : base(SR.Arg_ArgumentException)
{
SetErrorCode(__HResults.COR_E_ARGUMENT);
}
@@ -146,14 +142,12 @@ namespace System.Text
if (!Char.IsHighSurrogate(charUnknownHigh))
{
throw new ArgumentOutOfRangeException(nameof(charUnknownHigh),
- Environment.GetResourceString("ArgumentOutOfRange_Range",
- 0xD800, 0xDBFF));
+ SR.Format(SR.ArgumentOutOfRange_Range, 0xD800, 0xDBFF));
}
if (!Char.IsLowSurrogate(charUnknownLow))
{
throw new ArgumentOutOfRangeException(nameof(CharUnknownLow),
- Environment.GetResourceString("ArgumentOutOfRange_Range",
- 0xDC00, 0xDFFF));
+ SR.Format(SR.ArgumentOutOfRange_Range, 0xDC00, 0xDFFF));
}
Contract.EndContractBlock();
diff --git a/src/mscorlib/src/System/Text/EncoderFallback.cs b/src/mscorlib/src/System/Text/EncoderFallback.cs
index 2d1ee52c59..410b6f5016 100644
--- a/src/mscorlib/src/System/Text/EncoderFallback.cs
+++ b/src/mscorlib/src/System/Text/EncoderFallback.cs
@@ -224,8 +224,7 @@ namespace System.Text
{
// Throw it, using our complete character
throw new ArgumentException(
- Environment.GetResourceString("Argument_RecursiveFallback",
- charRecursive), "chars");
+ SR.Format(SR.Argument_RecursiveFallback, charRecursive), "chars");
}
}
}
diff --git a/src/mscorlib/src/System/Text/EncoderNLS.cs b/src/mscorlib/src/System/Text/EncoderNLS.cs
index 2ba909701c..99a26ca575 100644
--- a/src/mscorlib/src/System/Text/EncoderNLS.cs
+++ b/src/mscorlib/src/System/Text/EncoderNLS.cs
@@ -41,7 +41,7 @@ namespace System.Text
throw new NotSupportedException(
String.Format(
System.Globalization.CultureInfo.CurrentCulture,
- Environment.GetResourceString("NotSupported_TypeCannotDeserialized"), this.GetType()));
+ SR.NotSupported_TypeCannotDeserialized, this.GetType()));
}
// ISerializable implementation. called during serialization.
@@ -81,15 +81,15 @@ namespace System.Text
// Validate input parameters
if (chars == null)
throw new ArgumentNullException(nameof(chars),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (index < 0 || count < 0)
throw new ArgumentOutOfRangeException((index < 0 ? nameof(index) : nameof(count)),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
if (chars.Length - index < count)
throw new ArgumentOutOfRangeException(nameof(chars),
- Environment.GetResourceString("ArgumentOutOfRange_IndexCountBuffer"));
+ SR.ArgumentOutOfRange_IndexCountBuffer);
Contract.EndContractBlock();
// Avoid empty input problem
@@ -110,11 +110,11 @@ namespace System.Text
// Validate input parameters
if (chars == null)
throw new ArgumentNullException(nameof(chars),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (count < 0)
throw new ArgumentOutOfRangeException(nameof(count),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
this.m_mustFlush = flush;
@@ -128,19 +128,19 @@ namespace System.Text
// Validate parameters
if (chars == null || bytes == null)
throw new ArgumentNullException((chars == null ? nameof(chars) : nameof(bytes)),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (charIndex < 0 || charCount < 0)
throw new ArgumentOutOfRangeException((charIndex < 0 ? nameof(charIndex) : nameof(charCount)),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
if (chars.Length - charIndex < charCount)
throw new ArgumentOutOfRangeException(nameof(chars),
- Environment.GetResourceString("ArgumentOutOfRange_IndexCountBuffer"));
+ SR.ArgumentOutOfRange_IndexCountBuffer);
if (byteIndex < 0 || byteIndex > bytes.Length)
throw new ArgumentOutOfRangeException(nameof(byteIndex),
- Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ SR.ArgumentOutOfRange_Index);
Contract.EndContractBlock();
if (chars.Length == 0)
@@ -164,11 +164,11 @@ namespace System.Text
// Validate parameters
if (chars == null || bytes == null)
throw new ArgumentNullException((chars == null ? nameof(chars) : nameof(bytes)),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (byteCount < 0 || charCount < 0)
throw new ArgumentOutOfRangeException((byteCount < 0 ? nameof(byteCount) : nameof(charCount)),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
this.m_mustFlush = flush;
@@ -185,23 +185,23 @@ namespace System.Text
// Validate parameters
if (chars == null || bytes == null)
throw new ArgumentNullException((chars == null ? nameof(chars) : nameof(bytes)),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (charIndex < 0 || charCount < 0)
throw new ArgumentOutOfRangeException((charIndex < 0 ? nameof(charIndex) : nameof(charCount)),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
if (byteIndex < 0 || byteCount < 0)
throw new ArgumentOutOfRangeException((byteIndex < 0 ? nameof(byteIndex) : nameof(byteCount)),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
if (chars.Length - charIndex < charCount)
throw new ArgumentOutOfRangeException(nameof(chars),
- Environment.GetResourceString("ArgumentOutOfRange_IndexCountBuffer"));
+ SR.ArgumentOutOfRange_IndexCountBuffer);
if (bytes.Length - byteIndex < byteCount)
throw new ArgumentOutOfRangeException(nameof(bytes),
- Environment.GetResourceString("ArgumentOutOfRange_IndexCountBuffer"));
+ SR.ArgumentOutOfRange_IndexCountBuffer);
Contract.EndContractBlock();
@@ -231,10 +231,10 @@ namespace System.Text
// Validate input parameters
if (bytes == null || chars == null)
throw new ArgumentNullException(bytes == null ? nameof(bytes) : nameof(chars),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (charCount < 0 || byteCount < 0)
throw new ArgumentOutOfRangeException((charCount < 0 ? nameof(charCount) : nameof(byteCount)),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// We don't want to throw
diff --git a/src/mscorlib/src/System/Text/EncoderReplacementFallback.cs b/src/mscorlib/src/System/Text/EncoderReplacementFallback.cs
index 0b8abb33a5..65b807c1bd 100644
--- a/src/mscorlib/src/System/Text/EncoderReplacementFallback.cs
+++ b/src/mscorlib/src/System/Text/EncoderReplacementFallback.cs
@@ -61,7 +61,7 @@ namespace System.Text
break;
}
if (bFoundHigh)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidCharSequenceNoIndex", nameof(replacement)));
+ throw new ArgumentException(SR.Format(SR.Argument_InvalidCharSequenceNoIndex, nameof(replacement)));
strDefault = replacement;
}
@@ -149,13 +149,11 @@ namespace System.Text
// Double check input surrogate pair
if (!Char.IsHighSurrogate(charUnknownHigh))
throw new ArgumentOutOfRangeException(nameof(charUnknownHigh),
- Environment.GetResourceString("ArgumentOutOfRange_Range",
- 0xD800, 0xDBFF));
+ SR.Format(SR.ArgumentOutOfRange_Range, 0xD800, 0xDBFF));
if (!Char.IsLowSurrogate(charUnknownLow))
throw new ArgumentOutOfRangeException(nameof(charUnknownLow),
- Environment.GetResourceString("ArgumentOutOfRange_Range",
- 0xDC00, 0xDFFF));
+ SR.Format(SR.ArgumentOutOfRange_Range, 0xDC00, 0xDFFF));
Contract.EndContractBlock();
// If we had a buffer already we're being recursive, throw, it's probably at the suspect
diff --git a/src/mscorlib/src/System/Text/Encoding.cs b/src/mscorlib/src/System/Text/Encoding.cs
index 09ec958f49..a4fdc792a7 100644
--- a/src/mscorlib/src/System/Text/Encoding.cs
+++ b/src/mscorlib/src/System/Text/Encoding.cs
@@ -362,12 +362,12 @@ namespace System.Text
if (srcEncoding == null || dstEncoding == null)
{
throw new ArgumentNullException((srcEncoding == null ? nameof(srcEncoding) : nameof(dstEncoding)),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
}
if (bytes == null)
{
throw new ArgumentNullException(nameof(bytes),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
}
Contract.Ensures(Contract.Result<byte[]>() != null);
@@ -397,8 +397,7 @@ namespace System.Text
if (codepage < 0 || codepage > 65535)
{
throw new ArgumentOutOfRangeException(
- nameof(codepage), Environment.GetResourceString("ArgumentOutOfRange_Range",
- 0, 65535));
+ nameof(codepage), SR.Format(SR.ArgumentOutOfRange_Range, 0, 65535));
}
Contract.EndContractBlock();
@@ -423,15 +422,14 @@ namespace System.Text
case CodePageNoMac: // 2 CP_MACCP
case CodePageNoThread: // 3 CP_THREAD_ACP
case CodePageNoSymbol: // 42 CP_SYMBOL
- throw new ArgumentException(Environment.GetResourceString(
- "Argument_CodepageNotSupported", codepage), nameof(codepage));
+ throw new ArgumentException(SR.Format(SR.Argument_CodepageNotSupported, codepage), nameof(codepage));
}
// Is it a valid code page?
if (EncodingTable.GetCodePageDataItem(codepage) == null)
{
throw new NotSupportedException(
- Environment.GetResourceString("NotSupported_NoCodepageData", codepage));
+ SR.Format(SR.NotSupported_NoCodepageData, codepage));
}
return UTF8;
@@ -514,7 +512,7 @@ namespace System.Text
if (dataItem == null)
{
throw new NotSupportedException(
- Environment.GetResourceString("NotSupported_NoCodepageData", m_codePage));
+ SR.Format(SR.NotSupported_NoCodepageData, m_codePage));
}
}
}
@@ -540,7 +538,7 @@ namespace System.Text
{
get
{
- return Environment.GetResourceString("Globalization.cp_" + m_codePage.ToString());
+ return SR.GetResourceString("Globalization_cp_" + m_codePage.ToString());
}
}
@@ -668,7 +666,7 @@ namespace System.Text
set
{
if (this.IsReadOnly)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
+ throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
if (value == null)
throw new ArgumentNullException(nameof(value));
@@ -689,7 +687,7 @@ namespace System.Text
set
{
if (this.IsReadOnly)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ReadOnly"));
+ throw new InvalidOperationException(SR.InvalidOperation_ReadOnly);
if (value == null)
throw new ArgumentNullException(nameof(value));
@@ -739,7 +737,7 @@ namespace System.Text
if (chars == null)
{
throw new ArgumentNullException(nameof(chars),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
}
Contract.EndContractBlock();
@@ -770,16 +768,16 @@ namespace System.Text
{
if (s == null)
throw new ArgumentNullException(nameof(s),
- Environment.GetResourceString("ArgumentNull_String"));
+ SR.ArgumentNull_String);
if (index < 0)
throw new ArgumentOutOfRangeException(nameof(index),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
if (count < 0)
throw new ArgumentOutOfRangeException(nameof(count),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
if (index > s.Length - count)
throw new ArgumentOutOfRangeException(nameof(index),
- Environment.GetResourceString("ArgumentOutOfRange_IndexCount"));
+ SR.ArgumentOutOfRange_IndexCount);
Contract.EndContractBlock();
unsafe
@@ -802,11 +800,11 @@ namespace System.Text
// Validate input parameters
if (chars == null)
throw new ArgumentNullException(nameof(chars),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (count < 0)
throw new ArgumentOutOfRangeException(nameof(count),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
char[] arrChar = new char[count];
@@ -837,7 +835,7 @@ namespace System.Text
if (chars == null)
{
throw new ArgumentNullException(nameof(chars),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
}
Contract.EndContractBlock();
return GetBytes(chars, 0, chars.Length);
@@ -874,7 +872,7 @@ namespace System.Text
{
if (s == null)
throw new ArgumentNullException(nameof(s),
- Environment.GetResourceString("ArgumentNull_String"));
+ SR.ArgumentNull_String);
Contract.EndContractBlock();
int byteCount = GetByteCount(s);
@@ -892,16 +890,16 @@ namespace System.Text
{
if (s == null)
throw new ArgumentNullException(nameof(s),
- Environment.GetResourceString("ArgumentNull_String"));
+ SR.ArgumentNull_String);
if (index < 0)
throw new ArgumentOutOfRangeException(nameof(index),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
if (count < 0)
throw new ArgumentOutOfRangeException(nameof(count),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
if (index > s.Length - count)
throw new ArgumentOutOfRangeException(nameof(index),
- Environment.GetResourceString("ArgumentOutOfRange_IndexCount"));
+ SR.ArgumentOutOfRange_IndexCount);
Contract.EndContractBlock();
unsafe
@@ -964,11 +962,11 @@ namespace System.Text
// Validate input parameters
if (bytes == null || chars == null)
throw new ArgumentNullException(bytes == null ? nameof(bytes) : nameof(chars),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (charCount < 0 || byteCount < 0)
throw new ArgumentOutOfRangeException((charCount < 0 ? nameof(charCount) : nameof(byteCount)),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// Get the char array to convert
@@ -1010,7 +1008,7 @@ namespace System.Text
if (bytes == null)
{
throw new ArgumentNullException(nameof(bytes),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
}
Contract.EndContractBlock();
return GetCharCount(bytes, 0, bytes.Length);
@@ -1031,11 +1029,11 @@ namespace System.Text
// Validate input parameters
if (bytes == null)
throw new ArgumentNullException(nameof(bytes),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (count < 0)
throw new ArgumentOutOfRangeException(nameof(count),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
byte[] arrbyte = new byte[count];
@@ -1063,7 +1061,7 @@ namespace System.Text
if (bytes == null)
{
throw new ArgumentNullException(nameof(bytes),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
}
Contract.EndContractBlock();
return GetChars(bytes, 0, bytes.Length);
@@ -1118,11 +1116,11 @@ namespace System.Text
// Validate input parameters
if (chars == null || bytes == null)
throw new ArgumentNullException(chars == null ? nameof(chars) : nameof(bytes),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
if (byteCount < 0 || charCount < 0)
throw new ArgumentOutOfRangeException((byteCount < 0 ? nameof(byteCount) : nameof(charCount)),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// Get the byte array to convert
@@ -1169,10 +1167,10 @@ namespace System.Text
public unsafe string GetString(byte* bytes, int byteCount)
{
if (bytes == null)
- throw new ArgumentNullException(nameof(bytes), Environment.GetResourceString("ArgumentNull_Array"));
+ throw new ArgumentNullException(nameof(bytes), SR.ArgumentNull_Array);
if (byteCount < 0)
- throw new ArgumentOutOfRangeException(nameof(byteCount), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(byteCount), SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
return String.CreateStringFromEncoding(bytes, byteCount, this);
@@ -1297,7 +1295,7 @@ namespace System.Text
{
if (bytes == null)
throw new ArgumentNullException(nameof(bytes),
- Environment.GetResourceString("ArgumentNull_Array"));
+ SR.ArgumentNull_Array);
Contract.EndContractBlock();
return GetString(bytes, 0, bytes.Length);
@@ -1385,8 +1383,7 @@ namespace System.Text
// Special message to include fallback type in case fallback's GetMaxCharCount is broken
// This happens if user has implimented an encoder fallback with a broken GetMaxCharCount
throw new ArgumentException(
- Environment.GetResourceString("Argument_EncodingConversionOverflowBytes",
- EncodingName, EncoderFallback.GetType()), "bytes");
+ SR.Format(SR.Argument_EncodingConversionOverflowBytes, EncodingName, EncoderFallback.GetType()), "bytes");
}
internal void ThrowBytesOverflow(EncoderNLS encoder, bool nothingEncoded)
@@ -1409,8 +1406,7 @@ namespace System.Text
// Special message to include fallback type in case fallback's GetMaxCharCount is broken
// This happens if user has implimented a decoder fallback with a broken GetMaxCharCount
throw new ArgumentException(
- Environment.GetResourceString("Argument_EncodingConversionOverflowChars",
- EncodingName, DecoderFallback.GetType()), "chars");
+ SR.Format(SR.Argument_EncodingConversionOverflowChars, EncodingName, DecoderFallback.GetType()), "chars");
}
internal void ThrowCharsOverflow(DecoderNLS decoder, bool nothingDecoded)
@@ -1430,7 +1426,7 @@ namespace System.Text
}
[Serializable]
- internal class DefaultEncoder : Encoder, IObjectReference, ISerializable
+ internal sealed class DefaultEncoder : Encoder, IObjectReference, ISerializable
{
private Encoding m_encoding;
[NonSerialized] private bool m_hasInitializedEncoding;
@@ -1552,7 +1548,7 @@ namespace System.Text
}
[Serializable]
- internal class DefaultDecoder : Decoder, IObjectReference, ISerializable
+ internal sealed class DefaultDecoder : Decoder, IObjectReference, ISerializable
{
private Encoding m_encoding;
[NonSerialized]
@@ -1847,8 +1843,7 @@ namespace System.Text
// If we're not converting we must not have data in our fallback buffer
if (encoder.m_throwOnOverflow && encoder.InternalHasFallbackBuffer &&
this.fallbackBuffer.Remaining > 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EncoderFallbackNotEmpty",
- encoder.Encoding.EncodingName, encoder.Fallback.GetType()));
+ throw new ArgumentException(SR.Format(SR.Argument_EncoderFallbackNotEmpty, encoder.Encoding.EncodingName, encoder.Fallback.GetType()));
}
fallbackBuffer.InternalInitialize(chars, charEnd, encoder, bytes != null);
}
diff --git a/src/mscorlib/src/System/Text/EncodingForwarder.cs b/src/mscorlib/src/System/Text/EncodingForwarder.cs
index 1198045689..db7dda3991 100644
--- a/src/mscorlib/src/System/Text/EncodingForwarder.cs
+++ b/src/mscorlib/src/System/Text/EncodingForwarder.cs
@@ -39,15 +39,15 @@ namespace System.Text
Debug.Assert(encoding != null); // this parameter should only be affected internally, so just do a debug check here
if (chars == null)
{
- throw new ArgumentNullException(nameof(chars), Environment.GetResourceString("ArgumentNull_Array"));
+ throw new ArgumentNullException(nameof(chars), SR.ArgumentNull_Array);
}
if (index < 0 || count < 0)
{
- throw new ArgumentOutOfRangeException(index < 0 ? nameof(index) : nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(index < 0 ? nameof(index) : nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (chars.Length - index < count)
{
- throw new ArgumentOutOfRangeException(nameof(chars), Environment.GetResourceString("ArgumentOutOfRange_IndexCountBuffer"));
+ throw new ArgumentOutOfRangeException(nameof(chars), SR.ArgumentOutOfRange_IndexCountBuffer);
}
Contract.EndContractBlock();
@@ -88,11 +88,11 @@ namespace System.Text
Debug.Assert(encoding != null);
if (chars == null)
{
- throw new ArgumentNullException(nameof(chars), Environment.GetResourceString("ArgumentNull_Array"));
+ throw new ArgumentNullException(nameof(chars), SR.ArgumentNull_Array);
}
if (count < 0)
{
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
}
Contract.EndContractBlock();
@@ -106,21 +106,21 @@ namespace System.Text
if (s == null || bytes == null)
{
string stringName = encoding is ASCIIEncoding ? "chars" : nameof(s); // ASCIIEncoding calls the first parameter chars
- throw new ArgumentNullException(s == null ? stringName : nameof(bytes), Environment.GetResourceString("ArgumentNull_Array"));
+ throw new ArgumentNullException(s == null ? stringName : nameof(bytes), SR.ArgumentNull_Array);
}
if (charIndex < 0 || charCount < 0)
{
- throw new ArgumentOutOfRangeException(charIndex < 0 ? nameof(charIndex) : nameof(charCount), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(charIndex < 0 ? nameof(charIndex) : nameof(charCount), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (s.Length - charIndex < charCount)
{
string stringName = encoding is ASCIIEncoding ? "chars" : nameof(s); // ASCIIEncoding calls the first parameter chars
// Duplicate the above check since we don't want the overhead of a type check on the general path
- throw new ArgumentOutOfRangeException(stringName, Environment.GetResourceString("ArgumentOutOfRange_IndexCount"));
+ throw new ArgumentOutOfRangeException(stringName, SR.ArgumentOutOfRange_IndexCount);
}
if (byteIndex < 0 || byteIndex > bytes.Length)
{
- throw new ArgumentOutOfRangeException(nameof(byteIndex), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(byteIndex), SR.ArgumentOutOfRange_Index);
}
Contract.EndContractBlock();
@@ -141,19 +141,19 @@ namespace System.Text
Debug.Assert(encoding != null);
if (chars == null || bytes == null)
{
- throw new ArgumentNullException(chars == null ? nameof(chars) : nameof(bytes), Environment.GetResourceString("ArgumentNull_Array"));
+ throw new ArgumentNullException(chars == null ? nameof(chars) : nameof(bytes), SR.ArgumentNull_Array);
}
if (charIndex < 0 || charCount < 0)
{
- throw new ArgumentOutOfRangeException(charIndex < 0 ? nameof(charIndex) : nameof(charCount), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(charIndex < 0 ? nameof(charIndex) : nameof(charCount), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (chars.Length - charIndex < charCount)
{
- throw new ArgumentOutOfRangeException(nameof(chars), Environment.GetResourceString("ArgumentOutOfRange_IndexCountBuffer"));
+ throw new ArgumentOutOfRangeException(nameof(chars), SR.ArgumentOutOfRange_IndexCountBuffer);
}
if (byteIndex < 0 || byteIndex > bytes.Length)
{
- throw new ArgumentOutOfRangeException(nameof(byteIndex), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(byteIndex), SR.ArgumentOutOfRange_Index);
}
Contract.EndContractBlock();
@@ -181,11 +181,11 @@ namespace System.Text
Debug.Assert(encoding != null);
if (bytes == null || chars == null)
{
- throw new ArgumentNullException(bytes == null ? nameof(bytes) : nameof(chars), Environment.GetResourceString("ArgumentNull_Array"));
+ throw new ArgumentNullException(bytes == null ? nameof(bytes) : nameof(chars), SR.ArgumentNull_Array);
}
if (charCount < 0 || byteCount < 0)
{
- throw new ArgumentOutOfRangeException(charCount < 0 ? nameof(charCount) : nameof(byteCount), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(charCount < 0 ? nameof(charCount) : nameof(byteCount), SR.ArgumentOutOfRange_NeedNonNegNum);
}
Contract.EndContractBlock();
@@ -197,15 +197,15 @@ namespace System.Text
Debug.Assert(encoding != null);
if (bytes == null)
{
- throw new ArgumentNullException(nameof(bytes), Environment.GetResourceString("ArgumentNull_Array"));
+ throw new ArgumentNullException(nameof(bytes), SR.ArgumentNull_Array);
}
if (index < 0 || count < 0)
{
- throw new ArgumentOutOfRangeException(index < 0 ? nameof(index) : nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(index < 0 ? nameof(index) : nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (bytes.Length - index < count)
{
- throw new ArgumentOutOfRangeException(nameof(bytes), Environment.GetResourceString("ArgumentOutOfRange_IndexCountBuffer"));
+ throw new ArgumentOutOfRangeException(nameof(bytes), SR.ArgumentOutOfRange_IndexCountBuffer);
}
Contract.EndContractBlock();
@@ -223,11 +223,11 @@ namespace System.Text
Debug.Assert(encoding != null);
if (bytes == null)
{
- throw new ArgumentNullException(nameof(bytes), Environment.GetResourceString("ArgumentNull_Array"));
+ throw new ArgumentNullException(nameof(bytes), SR.ArgumentNull_Array);
}
if (count < 0)
{
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
}
Contract.EndContractBlock();
@@ -239,19 +239,19 @@ namespace System.Text
Debug.Assert(encoding != null);
if (bytes == null || chars == null)
{
- throw new ArgumentNullException(bytes == null ? nameof(bytes) : nameof(chars), Environment.GetResourceString("ArgumentNull_Array"));
+ throw new ArgumentNullException(bytes == null ? nameof(bytes) : nameof(chars), SR.ArgumentNull_Array);
}
if (byteIndex < 0 || byteCount < 0)
{
- throw new ArgumentOutOfRangeException(byteIndex < 0 ? nameof(byteIndex) : nameof(byteCount), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(byteIndex < 0 ? nameof(byteIndex) : nameof(byteCount), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (bytes.Length - byteIndex < byteCount)
{
- throw new ArgumentOutOfRangeException(nameof(bytes), Environment.GetResourceString("ArgumentOutOfRange_IndexCountBuffer"));
+ throw new ArgumentOutOfRangeException(nameof(bytes), SR.ArgumentOutOfRange_IndexCountBuffer);
}
if (charIndex < 0 || charIndex > chars.Length)
{
- throw new ArgumentOutOfRangeException(nameof(charIndex), Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(charIndex), SR.ArgumentOutOfRange_Index);
}
Contract.EndContractBlock();
@@ -277,11 +277,11 @@ namespace System.Text
Debug.Assert(encoding != null);
if (bytes == null || chars == null)
{
- throw new ArgumentNullException(bytes == null ? nameof(bytes) : nameof(chars), Environment.GetResourceString("ArgumentNull_Array"));
+ throw new ArgumentNullException(bytes == null ? nameof(bytes) : nameof(chars), SR.ArgumentNull_Array);
}
if (charCount < 0 || byteCount < 0)
{
- throw new ArgumentOutOfRangeException(charCount < 0 ? nameof(charCount) : nameof(byteCount), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(charCount < 0 ? nameof(charCount) : nameof(byteCount), SR.ArgumentOutOfRange_NeedNonNegNum);
}
Contract.EndContractBlock();
@@ -293,7 +293,7 @@ namespace System.Text
Debug.Assert(encoding != null);
if (bytes == null)
{
- throw new ArgumentNullException(nameof(bytes), Environment.GetResourceString("ArgumentNull_Array"));
+ throw new ArgumentNullException(nameof(bytes), SR.ArgumentNull_Array);
}
if (index < 0 || count < 0)
{
@@ -301,11 +301,11 @@ namespace System.Text
bool ascii = encoding is ASCIIEncoding;
string indexName = ascii ? "byteIndex" : nameof(index);
string countName = ascii ? "byteCount" : nameof(count);
- throw new ArgumentOutOfRangeException(index < 0 ? indexName : countName, Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(index < 0 ? indexName : countName, SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (bytes.Length - index < count)
{
- throw new ArgumentOutOfRangeException(nameof(bytes), Environment.GetResourceString("ArgumentOutOfRange_IndexCountBuffer"));
+ throw new ArgumentOutOfRangeException(nameof(bytes), SR.ArgumentOutOfRange_IndexCountBuffer);
}
Contract.EndContractBlock();
diff --git a/src/mscorlib/src/System/Text/Latin1Encoding.cs b/src/mscorlib/src/System/Text/Latin1Encoding.cs
index 7742f7cc52..e456b8533d 100644
--- a/src/mscorlib/src/System/Text/Latin1Encoding.cs
+++ b/src/mscorlib/src/System/Text/Latin1Encoding.cs
@@ -452,7 +452,7 @@ namespace System.Text
{
if (charCount < 0)
throw new ArgumentOutOfRangeException(nameof(charCount),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// Characters would be # of characters + 1 in case high surrogate is ? * max fallback
@@ -464,7 +464,7 @@ namespace System.Text
// 1 to 1 for most characters. Only surrogates with fallbacks have less.
if (byteCount > 0x7fffffff)
- throw new ArgumentOutOfRangeException(nameof(charCount), Environment.GetResourceString("ArgumentOutOfRange_GetByteCountOverflow"));
+ throw new ArgumentOutOfRangeException(nameof(charCount), SR.ArgumentOutOfRange_GetByteCountOverflow);
return (int)byteCount;
}
@@ -472,7 +472,7 @@ namespace System.Text
{
if (byteCount < 0)
throw new ArgumentOutOfRangeException(nameof(byteCount),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// Just return length, SBCS stay the same length because they don't map to surrogate
@@ -483,7 +483,7 @@ namespace System.Text
charCount *= DecoderFallback.MaxCharCount;
if (charCount > 0x7fffffff)
- throw new ArgumentOutOfRangeException(nameof(byteCount), Environment.GetResourceString("ArgumentOutOfRange_GetCharCountOverflow"));
+ throw new ArgumentOutOfRangeException(nameof(byteCount), SR.ArgumentOutOfRange_GetCharCountOverflow);
return (int)charCount;
}
diff --git a/src/mscorlib/src/System/Text/Normalization.Unix.cs b/src/mscorlib/src/System/Text/Normalization.Unix.cs
index d49bdc6c21..2a10d062f2 100644
--- a/src/mscorlib/src/System/Text/Normalization.Unix.cs
+++ b/src/mscorlib/src/System/Text/Normalization.Unix.cs
@@ -4,6 +4,7 @@
using System.Security;
using System.Text;
+using System.Globalization;
namespace System.Text
{
@@ -13,11 +14,18 @@ namespace System.Text
{
ValidateArguments(strInput, normalizationForm);
+ if (GlobalizationMode.Invariant)
+ {
+ // In Invariant mode we assume all characters are normalized.
+ // This is because we don't support any linguistic operation on the strings
+ return true;
+ }
+
int ret = Interop.GlobalizationInterop.IsNormalized(normalizationForm, strInput, strInput.Length);
if (ret == -1)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidCharSequenceNoIndex"), nameof(strInput));
+ throw new ArgumentException(SR.Argument_InvalidCharSequenceNoIndex, nameof(strInput));
}
return ret == 1;
@@ -27,6 +35,13 @@ namespace System.Text
{
ValidateArguments(strInput, normalizationForm);
+ if (GlobalizationMode.Invariant)
+ {
+ // In Invariant mode we assume all characters are normalized.
+ // This is because we don't support any linguistic operation on the strings
+ return strInput;
+ }
+
char[] buf = new char[strInput.Length];
for (int attempts = 2; attempts > 0; attempts--)
@@ -35,7 +50,7 @@ namespace System.Text
if (realLen == -1)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidCharSequenceNoIndex"), nameof(strInput));
+ throw new ArgumentException(SR.Argument_InvalidCharSequenceNoIndex, nameof(strInput));
}
if (realLen <= buf.Length)
@@ -46,7 +61,7 @@ namespace System.Text
buf = new char[realLen];
}
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidCharSequenceNoIndex"), nameof(strInput));
+ throw new ArgumentException(SR.Argument_InvalidCharSequenceNoIndex, nameof(strInput));
}
// -----------------------------
@@ -63,12 +78,12 @@ namespace System.Text
if (normalizationForm != NormalizationForm.FormC && normalizationForm != NormalizationForm.FormD &&
normalizationForm != NormalizationForm.FormKC && normalizationForm != NormalizationForm.FormKD)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidNormalizationForm"), nameof(normalizationForm));
+ throw new ArgumentException(SR.Argument_InvalidNormalizationForm, nameof(normalizationForm));
}
if (HasInvalidUnicodeSequence(strInput))
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidCharSequenceNoIndex"), nameof(strInput));
+ throw new ArgumentException(SR.Argument_InvalidCharSequenceNoIndex, nameof(strInput));
}
}
diff --git a/src/mscorlib/src/System/Text/Normalization.Windows.cs b/src/mscorlib/src/System/Text/Normalization.Windows.cs
index 1e08817943..389dba743d 100644
--- a/src/mscorlib/src/System/Text/Normalization.Windows.cs
+++ b/src/mscorlib/src/System/Text/Normalization.Windows.cs
@@ -20,6 +20,13 @@ namespace System.Text
{
internal static bool IsNormalized(String strInput, NormalizationForm normForm)
{
+ if (GlobalizationMode.Invariant)
+ {
+ // In Invariant mode we assume all characters are normalized.
+ // This is because we don't support any linguistic operation on the strings
+ return true;
+ }
+
Debug.Assert(strInput != null);
// The only way to know if IsNormalizedString failed is through checking the Win32 last error
@@ -38,7 +45,7 @@ namespace System.Text
throw new ArgumentException(SR.Argument_InvalidCharSequenceNoIndex, nameof(strInput));
case Interop.Errors.ERROR_NOT_ENOUGH_MEMORY:
- throw new OutOfMemoryException(SR.Arg_OutOfMemoryException);
+ throw new OutOfMemoryException();
default:
throw new InvalidOperationException(SR.Format(SR.UnknownError_Num, lastError));
@@ -49,6 +56,13 @@ namespace System.Text
internal static String Normalize(String strInput, NormalizationForm normForm)
{
+ if (GlobalizationMode.Invariant)
+ {
+ // In Invariant mode we assume all characters are normalized.
+ // This is because we don't support any linguistic operation on the strings
+ return strInput;
+ }
+
Debug.Assert(strInput != null);
// we depend on Win32 last error when calling NormalizeString
@@ -69,7 +83,7 @@ namespace System.Text
// a trivial math function...
// Can't really be Out of Memory, but just in case:
if (lastError == Interop.Errors.ERROR_NOT_ENOUGH_MEMORY)
- throw new OutOfMemoryException(SR.Arg_OutOfMemoryException);
+ throw new OutOfMemoryException();
// Who knows what happened? Not us!
throw new InvalidOperationException(SR.Format(SR.UnknownError_Num, lastError));
@@ -109,7 +123,7 @@ namespace System.Text
throw new ArgumentException(SR.Argument_InvalidCharSequenceNoIndex, nameof(strInput));
case Interop.Errors.ERROR_NOT_ENOUGH_MEMORY:
- throw new OutOfMemoryException(SR.Arg_OutOfMemoryException);
+ throw new OutOfMemoryException();
default:
// We shouldn't get here...
diff --git a/src/mscorlib/src/System/Text/StringBuilder.CoreCLR.cs b/src/mscorlib/src/System/Text/StringBuilder.CoreCLR.cs
new file mode 100644
index 0000000000..db3895f161
--- /dev/null
+++ b/src/mscorlib/src/System/Text/StringBuilder.CoreCLR.cs
@@ -0,0 +1,48 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Runtime.CompilerServices;
+
+namespace System.Text
+{
+ public partial class StringBuilder
+ {
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal unsafe extern void ReplaceBufferInternal(char* newBuffer, int newLength);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal unsafe extern void ReplaceBufferAnsiInternal(sbyte* newBuffer, int newLength);
+
+ // Copies the source StringBuilder to the destination IntPtr memory allocated with len bytes.
+ internal unsafe void InternalCopy(IntPtr dest, int len)
+ {
+ if (len == 0)
+ return;
+
+ bool isLastChunk = true;
+ byte* dstPtr = (byte*)dest.ToPointer();
+ StringBuilder currentSrc = FindChunkForByte(len);
+
+ do
+ {
+ int chunkOffsetInBytes = currentSrc.m_ChunkOffset * sizeof(char);
+ int chunkLengthInBytes = currentSrc.m_ChunkLength * sizeof(char);
+ fixed (char* charPtr = &currentSrc.m_ChunkChars[0])
+ {
+ byte* srcPtr = (byte*)charPtr;
+ if (isLastChunk)
+ {
+ isLastChunk = false;
+ Buffer.Memcpy(dstPtr + chunkOffsetInBytes, srcPtr, len - chunkOffsetInBytes);
+ }
+ else
+ {
+ Buffer.Memcpy(dstPtr + chunkOffsetInBytes, srcPtr, chunkLengthInBytes);
+ }
+ }
+ currentSrc = currentSrc.m_ChunkPrevious;
+ } while (currentSrc != null);
+ }
+ }
+}
diff --git a/src/mscorlib/src/System/Text/UTF32Encoding.cs b/src/mscorlib/src/System/Text/UTF32Encoding.cs
index d74653cdd5..37defe38ba 100644
--- a/src/mscorlib/src/System/Text/UTF32Encoding.cs
+++ b/src/mscorlib/src/System/Text/UTF32Encoding.cs
@@ -202,8 +202,7 @@ namespace System.Text
// We mustn't have left over fallback data when counting
if (fallbackBuffer.Remaining > 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EncoderFallbackNotEmpty",
- this.EncodingName, encoder.Fallback.GetType()));
+ throw new ArgumentException(SR.Format(SR.Argument_EncoderFallbackNotEmpty, this.EncodingName, encoder.Fallback.GetType()));
}
else
{
@@ -301,8 +300,7 @@ namespace System.Text
// Check for overflows.
if (byteCount < 0)
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString(
- "ArgumentOutOfRange_GetByteCountOverflow"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_GetByteCountOverflow);
// Shouldn't have anything in fallback buffer for GetByteCount
// (don't have to check m_throwOnOverflow for count)
@@ -339,8 +337,7 @@ namespace System.Text
// We mustn't have left over fallback data when not converting
if (encoder.m_throwOnOverflow && fallbackBuffer.Remaining > 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EncoderFallbackNotEmpty",
- this.EncodingName, encoder.Fallback.GetType()));
+ throw new ArgumentException(SR.Format(SR.Argument_EncoderFallbackNotEmpty, this.EncodingName, encoder.Fallback.GetType()));
}
else
{
@@ -647,7 +644,7 @@ namespace System.Text
// Check for overflows.
if (charCount < 0)
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_GetByteCountOverflow"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_GetByteCountOverflow);
// Shouldn't have anything in fallback buffer for GetCharCount
// (don't have to check m_throwOnOverflow for chars or count)
@@ -907,7 +904,7 @@ namespace System.Text
{
if (charCount < 0)
throw new ArgumentOutOfRangeException(nameof(charCount),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// Characters would be # of characters + 1 in case left over high surrogate is ? * max fallback
@@ -920,7 +917,7 @@ namespace System.Text
byteCount *= 4;
if (byteCount > 0x7fffffff)
- throw new ArgumentOutOfRangeException(nameof(charCount), Environment.GetResourceString("ArgumentOutOfRange_GetByteCountOverflow"));
+ throw new ArgumentOutOfRangeException(nameof(charCount), SR.ArgumentOutOfRange_GetByteCountOverflow);
return (int)byteCount;
}
@@ -930,7 +927,7 @@ namespace System.Text
{
if (byteCount < 0)
throw new ArgumentOutOfRangeException(nameof(byteCount),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// A supplementary character becomes 2 surrogate characters, so 4 input bytes becomes 2 chars,
@@ -950,7 +947,7 @@ namespace System.Text
}
if (charCount > 0x7fffffff)
- throw new ArgumentOutOfRangeException(nameof(byteCount), Environment.GetResourceString("ArgumentOutOfRange_GetCharCountOverflow"));
+ throw new ArgumentOutOfRangeException(nameof(byteCount), SR.ArgumentOutOfRange_GetCharCountOverflow);
return (int)charCount;
}
@@ -998,7 +995,7 @@ namespace System.Text
}
[Serializable]
- internal class UTF32Decoder : DecoderNLS
+ private sealed class UTF32Decoder : DecoderNLS
{
// Need a place to store any extra bytes we may have picked up
internal int iChar = 0;
diff --git a/src/mscorlib/src/System/Text/UTF7Encoding.cs b/src/mscorlib/src/System/Text/UTF7Encoding.cs
index d0cf9961c2..3a470a9479 100644
--- a/src/mscorlib/src/System/Text/UTF7Encoding.cs
+++ b/src/mscorlib/src/System/Text/UTF7Encoding.cs
@@ -581,7 +581,7 @@ namespace System.Text
{
if (charCount < 0)
throw new ArgumentOutOfRangeException(nameof(charCount),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// Suppose that every char can not be direct-encoded, we know that
@@ -604,7 +604,7 @@ namespace System.Text
// check for overflow
if (byteCount > 0x7fffffff)
- throw new ArgumentOutOfRangeException(nameof(charCount), Environment.GetResourceString("ArgumentOutOfRange_GetByteCountOverflow"));
+ throw new ArgumentOutOfRangeException(nameof(charCount), SR.ArgumentOutOfRange_GetByteCountOverflow);
return (int)byteCount;
}
@@ -614,7 +614,7 @@ namespace System.Text
{
if (byteCount < 0)
throw new ArgumentOutOfRangeException(nameof(byteCount),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// Worst case is 1 char per byte. Minimum 1 for left over bits in case decoder is being flushed
@@ -628,7 +628,7 @@ namespace System.Text
[Serializable]
// Of all the amazing things... This MUST be Decoder so that our com name
// for System.Text.Decoder doesn't change
- private class Decoder : DecoderNLS, ISerializable
+ private sealed class Decoder : DecoderNLS, ISerializable
{
/*private*/
internal int bits;
@@ -694,7 +694,7 @@ namespace System.Text
[Serializable]
// Of all the amazing things... This MUST be Encoder so that our com name
// for System.Text.Encoder doesn't change
- private class Encoder : EncoderNLS, ISerializable
+ private sealed class Encoder : EncoderNLS, ISerializable
{
/*private*/
internal int bits;
@@ -753,7 +753,7 @@ namespace System.Text
// Preexisting UTF7 behavior for bad bytes was just to spit out the byte as the next char
// and turn off base64 mode if it was in that mode. We still exit the mode, but now we fallback.
[Serializable]
- internal sealed class DecoderUTF7Fallback : DecoderFallback
+ private sealed class DecoderUTF7Fallback : DecoderFallback
{
// Construction. Default replacement fallback uses no best fit and ? replacement string
public DecoderUTF7Fallback()
@@ -791,7 +791,7 @@ namespace System.Text
}
}
- internal sealed class DecoderUTF7FallbackBuffer : DecoderFallbackBuffer
+ private sealed class DecoderUTF7FallbackBuffer : DecoderFallbackBuffer
{
// Store our default string
private char cFallback = (char)0;
@@ -869,7 +869,7 @@ namespace System.Text
Debug.Assert(iCount < 0, "[DecoderUTF7FallbackBuffer.InternalFallback] Can't have recursive fallbacks");
if (bytes.Length != 1)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidCharSequenceNoIndex"));
+ throw new ArgumentException(SR.Argument_InvalidCharSequenceNoIndex);
}
// Can't fallback a byte 0, so return for that case, 1 otherwise.
diff --git a/src/mscorlib/src/System/Text/UTF8Encoding.cs b/src/mscorlib/src/System/Text/UTF8Encoding.cs
index bfc8d2b8a7..997aa90729 100644
--- a/src/mscorlib/src/System/Text/UTF8Encoding.cs
+++ b/src/mscorlib/src/System/Text/UTF8Encoding.cs
@@ -231,8 +231,7 @@ namespace System.Text
{
fallbackBuffer = encoder.FallbackBuffer;
if (fallbackBuffer.Remaining > 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EncoderFallbackNotEmpty",
- this.EncodingName, encoder.Fallback.GetType()));
+ throw new ArgumentException(SR.Format(SR.Argument_EncoderFallbackNotEmpty, this.EncodingName, encoder.Fallback.GetType()));
// Set our internal fallback interesting things.
fallbackBuffer.InternalInitialize(chars, pEnd, encoder, false);
@@ -582,7 +581,7 @@ namespace System.Text
if (byteCount < 0)
{
throw new ArgumentException(
- Environment.GetResourceString("Argument_ConversionOverflow"));
+ SR.Argument_ConversionOverflow);
}
#endif
@@ -649,8 +648,7 @@ namespace System.Text
// We always need the fallback buffer in get bytes so we can flush any remaining ones if necessary
fallbackBuffer = encoder.FallbackBuffer;
if (fallbackBuffer.Remaining > 0 && encoder.m_throwOnOverflow)
- throw new ArgumentException(Environment.GetResourceString("Argument_EncoderFallbackNotEmpty",
- this.EncodingName, encoder.Fallback.GetType()));
+ throw new ArgumentException(SR.Format(SR.Argument_EncoderFallbackNotEmpty, this.EncodingName, encoder.Fallback.GetType()));
// Set our internal fallback interesting things.
fallbackBuffer.InternalInitialize(chars, pEnd, encoder, true);
@@ -2237,7 +2235,7 @@ namespace System.Text
{
if (charCount < 0)
throw new ArgumentOutOfRangeException(nameof(charCount),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// Characters would be # of characters + 1 in case left over high surrogate is ? * max fallback
@@ -2250,7 +2248,7 @@ namespace System.Text
byteCount *= 3;
if (byteCount > 0x7fffffff)
- throw new ArgumentOutOfRangeException(nameof(charCount), Environment.GetResourceString("ArgumentOutOfRange_GetByteCountOverflow"));
+ throw new ArgumentOutOfRangeException(nameof(charCount), SR.ArgumentOutOfRange_GetByteCountOverflow);
return (int)byteCount;
}
@@ -2260,7 +2258,7 @@ namespace System.Text
{
if (byteCount < 0)
throw new ArgumentOutOfRangeException(nameof(byteCount),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// Figure out our length, 1 char per input byte + 1 char if 1st byte is last byte of 4 byte surrogate pair
@@ -2274,7 +2272,7 @@ namespace System.Text
}
if (charCount > 0x7fffffff)
- throw new ArgumentOutOfRangeException(nameof(byteCount), Environment.GetResourceString("ArgumentOutOfRange_GetCharCountOverflow"));
+ throw new ArgumentOutOfRangeException(nameof(byteCount), SR.ArgumentOutOfRange_GetCharCountOverflow);
return (int)charCount;
}
@@ -2314,7 +2312,7 @@ namespace System.Text
}
[Serializable]
- internal class UTF8Encoder : EncoderNLS, ISerializable
+ private sealed class UTF8Encoder : EncoderNLS, ISerializable
{
// We must save a high surrogate value until the next call, looking
// for a low surrogate value.
@@ -2386,7 +2384,7 @@ namespace System.Text
}
[Serializable]
- internal class UTF8Decoder : DecoderNLS, ISerializable
+ private sealed class UTF8Decoder : DecoderNLS, ISerializable
{
// We'll need to remember the previous information. See the comments around definition
// of FinalByte for details.
diff --git a/src/mscorlib/src/System/Text/UnicodeEncoding.cs b/src/mscorlib/src/System/Text/UnicodeEncoding.cs
index b15bced5b9..07de4c8f81 100644
--- a/src/mscorlib/src/System/Text/UnicodeEncoding.cs
+++ b/src/mscorlib/src/System/Text/UnicodeEncoding.cs
@@ -189,7 +189,7 @@ namespace System.Text
// (If they were all invalid chars, this would actually be wrong,
// but that's a ridiculously large # so we're not concerned about that case)
if (byteCount < 0)
- throw new ArgumentOutOfRangeException(nameof(count), Environment.GetResourceString("ArgumentOutOfRange_GetByteCountOverflow"));
+ throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_GetByteCountOverflow);
char* charStart = chars;
char* charEnd = chars + count;
@@ -219,8 +219,7 @@ namespace System.Text
{
fallbackBuffer = encoder.FallbackBuffer;
if (fallbackBuffer.Remaining > 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EncoderFallbackNotEmpty",
- this.EncodingName, encoder.Fallback.GetType()));
+ throw new ArgumentException(SR.Format(SR.Argument_EncoderFallbackNotEmpty, this.EncodingName, encoder.Fallback.GetType()));
// Set our internal fallback interesting things.
fallbackBuffer.InternalInitialize(charStart, charEnd, encoder, false);
@@ -443,8 +442,7 @@ namespace System.Text
{
// Throw it, using our complete character
throw new ArgumentException(
- Environment.GetResourceString("Argument_RecursiveFallback",
- charLeftOver), nameof(chars));
+ SR.Format(SR.Argument_RecursiveFallback, charLeftOver), nameof(chars));
}
else
{
@@ -511,8 +509,7 @@ namespace System.Text
// We always need the fallback buffer in get bytes so we can flush any remaining ones if necessary
fallbackBuffer = encoder.FallbackBuffer;
if (fallbackBuffer.Remaining > 0 && encoder.m_throwOnOverflow)
- throw new ArgumentException(Environment.GetResourceString("Argument_EncoderFallbackNotEmpty",
- this.EncodingName, encoder.Fallback.GetType()));
+ throw new ArgumentException(SR.Format(SR.Argument_EncoderFallbackNotEmpty, this.EncodingName, encoder.Fallback.GetType()));
// Set our internal fallback interesting things.
fallbackBuffer.InternalInitialize(charStart, charEnd, encoder, false);
@@ -853,8 +850,7 @@ namespace System.Text
{
// Throw it, using our complete character
throw new ArgumentException(
- Environment.GetResourceString("Argument_RecursiveFallback",
- charLeftOver), nameof(chars));
+ SR.Format(SR.Argument_RecursiveFallback, charLeftOver), nameof(chars));
}
else
{
@@ -1712,7 +1708,7 @@ namespace System.Text
{
if (charCount < 0)
throw new ArgumentOutOfRangeException(nameof(charCount),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// Characters would be # of characters + 1 in case left over high surrogate is ? * max fallback
@@ -1725,7 +1721,7 @@ namespace System.Text
byteCount <<= 1;
if (byteCount > 0x7fffffff)
- throw new ArgumentOutOfRangeException(nameof(charCount), Environment.GetResourceString("ArgumentOutOfRange_GetByteCountOverflow"));
+ throw new ArgumentOutOfRangeException(nameof(charCount), SR.ArgumentOutOfRange_GetByteCountOverflow);
return (int)byteCount;
}
@@ -1735,7 +1731,7 @@ namespace System.Text
{
if (byteCount < 0)
throw new ArgumentOutOfRangeException(nameof(byteCount),
- Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
// long because byteCount could be biggest int.
@@ -1749,7 +1745,7 @@ namespace System.Text
charCount *= DecoderFallback.MaxCharCount;
if (charCount > 0x7fffffff)
- throw new ArgumentOutOfRangeException(nameof(byteCount), Environment.GetResourceString("ArgumentOutOfRange_GetCharCountOverflow"));
+ throw new ArgumentOutOfRangeException(nameof(byteCount), SR.ArgumentOutOfRange_GetCharCountOverflow);
return (int)charCount;
}
@@ -1781,7 +1777,7 @@ namespace System.Text
}
[Serializable]
- private class Decoder : System.Text.DecoderNLS, ISerializable
+ private sealed class Decoder : System.Text.DecoderNLS, ISerializable
{
internal int lastByte = -1;
internal char lastChar = '\0';
diff --git a/src/mscorlib/src/System/Threading/AbandonedMutexException.cs b/src/mscorlib/src/System/Threading/AbandonedMutexException.cs
index b39cb208b8..bbc1a676bf 100644
--- a/src/mscorlib/src/System/Threading/AbandonedMutexException.cs
+++ b/src/mscorlib/src/System/Threading/AbandonedMutexException.cs
@@ -25,7 +25,7 @@ namespace System.Threading
private Mutex m_Mutex = null;
public AbandonedMutexException()
- : base(Environment.GetResourceString("Threading.AbandonedMutexException"))
+ : base(SR.Threading_AbandonedMutexException)
{
SetErrorCode(__HResults.COR_E_ABANDONEDMUTEX);
}
@@ -43,7 +43,7 @@ namespace System.Threading
}
public AbandonedMutexException(int location, WaitHandle handle)
- : base(Environment.GetResourceString("Threading.AbandonedMutexException"))
+ : base(SR.Threading_AbandonedMutexException)
{
SetErrorCode(__HResults.COR_E_ABANDONEDMUTEX);
SetupException(location, handle);
diff --git a/src/mscorlib/src/System/Threading/CancellationToken.cs b/src/mscorlib/src/System/Threading/CancellationToken.cs
index 4d8212044c..8bddfc90dd 100644
--- a/src/mscorlib/src/System/Threading/CancellationToken.cs
+++ b/src/mscorlib/src/System/Threading/CancellationToken.cs
@@ -469,12 +469,12 @@ namespace System.Threading
// Throws an OCE; separated out to enable better inlining of ThrowIfCancellationRequested
private void ThrowOperationCanceledException()
{
- throw new OperationCanceledException(Environment.GetResourceString("OperationCanceled"), this);
+ throw new OperationCanceledException(SR.OperationCanceled, this);
}
private static void ThrowObjectDisposedException()
{
- throw new ObjectDisposedException(null, Environment.GetResourceString("CancellationToken_SourceDisposed"));
+ throw new ObjectDisposedException(null, SR.CancellationToken_SourceDisposed);
}
// -----------------------------------
diff --git a/src/mscorlib/src/System/Threading/CancellationTokenSource.cs b/src/mscorlib/src/System/Threading/CancellationTokenSource.cs
index eef3a15644..2707292ed2 100644
--- a/src/mscorlib/src/System/Threading/CancellationTokenSource.cs
+++ b/src/mscorlib/src/System/Threading/CancellationTokenSource.cs
@@ -600,7 +600,7 @@ namespace System.Threading
// separation enables inlining of ThrowIfDisposed
private static void ThrowObjectDisposedException()
{
- throw new ObjectDisposedException(null, Environment.GetResourceString("CancellationTokenSource_Disposed"));
+ throw new ObjectDisposedException(null, SR.CancellationTokenSource_Disposed);
}
/// <summary>
@@ -820,7 +820,7 @@ namespace System.Threading
{
m_state = NOTIFYINGCOMPLETE;
m_executingCallback = null;
- Thread.MemoryBarrier(); // for safety, prevent reorderings crossing this point and seeing inconsistent state.
+ Interlocked.MemoryBarrier(); // for safety, prevent reorderings crossing this point and seeing inconsistent state.
}
if (exceptionList != null)
@@ -891,7 +891,7 @@ namespace System.Threading
switch (tokens.Length)
{
case 0:
- throw new ArgumentException(Environment.GetResourceString("CancellationToken_CreateLinkedToken_TokensIsEmpty"));
+ throw new ArgumentException(SR.CancellationToken_CreateLinkedToken_TokensIsEmpty);
case 1:
return CreateLinkedTokenSource(tokens[0]);
case 2:
diff --git a/src/mscorlib/src/System/Threading/CountdownEvent.cs b/src/mscorlib/src/System/Threading/CountdownEvent.cs
deleted file mode 100644
index 8a36a84dc3..0000000000
--- a/src/mscorlib/src/System/Threading/CountdownEvent.cs
+++ /dev/null
@@ -1,588 +0,0 @@
-// 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.
-
-// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
-//
-//
-//
-// A simple coordination data structure that we use for fork/join style parallelism.
-//
-// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-
-using System;
-using System.Runtime.InteropServices;
-using System.Threading;
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
-
-namespace System.Threading
-{
- /// <summary>
- /// Represents a synchronization primitive that is signaled when its count reaches zero.
- /// </summary>
- /// <remarks>
- /// All public and protected members of <see cref="CountdownEvent"/> are thread-safe and may be used
- /// concurrently from multiple threads, with the exception of Dispose, which
- /// must only be used when all other operations on the <see cref="CountdownEvent"/> have
- /// completed, and Reset, which should only be used when no other threads are
- /// accessing the event.
- /// </remarks>
- [DebuggerDisplay("Initial Count={InitialCount}, Current Count={CurrentCount}")]
- public class CountdownEvent : IDisposable
- {
- // CountdownEvent is a simple synchronization primitive used for fork/join parallelism. We create a
- // latch with a count of N; threads then signal the latch, which decrements N by 1; other threads can
- // wait on the latch at any point; when the latch count reaches 0, all threads are woken and
- // subsequent waiters return without waiting. The implementation internally lazily creates a true
- // Win32 event as needed. We also use some amount of spinning on MP machines before falling back to a
- // wait.
-
- private int m_initialCount; // The original # of signals the latch was instantiated with.
- private volatile int m_currentCount; // The # of outstanding signals before the latch transitions to a signaled state.
- private ManualResetEventSlim m_event; // An event used to manage blocking and signaling.
- private volatile bool m_disposed; // Whether the latch has been disposed.
-
- /// <summary>
- /// Initializes a new instance of <see cref="T:System.Threading.CountdownEvent"/> class with the
- /// specified count.
- /// </summary>
- /// <param name="initialCount">The number of signals required to set the <see
- /// cref="T:System.Threading.CountdownEvent"/>.</param>
- /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="initialCount"/> is less
- /// than 0.</exception>
- public CountdownEvent(int initialCount)
- {
- if (initialCount < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(initialCount));
- }
-
- m_initialCount = initialCount;
- m_currentCount = initialCount;
-
- // Allocate a thin event, which internally defers creation of an actual Win32 event.
- m_event = new ManualResetEventSlim();
-
- // If the latch was created with a count of 0, then it's already in the signaled state.
- if (initialCount == 0)
- {
- m_event.Set();
- }
- }
-
- /// <summary>
- /// Gets the number of remaining signals required to set the event.
- /// </summary>
- /// <value>
- /// The number of remaining signals required to set the event.
- /// </value>
- public int CurrentCount
- {
- get
- {
- int observedCount = m_currentCount;
- return observedCount < 0 ? 0 : observedCount;
- }
- }
-
- /// <summary>
- /// Gets the numbers of signals initially required to set the event.
- /// </summary>
- /// <value>
- /// The number of signals initially required to set the event.
- /// </value>
- public int InitialCount
- {
- get { return m_initialCount; }
- }
-
- /// <summary>
- /// Determines whether the event is set.
- /// </summary>
- /// <value>true if the event is set; otherwise, false.</value>
- public bool IsSet
- {
- get
- {
- // The latch is "completed" if its current count has reached 0. Note that this is NOT
- // the same thing is checking the event's IsCompleted property. There is a tiny window
- // of time, after the final decrement of the current count to 0 and before setting the
- // event, where the two values are out of sync.
- return (m_currentCount <= 0);
- }
- }
-
- /// <summary>
- /// Gets a <see cref="T:System.Threading.WaitHandle"/> that is used to wait for the event to be set.
- /// </summary>
- /// <value>A <see cref="T:System.Threading.WaitHandle"/> that is used to wait for the event to be set.</value>
- /// <exception cref="T:System.ObjectDisposedException">The current instance has already been disposed.</exception>
- /// <remarks>
- /// <see cref="WaitHandle"/> should only be used if it's needed for integration with code bases
- /// that rely on having a WaitHandle. If all that's needed is to wait for the <see cref="CountdownEvent"/>
- /// to be set, the <see cref="Wait()"/> method should be preferred.
- /// </remarks>
- public WaitHandle WaitHandle
- {
- get
- {
- ThrowIfDisposed();
- return m_event.WaitHandle;
- }
- }
-
- /// <summary>
- /// Releases all resources used by the current instance of <see cref="T:System.Threading.CountdownEvent"/>.
- /// </summary>
- /// <remarks>
- /// Unlike most of the members of <see cref="CountdownEvent"/>, <see cref="Dispose()"/> is not
- /// thread-safe and may not be used concurrently with other members of this instance.
- /// </remarks>
- public void Dispose()
- {
- // Gets rid of this latch's associated resources. This can consist of a Win32 event
- // which is (lazily) allocated by the underlying thin event. This method is not safe to
- // call concurrently -- i.e. a caller must coordinate to ensure only one thread is using
- // the latch at the time of the call to Dispose.
-
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- /// <summary>
- /// When overridden in a derived class, releases the unmanaged resources used by the
- /// <see cref="T:System.Threading.CountdownEvent"/>, and optionally releases the managed resources.
- /// </summary>
- /// <param name="disposing">true to release both managed and unmanaged resources; false to release
- /// only unmanaged resources.</param>
- /// <remarks>
- /// Unlike most of the members of <see cref="CountdownEvent"/>, <see cref="Dispose()"/> is not
- /// thread-safe and may not be used concurrently with other members of this instance.
- /// </remarks>
- protected virtual void Dispose(bool disposing)
- {
- if (disposing)
- {
- m_event.Dispose();
- m_disposed = true;
- }
- }
-
- /// <summary>
- /// Registers a signal with the <see cref="T:System.Threading.CountdownEvent"/>, decrementing its
- /// count.
- /// </summary>
- /// <returns>true if the signal caused the count to reach zero and the event was set; otherwise,
- /// false.</returns>
- /// <exception cref="T:System.InvalidOperationException">The current instance is already set.
- /// </exception>
- /// <exception cref="T:System.ObjectDisposedException">The current instance has already been
- /// disposed.</exception>
- public bool Signal()
- {
- ThrowIfDisposed();
- Debug.Assert(m_event != null);
-
- if (m_currentCount <= 0)
- {
- throw new InvalidOperationException(Environment.GetResourceString("CountdownEvent_Decrement_BelowZero"));
- }
-#pragma warning disable 0420
- int newCount = Interlocked.Decrement(ref m_currentCount);
-#pragma warning restore 0420
- if (newCount == 0)
- {
- m_event.Set();
- return true;
- }
- else if (newCount < 0)
- {
- //if the count is decremented below zero, then throw, it's OK to keep the count negative, and we shouldn't set the event here
- //because there was a thread already which decremented it to zero and set the event
- throw new InvalidOperationException(Environment.GetResourceString("CountdownEvent_Decrement_BelowZero"));
- }
-
- return false;
- }
-
- /// <summary>
- /// Registers multiple signals with the <see cref="T:System.Threading.CountdownEvent"/>,
- /// decrementing its count by the specified amount.
- /// </summary>
- /// <param name="signalCount">The number of signals to register.</param>
- /// <returns>true if the signals caused the count to reach zero and the event was set; otherwise,
- /// false.</returns>
- /// <exception cref="T:System.InvalidOperationException">
- /// The current instance is already set. -or- Or <paramref name="signalCount"/> is greater than <see
- /// cref="CurrentCount"/>.
- /// </exception>
- /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="signalCount"/> is less
- /// than 1.</exception>
- /// <exception cref="T:System.ObjectDisposedException">The current instance has already been
- /// disposed.</exception>
- public bool Signal(int signalCount)
- {
- if (signalCount <= 0)
- {
- throw new ArgumentOutOfRangeException(nameof(signalCount));
- }
-
- ThrowIfDisposed();
- Debug.Assert(m_event != null);
-
- int observedCount;
- SpinWait spin = new SpinWait();
- while (true)
- {
- observedCount = m_currentCount;
-
- // If the latch is already signaled, we will fail.
- if (observedCount < signalCount)
- {
- throw new InvalidOperationException(Environment.GetResourceString("CountdownEvent_Decrement_BelowZero"));
- }
-
- // This disables the "CS0420: a reference to a volatile field will not be treated as volatile" warning
- // for this statement. This warning is clearly senseless for Interlocked operations.
-#pragma warning disable 0420
- if (Interlocked.CompareExchange(ref m_currentCount, observedCount - signalCount, observedCount) == observedCount)
-#pragma warning restore 0420
- {
- break;
- }
-
- // The CAS failed. Spin briefly and try again.
- spin.SpinOnce();
- }
-
- // If we were the last to signal, set the event.
- if (observedCount == signalCount)
- {
- m_event.Set();
- return true;
- }
-
- Debug.Assert(m_currentCount >= 0, "latch was decremented below zero");
- return false;
- }
-
- /// <summary>
- /// Increments the <see cref="T:System.Threading.CountdownEvent"/>'s current count by one.
- /// </summary>
- /// <exception cref="T:System.InvalidOperationException">The current instance is already
- /// set.</exception>
- /// <exception cref="T:System.InvalidOperationException"><see cref="CurrentCount"/> is equal to <see
- /// cref="T:System.Int32.MaxValue"/>.</exception>
- /// <exception cref="T:System.ObjectDisposedException">
- /// The current instance has already been disposed.
- /// </exception>
- public void AddCount()
- {
- AddCount(1);
- }
-
- /// <summary>
- /// Attempts to increment the <see cref="T:System.Threading.CountdownEvent"/>'s current count by one.
- /// </summary>
- /// <returns>true if the increment succeeded; otherwise, false. If <see cref="CurrentCount"/> is
- /// already at zero. this will return false.</returns>
- /// <exception cref="T:System.InvalidOperationException"><see cref="CurrentCount"/> is equal to <see
- /// cref="T:System.Int32.MaxValue"/>.</exception>
- /// <exception cref="T:System.ObjectDisposedException">The current instance has already been
- /// disposed.</exception>
- public bool TryAddCount()
- {
- return TryAddCount(1);
- }
-
- /// <summary>
- /// Increments the <see cref="T:System.Threading.CountdownEvent"/>'s current count by a specified
- /// value.
- /// </summary>
- /// <param name="signalCount">The value by which to increase <see cref="CurrentCount"/>.</param>
- /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="signalCount"/> is less than
- /// 0.</exception>
- /// <exception cref="T:System.InvalidOperationException">The current instance is already
- /// set.</exception>
- /// <exception cref="T:System.InvalidOperationException"><see cref="CurrentCount"/> is equal to <see
- /// cref="T:System.Int32.MaxValue"/>.</exception>
- /// <exception cref="T:System.ObjectDisposedException">The current instance has already been
- /// disposed.</exception>
- public void AddCount(int signalCount)
- {
- if (!TryAddCount(signalCount))
- {
- throw new InvalidOperationException(Environment.GetResourceString("CountdownEvent_Increment_AlreadyZero"));
- }
- }
-
- /// <summary>
- /// Attempts to increment the <see cref="T:System.Threading.CountdownEvent"/>'s current count by a
- /// specified value.
- /// </summary>
- /// <param name="signalCount">The value by which to increase <see cref="CurrentCount"/>.</param>
- /// <returns>true if the increment succeeded; otherwise, false. If <see cref="CurrentCount"/> is
- /// already at zero this will return false.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="signalCount"/> is less
- /// than 0.</exception>
- /// <exception cref="T:System.InvalidOperationException">The current instance is already
- /// set.</exception>
- /// <exception cref="T:System.InvalidOperationException"><see cref="CurrentCount"/> is equal to <see
- /// cref="T:System.Int32.MaxValue"/>.</exception>
- /// <exception cref="T:System.ObjectDisposedException">The current instance has already been
- /// disposed.</exception>
- public bool TryAddCount(int signalCount)
- {
- if (signalCount <= 0)
- {
- throw new ArgumentOutOfRangeException(nameof(signalCount));
- }
-
- ThrowIfDisposed();
-
- // Loop around until we successfully increment the count.
- int observedCount;
- SpinWait spin = new SpinWait();
- while (true)
- {
- observedCount = m_currentCount;
-
- if (observedCount <= 0)
- {
- return false;
- }
- else if (observedCount > (Int32.MaxValue - signalCount))
- {
- throw new InvalidOperationException(Environment.GetResourceString("CountdownEvent_Increment_AlreadyMax"));
- }
-
- // This disables the "CS0420: a reference to a volatile field will not be treated as volatile" warning
- // for this statement. This warning is clearly senseless for Interlocked operations.
-#pragma warning disable 0420
- if (Interlocked.CompareExchange(ref m_currentCount, observedCount + signalCount, observedCount) == observedCount)
-#pragma warning restore 0420
- {
- break;
- }
-
- // The CAS failed. Spin briefly and try again.
- spin.SpinOnce();
- }
-
- return true;
- }
-
- /// <summary>
- /// Resets the <see cref="CurrentCount"/> to the value of <see cref="InitialCount"/>.
- /// </summary>
- /// <remarks>
- /// Unlike most of the members of <see cref="CountdownEvent"/>, Reset is not
- /// thread-safe and may not be used concurrently with other members of this instance.
- /// </remarks>
- /// <exception cref="T:System.ObjectDisposedException">The current instance has already been
- /// disposed..</exception>
- public void Reset()
- {
- Reset(m_initialCount);
- }
-
- /// <summary>
- /// Resets the <see cref="CurrentCount"/> to a specified value.
- /// </summary>
- /// <param name="count">The number of signals required to set the <see
- /// cref="T:System.Threading.CountdownEvent"/>.</param>
- /// <remarks>
- /// Unlike most of the members of <see cref="CountdownEvent"/>, Reset is not
- /// thread-safe and may not be used concurrently with other members of this instance.
- /// </remarks>
- /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="count"/> is
- /// less than 0.</exception>
- /// <exception cref="T:System.ObjectDisposedException">The current instance has alread been disposed.</exception>
- public void Reset(int count)
- {
- ThrowIfDisposed();
-
- if (count < 0)
- {
- throw new ArgumentOutOfRangeException(nameof(count));
- }
-
- m_currentCount = count;
- m_initialCount = count;
-
- if (count == 0)
- {
- m_event.Set();
- }
- else
- {
- m_event.Reset();
- }
- }
-
- /// <summary>
- /// Blocks the current thread until the <see cref="T:System.Threading.CountdownEvent"/> is set.
- /// </summary>
- /// <remarks>
- /// The caller of this method blocks indefinitely until the current instance is set. The caller will
- /// return immediately if the event is currently in a set state.
- /// </remarks>
- /// <exception cref="T:System.ObjectDisposedException">The current instance has already been
- /// disposed.</exception>
- public void Wait()
- {
- Wait(Timeout.Infinite, new CancellationToken());
- }
-
-
- /// <summary>
- /// Blocks the current thread until the <see cref="T:System.Threading.CountdownEvent"/> is set, while
- /// observing a <see cref="T:System.Threading.CancellationToken"/>.
- /// </summary>
- /// <param name="cancellationToken">The <see cref="T:System.Threading.CancellationToken"/> to
- /// observe.</param>
- /// <remarks>
- /// The caller of this method blocks indefinitely until the current instance is set. The caller will
- /// return immediately if the event is currently in a set state. If the
- /// <see cref="T:System.Threading.CancellationToken">CancellationToken</see> being observed
- /// is canceled during the wait operation, an <see cref="T:System.OperationCanceledException"/>
- /// will be thrown.
- /// </remarks>
- /// <exception cref="T:System.OperationCanceledException"><paramref name="cancellationToken"/> has been
- /// canceled.</exception>
- /// <exception cref="T:System.ObjectDisposedException">The current instance has already been
- /// disposed.</exception>
- public void Wait(CancellationToken cancellationToken)
- {
- Wait(Timeout.Infinite, cancellationToken);
- }
-
- /// <summary>
- /// Blocks the current thread until the <see cref="T:System.Threading.CountdownEvent"/> is set, using a
- /// <see cref="T:System.TimeSpan"/> to measure the time interval.
- /// </summary>
- /// <param name="timeout">A <see cref="T:System.TimeSpan"/> that represents the number of
- /// milliseconds to wait, or a <see cref="T:System.TimeSpan"/> that represents -1 milliseconds to
- /// wait indefinitely.</param>
- /// <returns>true if the <see cref="System.Threading.CountdownEvent"/> was set; otherwise,
- /// false.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="timeout"/> is a negative
- /// number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater
- /// than <see cref="System.Int32.MaxValue"/>.</exception>
- /// <exception cref="T:System.ObjectDisposedException">The current instance has already been
- /// disposed.</exception>
- public bool Wait(TimeSpan timeout)
- {
- long totalMilliseconds = (long)timeout.TotalMilliseconds;
- if (totalMilliseconds < -1 || totalMilliseconds > int.MaxValue)
- {
- throw new ArgumentOutOfRangeException(nameof(timeout));
- }
-
- return Wait((int)totalMilliseconds, new CancellationToken());
- }
-
- /// <summary>
- /// Blocks the current thread until the <see cref="T:System.Threading.CountdownEvent"/> is set, using
- /// a <see cref="T:System.TimeSpan"/> to measure the time interval, while observing a
- /// <see cref="T:System.Threading.CancellationToken"/>.
- /// </summary>
- /// <param name="timeout">A <see cref="T:System.TimeSpan"/> that represents the number of
- /// milliseconds to wait, or a <see cref="T:System.TimeSpan"/> that represents -1 milliseconds to
- /// wait indefinitely.</param>
- /// <param name="cancellationToken">The <see cref="T:System.Threading.CancellationToken"/> to
- /// observe.</param>
- /// <returns>true if the <see cref="System.Threading.CountdownEvent"/> was set; otherwise,
- /// false.</returns>
- /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="timeout"/> is a negative
- /// number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater
- /// than <see cref="System.Int32.MaxValue"/>.</exception>
- /// <exception cref="T:System.ObjectDisposedException">The current instance has already been
- /// disposed.</exception>
- /// <exception cref="T:System.OperationCanceledException"><paramref name="cancellationToken"/> has
- /// been canceled.</exception>
- public bool Wait(TimeSpan timeout, CancellationToken cancellationToken)
- {
- long totalMilliseconds = (long)timeout.TotalMilliseconds;
- if (totalMilliseconds < -1 || totalMilliseconds > int.MaxValue)
- {
- throw new ArgumentOutOfRangeException(nameof(timeout));
- }
-
- return Wait((int)totalMilliseconds, cancellationToken);
- }
-
- /// <summary>
- /// Blocks the current thread until the <see cref="T:System.Threading.CountdownEvent"/> is set, using a
- /// 32-bit signed integer to measure the time interval.
- /// </summary>
- /// <param name="millisecondsTimeout">The number of milliseconds to wait, or <see
- /// cref="Timeout.Infinite"/>(-1) to wait indefinitely.</param>
- /// <returns>true if the <see cref="System.Threading.CountdownEvent"/> was set; otherwise,
- /// false.</returns>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="millisecondsTimeout"/> is a
- /// negative number other than -1, which represents an infinite time-out.</exception>
- /// <exception cref="T:System.ObjectDisposedException">The current instance has already been
- /// disposed.</exception>
- public bool Wait(int millisecondsTimeout)
- {
- return Wait(millisecondsTimeout, new CancellationToken());
- }
-
- /// <summary>
- /// Blocks the current thread until the <see cref="T:System.Threading.CountdownEvent"/> is set, using a
- /// 32-bit signed integer to measure the time interval, while observing a
- /// <see cref="T:System.Threading.CancellationToken"/>.
- /// </summary>
- /// <param name="millisecondsTimeout">The number of milliseconds to wait, or <see
- /// cref="Timeout.Infinite"/>(-1) to wait indefinitely.</param>
- /// <param name="cancellationToken">The <see cref="T:System.Threading.CancellationToken"/> to
- /// observe.</param>
- /// <returns>true if the <see cref="System.Threading.CountdownEvent"/> was set; otherwise,
- /// false.</returns>
- /// <exception cref="ArgumentOutOfRangeException"><paramref name="millisecondsTimeout"/> is a
- /// negative number other than -1, which represents an infinite time-out.</exception>
- /// <exception cref="T:System.ObjectDisposedException">The current instance has already been
- /// disposed.</exception>
- /// <exception cref="T:System.OperationCanceledException"><paramref name="cancellationToken"/> has
- /// been canceled.</exception>
- public bool Wait(int millisecondsTimeout, CancellationToken cancellationToken)
- {
- if (millisecondsTimeout < -1)
- {
- throw new ArgumentOutOfRangeException(nameof(millisecondsTimeout));
- }
-
- ThrowIfDisposed();
- cancellationToken.ThrowIfCancellationRequested();
-
- bool returnValue = IsSet;
-
- // If not completed yet, wait on the event.
- if (!returnValue)
- {
- // ** the actual wait
- returnValue = m_event.Wait(millisecondsTimeout, cancellationToken);
- //the Wait will throw OCE itself if the token is canceled.
- }
-
- return returnValue;
- }
-
- // --------------------------------------
- // Private methods
-
-
- /// <summary>
- /// Throws an exception if the latch has been disposed.
- /// </summary>
- private void ThrowIfDisposed()
- {
- if (m_disposed)
- {
- throw new ObjectDisposedException("CountdownEvent");
- }
- }
- }
-}
diff --git a/src/mscorlib/src/System/Threading/EventWaitHandle.cs b/src/mscorlib/src/System/Threading/EventWaitHandle.cs
index 034c4b0ee6..611d9de7e7 100644
--- a/src/mscorlib/src/System/Threading/EventWaitHandle.cs
+++ b/src/mscorlib/src/System/Threading/EventWaitHandle.cs
@@ -46,11 +46,11 @@ namespace System.Threading
if (name != null)
{
#if PLATFORM_UNIX
- throw new PlatformNotSupportedException(Environment.GetResourceString("PlatformNotSupported_NamedSynchronizationPrimitives"));
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_NamedSynchronizationPrimitives);
#else
if (System.IO.Path.MaxPath < name.Length)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_WaitHandleNameTooLong", Path.MaxPath), nameof(name));
+ throw new ArgumentException(SR.Format(SR.Argument_WaitHandleNameTooLong, Path.MaxPath), nameof(name));
}
#endif
}
@@ -67,7 +67,7 @@ namespace System.Threading
break;
default:
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidFlag", name));
+ throw new ArgumentException(SR.Format(SR.Argument_InvalidFlag, name));
};
if (_handle.IsInvalid)
@@ -76,7 +76,7 @@ namespace System.Threading
_handle.SetHandleAsInvalid();
if (null != name && 0 != name.Length && Win32Native.ERROR_INVALID_HANDLE == errorCode)
- throw new WaitHandleCannotBeOpenedException(Environment.GetResourceString("Threading.WaitHandleCannotBeOpenedException_InvalidHandle", name));
+ throw new WaitHandleCannotBeOpenedException(SR.Format(SR.Threading_WaitHandleCannotBeOpenedException_InvalidHandle, name));
__Error.WinIOError(errorCode, name);
}
@@ -93,11 +93,11 @@ namespace System.Threading
if (name != null)
{
#if PLATFORM_UNIX
- throw new PlatformNotSupportedException(Environment.GetResourceString("PlatformNotSupported_NamedSynchronizationPrimitives"));
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_NamedSynchronizationPrimitives);
#else
if (System.IO.Path.MaxPath < name.Length)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_WaitHandleNameTooLong", Path.MaxPath), nameof(name));
+ throw new ArgumentException(SR.Format(SR.Argument_WaitHandleNameTooLong, Path.MaxPath), nameof(name));
}
#endif
}
@@ -116,7 +116,7 @@ namespace System.Threading
break;
default:
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidFlag", name));
+ throw new ArgumentException(SR.Format(SR.Argument_InvalidFlag, name));
};
_handle = Win32Native.CreateEvent(secAttrs, isManualReset, initialState, name);
@@ -126,7 +126,7 @@ namespace System.Threading
{
_handle.SetHandleAsInvalid();
if (null != name && 0 != name.Length && Win32Native.ERROR_INVALID_HANDLE == errorCode)
- throw new WaitHandleCannotBeOpenedException(Environment.GetResourceString("Threading.WaitHandleCannotBeOpenedException_InvalidHandle", name));
+ throw new WaitHandleCannotBeOpenedException(SR.Format(SR.Threading_WaitHandleCannotBeOpenedException_InvalidHandle, name));
__Error.WinIOError(errorCode, name);
}
@@ -153,7 +153,7 @@ namespace System.Threading
throw new WaitHandleCannotBeOpenedException();
case OpenExistingResult.NameInvalid:
- throw new WaitHandleCannotBeOpenedException(Environment.GetResourceString("Threading.WaitHandleCannotBeOpenedException_InvalidHandle", name));
+ throw new WaitHandleCannotBeOpenedException(SR.Format(SR.Threading_WaitHandleCannotBeOpenedException_InvalidHandle, name));
case OpenExistingResult.PathNotFound:
__Error.WinIOError(Win32Native.ERROR_PATH_NOT_FOUND, "");
@@ -172,21 +172,21 @@ namespace System.Threading
private static OpenExistingResult OpenExistingWorker(string name, EventWaitHandleRights rights, out EventWaitHandle result)
{
#if PLATFORM_UNIX
- throw new PlatformNotSupportedException(Environment.GetResourceString("PlatformNotSupported_NamedSynchronizationPrimitives"));
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_NamedSynchronizationPrimitives);
#else
if (name == null)
{
- throw new ArgumentNullException(nameof(name), Environment.GetResourceString("ArgumentNull_WithParamName"));
+ throw new ArgumentNullException(nameof(name), SR.ArgumentNull_WithParamName);
}
if (name.Length == 0)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(name));
+ throw new ArgumentException(SR.Argument_EmptyName, nameof(name));
}
if (null != name && System.IO.Path.MaxPath < name.Length)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_WaitHandleNameTooLong", Path.MaxPath), nameof(name));
+ throw new ArgumentException(SR.Format(SR.Argument_WaitHandleNameTooLong, Path.MaxPath), nameof(name));
}
Contract.EndContractBlock();
diff --git a/src/mscorlib/src/System/Threading/ExecutionContext.cs b/src/mscorlib/src/System/Threading/ExecutionContext.cs
index 1e9e9b4ef1..ec125ad8d2 100644
--- a/src/mscorlib/src/System/Threading/ExecutionContext.cs
+++ b/src/mscorlib/src/System/Threading/ExecutionContext.cs
@@ -117,7 +117,7 @@ namespace System.Threading
ExecutionContext executionContext = currentThread.ExecutionContext ?? Default;
if (executionContext.m_isFlowSuppressed)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotSupressFlowMultipleTimes"));
+ throw new InvalidOperationException(SR.InvalidOperation_CannotSupressFlowMultipleTimes);
}
Contract.EndContractBlock();
@@ -134,7 +134,7 @@ namespace System.Threading
ExecutionContext executionContext = currentThread.ExecutionContext;
if (executionContext == null || !executionContext.m_isFlowSuppressed)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotRestoreUnsupressedFlow"));
+ throw new InvalidOperationException(SR.InvalidOperation_CannotRestoreUnsupressedFlow);
}
Contract.EndContractBlock();
@@ -151,7 +151,7 @@ namespace System.Threading
public static void Run(ExecutionContext executionContext, ContextCallback callback, Object state)
{
if (executionContext == null)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NullContext"));
+ throw new InvalidOperationException(SR.InvalidOperation_NullContext);
Thread currentThread = Thread.CurrentThread;
ExecutionContextSwitcher ecsw = default(ExecutionContextSwitcher);
@@ -238,7 +238,7 @@ namespace System.Threading
catch (Exception ex)
{
Environment.FailFast(
- Environment.GetResourceString("ExecutionContext_ExceptionInAsyncLocalNotification"),
+ SR.ExecutionContext_ExceptionInAsyncLocalNotification,
ex);
}
}
@@ -319,11 +319,11 @@ namespace System.Threading
{
if (_thread == null)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotUseAFCMultiple"));
+ throw new InvalidOperationException(SR.InvalidOperation_CannotUseAFCMultiple);
}
if (Thread.CurrentThread != _thread)
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CannotUseAFCOtherThread"));
+ throw new InvalidOperationException(SR.InvalidOperation_CannotUseAFCOtherThread);
}
// An async flow control cannot be undone when a different execution context is applied. The desktop framework
@@ -338,7 +338,7 @@ namespace System.Threading
// flow is suppressed.
if (!ExecutionContext.IsFlowSuppressed())
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_AsyncFlowCtrlCtxMismatch"));
+ throw new InvalidOperationException(SR.InvalidOperation_AsyncFlowCtrlCtxMismatch);
}
Contract.EndContractBlock();
diff --git a/src/mscorlib/src/System/Threading/Interlocked.cs b/src/mscorlib/src/System/Threading/Interlocked.cs
index 578201e5a3..7e2c2aeeab 100644
--- a/src/mscorlib/src/System/Threading/Interlocked.cs
+++ b/src/mscorlib/src/System/Threading/Interlocked.cs
@@ -9,6 +9,8 @@ using System.Runtime.CompilerServices;
using System.Runtime.ConstrainedExecution;
using System.Runtime.Versioning;
using System.Runtime;
+using System.Runtime.InteropServices;
+using System.Security;
namespace System.Threading
{
@@ -188,10 +190,16 @@ namespace System.Threading
return Interlocked.CompareExchange(ref location, 0, 0);
}
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern void MemoryBarrier();
+
+ [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
+ [SuppressUnmanagedCodeSecurity]
+ private static extern void _MemoryBarrierProcessWide();
- public static void MemoryBarrier()
+ public static void MemoryBarrierProcessWide()
{
- Thread.MemoryBarrier();
+ _MemoryBarrierProcessWide();
}
}
}
diff --git a/src/mscorlib/src/System/Threading/LazyInitializer.cs b/src/mscorlib/src/System/Threading/LazyInitializer.cs
index 6c84caa5a6..e264a8f166 100644
--- a/src/mscorlib/src/System/Threading/LazyInitializer.cs
+++ b/src/mscorlib/src/System/Threading/LazyInitializer.cs
@@ -128,7 +128,7 @@ namespace System.Threading
T value = valueFactory();
if (value == null)
{
- throw new InvalidOperationException(Environment.GetResourceString("Lazy_StaticInit_InvalidOperation"));
+ throw new InvalidOperationException(SR.Lazy_StaticInit_InvalidOperation);
}
Interlocked.CompareExchange(ref target, value, null);
@@ -257,7 +257,7 @@ namespace System.Threading
Volatile.Write(ref target, valueFactory());
if (target == null)
{
- throw new InvalidOperationException(Environment.GetResourceString("Lazy_StaticInit_InvalidOperation"));
+ throw new InvalidOperationException(SR.Lazy_StaticInit_InvalidOperation);
}
}
}
@@ -279,7 +279,7 @@ namespace System.Threading
}
catch (MissingMethodException)
{
- throw new MissingMemberException(Environment.GetResourceString("Lazy_CreateValue_NoParameterlessCtorForT"));
+ throw new MissingMemberException(SR.Lazy_CreateValue_NoParameterlessCtorForT);
}
}
}
diff --git a/src/mscorlib/src/System/Threading/ManualResetEventSlim.cs b/src/mscorlib/src/System/Threading/ManualResetEventSlim.cs
index c0bdbcece2..402a76cdc7 100644
--- a/src/mscorlib/src/System/Threading/ManualResetEventSlim.cs
+++ b/src/mscorlib/src/System/Threading/ManualResetEventSlim.cs
@@ -163,7 +163,7 @@ namespace System.Threading
// it is possible for the max number of waiters to be exceeded via user-code, hence we use a real exception here.
if (value >= NumWaitersState_MaxValue)
- throw new InvalidOperationException(String.Format(Environment.GetResourceString("ManualResetEventSlim_ctor_TooManyWaiters"), NumWaitersState_MaxValue));
+ throw new InvalidOperationException(String.Format(SR.ManualResetEventSlim_ctor_TooManyWaiters, NumWaitersState_MaxValue));
UpdateStateAtomically(value << NumWaitersState_ShiftCount, NumWaitersState_BitMask);
}
@@ -218,7 +218,7 @@ namespace System.Threading
{
throw new ArgumentOutOfRangeException(
nameof(spinCount),
- String.Format(Environment.GetResourceString("ManualResetEventSlim_ctor_SpinCountOutOfRange"), SpinCountState_MaxValue));
+ String.Format(SR.ManualResetEventSlim_ctor_SpinCountOutOfRange, SpinCountState_MaxValue));
}
// We will suppress default spin because the user specified a count.
@@ -717,7 +717,7 @@ namespace System.Threading
private void ThrowIfDisposed()
{
if ((m_combinedState & Dispose_BitMask) != 0)
- throw new ObjectDisposedException(Environment.GetResourceString("ManualResetEventSlim_Disposed"));
+ throw new ObjectDisposedException(SR.ManualResetEventSlim_Disposed);
}
/// <summary>
diff --git a/src/mscorlib/src/System/Threading/Monitor.cs b/src/mscorlib/src/System/Threading/Monitor.cs
index 8cebe647bb..3ace3335aa 100644
--- a/src/mscorlib/src/System/Threading/Monitor.cs
+++ b/src/mscorlib/src/System/Threading/Monitor.cs
@@ -57,7 +57,7 @@ namespace System.Threading
private static void ThrowLockTakenException()
{
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeFalse"), "lockTaken");
+ throw new ArgumentException(SR.Argument_MustBeFalse, "lockTaken");
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -122,7 +122,7 @@ namespace System.Threading
{
long tm = (long)timeout.TotalMilliseconds;
if (tm < -1 || tm > (long)Int32.MaxValue)
- throw new ArgumentOutOfRangeException(nameof(timeout), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(timeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
return (int)tm;
}
diff --git a/src/mscorlib/src/System/Threading/Mutex.cs b/src/mscorlib/src/System/Threading/Mutex.cs
index cac423f6a8..5e77e35bd6 100644
--- a/src/mscorlib/src/System/Threading/Mutex.cs
+++ b/src/mscorlib/src/System/Threading/Mutex.cs
@@ -50,7 +50,7 @@ namespace System.Threading
#if !PLATFORM_UNIX
if (name != null && System.IO.Path.MaxPath < name.Length)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_WaitHandleNameTooLong", Path.MaxPath), nameof(name));
+ throw new ArgumentException(SR.Format(SR.Argument_WaitHandleNameTooLong, Path.MaxPath), nameof(name));
}
#endif
Contract.EndContractBlock();
@@ -128,11 +128,11 @@ namespace System.Threading
#if PLATFORM_UNIX
case Win32Native.ERROR_FILENAME_EXCED_RANGE:
// On Unix, length validation is done by CoreCLR's PAL after converting to utf-8
- throw new ArgumentException(Environment.GetResourceString("Argument_WaitHandleNameTooLong", Interop.Sys.MaxName), "name");
+ throw new ArgumentException(SR.Format(SR.Argument_WaitHandleNameTooLong, Interop.Sys.MaxName), "name");
#endif
case Win32Native.ERROR_INVALID_HANDLE:
- throw new WaitHandleCannotBeOpenedException(Environment.GetResourceString("Threading.WaitHandleCannotBeOpenedException_InvalidHandle", m_name));
+ throw new WaitHandleCannotBeOpenedException(SR.Format(SR.Threading_WaitHandleCannotBeOpenedException_InvalidHandle, m_name));
}
}
__Error.WinIOError(errorCode, m_name);
@@ -210,7 +210,7 @@ namespace System.Threading
throw new WaitHandleCannotBeOpenedException();
case OpenExistingResult.NameInvalid:
- throw new WaitHandleCannotBeOpenedException(Environment.GetResourceString("Threading.WaitHandleCannotBeOpenedException_InvalidHandle", name));
+ throw new WaitHandleCannotBeOpenedException(SR.Format(SR.Threading_WaitHandleCannotBeOpenedException_InvalidHandle, name));
case OpenExistingResult.PathNotFound:
__Error.WinIOError(Win32Native.ERROR_PATH_NOT_FOUND, name);
@@ -230,17 +230,17 @@ namespace System.Threading
{
if (name == null)
{
- throw new ArgumentNullException(nameof(name), Environment.GetResourceString("ArgumentNull_WithParamName"));
+ throw new ArgumentNullException(nameof(name), SR.ArgumentNull_WithParamName);
}
if (name.Length == 0)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(name));
+ throw new ArgumentException(SR.Argument_EmptyName, nameof(name));
}
#if !PLATFORM_UNIX
if (System.IO.Path.MaxPath < name.Length)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_WaitHandleNameTooLong", Path.MaxPath), nameof(name));
+ throw new ArgumentException(SR.Format(SR.Argument_WaitHandleNameTooLong, Path.MaxPath), nameof(name));
}
#endif
Contract.EndContractBlock();
@@ -262,7 +262,7 @@ namespace System.Threading
if (name != null && errorCode == Win32Native.ERROR_FILENAME_EXCED_RANGE)
{
// On Unix, length validation is done by CoreCLR's PAL after converting to utf-8
- throw new ArgumentException(Environment.GetResourceString("Argument_WaitHandleNameTooLong", Interop.Sys.MaxName), nameof(name));
+ throw new ArgumentException(SR.Format(SR.Argument_WaitHandleNameTooLong, Interop.Sys.MaxName), nameof(name));
}
#endif
@@ -291,7 +291,7 @@ namespace System.Threading
}
else
{
- throw new ApplicationException(Environment.GetResourceString("Arg_SynchronizationLockException"));
+ throw new ApplicationException(SR.Arg_SynchronizationLockException);
}
}
diff --git a/src/mscorlib/src/System/Threading/Overlapped.cs b/src/mscorlib/src/System/Threading/Overlapped.cs
index 8712c12c8f..0830ee6b6c 100644
--- a/src/mscorlib/src/System/Threading/Overlapped.cs
+++ b/src/mscorlib/src/System/Threading/Overlapped.cs
@@ -166,7 +166,7 @@ namespace System.Threading
{
if (!m_pinSelf.IsNull())
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_Overlapped_Pack"));
+ throw new InvalidOperationException(SR.InvalidOperation_Overlapped_Pack);
}
if (iocb != null)
@@ -198,7 +198,7 @@ namespace System.Threading
{
if (!m_pinSelf.IsNull())
{
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_Overlapped_Pack"));
+ throw new InvalidOperationException(SR.InvalidOperation_Overlapped_Pack);
}
m_userObject = userData;
if (m_userObject != null)
@@ -241,7 +241,6 @@ namespace System.Threading
#region class Overlapped
- /// <internalonly/>
public class Overlapped
{
private OverlappedData m_overlappedData;
diff --git a/src/mscorlib/src/System/Threading/Semaphore.cs b/src/mscorlib/src/System/Threading/Semaphore.cs
index 1eac4aaaeb..ae353cc3e3 100644
--- a/src/mscorlib/src/System/Threading/Semaphore.cs
+++ b/src/mscorlib/src/System/Threading/Semaphore.cs
@@ -20,17 +20,17 @@ namespace System.Threading
{
if (initialCount < 0)
{
- throw new ArgumentOutOfRangeException(nameof(initialCount), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(initialCount), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (maximumCount < 1)
{
- throw new ArgumentOutOfRangeException(nameof(maximumCount), Environment.GetResourceString("ArgumentOutOfRange_NeedPosNum"));
+ throw new ArgumentOutOfRangeException(nameof(maximumCount), SR.ArgumentOutOfRange_NeedPosNum);
}
if (initialCount > maximumCount)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_SemaphoreInitialMaximum"));
+ throw new ArgumentException(SR.Argument_SemaphoreInitialMaximum);
}
SafeWaitHandle myHandle = CreateSemaphone(initialCount, maximumCount, name);
@@ -41,7 +41,7 @@ namespace System.Threading
if (null != name && 0 != name.Length && Win32Native.ERROR_INVALID_HANDLE == errorCode)
throw new WaitHandleCannotBeOpenedException(
- Environment.GetResourceString("Threading.WaitHandleCannotBeOpenedException_InvalidHandle", name));
+ SR.Format(SR.Threading_WaitHandleCannotBeOpenedException_InvalidHandle, name));
__Error.WinIOError();
}
@@ -52,17 +52,17 @@ namespace System.Threading
{
if (initialCount < 0)
{
- throw new ArgumentOutOfRangeException(nameof(initialCount), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(initialCount), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (maximumCount < 1)
{
- throw new ArgumentOutOfRangeException(nameof(maximumCount), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(maximumCount), SR.ArgumentOutOfRange_NeedNonNegNum);
}
if (initialCount > maximumCount)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_SemaphoreInitialMaximum"));
+ throw new ArgumentException(SR.Argument_SemaphoreInitialMaximum);
}
SafeWaitHandle myHandle = CreateSemaphone(initialCount, maximumCount, name);
@@ -72,7 +72,7 @@ namespace System.Threading
{
if (null != name && 0 != name.Length && Win32Native.ERROR_INVALID_HANDLE == errorCode)
throw new WaitHandleCannotBeOpenedException(
- Environment.GetResourceString("Threading.WaitHandleCannotBeOpenedException_InvalidHandle", name));
+ SR.Format(SR.Threading_WaitHandleCannotBeOpenedException_InvalidHandle, name));
__Error.WinIOError();
}
createdNew = errorCode != Win32Native.ERROR_ALREADY_EXISTS;
@@ -89,10 +89,10 @@ namespace System.Threading
if (name != null)
{
#if PLATFORM_UNIX
- throw new PlatformNotSupportedException(Environment.GetResourceString("PlatformNotSupported_NamedSynchronizationPrimitives"));
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_NamedSynchronizationPrimitives);
#else
if (name.Length > Path.MaxPath)
- throw new ArgumentException(Environment.GetResourceString("Argument_WaitHandleNameTooLong", Path.MaxPath), nameof(name));
+ throw new ArgumentException(SR.Format(SR.Argument_WaitHandleNameTooLong, Path.MaxPath), nameof(name));
#endif
}
@@ -111,7 +111,7 @@ namespace System.Threading
case OpenExistingResult.NameNotFound:
throw new WaitHandleCannotBeOpenedException();
case OpenExistingResult.NameInvalid:
- throw new WaitHandleCannotBeOpenedException(Environment.GetResourceString("Threading.WaitHandleCannotBeOpenedException_InvalidHandle", name));
+ throw new WaitHandleCannotBeOpenedException(SR.Format(SR.Threading_WaitHandleCannotBeOpenedException_InvalidHandle, name));
case OpenExistingResult.PathNotFound:
throw new IOException(Win32Native.GetMessage(Win32Native.ERROR_PATH_NOT_FOUND));
default:
@@ -127,14 +127,14 @@ namespace System.Threading
private static OpenExistingResult OpenExistingWorker(string name, out Semaphore result)
{
#if PLATFORM_UNIX
- throw new PlatformNotSupportedException(Environment.GetResourceString("PlatformNotSupported_NamedSynchronizationPrimitives"));
+ throw new PlatformNotSupportedException(SR.PlatformNotSupported_NamedSynchronizationPrimitives);
#else
if (name == null)
- throw new ArgumentNullException(nameof(name), Environment.GetResourceString("ArgumentNull_WithParamName"));
+ throw new ArgumentNullException(nameof(name), SR.ArgumentNull_WithParamName);
if (name.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(name));
+ throw new ArgumentException(SR.Argument_EmptyName, nameof(name));
if (name.Length > Path.MaxPath)
- throw new ArgumentException(Environment.GetResourceString("Argument_WaitHandleNameTooLong", Path.MaxPath), nameof(name));
+ throw new ArgumentException(SR.Format(SR.Argument_WaitHandleNameTooLong, Path.MaxPath), nameof(name));
const int SYNCHRONIZE = 0x00100000;
const int SEMAPHORE_MODIFY_STATE = 0x00000002;
@@ -173,7 +173,7 @@ namespace System.Threading
{
if (releaseCount < 1)
{
- throw new ArgumentOutOfRangeException(nameof(releaseCount), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(releaseCount), SR.ArgumentOutOfRange_NeedNonNegNum);
}
//If ReleaseSempahore returns false when the specified value would cause
diff --git a/src/mscorlib/src/System/Threading/SemaphoreFullException.cs b/src/mscorlib/src/System/Threading/SemaphoreFullException.cs
index ca01dba07e..bbcc226f95 100644
--- a/src/mscorlib/src/System/Threading/SemaphoreFullException.cs
+++ b/src/mscorlib/src/System/Threading/SemaphoreFullException.cs
@@ -12,7 +12,7 @@ namespace System.Threading
[ComVisibleAttribute(false)]
public class SemaphoreFullException : SystemException
{
- public SemaphoreFullException() : base(Environment.GetResourceString("Threading_SemaphoreFullException"))
+ public SemaphoreFullException() : base(SR.Threading_SemaphoreFullException)
{
}
diff --git a/src/mscorlib/src/System/Threading/SemaphoreSlim.cs b/src/mscorlib/src/System/Threading/SemaphoreSlim.cs
index 7be7d2fb55..97bbae18cc 100644
--- a/src/mscorlib/src/System/Threading/SemaphoreSlim.cs
+++ b/src/mscorlib/src/System/Threading/SemaphoreSlim.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// 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.
@@ -178,13 +178,13 @@ namespace System.Threading
if (initialCount < 0 || initialCount > maxCount)
{
throw new ArgumentOutOfRangeException(
- nameof(initialCount), initialCount, GetResourceString("SemaphoreSlim_ctor_InitialCountWrong"));
+ nameof(initialCount), initialCount, SR.SemaphoreSlim_ctor_InitialCountWrong);
}
//validate input
if (maxCount <= 0)
{
- throw new ArgumentOutOfRangeException(nameof(maxCount), maxCount, GetResourceString("SemaphoreSlim_ctor_MaxCountWrong"));
+ throw new ArgumentOutOfRangeException(nameof(maxCount), maxCount, SR.SemaphoreSlim_ctor_MaxCountWrong);
}
m_maxCount = maxCount;
@@ -241,7 +241,7 @@ namespace System.Threading
if (totalMilliseconds < -1 || totalMilliseconds > Int32.MaxValue)
{
throw new System.ArgumentOutOfRangeException(
- nameof(timeout), timeout, GetResourceString("SemaphoreSlim_Wait_TimeoutWrong"));
+ nameof(timeout), timeout, SR.SemaphoreSlim_Wait_TimeoutWrong);
}
// Call wait with the timeout milliseconds
@@ -271,7 +271,7 @@ namespace System.Threading
if (totalMilliseconds < -1 || totalMilliseconds > Int32.MaxValue)
{
throw new System.ArgumentOutOfRangeException(
- nameof(timeout), timeout, GetResourceString("SemaphoreSlim_Wait_TimeoutWrong"));
+ nameof(timeout), timeout, SR.SemaphoreSlim_Wait_TimeoutWrong);
}
// Call wait with the timeout milliseconds
@@ -314,7 +314,7 @@ namespace System.Threading
if (millisecondsTimeout < -1)
{
throw new ArgumentOutOfRangeException(
- nameof(millisecondsTimeout), millisecondsTimeout, GetResourceString("SemaphoreSlim_Wait_TimeoutWrong"));
+ nameof(millisecondsTimeout), millisecondsTimeout, SR.SemaphoreSlim_Wait_TimeoutWrong);
}
cancellationToken.ThrowIfCancellationRequested();
@@ -575,7 +575,7 @@ namespace System.Threading
if (totalMilliseconds < -1 || totalMilliseconds > Int32.MaxValue)
{
throw new System.ArgumentOutOfRangeException(
- nameof(timeout), timeout, GetResourceString("SemaphoreSlim_Wait_TimeoutWrong"));
+ nameof(timeout), timeout, SR.SemaphoreSlim_Wait_TimeoutWrong);
}
// Call wait with the timeout milliseconds
@@ -608,7 +608,7 @@ namespace System.Threading
if (millisecondsTimeout < -1)
{
throw new ArgumentOutOfRangeException(
- nameof(millisecondsTimeout), millisecondsTimeout, GetResourceString("SemaphoreSlim_Wait_TimeoutWrong"));
+ nameof(millisecondsTimeout), millisecondsTimeout, SR.SemaphoreSlim_Wait_TimeoutWrong);
}
// Bail early for cancellation
@@ -772,7 +772,7 @@ namespace System.Threading
if (releaseCount < 1)
{
throw new ArgumentOutOfRangeException(
- nameof(releaseCount), releaseCount, GetResourceString("SemaphoreSlim_Release_CountWrong"));
+ nameof(releaseCount), releaseCount, SR.SemaphoreSlim_Release_CountWrong);
}
int returnCount;
@@ -906,7 +906,7 @@ namespace System.Threading
{
if (m_lockObj == null)
{
- throw new ObjectDisposedException(null, GetResourceString("SemaphoreSlim_Disposed"));
+ throw new ObjectDisposedException(null, SR.SemaphoreSlim_Disposed);
}
}
@@ -916,7 +916,7 @@ namespace System.Threading
/// <param name="str">The key string</param>
private static string GetResourceString(string str)
{
- return Environment.GetResourceString(str);
+ return SR.GetResourceString(str);
}
#endregion
}
diff --git a/src/mscorlib/src/System/Threading/SpinWait.cs b/src/mscorlib/src/System/Threading/SpinWait.cs
index e5bd3c71c2..ae490e8f24 100644
--- a/src/mscorlib/src/System/Threading/SpinWait.cs
+++ b/src/mscorlib/src/System/Threading/SpinWait.cs
@@ -51,7 +51,7 @@ namespace System.Threading
/// <remarks>
/// <para>
/// <see cref="SpinWait"/> encapsulates common spinning logic. On single-processor machines, yields are
- /// always used instead of busy waits, and on computers with Intel™ processors employing Hyper-Threading™
+ /// always used instead of busy waits, and on computers with Intel� processors employing Hyper-Threading�
/// technology, it helps to prevent hardware thread starvation. SpinWait encapsulates a good mixture of
/// spinning and true yielding.
/// </para>
@@ -214,7 +214,7 @@ namespace System.Threading
if (totalMilliseconds < -1 || totalMilliseconds > Int32.MaxValue)
{
throw new System.ArgumentOutOfRangeException(
- nameof(timeout), timeout, Environment.GetResourceString("SpinWait_SpinUntil_TimeoutWrong"));
+ nameof(timeout), timeout, SR.SpinWait_SpinUntil_TimeoutWrong);
}
// Call wait with the timeout milliseconds
@@ -236,11 +236,11 @@ namespace System.Threading
if (millisecondsTimeout < Timeout.Infinite)
{
throw new ArgumentOutOfRangeException(
- nameof(millisecondsTimeout), millisecondsTimeout, Environment.GetResourceString("SpinWait_SpinUntil_TimeoutWrong"));
+ nameof(millisecondsTimeout), millisecondsTimeout, SR.SpinWait_SpinUntil_TimeoutWrong);
}
if (condition == null)
{
- throw new ArgumentNullException(nameof(condition), Environment.GetResourceString("SpinWait_SpinUntil_ArgumentNull"));
+ throw new ArgumentNullException(nameof(condition), SR.SpinWait_SpinUntil_ArgumentNull);
}
uint startTime = 0;
if (millisecondsTimeout != 0 && millisecondsTimeout != Timeout.Infinite)
diff --git a/src/mscorlib/src/System/Threading/SynchronizationLockException.cs b/src/mscorlib/src/System/Threading/SynchronizationLockException.cs
index 1f7a284ff4..a3b8cb4267 100644
--- a/src/mscorlib/src/System/Threading/SynchronizationLockException.cs
+++ b/src/mscorlib/src/System/Threading/SynchronizationLockException.cs
@@ -23,7 +23,7 @@ namespace System.Threading
public class SynchronizationLockException : SystemException
{
public SynchronizationLockException()
- : base(Environment.GetResourceString("Arg_SynchronizationLockException"))
+ : base(SR.Arg_SynchronizationLockException)
{
SetErrorCode(__HResults.COR_E_SYNCHRONIZATIONLOCK);
}
diff --git a/src/mscorlib/src/System/Threading/Tasks/TPLETWProvider.cs b/src/mscorlib/src/System/Threading/Tasks/TPLETWProvider.cs
index 19430596be..33bf792370 100644
--- a/src/mscorlib/src/System/Threading/Tasks/TPLETWProvider.cs
+++ b/src/mscorlib/src/System/Threading/Tasks/TPLETWProvider.cs
@@ -24,7 +24,7 @@ namespace System.Threading.Tasks
[EventSource(
Name = "System.Threading.Tasks.TplEventSource",
Guid = "2e5dba47-a3d2-4d16-8ee0-6671ffdcd7b5",
- LocalizationResources = System.CoreLib.Name)]
+ LocalizationResources = "FxResources.System.Private.CoreLib.SR")]
internal sealed class TplEtwProvider : EventSource
{
/// Used to determine if tasks should generate Activity IDs for themselves
diff --git a/src/mscorlib/src/System/Threading/Tasks/Task.cs b/src/mscorlib/src/System/Threading/Tasks/Task.cs
index b9f58c0ea0..8e2e6a4cb0 100644
--- a/src/mscorlib/src/System/Threading/Tasks/Task.cs
+++ b/src/mscorlib/src/System/Threading/Tasks/Task.cs
@@ -5029,6 +5029,10 @@ namespace System.Threading.Tasks
signaledTaskIndex = Array.IndexOf(tasks, firstCompleted.Result);
Debug.Assert(signaledTaskIndex >= 0);
}
+ else
+ {
+ TaskFactory.CommonCWAnyLogicCleanup(firstCompleted);
+ }
}
// We need to prevent the tasks array from being GC'ed until we come out of the wait.
diff --git a/src/mscorlib/src/System/Threading/Tasks/TaskExceptionHolder.cs b/src/mscorlib/src/System/Threading/Tasks/TaskExceptionHolder.cs
index 2ff127d7b7..1385d907e0 100644
--- a/src/mscorlib/src/System/Threading/Tasks/TaskExceptionHolder.cs
+++ b/src/mscorlib/src/System/Threading/Tasks/TaskExceptionHolder.cs
@@ -127,7 +127,7 @@ namespace System.Threading.Tasks
// First, publish the unobserved exception and allow users to observe it
AggregateException exceptionToThrow = new AggregateException(
- Environment.GetResourceString("TaskExceptionHolder_UnhandledException"),
+ SR.TaskExceptionHolder_UnhandledException,
m_faultExceptions);
UnobservedTaskExceptionEventArgs ueea = new UnobservedTaskExceptionEventArgs(exceptionToThrow);
TaskScheduler.PublishUnobservedTaskException(m_task, ueea);
@@ -276,7 +276,7 @@ namespace System.Threading.Tasks
// Anything else is a programming error
else
{
- throw new ArgumentException(Environment.GetResourceString("TaskExceptionHolder_UnknownExceptionType"), nameof(exceptionObject));
+ throw new ArgumentException(SR.TaskExceptionHolder_UnknownExceptionType, nameof(exceptionObject));
}
}
}
diff --git a/src/mscorlib/src/System/Threading/Tasks/TaskFactory.cs b/src/mscorlib/src/System/Threading/Tasks/TaskFactory.cs
index fd6c7216bb..e193d0e4e2 100644
--- a/src/mscorlib/src/System/Threading/Tasks/TaskFactory.cs
+++ b/src/mscorlib/src/System/Threading/Tasks/TaskFactory.cs
@@ -1518,9 +1518,9 @@ namespace System.Threading.Tasks
{
// Options detected here cause exceptions in FromAsync methods that take beginMethod as a parameter
if ((creationOptions & TaskCreationOptions.LongRunning) != 0)
- throw new ArgumentOutOfRangeException(nameof(creationOptions), Environment.GetResourceString("Task_FromAsync_LongRunning"));
+ throw new ArgumentOutOfRangeException(nameof(creationOptions), SR.Task_FromAsync_LongRunning);
if ((creationOptions & TaskCreationOptions.PreferFairness) != 0)
- throw new ArgumentOutOfRangeException(nameof(creationOptions), Environment.GetResourceString("Task_FromAsync_PreferFairness"));
+ throw new ArgumentOutOfRangeException(nameof(creationOptions), SR.Task_FromAsync_PreferFairness);
}
// Check for general validity of options
@@ -2372,7 +2372,8 @@ namespace System.Threading.Tasks
{
Contract.Requires(tasks != null);
- // Create a promise task to be returned to the user
+ // Create a promise task to be returned to the user.
+ // (If this logic ever changes, also update CommonCWAnyLogicCleanup.)
var promise = new CompleteOnInvokePromise(tasks);
// At the completion of any of the tasks, complete the promise.
@@ -2382,7 +2383,7 @@ namespace System.Threading.Tasks
for (int i = 0; i < numTasks; i++)
{
var task = tasks[i];
- if (task == null) throw new ArgumentException(Environment.GetResourceString("Task_MultiTaskContinuation_NullTask"), nameof(tasks));
+ if (task == null) throw new ArgumentException(SR.Task_MultiTaskContinuation_NullTask, nameof(tasks));
if (checkArgsOnly) continue;
@@ -2420,6 +2421,17 @@ namespace System.Threading.Tasks
return promise;
}
+ /// <summary>
+ /// Cleans up the operations performed by CommonCWAnyLogic in a case where
+ /// the created continuation task is being discarded.
+ /// </summary>
+ /// <param name="continuation">The task returned from CommonCWAnyLogic.</param>
+ internal static void CommonCWAnyLogicCleanup(Task<Task> continuation)
+ {
+ // Force cleanup of the promise (e.g. removing continuations from each
+ // constituent task), by completing the promise with any value.
+ ((CompleteOnInvokePromise)continuation).Invoke(null);
+ }
/// <summary>
/// Creates a continuation <see cref="T:System.Threading.Tasks.Task">Task</see>
@@ -3008,7 +3020,7 @@ namespace System.Threading.Tasks
if (tasks == null)
throw new ArgumentNullException(nameof(tasks));
if (tasks.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Task_MultiTaskContinuation_EmptyTaskList"), nameof(tasks));
+ throw new ArgumentException(SR.Task_MultiTaskContinuation_EmptyTaskList, nameof(tasks));
Contract.EndContractBlock();
Task[] tasksCopy = new Task[tasks.Length];
@@ -3017,7 +3029,7 @@ namespace System.Threading.Tasks
tasksCopy[i] = tasks[i];
if (tasksCopy[i] == null)
- throw new ArgumentException(Environment.GetResourceString("Task_MultiTaskContinuation_NullTask"), nameof(tasks));
+ throw new ArgumentException(SR.Task_MultiTaskContinuation_NullTask, nameof(tasks));
}
return tasksCopy;
@@ -3028,7 +3040,7 @@ namespace System.Threading.Tasks
if (tasks == null)
throw new ArgumentNullException(nameof(tasks));
if (tasks.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Task_MultiTaskContinuation_EmptyTaskList"), nameof(tasks));
+ throw new ArgumentException(SR.Task_MultiTaskContinuation_EmptyTaskList, nameof(tasks));
Contract.EndContractBlock();
Task<TResult>[] tasksCopy = new Task<TResult>[tasks.Length];
@@ -3037,7 +3049,7 @@ namespace System.Threading.Tasks
tasksCopy[i] = tasks[i];
if (tasksCopy[i] == null)
- throw new ArgumentException(Environment.GetResourceString("Task_MultiTaskContinuation_NullTask"), nameof(tasks));
+ throw new ArgumentException(SR.Task_MultiTaskContinuation_NullTask, nameof(tasks));
}
return tasksCopy;
@@ -3056,7 +3068,7 @@ namespace System.Threading.Tasks
const TaskContinuationOptions illegalMask = TaskContinuationOptions.ExecuteSynchronously | TaskContinuationOptions.LongRunning;
if ((continuationOptions & illegalMask) == illegalMask)
{
- throw new ArgumentOutOfRangeException(nameof(continuationOptions), Environment.GetResourceString("Task_ContinueWith_ESandLR"));
+ throw new ArgumentOutOfRangeException(nameof(continuationOptions), SR.Task_ContinueWith_ESandLR);
}
// Check that no nonsensical options are specified.
@@ -3075,7 +3087,7 @@ namespace System.Threading.Tasks
// Check that no "fire" options are specified.
if ((continuationOptions & NotOnAny) != 0)
- throw new ArgumentOutOfRangeException(nameof(continuationOptions), Environment.GetResourceString("Task_MultiTaskContinuation_FireOptions"));
+ throw new ArgumentOutOfRangeException(nameof(continuationOptions), SR.Task_MultiTaskContinuation_FireOptions);
Contract.EndContractBlock();
}
}
diff --git a/src/mscorlib/src/System/Threading/Tasks/TaskScheduler.cs b/src/mscorlib/src/System/Threading/Tasks/TaskScheduler.cs
index 94d3f1189e..45d398f0eb 100644
--- a/src/mscorlib/src/System/Threading/Tasks/TaskScheduler.cs
+++ b/src/mscorlib/src/System/Threading/Tasks/TaskScheduler.cs
@@ -218,7 +218,7 @@ namespace System.Threading.Tasks
// Otherwise the scheduler is buggy
if (bInlined && !(task.IsDelegateInvoked || task.IsCanceled))
{
- throw new InvalidOperationException(Environment.GetResourceString("TaskScheduler_InconsistentStateAfterTryExecuteTaskInline"));
+ throw new InvalidOperationException(SR.TaskScheduler_InconsistentStateAfterTryExecuteTaskInline);
}
return bInlined;
@@ -443,7 +443,7 @@ namespace System.Threading.Tasks
{
if (task.ExecutingTaskScheduler != this)
{
- throw new InvalidOperationException(Environment.GetResourceString("TaskScheduler_ExecuteTask_WrongTaskScheduler"));
+ throw new InvalidOperationException(SR.TaskScheduler_ExecuteTask_WrongTaskScheduler);
}
return task.ExecuteEntry();
@@ -594,13 +594,13 @@ namespace System.Threading.Tasks
m_taskScheduler = scheduler;
}
- // returns the scheduler’s Id
+ // returns the scheduler�s Id
public Int32 Id
{
get { return m_taskScheduler.Id; }
}
- // returns the scheduler’s GetScheduledTasks
+ // returns the scheduler�s GetScheduledTasks
public IEnumerable<Task> ScheduledTasks
{
get { return m_taskScheduler.GetScheduledTasks(); }
@@ -631,7 +631,7 @@ namespace System.Threading.Tasks
// make sure we have a synccontext to work with
if (synContext == null)
{
- throw new InvalidOperationException(Environment.GetResourceString("TaskScheduler_FromCurrentSynchronizationContext_NoCurrent"));
+ throw new InvalidOperationException(SR.TaskScheduler_FromCurrentSynchronizationContext_NoCurrent);
}
m_synchronizationContext = synContext;
diff --git a/src/mscorlib/src/System/Threading/Tasks/future.cs b/src/mscorlib/src/System/Threading/Tasks/future.cs
index 147456af5f..26c2388e6b 100644
--- a/src/mscorlib/src/System/Threading/Tasks/future.cs
+++ b/src/mscorlib/src/System/Threading/Tasks/future.cs
@@ -374,7 +374,7 @@ namespace System.Threading.Tasks
{
get
{
- return IsRanToCompletion ? "" + m_result : Environment.GetResourceString("TaskT_DebuggerNoResult");
+ return IsRanToCompletion ? "" + m_result : SR.TaskT_DebuggerNoResult;
}
}
diff --git a/src/mscorlib/src/System/Threading/Thread.cs b/src/mscorlib/src/System/Threading/Thread.cs
index 6342aa46f2..70a5d06f7a 100644
--- a/src/mscorlib/src/System/Threading/Thread.cs
+++ b/src/mscorlib/src/System/Threading/Thread.cs
@@ -100,7 +100,7 @@ namespace System.Threading
}
}
- public sealed class Thread : RuntimeThread
+ internal sealed class Thread : RuntimeThread
{
/*=========================================================================
** Data accessed from managed code that needs to be defined in
@@ -172,7 +172,7 @@ namespace System.Threading
throw new ArgumentNullException(nameof(start));
}
if (0 > maxStackSize)
- throw new ArgumentOutOfRangeException(nameof(maxStackSize), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(maxStackSize), SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
SetStartHelper((Delegate)start, maxStackSize);
}
@@ -193,7 +193,7 @@ namespace System.Threading
throw new ArgumentNullException(nameof(start));
}
if (0 > maxStackSize)
- throw new ArgumentOutOfRangeException(nameof(maxStackSize), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(maxStackSize), SR.ArgumentOutOfRange_NeedNonNegNum);
Contract.EndContractBlock();
SetStartHelper((Delegate)start, maxStackSize);
}
@@ -218,7 +218,7 @@ namespace System.Threading
// There are ways how to create an unitialized objects through remoting, etc. Avoid AVing in the EE by throwing a nice
// exception here.
if (thread.IsNull())
- throw new ArgumentException(null, Environment.GetResourceString("Argument_InvalidHandle"));
+ throw new ArgumentException(null, SR.Argument_InvalidHandle);
return new ThreadHandle(thread);
}
@@ -248,7 +248,7 @@ namespace System.Threading
//We expect the thread to be setup with a ParameterizedThreadStart
// if this constructor is called.
//If we got here then that wasn't the case
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_ThreadWrongThreadStart"));
+ throw new InvalidOperationException(SR.InvalidOperation_ThreadWrongThreadStart);
}
m_ThreadStartArg = parameter;
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
@@ -322,7 +322,7 @@ namespace System.Threading
{
long tm = (long)timeout.TotalMilliseconds;
if (tm < -1 || tm > (long)Int32.MaxValue)
- throw new ArgumentOutOfRangeException(nameof(timeout), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(timeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
Sleep((int)tm);
}
@@ -538,7 +538,7 @@ namespace System.Threading
lock (this)
{
if (m_Name != null)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_WriteOnce"));
+ throw new InvalidOperationException(SR.InvalidOperation_WriteOnce);
m_Name = value;
InformThreadNameChange(GetNativeHandle(), value, (value != null) ? value.Length : 0);
@@ -550,8 +550,6 @@ namespace System.Threading
[SuppressUnmanagedCodeSecurity]
private static extern void InformThreadNameChange(ThreadHandle t, String name, int len);
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public static extern void MemoryBarrier();
} // End of class Thread
// declaring a local var of this enum type and passing it by ref into a function that needs to do a
diff --git a/src/mscorlib/src/System/Threading/ThreadAbortException.cs b/src/mscorlib/src/System/Threading/ThreadAbortException.cs
index 21abb413db..a6fff1e31d 100644
--- a/src/mscorlib/src/System/Threading/ThreadAbortException.cs
+++ b/src/mscorlib/src/System/Threading/ThreadAbortException.cs
@@ -22,7 +22,7 @@ using System.Runtime.CompilerServices;
namespace System.Threading
{
[Serializable]
- public sealed class ThreadAbortException : SystemException
+ internal sealed class ThreadAbortException : SystemException
{
private ThreadAbortException()
: base(GetMessageFromNativeResources(ExceptionMessageKind.ThreadAbort))
diff --git a/src/mscorlib/src/System/Threading/ThreadLocal.cs b/src/mscorlib/src/System/Threading/ThreadLocal.cs
index 67407e7704..64b8a60196 100644
--- a/src/mscorlib/src/System/Threading/ThreadLocal.cs
+++ b/src/mscorlib/src/System/Threading/ThreadLocal.cs
@@ -323,7 +323,7 @@ namespace System.Threading
int id = ~m_idComplement;
if (id < 0)
{
- throw new ObjectDisposedException(Environment.GetResourceString("ThreadLocal_Disposed"));
+ throw new ObjectDisposedException(SR.ThreadLocal_Disposed);
}
Debugger.NotifyOfCrossThreadDependency();
@@ -340,7 +340,7 @@ namespace System.Threading
if (IsValueCreated)
{
- throw new InvalidOperationException(Environment.GetResourceString("ThreadLocal_Value_RecursiveCallsToValue"));
+ throw new InvalidOperationException(SR.ThreadLocal_Value_RecursiveCallsToValue);
}
}
@@ -356,7 +356,7 @@ namespace System.Threading
// If the object has been disposed, id will be -1.
if (id < 0)
{
- throw new ObjectDisposedException(Environment.GetResourceString("ThreadLocal_Disposed"));
+ throw new ObjectDisposedException(SR.ThreadLocal_Disposed);
}
// If a slot array has not been created on this thread yet, create it.
@@ -394,7 +394,7 @@ namespace System.Threading
if (!m_initialized)
{
- throw new ObjectDisposedException(Environment.GetResourceString("ThreadLocal_Disposed"));
+ throw new ObjectDisposedException(SR.ThreadLocal_Disposed);
}
slot.Value = value;
@@ -416,7 +416,7 @@ namespace System.Threading
// Dispose also executes under a lock.
if (!m_initialized)
{
- throw new ObjectDisposedException(Environment.GetResourceString("ThreadLocal_Disposed"));
+ throw new ObjectDisposedException(SR.ThreadLocal_Disposed);
}
LinkedSlot firstRealNode = m_linkedSlot.Next;
@@ -454,11 +454,11 @@ namespace System.Threading
{
if (!m_trackAllValues)
{
- throw new InvalidOperationException(Environment.GetResourceString("ThreadLocal_ValuesNotAvailable"));
+ throw new InvalidOperationException(SR.ThreadLocal_ValuesNotAvailable);
}
var list = GetValuesAsList(); // returns null if disposed
- if (list == null) throw new ObjectDisposedException(Environment.GetResourceString("ThreadLocal_Disposed"));
+ if (list == null) throw new ObjectDisposedException(SR.ThreadLocal_Disposed);
return list;
}
}
@@ -511,7 +511,7 @@ namespace System.Threading
int id = ~m_idComplement;
if (id < 0)
{
- throw new ObjectDisposedException(Environment.GetResourceString("ThreadLocal_Disposed"));
+ throw new ObjectDisposedException(SR.ThreadLocal_Disposed);
}
LinkedSlotVolatile[] slotArray = ts_slotArray;
diff --git a/src/mscorlib/src/System/Threading/ThreadPool.cs b/src/mscorlib/src/System/Threading/ThreadPool.cs
index 7dbb957055..0084050c43 100644
--- a/src/mscorlib/src/System/Threading/ThreadPool.cs
+++ b/src/mscorlib/src/System/Threading/ThreadPool.cs
@@ -805,8 +805,8 @@ namespace System.Threading
// This will result in a "leak" of sorts (since the handle will not be cleaned up)
// but the process is exiting anyway.
//
- // During AD-unload, we don’t finalize live objects until all threads have been
- // aborted out of the AD. Since these locked regions are CERs, we won’t abort them
+ // During AD-unload, we don�t finalize live objects until all threads have been
+ // aborted out of the AD. Since these locked regions are CERs, we won�t abort them
// while the lock is held. So there should be no leak on AD-unload.
//
if (Interlocked.CompareExchange(ref m_lock, 1, 0) == 0)
@@ -1184,7 +1184,7 @@ namespace System.Threading
)
{
if (millisecondsTimeOutInterval < -1)
- throw new ArgumentOutOfRangeException(nameof(millisecondsTimeOutInterval), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(millisecondsTimeOutInterval), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
Contract.EndContractBlock();
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return RegisterWaitForSingleObject(waitObject, callBack, state, (UInt32)millisecondsTimeOutInterval, executeOnlyOnce, ref stackMark, true);
@@ -1200,7 +1200,7 @@ namespace System.Threading
)
{
if (millisecondsTimeOutInterval < -1)
- throw new ArgumentOutOfRangeException(nameof(millisecondsTimeOutInterval), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(millisecondsTimeOutInterval), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
Contract.EndContractBlock();
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return RegisterWaitForSingleObject(waitObject, callBack, state, (UInt32)millisecondsTimeOutInterval, executeOnlyOnce, ref stackMark, false);
@@ -1216,7 +1216,7 @@ namespace System.Threading
)
{
if (millisecondsTimeOutInterval < -1)
- throw new ArgumentOutOfRangeException(nameof(millisecondsTimeOutInterval), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(millisecondsTimeOutInterval), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
Contract.EndContractBlock();
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return RegisterWaitForSingleObject(waitObject, callBack, state, (UInt32)millisecondsTimeOutInterval, executeOnlyOnce, ref stackMark, true);
@@ -1232,7 +1232,7 @@ namespace System.Threading
)
{
if (millisecondsTimeOutInterval < -1)
- throw new ArgumentOutOfRangeException(nameof(millisecondsTimeOutInterval), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(millisecondsTimeOutInterval), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
Contract.EndContractBlock();
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return RegisterWaitForSingleObject(waitObject, callBack, state, (UInt32)millisecondsTimeOutInterval, executeOnlyOnce, ref stackMark, false);
@@ -1249,9 +1249,9 @@ namespace System.Threading
{
long tm = (long)timeout.TotalMilliseconds;
if (tm < -1)
- throw new ArgumentOutOfRangeException(nameof(timeout), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(timeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
if (tm > (long)Int32.MaxValue)
- throw new ArgumentOutOfRangeException(nameof(timeout), Environment.GetResourceString("ArgumentOutOfRange_LessEqualToIntegerMaxVal"));
+ throw new ArgumentOutOfRangeException(nameof(timeout), SR.ArgumentOutOfRange_LessEqualToIntegerMaxVal);
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return RegisterWaitForSingleObject(waitObject, callBack, state, (UInt32)tm, executeOnlyOnce, ref stackMark, true);
}
@@ -1267,9 +1267,9 @@ namespace System.Threading
{
long tm = (long)timeout.TotalMilliseconds;
if (tm < -1)
- throw new ArgumentOutOfRangeException(nameof(timeout), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(timeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
if (tm > (long)Int32.MaxValue)
- throw new ArgumentOutOfRangeException(nameof(timeout), Environment.GetResourceString("ArgumentOutOfRange_LessEqualToIntegerMaxVal"));
+ throw new ArgumentOutOfRangeException(nameof(timeout), SR.ArgumentOutOfRange_LessEqualToIntegerMaxVal);
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return RegisterWaitForSingleObject(waitObject, callBack, state, (UInt32)tm, executeOnlyOnce, ref stackMark, false);
}
diff --git a/src/mscorlib/src/System/Threading/ThreadStartException.cs b/src/mscorlib/src/System/Threading/ThreadStartException.cs
index 5b5ee82fc7..27a0d57101 100644
--- a/src/mscorlib/src/System/Threading/ThreadStartException.cs
+++ b/src/mscorlib/src/System/Threading/ThreadStartException.cs
@@ -14,13 +14,13 @@ namespace System.Threading
public sealed class ThreadStartException : SystemException
{
private ThreadStartException()
- : base(Environment.GetResourceString("Arg_ThreadStartException"))
+ : base(SR.Arg_ThreadStartException)
{
SetErrorCode(__HResults.COR_E_THREADSTART);
}
private ThreadStartException(Exception reason)
- : base(Environment.GetResourceString("Arg_ThreadStartException"), reason)
+ : base(SR.Arg_ThreadStartException, reason)
{
SetErrorCode(__HResults.COR_E_THREADSTART);
}
diff --git a/src/mscorlib/src/System/Threading/ThreadStateException.cs b/src/mscorlib/src/System/Threading/ThreadStateException.cs
index 0df4416a93..9e1cc1d49b 100644
--- a/src/mscorlib/src/System/Threading/ThreadStateException.cs
+++ b/src/mscorlib/src/System/Threading/ThreadStateException.cs
@@ -22,7 +22,7 @@ namespace System.Threading
public class ThreadStateException : SystemException
{
public ThreadStateException()
- : base(Environment.GetResourceString("Arg_ThreadStateException"))
+ : base(SR.Arg_ThreadStateException)
{
SetErrorCode(__HResults.COR_E_THREADSTATE);
}
diff --git a/src/mscorlib/src/System/Threading/Timer.cs b/src/mscorlib/src/System/Threading/Timer.cs
index 666fe70b32..960f815d64 100644
--- a/src/mscorlib/src/System/Threading/Timer.cs
+++ b/src/mscorlib/src/System/Threading/Timer.cs
@@ -455,7 +455,7 @@ namespace System.Threading
lock (TimerQueue.Instance)
{
if (m_canceled)
- throw new ObjectDisposedException(null, Environment.GetResourceString("ObjectDisposed_Generic"));
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_Generic);
// prevent ThreadAbort while updating state
try { }
@@ -666,9 +666,9 @@ namespace System.Threading
int period)
{
if (dueTime < -1)
- throw new ArgumentOutOfRangeException(nameof(dueTime), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(dueTime), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
if (period < -1)
- throw new ArgumentOutOfRangeException(nameof(period), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(period), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
Contract.EndContractBlock();
TimerSetup(callback, state, (UInt32)dueTime, (UInt32)period);
@@ -681,15 +681,15 @@ namespace System.Threading
{
long dueTm = (long)dueTime.TotalMilliseconds;
if (dueTm < -1)
- throw new ArgumentOutOfRangeException(nameof(dueTm), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(dueTm), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
if (dueTm > MAX_SUPPORTED_TIMEOUT)
- throw new ArgumentOutOfRangeException(nameof(dueTm), Environment.GetResourceString("ArgumentOutOfRange_TimeoutTooLarge"));
+ throw new ArgumentOutOfRangeException(nameof(dueTm), SR.ArgumentOutOfRange_TimeoutTooLarge);
long periodTm = (long)period.TotalMilliseconds;
if (periodTm < -1)
- throw new ArgumentOutOfRangeException(nameof(periodTm), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(periodTm), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
if (periodTm > MAX_SUPPORTED_TIMEOUT)
- throw new ArgumentOutOfRangeException(nameof(periodTm), Environment.GetResourceString("ArgumentOutOfRange_PeriodTooLarge"));
+ throw new ArgumentOutOfRangeException(nameof(periodTm), SR.ArgumentOutOfRange_PeriodTooLarge);
TimerSetup(callback, state, (UInt32)dueTm, (UInt32)periodTm);
}
@@ -709,13 +709,13 @@ namespace System.Threading
long period)
{
if (dueTime < -1)
- throw new ArgumentOutOfRangeException(nameof(dueTime), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(dueTime), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
if (period < -1)
- throw new ArgumentOutOfRangeException(nameof(period), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(period), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
if (dueTime > MAX_SUPPORTED_TIMEOUT)
- throw new ArgumentOutOfRangeException(nameof(dueTime), Environment.GetResourceString("ArgumentOutOfRange_TimeoutTooLarge"));
+ throw new ArgumentOutOfRangeException(nameof(dueTime), SR.ArgumentOutOfRange_TimeoutTooLarge);
if (period > MAX_SUPPORTED_TIMEOUT)
- throw new ArgumentOutOfRangeException(nameof(period), Environment.GetResourceString("ArgumentOutOfRange_PeriodTooLarge"));
+ throw new ArgumentOutOfRangeException(nameof(period), SR.ArgumentOutOfRange_PeriodTooLarge);
Contract.EndContractBlock();
TimerSetup(callback, state, (UInt32)dueTime, (UInt32)period);
}
@@ -745,9 +745,9 @@ namespace System.Threading
public bool Change(int dueTime, int period)
{
if (dueTime < -1)
- throw new ArgumentOutOfRangeException(nameof(dueTime), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(dueTime), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
if (period < -1)
- throw new ArgumentOutOfRangeException(nameof(period), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(period), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
Contract.EndContractBlock();
return m_timer.m_timer.Change((UInt32)dueTime, (UInt32)period);
@@ -767,13 +767,13 @@ namespace System.Threading
public bool Change(long dueTime, long period)
{
if (dueTime < -1)
- throw new ArgumentOutOfRangeException(nameof(dueTime), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(dueTime), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
if (period < -1)
- throw new ArgumentOutOfRangeException(nameof(period), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(period), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
if (dueTime > MAX_SUPPORTED_TIMEOUT)
- throw new ArgumentOutOfRangeException(nameof(dueTime), Environment.GetResourceString("ArgumentOutOfRange_TimeoutTooLarge"));
+ throw new ArgumentOutOfRangeException(nameof(dueTime), SR.ArgumentOutOfRange_TimeoutTooLarge);
if (period > MAX_SUPPORTED_TIMEOUT)
- throw new ArgumentOutOfRangeException(nameof(period), Environment.GetResourceString("ArgumentOutOfRange_PeriodTooLarge"));
+ throw new ArgumentOutOfRangeException(nameof(period), SR.ArgumentOutOfRange_PeriodTooLarge);
Contract.EndContractBlock();
return m_timer.m_timer.Change((UInt32)dueTime, (UInt32)period);
diff --git a/src/mscorlib/src/System/Threading/Volatile.cs b/src/mscorlib/src/System/Threading/Volatile.cs
index 620aa5ee47..6aac8d63cd 100644
--- a/src/mscorlib/src/System/Threading/Volatile.cs
+++ b/src/mscorlib/src/System/Threading/Volatile.cs
@@ -34,7 +34,7 @@ namespace System.Threading
// The VM will replace this with a more efficient implementation.
//
var value = location;
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
return value;
}
@@ -46,7 +46,7 @@ namespace System.Threading
// The VM will replace this with a more efficient implementation.
//
var value = location;
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
return value;
}
@@ -57,7 +57,7 @@ namespace System.Threading
// The VM will replace this with a more efficient implementation.
//
var value = location;
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
return value;
}
@@ -68,7 +68,7 @@ namespace System.Threading
// The VM will replace this with a more efficient implementation.
//
var value = location;
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
return value;
}
@@ -80,7 +80,7 @@ namespace System.Threading
// The VM will replace this with a more efficient implementation.
//
var value = location;
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
return value;
}
@@ -91,7 +91,7 @@ namespace System.Threading
// The VM will replace this with a more efficient implementation.
//
var value = location;
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
return value;
}
@@ -103,7 +103,7 @@ namespace System.Threading
// The VM will replace this with a more efficient implementation.
//
var value = location;
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
return value;
}
@@ -115,7 +115,7 @@ namespace System.Threading
// The VM will replace this with a more efficient implementation.
//
var value = location;
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
return value;
}
@@ -127,7 +127,7 @@ namespace System.Threading
// The VM will replace this with a more efficient implementation.
//
var value = location;
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
return value;
}
#else
@@ -166,7 +166,7 @@ namespace System.Threading
// The VM will replace this with a more efficient implementation.
//
var value = location;
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
return value;
}
@@ -178,7 +178,7 @@ namespace System.Threading
// The VM will replace this with a more efficient implementation.
//
var value = location;
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
return value;
}
@@ -189,7 +189,7 @@ namespace System.Threading
// The VM will replace this with a more efficient implementation.
//
var value = location;
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
return value;
}
@@ -212,7 +212,7 @@ namespace System.Threading
// The VM will replace this with a more efficient implementation.
//
var value = location;
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
return value;
}
@@ -225,7 +225,7 @@ namespace System.Threading
//
// The VM will replace this with a more efficient implementation.
//
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
location = value;
}
@@ -236,7 +236,7 @@ namespace System.Threading
//
// The VM will replace this with a more efficient implementation.
//
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
location = value;
}
@@ -246,7 +246,7 @@ namespace System.Threading
//
// The VM will replace this with a more efficient implementation.
//
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
location = value;
}
@@ -256,7 +256,7 @@ namespace System.Threading
//
// The VM will replace this with a more efficient implementation.
//
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
location = value;
}
@@ -267,7 +267,7 @@ namespace System.Threading
//
// The VM will replace this with a more efficient implementation.
//
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
location = value;
}
@@ -277,7 +277,7 @@ namespace System.Threading
//
// The VM will replace this with a more efficient implementation.
//
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
location = value;
}
@@ -288,7 +288,7 @@ namespace System.Threading
//
// The VM will replace this with a more efficient implementation.
//
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
location = value;
}
@@ -299,7 +299,7 @@ namespace System.Threading
//
// The VM will replace this with a more efficient implementation.
//
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
location = value;
}
@@ -310,7 +310,7 @@ namespace System.Threading
//
// The VM will replace this with a more efficient implementation.
//
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
location = value;
}
#else
@@ -354,7 +354,7 @@ namespace System.Threading
//
// The VM will replace this with a more efficient implementation.
//
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
location = value;
}
@@ -365,7 +365,7 @@ namespace System.Threading
//
// The VM will replace this with a more efficient implementation.
//
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
location = value;
}
@@ -375,7 +375,7 @@ namespace System.Threading
//
// The VM will replace this with a more efficient implementation.
//
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
location = value;
}
@@ -397,7 +397,7 @@ namespace System.Threading
//
// The VM will replace this with a more efficient implementation.
//
- Thread.MemoryBarrier();
+ Interlocked.MemoryBarrier();
location = value;
}
}
diff --git a/src/mscorlib/src/System/Threading/WaitHandle.cs b/src/mscorlib/src/System/Threading/WaitHandle.cs
index 7ffd4b8d5a..97b9ff2f07 100644
--- a/src/mscorlib/src/System/Threading/WaitHandle.cs
+++ b/src/mscorlib/src/System/Threading/WaitHandle.cs
@@ -153,7 +153,7 @@ namespace System.Threading
{
if (millisecondsTimeout < -1)
{
- throw new ArgumentOutOfRangeException(nameof(millisecondsTimeout), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(millisecondsTimeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
}
Contract.EndContractBlock();
return WaitOne((long)millisecondsTimeout, exitContext);
@@ -164,7 +164,7 @@ namespace System.Threading
long tm = (long)timeout.TotalMilliseconds;
if (-1 > tm || (long)Int32.MaxValue < tm)
{
- throw new ArgumentOutOfRangeException(nameof(timeout), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(timeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
}
return WaitOne(tm, exitContext);
}
@@ -195,7 +195,7 @@ namespace System.Threading
{
if (waitableSafeHandle == null)
{
- throw new ObjectDisposedException(null, Environment.GetResourceString("ObjectDisposed_Generic"));
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_Generic);
}
Contract.EndContractBlock();
int ret = WaitOneNative(waitableSafeHandle, (uint)millisecondsTimeout, hasThreadAffinity, exitContext);
@@ -216,7 +216,7 @@ namespace System.Threading
// This is required to support the Wait which FAS needs (otherwise recursive dependency comes in)
if (safeWaitHandle == null)
{
- throw new ObjectDisposedException(null, Environment.GetResourceString("ObjectDisposed_Generic"));
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_Generic);
}
Contract.EndContractBlock();
@@ -248,7 +248,7 @@ namespace System.Threading
{
if (waitHandles == null)
{
- throw new ArgumentNullException(nameof(waitHandles), Environment.GetResourceString("ArgumentNull_Waithandles"));
+ throw new ArgumentNullException(nameof(waitHandles), SR.ArgumentNull_Waithandles);
}
if (waitHandles.Length == 0)
{
@@ -261,15 +261,15 @@ namespace System.Threading
// in CoreCLR, and ArgumentNullException in the desktop CLR. This is ugly, but so is breaking
// user code.
//
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyWaithandleArray"));
+ throw new ArgumentException(SR.Argument_EmptyWaithandleArray);
}
if (waitHandles.Length > MAX_WAITHANDLES)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_MaxWaitHandles"));
+ throw new NotSupportedException(SR.NotSupported_MaxWaitHandles);
}
if (-1 > millisecondsTimeout)
{
- throw new ArgumentOutOfRangeException(nameof(millisecondsTimeout), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(millisecondsTimeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
}
Contract.EndContractBlock();
WaitHandle[] internalWaitHandles = new WaitHandle[waitHandles.Length];
@@ -278,7 +278,7 @@ namespace System.Threading
WaitHandle waitHandle = waitHandles[i];
if (waitHandle == null)
- throw new ArgumentNullException("waitHandles[" + i + "]", Environment.GetResourceString("ArgumentNull_ArrayElement"));
+ throw new ArgumentNullException("waitHandles[" + i + "]", SR.ArgumentNull_ArrayElement);
internalWaitHandles[i] = waitHandle;
}
@@ -312,7 +312,7 @@ namespace System.Threading
long tm = (long)timeout.TotalMilliseconds;
if (-1 > tm || (long)Int32.MaxValue < tm)
{
- throw new ArgumentOutOfRangeException(nameof(timeout), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(timeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
}
return WaitAll(waitHandles, (int)tm, exitContext);
}
@@ -350,19 +350,19 @@ namespace System.Threading
{
if (waitHandles == null)
{
- throw new ArgumentNullException(nameof(waitHandles), Environment.GetResourceString("ArgumentNull_Waithandles"));
+ throw new ArgumentNullException(nameof(waitHandles), SR.ArgumentNull_Waithandles);
}
if (waitHandles.Length == 0)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyWaithandleArray"));
+ throw new ArgumentException(SR.Argument_EmptyWaithandleArray);
}
if (MAX_WAITHANDLES < waitHandles.Length)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_MaxWaitHandles"));
+ throw new NotSupportedException(SR.NotSupported_MaxWaitHandles);
}
if (-1 > millisecondsTimeout)
{
- throw new ArgumentOutOfRangeException(nameof(millisecondsTimeout), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(millisecondsTimeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
}
Contract.EndContractBlock();
WaitHandle[] internalWaitHandles = new WaitHandle[waitHandles.Length];
@@ -371,7 +371,7 @@ namespace System.Threading
WaitHandle waitHandle = waitHandles[i];
if (waitHandle == null)
- throw new ArgumentNullException("waitHandles[" + i + "]", Environment.GetResourceString("ArgumentNull_ArrayElement"));
+ throw new ArgumentNullException("waitHandles[" + i + "]", SR.ArgumentNull_ArrayElement);
internalWaitHandles[i] = waitHandle;
}
@@ -409,7 +409,7 @@ namespace System.Threading
long tm = (long)timeout.TotalMilliseconds;
if (-1 > tm || (long)Int32.MaxValue < tm)
{
- throw new ArgumentOutOfRangeException(nameof(timeout), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(timeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
}
return WaitAny(waitHandles, (int)tm, exitContext);
}
@@ -448,7 +448,7 @@ namespace System.Threading
WaitHandle toWaitOn)
{
#if PLATFORM_UNIX
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.Arg_PlatformNotSupported); // https://github.com/dotnet/coreclr/issues/10441
#else
return SignalAndWait(toSignal, toWaitOn, -1, false);
#endif
@@ -461,12 +461,12 @@ namespace System.Threading
bool exitContext)
{
#if PLATFORM_UNIX
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.Arg_PlatformNotSupported); // https://github.com/dotnet/coreclr/issues/10441
#else
long tm = (long)timeout.TotalMilliseconds;
if (-1 > tm || (long)Int32.MaxValue < tm)
{
- throw new ArgumentOutOfRangeException(nameof(timeout), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(timeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
}
return SignalAndWait(toSignal, toWaitOn, (int)tm, exitContext);
#endif
@@ -480,7 +480,7 @@ namespace System.Threading
bool exitContext)
{
#if PLATFORM_UNIX
- throw new PlatformNotSupportedException();
+ throw new PlatformNotSupportedException(SR.Arg_PlatformNotSupported); // https://github.com/dotnet/coreclr/issues/10441
#else
if (null == toSignal)
{
@@ -492,7 +492,7 @@ namespace System.Threading
}
if (-1 > millisecondsTimeout)
{
- throw new ArgumentOutOfRangeException(nameof(millisecondsTimeout), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegOrNegative1"));
+ throw new ArgumentOutOfRangeException(nameof(millisecondsTimeout), SR.ArgumentOutOfRange_NeedNonNegOrNegative1);
}
Contract.EndContractBlock();
@@ -507,7 +507,7 @@ namespace System.Threading
if (ERROR_TOO_MANY_POSTS == ret)
{
- throw new InvalidOperationException(Environment.GetResourceString("Threading.WaitHandleTooManyPosts"));
+ throw new InvalidOperationException(SR.Threading_WaitHandleTooManyPosts);
}
//Object was signaled
diff --git a/src/mscorlib/src/System/Threading/WaitHandleCannotBeOpenedException.cs b/src/mscorlib/src/System/Threading/WaitHandleCannotBeOpenedException.cs
index acdb19cfac..7bc6e289e3 100644
--- a/src/mscorlib/src/System/Threading/WaitHandleCannotBeOpenedException.cs
+++ b/src/mscorlib/src/System/Threading/WaitHandleCannotBeOpenedException.cs
@@ -15,7 +15,7 @@ namespace System.Threading
public class WaitHandleCannotBeOpenedException : ApplicationException
{
- public WaitHandleCannotBeOpenedException() : base(Environment.GetResourceString("Threading.WaitHandleCannotBeOpenedException"))
+ public WaitHandleCannotBeOpenedException() : base(SR.Threading_WaitHandleCannotBeOpenedException)
{
SetErrorCode(__HResults.COR_E_WAITHANDLECANNOTBEOPENED);
}
diff --git a/src/mscorlib/src/System/ThrowHelper.cs b/src/mscorlib/src/System/ThrowHelper.cs
index 978e47a80f..4dcf8d4511 100644
--- a/src/mscorlib/src/System/ThrowHelper.cs
+++ b/src/mscorlib/src/System/ThrowHelper.cs
@@ -9,7 +9,7 @@
// The old way to throw an exception generates quite a lot IL code and assembly code.
// Following is an example:
// C# source
-// throw new ArgumentNullException(nameof(key), Environment.GetResourceString("ArgumentNull_Key"));
+// throw new ArgumentNullException(nameof(key), SR.ArgumentNull_Key);
// IL code:
// IL_0003: ldstr "key"
// IL_0008: ldstr "ArgumentNull_Key"
@@ -38,6 +38,7 @@
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
+using System.Diagnostics;
using System.Diagnostics.Contracts;
namespace System
@@ -52,7 +53,7 @@ namespace System
internal static void ThrowInvalidTypeWithPointersNotSupported(Type targetType)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidTypeWithPointersNotSupported", targetType));
+ throw new ArgumentException(SR.Format(SR.Argument_InvalidTypeWithPointersNotSupported, targetType));
}
internal static void ThrowIndexOutOfRangeException()
@@ -67,17 +68,7 @@ namespace System
internal static void ThrowArgumentException_DestinationTooShort()
{
- throw new ArgumentException(Environment.GetResourceString("Argument_DestinationTooShort"));
- }
-
- internal static void ThrowNotSupportedException_CannotCallEqualsOnSpan()
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_CannotCallEqualsOnSpan"));
- }
-
- internal static void ThrowNotSupportedException_CannotCallGetHashCodeOnSpan()
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_CannotCallGetHashCodeOnSpan"));
+ throw new ArgumentException(SR.Argument_DestinationTooShort);
}
internal static void ThrowArgumentOutOfRange_IndexException()
@@ -122,7 +113,7 @@ namespace System
private static ArgumentException GetAddingDuplicateWithKeyArgumentException(object key)
{
- return new ArgumentException(Environment.GetResourceString("Argument_AddingDuplicateWithKey", key));
+ return new ArgumentException(SR.Format(SR.Argument_AddingDuplicateWithKey, key));
}
internal static void ThrowAddingDuplicateWithKeyArgumentException(object key)
@@ -290,12 +281,12 @@ namespace System
private static ArgumentException GetWrongKeyTypeArgumentException(object key, Type targetType)
{
- return new ArgumentException(Environment.GetResourceString("Arg_WrongType", key, targetType), nameof(key));
+ return new ArgumentException(SR.Format(SR.Arg_WrongType, key, targetType), nameof(key));
}
private static ArgumentException GetWrongValueTypeArgumentException(object value, Type targetType)
{
- return new ArgumentException(Environment.GetResourceString("Arg_WrongType", value, targetType), nameof(value));
+ return new ArgumentException(SR.Format(SR.Arg_WrongType, value, targetType), nameof(value));
}
internal static ArgumentOutOfRangeException GetArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
@@ -341,7 +332,7 @@ namespace System
Debug.Assert(Enum.IsDefined(typeof(ExceptionResource), resource),
"The enum value is not defined, please check the ExceptionResource Enum.");
- return Environment.GetResourceString(resource.ToString());
+ return SR.GetResourceString(resource.ToString());
}
}
diff --git a/src/mscorlib/src/System/TimeSpan.cs b/src/mscorlib/src/System/TimeSpan.cs
index cd7b454694..9166656d0f 100644
--- a/src/mscorlib/src/System/TimeSpan.cs
+++ b/src/mscorlib/src/System/TimeSpan.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// 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.
@@ -93,7 +93,7 @@ namespace System
{
Int64 totalMilliSeconds = ((Int64)days * 3600 * 24 + (Int64)hours * 3600 + (Int64)minutes * 60 + seconds) * 1000 + milliseconds;
if (totalMilliSeconds > MaxMilliSeconds || totalMilliSeconds < MinMilliSeconds)
- throw new ArgumentOutOfRangeException(null, Environment.GetResourceString("Overflow_TimeSpanTooLong"));
+ throw new ArgumentOutOfRangeException(null, SR.Overflow_TimeSpanTooLong);
_ticks = (long)totalMilliSeconds * TicksPerMillisecond;
}
@@ -169,7 +169,7 @@ namespace System
// sign was opposite.
// >> 63 gives the sign bit (either 64 1's or 64 0's).
if ((_ticks >> 63 == ts._ticks >> 63) && (_ticks >> 63 != result >> 63))
- throw new OverflowException(Environment.GetResourceString("Overflow_TimeSpanTooLong"));
+ throw new OverflowException(SR.Overflow_TimeSpanTooLong);
return new TimeSpan(result);
}
@@ -189,7 +189,7 @@ namespace System
{
if (value == null) return 1;
if (!(value is TimeSpan))
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeTimeSpan"));
+ throw new ArgumentException(SR.Arg_MustBeTimeSpan);
long t = ((TimeSpan)value)._ticks;
if (_ticks > t) return 1;
if (_ticks < t) return -1;
@@ -212,7 +212,7 @@ namespace System
public TimeSpan Duration()
{
if (Ticks == TimeSpan.MinValue.Ticks)
- throw new OverflowException(Environment.GetResourceString("Overflow_Duration"));
+ throw new OverflowException(SR.Overflow_Duration);
Contract.EndContractBlock();
return new TimeSpan(_ticks >= 0 ? _ticks : -_ticks);
}
@@ -249,12 +249,12 @@ namespace System
private static TimeSpan Interval(double value, int scale)
{
if (Double.IsNaN(value))
- throw new ArgumentException(Environment.GetResourceString("Arg_CannotBeNaN"));
+ throw new ArgumentException(SR.Arg_CannotBeNaN);
Contract.EndContractBlock();
double tmp = value * scale;
double millis = tmp + (value >= 0 ? 0.5 : -0.5);
if ((millis > Int64.MaxValue / TicksPerMillisecond) || (millis < Int64.MinValue / TicksPerMillisecond))
- throw new OverflowException(Environment.GetResourceString("Overflow_TimeSpanTooLong"));
+ throw new OverflowException(SR.Overflow_TimeSpanTooLong);
return new TimeSpan((long)millis * TicksPerMillisecond);
}
@@ -271,7 +271,7 @@ namespace System
public TimeSpan Negate()
{
if (Ticks == TimeSpan.MinValue.Ticks)
- throw new OverflowException(Environment.GetResourceString("Overflow_NegateTwosCompNum"));
+ throw new OverflowException(SR.Overflow_NegateTwosCompNum);
Contract.EndContractBlock();
return new TimeSpan(-_ticks);
}
@@ -288,10 +288,16 @@ namespace System
// sign was opposite from the first argument's sign.
// >> 63 gives the sign bit (either 64 1's or 64 0's).
if ((_ticks >> 63 != ts._ticks >> 63) && (_ticks >> 63 != result >> 63))
- throw new OverflowException(Environment.GetResourceString("Overflow_TimeSpanTooLong"));
+ throw new OverflowException(SR.Overflow_TimeSpanTooLong);
return new TimeSpan(result);
}
+ public TimeSpan Multiply(double factor) => this * factor;
+
+ public TimeSpan Divide(double divisor) => this / divisor;
+
+ public double Divide(TimeSpan ts) => this / ts;
+
public static TimeSpan FromTicks(long value)
{
return new TimeSpan(value);
@@ -303,7 +309,7 @@ namespace System
// which is less than 2^44, meaning we won't overflow totalSeconds.
long totalSeconds = (long)hour * 3600 + (long)minute * 60 + (long)second;
if (totalSeconds > MaxSeconds || totalSeconds < MinSeconds)
- throw new ArgumentOutOfRangeException(null, Environment.GetResourceString("Overflow_TimeSpanTooLong"));
+ throw new ArgumentOutOfRangeException(null, SR.Overflow_TimeSpanTooLong);
return totalSeconds * TicksPerSecond;
}
@@ -386,7 +392,7 @@ namespace System
public static TimeSpan operator -(TimeSpan t)
{
if (t._ticks == TimeSpan.MinValue._ticks)
- throw new OverflowException(Environment.GetResourceString("Overflow_NegateTwosCompNum"));
+ throw new OverflowException(SR.Overflow_NegateTwosCompNum);
return new TimeSpan(-t._ticks);
}
@@ -409,7 +415,7 @@ namespace System
{
if (double.IsNaN(factor))
{
- throw new ArgumentException(Environment.GetResourceString("Arg_CannotBeNaN"), nameof(factor));
+ throw new ArgumentException(SR.Arg_CannotBeNaN, nameof(factor));
}
// Rounding to the nearest tick is as close to the result we would have with unlimited
@@ -417,7 +423,7 @@ namespace System
double ticks = Math.Round(timeSpan.Ticks * factor);
if (ticks > long.MaxValue | ticks < long.MinValue)
{
- throw new OverflowException(Environment.GetResourceString("Overflow_TimeSpanTooLong"));
+ throw new OverflowException(SR.Overflow_TimeSpanTooLong);
}
return FromTicks((long)ticks);
@@ -429,13 +435,13 @@ namespace System
{
if (double.IsNaN(divisor))
{
- throw new ArgumentException(Environment.GetResourceString("Arg_CannotBeNaN"), nameof(divisor));
+ throw new ArgumentException(SR.Arg_CannotBeNaN, nameof(divisor));
}
double ticks = Math.Round(timeSpan.Ticks / divisor);
if (ticks > long.MaxValue | ticks < long.MinValue || double.IsNaN(ticks))
{
- throw new OverflowException(Environment.GetResourceString("Overflow_TimeSpanTooLong"));
+ throw new OverflowException(SR.Overflow_TimeSpanTooLong);
}
return FromTicks((long)ticks);
diff --git a/src/mscorlib/src/System/TimeZoneInfo.AdjustmentRule.cs b/src/mscorlib/src/System/TimeZoneInfo.AdjustmentRule.cs
index 21238fb94f..c0c27eeab7 100644
--- a/src/mscorlib/src/System/TimeZoneInfo.AdjustmentRule.cs
+++ b/src/mscorlib/src/System/TimeZoneInfo.AdjustmentRule.cs
@@ -144,22 +144,22 @@ namespace System
{
if (dateStart.Kind != DateTimeKind.Unspecified && dateStart.Kind != DateTimeKind.Utc)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_DateTimeKindMustBeUnspecifiedOrUtc"), nameof(dateStart));
+ throw new ArgumentException(SR.Argument_DateTimeKindMustBeUnspecifiedOrUtc, nameof(dateStart));
}
if (dateEnd.Kind != DateTimeKind.Unspecified && dateEnd.Kind != DateTimeKind.Utc)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_DateTimeKindMustBeUnspecifiedOrUtc"), nameof(dateEnd));
+ throw new ArgumentException(SR.Argument_DateTimeKindMustBeUnspecifiedOrUtc, nameof(dateEnd));
}
if (daylightTransitionStart.Equals(daylightTransitionEnd) && !noDaylightTransitions)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_TransitionTimesAreIdentical"), nameof(daylightTransitionEnd));
+ throw new ArgumentException(SR.Argument_TransitionTimesAreIdentical, nameof(daylightTransitionEnd));
}
if (dateStart > dateEnd)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_OutOfOrderDateTimes"), nameof(dateStart));
+ throw new ArgumentException(SR.Argument_OutOfOrderDateTimes, nameof(dateStart));
}
// This cannot use UtcOffsetOutOfRange to account for the scenario where Samoa moved across the International Date Line,
@@ -168,22 +168,22 @@ namespace System
// to be -23 (what it takes to go from UTC+13 to UTC-10)
if (daylightDelta.TotalHours < -23.0 || daylightDelta.TotalHours > 14.0)
{
- throw new ArgumentOutOfRangeException(nameof(daylightDelta), daylightDelta, Environment.GetResourceString("ArgumentOutOfRange_UtcOffset"));
+ throw new ArgumentOutOfRangeException(nameof(daylightDelta), daylightDelta, SR.ArgumentOutOfRange_UtcOffset);
}
if (daylightDelta.Ticks % TimeSpan.TicksPerMinute != 0)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_TimeSpanHasSeconds"), nameof(daylightDelta));
+ throw new ArgumentException(SR.Argument_TimeSpanHasSeconds, nameof(daylightDelta));
}
if (dateStart != DateTime.MinValue && dateStart.Kind == DateTimeKind.Unspecified && dateStart.TimeOfDay != TimeSpan.Zero)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_DateTimeHasTimeOfDay"), nameof(dateStart));
+ throw new ArgumentException(SR.Argument_DateTimeHasTimeOfDay, nameof(dateStart));
}
if (dateEnd != DateTime.MaxValue && dateEnd.Kind == DateTimeKind.Unspecified && dateEnd.TimeOfDay != TimeSpan.Zero)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_DateTimeHasTimeOfDay"), nameof(dateEnd));
+ throw new ArgumentException(SR.Argument_DateTimeHasTimeOfDay, nameof(dateEnd));
}
Contract.EndContractBlock();
}
@@ -200,7 +200,7 @@ namespace System
}
catch (ArgumentException e)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"), e);
+ throw new SerializationException(SR.Serialization_InvalidData, e);
}
}
diff --git a/src/mscorlib/src/System/TimeZoneInfo.StringSerializer.cs b/src/mscorlib/src/System/TimeZoneInfo.StringSerializer.cs
index 9c1d5c3502..c52f7307d8 100644
--- a/src/mscorlib/src/System/TimeZoneInfo.StringSerializer.cs
+++ b/src/mscorlib/src/System/TimeZoneInfo.StringSerializer.cs
@@ -112,11 +112,11 @@ namespace System
}
catch (ArgumentException ex)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"), ex);
+ throw new SerializationException(SR.Serialization_InvalidData, ex);
}
catch (InvalidTimeZoneException ex)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"), ex);
+ throw new SerializationException(SR.Serialization_InvalidData, ex);
}
}
@@ -181,7 +181,7 @@ namespace System
{
if (c != Esc && c != Sep && c != Lhs && c != Rhs)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidEscapeSequence", c));
+ throw new SerializationException(SR.Format(SR.Serialization_InvalidEscapeSequence, c));
}
}
@@ -194,7 +194,7 @@ namespace System
{
if (_currentTokenStartIndex < 0 || _currentTokenStartIndex >= _serializedText.Length)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
}
State tokenState = State.NotEscaped;
@@ -236,7 +236,7 @@ namespace System
case '\0':
// invalid character
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
default:
break;
@@ -244,7 +244,7 @@ namespace System
}
}
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
}
/// <summary>
@@ -258,11 +258,11 @@ namespace System
// first verify the internal state of the object
if (_state == State.EndOfLine)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
}
if (_currentTokenStartIndex < 0 || _currentTokenStartIndex >= _serializedText.Length)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
}
State tokenState = State.NotEscaped;
StringBuilder token = StringBuilderCache.Acquire(InitialCapacityForString);
@@ -286,11 +286,11 @@ namespace System
case Lhs:
// '[' is an unexpected character
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
case Rhs:
// ']' is an unexpected character
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
case Sep:
_currentTokenStartIndex = i + 1;
@@ -306,7 +306,7 @@ namespace System
case '\0':
// invalid character
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
default:
token.Append(_serializedText[i]);
@@ -320,10 +320,10 @@ namespace System
if (tokenState == State.Escaped)
{
// we are at the end of the serialized text but we are in an escaped state
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidEscapeSequence", string.Empty));
+ throw new SerializationException(SR.Format(SR.Serialization_InvalidEscapeSequence, string.Empty));
}
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
}
/// <summary>
@@ -335,7 +335,7 @@ namespace System
DateTime time;
if (!DateTime.TryParseExact(token, format, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.None, out time))
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
}
return time;
}
@@ -352,7 +352,7 @@ namespace System
}
catch (ArgumentOutOfRangeException e)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"), e);
+ throw new SerializationException(SR.Serialization_InvalidData, e);
}
}
@@ -365,7 +365,7 @@ namespace System
int value;
if (!int.TryParse(token, NumberStyles.AllowLeadingSign /* "[sign]digits" */, CultureInfo.InvariantCulture, out value))
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
}
return value;
}
@@ -391,11 +391,11 @@ namespace System
// the AdjustmentRule array must end with a separator
if (_state == State.EndOfLine)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
}
if (_currentTokenStartIndex < 0 || _currentTokenStartIndex >= _serializedText.Length)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
}
return count != 0 ? rules.ToArray() : null;
@@ -414,7 +414,7 @@ namespace System
if (_currentTokenStartIndex < 0 || _currentTokenStartIndex >= _serializedText.Length)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
}
// check to see if the very first token we see is the separator
@@ -426,7 +426,7 @@ namespace System
// verify the current token is a left-hand-side marker ("[")
if (_serializedText[_currentTokenStartIndex] != Lhs)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
}
_currentTokenStartIndex++;
@@ -442,7 +442,7 @@ namespace System
if (_state == State.EndOfLine || _currentTokenStartIndex >= _serializedText.Length)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
}
// Check if we have baseUtcOffsetDelta in the serialized string and then deserialize it
@@ -460,7 +460,7 @@ namespace System
if (_state == State.EndOfLine || _currentTokenStartIndex >= _serializedText.Length)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
}
if (_serializedText[_currentTokenStartIndex] != Rhs)
@@ -486,7 +486,7 @@ namespace System
}
catch (ArgumentException e)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"), e);
+ throw new SerializationException(SR.Serialization_InvalidData, e);
}
// finally set the state to either EndOfLine or StartOfToken for the next caller
@@ -514,19 +514,19 @@ namespace System
//
// we are at the end of the line or we are starting at a "]" character
//
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
}
if (_currentTokenStartIndex < 0 || _currentTokenStartIndex >= _serializedText.Length)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
}
// verify the current token is a left-hand-side marker ("[")
if (_serializedText[_currentTokenStartIndex] != Lhs)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
}
_currentTokenStartIndex++;
@@ -534,7 +534,7 @@ namespace System
if (isFixedDate != 0 && isFixedDate != 1)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
}
TransitionTime transition;
@@ -554,7 +554,7 @@ namespace System
}
catch (ArgumentException e)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"), e);
+ throw new SerializationException(SR.Serialization_InvalidData, e);
}
}
else
@@ -568,7 +568,7 @@ namespace System
}
catch (ArgumentException e)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"), e);
+ throw new SerializationException(SR.Serialization_InvalidData, e);
}
}
@@ -576,7 +576,7 @@ namespace System
if (_state == State.EndOfLine || _currentTokenStartIndex >= _serializedText.Length)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
}
if (_serializedText[_currentTokenStartIndex] != Rhs)
@@ -606,7 +606,7 @@ namespace System
if (!sepFound)
{
// we MUST end on a separator
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"));
+ throw new SerializationException(SR.Serialization_InvalidData);
}
// finally set the state to either EndOfLine or StartOfToken for the next caller
diff --git a/src/mscorlib/src/System/TimeZoneInfo.TransitionTime.cs b/src/mscorlib/src/System/TimeZoneInfo.TransitionTime.cs
index 354d0acdb7..1e1d9d328b 100644
--- a/src/mscorlib/src/System/TimeZoneInfo.TransitionTime.cs
+++ b/src/mscorlib/src/System/TimeZoneInfo.TransitionTime.cs
@@ -75,37 +75,37 @@ namespace System
{
if (timeOfDay.Kind != DateTimeKind.Unspecified)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_DateTimeKindMustBeUnspecified"), nameof(timeOfDay));
+ throw new ArgumentException(SR.Argument_DateTimeKindMustBeUnspecified, nameof(timeOfDay));
}
// Month range 1-12
if (month < 1 || month > 12)
{
- throw new ArgumentOutOfRangeException(nameof(month), Environment.GetResourceString("ArgumentOutOfRange_MonthParam"));
+ throw new ArgumentOutOfRangeException(nameof(month), SR.ArgumentOutOfRange_MonthParam);
}
// Day range 1-31
if (day < 1 || day > 31)
{
- throw new ArgumentOutOfRangeException(nameof(day), Environment.GetResourceString("ArgumentOutOfRange_DayParam"));
+ throw new ArgumentOutOfRangeException(nameof(day), SR.ArgumentOutOfRange_DayParam);
}
// Week range 1-5
if (week < 1 || week > 5)
{
- throw new ArgumentOutOfRangeException(nameof(week), Environment.GetResourceString("ArgumentOutOfRange_Week"));
+ throw new ArgumentOutOfRangeException(nameof(week), SR.ArgumentOutOfRange_Week);
}
// DayOfWeek range 0-6
if ((int)dayOfWeek < 0 || (int)dayOfWeek > 6)
{
- throw new ArgumentOutOfRangeException(nameof(dayOfWeek), Environment.GetResourceString("ArgumentOutOfRange_DayOfWeek"));
+ throw new ArgumentOutOfRangeException(nameof(dayOfWeek), SR.ArgumentOutOfRange_DayOfWeek);
}
Contract.EndContractBlock();
if (timeOfDay.Year != 1 || timeOfDay.Month != 1 || timeOfDay.Day != 1 || (timeOfDay.Ticks % TimeSpan.TicksPerMillisecond != 0))
{
- throw new ArgumentException(Environment.GetResourceString("Argument_DateTimeHasTicks"), nameof(timeOfDay));
+ throw new ArgumentException(SR.Argument_DateTimeHasTicks, nameof(timeOfDay));
}
}
@@ -120,7 +120,7 @@ namespace System
}
catch (ArgumentException e)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"), e);
+ throw new SerializationException(SR.Serialization_InvalidData, e);
}
}
diff --git a/src/mscorlib/src/System/TimeZoneInfo.Unix.cs b/src/mscorlib/src/System/TimeZoneInfo.Unix.cs
index bb12c6b079..02baadcfe5 100644
--- a/src/mscorlib/src/System/TimeZoneInfo.Unix.cs
+++ b/src/mscorlib/src/System/TimeZoneInfo.Unix.cs
@@ -97,6 +97,12 @@ namespace System
private void GetDisplayName(Interop.GlobalizationInterop.TimeZoneDisplayNameType nameType, ref string displayName)
{
+ if (GlobalizationMode.Invariant)
+ {
+ displayName = _standardDisplayName;
+ return;
+ }
+
string timeZoneDisplayName;
bool result = Interop.CallStringMethod(
(locale, id, type, stringBuilder) => Interop.GlobalizationInterop.GetTimeZoneDisplayName(
@@ -213,7 +219,7 @@ namespace System
}
catch (IOException ex)
{
- e = new InvalidTimeZoneException(Environment.GetResourceString("InvalidTimeZone_InvalidFileData", id, timeZoneFilePath), ex);
+ e = new InvalidTimeZoneException(SR.Format(SR.InvalidTimeZone_InvalidFileData, id, timeZoneFilePath), ex);
return TimeZoneInfoResult.InvalidTimeZoneException;
}
@@ -221,7 +227,7 @@ namespace System
if (value == null)
{
- e = new InvalidTimeZoneException(Environment.GetResourceString("InvalidTimeZone_InvalidFileData", id, timeZoneFilePath));
+ e = new InvalidTimeZoneException(SR.Format(SR.InvalidTimeZone_InvalidFileData, id, timeZoneFilePath));
return TimeZoneInfoResult.InvalidTimeZoneException;
}
@@ -565,7 +571,7 @@ namespace System
}
else if (id.Length == 0 || id.Contains("\0"))
{
- throw new TimeZoneNotFoundException(Environment.GetResourceString("TimeZoneNotFound_MissingData", id));
+ throw new TimeZoneNotFoundException(SR.Format(SR.TimeZoneNotFound_MissingData, id));
}
TimeZoneInfo value;
@@ -592,11 +598,11 @@ namespace System
}
else if (result == TimeZoneInfoResult.SecurityException)
{
- throw new SecurityException(Environment.GetResourceString("Security_CannotReadFileData", id), e);
+ throw new SecurityException(SR.Format(SR.Security_CannotReadFileData, id), e);
}
else
{
- throw new TimeZoneNotFoundException(Environment.GetResourceString("TimeZoneNotFound_MissingData", id), e);
+ throw new TimeZoneNotFoundException(SR.Format(SR.TimeZoneNotFound_MissingData, id), e);
}
}
@@ -920,14 +926,14 @@ namespace System
return transitionTypes[0];
}
- throw new InvalidTimeZoneException(Environment.GetResourceString("InvalidTimeZone_NoTTInfoStructures"));
+ throw new InvalidTimeZoneException(SR.InvalidTimeZone_NoTTInfoStructures);
}
/// <summary>
/// Creates an AdjustmentRule given the POSIX TZ environment variable string.
/// </summary>
/// <remarks>
- /// See http://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html for the format and semantics of this POSX string.
+ /// See http://man7.org/linux/man-pages/man3/tzset.3.html for the format and semantics of this POSX string.
/// </remarks>
private static AdjustmentRule TZif_CreateAdjustmentRuleForPosixFormat(string posixFormat, DateTime startTransitionDate, TimeSpan timeZoneBaseUtcOffset)
{
@@ -1054,7 +1060,7 @@ namespace System
DayOfWeek day;
if (!TZif_ParseMDateRule(date, out month, out week, out day))
{
- throw new InvalidTimeZoneException(Environment.GetResourceString("InvalidTimeZone_UnparseablePosixMDateString", date));
+ throw new InvalidTimeZoneException(SR.Format(SR.InvalidTimeZone_UnparseablePosixMDateString, date));
}
DateTime timeOfDay;
@@ -1097,7 +1103,7 @@ namespace System
// One of them *could* be supported if we relaxed the TransitionTime validation rules, and allowed
// "IsFixedDateRule = true, Month = 0, Day = n" to mean the nth day of the year, picking one of the rules above
- throw new InvalidTimeZoneException(Environment.GetResourceString("InvalidTimeZone_JulianDayNotSupported"));
+ throw new InvalidTimeZoneException(SR.InvalidTimeZone_JulianDayNotSupported);
}
}
@@ -1189,8 +1195,32 @@ namespace System
return !string.IsNullOrEmpty(standardName) && !string.IsNullOrEmpty(standardOffset);
}
- private static string TZif_ParsePosixName(string posixFormat, ref int index) =>
- TZif_ParsePosixString(posixFormat, ref index, c => char.IsDigit(c) || c == '+' || c == '-' || c == ',');
+ private static string TZif_ParsePosixName(string posixFormat, ref int index)
+ {
+ bool isBracketEnclosed = index < posixFormat.Length && posixFormat[index] == '<';
+ if (isBracketEnclosed)
+ {
+ // move past the opening bracket
+ index++;
+
+ string result = TZif_ParsePosixString(posixFormat, ref index, c => c == '>');
+
+ // move past the closing bracket
+ if (index < posixFormat.Length && posixFormat[index] == '>')
+ {
+ index++;
+ }
+
+ return result;
+ }
+ else
+ {
+ return TZif_ParsePosixString(
+ posixFormat,
+ ref index,
+ c => char.IsDigit(c) || c == '+' || c == '-' || c == ',');
+ }
+ }
private static string TZif_ParsePosixOffset(string posixFormat, ref int index) =>
TZif_ParsePosixString(posixFormat, ref index, c => !char.IsDigit(c) && c != '+' && c != '-' && c != ':');
@@ -1395,7 +1425,7 @@ namespace System
{
if (data == null || data.Length < index + Length)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_TimeZoneInfoInvalidTZif"), nameof(data));
+ throw new ArgumentException(SR.Argument_TimeZoneInfoInvalidTZif, nameof(data));
}
Contract.EndContractBlock();
UtcOffset = new TimeSpan(0, 0, TZif_ToInt32(data, index + 00));
@@ -1431,7 +1461,7 @@ namespace System
if (Magic != 0x545A6966)
{
// 0x545A6966 = {0x54, 0x5A, 0x69, 0x66} = "TZif"
- throw new ArgumentException(Environment.GetResourceString("Argument_TimeZoneInfoBadTZif"), nameof(data));
+ throw new ArgumentException(SR.Argument_TimeZoneInfoBadTZif, nameof(data));
}
byte version = data[index + 04];
diff --git a/src/mscorlib/src/System/TimeZoneInfo.Win32.cs b/src/mscorlib/src/System/TimeZoneInfo.Win32.cs
index 09a926f1aa..f359a2a2a3 100644
--- a/src/mscorlib/src/System/TimeZoneInfo.Win32.cs
+++ b/src/mscorlib/src/System/TimeZoneInfo.Win32.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
+using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Security;
@@ -348,7 +349,7 @@ namespace System
}
else if (id.Length == 0 || id.Length > MaxKeyLength || id.Contains("\0"))
{
- throw new TimeZoneNotFoundException(Environment.GetResourceString("TimeZoneNotFound_MissingData", id));
+ throw new TimeZoneNotFoundException(SR.Format(SR.TimeZoneNotFound_MissingData, id));
}
TimeZoneInfo value;
@@ -369,15 +370,15 @@ namespace System
}
else if (result == TimeZoneInfoResult.InvalidTimeZoneException)
{
- throw new InvalidTimeZoneException(Environment.GetResourceString("InvalidTimeZone_InvalidRegistryData", id), e);
+ throw new InvalidTimeZoneException(SR.Format(SR.InvalidTimeZone_InvalidRegistryData, id), e);
}
else if (result == TimeZoneInfoResult.SecurityException)
{
- throw new SecurityException(Environment.GetResourceString("Security_CannotReadRegistryData", id), e);
+ throw new SecurityException(SR.Format(SR.Security_CannotReadRegistryData, id), e);
}
else
{
- throw new TimeZoneNotFoundException(Environment.GetResourceString("TimeZoneNotFound_MissingData", id), e);
+ throw new TimeZoneNotFoundException(SR.Format(SR.TimeZoneNotFound_MissingData, id), e);
}
}
diff --git a/src/mscorlib/src/System/TimeZoneInfo.cs b/src/mscorlib/src/System/TimeZoneInfo.cs
index 1f628793d4..29ea33a8ad 100644
--- a/src/mscorlib/src/System/TimeZoneInfo.cs
+++ b/src/mscorlib/src/System/TimeZoneInfo.cs
@@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
+using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Globalization;
using System.Runtime.Serialization;
@@ -164,7 +165,7 @@ namespace System
{
if (!SupportsDaylightSavingTime)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_DateTimeOffsetIsNotAmbiguous"), nameof(dateTimeOffset));
+ throw new ArgumentException(SR.Argument_DateTimeOffsetIsNotAmbiguous, nameof(dateTimeOffset));
}
Contract.EndContractBlock();
@@ -180,7 +181,7 @@ namespace System
if (!isAmbiguous)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_DateTimeOffsetIsNotAmbiguous"), nameof(dateTimeOffset));
+ throw new ArgumentException(SR.Argument_DateTimeOffsetIsNotAmbiguous, nameof(dateTimeOffset));
}
// the passed in dateTime is ambiguous in this TimeZoneInfo instance
@@ -210,7 +211,7 @@ namespace System
{
if (!SupportsDaylightSavingTime)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_DateTimeIsNotAmbiguous"), nameof(dateTime));
+ throw new ArgumentException(SR.Argument_DateTimeIsNotAmbiguous, nameof(dateTime));
}
Contract.EndContractBlock();
@@ -240,7 +241,7 @@ namespace System
if (!isAmbiguous)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_DateTimeIsNotAmbiguous"), nameof(dateTime));
+ throw new ArgumentException(SR.Argument_DateTimeIsNotAmbiguous, nameof(dateTime));
}
// the passed in dateTime is ambiguous in this TimeZoneInfo instance
@@ -649,7 +650,7 @@ namespace System
DateTimeKind sourceKind = cachedData.GetCorrespondingKind(sourceTimeZone);
if (((flags & TimeZoneInfoOptions.NoThrowOnInvalidTime) == 0) && (dateTime.Kind != DateTimeKind.Unspecified) && (dateTime.Kind != sourceKind))
{
- throw new ArgumentException(Environment.GetResourceString("Argument_ConvertMismatch"), nameof(sourceTimeZone));
+ throw new ArgumentException(SR.Argument_ConvertMismatch, nameof(sourceTimeZone));
}
//
@@ -675,7 +676,7 @@ namespace System
// period that supports DST
if (((flags & TimeZoneInfoOptions.NoThrowOnInvalidTime) == 0) && GetIsInvalidTime(dateTime, sourceRule, sourceDaylightTime))
{
- throw new ArgumentException(Environment.GetResourceString("Argument_DateTimeIsInvalid"), nameof(dateTime));
+ throw new ArgumentException(SR.Argument_DateTimeIsInvalid, nameof(dateTime));
}
sourceIsDaylightSavings = GetIsDaylightSavings(dateTime, sourceRule, sourceDaylightTime, flags);
@@ -767,7 +768,7 @@ namespace System
}
if (source.Length == 0)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidSerializedString", source), nameof(source));
+ throw new ArgumentException(SR.Format(SR.Argument_InvalidSerializedString, source), nameof(source));
}
Contract.EndContractBlock();
@@ -1001,16 +1002,16 @@ namespace System
if (adjustmentRulesSupportDst != _supportsDaylightSavingTime)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_CorruptField", "SupportsDaylightSavingTime"));
+ throw new SerializationException(SR.Format(SR.Serialization_CorruptField, "SupportsDaylightSavingTime"));
}
}
catch (ArgumentException e)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"), e);
+ throw new SerializationException(SR.Serialization_InvalidData, e);
}
catch (InvalidTimeZoneException e)
{
- throw new SerializationException(Environment.GetResourceString("Serialization_InvalidData"), e);
+ throw new SerializationException(SR.Serialization_InvalidData, e);
}
}
@@ -1062,14 +1063,29 @@ namespace System
(dateTime + BaseUtcOffset).Date :
dateTime.Date;
- for (int i = 0; i < _adjustmentRules.Length; i++)
+ int low = 0;
+ int high = _adjustmentRules.Length - 1;
+
+ while (low <= high)
{
- AdjustmentRule rule = _adjustmentRules[i];
- AdjustmentRule previousRule = i > 0 ? _adjustmentRules[i - 1] : rule;
- if (IsAdjustmentRuleValid(rule, previousRule, dateTime, date, dateTimeisUtc))
+ int median = low + ((high - low) >> 1);
+
+ AdjustmentRule rule = _adjustmentRules[median];
+ AdjustmentRule previousRule = median > 0 ? _adjustmentRules[median - 1] : rule;
+
+ int compareResult = CompareAdjustmentRuleToDateTime(rule, previousRule, dateTime, date, dateTimeisUtc);
+ if (compareResult == 0)
{
return rule;
}
+ else if (compareResult < 0)
+ {
+ low = median + 1;
+ }
+ else
+ {
+ high = median - 1;
+ }
}
return null;
@@ -1078,7 +1094,12 @@ namespace System
/// <summary>
/// Determines if 'rule' is the correct AdjustmentRule for the given dateTime.
/// </summary>
- private bool IsAdjustmentRuleValid(AdjustmentRule rule, AdjustmentRule previousRule,
+ /// <returns>
+ /// A value less than zero if rule is for times before dateTime.
+ /// Zero if rule is correct for dateTime.
+ /// A value greater than zero if rule is for times after dateTime.
+ /// </returns>
+ private int CompareAdjustmentRuleToDateTime(AdjustmentRule rule, AdjustmentRule previousRule,
DateTime dateTime, DateTime dateOnly, bool dateTimeisUtc)
{
bool isAfterStart;
@@ -1100,7 +1121,7 @@ namespace System
if (!isAfterStart)
{
- return false;
+ return 1;
}
bool isBeforeEnd;
@@ -1118,7 +1139,7 @@ namespace System
isBeforeEnd = dateOnly <= rule.DateEnd;
}
- return isBeforeEnd;
+ return isBeforeEnd ? 0 : -1;
}
/// <summary>
@@ -1880,17 +1901,17 @@ namespace System
if (id.Length == 0)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidId", id), nameof(id));
+ throw new ArgumentException(SR.Format(SR.Argument_InvalidId, id), nameof(id));
}
if (UtcOffsetOutOfRange(baseUtcOffset))
{
- throw new ArgumentOutOfRangeException(nameof(baseUtcOffset), Environment.GetResourceString("ArgumentOutOfRange_UtcOffset"));
+ throw new ArgumentOutOfRangeException(nameof(baseUtcOffset), SR.ArgumentOutOfRange_UtcOffset);
}
if (baseUtcOffset.Ticks % TimeSpan.TicksPerMinute != 0)
{
- throw new ArgumentException(Environment.GetResourceString("Argument_TimeSpanHasSeconds"), nameof(baseUtcOffset));
+ throw new ArgumentException(SR.Argument_TimeSpanHasSeconds, nameof(baseUtcOffset));
}
Contract.EndContractBlock();
@@ -1914,7 +1935,7 @@ namespace System
if (current == null)
{
- throw new InvalidTimeZoneException(Environment.GetResourceString("Argument_AdjustmentRulesNoNulls"));
+ throw new InvalidTimeZoneException(SR.Argument_AdjustmentRulesNoNulls);
}
// FUTURE: check to see if this rule supports Daylight Saving Time
@@ -1923,13 +1944,13 @@ namespace System
if (UtcOffsetOutOfRange(baseUtcOffset + current.DaylightDelta))
{
- throw new InvalidTimeZoneException(Environment.GetResourceString("ArgumentOutOfRange_UtcOffsetAndDaylightDelta"));
+ throw new InvalidTimeZoneException(SR.ArgumentOutOfRange_UtcOffsetAndDaylightDelta);
}
if (prev != null && current.DateStart <= prev.DateEnd)
{
// verify the rules are in chronological order and the DateStart/DateEnd do not overlap
- throw new InvalidTimeZoneException(Environment.GetResourceString("Argument_AdjustmentRulesOutOfOrder"));
+ throw new InvalidTimeZoneException(SR.Argument_AdjustmentRulesOutOfOrder);
}
}
}
diff --git a/src/mscorlib/src/System/Tuple.cs b/src/mscorlib/src/System/Tuple.cs
index 02894c2a2b..a118df02bd 100644
--- a/src/mscorlib/src/System/Tuple.cs
+++ b/src/mscorlib/src/System/Tuple.cs
@@ -148,7 +148,7 @@ namespace System
if (objTuple == null)
{
- throw new ArgumentException(Environment.GetResourceString("ArgumentException_TupleIncorrectType", this.GetType().ToString()), "other");
+ throw new ArgumentException(SR.Format(SR.ArgumentException_TupleIncorrectType, this.GetType().ToString()), "other");
}
return comparer.Compare(m_Item1, objTuple.m_Item1);
@@ -250,7 +250,7 @@ namespace System
if (objTuple == null)
{
- throw new ArgumentException(Environment.GetResourceString("ArgumentException_TupleIncorrectType", this.GetType().ToString()), "other");
+ throw new ArgumentException(SR.Format(SR.ArgumentException_TupleIncorrectType, this.GetType().ToString()), "other");
}
int c = 0;
@@ -367,7 +367,7 @@ namespace System
if (objTuple == null)
{
- throw new ArgumentException(Environment.GetResourceString("ArgumentException_TupleIncorrectType", this.GetType().ToString()), "other");
+ throw new ArgumentException(SR.Format(SR.ArgumentException_TupleIncorrectType, this.GetType().ToString()), "other");
}
int c = 0;
@@ -495,7 +495,7 @@ namespace System
if (objTuple == null)
{
- throw new ArgumentException(Environment.GetResourceString("ArgumentException_TupleIncorrectType", this.GetType().ToString()), "other");
+ throw new ArgumentException(SR.Format(SR.ArgumentException_TupleIncorrectType, this.GetType().ToString()), "other");
}
int c = 0;
@@ -634,7 +634,7 @@ namespace System
if (objTuple == null)
{
- throw new ArgumentException(Environment.GetResourceString("ArgumentException_TupleIncorrectType", this.GetType().ToString()), "other");
+ throw new ArgumentException(SR.Format(SR.ArgumentException_TupleIncorrectType, this.GetType().ToString()), "other");
}
int c = 0;
@@ -784,7 +784,7 @@ namespace System
if (objTuple == null)
{
- throw new ArgumentException(Environment.GetResourceString("ArgumentException_TupleIncorrectType", this.GetType().ToString()), "other");
+ throw new ArgumentException(SR.Format(SR.ArgumentException_TupleIncorrectType, this.GetType().ToString()), "other");
}
int c = 0;
@@ -945,7 +945,7 @@ namespace System
if (objTuple == null)
{
- throw new ArgumentException(Environment.GetResourceString("ArgumentException_TupleIncorrectType", this.GetType().ToString()), "other");
+ throw new ArgumentException(SR.Format(SR.ArgumentException_TupleIncorrectType, this.GetType().ToString()), "other");
}
int c = 0;
@@ -1077,7 +1077,7 @@ namespace System
{
if (!(rest is ITupleInternal))
{
- throw new ArgumentException(Environment.GetResourceString("ArgumentException_TupleLastArgumentNotATuple"));
+ throw new ArgumentException(SR.ArgumentException_TupleLastArgumentNotATuple);
}
m_Item1 = item1;
@@ -1122,7 +1122,7 @@ namespace System
if (objTuple == null)
{
- throw new ArgumentException(Environment.GetResourceString("ArgumentException_TupleIncorrectType", this.GetType().ToString()), "other");
+ throw new ArgumentException(SR.Format(SR.ArgumentException_TupleIncorrectType, this.GetType().ToString()), "other");
}
int c = 0;
diff --git a/src/mscorlib/src/System/Type.CoreCLR.cs b/src/mscorlib/src/System/Type.CoreCLR.cs
new file mode 100644
index 0000000000..9c443b472a
--- /dev/null
+++ b/src/mscorlib/src/System/Type.CoreCLR.cs
@@ -0,0 +1,206 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Diagnostics.Contracts;
+using StackCrawlMark = System.Threading.StackCrawlMark;
+
+namespace System
+{
+ public abstract partial class Type : MemberInfo, IReflect
+ {
+ public bool IsInterface
+ {
+ get
+ {
+ RuntimeType rt = this as RuntimeType;
+ if (rt != null)
+ return RuntimeTypeHandle.IsInterface(rt);
+ return ((GetAttributeFlagsImpl() & TypeAttributes.ClassSemanticsMask) == TypeAttributes.Interface);
+ }
+ }
+
+ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
+ public static Type GetType(String typeName, bool throwOnError, bool ignoreCase)
+ {
+ StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
+ return RuntimeType.GetType(typeName, throwOnError, ignoreCase, false, ref stackMark);
+ }
+
+ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
+ public static Type GetType(String typeName, bool throwOnError)
+ {
+ StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
+ return RuntimeType.GetType(typeName, throwOnError, false, false, ref stackMark);
+ }
+
+ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
+ public static Type GetType(String typeName)
+ {
+ StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
+ return RuntimeType.GetType(typeName, false, false, false, ref stackMark);
+ }
+
+ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
+ public static Type GetType(
+ string typeName,
+ Func<AssemblyName, Assembly> assemblyResolver,
+ Func<Assembly, string, bool, Type> typeResolver)
+ {
+ StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
+ return TypeNameParser.GetType(typeName, assemblyResolver, typeResolver, false, false, ref stackMark);
+ }
+
+ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
+ public static Type GetType(
+ string typeName,
+ Func<AssemblyName, Assembly> assemblyResolver,
+ Func<Assembly, string, bool, Type> typeResolver,
+ bool throwOnError)
+ {
+ StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
+ return TypeNameParser.GetType(typeName, assemblyResolver, typeResolver, throwOnError, false, ref stackMark);
+ }
+
+ [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
+ public static Type GetType(
+ string typeName,
+ Func<AssemblyName, Assembly> assemblyResolver,
+ Func<Assembly, string, bool, Type> typeResolver,
+ bool throwOnError,
+ bool ignoreCase)
+ {
+ StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
+ return TypeNameParser.GetType(typeName, assemblyResolver, typeResolver, throwOnError, ignoreCase, ref stackMark);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // This will return a class based upon the progID. This is provided for
+ // COM classic support. Program ID's are not used in COM+ because they
+ // have been superceded by namespace. (This routine is called this instead
+ // of getClass() because of the name conflict with the first method above.)
+ //
+ // param progID: the progID of the class to retrieve
+ // returns: the class object associated to the progID
+ ////
+ public static Type GetTypeFromProgID(String progID, String server, bool throwOnError)
+ {
+ return RuntimeType.GetTypeFromProgIDImpl(progID, server, throwOnError);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // This will return a class based upon the CLSID. This is provided for
+ // COM classic support.
+ //
+ // param CLSID: the CLSID of the class to retrieve
+ // returns: the class object associated to the CLSID
+ ////
+ public static Type GetTypeFromCLSID(Guid clsid, String server, bool throwOnError)
+ {
+ return RuntimeType.GetTypeFromCLSIDImpl(clsid, server, throwOnError);
+ }
+
+ internal virtual RuntimeTypeHandle GetTypeHandleInternal()
+ {
+ return TypeHandle;
+ }
+
+ // Given a class handle, this will return the class for that handle.
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal static extern RuntimeType GetTypeFromHandleUnsafe(IntPtr handle);
+
+ [Pure]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ public static extern Type GetTypeFromHandle(RuntimeTypeHandle handle);
+
+
+
+
+#if FEATURE_COMINTEROP
+ internal bool IsWindowsRuntimeObject
+ {
+ [Pure]
+ get { return IsWindowsRuntimeObjectImpl(); }
+ }
+
+ internal bool IsExportedToWindowsRuntime
+ {
+ [Pure]
+ get { return IsExportedToWindowsRuntimeImpl(); }
+ }
+
+
+ // Protected routine to determine if this class represents a Windows Runtime object
+ virtual internal bool IsWindowsRuntimeObjectImpl()
+ {
+ throw new NotImplementedException();
+ }
+
+ // Determines if this type is exported to WinRT (i.e. is an activatable class in a managed .winmd)
+ virtual internal bool IsExportedToWindowsRuntimeImpl()
+ {
+ throw new NotImplementedException();
+ }
+#endif // FEATURE_COMINTEROP
+
+ internal bool NeedsReflectionSecurityCheck
+ {
+ get
+ {
+ if (!IsVisible)
+ {
+ // Types which are not externally visible require security checks
+ return true;
+ }
+ else if (IsSecurityCritical && !IsSecuritySafeCritical)
+ {
+ // Critical types require security checks
+ return true;
+ }
+ else if (IsGenericType)
+ {
+ // If any of the generic arguments to this type require a security check, then this type
+ // also requires one.
+ foreach (Type genericArgument in GetGenericArguments())
+ {
+ if (genericArgument.NeedsReflectionSecurityCheck)
+ {
+ return true;
+ }
+ }
+ }
+ else if (IsArray || IsPointer)
+ {
+ return GetElementType().NeedsReflectionSecurityCheck;
+ }
+
+ return false;
+ }
+ }
+
+ // This is only ever called on RuntimeType objects.
+ internal string FormatTypeName()
+ {
+ return FormatTypeName(false);
+ }
+
+ internal virtual string FormatTypeName(bool serialization)
+ {
+ throw new NotImplementedException();
+ }
+
+ [Pure]
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern bool operator ==(Type left, Type right);
+
+ [Pure]
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public static extern bool operator !=(Type left, Type right);
+
+ // Exists to faciliate code sharing between CoreCLR and CoreRT.
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ internal bool IsRuntimeImplemented() => this is RuntimeType;
+ }
+}
diff --git a/src/mscorlib/src/System/Type.cs b/src/mscorlib/src/System/Type.cs
deleted file mode 100644
index cb6c9ab4fd..0000000000
--- a/src/mscorlib/src/System/Type.cs
+++ /dev/null
@@ -1,1867 +0,0 @@
-// 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.
-
-//
-//
-//
-// Implements System.Type
-//
-// ======================================================================================
-
-namespace System
-{
- using System;
- using System.Reflection;
- using System.Threading;
- using System.Runtime;
- using System.Runtime.Remoting;
- using System.Runtime.InteropServices;
- using System.Runtime.CompilerServices;
- using System.Security;
- using System.Collections;
- using System.Collections.Generic;
- using System.Runtime.Versioning;
- using System.Diagnostics.Contracts;
- using CultureInfo = System.Globalization.CultureInfo;
- using StackCrawlMark = System.Threading.StackCrawlMark;
- using DebuggerStepThroughAttribute = System.Diagnostics.DebuggerStepThroughAttribute;
-
- [Serializable]
- public abstract class Type : MemberInfo, IReflect
- {
- //
- // System.Type is appdomain agile type. Appdomain agile types cannot have precise static constructors. Make
- // sure to never introduce one here!
- //
- public static readonly MemberFilter FilterAttribute = new MemberFilter(__Filters.Instance.FilterAttribute);
- public static readonly MemberFilter FilterName = new MemberFilter(__Filters.Instance.FilterName);
- public static readonly MemberFilter FilterNameIgnoreCase = new MemberFilter(__Filters.Instance.FilterIgnoreCase);
-
- public static readonly Object Missing = System.Reflection.Missing.Value;
-
- public static readonly char Delimiter = '.';
-
- // EmptyTypes is used to indicate that we are looking for someting without any parameters.
- public readonly static Type[] EmptyTypes = EmptyArray<Type>.Value;
-
- // The Default binder. We create a single one and expose that.
- private static Binder defaultBinder;
-
-
- protected Type() { }
-
-
- // MemberInfo Methods....
- // The Member type Field.
- public override MemberTypes MemberType
- {
- get { return System.Reflection.MemberTypes.TypeInfo; }
- }
-
- // Return the class that declared this type.
- public override Type DeclaringType
- {
- get { return null; }
- }
-
- public virtual MethodBase DeclaringMethod { get { return null; } }
-
- // Return the class that was used to obtain this type.
- public override Type ReflectedType
- {
- get { return null; }
- }
-
- ////////////////////////////////////////////////////////////////////////////////
- // This is a static method that returns a Class based upon the name of the class
- // (this name needs to be fully qualified with the package name and is
- // case-sensitive by default).
- ////
-
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
- public static Type GetType(String typeName, bool throwOnError, bool ignoreCase)
- {
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- return RuntimeType.GetType(typeName, throwOnError, ignoreCase, false, ref stackMark);
- }
-
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
- public static Type GetType(String typeName, bool throwOnError)
- {
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- return RuntimeType.GetType(typeName, throwOnError, false, false, ref stackMark);
- }
-
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
- public static Type GetType(String typeName)
- {
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- return RuntimeType.GetType(typeName, false, false, false, ref stackMark);
- }
-
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
- public static Type GetType(
- string typeName,
- Func<AssemblyName, Assembly> assemblyResolver,
- Func<Assembly, string, bool, Type> typeResolver)
- {
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- return TypeNameParser.GetType(typeName, assemblyResolver, typeResolver, false, false, ref stackMark);
- }
-
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
- public static Type GetType(
- string typeName,
- Func<AssemblyName, Assembly> assemblyResolver,
- Func<Assembly, string, bool, Type> typeResolver,
- bool throwOnError)
- {
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- return TypeNameParser.GetType(typeName, assemblyResolver, typeResolver, throwOnError, false, ref stackMark);
- }
-
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
- public static Type GetType(
- string typeName,
- Func<AssemblyName, Assembly> assemblyResolver,
- Func<Assembly, string, bool, Type> typeResolver,
- bool throwOnError,
- bool ignoreCase)
- {
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- return TypeNameParser.GetType(typeName, assemblyResolver, typeResolver, throwOnError, ignoreCase, ref stackMark);
- }
-
- [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod
- public static Type ReflectionOnlyGetType(String typeName, bool throwIfNotFound, bool ignoreCase)
- {
- if (typeName == null)
- throw new ArgumentNullException(nameof(typeName));
- if (typeName.Length == 0 && throwIfNotFound)
- throw new TypeLoadException(Environment.GetResourceString("Arg_TypeLoadNullStr"));
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_ReflectionOnlyGetType"));
- }
-
- public virtual Type MakePointerType() { throw new NotSupportedException(); }
- public virtual StructLayoutAttribute StructLayoutAttribute { get { throw new NotSupportedException(); } }
- public virtual Type MakeByRefType() { throw new NotSupportedException(); }
- public virtual Type MakeArrayType() { throw new NotSupportedException(); }
- public virtual Type MakeArrayType(int rank) { throw new NotSupportedException(); }
-
- ////////////////////////////////////////////////////////////////////////////////
- // This will return a class based upon the progID. This is provided for
- // COM classic support. Program ID's are not used in COM+ because they
- // have been superceded by namespace. (This routine is called this instead
- // of getClass() because of the name conflict with the first method above.)
- //
- // param progID: the progID of the class to retrieve
- // returns: the class object associated to the progID
- ////
- public static Type GetTypeFromProgID(String progID)
- {
- return RuntimeType.GetTypeFromProgIDImpl(progID, null, false);
- }
-
- ////////////////////////////////////////////////////////////////////////////////
- // This will return a class based upon the progID. This is provided for
- // COM classic support. Program ID's are not used in COM+ because they
- // have been superceded by namespace. (This routine is called this instead
- // of getClass() because of the name conflict with the first method above.)
- //
- // param progID: the progID of the class to retrieve
- // returns: the class object associated to the progID
- ////
- public static Type GetTypeFromProgID(String progID, bool throwOnError)
- {
- return RuntimeType.GetTypeFromProgIDImpl(progID, null, throwOnError);
- }
-
- public static Type GetTypeFromProgID(String progID, String server)
- {
- return RuntimeType.GetTypeFromProgIDImpl(progID, server, false);
- }
-
- public static Type GetTypeFromProgID(String progID, String server, bool throwOnError)
- {
- return RuntimeType.GetTypeFromProgIDImpl(progID, server, throwOnError);
- }
-
- ////////////////////////////////////////////////////////////////////////////////
- // This will return a class based upon the CLSID. This is provided for
- // COM classic support.
- //
- // param CLSID: the CLSID of the class to retrieve
- // returns: the class object associated to the CLSID
- ////
- public static Type GetTypeFromCLSID(Guid clsid)
- {
- return RuntimeType.GetTypeFromCLSIDImpl(clsid, null, false);
- }
-
- public static Type GetTypeFromCLSID(Guid clsid, bool throwOnError)
- {
- return RuntimeType.GetTypeFromCLSIDImpl(clsid, null, throwOnError);
- }
-
- public static Type GetTypeFromCLSID(Guid clsid, String server)
- {
- return RuntimeType.GetTypeFromCLSIDImpl(clsid, server, false);
- }
-
- public static Type GetTypeFromCLSID(Guid clsid, String server, bool throwOnError)
- {
- return RuntimeType.GetTypeFromCLSIDImpl(clsid, server, throwOnError);
- }
-
- // GetTypeCode
- // This method will return a TypeCode for the passed
- // type.
- public static TypeCode GetTypeCode(Type type)
- {
- if (type == null)
- return TypeCode.Empty;
- return type.GetTypeCodeImpl();
- }
-
- protected virtual TypeCode GetTypeCodeImpl()
- {
- // System.RuntimeType overrides GetTypeCodeInternal
- // so we can assume that this is not a runtime type
-
- // this is true for EnumBuilder but not the other System.Type subclasses in BCL
- if (this != UnderlyingSystemType && UnderlyingSystemType != null)
- return Type.GetTypeCode(UnderlyingSystemType);
-
- return TypeCode.Object;
- }
-
- // Property representing the GUID associated with a class.
- public abstract Guid GUID
- {
- get;
- }
-
- // Return the Default binder used by the system.
- static public Binder DefaultBinder
- {
- get
- {
- // Allocate the default binder if it hasn't been allocated yet.
- if (defaultBinder == null)
- CreateBinder();
- return defaultBinder;
- }
- }
-
- static private void CreateBinder()
- {
- if (defaultBinder == null)
- {
- DefaultBinder binder = new DefaultBinder();
- Interlocked.CompareExchange<Binder>(ref defaultBinder, binder, null);
- }
- }
-
- // Description of the Binding Process.
- // We must invoke a method that is accessable and for which the provided
- // parameters have the most specific match. A method may be called if
- // 1. The number of parameters in the method declaration equals the number of
- // arguments provided to the invocation
- // 2. The type of each argument can be converted by the binder to the
- // type of the type of the parameter.
- //
- // The binder will find all of the matching methods. These method are found based
- // upon the type of binding requested (MethodInvoke, Get/Set Properties). The set
- // of methods is filtered by the name, number of arguments and a set of search modifiers
- // defined in the Binder.
- //
- // After the method is selected, it will be invoked. Accessability is checked
- // at that point. The search may be control which set of methods are searched based
- // upon the accessibility attribute associated with the method.
- //
- // The BindToMethod method is responsible for selecting the method to be invoked.
- // For the default binder, the most specific method will be selected.
- //
- // This will invoke a specific member...
-
- abstract public Object InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target,
- Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters);
-
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- public Object InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
- {
- return InvokeMember(name, invokeAttr, binder, target, args, null, culture, null);
- }
-
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- public Object InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args)
- {
- return InvokeMember(name, invokeAttr, binder, target, args, null, null, null);
- }
-
-
- // Module Property associated with a class.
- public new abstract Module Module { get; }
-
- // Assembly Property associated with a class.
- public abstract Assembly Assembly
- {
- [Pure]
- get;
- }
-
- // Assembly Property associated with a class.
- // A class handle is a unique integer value associated with
- // each class. The handle is unique during the process life time.
- public virtual RuntimeTypeHandle TypeHandle
- {
- [Pure]
- get
- {
- throw new NotSupportedException();
- }
- }
-
- internal virtual RuntimeTypeHandle GetTypeHandleInternal()
- {
- return TypeHandle;
- }
-
- public static RuntimeTypeHandle GetTypeHandle(Object o)
- {
- if (o == null)
- throw new ArgumentNullException(null, Environment.GetResourceString("Arg_InvalidHandle"));
- return new RuntimeTypeHandle((RuntimeType)o.GetType());
- }
-
- // Given a class handle, this will return the class for that handle.
- [MethodImpl(MethodImplOptions.InternalCall)]
- internal static extern RuntimeType GetTypeFromHandleUnsafe(IntPtr handle);
-
- [Pure]
- [MethodImpl(MethodImplOptions.InternalCall)]
- public static extern Type GetTypeFromHandle(RuntimeTypeHandle handle);
-
-
- // Return the fully qualified name. The name does contain the namespace.
- public abstract String FullName
- {
- [Pure]
- get;
- }
-
- // Return the name space of the class.
- public abstract String Namespace
- {
- [Pure]
- get;
- }
-
-
- public abstract String AssemblyQualifiedName
- {
- [Pure]
- get;
- }
-
-
- [Pure]
- public virtual int GetArrayRank()
- {
- Contract.Ensures(Contract.Result<int>() >= 0);
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_SubclassOverride"));
- }
-
- // Returns the base class for a class. If this is an interface or has
- // no base class null is returned. Object is the only Type that does not
- // have a base class.
- public abstract Type BaseType
- {
- [Pure]
- get;
- }
-
-
- // GetConstructor
- // This method will search for the specified constructor. For constructors,
- // unlike everything else, the default is to not look for static methods. The
- // reason is that we don't typically expose the class initializer.
- public ConstructorInfo GetConstructor(BindingFlags bindingAttr,
- Binder binder,
- CallingConventions callConvention,
- Type[] types,
- ParameterModifier[] modifiers)
- {
- // Must provide some types (Type[0] for nothing)
- if (types == null)
- throw new ArgumentNullException(nameof(types));
- Contract.EndContractBlock();
- for (int i = 0; i < types.Length; i++)
- if (types[i] == null)
- throw new ArgumentNullException(nameof(types));
- return GetConstructorImpl(bindingAttr, binder, callConvention, types, modifiers);
- }
-
- public ConstructorInfo GetConstructor(BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers)
- {
- if (types == null)
- throw new ArgumentNullException(nameof(types));
- Contract.EndContractBlock();
- for (int i = 0; i < types.Length; i++)
- if (types[i] == null)
- throw new ArgumentNullException(nameof(types));
- return GetConstructorImpl(bindingAttr, binder, CallingConventions.Any, types, modifiers);
- }
-
- public ConstructorInfo GetConstructor(Type[] types)
- {
- // The arguments are checked in the called version of GetConstructor.
- return GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, types, null);
- }
-
- abstract protected ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr,
- Binder binder,
- CallingConventions callConvention,
- Type[] types,
- ParameterModifier[] modifiers);
-
- // GetConstructors()
- // This routine will return an array of all constructors supported by the class.
- // Unlike everything else, the default is to not look for static methods. The
- // reason is that we don't typically expose the class initializer.
- public ConstructorInfo[] GetConstructors()
- {
- return GetConstructors(BindingFlags.Public | BindingFlags.Instance);
- }
-
- abstract public ConstructorInfo[] GetConstructors(BindingFlags bindingAttr);
-
- public ConstructorInfo TypeInitializer
- {
- get
- {
- return GetConstructorImpl(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic,
- null,
- CallingConventions.Any,
- Type.EmptyTypes,
- null);
- }
- }
-
-
- // Return a method based upon the passed criteria. The name of the method
- // must be provided, and exception is thrown if it is not. The bindingAttr
- // parameter indicates if non-public methods should be searched. The types
- // array indicates the types of the parameters being looked for.
- public MethodInfo GetMethod(String name,
- BindingFlags bindingAttr,
- Binder binder,
- CallingConventions callConvention,
- Type[] types,
- ParameterModifier[] modifiers)
- {
- if (name == null)
- throw new ArgumentNullException(nameof(name));
- if (types == null)
- throw new ArgumentNullException(nameof(types));
- Contract.EndContractBlock();
- for (int i = 0; i < types.Length; i++)
- if (types[i] == null)
- throw new ArgumentNullException(nameof(types));
- return GetMethodImpl(name, bindingAttr, binder, callConvention, types, modifiers);
- }
-
- public MethodInfo GetMethod(String name,
- BindingFlags bindingAttr,
- Binder binder,
- Type[] types,
- ParameterModifier[] modifiers)
- {
- if (name == null)
- throw new ArgumentNullException(nameof(name));
- if (types == null)
- throw new ArgumentNullException(nameof(types));
- Contract.EndContractBlock();
- for (int i = 0; i < types.Length; i++)
- if (types[i] == null)
- throw new ArgumentNullException(nameof(types));
- return GetMethodImpl(name, bindingAttr, binder, CallingConventions.Any, types, modifiers);
- }
-
- public MethodInfo GetMethod(String name, Type[] types, ParameterModifier[] modifiers)
- {
- if (name == null)
- throw new ArgumentNullException(nameof(name));
- if (types == null)
- throw new ArgumentNullException(nameof(types));
- Contract.EndContractBlock();
- for (int i = 0; i < types.Length; i++)
- if (types[i] == null)
- throw new ArgumentNullException(nameof(types));
- return GetMethodImpl(name, Type.DefaultLookup, null, CallingConventions.Any, types, modifiers);
- }
-
- public MethodInfo GetMethod(String name, Type[] types)
- {
- if (name == null)
- throw new ArgumentNullException(nameof(name));
- if (types == null)
- throw new ArgumentNullException(nameof(types));
- Contract.EndContractBlock();
- for (int i = 0; i < types.Length; i++)
- if (types[i] == null)
- throw new ArgumentNullException(nameof(types));
- return GetMethodImpl(name, Type.DefaultLookup, null, CallingConventions.Any, types, null);
- }
-
- public MethodInfo GetMethod(String name, BindingFlags bindingAttr)
- {
- if (name == null)
- throw new ArgumentNullException(nameof(name));
- Contract.EndContractBlock();
- return GetMethodImpl(name, bindingAttr, null, CallingConventions.Any, null, null);
- }
-
- public MethodInfo GetMethod(String name)
- {
- if (name == null)
- throw new ArgumentNullException(nameof(name));
- Contract.EndContractBlock();
- return GetMethodImpl(name, Type.DefaultLookup, null, CallingConventions.Any, null, null);
- }
-
- abstract protected MethodInfo GetMethodImpl(String name,
- BindingFlags bindingAttr,
- Binder binder,
- CallingConventions callConvention,
- Type[] types,
- ParameterModifier[] modifiers);
-
-
- // GetMethods
- // This routine will return all the methods implemented by the class
- public MethodInfo[] GetMethods()
- {
- return GetMethods(Type.DefaultLookup);
- }
-
- abstract public MethodInfo[] GetMethods(BindingFlags bindingAttr);
-
- // GetField
- // Get Field will return a specific field based upon name
- abstract public FieldInfo GetField(String name, BindingFlags bindingAttr);
-
-
- public FieldInfo GetField(String name)
- {
- return GetField(name, Type.DefaultLookup);
- }
-
-
- // GetFields
- // Get fields will return a full array of fields implemented by a class
- public FieldInfo[] GetFields()
- {
- return GetFields(Type.DefaultLookup);
- }
- abstract public FieldInfo[] GetFields(BindingFlags bindingAttr);
-
- // GetInterface
- // This method will return an interface (as a class) based upon
- // the passed in name.
- public Type GetInterface(String name)
- {
- return GetInterface(name, false);
- }
- abstract public Type GetInterface(String name, bool ignoreCase);
-
-
- // GetInterfaces
- // This method will return all of the interfaces implemented by a class
- abstract public Type[] GetInterfaces();
-
- // FindInterfaces
- // This method will filter the interfaces supported the class
- public virtual Type[] FindInterfaces(TypeFilter filter, Object filterCriteria)
- {
- if (filter == null)
- throw new ArgumentNullException(nameof(filter));
- Contract.EndContractBlock();
- Type[] c = GetInterfaces();
- int cnt = 0;
- for (int i = 0; i < c.Length; i++)
- {
- if (!filter(c[i], filterCriteria))
- c[i] = null;
- else
- cnt++;
- }
- if (cnt == c.Length)
- return c;
-
- Type[] ret = new Type[cnt];
- cnt = 0;
- for (int i = 0; i < c.Length; i++)
- {
- if (c[i] != null)
- ret[cnt++] = c[i];
- }
- return ret;
- }
-
- // GetEvent
- // This method will return a event by name if it is found.
- // null is returned if the event is not found
-
-
- public EventInfo GetEvent(String name)
- {
- return GetEvent(name, Type.DefaultLookup);
- }
- abstract public EventInfo GetEvent(String name, BindingFlags bindingAttr);
-
- // GetEvents
- // This method will return an array of EventInfo. If there are not Events
- // an empty array will be returned.
- virtual public EventInfo[] GetEvents()
- {
- return GetEvents(Type.DefaultLookup);
- }
- abstract public EventInfo[] GetEvents(BindingFlags bindingAttr);
-
-
- // Return a property based upon the passed criteria. The nameof the
- // parameter must be provided.
- public PropertyInfo GetProperty(String name, BindingFlags bindingAttr, Binder binder,
- Type returnType, Type[] types, ParameterModifier[] modifiers)
- {
- if (name == null)
- throw new ArgumentNullException(nameof(name));
- if (types == null)
- throw new ArgumentNullException(nameof(types));
- Contract.EndContractBlock();
- return GetPropertyImpl(name, bindingAttr, binder, returnType, types, modifiers);
- }
-
- public PropertyInfo GetProperty(String name, Type returnType, Type[] types, ParameterModifier[] modifiers)
- {
- if (name == null)
- throw new ArgumentNullException(nameof(name));
- if (types == null)
- throw new ArgumentNullException(nameof(types));
- Contract.EndContractBlock();
- return GetPropertyImpl(name, Type.DefaultLookup, null, returnType, types, modifiers);
- }
-
- public PropertyInfo GetProperty(String name, BindingFlags bindingAttr)
- {
- if (name == null)
- throw new ArgumentNullException(nameof(name));
- Contract.EndContractBlock();
- return GetPropertyImpl(name, bindingAttr, null, null, null, null);
- }
-
- public PropertyInfo GetProperty(String name, Type returnType, Type[] types)
- {
- if (name == null)
- throw new ArgumentNullException(nameof(name));
- if (types == null)
- throw new ArgumentNullException(nameof(types));
- Contract.EndContractBlock();
- return GetPropertyImpl(name, Type.DefaultLookup, null, returnType, types, null);
- }
-
- public PropertyInfo GetProperty(String name, Type[] types)
- {
- if (name == null)
- throw new ArgumentNullException(nameof(name));
- if (types == null)
- throw new ArgumentNullException(nameof(types));
- Contract.EndContractBlock();
- return GetPropertyImpl(name, Type.DefaultLookup, null, null, types, null);
- }
-
- public PropertyInfo GetProperty(String name, Type returnType)
- {
- if (name == null)
- throw new ArgumentNullException(nameof(name));
- if (returnType == null)
- throw new ArgumentNullException(nameof(returnType));
- Contract.EndContractBlock();
- return GetPropertyImpl(name, Type.DefaultLookup, null, returnType, null, null);
- }
-
- public PropertyInfo GetProperty(String name)
- {
- if (name == null)
- throw new ArgumentNullException(nameof(name));
- Contract.EndContractBlock();
- return GetPropertyImpl(name, Type.DefaultLookup, null, null, null, null);
- }
-
- protected abstract PropertyInfo GetPropertyImpl(String name, BindingFlags bindingAttr, Binder binder,
- Type returnType, Type[] types, ParameterModifier[] modifiers);
-
-
- // GetProperties
- // This method will return an array of all of the properties defined
- // for a Type.
- abstract public PropertyInfo[] GetProperties(BindingFlags bindingAttr);
- public PropertyInfo[] GetProperties()
- {
- return GetProperties(Type.DefaultLookup);
- }
-
- // GetNestedTypes()
- // This set of method will return any nested types that are found inside
- // of the type.
- public Type[] GetNestedTypes()
- {
- return GetNestedTypes(Type.DefaultLookup);
- }
-
- abstract public Type[] GetNestedTypes(BindingFlags bindingAttr);
-
- public Type GetNestedType(String name)
- {
- return GetNestedType(name, Type.DefaultLookup);
- }
-
- abstract public Type GetNestedType(String name, BindingFlags bindingAttr);
-
- // GetMember
- // This method will return all of the members which match the specified string
- // passed into the method
- public MemberInfo[] GetMember(String name)
- {
- return GetMember(name, Type.DefaultLookup);
- }
-
- virtual public MemberInfo[] GetMember(String name, BindingFlags bindingAttr)
- {
- return GetMember(name, MemberTypes.All, bindingAttr);
- }
-
- virtual public MemberInfo[] GetMember(String name, MemberTypes type, BindingFlags bindingAttr)
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_SubclassOverride"));
- }
-
-
- // GetMembers
- // This will return a Member array of all of the members of a class
- public MemberInfo[] GetMembers()
- {
- return GetMembers(Type.DefaultLookup);
- }
- abstract public MemberInfo[] GetMembers(BindingFlags bindingAttr);
-
- // GetDefaultMembers
- // This will return a MemberInfo that has been marked with the
- // DefaultMemberAttribute
- public virtual MemberInfo[] GetDefaultMembers()
- {
- throw new NotImplementedException();
- }
-
- // FindMembers
- // This will return a filtered version of the member information
- public virtual MemberInfo[] FindMembers(MemberTypes memberType, BindingFlags bindingAttr, MemberFilter filter, Object filterCriteria)
- {
- // Define the work arrays
- MethodInfo[] m = null;
- ConstructorInfo[] c = null;
- FieldInfo[] f = null;
- PropertyInfo[] p = null;
- EventInfo[] e = null;
- Type[] t = null;
-
- int i = 0;
- int cnt = 0; // Total Matchs
-
- // Check the methods
- if ((memberType & System.Reflection.MemberTypes.Method) != 0)
- {
- m = GetMethods(bindingAttr);
- if (filter != null)
- {
- for (i = 0; i < m.Length; i++)
- if (!filter(m[i], filterCriteria))
- m[i] = null;
- else
- cnt++;
- }
- else
- {
- cnt += m.Length;
- }
- }
-
- // Check the constructors
- if ((memberType & System.Reflection.MemberTypes.Constructor) != 0)
- {
- c = GetConstructors(bindingAttr);
- if (filter != null)
- {
- for (i = 0; i < c.Length; i++)
- if (!filter(c[i], filterCriteria))
- c[i] = null;
- else
- cnt++;
- }
- else
- {
- cnt += c.Length;
- }
- }
-
- // Check the fields
- if ((memberType & System.Reflection.MemberTypes.Field) != 0)
- {
- f = GetFields(bindingAttr);
- if (filter != null)
- {
- for (i = 0; i < f.Length; i++)
- if (!filter(f[i], filterCriteria))
- f[i] = null;
- else
- cnt++;
- }
- else
- {
- cnt += f.Length;
- }
- }
-
- // Check the Properties
- if ((memberType & System.Reflection.MemberTypes.Property) != 0)
- {
- p = GetProperties(bindingAttr);
- if (filter != null)
- {
- for (i = 0; i < p.Length; i++)
- if (!filter(p[i], filterCriteria))
- p[i] = null;
- else
- cnt++;
- }
- else
- {
- cnt += p.Length;
- }
- }
-
- // Check the Events
- if ((memberType & System.Reflection.MemberTypes.Event) != 0)
- {
- e = GetEvents(bindingAttr);
- if (filter != null)
- {
- for (i = 0; i < e.Length; i++)
- if (!filter(e[i], filterCriteria))
- e[i] = null;
- else
- cnt++;
- }
- else
- {
- cnt += e.Length;
- }
- }
-
- // Check the Types
- if ((memberType & System.Reflection.MemberTypes.NestedType) != 0)
- {
- t = GetNestedTypes(bindingAttr);
- if (filter != null)
- {
- for (i = 0; i < t.Length; i++)
- if (!filter(t[i], filterCriteria))
- t[i] = null;
- else
- cnt++;
- }
- else
- {
- cnt += t.Length;
- }
- }
-
- // Allocate the Member Info
- MemberInfo[] ret = new MemberInfo[cnt];
-
- // Copy the Methods
- cnt = 0;
- if (m != null)
- {
- for (i = 0; i < m.Length; i++)
- if (m[i] != null)
- ret[cnt++] = m[i];
- }
-
- // Copy the Constructors
- if (c != null)
- {
- for (i = 0; i < c.Length; i++)
- if (c[i] != null)
- ret[cnt++] = c[i];
- }
-
- // Copy the Fields
- if (f != null)
- {
- for (i = 0; i < f.Length; i++)
- if (f[i] != null)
- ret[cnt++] = f[i];
- }
-
- // Copy the Properties
- if (p != null)
- {
- for (i = 0; i < p.Length; i++)
- if (p[i] != null)
- ret[cnt++] = p[i];
- }
-
- // Copy the Events
- if (e != null)
- {
- for (i = 0; i < e.Length; i++)
- if (e[i] != null)
- ret[cnt++] = e[i];
- }
-
- // Copy the Types
- if (t != null)
- {
- for (i = 0; i < t.Length; i++)
- if (t[i] != null)
- ret[cnt++] = t[i];
- }
-
- return ret;
- }
-
- ////////////////////////////////////////////////////////////////////////////////
- //
- // Attributes
- //
- // The attributes are all treated as read-only properties on a class. Most of
- // these boolean properties have flag values defined in this class and act like
- // a bit mask of attributes. There are also a set of boolean properties that
- // relate to the classes relationship to other classes and to the state of the
- // class inside the runtime.
- //
- ////////////////////////////////////////////////////////////////////////////////
-
- public bool IsNested
- {
- [Pure]
- get
- {
- return DeclaringType != null;
- }
- }
-
- // The attribute property on the Type.
- public TypeAttributes Attributes
- {
- [Pure]
- get { return GetAttributeFlagsImpl(); }
- }
-
- public virtual GenericParameterAttributes GenericParameterAttributes
- {
- get { throw new NotSupportedException(); }
- }
-
- public bool IsVisible
- {
- [Pure]
- get
- {
- RuntimeType rt = this as RuntimeType;
- if (rt != null)
- return RuntimeTypeHandle.IsVisible(rt);
-
- if (IsGenericParameter)
- return true;
-
- if (HasElementType)
- return GetElementType().IsVisible;
-
- Type type = this;
- while (type.IsNested)
- {
- if (!type.IsNestedPublic)
- return false;
-
- // this should be null for non-nested types.
- type = type.DeclaringType;
- }
-
- // Now "type" should be a top level type
- if (!type.IsPublic)
- return false;
-
- if (IsGenericType && !IsGenericTypeDefinition)
- {
- foreach (Type t in GetGenericArguments())
- {
- if (!t.IsVisible)
- return false;
- }
- }
-
- return true;
- }
- }
-
- public bool IsNotPublic
- {
- [Pure]
- get { return ((GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.NotPublic); }
- }
-
- public bool IsPublic
- {
- [Pure]
- get { return ((GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.Public); }
- }
-
- public bool IsNestedPublic
- {
- [Pure]
- get { return ((GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPublic); }
- }
-
- public bool IsNestedPrivate
- {
- [Pure]
- get { return ((GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPrivate); }
- }
- public bool IsNestedFamily
- {
- [Pure]
- get { return ((GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamily); }
- }
- public bool IsNestedAssembly
- {
- [Pure]
- get { return ((GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.NestedAssembly); }
- }
- public bool IsNestedFamANDAssem
- {
- [Pure]
- get { return ((GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamANDAssem); }
- }
- public bool IsNestedFamORAssem
- {
- [Pure]
- get { return ((GetAttributeFlagsImpl() & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamORAssem); }
- }
-
- public bool IsAutoLayout
- {
- [Pure]
- get { return ((GetAttributeFlagsImpl() & TypeAttributes.LayoutMask) == TypeAttributes.AutoLayout); }
- }
- public bool IsLayoutSequential
- {
- [Pure]
- get { return ((GetAttributeFlagsImpl() & TypeAttributes.LayoutMask) == TypeAttributes.SequentialLayout); }
- }
- public bool IsExplicitLayout
- {
- [Pure]
- get { return ((GetAttributeFlagsImpl() & TypeAttributes.LayoutMask) == TypeAttributes.ExplicitLayout); }
- }
-
- public bool IsClass
- {
- [Pure]
- get { return ((GetAttributeFlagsImpl() & TypeAttributes.ClassSemanticsMask) == TypeAttributes.Class && !IsValueType); }
- }
-
- public bool IsInterface
- {
- [Pure]
- get
- {
- RuntimeType rt = this as RuntimeType;
- if (rt != null)
- return RuntimeTypeHandle.IsInterface(rt);
-
- return ((GetAttributeFlagsImpl() & TypeAttributes.ClassSemanticsMask) == TypeAttributes.Interface);
- }
- }
-
- public bool IsValueType
- {
- [Pure]
- get { return IsValueTypeImpl(); }
- }
-
- public bool IsAbstract
- {
- [Pure]
- get { return ((GetAttributeFlagsImpl() & TypeAttributes.Abstract) != 0); }
- }
-
- public bool IsSealed
- {
- [Pure]
- get { return ((GetAttributeFlagsImpl() & TypeAttributes.Sealed) != 0); }
- }
-
- public virtual bool IsEnum
- {
- [Pure]
- get
- {
- // This will return false for a non-runtime Type object unless it overrides IsSubclassOf.
- return IsSubclassOf(RuntimeType.EnumType);
- }
- }
-
- public bool IsSpecialName
- {
- [Pure]
- get { return ((GetAttributeFlagsImpl() & TypeAttributes.SpecialName) != 0); }
- }
-
- public bool IsImport
- {
- [Pure]
- get { return ((GetAttributeFlagsImpl() & TypeAttributes.Import) != 0); }
- }
-
- public virtual bool IsSerializable
- {
- [Pure]
- get
- {
- if ((GetAttributeFlagsImpl() & TypeAttributes.Serializable) != 0)
- return true;
-
- RuntimeType rt = this.UnderlyingSystemType as RuntimeType;
-
- if (rt != null)
- return rt.IsSpecialSerializableType();
-
- return false;
- }
- }
-
- public bool IsAnsiClass
- {
- [Pure]
- get { return ((GetAttributeFlagsImpl() & TypeAttributes.StringFormatMask) == TypeAttributes.AnsiClass); }
- }
-
- public bool IsUnicodeClass
- {
- [Pure]
- get { return ((GetAttributeFlagsImpl() & TypeAttributes.StringFormatMask) == TypeAttributes.UnicodeClass); }
- }
-
- public bool IsAutoClass
- {
- [Pure]
- get { return ((GetAttributeFlagsImpl() & TypeAttributes.StringFormatMask) == TypeAttributes.AutoClass); }
- }
-
- // These are not backed up by attributes. Instead they are implemented
- // based internally.
- public bool IsArray
- {
- [Pure]
- get { return IsArrayImpl(); }
- }
-
- public virtual bool IsSZArray
- {
- [Pure]
- get { throw new NotImplementedException(); }
- }
-
- public virtual bool IsGenericType
- {
- [Pure]
- get { return false; }
- }
-
- public virtual bool IsGenericTypeDefinition
- {
- [Pure]
- get { return false; }
- }
-
- public virtual bool IsConstructedGenericType
- {
- [Pure]
- get { throw new NotImplementedException(); }
- }
-
- public virtual bool IsGenericParameter
- {
- [Pure]
- get { return false; }
- }
-
- public virtual int GenericParameterPosition
- {
- [Pure]
- get { throw new InvalidOperationException(Environment.GetResourceString("Arg_NotGenericParameter")); }
- }
-
- public virtual bool ContainsGenericParameters
- {
- [Pure]
- get
- {
- if (HasElementType)
- return GetRootElementType().ContainsGenericParameters;
-
- if (IsGenericParameter)
- return true;
-
- if (!IsGenericType)
- return false;
-
- Type[] genericArguments = GetGenericArguments();
- for (int i = 0; i < genericArguments.Length; i++)
- {
- if (genericArguments[i].ContainsGenericParameters)
- return true;
- }
-
- return false;
- }
- }
-
- [Pure]
- public virtual Type[] GetGenericParameterConstraints()
- {
- if (!IsGenericParameter)
- throw new InvalidOperationException(Environment.GetResourceString("Arg_NotGenericParameter"));
- Contract.EndContractBlock();
-
- throw new InvalidOperationException();
- }
-
- public bool IsByRef
- {
- [Pure]
- get { return IsByRefImpl(); }
- }
- public bool IsPointer
- {
- [Pure]
- get { return IsPointerImpl(); }
- }
- public bool IsPrimitive
- {
- [Pure]
- get { return IsPrimitiveImpl(); }
- }
- public bool IsCOMObject
- {
- [Pure]
- get { return IsCOMObjectImpl(); }
- }
-
-#if FEATURE_COMINTEROP
- internal bool IsWindowsRuntimeObject
- {
- [Pure]
- get { return IsWindowsRuntimeObjectImpl(); }
- }
-
- internal bool IsExportedToWindowsRuntime
- {
- [Pure]
- get { return IsExportedToWindowsRuntimeImpl(); }
- }
-#endif // FEATURE_COMINTEROP
-
- public bool HasElementType
- {
- [Pure]
- get { return HasElementTypeImpl(); }
- }
-
- public bool IsContextful
- {
- [Pure]
- get { return IsContextfulImpl(); }
- }
-
- public bool IsMarshalByRef
- {
- [Pure]
- get { return IsMarshalByRefImpl(); }
- }
-
- // Protected routine to determine if this class represents a value class
- // The default implementation of IsValueTypeImpl never returns true for non-runtime types.
- protected virtual bool IsValueTypeImpl()
- {
- // Note that typeof(Enum) and typeof(ValueType) are not themselves value types.
- // But there is no point excluding them here because customer derived System.Type
- // (non-runtime type) objects can never be equal to a runtime type, which typeof(XXX) is.
- // Ideally we should throw a NotImplementedException here or just return false because
- // customer implementations of IsSubclassOf should never return true between a non-runtime
- // type and a runtime type. There is no benefits in making that breaking change though.
-
- return IsSubclassOf(RuntimeType.ValueType);
- }
-
- // Protected routine to get the attributes.
- abstract protected TypeAttributes GetAttributeFlagsImpl();
-
- // Protected routine to determine if this class represents an Array
- abstract protected bool IsArrayImpl();
-
- // Protected routine to determine if this class is a ByRef
- abstract protected bool IsByRefImpl();
-
- // Protected routine to determine if this class is a Pointer
- abstract protected bool IsPointerImpl();
-
- // Protected routine to determine if this class represents a primitive type
- abstract protected bool IsPrimitiveImpl();
-
- // Protected routine to determine if this class represents a COM object
- abstract protected bool IsCOMObjectImpl();
-
-#if FEATURE_COMINTEROP
- // Protected routine to determine if this class represents a Windows Runtime object
- virtual internal bool IsWindowsRuntimeObjectImpl()
- {
- throw new NotImplementedException();
- }
-
- // Determines if this type is exported to WinRT (i.e. is an activatable class in a managed .winmd)
- virtual internal bool IsExportedToWindowsRuntimeImpl()
- {
- throw new NotImplementedException();
- }
-#endif // FEATURE_COMINTEROP
-
- public virtual Type MakeGenericType(params Type[] typeArguments)
- {
- Contract.Ensures(Contract.Result<Type>() != null);
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_SubclassOverride"));
- }
-
-
- // Protected routine to determine if this class is contextful
- protected virtual bool IsContextfulImpl()
- {
- return false;
- }
-
- // Protected routine to determine if this class is marshaled by ref
- protected virtual bool IsMarshalByRefImpl()
- {
- return false;
- }
-
- [Pure]
- abstract public Type GetElementType();
-
- [Pure]
- public virtual Type[] GetGenericArguments()
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_SubclassOverride"));
- }
-
- public virtual Type[] GenericTypeArguments
- {
- get
- {
- if (IsGenericType && !IsGenericTypeDefinition)
- {
- return GetGenericArguments();
- }
- else
- {
- return Type.EmptyTypes;
- }
- }
- }
-
- [Pure]
- public virtual Type GetGenericTypeDefinition()
- {
- Contract.Ensures(Contract.Result<Type>() != null);
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_SubclassOverride"));
- }
-
- [Pure]
- abstract protected bool HasElementTypeImpl();
-
- internal Type GetRootElementType()
- {
- Type rootElementType = this;
-
- while (rootElementType.HasElementType)
- rootElementType = rootElementType.GetElementType();
-
- return rootElementType;
- }
-
- #region Enum methods
-
- // Default implementations of GetEnumNames, GetEnumValues, and GetEnumUnderlyingType
- // Subclass of types can override these methods.
-
- public virtual string[] GetEnumNames()
- {
- if (!IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
- Contract.Ensures(Contract.Result<String[]>() != null);
-
- string[] names;
- Array values;
- GetEnumData(out names, out values);
- return names;
- }
-
- // We don't support GetEnumValues in the default implementation because we cannot create an array of
- // a non-runtime type. If there is strong need we can consider returning an object or int64 array.
- public virtual Array GetEnumValues()
- {
- if (!IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
- Contract.Ensures(Contract.Result<Array>() != null);
-
- throw new NotImplementedException();
- }
-
- // Returns the enum values as an object array.
- private Array GetEnumRawConstantValues()
- {
- string[] names;
- Array values;
- GetEnumData(out names, out values);
- return values;
- }
-
- // This will return enumValues and enumNames sorted by the values.
- private void GetEnumData(out string[] enumNames, out Array enumValues)
- {
- Contract.Ensures(Contract.ValueAtReturn<String[]>(out enumNames) != null);
- Contract.Ensures(Contract.ValueAtReturn<Array>(out enumValues) != null);
-
- FieldInfo[] flds = GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
-
- object[] values = new object[flds.Length];
- string[] names = new string[flds.Length];
-
- for (int i = 0; i < flds.Length; i++)
- {
- names[i] = flds[i].Name;
- values[i] = flds[i].GetRawConstantValue();
- }
-
- // Insertion Sort these values in ascending order.
- // We use this O(n^2) algorithm, but it turns out that most of the time the elements are already in sorted order and
- // the common case performance will be faster than quick sorting this.
- IComparer comparer = Comparer.Default;
- for (int i = 1; i < values.Length; i++)
- {
- int j = i;
- string tempStr = names[i];
- object val = values[i];
- bool exchanged = false;
-
- // Since the elements are sorted we only need to do one comparision, we keep the check for j inside the loop.
- while (comparer.Compare(values[j - 1], val) > 0)
- {
- names[j] = names[j - 1];
- values[j] = values[j - 1];
- j--;
- exchanged = true;
- if (j == 0)
- break;
- }
-
- if (exchanged)
- {
- names[j] = tempStr;
- values[j] = val;
- }
- }
-
- enumNames = names;
- enumValues = values;
- }
-
- public virtual Type GetEnumUnderlyingType()
- {
- if (!IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
- Contract.Ensures(Contract.Result<Type>() != null);
-
- FieldInfo[] fields = GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
- if (fields == null || fields.Length != 1)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidEnum"), "enumType");
-
- return fields[0].FieldType;
- }
-
- public virtual bool IsEnumDefined(object value)
- {
- if (value == null)
- throw new ArgumentNullException(nameof(value));
-
- if (!IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
- Contract.EndContractBlock();
-
- // Check if both of them are of the same type
- Type valueType = value.GetType();
-
- // If the value is an Enum then we need to extract the underlying value from it
- if (valueType.IsEnum)
- {
- if (!valueType.IsEquivalentTo(this))
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumAndObjectMustBeSameType", valueType.ToString(), this.ToString()));
-
- valueType = valueType.GetEnumUnderlyingType();
- }
-
- // If a string is passed in
- if (valueType == typeof(string))
- {
- string[] names = GetEnumNames();
- if (Array.IndexOf(names, value) >= 0)
- return true;
- else
- return false;
- }
-
- // If an enum or integer value is passed in
- if (Type.IsIntegerType(valueType))
- {
- Type underlyingType = GetEnumUnderlyingType();
- // We cannot compare the types directly because valueType is always a runtime type but underlyingType might not be.
- if (underlyingType.GetTypeCodeImpl() != valueType.GetTypeCodeImpl())
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumUnderlyingTypeAndObjectMustBeSameType", valueType.ToString(), underlyingType.ToString()));
-
- Array values = GetEnumRawConstantValues();
- return (BinarySearch(values, value) >= 0);
- }
- else
- {
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_UnknownEnumType"));
- }
- }
-
- public virtual string GetEnumName(object value)
- {
- if (value == null)
- throw new ArgumentNullException(nameof(value));
-
- if (!IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
- Contract.EndContractBlock();
-
- Type valueType = value.GetType();
-
- if (!(valueType.IsEnum || Type.IsIntegerType(valueType)))
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnumBaseTypeOrEnum"), nameof(value));
-
- Array values = GetEnumRawConstantValues();
- int index = BinarySearch(values, value);
-
- if (index >= 0)
- {
- string[] names = GetEnumNames();
- return names[index];
- }
-
- return null;
- }
-
- // Convert everything to ulong then perform a binary search.
- private static int BinarySearch(Array array, object value)
- {
- ulong[] ulArray = new ulong[array.Length];
- for (int i = 0; i < array.Length; ++i)
- ulArray[i] = Enum.ToUInt64(array.GetValue(i));
-
- ulong ulValue = Enum.ToUInt64(value);
-
- return Array.BinarySearch(ulArray, ulValue);
- }
-
- internal static bool IsIntegerType(Type t)
- {
- return (t == typeof(int) ||
- t == typeof(short) ||
- t == typeof(ushort) ||
- t == typeof(byte) ||
- t == typeof(sbyte) ||
- t == typeof(uint) ||
- t == typeof(long) ||
- t == typeof(ulong) ||
- t == typeof(char) ||
- t == typeof(bool));
- }
- #endregion
-
- public virtual bool IsSecurityCritical { [Pure] get { throw new NotImplementedException(); } }
-
- public virtual bool IsSecuritySafeCritical { [Pure] get { throw new NotImplementedException(); } }
-
- public virtual bool IsSecurityTransparent { [Pure] get { throw new NotImplementedException(); } }
-
- internal bool NeedsReflectionSecurityCheck
- {
- get
- {
- if (!IsVisible)
- {
- // Types which are not externally visible require security checks
- return true;
- }
- else if (IsSecurityCritical && !IsSecuritySafeCritical)
- {
- // Critical types require security checks
- return true;
- }
- else if (IsGenericType)
- {
- // If any of the generic arguments to this type require a security check, then this type
- // also requires one.
- foreach (Type genericArgument in GetGenericArguments())
- {
- if (genericArgument.NeedsReflectionSecurityCheck)
- {
- return true;
- }
- }
- }
- else if (IsArray || IsPointer)
- {
- return GetElementType().NeedsReflectionSecurityCheck;
- }
-
- return false;
- }
- }
-
- // The behavior of UnderlyingSystemType varies from type to type.
- // For IReflect objects: Return the underlying Type that represents the IReflect Object.
- // For expando object: this is the (Object) IReflectInstance.GetType(). For Type object it is this.
- // It could also return the baked type or the underlying enum type in RefEmit. See the comment in
- // code:TypeBuilder.SetConstantValue.
- public abstract Type UnderlyingSystemType
- {
- get;
- }
-
- // Returns true of this class is a true subclass of c. Everything
- // else returns false. If this class and c are the same class false is
- // returned.
- //
- [Pure]
- public virtual bool IsSubclassOf(Type c)
- {
- Type p = this;
- if (p == c)
- return false;
- while (p != null)
- {
- if (p == c)
- return true;
- p = p.BaseType;
- }
- return false;
- }
-
- // Returns true if the object passed is assignable to an instance of this class.
- // Everything else returns false.
- //
- [Pure]
- public virtual bool IsInstanceOfType(Object o)
- {
- if (o == null)
- return false;
-
- // No need for transparent proxy casting check here
- // because it never returns true for a non-rutnime type.
-
- return IsAssignableFrom(o.GetType());
- }
-
- // Returns true if an instance of Type c may be assigned
- // to an instance of this class. Return false otherwise.
- //
- [Pure]
- public virtual bool IsAssignableFrom(Type c)
- {
- if (c == null)
- return false;
-
- if (this == c)
- return true;
-
- // For backward-compatibility, we need to special case for the types
- // whose UnderlyingSystemType are RuntimeType objects.
- RuntimeType toType = this.UnderlyingSystemType as RuntimeType;
- if (toType != null)
- return toType.IsAssignableFrom(c);
-
- // If c is a subclass of this class, then c can be cast to this type.
- if (c.IsSubclassOf(this))
- return true;
-
- if (this.IsInterface)
- {
- return c.ImplementInterface(this);
- }
- else if (IsGenericParameter)
- {
- Type[] constraints = GetGenericParameterConstraints();
- for (int i = 0; i < constraints.Length; i++)
- if (!constraints[i].IsAssignableFrom(c))
- return false;
-
- return true;
- }
-
- return false;
- }
-
- // Base implementation that does only ==.
- [Pure]
- public virtual bool IsEquivalentTo(Type other)
- {
- return (this == other);
- }
-
- internal bool ImplementInterface(Type ifaceType)
- {
- Contract.Requires(ifaceType != null);
- Contract.Requires(ifaceType.IsInterface, "ifaceType must be an interface type");
-
- Type t = this;
- while (t != null)
- {
- Type[] interfaces = t.GetInterfaces();
- if (interfaces != null)
- {
- for (int i = 0; i < interfaces.Length; i++)
- {
- // Interfaces don't derive from other interfaces, they implement them.
- // So instead of IsSubclassOf, we should use ImplementInterface instead.
- if (interfaces[i] == ifaceType ||
- (interfaces[i] != null && interfaces[i].ImplementInterface(ifaceType)))
- return true;
- }
- }
-
- t = t.BaseType;
- }
-
- return false;
- }
-
- // This is only ever called on RuntimeType objects.
- internal string FormatTypeName()
- {
- return FormatTypeName(false);
- }
-
- internal virtual string FormatTypeName(bool serialization)
- {
- throw new NotImplementedException();
- }
-
- // ToString
- // Print the String Representation of the Type
- public override String ToString()
- {
- // Why do we add the "Type: " prefix? RuntimeType.ToString() doesn't include it.
- return "Type: " + Name;
- }
-
- // This method will return an array of classes based upon the array of
- // types.
- public static Type[] GetTypeArray(Object[] args)
- {
- if (args == null)
- throw new ArgumentNullException(nameof(args));
- Contract.EndContractBlock();
- Type[] cls = new Type[args.Length];
- for (int i = 0; i < cls.Length; i++)
- {
- if (args[i] == null)
- throw new ArgumentNullException();
- cls[i] = args[i].GetType();
- }
- return cls;
- }
-
- [Pure]
- public override bool Equals(Object o)
- {
- if (o == null)
- return false;
-
- return Equals(o as Type);
- }
-
- [Pure]
- public virtual bool Equals(Type o)
- {
- if ((object)o == null)
- return false;
-
- return (Object.ReferenceEquals(this.UnderlyingSystemType, o.UnderlyingSystemType));
- }
-
- [Pure]
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public static extern bool operator ==(Type left, Type right);
-
- [Pure]
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public static extern bool operator !=(Type left, Type right);
-
- public override int GetHashCode()
- {
- Type SystemType = UnderlyingSystemType;
- if (!Object.ReferenceEquals(SystemType, this))
- return SystemType.GetHashCode();
- return base.GetHashCode();
- }
-
-
- // GetInterfaceMap
- // This method will return an interface mapping for the interface
- // requested. It will throw an argument exception if the Type doesn't
- // implemenet the interface.
- public virtual InterfaceMapping GetInterfaceMap(Type interfaceType)
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_SubclassOverride"));
- }
-
- // this method is required so Object.GetType is not made virtual by the compiler
- public new Type GetType()
- {
- return base.GetType();
- }
-
- // 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;
- }
-}
diff --git a/src/mscorlib/src/System/TypeLoadException.cs b/src/mscorlib/src/System/TypeLoadException.cs
index 750e84ffa5..c09d3e1267 100644
--- a/src/mscorlib/src/System/TypeLoadException.cs
+++ b/src/mscorlib/src/System/TypeLoadException.cs
@@ -27,7 +27,7 @@ namespace System
public class TypeLoadException : SystemException, ISerializable
{
public TypeLoadException()
- : base(Environment.GetResourceString("Arg_TypeLoadException"))
+ : base(SR.Arg_TypeLoadException)
{
SetErrorCode(__HResults.COR_E_TYPELOAD);
}
@@ -59,14 +59,14 @@ namespace System
{
if ((ClassName == null) &&
(ResourceId == 0))
- _message = Environment.GetResourceString("Arg_TypeLoadException");
+ _message = SR.Arg_TypeLoadException;
else
{
if (AssemblyName == null)
- AssemblyName = Environment.GetResourceString("IO_UnknownFileName");
+ AssemblyName = SR.IO_UnknownFileName;
if (ClassName == null)
- ClassName = Environment.GetResourceString("IO_UnknownFileName");
+ ClassName = SR.IO_UnknownFileName;
String format = null;
GetTypeLoadExceptionMessage(ResourceId, JitHelpers.GetStringHandleOnStack(ref format));
diff --git a/src/mscorlib/src/System/TypeNameParser.cs b/src/mscorlib/src/System/TypeNameParser.cs
index 4dee3d4c88..f9d608968f 100644
--- a/src/mscorlib/src/System/TypeNameParser.cs
+++ b/src/mscorlib/src/System/TypeNameParser.cs
@@ -74,7 +74,7 @@ namespace System
if (typeName == null)
throw new ArgumentNullException(nameof(typeName));
if (typeName.Length > 0 && typeName[0] == '\0')
- throw new ArgumentException(Environment.GetResourceString("Format_StringZeroLength"));
+ throw new ArgumentException(SR.Format_StringZeroLength);
Contract.EndContractBlock();
Type ret = null;
@@ -143,7 +143,7 @@ namespace System
{
// This can only happen if the type name is an empty string or if the first char is '\0'
if (throwOnError)
- throw new TypeLoadException(Environment.GetResourceString("Arg_TypeLoadNullStr"));
+ throw new TypeLoadException(SR.Arg_TypeLoadNullStr);
return null;
}
@@ -221,7 +221,7 @@ namespace System
assembly = assemblyResolver(new AssemblyName(asmName));
if (assembly == null && throwOnError)
{
- throw new FileNotFoundException(Environment.GetResourceString("FileNotFound_ResolveAssembly", asmName));
+ throw new FileNotFoundException(SR.Format(SR.FileNotFound_ResolveAssembly, asmName));
}
}
@@ -245,8 +245,8 @@ namespace System
if (type == null && throwOnError)
{
string errorString = assembly == null ?
- Environment.GetResourceString("TypeLoad_ResolveType", OuterMostTypeName) :
- Environment.GetResourceString("TypeLoad_ResolveTypeFromAssembly", OuterMostTypeName, assembly.FullName);
+ SR.Format(SR.TypeLoad_ResolveType, OuterMostTypeName):
+ SR.Format(SR.TypeLoad_ResolveTypeFromAssembly, OuterMostTypeName, assembly.FullName);
throw new TypeLoadException(errorString);
}
@@ -277,7 +277,7 @@ namespace System
if (type == null)
{
if (throwOnError)
- throw new TypeLoadException(Environment.GetResourceString("TypeLoad_ResolveNestedType", names[i], names[i - 1]));
+ throw new TypeLoadException(SR.Format(SR.TypeLoad_ResolveNestedType, names[i], names[i - 1]));
else
break;
}
diff --git a/src/mscorlib/src/System/TypedReference.cs b/src/mscorlib/src/System/TypedReference.cs
index eb5234ec85..ca65082158 100644
--- a/src/mscorlib/src/System/TypedReference.cs
+++ b/src/mscorlib/src/System/TypedReference.cs
@@ -31,7 +31,7 @@ namespace System
throw new ArgumentNullException(nameof(flds));
Contract.EndContractBlock();
if (flds.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Arg_ArrayZeroError"));
+ throw new ArgumentException(SR.Arg_ArrayZeroError);
IntPtr[] fields = new IntPtr[flds.Length];
// For proper handling of Nullable<T> don't change GetType() to something like 'IsAssignableFrom'
@@ -41,20 +41,20 @@ namespace System
{
RuntimeFieldInfo field = flds[i] as RuntimeFieldInfo;
if (field == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeFieldInfo"));
+ throw new ArgumentException(SR.Argument_MustBeRuntimeFieldInfo);
if (field.IsInitOnly || field.IsStatic)
- throw new ArgumentException(Environment.GetResourceString("Argument_TypedReferenceInvalidField"));
+ throw new ArgumentException(SR.Argument_TypedReferenceInvalidField);
if (targetType != field.GetDeclaringTypeInternal() && !targetType.IsSubclassOf(field.GetDeclaringTypeInternal()))
- throw new MissingMemberException(Environment.GetResourceString("MissingMemberTypeRef"));
+ throw new MissingMemberException(SR.MissingMemberTypeRef);
RuntimeType fieldType = (RuntimeType)field.FieldType;
if (fieldType.IsPrimitive)
- throw new ArgumentException(Environment.GetResourceString("Arg_TypeRefPrimitve"));
+ throw new ArgumentException(SR.Arg_TypeRefPrimitve);
if (i < (flds.Length - 1) && !fieldType.IsValueType)
- throw new MissingMemberException(Environment.GetResourceString("MissingMemberNestErr"));
+ throw new MissingMemberException(SR.MissingMemberNestErr);
fields[i] = field.FieldHandle.Value;
targetType = fieldType;
@@ -84,7 +84,7 @@ namespace System
public override bool Equals(Object o)
{
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NYI"));
+ throw new NotSupportedException(SR.NotSupported_NYI);
}
public unsafe static Object ToObject(TypedReference value)
diff --git a/src/mscorlib/src/System/UInt16.cs b/src/mscorlib/src/System/UInt16.cs
index b9b541273f..e4a6837ae2 100644
--- a/src/mscorlib/src/System/UInt16.cs
+++ b/src/mscorlib/src/System/UInt16.cs
@@ -46,7 +46,7 @@ namespace System
{
return ((int)m_value - (int)(((UInt16)value).m_value));
}
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeUInt16"));
+ throw new ArgumentException(SR.Arg_MustBeUInt16);
}
public int CompareTo(UInt16 value)
@@ -137,10 +137,10 @@ namespace System
}
catch (OverflowException e)
{
- throw new OverflowException(Environment.GetResourceString("Overflow_UInt16"), e);
+ throw new OverflowException(SR.Overflow_UInt16, e);
}
- if (i > MaxValue) throw new OverflowException(Environment.GetResourceString("Overflow_UInt16"));
+ if (i > MaxValue) throw new OverflowException(SR.Overflow_UInt16);
return (ushort)i;
}
@@ -182,91 +182,76 @@ namespace System
return TypeCode.UInt16;
}
- /// <internalonly/>
bool IConvertible.ToBoolean(IFormatProvider provider)
{
return Convert.ToBoolean(m_value);
}
- /// <internalonly/>
char IConvertible.ToChar(IFormatProvider provider)
{
return Convert.ToChar(m_value);
}
- /// <internalonly/>
sbyte IConvertible.ToSByte(IFormatProvider provider)
{
return Convert.ToSByte(m_value);
}
- /// <internalonly/>
byte IConvertible.ToByte(IFormatProvider provider)
{
return Convert.ToByte(m_value);
}
- /// <internalonly/>
short IConvertible.ToInt16(IFormatProvider provider)
{
return Convert.ToInt16(m_value);
}
- /// <internalonly/>
ushort IConvertible.ToUInt16(IFormatProvider provider)
{
return m_value;
}
- /// <internalonly/>
int IConvertible.ToInt32(IFormatProvider provider)
{
return Convert.ToInt32(m_value);
}
- /// <internalonly/>
uint IConvertible.ToUInt32(IFormatProvider provider)
{
return Convert.ToUInt32(m_value);
}
- /// <internalonly/>
long IConvertible.ToInt64(IFormatProvider provider)
{
return Convert.ToInt64(m_value);
}
- /// <internalonly/>
ulong IConvertible.ToUInt64(IFormatProvider provider)
{
return Convert.ToUInt64(m_value);
}
- /// <internalonly/>
float IConvertible.ToSingle(IFormatProvider provider)
{
return Convert.ToSingle(m_value);
}
- /// <internalonly/>
double IConvertible.ToDouble(IFormatProvider provider)
{
return Convert.ToDouble(m_value);
}
- /// <internalonly/>
Decimal IConvertible.ToDecimal(IFormatProvider provider)
{
return Convert.ToDecimal(m_value);
}
- /// <internalonly/>
DateTime IConvertible.ToDateTime(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "UInt16", "DateTime"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "UInt16", "DateTime"));
}
- /// <internalonly/>
Object IConvertible.ToType(Type type, IFormatProvider provider)
{
return Convert.DefaultToType((IConvertible)this, type, provider);
diff --git a/src/mscorlib/src/System/UInt32.cs b/src/mscorlib/src/System/UInt32.cs
index 503a136e2f..7c27efef39 100644
--- a/src/mscorlib/src/System/UInt32.cs
+++ b/src/mscorlib/src/System/UInt32.cs
@@ -53,7 +53,7 @@ namespace System
if (m_value > i) return 1;
return 0;
}
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeUInt32"));
+ throw new ArgumentException(SR.Arg_MustBeUInt32);
}
public int CompareTo(UInt32 value)
@@ -160,91 +160,76 @@ namespace System
return TypeCode.UInt32;
}
- /// <internalonly/>
bool IConvertible.ToBoolean(IFormatProvider provider)
{
return Convert.ToBoolean(m_value);
}
- /// <internalonly/>
char IConvertible.ToChar(IFormatProvider provider)
{
return Convert.ToChar(m_value);
}
- /// <internalonly/>
sbyte IConvertible.ToSByte(IFormatProvider provider)
{
return Convert.ToSByte(m_value);
}
- /// <internalonly/>
byte IConvertible.ToByte(IFormatProvider provider)
{
return Convert.ToByte(m_value);
}
- /// <internalonly/>
short IConvertible.ToInt16(IFormatProvider provider)
{
return Convert.ToInt16(m_value);
}
- /// <internalonly/>
ushort IConvertible.ToUInt16(IFormatProvider provider)
{
return Convert.ToUInt16(m_value);
}
- /// <internalonly/>
int IConvertible.ToInt32(IFormatProvider provider)
{
return Convert.ToInt32(m_value);
}
- /// <internalonly/>
uint IConvertible.ToUInt32(IFormatProvider provider)
{
return m_value;
}
- /// <internalonly/>
long IConvertible.ToInt64(IFormatProvider provider)
{
return Convert.ToInt64(m_value);
}
- /// <internalonly/>
ulong IConvertible.ToUInt64(IFormatProvider provider)
{
return Convert.ToUInt64(m_value);
}
- /// <internalonly/>
float IConvertible.ToSingle(IFormatProvider provider)
{
return Convert.ToSingle(m_value);
}
- /// <internalonly/>
double IConvertible.ToDouble(IFormatProvider provider)
{
return Convert.ToDouble(m_value);
}
- /// <internalonly/>
Decimal IConvertible.ToDecimal(IFormatProvider provider)
{
return Convert.ToDecimal(m_value);
}
- /// <internalonly/>
DateTime IConvertible.ToDateTime(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "UInt32", "DateTime"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "UInt32", "DateTime"));
}
- /// <internalonly/>
Object IConvertible.ToType(Type type, IFormatProvider provider)
{
return Convert.DefaultToType((IConvertible)this, type, provider);
diff --git a/src/mscorlib/src/System/UInt64.cs b/src/mscorlib/src/System/UInt64.cs
index f034d17de9..0b79b6a7d8 100644
--- a/src/mscorlib/src/System/UInt64.cs
+++ b/src/mscorlib/src/System/UInt64.cs
@@ -50,7 +50,7 @@ namespace System
if (m_value > i) return 1;
return 0;
}
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeUInt64"));
+ throw new ArgumentException(SR.Arg_MustBeUInt64);
}
public int CompareTo(UInt64 value)
@@ -155,91 +155,76 @@ namespace System
return TypeCode.UInt64;
}
- /// <internalonly/>
bool IConvertible.ToBoolean(IFormatProvider provider)
{
return Convert.ToBoolean(m_value);
}
- /// <internalonly/>
char IConvertible.ToChar(IFormatProvider provider)
{
return Convert.ToChar(m_value);
}
- /// <internalonly/>
sbyte IConvertible.ToSByte(IFormatProvider provider)
{
return Convert.ToSByte(m_value);
}
- /// <internalonly/>
byte IConvertible.ToByte(IFormatProvider provider)
{
return Convert.ToByte(m_value);
}
- /// <internalonly/>
short IConvertible.ToInt16(IFormatProvider provider)
{
return Convert.ToInt16(m_value);
}
- /// <internalonly/>
ushort IConvertible.ToUInt16(IFormatProvider provider)
{
return Convert.ToUInt16(m_value);
}
- /// <internalonly/>
int IConvertible.ToInt32(IFormatProvider provider)
{
return Convert.ToInt32(m_value);
}
- /// <internalonly/>
uint IConvertible.ToUInt32(IFormatProvider provider)
{
return Convert.ToUInt32(m_value);
}
- /// <internalonly/>
long IConvertible.ToInt64(IFormatProvider provider)
{
return Convert.ToInt64(m_value);
}
- /// <internalonly/>
ulong IConvertible.ToUInt64(IFormatProvider provider)
{
return m_value;
}
- /// <internalonly/>
float IConvertible.ToSingle(IFormatProvider provider)
{
return Convert.ToSingle(m_value);
}
- /// <internalonly/>
double IConvertible.ToDouble(IFormatProvider provider)
{
return Convert.ToDouble(m_value);
}
- /// <internalonly/>
Decimal IConvertible.ToDecimal(IFormatProvider provider)
{
return Convert.ToDecimal(m_value);
}
- /// <internalonly/>
DateTime IConvertible.ToDateTime(IFormatProvider provider)
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_FromTo", "UInt64", "DateTime"));
+ throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "UInt64", "DateTime"));
}
- /// <internalonly/>
Object IConvertible.ToType(Type type, IFormatProvider provider)
{
return Convert.DefaultToType((IConvertible)this, type, provider);
diff --git a/src/mscorlib/src/System/UIntPtr.cs b/src/mscorlib/src/System/UIntPtr.cs
index 09e61a3a50..09b7e51e89 100644
--- a/src/mscorlib/src/System/UIntPtr.cs
+++ b/src/mscorlib/src/System/UIntPtr.cs
@@ -57,7 +57,7 @@ namespace System
if (Size == 4 && l > UInt32.MaxValue)
{
- throw new ArgumentException(Environment.GetResourceString("Serialization_InvalidPtrValue"));
+ throw new ArgumentException(SR.Serialization_InvalidPtrValue);
}
m_value = (void*)l;
diff --git a/src/mscorlib/src/System/ValueTuple.cs b/src/mscorlib/src/System/ValueTuple.cs
index 0f0863a2ed..abe119a837 100644
--- a/src/mscorlib/src/System/ValueTuple.cs
+++ b/src/mscorlib/src/System/ValueTuple.cs
@@ -1,4 +1,4 @@
-// Licensed to the .NET Foundation under one or more agreements.
+// 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.
@@ -1956,7 +1956,7 @@ namespace System
{
if (!(rest is IValueTupleInternal))
{
- throw new ArgumentException(SR.ArgumentException_ValueTupleLastArgumentNotATuple);
+ throw new ArgumentException(SR.ArgumentException_ValueTupleLastArgumentNotAValueTuple);
}
Item1 = item1;
diff --git a/src/mscorlib/src/System/Variant.cs b/src/mscorlib/src/System/Variant.cs
index 3036e5b45d..cae5bdade4 100644
--- a/src/mscorlib/src/System/Variant.cs
+++ b/src/mscorlib/src/System/Variant.cs
@@ -515,7 +515,7 @@ namespace System
break;
default:
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_UnknownTypeCode", ic.GetTypeCode()));
+ throw new NotSupportedException(SR.Format(SR.NotSupported_UnknownTypeCode, ic.GetTypeCode()));
}
}
}
@@ -561,12 +561,12 @@ namespace System
}
else
{
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_CannotCoerceByRefVariant"));
+ throw new InvalidCastException(SR.InvalidCast_CannotCoerceByRefVariant);
}
break;
default:
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_CannotCoerceByRefVariant"));
+ throw new InvalidCastException(SR.InvalidCast_CannotCoerceByRefVariant);
}
}
else
@@ -670,7 +670,7 @@ namespace System
break;
default:
- throw new InvalidCastException(Environment.GetResourceString("InvalidCast_CannotCoerceByRefVariant"));
+ throw new InvalidCastException(SR.InvalidCast_CannotCoerceByRefVariant);
}
}
}
diff --git a/src/mscorlib/src/System/Version.cs b/src/mscorlib/src/System/Version.cs
index 03d45af395..9c31786fef 100644
--- a/src/mscorlib/src/System/Version.cs
+++ b/src/mscorlib/src/System/Version.cs
@@ -38,16 +38,16 @@ namespace System
public Version(int major, int minor, int build, int revision)
{
if (major < 0)
- throw new ArgumentOutOfRangeException(nameof(major), Environment.GetResourceString("ArgumentOutOfRange_Version"));
+ throw new ArgumentOutOfRangeException(nameof(major), SR.ArgumentOutOfRange_Version);
if (minor < 0)
- throw new ArgumentOutOfRangeException(nameof(minor), Environment.GetResourceString("ArgumentOutOfRange_Version"));
+ throw new ArgumentOutOfRangeException(nameof(minor), SR.ArgumentOutOfRange_Version);
if (build < 0)
- throw new ArgumentOutOfRangeException(nameof(build), Environment.GetResourceString("ArgumentOutOfRange_Version"));
+ throw new ArgumentOutOfRangeException(nameof(build), SR.ArgumentOutOfRange_Version);
if (revision < 0)
- throw new ArgumentOutOfRangeException(nameof(revision), Environment.GetResourceString("ArgumentOutOfRange_Version"));
+ throw new ArgumentOutOfRangeException(nameof(revision), SR.ArgumentOutOfRange_Version);
Contract.EndContractBlock();
_Major = major;
@@ -59,13 +59,13 @@ namespace System
public Version(int major, int minor, int build)
{
if (major < 0)
- throw new ArgumentOutOfRangeException(nameof(major), Environment.GetResourceString("ArgumentOutOfRange_Version"));
+ throw new ArgumentOutOfRangeException(nameof(major), SR.ArgumentOutOfRange_Version);
if (minor < 0)
- throw new ArgumentOutOfRangeException(nameof(minor), Environment.GetResourceString("ArgumentOutOfRange_Version"));
+ throw new ArgumentOutOfRangeException(nameof(minor), SR.ArgumentOutOfRange_Version);
if (build < 0)
- throw new ArgumentOutOfRangeException(nameof(build), Environment.GetResourceString("ArgumentOutOfRange_Version"));
+ throw new ArgumentOutOfRangeException(nameof(build), SR.ArgumentOutOfRange_Version);
Contract.EndContractBlock();
@@ -77,10 +77,10 @@ namespace System
public Version(int major, int minor)
{
if (major < 0)
- throw new ArgumentOutOfRangeException(nameof(major), Environment.GetResourceString("ArgumentOutOfRange_Version"));
+ throw new ArgumentOutOfRangeException(nameof(major), SR.ArgumentOutOfRange_Version);
if (minor < 0)
- throw new ArgumentOutOfRangeException(nameof(minor), Environment.GetResourceString("ArgumentOutOfRange_Version"));
+ throw new ArgumentOutOfRangeException(nameof(minor), SR.ArgumentOutOfRange_Version);
Contract.EndContractBlock();
_Major = major;
@@ -158,7 +158,7 @@ namespace System
Version v = version as Version;
if (v == null)
{
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeVersion"));
+ throw new ArgumentException(SR.Arg_MustBeVersion);
}
return CompareTo(v);
@@ -230,7 +230,7 @@ namespace System
return StringBuilderCache.GetStringAndRelease(sb);
default:
if (_Build == -1)
- throw new ArgumentException(Environment.GetResourceString("ArgumentOutOfRange_Bounds_Lower_Upper", "0", "2"), nameof(fieldCount));
+ throw new ArgumentException(SR.Format(SR.ArgumentOutOfRange_Bounds_Lower_Upper, "0", "2"), nameof(fieldCount));
if (fieldCount == 3)
{
@@ -244,7 +244,7 @@ namespace System
}
if (_Revision == -1)
- throw new ArgumentException(Environment.GetResourceString("ArgumentOutOfRange_Bounds_Lower_Upper", "0", "3"), nameof(fieldCount));
+ throw new ArgumentException(SR.Format(SR.ArgumentOutOfRange_Bounds_Lower_Upper, "0", "3"), nameof(fieldCount));
if (fieldCount == 4)
{
@@ -259,7 +259,7 @@ namespace System
return StringBuilderCache.GetStringAndRelease(sb);
}
- throw new ArgumentException(Environment.GetResourceString("ArgumentOutOfRange_Bounds_Lower_Upper", "0", "4"), nameof(fieldCount));
+ throw new ArgumentException(SR.Format(SR.ArgumentOutOfRange_Bounds_Lower_Upper, "0", "4"), nameof(fieldCount));
}
}
@@ -476,9 +476,9 @@ namespace System
case ParseFailureKind.ArgumentNullException:
return new ArgumentNullException(m_argumentName);
case ParseFailureKind.ArgumentException:
- return new ArgumentException(Environment.GetResourceString("Arg_VersionString"));
+ return new ArgumentException(SR.Arg_VersionString);
case ParseFailureKind.ArgumentOutOfRangeException:
- return new ArgumentOutOfRangeException(m_exceptionArgument, Environment.GetResourceString("ArgumentOutOfRange_Version"));
+ return new ArgumentOutOfRangeException(m_exceptionArgument, SR.ArgumentOutOfRange_Version);
case ParseFailureKind.FormatException:
// Regenerate the FormatException as would be thrown by Int32.Parse()
try
@@ -494,10 +494,10 @@ namespace System
return e;
}
Debug.Assert(false, "Int32.Parse() did not throw exception but TryParse failed: " + m_exceptionArgument);
- return new FormatException(Environment.GetResourceString("Format_InvalidString"));
+ return new FormatException(SR.Format_InvalidString);
default:
Debug.Assert(false, "Unmatched case in Version.GetVersionParseException() for value: " + m_failure);
- return new ArgumentException(Environment.GetResourceString("Arg_VersionString"));
+ return new ArgumentException(SR.Arg_VersionString);
}
}
}
diff --git a/src/mscorlib/src/System/__Filters.cs b/src/mscorlib/src/System/__Filters.cs
deleted file mode 100644
index 32d1db3143..0000000000
--- a/src/mscorlib/src/System/__Filters.cs
+++ /dev/null
@@ -1,163 +0,0 @@
-// 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.
-
-//
-// This class defines the delegate methods for the COM+ implemented filters.
-//
-//
-//
-
-using System;
-using System.Reflection;
-using System.Globalization;
-
-namespace System
-{
- [Serializable]
- internal class __Filters
- {
- // Filters...
- // The following are the built in filters defined for this class. These
- // should really be defined as static methods. They are used in as delegates
- // which currently doesn't support static methods. We will change this
- // once the compiler supports delegates.
- //
- // Note that it is not possible to make this class static as suggested by
- // the above comment anymore because of it got marked serializable.
-
- internal static readonly __Filters Instance = new __Filters();
-
- // FilterAttribute
- // This method will search for a member based upon the attribute passed in.
- // filterCriteria -- an Int32 representing the attribute
- internal virtual bool FilterAttribute(MemberInfo m, Object filterCriteria)
- {
- // Check that the criteria object is an Integer object
- if (filterCriteria == null)
- throw new InvalidFilterCriteriaException(Environment.GetResourceString("RFLCT.FltCritInt"));
-
- switch (m.MemberType)
- {
- case MemberTypes.Constructor:
- case MemberTypes.Method:
- {
- MethodAttributes criteria = 0;
- try
- {
- int i = (int)filterCriteria;
- criteria = (MethodAttributes)i;
- }
- catch
- {
- throw new InvalidFilterCriteriaException(Environment.GetResourceString("RFLCT.FltCritInt"));
- }
-
-
- MethodAttributes attr;
- if (m.MemberType == MemberTypes.Method)
- attr = ((MethodInfo)m).Attributes;
- else
- attr = ((ConstructorInfo)m).Attributes;
-
- if (((criteria & MethodAttributes.MemberAccessMask) != 0) && (attr & MethodAttributes.MemberAccessMask) != (criteria & MethodAttributes.MemberAccessMask))
- return false;
- if (((criteria & MethodAttributes.Static) != 0) && (attr & MethodAttributes.Static) == 0)
- return false;
- if (((criteria & MethodAttributes.Final) != 0) && (attr & MethodAttributes.Final) == 0)
- return false;
- if (((criteria & MethodAttributes.Virtual) != 0) && (attr & MethodAttributes.Virtual) == 0)
- return false;
- if (((criteria & MethodAttributes.Abstract) != 0) && (attr & MethodAttributes.Abstract) == 0)
- return false;
- if (((criteria & MethodAttributes.SpecialName) != 0) && (attr & MethodAttributes.SpecialName) == 0)
- return false;
- return true;
- }
- case MemberTypes.Field:
- {
- FieldAttributes criteria = 0;
- try
- {
- int i = (int)filterCriteria;
- criteria = (FieldAttributes)i;
- }
- catch
- {
- throw new InvalidFilterCriteriaException(Environment.GetResourceString("RFLCT.FltCritInt"));
- }
-
- FieldAttributes attr = ((FieldInfo)m).Attributes;
- if (((criteria & FieldAttributes.FieldAccessMask) != 0) && (attr & FieldAttributes.FieldAccessMask) != (criteria & FieldAttributes.FieldAccessMask))
- return false;
- if (((criteria & FieldAttributes.Static) != 0) && (attr & FieldAttributes.Static) == 0)
- return false;
- if (((criteria & FieldAttributes.InitOnly) != 0) && (attr & FieldAttributes.InitOnly) == 0)
- return false;
- if (((criteria & FieldAttributes.Literal) != 0) && (attr & FieldAttributes.Literal) == 0)
- return false;
- if (((criteria & FieldAttributes.NotSerialized) != 0) && (attr & FieldAttributes.NotSerialized) == 0)
- return false;
- if (((criteria & FieldAttributes.PinvokeImpl) != 0) && (attr & FieldAttributes.PinvokeImpl) == 0)
- return false;
- return true;
- }
- }
-
- return false;
- }
- // FilterName
- // This method will filter based upon the name. A partial wildcard
- // at the end of the string is supported.
- // filterCriteria -- This is the string name
- internal virtual bool FilterName(MemberInfo m, Object filterCriteria)
- {
- // Check that the criteria object is a String object
- if (filterCriteria == null || !(filterCriteria is String))
- throw new InvalidFilterCriteriaException(Environment.GetResourceString("RFLCT.FltCritString"));
-
- // At the moment this fails if its done on a single line....
- String str = ((String)filterCriteria);
- str = str.Trim();
-
- String name = m.Name;
- // Get the nested class name only, as opposed to the mangled one
- if (m.MemberType == MemberTypes.NestedType)
- name = name.Substring(name.LastIndexOf('+') + 1);
- // Check to see if this is a prefix or exact match requirement
- if (str.Length > 0 && str[str.Length - 1] == '*')
- {
- str = str.Substring(0, str.Length - 1);
- return (name.StartsWith(str, StringComparison.Ordinal));
- }
-
- return (name.Equals(str));
- }
-
- // FilterIgnoreCase
- // This delegate will do a name search but does it with the
- // ignore case specified.
- internal virtual bool FilterIgnoreCase(MemberInfo m, Object filterCriteria)
- {
- // Check that the criteria object is a String object
- if (filterCriteria == null || !(filterCriteria is String))
- throw new InvalidFilterCriteriaException(Environment.GetResourceString("RFLCT.FltCritString"));
-
- String str = (String)filterCriteria;
- str = str.Trim();
-
- String name = m.Name;
- // Get the nested class name only, as opposed to the mangled one
- if (m.MemberType == MemberTypes.NestedType)
- name = name.Substring(name.LastIndexOf('+') + 1);
- // Check to see if this is a prefix or exact match requirement
- if (str.Length > 0 && str[str.Length - 1] == '*')
- {
- str = str.Substring(0, str.Length - 1);
- return (String.Compare(name, 0, str, 0, str.Length, StringComparison.OrdinalIgnoreCase) == 0);
- }
-
- return (String.Compare(str, name, StringComparison.OrdinalIgnoreCase) == 0);
- }
- }
-}
diff --git a/src/mscorlib/src/mscorlib.Friends.cs b/src/mscorlib/src/mscorlib.Friends.cs
index 17ad5ae84b..b02b4829d9 100644
--- a/src/mscorlib/src/mscorlib.Friends.cs
+++ b/src/mscorlib/src/mscorlib.Friends.cs
@@ -4,9 +4,6 @@
using System.Runtime.CompilerServices;
-// We need this to be able to typeforward to internal types
-[assembly: InternalsVisibleTo("mscorlib, PublicKey=00240000048000009400000006020000002400005253413100040000010001008d56c76f9e8649383049f383c44be0ec204181822a6c31cf5eb7ef486944d032188ea1d3920763712ccb12d75fb77e9811149e6148e5d32fbaab37611c1878ddc19e20ef135d0cb2cff2bfec3d115810c3d9069638fe4be215dbf795861920e5ab6f7db2e2ceef136ac23d5dd2bf031700aec232f6c6b1c785b4305c123b37ab", AllInternalsVisible = false)]
-
// 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.
diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h
index 8d099aff0f..589eb54831 100644
--- a/src/pal/inc/pal.h
+++ b/src/pal/inc/pal.h
@@ -538,7 +538,6 @@ PAL_ProbeMemory(
BOOL fWriteAccess);
/******************* winuser.h Entrypoints *******************************/
-
PALIMPORT
LPSTR
PALAPI
@@ -2536,6 +2535,16 @@ PAL_GetLogicalCpuCountFromOS(VOID);
PALIMPORT
size_t
PALAPI
+PAL_GetRestrictedPhysicalMemoryLimit(VOID);
+
+PALIMPORT
+BOOL
+PALAPI
+PAL_GetWorkingSetSize(size_t* val);
+
+PALIMPORT
+size_t
+PALAPI
PAL_GetLogicalProcessorCacheSizeFromOS(VOID);
typedef BOOL (*ReadMemoryWordCallback)(SIZE_T address, SIZE_T *value);
@@ -4733,18 +4742,6 @@ typedef POSVERSIONINFOEXA POSVERSIONINFOEX;
typedef LPOSVERSIONINFOEXA LPOSVERSIONINFOEX;
#endif
-PALIMPORT
-BOOL
-PALAPI
-GetVersionExW(
- IN OUT LPOSVERSIONINFOW lpVersionInformation);
-
-#ifdef UNICODE
-#define GetVersionEx GetVersionExW
-#else
-#define GetVersionEx GetVersionExA
-#endif
-
#define IMAGE_FILE_MACHINE_I386 0x014c
#define IMAGE_FILE_MACHINE_ARM64 0xAA64 // ARM64 Little-Endian
diff --git a/src/pal/inc/palprivate.h b/src/pal/inc/palprivate.h
index 2677dd6bdd..554a5028ad 100644
--- a/src/pal/inc/palprivate.h
+++ b/src/pal/inc/palprivate.h
@@ -293,12 +293,6 @@ FreeEnvironmentStringsA(
PALIMPORT
BOOL
PALAPI
-GetVersionExA(
- IN OUT LPOSVERSIONINFOA lpVersionInformation);
-
-PALIMPORT
-BOOL
-PALAPI
RemoveDirectoryA(
IN LPCSTR lpPathName);
diff --git a/src/pal/src/CMakeLists.txt b/src/pal/src/CMakeLists.txt
index 5142dcc18b..5314cdf86b 100644
--- a/src/pal/src/CMakeLists.txt
+++ b/src/pal/src/CMakeLists.txt
@@ -168,6 +168,7 @@ set(SOURCES
map/virtual.cpp
memory/heap.cpp
memory/local.cpp
+ misc/cgroup.cpp
misc/dbgmsg.cpp
misc/environ.cpp
misc/error.cpp
@@ -180,7 +181,6 @@ set(SOURCES
misc/sysinfo.cpp
misc/time.cpp
misc/utils.cpp
- misc/version.cpp
objmgr/palobjbase.cpp
objmgr/shmobject.cpp
objmgr/shmobjectmanager.cpp
diff --git a/src/pal/src/configure.cmake b/src/pal/src/configure.cmake
index 4f2bc5739b..4ca1fe9c84 100644
--- a/src/pal/src/configure.cmake
+++ b/src/pal/src/configure.cmake
@@ -728,9 +728,9 @@ check_cxx_source_runs("
int main(void) {
double infinity = 1.0 / 0.0;
if (pow(1.0, infinity) != 1.0 || pow(1.0, -infinity) != 1.0) {
- exit(1)
+ exit(1);
}
- if (!isnan(pow(-1.0, infinity)) || !isnan(pow(-1.0, -infinity))) {
+ if (pow(-1.0, infinity) != 1.0 || pow(-1.0, -infinity) != 1.0) {
exit(1);
}
if (pow(0.0, infinity) != 0.0) {
@@ -742,7 +742,7 @@ int main(void) {
if (pow(-1.1, infinity) != infinity || pow(1.1, infinity) != infinity) {
exit(1);
}
- if (pow(-1.1, -infinity) != 0.0 || pow(1.1, infinity) != 0.0) {
+ if (pow(-1.1, -infinity) != 0.0 || pow(1.1, -infinity) != 0.0) {
exit(1);
}
if (pow(-0.0, -1) != -infinity) {
diff --git a/src/pal/src/cruntime/math.cpp b/src/pal/src/cruntime/math.cpp
index d53dbe7982..7b5175a526 100644
--- a/src/pal/src/cruntime/math.cpp
+++ b/src/pal/src/cruntime/math.cpp
@@ -343,7 +343,7 @@ PALIMPORT double __cdecl PAL_pow(double x, double y)
}
else if (x == -1.0)
{
- ret = PAL_NAN_DBL; // NaN
+ ret = 1.0;
}
else if ((x > -1.0) && (x < 1.0))
{
@@ -362,7 +362,7 @@ PALIMPORT double __cdecl PAL_pow(double x, double y)
}
else if (x == -1.0)
{
- ret = PAL_NAN_DBL; // NaN
+ ret = 1.0;
}
else if ((x > -1.0) && (x < 1.0))
{
@@ -384,17 +384,7 @@ PALIMPORT double __cdecl PAL_pow(double x, double y)
else
#endif // !HAVE_COMPATIBLE_POW
- if ((y == 0.0) && isnan(x))
- {
- // Windows returns NaN for pow(NaN, 0), but POSIX specifies
- // a return value of 1 for that case. We need to return
- // the same result as Windows.
- ret = PAL_NAN_DBL;
- }
- else
- {
- ret = pow(x, y);
- }
+ ret = pow(x, y);
#if !HAVE_VALID_NEGATIVE_INF_POW
if ((ret == PAL_POSINF_DBL) && (x < 0) && isfinite(x) && (ceil(y / 2) != floor(y / 2)))
@@ -706,7 +696,7 @@ PALIMPORT float __cdecl PAL_powf(float x, float y)
}
else if (x == -1.0f)
{
- ret = PAL_NAN_FLT; // NaN
+ ret = 1.0f;
}
else if ((x > -1.0f) && (x < 1.0f))
{
@@ -725,7 +715,7 @@ PALIMPORT float __cdecl PAL_powf(float x, float y)
}
else if (x == -1.0f)
{
- ret = PAL_NAN_FLT; // NaN
+ ret = 1.0f;
}
else if ((x > -1.0f) && (x < 1.0f))
{
@@ -747,18 +737,8 @@ PALIMPORT float __cdecl PAL_powf(float x, float y)
else
#endif // !HAVE_COMPATIBLE_POW
- if ((y == 0.0f) && isnan(x))
- {
- // Windows returns NaN for powf(NaN, 0), but POSIX specifies
- // a return value of 1 for that case. We need to return
- // the same result as Windows.
- ret = PAL_NAN_FLT;
- }
- else
- {
- ret = powf(x, y);
- }
-
+ ret = powf(x, y);
+
#if !HAVE_VALID_NEGATIVE_INF_POW
if ((ret == PAL_POSINF_FLT) && (x < 0) && isfinite(x) && (ceilf(y / 2) != floorf(y / 2)))
{
diff --git a/src/pal/src/cruntime/misctls.cpp b/src/pal/src/cruntime/misctls.cpp
index e46582ec17..2df32fe115 100644
--- a/src/pal/src/cruntime/misctls.cpp
+++ b/src/pal/src/cruntime/misctls.cpp
@@ -128,6 +128,11 @@ done:
return retval;
}
+UINT GetExponent(double d)
+{
+ return (*((UINT*)&d + 1) >> 20) & 0x000007ff;
+}
+
/**
Function:
@@ -150,250 +155,143 @@ NOTES:
char * __cdecl
_ecvt( double value, int count, int * dec, int * sign )
{
- CONST CHAR * FORMAT_STRING = "%.348e";
- CHAR TempBuffer[ ECVT_MAX_BUFFER_SIZE ];
- CPalThread *pThread = NULL;
- LPSTR lpReturnBuffer = NULL;
- LPSTR lpStartOfReturnBuffer = NULL;
- LPSTR lpTempBuffer = NULL;
- LPSTR lpEndOfTempBuffer = NULL;
- INT nTempBufferLength = 0;
- CHAR ExponentBuffer[ 6 ];
- INT nExponentValue = 0;
- INT LoopIndex = 0;
-
PERF_ENTRY(_ecvt);
ENTRY( "_ecvt( value=%.30g, count=%d, dec=%p, sign=%p )\n",
value, count, dec, sign );
+
+ _ASSERTE(dec != nullptr && sign != nullptr);
+ CPalThread *pThread = InternalGetCurrentThread();
+ LPSTR lpStartOfReturnBuffer = pThread->crtInfo.ECVTBuffer;
- /* Get the per-thread buffer from the thread structure. */
- pThread = InternalGetCurrentThread();
-
- lpStartOfReturnBuffer = lpReturnBuffer = pThread->crtInfo.ECVTBuffer;
-
- /* Sanity checks */
- if ( !dec || !sign )
- {
- ERROR( "dec and sign have to be valid pointers.\n" );
- *lpReturnBuffer = '\0';
- goto done;
- }
- else
+ if (count > ECVT_MAX_COUNT_SIZE)
{
- *dec = *sign = 0;
+ count = ECVT_MAX_COUNT_SIZE;
}
- if ( value < 0.0 )
- {
- *sign = 1;
- }
+ // the caller of _ecvt should already checked the Infinity and NAN values
+ _ASSERTE(GetExponent(value) != 0x7ff);
- if ( count > ECVT_MAX_COUNT_SIZE )
+ CHAR TempBuffer[ECVT_MAX_BUFFER_SIZE];
+
+ *dec = *sign = 0;
+
+ if (value < 0.0)
{
- count = ECVT_MAX_COUNT_SIZE;
+ *sign = 1;
}
-
- /* Get the string to work with. */
- sprintf_s( TempBuffer, sizeof(TempBuffer), FORMAT_STRING, value );
-
- /* Check to see if value was a valid number. */
- if ( strcmp( "NaN", TempBuffer ) == 0 || strcmp( "-NaN", TempBuffer ) == 0 )
+
{
- TRACE( "value was not a number!\n" );
- if (strcpy_s( lpStartOfReturnBuffer, ECVT_MAX_BUFFER_SIZE, "1#QNAN0" ) != SAFECRT_SUCCESS)
+ // we have issue #10290 tracking fixing the sign of 0.0 across the platforms
+ if (value == 0.0)
{
- ERROR( "strcpy_s failed!\n" );
- *lpStartOfReturnBuffer = '\0';
+ for (int j = 0; j < count; j++)
+ {
+ lpStartOfReturnBuffer[j] = '0';
+ }
+ lpStartOfReturnBuffer[count] = '\0';
goto done;
+ }
+
+ int tempBufferLength = snprintf(TempBuffer, ECVT_MAX_BUFFER_SIZE, "%.40e", value);
+ _ASSERTE(tempBufferLength > 0 && ECVT_MAX_BUFFER_SIZE > tempBufferLength);
+
+ //
+ // Calculate the exponent value
+ //
+
+ int exponentIndex = strrchr(TempBuffer, 'e') - TempBuffer;
+ _ASSERTE(exponentIndex > 0 && (exponentIndex < tempBufferLength - 1));
+
+ int i = exponentIndex + 1;
+ int exponentSign = 1;
+ if (TempBuffer[i] == '-')
+ {
+ exponentSign = -1;
+ i++;
}
-
- *dec = 1;
- goto done;
- }
-
- /* Check to see if it is infinite. */
- if ( strcmp( "Inf", TempBuffer ) == 0 || strcmp( "-Inf", TempBuffer ) == 0 )
- {
- TRACE( "value is infinite!\n" );
- if (strcpy_s( lpStartOfReturnBuffer, ECVT_MAX_BUFFER_SIZE, "1#INF00" ) != SAFECRT_SUCCESS)
+ else if (TempBuffer[i] == '+')
{
- ERROR( "strcpy_s failed!\n" );
- *lpStartOfReturnBuffer = '\0';
- goto done;
+ i++;
}
- *dec = 1;
- if ( *TempBuffer == '-' )
+ int exponentValue = 0;
+ while (i < tempBufferLength)
{
- *sign = 1;
+ _ASSERTE(TempBuffer[i] >= '0' && TempBuffer[i] <= '9');
+ exponentValue = exponentValue * 10 + ((BYTE) TempBuffer[i] - (BYTE) '0');
+ i++;
}
- goto done;
- }
-
- nTempBufferLength = strlen( TempBuffer );
- lpEndOfTempBuffer = &(TempBuffer[ nTempBufferLength ]);
-
- /* Extract the exponent, and convert it to integer. */
- while ( *lpEndOfTempBuffer != 'e' && nTempBufferLength > 0 )
- {
- nTempBufferLength--;
- lpEndOfTempBuffer--;
- }
-
- ExponentBuffer[ 0 ] = '\0';
- if (strncat_s( ExponentBuffer, sizeof(ExponentBuffer), lpEndOfTempBuffer + 1, 5 ) != SAFECRT_SUCCESS)
- {
- ERROR( "strncat_s failed!\n" );
- *lpStartOfReturnBuffer = '\0';
- goto done;
- }
-
- nExponentValue = atoi( ExponentBuffer );
+ exponentValue *= exponentSign;
+
+ //
+ // Determine decimal location.
+ //
- /* End the string at the 'e' */
- *lpEndOfTempBuffer = '\0';
- nTempBufferLength--;
+ if (exponentValue == 0)
+ {
+ *dec = 1;
+ }
+ else
+ {
+ *dec = exponentValue + 1;
+ }
+
+ //
+ // Copy the string from the temp buffer upto precision characters, removing the sign, and decimal as required.
+ //
+
+ i = 0;
+ int mantissaIndex = 0;
+ while (i < count && mantissaIndex < exponentIndex)
+ {
+ if (TempBuffer[mantissaIndex] >= '0' && TempBuffer[mantissaIndex] <= '9')
+ {
+ lpStartOfReturnBuffer[i] = TempBuffer[mantissaIndex];
+ i++;
+ }
+ mantissaIndex++;
+ }
- /* Determine decimal location. */
- if ( nExponentValue == 0 )
- {
- *dec = 1;
- }
- else
- {
- *dec = nExponentValue + 1;
- }
+ while (i < count)
+ {
+ lpStartOfReturnBuffer[i] = '0'; // append zeros as needed
+ i++;
+ }
- if ( value == 0.0 )
- {
- *dec = 0;
- }
- /* Copy the string from the temp buffer upto count characters,
- removing the sign, and decimal as required. */
- lpTempBuffer = TempBuffer;
- *lpReturnBuffer = '0';
- lpReturnBuffer++;
+ lpStartOfReturnBuffer[i] = '\0';
+
+ //
+ // Round if needed
+ //
- while ( LoopIndex < ECVT_MAX_COUNT_SIZE )
- {
- if ( isdigit(*lpTempBuffer) )
+ if (mantissaIndex >= exponentIndex || TempBuffer[mantissaIndex] < '5')
{
- *lpReturnBuffer = *lpTempBuffer;
- LoopIndex++;
- lpReturnBuffer++;
+ goto done;
}
- lpTempBuffer++;
- if ( LoopIndex == count + 1 )
+ i = count - 1;
+ while (lpStartOfReturnBuffer[i] == '9' && i > 0)
{
- break;
+ lpStartOfReturnBuffer[i] = '0';
+ i--;
}
- }
- *lpReturnBuffer = '\0';
-
- /* Round if needed. If count is less then 0
- then windows does not round for some reason.*/
- nTempBufferLength = strlen( lpStartOfReturnBuffer ) - 1;
-
- /* Add one for the preceeding zero. */
- lpReturnBuffer = ( lpStartOfReturnBuffer + 1 );
-
- if ( nTempBufferLength >= count && count >= 0 )
- {
- /* Determine whether I need to round up. */
- if ( *(lpReturnBuffer + count) >= '5' )
+ if (i == 0 && lpStartOfReturnBuffer[i] == '9')
{
- CHAR cNumberToBeRounded;
- if ( count != 0 )
- {
- cNumberToBeRounded = *(lpReturnBuffer + count - 1);
- }
- else
- {
- cNumberToBeRounded = *lpReturnBuffer;
- }
-
- if ( cNumberToBeRounded < '9' )
- {
- if ( count > 0 )
- {
- /* Add one to the character. */
- (*(lpReturnBuffer + count - 1))++;
- }
- else
- {
- if ( cNumberToBeRounded >= '5' )
- {
- (*dec)++;
- }
- }
- }
- else
- {
- LPSTR lpRounding = NULL;
-
- if ( count > 0 )
- {
- lpRounding = lpReturnBuffer + count - 1;
- }
- else
- {
- lpRounding = lpReturnBuffer + count;
- }
-
- while ( cNumberToBeRounded == '9' )
- {
- cNumberToBeRounded = *lpRounding;
-
- if ( cNumberToBeRounded == '9' )
- {
- *lpRounding = '0';
- lpRounding--;
- }
- }
-
- if ( lpRounding == lpStartOfReturnBuffer )
- {
- /* Overflow. number is a whole number now. */
- *lpRounding = '1';
- memset( ++lpRounding, '0', count);
-
- /* The decimal has moved. */
- (*dec)++;
- }
- else
- {
- *lpRounding = ++cNumberToBeRounded;
- }
- }
+ lpStartOfReturnBuffer[i] = '1';
+ (*dec)++;
}
else
{
- /* Get rid of the preceding 0 */
- lpStartOfReturnBuffer++;
- }
- }
-
- if ( *lpStartOfReturnBuffer == '0' )
- {
- lpStartOfReturnBuffer++;
- }
-
- if ( count >= 0 )
- {
- *(lpStartOfReturnBuffer + count) = '\0';
- }
- else
- {
- *lpStartOfReturnBuffer = '\0';
+ lpStartOfReturnBuffer[i]++;
+ }
}
done:
LOGEXIT( "_ecvt returning %p (%s)\n", lpStartOfReturnBuffer , lpStartOfReturnBuffer );
PERF_EXIT(_ecvt);
-
+
return lpStartOfReturnBuffer;
}
diff --git a/src/pal/src/file/filetime.cpp b/src/pal/src/file/filetime.cpp
index 4e55e18060..ca36e04d9d 100644
--- a/src/pal/src/file/filetime.cpp
+++ b/src/pal/src/file/filetime.cpp
@@ -81,8 +81,8 @@ SET_DEFAULT_DEBUG_CHANNEL(FILE);
Both epochs are Gregorian. 1970 - 1601 = 369. Assuming a leap
year every four years, 369 / 4 = 92. However, 1700, 1800, and 1900
were NOT leap years, so 89 leap years, 280 non-leap years.
- 89 * 366 + 280 * 365 = 134744 days between epochs. Of course
- 60 * 60 * 24 = 86400 seconds per day, so 134744 * 86400 =
+ 89 * 366 + 280 * 365 = 134774 days between epochs. Of course
+ 60 * 60 * 24 = 86400 seconds per day, so 134774 * 86400 =
11644473600 = SECS_BETWEEN_1601_AND_1970_EPOCHS.
To 2001:
diff --git a/src/pal/src/init/pal.cpp b/src/pal/src/init/pal.cpp
index e6db7dca2e..fa94922325 100644
--- a/src/pal/src/init/pal.cpp
+++ b/src/pal/src/init/pal.cpp
@@ -105,7 +105,7 @@ static PCRITICAL_SECTION init_critsec = NULL;
static int Initialize(int argc, const char *const argv[], DWORD flags);
static BOOL INIT_IncreaseDescriptorLimit(void);
static LPWSTR INIT_FormatCommandLine (int argc, const char * const *argv);
-static LPWSTR INIT_FindEXEPath(LPCSTR exe_name);
+static LPWSTR INIT_ConvertEXEPath(LPCSTR exe_name);
#ifdef _DEBUG
extern void PROCDumpThreadList(void);
@@ -406,7 +406,7 @@ Initialize(
}
/* find out the application's full path */
- exe_path = INIT_FindEXEPath(argv[0]);
+ exe_path = INIT_ConvertEXEPath(argv[0]);
if (NULL == exe_path)
{
ERROR("Unable to find exe path\n");
@@ -1130,14 +1130,13 @@ static LPWSTR INIT_FormatCommandLine (int argc, const char * const *argv)
/*++
Function:
- INIT_FindEXEPath
+ INIT_ConvertEXEPath
Abstract:
- Determine the full, canonical path of the current executable by searching
- $PATH.
+ Check whether the executable path is valid, and convert its type (LPCSTR -> LPWSTR)
Parameters:
- LPCSTR exe_name : file to search for
+ LPCSTR exe_name : full path of the current executable
Return:
pointer to buffer containing the full path. This buffer must be released
@@ -1145,299 +1144,33 @@ Return:
Notes :
this function assumes that "exe_name" is in Unix style (no \)
-
-Notes 2:
- This doesn't handle the case of directories with the desired name
- (and directories are usually executable...)
--*/
-static LPWSTR INIT_FindEXEPath(LPCSTR exe_name)
+static LPWSTR INIT_ConvertEXEPath(LPCSTR exe_path)
{
-#ifndef __APPLE__
PathCharString real_path;
- LPSTR env_path;
- LPSTR path_ptr;
- LPSTR cur_dir;
- INT exe_name_length;
- BOOL need_slash;
LPWSTR return_value;
INT return_size;
struct stat theStats;
- /* if a path is specified, only search there */
- if (strchr(exe_name, '/'))
- {
- if ( -1 == stat( exe_name, &theStats ) )
- {
- ERROR( "The file does not exist\n" );
- return NULL;
- }
-
- if ( UTIL_IsExecuteBitsSet( &theStats ) )
- {
- if (!CorUnix::RealPathHelper(exe_name, real_path))
- {
- ERROR("realpath() failed!\n");
- return NULL;
- }
-
- return_size=MultiByteToWideChar(CP_ACP,0,real_path,-1,NULL,0);
- if ( 0 == return_size )
- {
- ASSERT("MultiByteToWideChar failure\n");
- return NULL;
- }
-
- return_value = reinterpret_cast<LPWSTR>(InternalMalloc((return_size*sizeof(WCHAR))));
- if ( NULL == return_value )
- {
- ERROR("Not enough memory to create full path\n");
- return NULL;
- }
- else
- {
- if (!MultiByteToWideChar(CP_ACP, 0, real_path, -1,
- return_value, return_size))
- {
- ASSERT("MultiByteToWideChar failure\n");
- free(return_value);
- return_value = NULL;
- }
- else
- {
- TRACE("full path to executable is %s\n", real_path.GetString());
- }
- }
- return return_value;
- }
- }
-
- /* no path was specified : search $PATH */
-
- env_path = EnvironGetenv("PATH");
- if (!env_path || *env_path=='\0')
- {
- WARN("$PATH isn't set.\n");
- if (env_path != NULL)
- {
- free(env_path);
- }
- goto last_resort;
- }
-
- exe_name_length=strlen(exe_name);
-
- cur_dir=env_path;
-
- while (cur_dir)
+ if (!strchr(exe_path, '/'))
{
- LPSTR full_path;
- struct stat theStats;
-
- /* skip all leading ':' */
- while (*cur_dir==':')
- {
- cur_dir++;
- }
- if (*cur_dir=='\0')
- {
- break;
- }
-
- /* cut string at next ':' */
- path_ptr = strchr(cur_dir, ':');
- if (path_ptr)
- {
- /* check if we need to add a '/' between the path and filename */
- need_slash=(*(path_ptr-1))!='/';
-
- /* NULL_terminate path element */
- *path_ptr++='\0';
- }
- else
- {
- /* check if we need to add a '/' between the path and filename */
- need_slash=(cur_dir[strlen(cur_dir)-1])!='/';
- }
-
- TRACE("looking for %s in %s\n", exe_name, cur_dir);
-
- /* build tentative full file name */
- int iLength = (strlen(cur_dir)+exe_name_length+2);
- full_path = reinterpret_cast<LPSTR>(InternalMalloc(iLength));
- if (!full_path)
- {
- ERROR("Not enough memory!\n");
- break;
- }
-
- if (strcpy_s(full_path, iLength, cur_dir) != SAFECRT_SUCCESS)
- {
- ERROR("strcpy_s failed!\n");
- free(full_path);
- free(env_path);
- return NULL;
- }
-
- if (need_slash)
- {
- if (strcat_s(full_path, iLength, "/") != SAFECRT_SUCCESS)
- {
- ERROR("strcat_s failed!\n");
- free(full_path);
- free(env_path);
- return NULL;
- }
- }
-
- if (strcat_s(full_path, iLength, exe_name) != SAFECRT_SUCCESS)
- {
- ERROR("strcat_s failed!\n");
- free(full_path);
- free(env_path);
- return NULL;
- }
-
- /* see if file exists AND is executable */
- if ( -1 != stat( full_path, &theStats ) )
- {
- if( UTIL_IsExecuteBitsSet( &theStats ) )
- {
- /* generate canonical path */
- if (!CorUnix::RealPathHelper(full_path, real_path))
- {
- ERROR("realpath() failed!\n");
- free(full_path);
- free(env_path);
- return NULL;
- }
- free(full_path);
-
- return_size = MultiByteToWideChar(CP_ACP,0,real_path,-1,NULL,0);
- if ( 0 == return_size )
- {
- ASSERT("MultiByteToWideChar failure\n");
- free(env_path);
- return NULL;
- }
-
- return_value = reinterpret_cast<LPWSTR>(InternalMalloc((return_size*sizeof(WCHAR))));
- if ( NULL == return_value )
- {
- ERROR("Not enough memory to create full path\n");
- free(env_path);
- return NULL;
- }
-
- if (!MultiByteToWideChar(CP_ACP, 0, real_path, -1, return_value,
- return_size))
- {
- ASSERT("MultiByteToWideChar failure\n");
- free(return_value);
- return_value = NULL;
- }
- else
- {
- TRACE("found %s in %s; real path is %s\n", exe_name,
- cur_dir,real_path.GetString());
- }
-
- free(env_path);
- return return_value;
- }
- }
-
- /* file doesn't exist : keep searching */
- free(full_path);
-
- /* path_ptr is NULL if there's no ':' after this directory */
- cur_dir=path_ptr;
- }
-
- free(env_path);
- TRACE("No %s found in $PATH (%s)\n", exe_name, EnvironGetenv("PATH", FALSE));
-
-last_resort:
- /* last resort : see if the executable is in the current directory. This is
- possible if it comes from a exec*() call. */
- if (0 == stat(exe_name,&theStats))
- {
- if ( UTIL_IsExecuteBitsSet( &theStats ) )
- {
- if (!CorUnix::RealPathHelper(exe_name, real_path))
- {
- ERROR("realpath() failed!\n");
- return NULL;
- }
-
- return_size = MultiByteToWideChar(CP_ACP,0,real_path,-1,NULL,0);
- if (0 == return_size)
- {
- ASSERT("MultiByteToWideChar failure\n");
- return NULL;
- }
-
- return_value = reinterpret_cast<LPWSTR>(InternalMalloc((return_size*sizeof(WCHAR))));
- if (NULL == return_value)
- {
- ERROR("Not enough memory to create full path\n");
- return NULL;
- }
- else
- {
- if (!MultiByteToWideChar(CP_ACP, 0, real_path, -1,
- return_value, return_size))
- {
- ASSERT("MultiByteToWideChar failure\n");
- free(return_value);
- return_value = NULL;
- }
- else
- {
- TRACE("full path to executable is %s\n", real_path.GetString());
- }
- }
-
- return return_value;
- }
- else
- {
- ERROR("found %s in current directory, but it isn't executable!\n",
- exe_name);
- }
- }
- else
- {
- TRACE("last resort failed : executable %s is not in the current "
- "directory\n",exe_name);
+ ERROR( "The exe path is not fully specified\n" );
+ return NULL;
}
- ERROR("executable %s not found anywhere!\n", exe_name);
- return NULL;
-#else // !__APPLE__
- // On the Mac we can just directly ask the OS for the executable path.
-
- LPWSTR return_value;
- INT return_size;
-
- PathCharString exec_pathPS;
- LPSTR exec_path = exec_pathPS.OpenStringBuffer(MAX_PATH);
- uint32_t bufsize = exec_pathPS.GetCount();
-
- if (-1 == _NSGetExecutablePath(exec_path, &bufsize))
+ if (-1 == stat(exe_path, &theStats))
{
- exec_pathPS.CloseBuffer(exec_pathPS.GetCount());
- exec_path = exec_pathPS.OpenStringBuffer(bufsize);
+ ERROR( "The file does not exist\n" );
+ return NULL;
}
- if (_NSGetExecutablePath(exec_path, &bufsize))
+ if (!CorUnix::RealPathHelper(exe_path, real_path))
{
- ASSERT("_NSGetExecutablePath failure\n");
+ ERROR("realpath() failed!\n");
return NULL;
}
- exec_pathPS.CloseBuffer(bufsize);
-
- return_size = MultiByteToWideChar(CP_ACP,0,exec_path,-1,NULL,0);
+ return_size = MultiByteToWideChar(CP_ACP, 0, real_path, -1, NULL, 0);
if (0 == return_size)
{
ASSERT("MultiByteToWideChar failure\n");
@@ -1452,7 +1185,7 @@ last_resort:
}
else
{
- if (!MultiByteToWideChar(CP_ACP, 0, exec_path, -1,
+ if (!MultiByteToWideChar(CP_ACP, 0, real_path, -1,
return_value, return_size))
{
ASSERT("MultiByteToWideChar failure\n");
@@ -1461,10 +1194,9 @@ last_resort:
}
else
{
- TRACE("full path to executable is %s\n", exec_path);
+ TRACE("full path to executable is %s\n", real_path.GetString());
}
}
return return_value;
-#endif // !__APPLE__
}
diff --git a/src/pal/src/misc/cgroup.cpp b/src/pal/src/misc/cgroup.cpp
new file mode 100644
index 0000000000..40178032e3
--- /dev/null
+++ b/src/pal/src/misc/cgroup.cpp
@@ -0,0 +1,335 @@
+// 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.
+
+/*++
+
+Module Name:
+
+ cgroup.cpp
+
+Abstract:
+ Read memory limits for the current process
+--*/
+
+#include "pal/dbgmsg.h"
+SET_DEFAULT_DEBUG_CHANNEL(MISC);
+#include "pal/palinternal.h"
+#include <sys/resource.h>
+#include "pal/virtual.h"
+
+#define PROC_MOUNTINFO_FILENAME "/proc/self/mountinfo"
+#define PROC_CGROUP_FILENAME "/proc/self/cgroup"
+#define PROC_STATM_FILENAME "/proc/self/statm"
+#define MEM_LIMIT_FILENAME "/memory.limit_in_bytes"
+
+class CGroup
+{
+ char *m_memory_cgroup_path;
+public:
+ CGroup()
+ {
+ m_memory_cgroup_path = nullptr;
+ char* memoryHierarchyMount = nullptr;
+ char *cgroup_path_relative_to_mount = nullptr;
+ size_t len;
+ memoryHierarchyMount = FindMemoryHierarchyMount();
+ if (memoryHierarchyMount == nullptr)
+ goto done;
+
+ cgroup_path_relative_to_mount = FindCGroupPathForMemorySubsystem();
+ if (cgroup_path_relative_to_mount == nullptr)
+ goto done;
+
+ len = strlen(memoryHierarchyMount);
+ len += strlen(cgroup_path_relative_to_mount);
+ m_memory_cgroup_path = (char*)PAL_malloc(len+1);
+ if (m_memory_cgroup_path == nullptr)
+ goto done;
+
+ strcpy_s(m_memory_cgroup_path, len+1, memoryHierarchyMount);
+ strcat_s(m_memory_cgroup_path, len+1, cgroup_path_relative_to_mount);
+
+ done:
+ PAL_free(memoryHierarchyMount);
+ PAL_free(cgroup_path_relative_to_mount);
+ }
+ ~CGroup()
+ {
+ PAL_free(m_memory_cgroup_path);
+ }
+
+ bool GetPhysicalMemoryLimit(size_t *val)
+ {
+ char *mem_limit_filename = nullptr;
+ bool result = false;
+
+ if (m_memory_cgroup_path == nullptr)
+ return result;
+
+ size_t len = strlen(m_memory_cgroup_path);
+ len += strlen(MEM_LIMIT_FILENAME);
+ mem_limit_filename = (char*)PAL_malloc(len+1);
+ if (mem_limit_filename == nullptr)
+ return result;
+
+ strcpy_s(mem_limit_filename, len+1, m_memory_cgroup_path);
+ strcat_s(mem_limit_filename, len+1, MEM_LIMIT_FILENAME);
+ result = ReadMemoryValueFromFile(mem_limit_filename, val);
+ PAL_free(mem_limit_filename);
+ return result;
+ }
+private:
+ char* FindMemoryHierarchyMount()
+ {
+ char *line = nullptr;
+ size_t lineLen = 0, maxLineLen = 0;
+ char *filesystemType = nullptr;
+ char *options = nullptr;
+ char* mountpath = nullptr;
+
+ FILE *mountinfofile = fopen(PROC_MOUNTINFO_FILENAME, "r");
+ if (mountinfofile == nullptr)
+ goto done;
+
+ while (getline(&line, &lineLen, mountinfofile) != -1)
+ {
+ if (filesystemType == nullptr || lineLen > maxLineLen)
+ {
+ PAL_free(filesystemType);
+ PAL_free(options);
+ filesystemType = (char*)PAL_malloc(lineLen+1);
+ if (filesystemType == nullptr)
+ goto done;
+ options = (char*)PAL_malloc(lineLen+1);
+ if (options == nullptr)
+ goto done;
+ maxLineLen = lineLen;
+ }
+ char* separatorChar = strchr(line, '-');
+
+ // See man page of proc to get format for /proc/self/mountinfo file
+ int sscanfRet = sscanf_s(separatorChar,
+ "- %s %*s %s",
+ filesystemType, lineLen+1,
+ options, lineLen+1);
+ if (sscanfRet != 2)
+ {
+ _ASSERTE(!"Failed to parse mount info file contents with sscanf_s.");
+ goto done;
+ }
+
+ if (strncmp(filesystemType, "cgroup", 6) == 0)
+ {
+ char* context = nullptr;
+ char* strTok = strtok_s(options, ",", &context);
+ while (strTok != nullptr)
+ {
+ if (strncmp("memory", strTok, 6) == 0)
+ {
+ mountpath = (char*)PAL_malloc(lineLen+1);
+ if (mountpath == nullptr)
+ goto done;
+
+ sscanfRet = sscanf_s(line,
+ "%*s %*s %*s %*s %s ",
+ mountpath, lineLen+1);
+ if (sscanfRet != 1)
+ {
+ PAL_free(mountpath);
+ mountpath = nullptr;
+ _ASSERTE(!"Failed to parse mount info file contents with sscanf_s.");
+ }
+ goto done;
+ }
+ strTok = strtok_s(nullptr, ",", &context);
+ }
+ }
+ }
+ done:
+ PAL_free(filesystemType);
+ PAL_free(options);
+ free(line);
+ if (mountinfofile)
+ fclose(mountinfofile);
+ return mountpath;
+ }
+
+ char* FindCGroupPathForMemorySubsystem()
+ {
+ char *line = nullptr;
+ size_t lineLen = 0;
+ size_t maxLineLen = 0;
+ char *subsystem_list = nullptr;
+ char *cgroup_path = nullptr;
+ bool result = false;
+
+ FILE *cgroupfile = fopen(PROC_CGROUP_FILENAME, "r");
+ if (cgroupfile == nullptr)
+ goto done;
+
+ while (!result && getline(&line, &lineLen, cgroupfile) != -1)
+ {
+ if (subsystem_list == nullptr || lineLen > maxLineLen)
+ {
+ PAL_free(subsystem_list);
+ PAL_free(cgroup_path);
+ subsystem_list = (char*)PAL_malloc(lineLen+1);
+ if (subsystem_list == nullptr)
+ goto done;
+ cgroup_path = (char*)PAL_malloc(lineLen+1);
+ if (cgroup_path == nullptr)
+ goto done;
+ maxLineLen = lineLen;
+ }
+
+ // See man page of proc to get format for /proc/self/cgroup file
+ int sscanfRet = sscanf_s(line,
+ "%*[^:]:%[^:]:%s",
+ subsystem_list, lineLen+1,
+ cgroup_path, lineLen+1);
+ if (sscanfRet != 2)
+ {
+ _ASSERTE(!"Failed to parse cgroup info file contents with sscanf_s.");
+ goto done;
+ }
+
+ char* context = nullptr;
+ char* strTok = strtok_s(subsystem_list, ",", &context);
+ while (strTok != nullptr)
+ {
+ if (strncmp("memory", strTok, 6) == 0)
+ {
+ result = true;
+ break;
+ }
+ strTok = strtok_s(nullptr, ",", &context);
+ }
+ }
+ done:
+ PAL_free(subsystem_list);
+ if (!result)
+ {
+ PAL_free(cgroup_path);
+ cgroup_path = nullptr;
+ }
+ free(line);
+ if (cgroupfile)
+ fclose(cgroupfile);
+ return cgroup_path;
+ }
+
+ bool ReadMemoryValueFromFile(const char* filename, size_t* val)
+ {
+ bool result = false;
+ char *line = nullptr;
+ size_t lineLen = 0;
+ char* endptr = nullptr;
+ size_t num = 0, l, multiplier;
+
+ if (val == nullptr)
+ return false;
+
+ FILE* file = fopen(filename, "r");
+ if (file == nullptr)
+ goto done;
+
+ if (getline(&line, &lineLen, file) == -1)
+ goto done;
+
+ errno = 0;
+ num = strtoull(line, &endptr, 0);
+ if (errno != 0)
+ goto done;
+
+ multiplier = 1;
+ switch(*endptr)
+ {
+ case 'g':
+ case 'G': multiplier = 1024;
+ case 'm':
+ case 'M': multiplier = multiplier*1024;
+ case 'k':
+ case 'K': multiplier = multiplier*1024;
+ }
+
+ *val = num * multiplier;
+ result = true;
+ if (*val/multiplier != num)
+ result = false;
+ done:
+ if (file)
+ fclose(file);
+ free(line);
+ return result;
+ }
+};
+
+
+size_t
+PALAPI
+PAL_GetRestrictedPhysicalMemoryLimit()
+{
+ CGroup cgroup;
+ size_t physical_memory_limit;
+
+ if (!cgroup.GetPhysicalMemoryLimit(&physical_memory_limit))
+ physical_memory_limit = SIZE_T_MAX;
+
+ struct rlimit curr_rlimit;
+ size_t rlimit_soft_limit = (size_t)RLIM_INFINITY;
+ if (getrlimit(RLIMIT_AS, &curr_rlimit) == 0)
+ {
+ rlimit_soft_limit = curr_rlimit.rlim_cur;
+ }
+ physical_memory_limit = min(physical_memory_limit, rlimit_soft_limit);
+
+ // Ensure that limit is not greater than real memory size
+ long pages = sysconf(_SC_PHYS_PAGES);
+ if (pages != -1)
+ {
+ long pageSize = sysconf(_SC_PAGE_SIZE);
+ if (pageSize != -1)
+ {
+ physical_memory_limit = min(physical_memory_limit,
+ (size_t)pages * pageSize);
+ }
+ }
+
+ if(physical_memory_limit == SIZE_T_MAX)
+ physical_memory_limit = 0;
+ return physical_memory_limit;
+}
+
+BOOL
+PALAPI
+PAL_GetWorkingSetSize(size_t* val)
+{
+ BOOL result = false;
+ size_t linelen;
+ char* line = nullptr;
+
+ if (val == nullptr)
+ return FALSE;
+
+ FILE* file = fopen(PROC_STATM_FILENAME, "r");
+ if (file != nullptr && getline(&line, &linelen, file) != -1)
+ {
+ char* context = nullptr;
+ char* strTok = strtok_s(line, " ", &context);
+ strTok = strtok_s(nullptr, " ", &context);
+
+ errno = 0;
+ *val = strtoull(strTok, nullptr, 0);
+ if(errno == 0)
+ {
+ *val = *val * VIRTUAL_PAGE_SIZE;
+ result = true;
+ }
+ }
+
+ if (file)
+ fclose(file);
+ free(line);
+ return result;
+}
diff --git a/src/pal/src/misc/environ.cpp b/src/pal/src/misc/environ.cpp
index fed7b69f38..9fc13467c5 100644
--- a/src/pal/src/misc/environ.cpp
+++ b/src/pal/src/misc/environ.cpp
@@ -218,7 +218,13 @@ GetEnvironmentVariableW(
}
else if (size == 0)
{
- // handle error in GetEnvironmentVariableA
+ // If size is 0, it either means GetEnvironmentVariableA failed, or that
+ // it succeeded and the value of the variable is empty. Check GetLastError
+ // to determine which. If the call failed, we won't touch the buffer.
+ if (GetLastError() == ERROR_SUCCESS)
+ {
+ *lpBuffer = '\0';
+ }
}
else
{
diff --git a/src/pal/src/misc/utils.cpp b/src/pal/src/misc/utils.cpp
index f0ff63439f..4eefd749ed 100644
--- a/src/pal/src/misc/utils.cpp
+++ b/src/pal/src/misc/utils.cpp
@@ -124,7 +124,12 @@ BOOL UTIL_IsExecuteBitsSet( struct stat * stat_data )
}
/* Check for read permissions. */
- if ( stat_data->st_uid == geteuid() )
+ if ( 0 == geteuid() )
+ {
+ /* The process owner is root */
+ bRetVal = TRUE;
+ }
+ else if ( stat_data->st_uid == geteuid() )
{
/* The process owner is the file owner as well. */
if ( ( stat_data->st_mode & S_IXUSR ) )
diff --git a/src/pal/src/misc/version.cpp b/src/pal/src/misc/version.cpp
deleted file mode 100644
index 7a9f90a320..0000000000
--- a/src/pal/src/misc/version.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-// 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.
-
-/*++
-
-
-
-Module Name:
-
- version.c
-
-Abstract:
-
- Implementation of functions for getting platform.OS versions.
-
-Revision History:
-
-
-
---*/
-
-#include "pal/palinternal.h"
-#include "pal/dbgmsg.h"
-
-SET_DEFAULT_DEBUG_CHANNEL(MISC);
-
-/*++
-Function:
- GetVersionExA
-
-
-
-GetVersionEx
-
-The GetVersionEx function obtains extended information about the
-version of the operating system that is currently running.
-
-Parameters
-
-lpVersionInfo
- [in/out] Pointer to an OSVERSIONINFO data structure that the
- function fills with operating system version information.
-
- Before calling the GetVersionEx function, set the
- dwOSVersionInfoSize member of the OSVERSIONINFO data structure
- to sizeof(OSVERSIONINFO).
-
-Return Values
-
-If the function succeeds, the return value is a nonzero value.
-
-If the function fails, the return value is zero. To get extended error
-information, call GetLastError. The function fails if you specify an
-invalid value for the dwOSVersionInfoSize member of the OSVERSIONINFO
-structure.
-
---*/
-BOOL
-PALAPI
-GetVersionExA(
- IN OUT LPOSVERSIONINFOA lpVersionInformation)
-{
- BOOL bRet = TRUE;
- PERF_ENTRY(GetVersionExA);
- ENTRY("GetVersionExA (lpVersionInformation=%p)\n", lpVersionInformation);
-
- if (lpVersionInformation->dwOSVersionInfoSize == sizeof(OSVERSIONINFOA))
- {
- lpVersionInformation->dwMajorVersion = 5; /* same as WIN2000 */
- lpVersionInformation->dwMinorVersion = 0; /* same as WIN2000 */
- lpVersionInformation->dwBuildNumber = 0;
- lpVersionInformation->dwPlatformId = VER_PLATFORM_UNIX;
- lpVersionInformation->szCSDVersion[0] = '\0'; /* no service pack */
- }
- else
- {
- SetLastError(ERROR_INVALID_PARAMETER);
- bRet = FALSE;
- }
- LOGEXIT("GetVersionExA returning BOOL %d\n", bRet);
- PERF_EXIT(GetVersionExA);
- return bRet;
-}
-
-
-/*++
-Function:
- GetVersionExW
-
-See GetVersionExA
---*/
-BOOL
-PALAPI
-GetVersionExW(
- IN OUT LPOSVERSIONINFOW lpVersionInformation)
-{
- BOOL bRet = TRUE;
-
- PERF_ENTRY(GetVersionExW);
- ENTRY("GetVersionExW (lpVersionInformation=%p)\n", lpVersionInformation);
-
- if (lpVersionInformation->dwOSVersionInfoSize == sizeof(OSVERSIONINFOW))
- {
- lpVersionInformation->dwMajorVersion = 5; /* same as WIN2000 */
- lpVersionInformation->dwMinorVersion = 0; /* same as WIN2000 */
- lpVersionInformation->dwBuildNumber = 0;
- lpVersionInformation->dwPlatformId = VER_PLATFORM_UNIX;
- lpVersionInformation->szCSDVersion[0] = '\0'; /* no service pack */
- }
- else
- {
- SetLastError(ERROR_INVALID_PARAMETER);
- bRet = FALSE;
- }
- LOGEXIT("GetVersionExW returning BOOL %d\n", bRet);
- PERF_EXIT(GetVersionExW);
- return bRet;
-}
diff --git a/src/pal/tests/palsuite/c_runtime/pow/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/pow/test1/test1.cpp
index 0a05cd5a47..7eea316e62 100644
--- a/src/pal/tests/palsuite/c_runtime/pow/test1/test1.cpp
+++ b/src/pal/tests/palsuite/c_runtime/pow/test1/test1.cpp
@@ -106,6 +106,9 @@ int __cdecl main(int argc, char **argv)
{ -2.7182818284590452, 1, -2.7182818284590452, PAL_EPSILON * 10 }, // x: -(e) expected: e
{ -2.7182818284590452, PAL_POSINF, PAL_POSINF, 0 }, // x: -(e)
+ { -1.0, PAL_NEGINF, 1.0, PAL_EPSILON * 10 },
+ { -1.0, PAL_POSINF, 1.0, PAL_EPSILON * 10 },
+
{ -0.0, PAL_NEGINF, PAL_POSINF, 0 },
{ -0.0, -1, PAL_NEGINF, 0 },
{ -0.0, -0.0, 1, PAL_EPSILON * 10 },
@@ -113,6 +116,9 @@ int __cdecl main(int argc, char **argv)
{ -0.0, 1, -0.0, PAL_EPSILON },
{ -0.0, PAL_POSINF, 0, PAL_EPSILON },
+ { PAL_NAN, -0.0, 1.0, PAL_EPSILON * 10 },
+ { PAL_NAN, 0, 1.0, PAL_EPSILON * 10 },
+
{ 0.0, PAL_NEGINF, PAL_POSINF, 0 },
{ 0.0, -1, PAL_POSINF, 0 },
{ 0, -0.0, 1, PAL_EPSILON * 10 },
@@ -211,12 +217,6 @@ int __cdecl main(int argc, char **argv)
validate_isnan(-2.7182818284590452, 0.78539816339744828); // x: -(e) y: pi / 4
validate_isnan(-2.7182818284590452, 1.5707963267948966); // x: -(e) y: pi / 2
- validate_isnan(-1, PAL_NEGINF);
- validate_isnan(-1, PAL_POSINF);
-
- validate_isnan(PAL_NAN, -0.0);
- validate_isnan(PAL_NAN, 0);
-
validate_isnan(PAL_NEGINF, PAL_NAN);
validate_isnan(PAL_NAN, PAL_NEGINF);
diff --git a/src/pal/tests/palsuite/c_runtime/powf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/powf/test1/test1.c
index ca738e8c8d..e8933c5ce2 100644
--- a/src/pal/tests/palsuite/c_runtime/powf/test1/test1.c
+++ b/src/pal/tests/palsuite/c_runtime/powf/test1/test1.c
@@ -104,7 +104,10 @@ int __cdecl main(int argc, char **argv)
{ -2.71828183f, 0, 1, PAL_EPSILON * 10 }, // x: -(e)
{ -2.71828183f, 1, -2.71828183f, PAL_EPSILON * 10 }, // x: -(e) expected: e
{ -2.71828183f, PAL_POSINF, PAL_POSINF, 0 }, // x: -(e)
-
+
+ { -1.0, PAL_NEGINF, 1.0, PAL_EPSILON * 10 },
+ { -1.0, PAL_POSINF, 1.0, PAL_EPSILON * 10 },
+
{ -0.0, PAL_NEGINF, PAL_POSINF, 0 },
{ -0.0, -1, PAL_NEGINF, 0 },
{ -0.0f, -0.0f, 1, PAL_EPSILON * 10 },
@@ -112,6 +115,9 @@ int __cdecl main(int argc, char **argv)
{ -0.0, 1, -0.0, PAL_EPSILON },
{ -0.0, PAL_POSINF, 0, PAL_EPSILON },
+ { PAL_NAN, -0.0, 1.0, PAL_EPSILON * 10 },
+ { PAL_NAN, 0, 1.0, PAL_EPSILON * 10 },
+
{ 0.0, PAL_NEGINF, PAL_POSINF, 0 },
{ 0.0, -1, PAL_POSINF, 0 },
{ 0, -0.0f, 1, PAL_EPSILON * 10 },
@@ -210,12 +216,6 @@ int __cdecl main(int argc, char **argv)
validate_isnan(-2.71828183f, 0.785398163f); // x: -(e) y: pi / 4
validate_isnan(-2.71828183f, 1.57079633f); // x: -(e) y: pi / 2
- validate_isnan(-1, PAL_NEGINF);
- validate_isnan(-1, PAL_POSINF);
-
- validate_isnan(PAL_NAN, -0.0);
- validate_isnan(PAL_NAN, 0);
-
validate_isnan(PAL_NEGINF, PAL_NAN);
validate_isnan(PAL_NAN, PAL_NEGINF);
diff --git a/src/pal/tests/palsuite/miscellaneous/GetVersionExA/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/CGroup/CMakeLists.txt
index f6aa0cb2d9..f6aa0cb2d9 100644
--- a/src/pal/tests/palsuite/miscellaneous/GetVersionExA/CMakeLists.txt
+++ b/src/pal/tests/palsuite/miscellaneous/CGroup/CMakeLists.txt
diff --git a/src/pal/tests/palsuite/miscellaneous/CGroup/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/CGroup/test1/CMakeLists.txt
new file mode 100644
index 0000000000..cdd7fa99d0
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/CGroup/test1/CMakeLists.txt
@@ -0,0 +1,17 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test.cpp
+)
+
+add_executable(paltest_cgroup_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_cgroup_test1 coreclrpal)
+
+target_link_libraries(paltest_cgroup_test1
+ ${COMMON_TEST_LIBRARIES}
+)
diff --git a/src/pal/tests/palsuite/miscellaneous/CGroup/test1/test.cpp b/src/pal/tests/palsuite/miscellaneous/CGroup/test1/test.cpp
new file mode 100644
index 0000000000..44b970a233
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/CGroup/test1/test.cpp
@@ -0,0 +1,53 @@
+// 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.
+
+/*============================================================
+**
+** Source: test.c
+**
+** Purpose: Test for CGroup
+**
+**
+** Steps to run this test on ubuntu:
+** 1. sudo apt-get install cgroup-bin
+** 2. sudo vi /etc/default/grub
+** Add cgroup_enable=memory swapaccount=1 to GRUB_CMDLINE_LINUX_DEFAULT
+** 3. sudo update-grub
+** 4. reboot
+** 5. sudo cgcreate -g cpu,memory:/myGroup -a <username>:<username> -t <username>:<username>
+** 6. echo 4M > /sys/fs/cgroup/memory/mygroup/memory.limit_in_bytes
+** 7. echo 4M > /sys/fs/cgroup/memory/mygroup/memory.memsw.limit_in_bytes
+** 8. cgexe -g memory:/mygroup --sticky <application>
+**=========================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc,char *argv[])
+{
+
+ /*
+ * Initialize the PAL and return FAILURE if this fails
+ */
+
+ if(0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ size_t mem_limit = PAL_GetRestrictedPhysicalMemoryLimit();
+
+ FILE* file = fopen("/sys/fs/cgroup/memory/mygroup/memory.limit_in_bytes", "r");
+ if(file != NULL)
+ {
+ if(mem_limit != 4194304)
+ Fail("Memory limit obtained from PAL_GetRestrictedPhysicalMemory is not 4MB\n");
+ fclose(file);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
diff --git a/src/pal/tests/palsuite/miscellaneous/GetVersionExW/test1/testinfo.dat b/src/pal/tests/palsuite/miscellaneous/CGroup/test1/testinfo.dat
index 7773245b3f..86da2d1515 100644
--- a/src/pal/tests/palsuite/miscellaneous/GetVersionExW/test1/testinfo.dat
+++ b/src/pal/tests/palsuite/miscellaneous/CGroup/test1/testinfo.dat
@@ -4,13 +4,9 @@
Version = 1.0
Section = Miscellaneous
-Function = GetVersionExW
-Name = Positive Test for GetVersionExW
+Function = CGroup
+Name = Positive Test for CGroup
TYPE = DEFAULT
EXE1 = test
Description
-= Test that all the values in the OSVERSION structure are set properly
-= for the current environment.
-
-
-
+= Test to see if Cgroup memory limit works properly
diff --git a/src/pal/tests/palsuite/miscellaneous/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/CMakeLists.txt
index 0fd4df8ad5..0b5fd37bbb 100644
--- a/src/pal/tests/palsuite/miscellaneous/CMakeLists.txt
+++ b/src/pal/tests/palsuite/miscellaneous/CMakeLists.txt
@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 2.8.12.2)
+add_subdirectory(CGroup)
add_subdirectory(CharNextA)
add_subdirectory(CharNextExA)
add_subdirectory(CloseHandle)
diff --git a/src/pal/tests/palsuite/miscellaneous/GetVersionExA/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/GetVersionExA/test1/CMakeLists.txt
deleted file mode 100644
index 1e512f3c2f..0000000000
--- a/src/pal/tests/palsuite/miscellaneous/GetVersionExA/test1/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test.cpp
-)
-
-add_executable(paltest_getversionexa_test1
- ${SOURCES}
-)
-
-add_dependencies(paltest_getversionexa_test1 coreclrpal)
-
-target_link_libraries(paltest_getversionexa_test1
- ${COMMON_TEST_LIBRARIES}
-)
diff --git a/src/pal/tests/palsuite/miscellaneous/GetVersionExA/test1/test.cpp b/src/pal/tests/palsuite/miscellaneous/GetVersionExA/test1/test.cpp
deleted file mode 100644
index 5dd20c6576..0000000000
--- a/src/pal/tests/palsuite/miscellaneous/GetVersionExA/test1/test.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-// 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.
-
-/*============================================================
-**
-** Source : test.c
-**
-** Purpose: Test for GetVersionExA() function
-**
-**
-**=========================================================*/
-
-#include <palsuite.h>
-
-int __cdecl main(int argc, char *argv[]) {
-
- OSVERSIONINFO TheVersionInfo;
- OSVERSIONINFO* pVersionInfo = &TheVersionInfo;
-
- /*
- * Initialize the PAL and return FAILURE if this fails
- */
-
- if(0 != (PAL_Initialize(argc, argv)))
- {
- return FAIL;
- }
-
-
- /* This needs to be done before using GetVersionEx */
- pVersionInfo->dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-
- /* If GetVersionEx fails, then the test fails */
- if(GetVersionEx(pVersionInfo) == 0)
- {
- Fail("ERROR: The GetVersionEx function returned 0, which indicates "
- "failure.");
- }
-
- /* These values are fixed, ensure they're set properly */
- if(pVersionInfo->dwMajorVersion != 5)
- {
- Fail("ERROR: The fixed value of dwMajorVersion shoud be 5, "
- "but is really %d.",pVersionInfo->dwMajorVersion);
- }
-
- /* The minor version values for Win2k and XP are different
- for Win2k minor version equals 0 and for XP minor version
- equals 1. Both values are excepted here. */
- if((pVersionInfo->dwMinorVersion != 0) &&
- (pVersionInfo->dwMinorVersion != 1))
- {
- Fail("ERROR: The fixed value of dwMinorVersion shoud be 0 or 1, "
- "but is really %d.",pVersionInfo->dwMinorVersion);
- }
- if(pVersionInfo->dwBuildNumber_PAL_Undefined < 0)
- {
- Fail("ERROR: The value of dwBuildNumber shoud be at least 0, but "
- "is really %d.",pVersionInfo->dwBuildNumber_PAL_Undefined);
- }
-
-#if !WIN32
- /* Under BSD, the PlatformID should be UNIX and the Service Pack
- version should be set to "".
- */
-
- if(pVersionInfo->dwPlatformId != VER_PLATFORM_UNIX ||
- pVersionInfo->szCSDVersion_PAL_Undefined[0] != 0)
- {
- Fail("ERROR: The dwPlatformId should be %d but is really %d. And the "
- "szCSDVerion should be NULL.",
- VER_PLATFORM_UNIX,pVersionInfo->dwPlatformId);
- }
-#endif
-
-
- PAL_Terminate();
- return PASS;
-}
-
-
-
diff --git a/src/pal/tests/palsuite/miscellaneous/GetVersionExA/test1/testinfo.dat b/src/pal/tests/palsuite/miscellaneous/GetVersionExA/test1/testinfo.dat
deleted file mode 100644
index 1e9c570c60..0000000000
--- a/src/pal/tests/palsuite/miscellaneous/GetVersionExA/test1/testinfo.dat
+++ /dev/null
@@ -1,16 +0,0 @@
-# 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.
-
-Version = 1.0
-Section = Miscellaneous
-Function = GetVersionExA
-Name = Positive Test for GetVersionExA
-TYPE = DEFAULT
-EXE1 = test
-Description
-= Test that all the values in the OSVERSION structure are set properly
-= for the current environment.
-
-
-
diff --git a/src/pal/tests/palsuite/miscellaneous/GetVersionExW/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/GetVersionExW/CMakeLists.txt
deleted file mode 100644
index f6aa0cb2d9..0000000000
--- a/src/pal/tests/palsuite/miscellaneous/GetVersionExW/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12.2)
-
-add_subdirectory(test1)
-
diff --git a/src/pal/tests/palsuite/miscellaneous/GetVersionExW/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/GetVersionExW/test1/CMakeLists.txt
deleted file mode 100644
index 4ef820c479..0000000000
--- a/src/pal/tests/palsuite/miscellaneous/GetVersionExW/test1/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-cmake_minimum_required(VERSION 2.8.12.2)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(SOURCES
- test.cpp
-)
-
-add_executable(paltest_getversionexw_test1
- ${SOURCES}
-)
-
-add_dependencies(paltest_getversionexw_test1 coreclrpal)
-
-target_link_libraries(paltest_getversionexw_test1
- ${COMMON_TEST_LIBRARIES}
-)
diff --git a/src/pal/tests/palsuite/miscellaneous/GetVersionExW/test1/test.cpp b/src/pal/tests/palsuite/miscellaneous/GetVersionExW/test1/test.cpp
deleted file mode 100644
index 69aae54bcf..0000000000
--- a/src/pal/tests/palsuite/miscellaneous/GetVersionExW/test1/test.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-// 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.
-
-/*============================================================
-**
-** Source : test.c
-**
-** Purpose: Test for GetVersionExW() function
-**
-**
-**=========================================================*/
-
-#define UNICODE
-
-#include <palsuite.h>
-
-int __cdecl main(int argc, char *argv[])
-{
-
- OSVERSIONINFO TheVersionInfo;
- OSVERSIONINFO* pVersionInfo = &TheVersionInfo;
-
- /*
- * Initialize the PAL and return FAILURE if this fails
- */
-
- if(0 != (PAL_Initialize(argc, argv)))
- {
- return FAIL;
- }
-
- /* This needs to be done before using GetVersionEx */
- pVersionInfo->dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-
- /* If GetVersionEx fails, then the test fails */
- if(GetVersionEx(pVersionInfo) == 0)
- {
- Fail("ERROR: The GetVersionEx function returned 0, which indicates "
- "failure.");
- }
-
- /* These values are fixed, ensure they're set properly */
- if(pVersionInfo->dwMajorVersion != 5)
- {
- Fail("ERROR: The fixed value of dwMajorVersion shoud be 5, but is "
- " really %d.",pVersionInfo->dwMajorVersion);
- }
-
- /* The minor version values for Win2k and XP are different
- for Win2k minor version equals 0 and for XP minor version
- equals 1. Both values are excepted here. */
- if((pVersionInfo->dwMinorVersion != 0) &&
- (pVersionInfo->dwMinorVersion != 1))
- {
- Fail("ERROR: The fixed value of dwMinorVersion shoud be 0 or 1, "
- "but is really %d.",pVersionInfo->dwMinorVersion);
- }
-
- if(pVersionInfo->dwBuildNumber_PAL_Undefined < 0)
- {
- Fail("ERROR: The value of dwBuildNumber shoud be at least 0, but is "
- "really %d.",pVersionInfo->dwBuildNumber_PAL_Undefined);
- }
-
-#if !WIN32
-
-
- /* Under BSD, the PlatformID should be UNIX and the Service Pack
- version should be set to "".
- */
-
- if(pVersionInfo->dwPlatformId != VER_PLATFORM_UNIX ||
- pVersionInfo->szCSDVersion_PAL_Undefined[0] != 0)
- {
- Fail("ERROR: The dwPlatformId should be %d but is really %d. And the "
- "szCSDVerion should be NULL.",VER_PLATFORM_UNIX,
- pVersionInfo->dwPlatformId);
- }
-#endif
-
-
- PAL_Terminate();
- return PASS;
-}
-
-
-
diff --git a/src/pal/tests/palsuite/paltestlist.txt b/src/pal/tests/palsuite/paltestlist.txt
index 600c2a533b..9f0be50441 100644
--- a/src/pal/tests/palsuite/paltestlist.txt
+++ b/src/pal/tests/palsuite/paltestlist.txt
@@ -687,7 +687,6 @@ miscellaneous/InterlockedIncrement64/test1/paltest_interlockedincrement64_test1
miscellaneous/InterlockedIncrement64/test2/paltest_interlockedincrement64_test2
miscellaneous/lstrlenA/test1/paltest_lstrlena_test1
miscellaneous/lstrlenW/test1/paltest_lstrlenw_test1
-miscellaneous/queryperformancecounter/test1/paltest_queryperformancecounter_test1
miscellaneous/queryperformancefrequency/test1/paltest_queryperformancefrequency_test1
miscellaneous/SetEnvironmentVariableA/test1/paltest_setenvironmentvariablea_test1
miscellaneous/SetEnvironmentVariableA/test2/paltest_setenvironmentvariablea_test2
@@ -763,9 +762,6 @@ threading/SetEvent/test1/paltest_setevent_test1
threading/SetEvent/test2/paltest_setevent_test2
threading/SetEvent/test3/paltest_setevent_test3
threading/SetEvent/test4/paltest_setevent_test4
-threading/Sleep/test1/paltest_sleep_test1
-threading/SleepEx/test1/paltest_sleepex_test1
-threading/SleepEx/test2/paltest_sleepex_test2
threading/SwitchToThread/test1/paltest_switchtothread_test1
threading/ThreadPriority/test1/paltest_threadpriority_test1
threading/TLS/test1/paltest_tls_test1
diff --git a/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt b/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt
index 0e12ccbf55..3f9469d254 100644
--- a/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt
+++ b/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt
@@ -144,8 +144,6 @@ miscellaneous/GetDateFormatW/GetDateFormatW_neg1/paltest_getdateformatw_getdatef
miscellaneous/GetDateFormatW/GetDateFormatW_neg2/paltest_getdateformatw_getdateformatw_neg2
miscellaneous/GetDateFormatW/test1/paltest_getdateformatw_test1
miscellaneous/GetUserNameW/test1/paltest_getusernamew_test1
-miscellaneous/GetVersionExA/test1/paltest_getversionexa_test1
-miscellaneous/GetVersionExW/test1/paltest_getversionexw_test1
miscellaneous/InterLockedExchangeAdd/test1/paltest_interlockedexchangeadd_test1
miscellaneous/IsBadCodePtr/test1/paltest_isbadcodeptr_test1
miscellaneous/IsBadReadPtr/test1/paltest_isbadreadptr_test1
@@ -154,6 +152,7 @@ miscellaneous/IsBadWritePtr/test2/paltest_isbadwriteptr_test2
miscellaneous/IsBadWritePtr/test3/paltest_isbadwriteptr_test3
miscellaneous/MessageBoxW/test1/paltest_messageboxw_test1
miscellaneous/MessageBoxW/test2/paltest_messageboxw_test2
+miscellaneous/queryperformancecounter/test1/paltest_queryperformancecounter_test1
miscellaneous/wsprintfW/test2/paltest_wsprintfw_test2
miscellaneous/wsprintfW/test7/paltest_wsprintfw_test7
pal_specific/PAL_GetMachineConfigurationDirectoryW/test1/paltest_pal_getmachineconfigurationdirectoryw_test1
@@ -191,6 +190,9 @@ threading/OpenEventW/test5/paltest_openeventw_test5
threading/OpenProcess/test1/paltest_openprocess_test1
threading/QueueUserAPC/test1/paltest_queueuserapc_test1
threading/setthreadcontext/test1/paltest_setthreadcontext_test1
+threading/Sleep/test1/paltest_sleep_test1
+threading/SleepEx/test1/paltest_sleepex_test1
+threading/SleepEx/test2/paltest_sleepex_test2
threading/SuspendThread/test2/paltest_suspendthread_test2
threading/SuspendThread/test3/paltest_suspendthread_test3
threading/TerminateProcess/test1/paltest_terminateprocess_test1
diff --git a/src/pal/tools/gen-buildsys-clang.sh b/src/pal/tools/gen-buildsys-clang.sh
index db342eb2c9..924a365af9 100755
--- a/src/pal/tools/gen-buildsys-clang.sh
+++ b/src/pal/tools/gen-buildsys-clang.sh
@@ -3,7 +3,7 @@
# This file invokes cmake and generates the build system for Clang.
#
-if [ $# -lt 4 -o $# -gt 8 ]
+if [ $# -lt 4 ]
then
echo "Usage..."
echo "gen-buildsys-clang.sh <path to top level CMakeLists.txt> <ClangMajorVersion> <ClangMinorVersion> <Architecture> [build flavor] [coverage] [ninja] [cmakeargs]"
@@ -139,6 +139,17 @@ if [[ -n "$CROSSCOMPILE" ]]; then
fi
cmake_extra_defines="$cmake_extra_defines -C $CONFIG_DIR/tryrun.cmake"
cmake_extra_defines="$cmake_extra_defines -DCMAKE_TOOLCHAIN_FILE=$CONFIG_DIR/toolchain.cmake"
+ cmake_extra_defines="$cmake_extra_defines -DCLR_UNIX_CROSS_BUILD=1"
+fi
+if [ $OS == "Linux" ]; then
+ linux_id_file="/etc/os-release"
+ if [[ -n "$CROSSCOMPILE" ]]; then
+ linux_id_file="$ROOTFS_DIR/$linux_id_file"
+ fi
+ if [[ -e $linux_id_file ]]; then
+ source $linux_id_file
+ cmake_extra_defines="$cmake_extra_defines -DCLR_CMAKE_LINUX_ID=$ID"
+ fi
fi
if [ "$build_arch" == "armel" ]; then
cmake_extra_defines="$cmake_extra_defines -DARM_SOFTFP=1"
diff --git a/src/pal/tools/probe-win.ps1 b/src/pal/tools/probe-win.ps1
index 783cb6dfe0..3d6c969d06 100644
--- a/src/pal/tools/probe-win.ps1
+++ b/src/pal/tools/probe-win.ps1
@@ -28,9 +28,13 @@ function GetCMakeInfo($regKey)
function LocateCMake
{
$errorMsg = "CMake is a pre-requisite to build this repository but it was not found on the path. Please install CMake from http://www.cmake.org/download/ and ensure it is on your path."
- $inPathPath = (get-command cmake.exe -ErrorAction SilentlyContinue).Path
+ $inPathPath = (get-command cmake.exe -ErrorAction SilentlyContinue)
if ($inPathPath -ne $null) {
- return $inPathPath
+ # Resolve the first version of CMake if multiple commands are found
+ if ($inPathPath.Length -gt 1) {
+ return $inPathPath[0].Path
+ }
+ return $inPathPath.Path
}
# Let us hope that CMake keep using their current version scheme
$validVersions = @()
diff --git a/src/tools/crossgen/crossgen.cpp b/src/tools/crossgen/crossgen.cpp
index df16e94bed..43e667bd25 100644
--- a/src/tools/crossgen/crossgen.cpp
+++ b/src/tools/crossgen/crossgen.cpp
@@ -108,6 +108,7 @@ void PrintUsageHelper()
W("\n")
W(" /? or /help - Display this screen\n")
W(" /nologo - Prevents displaying the logo\n")
+ W(" /silent - Do not display completion message\n")
W(" @response.rsp - Process command line arguments from specified\n")
W(" response file\n")
W(" /partialtrust - Assembly will be run in a partial trust domain.\n")
@@ -498,6 +499,10 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
{
fDisplayLogo = false;
}
+ else if (MatchParameter(*argv, W("silent")))
+ {
+ dwFlags |= NGENWORKER_FLAGS_SILENT;
+ }
else if (MatchParameter(*argv, W("Tuning")))
{
dwFlags |= NGENWORKER_FLAGS_TUNING;
diff --git a/src/tools/metainfo/mdinfo.cpp b/src/tools/metainfo/mdinfo.cpp
index 143220117e..753321fb5c 100644
--- a/src/tools/metainfo/mdinfo.cpp
+++ b/src/tools/metainfo/mdinfo.cpp
@@ -1418,7 +1418,7 @@ void MDInfo::DisplayFields(mdTypeDef inTypeDef, COR_FIELD_OFFSET *rFieldOffset,
if (cFieldOffset)
{
bool found = false;
- for (ULONG iLayout = 0; i < cFieldOffset; ++iLayout)
+ for (ULONG iLayout = 0; iLayout < cFieldOffset; ++iLayout)
{
if (RidFromToken(rFieldOffset[iLayout].ridOfField) == RidFromToken(fields[i]))
{
diff --git a/src/unwinder/i386/unwinder_i386.cpp b/src/unwinder/i386/unwinder_i386.cpp
index 2c184d1e66..5ce6e16524 100644
--- a/src/unwinder/i386/unwinder_i386.cpp
+++ b/src/unwinder/i386/unwinder_i386.cpp
@@ -76,7 +76,7 @@ OOPStackUnwinderX86::VirtualUnwind(
FillRegDisplay(&rd, ContextRecord);
- rd.SP = ContextRecord->ResumeEsp;
+ rd.SP = ContextRecord->Esp;
rd.PCTAddr = (UINT_PTR)&(ContextRecord->Eip);
if (ContextPointers)
diff --git a/src/utilcode/CMakeLists.txt b/src/utilcode/CMakeLists.txt
index 27b7a4a006..dfe830d5c0 100644
--- a/src/utilcode/CMakeLists.txt
+++ b/src/utilcode/CMakeLists.txt
@@ -1,10 +1,6 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON)
-if(WIN32)
- add_compile_options(/wd4996)
-endif(WIN32)
-
set(UTILCODE_COMMON_SOURCES
clrhost_nodependencies.cpp
ccomprc.cpp
diff --git a/src/utilcode/pedecoder.cpp b/src/utilcode/pedecoder.cpp
index 9b7a058129..79fe244bda 100644
--- a/src/utilcode/pedecoder.cpp
+++ b/src/utilcode/pedecoder.cpp
@@ -1828,8 +1828,8 @@ BOOL PEDecoder::HasNativeHeader() const
CONTRACT_END;
#ifdef FEATURE_PREJIT
- // Pretend that ready-to-run images do not have a native header
- RETURN (((GetCorHeader()->Flags & VAL32(COMIMAGE_FLAGS_IL_LIBRARY)) != 0) && !HasReadyToRunHeader());
+ // Pretend that ready-to-run images do not have native header
+ RETURN (GetCorHeader() && ((GetCorHeader()->Flags & VAL32(COMIMAGE_FLAGS_IL_LIBRARY)) != 0) && !HasReadyToRunHeader());
#else
RETURN FALSE;
#endif
diff --git a/src/utilcode/prettyprintsig.cpp b/src/utilcode/prettyprintsig.cpp
index 7e9028ddab..fc0844ce4a 100644
--- a/src/utilcode/prettyprintsig.cpp
+++ b/src/utilcode/prettyprintsig.cpp
@@ -167,7 +167,7 @@ LPCWSTR PrettyPrintSigWorker(
//*****************************************************************************
//*****************************************************************************
-// pretty prints 'type' to the buffer 'out' returns a poitner to the next type,
+// pretty prints 'type' to the buffer 'out' returns a pointer to the next type,
// or 0 on a format failure
static PCCOR_SIGNATURE PrettyPrintType(
@@ -562,7 +562,7 @@ HRESULT PrettyPrintSigWorkerInternal(
#endif
//*****************************************************************************
//*****************************************************************************
-// pretty prints 'type' to the buffer 'out' returns a poitner to the next type,
+// pretty prints 'type' to the buffer 'out' returns a pointer to the next type,
// or 0 on a format failure
__checkReturn
diff --git a/src/utilcode/safewrap.cpp b/src/utilcode/safewrap.cpp
index 4a6ecdb93c..294743d519 100644
--- a/src/utilcode/safewrap.cpp
+++ b/src/utilcode/safewrap.cpp
@@ -40,12 +40,9 @@ void ClrGetCurrentDirectory(SString & value)
// An actual API failure in GetCurrentDirectory failure should be very rare, so we'll throw on those.
if (len == 0)
- {
- value.CloseBuffer(0);
+ {
ThrowLastError();
}
-
- value.CloseBuffer();
}
// Nothrowing wrapper.
diff --git a/src/utilcode/util.cpp b/src/utilcode/util.cpp
index b0b81db281..c215a49213 100644
--- a/src/utilcode/util.cpp
+++ b/src/utilcode/util.cpp
@@ -879,6 +879,27 @@ BYTE * ClrVirtualAllocWithinRange(const BYTE *pMinAddr,
#endif
}
+#if !defined(FEATURE_REDHAWK) && defined(_TARGET_AMD64_) && !defined(FEATURE_PAL)
+// Calculate greatest common divisor
+DWORD GCD(DWORD u, DWORD v)
+{
+ while (v != 0)
+ {
+ DWORD dwTemp = v;
+ v = u % v;
+ u = dwTemp;
+ }
+
+ return u;
+}
+
+// Calculate least common multiple
+DWORD LCM(DWORD u, DWORD v)
+{
+ return u / GCD(u, v) * v;
+}
+#endif
+
/*static*/ BOOL CPUGroupInfo::InitCPUGroupInfoArray()
{
CONTRACTL
@@ -940,11 +961,13 @@ BYTE * ClrVirtualAllocWithinRange(const BYTE *pMinAddr,
m_CPUGroupInfoArray[i].nr_active = (WORD)pRecord->Group.GroupInfo[i].ActiveProcessorCount;
m_CPUGroupInfoArray[i].active_mask = pRecord->Group.GroupInfo[i].ActiveProcessorMask;
m_nProcessors += m_CPUGroupInfoArray[i].nr_active;
- dwWeight *= (DWORD)m_CPUGroupInfoArray[i].nr_active;
+ dwWeight = LCM(dwWeight, (DWORD)m_CPUGroupInfoArray[i].nr_active);
}
- //NOTE: the weight setting should work fine with 4 CPU groups upto 64 LPs each. the minimum number of threads
- // per group before the weight overflow is 2^32/(2^6x2^6x2^6) = 2^14 (i.e. 16K threads)
+ // The number of threads per group that can be supported will depend on the number of CPU groups
+ // and the number of LPs within each processor group. For example, when the number of LPs in
+ // CPU groups is the same and is 64, the number of threads per group before weight overflow
+ // would be 2^32/2^6 = 2^26 (64M threads)
for (DWORD i = 0; i < m_nGroups; i++)
{
m_CPUGroupInfoArray[i].groupWeight = dwWeight / (DWORD)m_CPUGroupInfoArray[i].nr_active;
diff --git a/src/vm/CMakeLists.txt b/src/vm/CMakeLists.txt
index 1dee95fafa..861d68c9c9 100644
--- a/src/vm/CMakeLists.txt
+++ b/src/vm/CMakeLists.txt
@@ -97,6 +97,7 @@ set(VM_SOURCES_DAC_AND_WKS_COMMON
securitydescriptorassembly.cpp
sigformat.cpp
siginfo.cpp
+ spinlock.cpp
stackwalk.cpp
stublink.cpp
stubmgr.cpp
@@ -137,8 +138,10 @@ set(VM_SOURCES_WKS
assemblynative.cpp
assemblyspec.cpp
cachelinealloc.cpp
+ callcounter.cpp
callhelpers.cpp
ceemain.cpp
+ clrconfignative.cpp
clrex.cpp
clrprivbinderutil.cpp
clrvarargs.cpp
@@ -219,7 +222,6 @@ set(VM_SOURCES_WKS
sha1.cpp
simplerwlock.cpp
sourceline.cpp
- spinlock.cpp
stackingallocator.cpp
stringliteralmap.cpp
stubcache.cpp
@@ -229,6 +231,7 @@ set(VM_SOURCES_WKS
synch.cpp
synchronizationcontextnative.cpp
testhookmgr.cpp
+ tieredcompilation.cpp
threaddebugblockinginfo.cpp
threadsuspend.cpp
typeparse.cpp
diff --git a/src/vm/amd64/JitHelpers_Slow.asm b/src/vm/amd64/JitHelpers_Slow.asm
index 7deed49d98..293e447540 100644
--- a/src/vm/amd64/JitHelpers_Slow.asm
+++ b/src/vm/amd64/JitHelpers_Slow.asm
@@ -467,13 +467,9 @@ NESTED_END JIT_NewArr1OBJ_MP, _TEXT
-; <TODO> this m_GCLock should be a size_t so we don't have a store-forwarding penalty in the code below.
-; Unfortunately, the compiler intrinsic for InterlockedExchangePointer seems to be broken and we
-; get bad code gen in gc.cpp on IA64. </TODO>
-M_GCLOCK equ ?m_GCLock@@3HC
-extern M_GCLOCK:dword
-extern generation_table:qword
+extern g_global_alloc_lock:dword
+extern g_global_alloc_context:qword
LEAF_ENTRY JIT_TrialAllocSFastSP, _TEXT
@@ -481,20 +477,20 @@ LEAF_ENTRY JIT_TrialAllocSFastSP, _TEXT
; m_BaseSize is guaranteed to be a multiple of 8.
- inc [M_GCLOCK]
+ inc [g_global_alloc_lock]
jnz JIT_NEW
- mov rax, [generation_table + 0] ; alloc_ptr
- mov r10, [generation_table + 8] ; limit_ptr
+ mov rax, [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_ptr] ; alloc_ptr
+ mov r10, [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_limit] ; limit_ptr
add r8, rax
cmp r8, r10
ja AllocFailed
- mov qword ptr [generation_table + 0], r8 ; update the alloc ptr
+ mov qword ptr [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_ptr], r8 ; update the alloc ptr
mov [rax], rcx
- mov [M_GCLOCK], -1
+ mov [g_global_alloc_lock], -1
ifdef _DEBUG
call DEBUG_TrialAllocSetAppDomain_NoScratchArea
@@ -503,7 +499,7 @@ endif ; _DEBUG
ret
AllocFailed:
- mov [M_GCLOCK], -1
+ mov [g_global_alloc_lock], -1
jmp JIT_NEW
LEAF_END JIT_TrialAllocSFastSP, _TEXT
@@ -520,11 +516,11 @@ NESTED_ENTRY JIT_BoxFastUP, _TEXT
; m_BaseSize is guaranteed to be a multiple of 8.
- inc [M_GCLOCK]
+ inc [g_global_alloc_lock]
jnz JIT_Box
- mov rax, [generation_table + 0] ; alloc_ptr
- mov r10, [generation_table + 8] ; limit_ptr
+ mov rax, [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_ptr] ; alloc_ptr
+ mov r10, [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_limit] ; limit_ptr
add r8, rax
@@ -532,9 +528,9 @@ NESTED_ENTRY JIT_BoxFastUP, _TEXT
ja NoAlloc
- mov qword ptr [generation_table + 0], r8 ; update the alloc ptr
+ mov qword ptr [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_ptr], r8 ; update the alloc ptr
mov [rax], rcx
- mov [M_GCLOCK], -1
+ mov [g_global_alloc_lock], -1
ifdef _DEBUG
call DEBUG_TrialAllocSetAppDomain_NoScratchArea
@@ -574,7 +570,7 @@ endif ; _DEBUG
ret
NoAlloc:
- mov [M_GCLOCK], -1
+ mov [g_global_alloc_lock], -1
jmp JIT_Box
NESTED_END JIT_BoxFastUP, _TEXT
@@ -602,20 +598,20 @@ LEAF_ENTRY AllocateStringFastUP, _TEXT
lea r8d, [r8d + ecx*2 + 7]
and r8d, -8
- inc [M_GCLOCK]
+ inc [g_global_alloc_lock]
jnz FramedAllocateString
- mov rax, [generation_table + 0] ; alloc_ptr
- mov r10, [generation_table + 8] ; limit_ptr
+ mov rax, [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_ptr] ; alloc_ptr
+ mov r10, [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_limit] ; limit_ptr
add r8, rax
cmp r8, r10
ja AllocFailed
- mov qword ptr [generation_table + 0], r8 ; update the alloc ptr
+ mov qword ptr [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_ptr], r8 ; update the alloc ptr
mov [rax], r11
- mov [M_GCLOCK], -1
+ mov [g_global_alloc_lock], -1
mov [rax + OFFSETOF__StringObject__m_StringLength], ecx
@@ -626,7 +622,7 @@ endif ; _DEBUG
ret
AllocFailed:
- mov [M_GCLOCK], -1
+ mov [g_global_alloc_lock], -1
jmp FramedAllocateString
LEAF_END AllocateStringFastUP, _TEXT
@@ -668,11 +664,11 @@ LEAF_ENTRY JIT_NewArr1VC_UP, _TEXT
add r8d, 7
and r8d, -8
- inc [M_GCLOCK]
+ inc [g_global_alloc_lock]
jnz JIT_NewArr1
- mov rax, [generation_table + 0] ; alloc_ptr
- mov r10, [generation_table + 8] ; limit_ptr
+ mov rax, [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_ptr] ; alloc_ptr
+ mov r10, [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_limit] ; limit_ptr
add r8, rax
jc AllocFailed
@@ -680,9 +676,9 @@ LEAF_ENTRY JIT_NewArr1VC_UP, _TEXT
cmp r8, r10
ja AllocFailed
- mov qword ptr [generation_table + 0], r8 ; update the alloc ptr
+ mov qword ptr [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_ptr], r8 ; update the alloc ptr
mov [rax], r9
- mov [M_GCLOCK], -1
+ mov [g_global_alloc_lock], -1
mov dword ptr [rax + OFFSETOF__ArrayBase__m_NumComponents], edx
@@ -693,7 +689,7 @@ endif ; _DEBUG
ret
AllocFailed:
- mov [M_GCLOCK], -1
+ mov [g_global_alloc_lock], -1
jmp JIT_NewArr1
LEAF_END JIT_NewArr1VC_UP, _TEXT
@@ -731,20 +727,20 @@ LEAF_ENTRY JIT_NewArr1OBJ_UP, _TEXT
; No need for rounding in this case - element size is 8, and m_BaseSize is guaranteed
; to be a multiple of 8.
- inc [M_GCLOCK]
+ inc [g_global_alloc_lock]
jnz JIT_NewArr1
- mov rax, [generation_table + 0] ; alloc_ptr
- mov r10, [generation_table + 8] ; limit_ptr
+ mov rax, [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_ptr] ; alloc_ptr
+ mov r10, [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_limit] ; limit_ptr
add r8, rax
cmp r8, r10
ja AllocFailed
- mov qword ptr [generation_table + 0], r8 ; update the alloc ptr
+ mov qword ptr [g_global_alloc_context + OFFSETOF__gc_alloc_context__alloc_ptr], r8 ; update the alloc ptr
mov [rax], r9
- mov [M_GCLOCK], -1
+ mov [g_global_alloc_lock], -1
mov dword ptr [rax + OFFSETOF__ArrayBase__m_NumComponents], edx
@@ -755,7 +751,7 @@ endif ; _DEBUG
ret
AllocFailed:
- mov [M_GCLOCK], -1
+ mov [g_global_alloc_lock], -1
OversizedArray:
jmp JIT_NewArr1
diff --git a/src/vm/amd64/asmconstants.h b/src/vm/amd64/asmconstants.h
index 9c3b22d8cc..e4f77deb42 100644
--- a/src/vm/amd64/asmconstants.h
+++ b/src/vm/amd64/asmconstants.h
@@ -165,6 +165,12 @@ ASMCONSTANTS_C_ASSERT(OFFSET__Thread__m_alloc_context__alloc_ptr == offsetof(Thr
#define OFFSET__Thread__m_alloc_context__alloc_limit 0x68
ASMCONSTANTS_C_ASSERT(OFFSET__Thread__m_alloc_context__alloc_limit == offsetof(Thread, m_alloc_context) + offsetof(gc_alloc_context, alloc_limit));
+#define OFFSETOF__gc_alloc_context__alloc_ptr 0x0
+ASMCONSTANT_OFFSETOF_ASSERT(gc_alloc_context, alloc_ptr);
+
+#define OFFSETOF__gc_alloc_context__alloc_limit 0x8
+ASMCONSTANT_OFFSETOF_ASSERT(gc_alloc_context, alloc_limit);
+
#define OFFSETOF__ThreadExceptionState__m_pCurrentTracker 0x000
ASMCONSTANTS_C_ASSERT(OFFSETOF__ThreadExceptionState__m_pCurrentTracker
== offsetof(ThreadExceptionState, m_pCurrentTracker));
diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp
index c50d77655e..5664740b5d 100644
--- a/src/vm/appdomain.cpp
+++ b/src/vm/appdomain.cpp
@@ -4333,6 +4333,10 @@ void AppDomain::Init()
}
#endif //FEATURE_COMINTEROP
+#ifdef FEATURE_TIERED_COMPILATION
+ m_callCounter.SetTieredCompilationManager(GetTieredCompilationManager());
+ m_tieredCompilationManager.Init(GetId());
+#endif
#endif // CROSSGEN_COMPILE
} // AppDomain::Init
@@ -7475,7 +7479,7 @@ void AppDomain::ProcessUnloadDomainEventOnFinalizeThread()
{
CONTRACTL
{
- NOTHROW;
+ THROWS;
GC_TRIGGERS;
MODE_COOPERATIVE;
}
@@ -7512,45 +7516,37 @@ void AppDomain::RaiseUnloadDomainEvent()
{
CONTRACTL
{
- NOTHROW;
+ THROWS;
MODE_COOPERATIVE;
GC_TRIGGERS;
SO_INTOLERANT;
}
CONTRACTL_END;
- EX_TRY
+ Thread *pThread = GetThread();
+ if (this != pThread->GetDomain())
{
- Thread *pThread = GetThread();
- if (this != pThread->GetDomain())
+ pThread->DoADCallBack(this, AppDomain::RaiseUnloadDomainEvent_Wrapper, this,ADV_FINALIZER|ADV_COMPILATION);
+ }
+ else
+ {
+ struct _gc
{
- pThread->DoADCallBack(this, AppDomain::RaiseUnloadDomainEvent_Wrapper, this,ADV_FINALIZER|ADV_COMPILATION);
- }
- else
+ APPDOMAINREF Domain;
+ OBJECTREF Delegate;
+ } gc;
+ ZeroMemory(&gc, sizeof(gc));
+
+ GCPROTECT_BEGIN(gc);
+ gc.Domain = (APPDOMAINREF) GetRawExposedObject();
+ if (gc.Domain != NULL)
{
- struct _gc
- {
- APPDOMAINREF Domain;
- OBJECTREF Delegate;
- } gc;
- ZeroMemory(&gc, sizeof(gc));
-
- GCPROTECT_BEGIN(gc);
- gc.Domain = (APPDOMAINREF) GetRawExposedObject();
- if (gc.Domain != NULL)
- {
- gc.Delegate = gc.Domain->m_pDomainUnloadEventHandler;
- if (gc.Delegate != NULL)
- DistributeEventReliably(&gc.Delegate, (OBJECTREF *) &gc.Domain);
- }
- GCPROTECT_END();
+ gc.Delegate = gc.Domain->m_pDomainUnloadEventHandler;
+ if (gc.Delegate != NULL)
+ DistributeEvent(&gc.Delegate, (OBJECTREF *) &gc.Domain);
}
+ GCPROTECT_END();
}
- EX_CATCH
- {
- //@TODO call a MDA here
- }
- EX_END_CATCH(SwallowAllExceptions);
}
void AppDomain::RaiseLoadingAssemblyEvent(DomainAssembly *pAssembly)
@@ -7669,20 +7665,15 @@ void AppDomain::RaiseOneExitProcessEvent()
} gc;
ZeroMemory(&gc, sizeof(gc));
- EX_TRY {
-
- GCPROTECT_BEGIN(gc);
- gc.Domain = (APPDOMAINREF) SystemDomain::GetCurrentDomain()->GetRawExposedObject();
- if (gc.Domain != NULL)
- {
- gc.Delegate = gc.Domain->m_pProcessExitEventHandler;
- if (gc.Delegate != NULL)
- DistributeEventReliably(&gc.Delegate, (OBJECTREF *) &gc.Domain);
- }
- GCPROTECT_END();
-
- } EX_CATCH {
- } EX_END_CATCH(SwallowAllExceptions);
+ GCPROTECT_BEGIN(gc);
+ gc.Domain = (APPDOMAINREF) SystemDomain::GetCurrentDomain()->GetRawExposedObject();
+ if (gc.Domain != NULL)
+ {
+ gc.Delegate = gc.Domain->m_pProcessExitEventHandler;
+ if (gc.Delegate != NULL)
+ DistributeEvent(&gc.Delegate, (OBJECTREF *) &gc.Domain);
+ }
+ GCPROTECT_END();
}
// Local wrapper used in AppDomain::RaiseExitProcessEvent,
@@ -7691,17 +7682,13 @@ void AppDomain::RaiseOneExitProcessEvent()
// because it calls private RaiseOneExitProcessEvent
/*static*/ void AppDomain::RaiseOneExitProcessEvent_Wrapper(AppDomainIterator* pi)
{
-
STATIC_CONTRACT_MODE_COOPERATIVE;
- STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_THROWS;
STATIC_CONTRACT_GC_TRIGGERS;
- EX_TRY {
- ENTER_DOMAIN_PTR(pi->GetDomain(),ADV_ITERATOR)
- AppDomain::RaiseOneExitProcessEvent();
- END_DOMAIN_TRANSITION;
- } EX_CATCH {
- } EX_END_CATCH(SwallowAllExceptions);
+ ENTER_DOMAIN_PTR(pi->GetDomain(), ADV_ITERATOR)
+ AppDomain::RaiseOneExitProcessEvent();
+ END_DOMAIN_TRANSITION;
}
static LONG s_ProcessedExitProcessEventCount = 0;
@@ -7718,7 +7705,7 @@ void AppDomain::RaiseExitProcessEvent()
return;
STATIC_CONTRACT_MODE_COOPERATIVE;
- STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_THROWS;
STATIC_CONTRACT_GC_TRIGGERS;
// Only finalizer thread during shutdown can call this function.
@@ -8271,6 +8258,18 @@ void AppDomain::Exit(BOOL fRunFinalizers, BOOL fAsyncExit)
}
}
+ // Tell the tiered compilation manager to stop initiating any new work for background
+ // jit optimization. Its possible the standard thread unwind mechanisms would pre-emptively
+ // evacuate the jit threadpool worker threads from the domain on their own, but I see no reason
+ // to take the risk of relying on them when we can easily augment with a cooperative
+ // shutdown check. This notification only initiates the process of evacuating the threads
+ // and then the UnwindThreads() call below is where blocking will occur to ensure the threads
+ // have exited the domain.
+ //
+#ifdef FEATURE_TIERED_COMPILATION
+ m_tieredCompilationManager.OnAppDomainShutdown();
+#endif
+
//
// Set up blocks so no threads can enter except for the finalizer and the thread
// doing the unload.
diff --git a/src/vm/appdomain.hpp b/src/vm/appdomain.hpp
index d6023dd3b2..ed83eb3e2f 100644
--- a/src/vm/appdomain.hpp
+++ b/src/vm/appdomain.hpp
@@ -43,6 +43,11 @@
#include "appxutil.h"
+#ifdef FEATURE_TIERED_COMPILATION
+#include "tieredcompilation.h"
+#include "callcounter.h"
+#endif
+
class BaseDomain;
class SystemDomain;
class SharedDomain;
@@ -3823,6 +3828,29 @@ public:
#endif
+#if defined(FEATURE_TIERED_COMPILATION)
+
+public:
+ TieredCompilationManager * GetTieredCompilationManager()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return &m_tieredCompilationManager;
+ }
+
+private:
+ TieredCompilationManager m_tieredCompilationManager;
+
+public:
+ CallCounter * GetCallCounter()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return &m_callCounter;
+ }
+
+private:
+ CallCounter m_callCounter;
+#endif
+
#ifdef FEATURE_COMINTEROP
private:
diff --git a/src/vm/arm/stubs.cpp b/src/vm/arm/stubs.cpp
index c276d21877..f1ba278ada 100644
--- a/src/vm/arm/stubs.cpp
+++ b/src/vm/arm/stubs.cpp
@@ -2641,7 +2641,7 @@ void InitJITHelpers1()
))
{
- _ASSERTE(GCHeapUtilities::UseAllocationContexts());
+ _ASSERTE(GCHeapUtilities::UseThreadAllocationContexts());
// If the TLS for Thread is low enough use the super-fast helpers
if (gThreadTLSIndex < TLS_MINIMUM_AVAILABLE)
{
diff --git a/src/vm/arm64/calldescrworkerarm64.S b/src/vm/arm64/calldescrworkerarm64.S
index 2210d70523..5bcad2f9c0 100644
--- a/src/vm/arm64/calldescrworkerarm64.S
+++ b/src/vm/arm64/calldescrworkerarm64.S
@@ -13,8 +13,7 @@
NESTED_ENTRY CallDescrWorkerInternal, _TEXT, NoHandler
PROLOG_SAVE_REG_PAIR_INDEXED fp, lr, -32
- PROLOG_SAVE_REG x19, 16
- PROLOG_SAVE_REG x0, 24
+ PROLOG_SAVE_REG x19, 16 //the stack slot at sp+24 is empty for 16 byte alligment
mov x19, x0 // save pCallDescrData in x19
@@ -69,8 +68,6 @@ LOCAL_LABEL(NoFloatingPoint):
ldr x9, [x19,#CallDescrData__pTarget]
blr x9
- ldr x19, [fp, 24] // Fixup corrupted X19 caller preserved register
-
ldr w3, [x19,#CallDescrData__fpReturnSize]
// Int return case
diff --git a/src/vm/assemblynative.cpp b/src/vm/assemblynative.cpp
index ed5cd7207a..b9079ec06a 100644
--- a/src/vm/assemblynative.cpp
+++ b/src/vm/assemblynative.cpp
@@ -507,9 +507,12 @@ Assembly* AssemblyNative::LoadFromPEImage(ICLRPrivBinder* pBinderContext, PEImag
spec.GetFileOrDisplayName(0, name);
COMPlusThrowHR(COR_E_FILELOAD, dwMessageID, name);
}
+
+ BINDER_SPACE::Assembly* assem;
+ assem = BINDER_SPACE::GetAssemblyFromPrivAssemblyFast(pAssembly);
- PEAssemblyHolder pPEAssembly(PEAssembly::Open(pParentAssembly, pILImage, pNIImage, pAssembly, FALSE));
-
+ PEAssemblyHolder pPEAssembly(PEAssembly::Open(pParentAssembly, assem->GetPEImage(), assem->GetNativePEImage(), pAssembly, FALSE));
+
GCX_COOP();
IApplicationSecurityDescriptor *pDomainSecDesc = pCurDomain->GetSecurityDescriptor();
diff --git a/src/vm/baseassemblyspec.cpp b/src/vm/baseassemblyspec.cpp
index fdaa981523..4d6ba26e40 100644
--- a/src/vm/baseassemblyspec.cpp
+++ b/src/vm/baseassemblyspec.cpp
@@ -266,9 +266,9 @@ BOOL BaseAssemblySpec::CompareRefToDef(const BaseAssemblySpec *pRef, const BaseA
}
//
- // flags are non-optional, except processor architecture and content type
+ // flags are non-optional, except processor architecture, content type, and debuggable attribute bits
//
- DWORD dwFlagsMask = ~(afPA_FullMask | afContentType_Mask);
+ DWORD dwFlagsMask = ~(afPA_FullMask | afContentType_Mask | afDebuggableAttributeMask);
if ((pRef->m_dwFlags & dwFlagsMask) != (pDef->m_dwFlags & dwFlagsMask))
return FALSE;
diff --git a/src/vm/binder.cpp b/src/vm/binder.cpp
index 0a273d0fcb..9ce1584c31 100644
--- a/src/vm/binder.cpp
+++ b/src/vm/binder.cpp
@@ -562,6 +562,7 @@ void MscorlibBinder::Check()
}
}
+#ifdef CHECK_FCALL_SIGNATURE
//
// check consistency of the unmanaged and managed fcall signatures
//
@@ -842,6 +843,7 @@ static void FCallCheckSignature(MethodDesc* pMD, PCODE pImpl)
}
}
}
+#endif // CHECK_FCALL_SIGNATURE
//
// extended check of consistency between mscorlib and mscorwks:
@@ -1047,10 +1049,12 @@ void MscorlibBinder::CheckExtended()
usedECallIds.Add(id);
}
+#ifdef CHECK_FCALL_SIGNATURE
if (pMD->IsFCall())
{
FCallCheckSignature(pMD, ECall::GetFCallImpl(pMD));
}
+#endif // CHECK_FCALL_SIGNATURE
}
pInternalImport->EnumClose(&hEnum);
diff --git a/src/vm/callcounter.cpp b/src/vm/callcounter.cpp
new file mode 100644
index 0000000000..90013c79fb
--- /dev/null
+++ b/src/vm/callcounter.cpp
@@ -0,0 +1,98 @@
+// 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.
+// ===========================================================================
+// File: CallCounter.CPP
+//
+// ===========================================================================
+
+
+
+#include "common.h"
+#include "excep.h"
+#include "log.h"
+#include "tieredcompilation.h"
+#include "callcounter.h"
+
+#ifdef FEATURE_TIERED_COMPILATION
+
+CallCounter::CallCounter()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ m_lock.Init(LOCK_TYPE_DEFAULT);
+}
+
+// Init our connection to the tiered compilation manager during
+// AppDomain startup. This pointer will remain valid for the lifetime
+// of the AppDomain.
+void CallCounter::SetTieredCompilationManager(TieredCompilationManager* pTieredCompilationManager)
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CAN_TAKE_LOCK;
+ MODE_PREEMPTIVE;
+ }
+ CONTRACTL_END;
+
+ m_pTieredCompilationManager.Store(pTieredCompilationManager);
+}
+
+// This is called by the prestub each time the method is invoked in a particular
+// AppDomain (the AppDomain for which AppDomain.GetCallCounter() == this). These
+// calls continue until we backpatch the prestub to avoid future calls. This allows
+// us to track the number of calls to each method and use it as a trigger for tiered
+// compilation.
+//
+// Returns TRUE if no future invocations are needed (we reached the count we cared about)
+// and FALSE otherwise. It is permissible to keep calling even when TRUE was previously
+// returned and multi-threaded race conditions will surely cause this to occur.
+BOOL CallCounter::OnMethodCalled(MethodDesc* pMethodDesc)
+{
+ STANDARD_VM_CONTRACT;
+
+ _ASSERTE(pMethodDesc->IsEligibleForTieredCompilation());
+
+ // PERF: This as a simple to implement, but not so performant, call counter
+ // Currently this is only called until we reach a fixed call count and then
+ // disabled. Its likely we'll want to improve this at some point but
+ // its not as bad as you might expect. Allocating a counter inline in the
+ // MethodDesc or at some location computable from the MethodDesc should
+ // eliminate 1 pointer per-method (the MethodDesc* key) and the CPU
+ // overhead to acquire the lock/search the dictionary. Depending on where it
+ // is we may also be able to reduce it to 1 byte counter without wasting the
+ // following bytes for alignment. Further work to inline the OnMethodCalled
+ // callback directly into the jitted code would eliminate CPU overhead of
+ // leaving the prestub unpatched, but may not be good overall as it increases
+ // the size of the jitted code.
+
+
+ TieredCompilationManager* pCallCounterSink = NULL;
+ int callCount;
+ {
+ //Be careful if you convert to something fully lock/interlocked-free that
+ //you correctly handle what happens when some N simultaneous calls don't
+ //all increment the counter. The slight drift is probably neglible for tuning
+ //but TieredCompilationManager::OnMethodCalled() doesn't expect multiple calls
+ //each claiming to be exactly the threshhold call count needed to trigger
+ //optimization.
+ SpinLockHolder holder(&m_lock);
+ CallCounterEntry* pEntry = const_cast<CallCounterEntry*>(m_methodToCallCount.LookupPtr(pMethodDesc));
+ if (pEntry == NULL)
+ {
+ callCount = 1;
+ m_methodToCallCount.Add(CallCounterEntry(pMethodDesc, callCount));
+ }
+ else
+ {
+ pEntry->callCount++;
+ callCount = pEntry->callCount;
+ }
+ }
+
+ return m_pTieredCompilationManager.Load()->OnMethodCalled(pMethodDesc, callCount);
+}
+
+#endif // FEATURE_TIERED_COMPILATION
diff --git a/src/vm/callcounter.h b/src/vm/callcounter.h
new file mode 100644
index 0000000000..82d14b76d9
--- /dev/null
+++ b/src/vm/callcounter.h
@@ -0,0 +1,87 @@
+// 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.
+// ===========================================================================
+// File: CallCounter.h
+//
+// ===========================================================================
+
+
+#ifndef CALL_COUNTER_H
+#define CALL_COUNTER_H
+
+#ifdef FEATURE_TIERED_COMPILATION
+
+// One entry in our dictionary mapping methods to the number of times they
+// have been invoked
+struct CallCounterEntry
+{
+ CallCounterEntry() {}
+ CallCounterEntry(const MethodDesc* m, const int c)
+ : pMethod(m), callCount(c) {}
+
+ const MethodDesc* pMethod;
+ int callCount;
+};
+
+class CallCounterHashTraits : public DefaultSHashTraits<CallCounterEntry>
+{
+public:
+ typedef typename DefaultSHashTraits<CallCounterEntry>::element_t element_t;
+ typedef typename DefaultSHashTraits<CallCounterEntry>::count_t count_t;
+
+ typedef const MethodDesc* key_t;
+
+ static key_t GetKey(element_t e)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return e.pMethod;
+ }
+ static BOOL Equals(key_t k1, key_t k2)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return k1 == k2;
+ }
+ static count_t Hash(key_t k)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (count_t)(size_t)k;
+ }
+
+ static const element_t Null() { LIMITED_METHOD_CONTRACT; return element_t(NULL, 0); }
+ static const element_t Deleted() { LIMITED_METHOD_CONTRACT; return element_t((const MethodDesc*)-1, 0); }
+ static bool IsNull(const element_t &e) { LIMITED_METHOD_CONTRACT; return e.pMethod == NULL; }
+ static bool IsDeleted(const element_t &e) { return e.pMethod == (const MethodDesc*)-1; }
+};
+
+typedef SHash<NoRemoveSHashTraits<CallCounterHashTraits>> CallCounterHash;
+
+
+// This is a per-appdomain cache of call counts for all code in that AppDomain.
+// Each method invocation should trigger a call to OnMethodCalled (until it is disabled per-method)
+// and the CallCounter will forward the call to the TieredCompilationManager including the
+// current call count.
+class CallCounter
+{
+public:
+#if defined(DACCESS_COMPILE) || defined(CROSSGEN_COMPILE)
+ CallCounter() {}
+#else
+ CallCounter();
+#endif
+
+ void SetTieredCompilationManager(TieredCompilationManager* pTieredCompilationManager);
+ BOOL OnMethodCalled(MethodDesc* pMethodDesc);
+
+private:
+
+ VolatilePtr<TieredCompilationManager> m_pTieredCompilationManager;
+
+ // fields protected by lock
+ SpinLock m_lock;
+ CallCounterHash m_methodToCallCount;
+};
+
+#endif // FEATURE_TIERED_COMPILATION
+
+#endif // CALL_COUNTER_H
diff --git a/src/vm/callingconvention.h b/src/vm/callingconvention.h
index c9a27c2371..cde2ba465a 100644
--- a/src/vm/callingconvention.h
+++ b/src/vm/callingconvention.h
@@ -1701,6 +1701,17 @@ inline BOOL HasRetBuffArg(MetaSig * pSig)
return argit.HasRetBuffArg();
}
+#ifdef UNIX_X86_ABI
+// For UNIX_X86_ABI and unmanaged function, we always need RetBuf if the return type is VALUETYPE
+inline BOOL HasRetBuffArgUnmanagedFixup(MetaSig * pSig)
+{
+ WRAPPER_NO_CONTRACT;
+ // We cannot just pSig->GetReturnType() here since it will return ELEMENT_TYPE_VALUETYPE for enums
+ CorElementType type = pSig->GetRetTypeHandleThrowing().GetVerifierCorElementType();
+ return type == ELEMENT_TYPE_VALUETYPE;
+}
+#endif
+
inline BOOL IsRetBuffPassedAsFirstArg()
{
WRAPPER_NO_CONTRACT;
diff --git a/src/vm/ceeload.cpp b/src/vm/ceeload.cpp
index 1979d694cb..0845d8608f 100644
--- a/src/vm/ceeload.cpp
+++ b/src/vm/ceeload.cpp
@@ -6511,7 +6511,9 @@ MethodDesc *Module::FindMethod(mdToken pMethod)
CONTRACT_VIOLATION(ThrowsViolation);
char szMethodName [MAX_CLASSNAME_LENGTH];
CEEInfo::findNameOfToken(this, pMethod, szMethodName, COUNTOF (szMethodName));
- LOG((LF_IJW, LL_INFO10, "Failed to find Method: %s for Vtable Fixup\n", szMethodName));
+ // This used to be LF_IJW, but changed to LW_INTEROP to reclaim a bit in our log facilities
+ // IJW itself is not supported in coreclr so this code should never be run.
+ LOG((LF_INTEROP, LL_INFO10, "Failed to find Method: %s for Vtable Fixup\n", szMethodName));
#endif // _DEBUG
}
EX_END_CATCH(SwallowAllExceptions)
@@ -14519,8 +14521,7 @@ void Module::ExpandAll()
#include "clrvarargs.h" /* for VARARG C_ASSERTs in asmconstants.h */
class CheckAsmOffsets
{
-#define ASMCONSTANTS_C_ASSERT(cond) \
- typedef char UNIQUE_LABEL(__C_ASSERT__)[(cond) ? 1 : -1];
+#define ASMCONSTANTS_C_ASSERT(cond) static_assert(cond, #cond);
#include "asmconstants.h"
};
diff --git a/src/vm/ceemain.cpp b/src/vm/ceemain.cpp
index bb82191c70..d5d09626a2 100644
--- a/src/vm/ceemain.cpp
+++ b/src/vm/ceemain.cpp
@@ -483,6 +483,7 @@ void InitializeStartupFlags()
InitializeHeapType((flags & STARTUP_SERVER_GC) != 0);
+ g_heap_type = (flags & STARTUP_SERVER_GC) == 0 ? GC_HEAP_WKS : GC_HEAP_SVR;
#ifdef FEATURE_LOADER_OPTIMIZATION
g_dwGlobalSharePolicy = (flags&STARTUP_LOADER_OPTIMIZATION_MASK)>>1;
@@ -582,6 +583,23 @@ void InitGSCookie()
}
}
+Volatile<BOOL> g_bIsGarbageCollectorFullyInitialized = FALSE;
+
+void SetGarbageCollectorFullyInitialized()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ g_bIsGarbageCollectorFullyInitialized = TRUE;
+}
+
+// Tells whether the garbage collector is fully initialized
+// Stronger than IsGCHeapInitialized
+BOOL IsGarbageCollectorFullyInitialized()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return g_bIsGarbageCollectorFullyInitialized;
+}
// ---------------------------------------------------------------------------
// %%Function: EEStartupHelper
@@ -845,11 +863,14 @@ void EEStartupHelper(COINITIEE fFlags)
#ifndef CROSSGEN_COMPILE
+ InitializeGarbageCollector();
+
// Initialize remoting
- // weak_short, weak_long, strong; no pin
- if (!Ref_Initialize())
+ if (!GCHeapUtilities::GetGCHandleTable()->Initialize())
+ {
IfFailGo(E_OUTOFMEMORY);
+ }
// Initialize contexts
Context::Initialize();
@@ -857,8 +878,6 @@ void EEStartupHelper(COINITIEE fFlags)
g_pEEShutDownEvent = new CLREvent();
g_pEEShutDownEvent->CreateManualEvent(FALSE);
-
-
#ifdef FEATURE_IPCMAN
// Initialize CCLRSecurityAttributeManager
CCLRSecurityAttributeManager::ProcessInit();
@@ -868,7 +887,6 @@ void EEStartupHelper(COINITIEE fFlags)
GCInterface::m_MemoryPressureLock.Init(CrstGCMemoryPressure);
-
#endif // CROSSGEN_COMPILE
// Setup the domains. Threads are started in a default domain.
@@ -887,6 +905,10 @@ void EEStartupHelper(COINITIEE fFlags)
#ifndef CROSSGEN_COMPILE
+ // This isn't done as part of InitializeGarbageCollector() above because thread
+ // creation requires AppDomains to have been set up.
+ FinalizerThread::FinalizerThreadCreate();
+
#ifndef FEATURE_PAL
// Watson initialization must precede InitializeDebugger() and InstallUnhandledExceptionFilter()
// because on CoreCLR when Waston is enabled, debugging service needs to be enabled and UEF will be used.
@@ -990,7 +1012,14 @@ void EEStartupHelper(COINITIEE fFlags)
}
#endif
- InitializeGarbageCollector();
+ // This isn't done as part of InitializeGarbageCollector() above because it
+ // requires write barriers to have been set up on x86, which happens as part
+ // of InitJITHelpers1.
+ hr = g_pGCHeap->Initialize();
+ IfFailGo(hr);
+
+ // Now we really have fully initialized the garbage collector
+ SetGarbageCollectorFullyInitialized();
InitializePinHandleTable();
@@ -1828,7 +1857,7 @@ part2:
#ifdef SHOULD_WE_CLEANUP
if (!g_fFastExitProcess)
{
- Ref_Shutdown(); // shut down the handle table
+ GCHeapUtilities::GetGCHandleTable()->Shutdown();
}
#endif /* SHOULD_WE_CLEANUP */
@@ -2378,11 +2407,6 @@ void STDMETHODCALLTYPE CoUninitializeEE(BOOL fIsDllUnloading)
}
-
-
-
-
-
//*****************************************************************************
BOOL ExecuteDLL_ReturnOrThrow(HRESULT hr, BOOL fFromThunk)
{
@@ -2402,28 +2426,6 @@ BOOL ExecuteDLL_ReturnOrThrow(HRESULT hr, BOOL fFromThunk)
return SUCCEEDED(hr);
}
-
-
-
-
-Volatile<BOOL> g_bIsGarbageCollectorFullyInitialized = FALSE;
-
-void SetGarbageCollectorFullyInitialized()
-{
- LIMITED_METHOD_CONTRACT;
-
- g_bIsGarbageCollectorFullyInitialized = TRUE;
-}
-
-// Tells whether the garbage collector is fully initialized
-// Stronger than IsGCHeapInitialized
-BOOL IsGarbageCollectorFullyInitialized()
-{
- LIMITED_METHOD_CONTRACT;
-
- return g_bIsGarbageCollectorFullyInitialized;
-}
-
//
// Initialize the Garbage Collector
//
@@ -2458,15 +2460,17 @@ void InitializeGarbageCollector()
IGCToCLR* gcToClr = nullptr;
#endif
+ IGCHandleTable *pGcHandleTable;
IGCHeap *pGCHeap;
- if (!InitializeGarbageCollector(gcToClr, &pGCHeap, &g_gc_dac_vars))
+ if (!InitializeGarbageCollector(gcToClr, &pGCHeap, &pGcHandleTable, &g_gc_dac_vars))
{
ThrowOutOfMemory();
}
assert(pGCHeap != nullptr);
g_pGCHeap = pGCHeap;
+ g_pGCHandleTable = pGcHandleTable;
g_gcDacGlobals = &g_gc_dac_vars;
// Apparently the Windows linker removes global variables if they are never
@@ -2474,15 +2478,6 @@ void InitializeGarbageCollector()
// only the DAC will read from it. This forces the linker to include
// g_gcDacGlobals.
volatile void* _dummy = g_gcDacGlobals;
-
- hr = pGCHeap->Initialize();
- IfFailThrow(hr);
-
- // Thread for running finalizers...
- FinalizerThread::FinalizerThreadCreate();
-
- // Now we really have fully initialized the garbage collector
- SetGarbageCollectorFullyInitialized();
}
/*****************************************************************************/
@@ -3402,24 +3397,4 @@ void ContractRegressionCheck()
#endif // ENABLE_CONTRACTS_IMPL
-
#endif // CROSSGEN_COMPILE
-
-
-//
-// GetOSVersion - Gets the real OS version bypassing the OS compatibility shim
-// Mscoree.dll resides in System32 dir and is always excluded from compat shim.
-// This function calls mscoree!shim function via mscoreei ICLRRuntimeHostInternal interface
-// to get the OS version. We do not do this PAL or coreclr..we direclty call the OS
-// in that case.
-//
-BOOL GetOSVersion(LPOSVERSIONINFO lposVer)
-{
-// Fix for warnings when building against WinBlue build 9444.0.130614-1739
-// warning C4996: 'GetVersionExW': was declared deprecated
-// externalapis\windows\winblue\sdk\inc\sysinfoapi.h(442)
-// Deprecated. Use VerifyVersionInfo* or IsWindows* macros from VersionHelpers.
-#pragma warning( disable : 4996 )
- return WszGetVersionEx(lposVer);
-#pragma warning( default : 4996 )
-}
diff --git a/src/vm/clrconfignative.cpp b/src/vm/clrconfignative.cpp
new file mode 100644
index 0000000000..11b9eb5555
--- /dev/null
+++ b/src/vm/clrconfignative.cpp
@@ -0,0 +1,21 @@
+// 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.
+//
+// File: clrconfiguration.cpp
+//
+
+#include "common.h"
+#include "clrconfignative.h"
+#include <configuration.h>
+
+BOOL QCALLTYPE ClrConfigNative::GetConfigBoolValue(LPCWSTR name)
+{
+ QCALL_CONTRACT;
+
+ BOOL retValue = FALSE;
+ BEGIN_QCALL;
+ retValue = Configuration::GetKnobBooleanValue(name, FALSE);
+ END_QCALL;
+ return(retValue);
+}
diff --git a/src/vm/clrconfignative.h b/src/vm/clrconfignative.h
new file mode 100644
index 0000000000..a60d119558
--- /dev/null
+++ b/src/vm/clrconfignative.h
@@ -0,0 +1,14 @@
+// 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.
+
+#ifndef _CLRCONFIGNATIVE_H_
+#define _CLRCONFIGNATIVE_H_
+
+class ClrConfigNative
+{
+public:
+ static BOOL QCALLTYPE GetConfigBoolValue(LPCWSTR name);
+};
+
+#endif // _CLRCONFIGNATIVE_H_
diff --git a/src/vm/comdelegate.cpp b/src/vm/comdelegate.cpp
index 075c473285..2682c2d32a 100644
--- a/src/vm/comdelegate.cpp
+++ b/src/vm/comdelegate.cpp
@@ -277,7 +277,14 @@ VOID GenerateShuffleArray(MethodDesc* pInvoke, MethodDesc *pTargetMeth, SArray<S
COMPlusThrow(kVerificationException);
}
- UINT stackSizeDelta = stackSizeSrc - stackSizeDst;
+ UINT stackSizeDelta;
+
+#ifdef UNIX_X86_ABI
+ // Stack does not shrink as UNIX_X86_ABI uses CDECL (instead of STDCALL).
+ stackSizeDelta = 0;
+#else
+ stackSizeDelta = stackSizeSrc - stackSizeDst;
+#endif
INT ofsSrc, ofsDst;
@@ -3960,55 +3967,12 @@ static void InvokeUnhandledSwallowing(OBJECTREF *pDelegate,
}
-// cannot combine SEH & C++ exceptions in one method. Split out from InvokeNotify.
-static void InvokeNotifyInner(OBJECTREF *pDelegate, OBJECTREF *pDomain)
-{
- // static contract, since we use SEH.
- STATIC_CONTRACT_GC_TRIGGERS;
- STATIC_CONTRACT_THROWS;
- STATIC_CONTRACT_MODE_COOPERATIVE;
-
- _ASSERTE(pDelegate != NULL && IsProtectedByGCFrame(pDelegate));
- _ASSERTE(pDomain != NULL && IsProtectedByGCFrame(pDomain));
-
- struct Param : ThreadBaseExceptionFilterParam
- {
- OBJECTREF *pDelegate;
- OBJECTREF *pDomain;
- } param;
- param.location = SystemNotification;
- param.pDelegate = pDelegate;
- param.pDomain = pDomain;
-
- PAL_TRY(Param *, pParam, &param)
- {
- PREPARE_NONVIRTUAL_CALLSITE_USING_CODE(DELEGATEREF(*pParam->pDelegate)->GetMethodPtr());
-
- DECLARE_ARGHOLDER_ARRAY(args, 3);
-
- args[ARGNUM_0] = OBJECTREF_TO_ARGHOLDER(DELEGATEREF(*pParam->pDelegate)->GetTarget());
- args[ARGNUM_1] = OBJECTREF_TO_ARGHOLDER(*pParam->pDomain);
- args[ARGNUM_2] = NULL;
-
- CALL_MANAGED_METHOD_NORET(args);
- }
- PAL_EXCEPT_FILTER(ThreadBaseExceptionFilter)
- {
- _ASSERTE(!"ThreadBaseExceptionFilter returned EXECUTE_HANDLER.");
- }
- PAL_ENDTRY;
-}
-
-
-
-// Helper to dispatch a single event notification. If anything goes wrong, we cause
-// an unhandled exception notification to occur out of our first pass, and then we
-// swallow and continue.
+// Helper to dispatch a single event notification.
static void InvokeNotify(OBJECTREF *pDelegate, OBJECTREF *pDomain)
{
CONTRACTL
{
- NOTHROW;
+ THROWS;
GC_TRIGGERS;
MODE_COOPERATIVE;
}
@@ -4030,19 +3994,15 @@ static void InvokeNotify(OBJECTREF *pDelegate, OBJECTREF *pDomain)
_ASSERTE(!pThread->HasCriticalRegion());
_ASSERTE(!pThread->HasThreadAffinity());
- EX_TRY
- {
- InvokeNotifyInner(pDelegate, pDomain);
- }
- EX_CATCH
- {
- // It's not even worth asserting, because these aren't our bugs. At
- // some point, a MDA may be warranted.
- // This is an early check for condition that we assert in Thread::InternalReset called from DoOneFinalization later.
- _ASSERTE(!pThread->HasCriticalRegion());
- _ASSERTE(!pThread->HasThreadAffinity());
- }
- EX_END_CATCH(SwallowAllExceptions)
+ PREPARE_NONVIRTUAL_CALLSITE_USING_CODE(DELEGATEREF(*pDelegate)->GetMethodPtr());
+
+ DECLARE_ARGHOLDER_ARRAY(args, 3);
+
+ args[ARGNUM_0] = OBJECTREF_TO_ARGHOLDER(DELEGATEREF(*pDelegate)->GetTarget());
+ args[ARGNUM_1] = OBJECTREF_TO_ARGHOLDER(*pDomain);
+ args[ARGNUM_2] = NULL;
+
+ CALL_MANAGED_METHOD_NORET(args);
// This is an early check for condition that we assert in Thread::InternalReset called from DoOneFinalization later.
_ASSERTE(!pThread->HasCriticalRegion());
@@ -4050,16 +4010,11 @@ static void InvokeNotify(OBJECTREF *pDelegate, OBJECTREF *pDomain)
}
-// For critical system events, ensure that each handler gets a notification --
-// even if prior handlers in the chain have thrown an exception. Also, try
-// to deliver an unhandled exception event if we ever swallow an exception
-// out of a reliable notification. Note that the add_ event handers are
-// responsible for any reliable preparation of the target, like eager JITting.
-void DistributeEventReliably(OBJECTREF *pDelegate, OBJECTREF *pDomain)
+void DistributeEvent(OBJECTREF *pDelegate, OBJECTREF *pDomain)
{
CONTRACTL
{
- NOTHROW;
+ THROWS;
GC_TRIGGERS;
MODE_COOPERATIVE;
}
@@ -4070,51 +4025,42 @@ void DistributeEventReliably(OBJECTREF *pDelegate, OBJECTREF *pDomain)
Thread *pThread = GetThread();
- EX_TRY
+ struct _gc
{
- struct _gc
- {
- PTRARRAYREF Array;
- OBJECTREF InnerDelegate;
- } gc;
- ZeroMemory(&gc, sizeof(gc));
+ PTRARRAYREF Array;
+ OBJECTREF InnerDelegate;
+ } gc;
+ ZeroMemory(&gc, sizeof(gc));
- GCPROTECT_BEGIN(gc);
+ GCPROTECT_BEGIN(gc);
- gc.Array = (PTRARRAYREF) ((DELEGATEREF)(*pDelegate))->GetInvocationList();
- if (gc.Array == NULL || !gc.Array->GetMethodTable()->IsArray())
- {
- InvokeNotify(pDelegate, pDomain);
- }
- else
- {
- // The _invocationCount could be less than the array size, if we are sharing
- // immutable arrays cleverly.
- INT_PTR invocationCount = ((DELEGATEREF)(*pDelegate))->GetInvocationCount();
+ gc.Array = (PTRARRAYREF) ((DELEGATEREF)(*pDelegate))->GetInvocationList();
+ if (gc.Array == NULL || !gc.Array->GetMethodTable()->IsArray())
+ {
+ InvokeNotify(pDelegate, pDomain);
+ }
+ else
+ {
+ // The _invocationCount could be less than the array size, if we are sharing
+ // immutable arrays cleverly.
+ INT_PTR invocationCount = ((DELEGATEREF)(*pDelegate))->GetInvocationCount();
- _ASSERTE(FitsInU4(invocationCount));
- DWORD cnt = static_cast<DWORD>(invocationCount);
+ _ASSERTE(FitsInU4(invocationCount));
+ DWORD cnt = static_cast<DWORD>(invocationCount);
- _ASSERTE(cnt <= gc.Array->GetNumComponents());
+ _ASSERTE(cnt <= gc.Array->GetNumComponents());
- for (DWORD i=0; i<cnt; i++)
+ for (DWORD i=0; i<cnt; i++)
+ {
+ gc.InnerDelegate = gc.Array->m_Array[i];
+ InvokeNotify(&gc.InnerDelegate, pDomain);
+ if (pThread->IsAbortRequested())
{
- gc.InnerDelegate = gc.Array->m_Array[i];
- InvokeNotify(&gc.InnerDelegate, pDomain);
- if (pThread->IsAbortRequested())
- {
- pThread->UnmarkThreadForAbort(Thread::TAR_Thread);
- }
+ pThread->UnmarkThreadForAbort(Thread::TAR_Thread);
}
}
- GCPROTECT_END();
}
- EX_CATCH
- {
- // It's not even worth asserting, because these aren't our bugs. At
- // some point, a MDA may be warranted.
- }
- EX_END_CATCH(SwallowAllExceptions)
+ GCPROTECT_END();
}
// The unhandled exception event is a little easier to distribute, because
diff --git a/src/vm/comdelegate.h b/src/vm/comdelegate.h
index c8ebf377ba..f1bed43db6 100644
--- a/src/vm/comdelegate.h
+++ b/src/vm/comdelegate.h
@@ -180,8 +180,8 @@ enum DelegateBindingFlags
DBF_RelaxedSignature = 0x00000080, // Allow relaxed signature matching (co/contra variance)
};
-void DistributeEventReliably(OBJECTREF *pDelegate,
- OBJECTREF *pDomain);
+void DistributeEvent(OBJECTREF *pDelegate,
+ OBJECTREF *pDomain);
void DistributeUnhandledExceptionReliably(OBJECTREF *pDelegate,
OBJECTREF *pDomain,
diff --git a/src/vm/commemoryfailpoint.cpp b/src/vm/commemoryfailpoint.cpp
index 4d1ed6ef64..2900409fb1 100644
--- a/src/vm/commemoryfailpoint.cpp
+++ b/src/vm/commemoryfailpoint.cpp
@@ -27,8 +27,8 @@ FCIMPL2(void, COMMemoryFailPoint::GetMemorySettings, UINT64* pMaxGCSegmentSize,
FCALL_CONTRACT;
IGCHeap * pGC = GCHeapUtilities::GetGCHeap();
- size_t segment_size = pGC->GetValidSegmentSize(FALSE);
- size_t large_segment_size = pGC->GetValidSegmentSize(TRUE);
+ size_t segment_size = pGC->GetValidSegmentSize(false);
+ size_t large_segment_size = pGC->GetValidSegmentSize(true);
_ASSERTE(segment_size < SIZE_T_MAX && large_segment_size < SIZE_T_MAX);
if (segment_size > large_segment_size)
*pMaxGCSegmentSize = (UINT64) segment_size;
diff --git a/src/vm/comsynchronizable.cpp b/src/vm/comsynchronizable.cpp
index bd24f6d392..08b5281a42 100644
--- a/src/vm/comsynchronizable.cpp
+++ b/src/vm/comsynchronizable.cpp
@@ -926,18 +926,8 @@ FCIMPL1(INT32, ThreadNative::GetThreadState, ThreadBaseObject* pThisUNSAFE)
if (state & Thread::TS_Interruptible)
res |= ThreadWaitSleepJoin;
- // Don't report a SuspendRequested if the thread has actually Suspended.
- if ((state & Thread::TS_UserSuspendPending) &&
- (state & Thread::TS_SyncSuspended)
- )
- {
- res |= ThreadSuspended;
- }
- else
- if (state & Thread::TS_UserSuspendPending)
- {
- res |= ThreadSuspendRequested;
- }
+ // CoreCLR does not support user-requested thread suspension
+ _ASSERTE(!(state & Thread::TS_UserSuspendPending));
HELPER_METHOD_POLL();
HELPER_METHOD_FRAME_END();
@@ -1669,16 +1659,6 @@ BOOL QCALLTYPE ThreadNative::YieldThread()
return ret;
}
-
-FCIMPL0(void, ThreadNative::FCMemoryBarrier)
-{
- FCALL_CONTRACT;
-
- MemoryBarrier();
- FC_GC_POLL();
-}
-FCIMPLEND
-
FCIMPL2(void, ThreadNative::SetAbortReason, ThreadBaseObject* pThisUNSAFE, Object* pObject)
{
FCALL_CONTRACT;
diff --git a/src/vm/comsynchronizable.h b/src/vm/comsynchronizable.h
index e9b4b62d59..00b055c960 100644
--- a/src/vm/comsynchronizable.h
+++ b/src/vm/comsynchronizable.h
@@ -106,7 +106,6 @@ public:
#endif //FEATURE_COMINTEROP
static FCDECL1(FC_BOOL_RET,IsThreadpoolThread, ThreadBaseObject* thread);
- static FCDECL0(void, FCMemoryBarrier);
static FCDECL1(void, SetIsThreadStaticsArray, Object* pObject);
static FCDECL2(void, SetAbortReason, ThreadBaseObject* pThisUNSAFE, Object* pObject);
diff --git a/src/vm/comutilnative.cpp b/src/vm/comutilnative.cpp
index 8e8d8a6aac..b75f684992 100644
--- a/src/vm/comutilnative.cpp
+++ b/src/vm/comutilnative.cpp
@@ -1777,9 +1777,9 @@ int QCALLTYPE GCInterface::StartNoGCRegion(INT64 totalSize, BOOL lohSizeKnown, I
GCX_COOP();
retVal = GCHeapUtilities::GetGCHeap()->StartNoGCRegion((ULONGLONG)totalSize,
- lohSizeKnown,
+ !!lohSizeKnown,
(ULONGLONG)lohSize,
- disallowFullBlockingGC);
+ !!disallowFullBlockingGC);
END_QCALL;
@@ -1868,7 +1868,7 @@ void QCALLTYPE GCInterface::Collect(INT32 generation, INT32 mode)
//We don't need to check the top end because the GC will take care of that.
GCX_COOP();
- GCHeapUtilities::GetGCHeap()->GarbageCollect(generation, FALSE, mode);
+ GCHeapUtilities::GetGCHeap()->GarbageCollect(generation, false, mode);
END_QCALL;
}
@@ -2331,7 +2331,7 @@ NOINLINE void GCInterface::GarbageCollectModeAny(int generation)
CONTRACTL_END;
GCX_COOP();
- GCHeapUtilities::GetGCHeap()->GarbageCollect(generation, FALSE, collection_non_blocking);
+ GCHeapUtilities::GetGCHeap()->GarbageCollect(generation, false, collection_non_blocking);
}
//
@@ -2584,9 +2584,23 @@ FCIMPL2_IV(INT64,COMInterlocked::ExchangeAdd64, INT64 *location, INT64 value)
}
FCIMPLEND
+FCIMPL0(void, COMInterlocked::FCMemoryBarrier)
+{
+ FCALL_CONTRACT;
+
+ MemoryBarrier();
+ FC_GC_POLL();
+}
+FCIMPLEND
+
#include <optdefault.h>
+void QCALLTYPE COMInterlocked::MemoryBarrierProcessWide()
+{
+ QCALL_CONTRACT;
+ FlushProcessWriteBuffers();
+}
FCIMPL6(INT32, ManagedLoggingHelper::GetRegistryLoggingValues, CLR_BOOL* bLoggingEnabled, CLR_BOOL* bLogToConsole, INT32 *iLogLevel, CLR_BOOL* bPerfWarnings, CLR_BOOL* bCorrectnessWarnings, CLR_BOOL* bSafeHandleStackTraces)
{
diff --git a/src/vm/comutilnative.h b/src/vm/comutilnative.h
index 5f581e244b..41df265e91 100644
--- a/src/vm/comutilnative.h
+++ b/src/vm/comutilnative.h
@@ -234,6 +234,9 @@ public:
static FCDECL2_IV(INT64, ExchangeAdd64, INT64 *location, INT64 value);
static FCDECL2_VV(void, ExchangeGeneric, FC_TypedByRef location, FC_TypedByRef value);
static FCDECL3_VVI(void, CompareExchangeGeneric, FC_TypedByRef location, FC_TypedByRef value, LPVOID comparand);
+
+ static FCDECL0(void, FCMemoryBarrier);
+ static void QCALLTYPE MemoryBarrierProcessWide();
};
class ManagedLoggingHelper {
diff --git a/src/vm/crossgencompile.cpp b/src/vm/crossgencompile.cpp
index c29d3cc60b..b106ecc918 100644
--- a/src/vm/crossgencompile.cpp
+++ b/src/vm/crossgencompile.cpp
@@ -133,9 +133,7 @@ BOOL g_fEEComActivatedStartup=FALSE;
GVAL_IMPL_INIT(DWORD, g_fHostConfig, 0);
-#ifdef FEATURE_SVR_GC
-SVAL_IMPL_INIT(uint32_t,IGCHeap,gcHeapType,IGCHeap::GC_HEAP_WKS);
-#endif
+GVAL_IMPL_INIT(GCHeapType, g_heap_type, GC_HEAP_WKS);
void UpdateGCSettingFromHost()
{
diff --git a/src/vm/debugdebugger.cpp b/src/vm/debugdebugger.cpp
index 32c6cd6cce..489c623df9 100644
--- a/src/vm/debugdebugger.cpp
+++ b/src/vm/debugdebugger.cpp
@@ -937,62 +937,8 @@ void DebugStackTrace::GetStackFramesHelper(Frame *pStartFrame,
goto LSafeToTrace;
}
- if (state & Thread::TS_UserSuspendPending)
- {
- if (state & Thread::TS_SyncSuspended)
- {
- goto LSafeToTrace;
- }
-
-#ifndef DISABLE_THREADSUSPEND
- // On Mac don't perform the optimization below, but rather wait for
- // the suspendee to set the TS_SyncSuspended flag
-
- // The target thread is not actually suspended yet, but if it is
- // in preemptive mode, then it is still safe to trace. Before we
- // can look at another thread's GC mode, we have to suspend it:
- // The target thread updates its GC mode flag with non-interlocked
- // operations, and Thread::SuspendThread drains the CPU's store
- // buffer (by virtue of calling GetThreadContext).
- switch (pThread->SuspendThread())
- {
- case Thread::STR_Success:
- if (!pThread->PreemptiveGCDisabledOther())
- {
- pThread->ResumeThread();
- goto LSafeToTrace;
- }
-
- // Refuse to trace the stack.
- //
- // Note that there is a pretty large window in-between when the
- // target thread sets the GC mode to cooperative, and when it
- // actually sets the TS_SyncSuspended bit. In this window, we
- // will refuse to take a stack trace even though it would be
- // safe to do so.
- pThread->ResumeThread();
- break;
- case Thread::STR_Failure:
- case Thread::STR_NoStressLog:
- break;
- case Thread::STR_UnstartedOrDead:
- // We know the thread is not unstarted, because we checked for
- // TS_Unstarted above.
- _ASSERTE(!(state & Thread::TS_Unstarted));
-
- // Since the thread is dead, it is safe to trace.
- goto LSafeToTrace;
- case Thread::STR_SwitchedOut:
- if (!pThread->PreemptiveGCDisabledOther())
- {
- goto LSafeToTrace;
- }
- break;
- default:
- UNREACHABLE();
- }
-#endif // DISABLE_THREADSUSPEND
- }
+ // CoreCLR does not support user-requested thread suspension
+ _ASSERTE(!(state & Thread::TS_UserSuspendPending));
COMPlusThrow(kThreadStateException, IDS_EE_THREAD_BAD_STATE);
diff --git a/src/vm/debughelp.cpp b/src/vm/debughelp.cpp
index abe45d5da0..3e66f14047 100644
--- a/src/vm/debughelp.cpp
+++ b/src/vm/debughelp.cpp
@@ -245,7 +245,7 @@ MethodDesc* IP2MD(ULONG_PTR IP)
}
/*******************************************************************/
-/* if addr is a valid method table, return a poitner to it */
+/* if addr is a valid method table, return a pointer to it */
MethodTable* AsMethodTable(size_t addr)
{
CONTRACTL
diff --git a/src/vm/dllimport.cpp b/src/vm/dllimport.cpp
index ba56831bd6..c0a73e8b80 100644
--- a/src/vm/dllimport.cpp
+++ b/src/vm/dllimport.cpp
@@ -3684,8 +3684,15 @@ static void CreateNDirectStubWorker(StubState* pss,
// return buffer in correct register.
// The return structure secret arg comes first, however byvalue return is processed at
// the end because it could be the HRESULT-swapped argument which always comes last.
+
+#ifdef UNIX_X86_ABI
+ // For functions with value type class, managed and unmanaged calling convention differ
+ fMarshalReturnValueFirst = HasRetBuffArgUnmanagedFixup(&msig);
+#else // UNIX_X86_ABI
fMarshalReturnValueFirst = HasRetBuffArg(&msig);
-#endif
+#endif // UNIX_X86_ABI
+
+#endif // defined(_TARGET_X86_) || defined(_TARGET_ARM_)
}
diff --git a/src/vm/dllimportcallback.cpp b/src/vm/dllimportcallback.cpp
index 11bad8b6b9..c70d52d02e 100644
--- a/src/vm/dllimportcallback.cpp
+++ b/src/vm/dllimportcallback.cpp
@@ -1375,20 +1375,29 @@ VOID UMThunkMarshInfo::RunTimeInit()
}
}
- //
- // m_cbActualArgSize gets the number of arg bytes for the NATIVE signature
- //
- m_cbActualArgSize =
- (pStubMD != NULL) ? pStubMD->AsDynamicMethodDesc()->GetNativeStackArgSize() : pMD->SizeOfArgStack();
#if defined(_TARGET_X86_)
MetaSig sig(pMD);
- ArgIterator argit(&sig);
int numRegistersUsed = 0;
- m_ecxArgOffset = -1;
- m_edxArgOffset = -1;
+ UINT16 cbRetPop = 0;
+
+ //
+ // m_cbStackArgSize represents the number of arg bytes for the MANAGED signature
+ //
+ m_cbStackArgSize = 0;
int offs = 0;
+
+#ifdef UNIX_X86_ABI
+ if (HasRetBuffArgUnmanagedFixup(&sig))
+ {
+ // callee should pop retbuf
+ numRegistersUsed += 1;
+ offs += STACK_ELEM_SIZE;
+ cbRetPop += STACK_ELEM_SIZE;
+ }
+#endif // UNIX_X86_ABI
+
for (UINT i = 0 ; i < sig.NumFixedArgs(); i++)
{
TypeHandle thValueType;
@@ -1396,17 +1405,16 @@ VOID UMThunkMarshInfo::RunTimeInit()
int cbSize = sig.GetElemSize(type, thValueType);
if (ArgIterator::IsArgumentInRegister(&numRegistersUsed, type))
{
- if (numRegistersUsed == 1)
- m_ecxArgOffset = offs;
- else if (numRegistersUsed == 2)
- m_edxArgOffset = offs;
offs += STACK_ELEM_SIZE;
}
else
{
offs += StackElemSize(cbSize);
+ m_cbStackArgSize += StackElemSize(cbSize);
}
}
+ m_cbActualArgSize = (pStubMD != NULL) ? pStubMD->AsDynamicMethodDesc()->GetNativeStackArgSize() : offs;
+
PInvokeStaticSigInfo sigInfo;
if (pMD != NULL)
new (&sigInfo) PInvokeStaticSigInfo(pMD);
@@ -1414,14 +1422,20 @@ VOID UMThunkMarshInfo::RunTimeInit()
new (&sigInfo) PInvokeStaticSigInfo(GetSignature(), GetModule());
if (sigInfo.GetCallConv() == pmCallConvCdecl)
{
- // caller pop
- m_cbRetPop = 0;
+ m_cbRetPop = cbRetPop;
}
else
{
- // callee pop
- m_cbRetPop = static_cast<UINT16>(m_cbActualArgSize);
+ // For all the other calling convention except cdecl, callee pops the stack arguments
+ m_cbRetPop = cbRetPop + static_cast<UINT16>(m_cbActualArgSize);
}
+#else // _TARGET_X86_
+ //
+ // m_cbActualArgSize gets the number of arg bytes for the NATIVE signature
+ //
+ m_cbActualArgSize =
+ (pStubMD != NULL) ? pStubMD->AsDynamicMethodDesc()->GetNativeStackArgSize() : pMD->SizeOfArgStack();
+
#endif // _TARGET_X86_
#endif // _TARGET_X86_ && !FEATURE_STUBS_AS_IL
@@ -1430,6 +1444,86 @@ VOID UMThunkMarshInfo::RunTimeInit()
InterlockedCompareExchangeT<PCODE>(&m_pILStub, pFinalILStub, (PCODE)1);
}
+#if defined(_TARGET_X86_) && defined(FEATURE_STUBS_AS_IL)
+VOID UMThunkMarshInfo::SetupArguments(char *pSrc, ArgumentRegisters *pArgRegs, char *pDst)
+{
+ MethodDesc *pMD = GetMethod();
+
+ _ASSERTE(pMD);
+
+ //
+ // x86 native uses the following stack layout:
+ // | saved eip |
+ // | --------- | <- CFA
+ // | stkarg 0 |
+ // | stkarg 1 |
+ // | ... |
+ // | stkarg N |
+ //
+ // x86 managed, however, uses a bit different stack layout:
+ // | saved eip |
+ // | --------- | <- CFA
+ // | stkarg M | (NATIVE/MANAGE may have different number of stack arguments)
+ // | ... |
+ // | stkarg 1 |
+ // | stkarg 0 |
+ //
+ // This stub bridges the gap between them.
+ //
+ char *pCurSrc = pSrc;
+ char *pCurDst = pDst + m_cbStackArgSize;
+
+ MetaSig sig(pMD);
+
+ int numRegistersUsed = 0;
+
+#ifdef UNIX_X86_ABI
+ if (HasRetBuffArgUnmanagedFixup(&sig))
+ {
+ // Pass retbuf via Ecx
+ numRegistersUsed += 1;
+ pArgRegs->Ecx = *((UINT32 *)pCurSrc);
+ pCurSrc += STACK_ELEM_SIZE;
+ }
+#endif // UNIX_X86_ABI
+
+ for (UINT i = 0 ; i < sig.NumFixedArgs(); i++)
+ {
+ TypeHandle thValueType;
+ CorElementType type = sig.NextArgNormalized(&thValueType);
+ int cbSize = sig.GetElemSize(type, thValueType);
+ int elemSize = StackElemSize(cbSize);
+
+ if (ArgIterator::IsArgumentInRegister(&numRegistersUsed, type))
+ {
+ _ASSERTE(elemSize == STACK_ELEM_SIZE);
+
+ if (numRegistersUsed == 1)
+ pArgRegs->Ecx = *((UINT32 *)pCurSrc);
+ else if (numRegistersUsed == 2)
+ pArgRegs->Edx = *((UINT32 *)pCurSrc);
+ }
+ else
+ {
+ pCurDst -= elemSize;
+ memcpy(pCurDst, pCurSrc, elemSize);
+ }
+
+ pCurSrc += elemSize;
+ }
+
+ _ASSERTE(pDst == pCurDst);
+}
+
+EXTERN_C VOID STDCALL UMThunkStubSetupArgumentsWorker(UMThunkMarshInfo *pMarshInfo,
+ char *pSrc,
+ UMThunkMarshInfo::ArgumentRegisters *pArgRegs,
+ char *pDst)
+{
+ pMarshInfo->SetupArguments(pSrc, pArgRegs, pDst);
+}
+#endif // _TARGET_X86_ && FEATURE_STUBS_AS_IL
+
#ifdef _DEBUG
void STDCALL LogUMTransition(UMEntryThunk* thunk)
{
diff --git a/src/vm/dllimportcallback.h b/src/vm/dllimportcallback.h
index c6f5788739..af2a0b1d92 100644
--- a/src/vm/dllimportcallback.h
+++ b/src/vm/dllimportcallback.h
@@ -205,16 +205,26 @@ public:
Stub *CompileNExportThunk(LoaderHeap *pLoaderHeap, PInvokeStaticSigInfo* pSigInfo, MetaSig *pMetaSig, BOOL fNoStub);
#endif // _TARGET_X86_ && !FEATURE_STUBS_AS_IL
+#if defined(_TARGET_X86_) && defined(FEATURE_STUBS_AS_IL)
+ struct ArgumentRegisters
+ {
+ UINT32 Ecx;
+ UINT32 Edx;
+ };
+
+ VOID SetupArguments(char *pSrc, ArgumentRegisters *pArgRegs, char *pDst);
+#endif // _TARGET_X86_ && FEATURE_STUBS_AS_IL
+
private:
PCODE m_pILStub; // IL stub for marshaling
// On x86, NULL for no-marshal signatures
// On non-x86, the managed entrypoint for no-delegate no-marshal signatures
UINT32 m_cbActualArgSize; // caches m_pSig.SizeOfFrameArgumentArray()
+ // On x86/Linux we have to augment with numRegistersUsed * STACK_ELEM_SIZE
#if defined(_TARGET_X86_)
UINT16 m_cbRetPop; // stack bytes popped by callee (for UpdateRegDisplay)
#if defined(FEATURE_STUBS_AS_IL)
- UINT32 m_ecxArgOffset;
- UINT32 m_edxArgOffset;
+ UINT32 m_cbStackArgSize; // stack bytes pushed for managed code
#else
Stub* m_pExecStub; // UMEntryThunk jumps directly here
UINT16 m_callConv; // unmanaged calling convention and flags (CorPinvokeMap)
diff --git a/src/vm/domainfile.cpp b/src/vm/domainfile.cpp
index 253ebbbd52..2193c5a28d 100644
--- a/src/vm/domainfile.cpp
+++ b/src/vm/domainfile.cpp
@@ -2418,14 +2418,11 @@ void DomainAssembly::GetCurrentVersionInfo(CORCOMPILE_VERSION_INFO *pNativeVersi
&fForceProfiling,
&fForceInstrument);
- OSVERSIONINFOW osInfo;
- osInfo.dwOSVersionInfoSize = sizeof(osInfo);
- if (!GetOSVersion(&osInfo))
- _ASSERTE(!"GetOSVersion failed");
-
- _ASSERTE(osInfo.dwMajorVersion < 999);
- _ASSERTE(osInfo.dwMinorVersion < 999);
- pNativeVersionInfo->wOSPlatformID = (WORD) osInfo.dwPlatformId;
+#ifndef FEATURE_PAL
+ pNativeVersionInfo->wOSPlatformID = VER_PLATFORM_WIN32_NT;
+#else
+ pNativeVersionInfo->wOSPlatformID = VER_PLATFORM_UNIX;
+#endif
// The native images should be OS-version agnostic. Do not store the actual OS version for determinism.
// pNativeVersionInfo->wOSMajorVersion = (WORD) osInfo.dwMajorVersion;
diff --git a/src/vm/dwreport.cpp b/src/vm/dwreport.cpp
index 95d717231a..b95c59ff8d 100644
--- a/src/vm/dwreport.cpp
+++ b/src/vm/dwreport.cpp
@@ -2468,7 +2468,7 @@ FaultReportResult DoFaultReportWorker( // Was Watson attempted, successful?
{ // Look for final '\'
pName = wcsrchr(buf, W('\\'));
// If found, skip it; if not, point to full name.
- pName = pName ? pName+1 : buf;
+ pName = pName ? pName+1 : (LPCWSTR)buf;
}
}
diff --git a/src/vm/ecalllist.h b/src/vm/ecalllist.h
index 929ae2ea9a..415926eafa 100644
--- a/src/vm/ecalllist.h
+++ b/src/vm/ecalllist.h
@@ -170,8 +170,6 @@ FCFuncStart(gDateTimeFuncs)
FCFuncEnd()
FCFuncStart(gEnvironmentFuncs)
- FCFuncElement("GetVersion", SystemNative::GetOSVersion)
- FCFuncElement("GetVersionEx", SystemNative::GetOSVersionEx)
FCFuncElement("get_TickCount", SystemNative::GetTickCount)
QCFuncElement("_Exit", SystemNative::Exit)
FCFuncElement("set_ExitCode", SystemNative::SetExitCode)
@@ -181,7 +179,7 @@ FCFuncStart(gEnvironmentFuncs)
FCFuncElement("GetCommandLineArgsNative", SystemNative::GetCommandLineArgs)
FCFuncElement("get_CurrentProcessorNumber", SystemNative::GetCurrentProcessorNumber)
-#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORESYSTEM)
+#if defined(FEATURE_COMINTEROP)
QCFuncElement("WinRTSupported", SystemNative::WinRTSupported)
#endif // FEATURE_COMINTEROP
FCFuncElementSig("FailFast", &gsig_SM_Str_RetVoid, SystemNative::FailFast)
@@ -623,7 +621,6 @@ FCFuncStart(gAssemblyLoadContextFuncs)
QCFuncElement("InternalLoadUnmanagedDllFromPath", AssemblyNative::InternalLoadUnmanagedDllFromPath)
QCFuncElement("CanUseAppPathAssemblyLoadContextInCurrentDomain", AssemblyNative::CanUseAppPathAssemblyLoadContextInCurrentDomain)
QCFuncElement("LoadFromStream", AssemblyNative::LoadFromStream)
- FCFuncElement("nGetFileInformation", AssemblyNameNative::GetFileInformation)
QCFuncElement("GetLoadContextForAssembly", AssemblyNative::GetLoadContextForAssembly)
#if defined(FEATURE_MULTICOREJIT)
QCFuncElement("InternalSetProfileRoot", MultiCoreJITNative::InternalSetProfileRoot)
@@ -765,7 +762,6 @@ FCFuncStart(gThreadFuncs)
#ifdef FEATURE_COMINTEROP_APARTMENT_SUPPORT
FCFuncElement("StartupSetApartmentStateInternal", ThreadNative::StartupSetApartmentState)
#endif // FEATURE_COMINTEROP_APARTMENT_SUPPORT
- FCIntrinsic("MemoryBarrier", ThreadNative::FCMemoryBarrier, CORINFO_INTRINSIC_MemoryBarrier)
FCFuncEnd()
FCFuncStart(gThreadPoolFuncs)
@@ -854,6 +850,9 @@ FCFuncStart(gCurrencyFuncs)
FCFuncElement("FCallToDecimal", COMCurrency::DoToDecimal)
FCFuncEnd()
+FCFuncStart(gClrConfig)
+ QCFuncElement("GetConfigBoolValue", ClrConfigNative::GetConfigBoolValue)
+FCFuncEnd()
#if !defined(FEATURE_COREFX_GLOBALIZATION)
FCFuncStart(gCompareInfoFuncs)
@@ -1044,7 +1043,9 @@ FCFuncStart(gInterlockedFuncs)
FCFuncElement("_Exchange", COMInterlocked::ExchangeGeneric)
FCFuncElement("_CompareExchange", COMInterlocked::CompareExchangeGeneric)
-
+
+ FCIntrinsic("MemoryBarrier", COMInterlocked::FCMemoryBarrier, CORINFO_INTRINSIC_MemoryBarrier)
+ QCFuncElement("_MemoryBarrierProcessWide", COMInterlocked::MemoryBarrierProcessWide)
FCFuncEnd()
FCFuncStart(gVarArgFuncs)
@@ -1356,6 +1357,7 @@ FCClassElement("AssemblyName", "System.Reflection", gAssemblyNameFuncs)
FCClassElement("Assert", "System.Diagnostics", gDiagnosticsAssert)
FCClassElement("BCLDebug", "System", gBCLDebugFuncs)
FCClassElement("Buffer", "System", gBufferFuncs)
+FCClassElement("CLRConfig", "System", gClrConfig)
FCClassElement("CompareInfo", "System.Globalization", gCompareInfoFuncs)
FCClassElement("CompatibilitySwitch", "System.Runtime.Versioning", gCompatibilitySwitchFuncs)
FCClassElement("CriticalHandle", "System.Runtime.InteropServices", gCriticalHandleFuncs)
diff --git a/src/vm/eeconfig.cpp b/src/vm/eeconfig.cpp
index 8b980ef17b..812d1df671 100644
--- a/src/vm/eeconfig.cpp
+++ b/src/vm/eeconfig.cpp
@@ -402,6 +402,10 @@ HRESULT EEConfig::Init()
#if defined(_DEBUG)
bDiagnosticSuspend = false;
#endif
+
+#if defined(FEATURE_TIERED_COMPILATION)
+ fTieredCompilation = false;
+#endif
// After initialization, register the code:#GetConfigValueCallback method with code:CLRConfig to let
// CLRConfig access config files. This is needed because CLRConfig lives outside the VM and can't
@@ -1277,6 +1281,10 @@ HRESULT EEConfig::sync()
dwSleepOnExit = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_SleepOnExit);
+#if defined(FEATURE_TIERED_COMPILATION)
+ fTieredCompilation = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_TieredCompilation) != 0;
+#endif
+
return hr;
}
diff --git a/src/vm/eeconfig.h b/src/vm/eeconfig.h
index 2c0d5ce20c..e97385e3da 100644
--- a/src/vm/eeconfig.h
+++ b/src/vm/eeconfig.h
@@ -294,6 +294,11 @@ public:
bool AddRejitNops(void) const {LIMITED_METHOD_DAC_CONTRACT; return fAddRejitNops; }
bool JitMinOpts(void) const {LIMITED_METHOD_CONTRACT; return fJitMinOpts; }
+ // Tiered Compilation config
+#if defined(FEATURE_TIERED_COMPILATION)
+ bool TieredCompilation(void) const {LIMITED_METHOD_CONTRACT; return fTieredCompilation; }
+#endif
+
BOOL PInvokeRestoreEsp(BOOL fDefault) const
{
LIMITED_METHOD_CONTRACT;
@@ -1182,6 +1187,10 @@ private: //----------------------------------------------------------------
DWORD testThreadAbort;
#endif
+#if defined(FEATURE_TIERED_COMPILATION)
+ bool fTieredCompilation;
+#endif
+
public:
HRESULT GetConfiguration_DontUse_(__in_z LPCWSTR pKey, ConfigSearch direction, __deref_out_opt LPCWSTR* value);
diff --git a/src/vm/eedbginterfaceimpl.cpp b/src/vm/eedbginterfaceimpl.cpp
index b7a4359350..ede82c7780 100644
--- a/src/vm/eedbginterfaceimpl.cpp
+++ b/src/vm/eedbginterfaceimpl.cpp
@@ -1588,15 +1588,8 @@ CorDebugUserState EEDbgInterfaceImpl::GetPartialUserState(Thread *pThread)
ret |= (unsigned)USER_WAIT_SLEEP_JOIN;
}
- // Don't report a SuspendRequested if the thread has actually Suspended.
- if ( ((ts & Thread::TS_UserSuspendPending) && (ts & Thread::TS_SyncSuspended)))
- {
- ret |= (unsigned)USER_SUSPENDED;
- }
- else if (ts & Thread::TS_UserSuspendPending)
- {
- ret |= (unsigned)USER_SUSPEND_REQUESTED;
- }
+ // CoreCLR does not support user-requested thread suspension
+ _ASSERTE(!(ts & Thread::TS_UserSuspendPending));
LOG((LF_CORDB,LL_INFO1000, "EEDbgII::GUS: thread 0x%x (id:0x%x)"
" userThreadState is 0x%x\n", pThread, pThread->GetThreadId(), ret));
diff --git a/src/vm/eetwain.cpp b/src/vm/eetwain.cpp
index 18bc24ae39..aff2507489 100644
--- a/src/vm/eetwain.cpp
+++ b/src/vm/eetwain.cpp
@@ -3815,7 +3815,10 @@ bool UnwindEbpDoubleAlignFrame(
// TODO Currently we assume that ESP of funclet frames is always fixed but actually it could change.
if (pCodeInfo->IsFunclet())
{
- baseSP = curESP + 12; // padding for 16byte stack alignment allocated in genFuncletProlog()
+ // Set baseSP as initial SP
+ baseSP = pContext->pCurrentContext->ResumeEsp;
+ // 16-byte stack alignment padding (allocated in genFuncletProlog)
+ baseSP += 12;
pContext->PCTAddr = baseSP;
pContext->ControlPC = *PTR_PCODE(pContext->PCTAddr);
@@ -4163,6 +4166,14 @@ bool EECodeManager::EnumGcRefs( PREGDISPLAY pContext,
GC_NOTRIGGER;
} CONTRACTL_END;
+#ifdef WIN64EXCEPTIONS
+ if (flags & ParentOfFuncletStackFrame)
+ {
+ LOG((LF_GCROOTS, LL_INFO100000, "Not reporting this frame because it was already reported via another funclet.\n"));
+ return true;
+ }
+#endif // WIN64EXCEPTIONS
+
GCInfoToken gcInfoToken = pCodeInfo->GetGCInfoToken();
unsigned curOffs = pCodeInfo->GetRelOffset();
@@ -4752,6 +4763,18 @@ bool EECodeManager::EnumGcRefs( PREGDISPLAY pContext,
_ASSERTE(*castto(table, unsigned short *)++ == 0xBABE);
#endif
+#ifdef WIN64EXCEPTIONS // funclets
+ //
+ // If we're in a funclet, we do not want to report the incoming varargs. This is
+ // taken care of by the parent method and the funclet should access those arguments
+ // by way of the parent method's stack frame.
+ //
+ if(pCodeInfo->IsFunclet())
+ {
+ return true;
+ }
+#endif // WIN64EXCEPTIONS
+
/* Are we a varargs function, if so we have to report all args
except 'this' (note that the GC tables created by the x86 jit
do not contain ANY arguments except 'this' (even if they
diff --git a/src/vm/eventreporter.cpp b/src/vm/eventreporter.cpp
index a96c525439..c73af36b55 100644
--- a/src/vm/eventreporter.cpp
+++ b/src/vm/eventreporter.cpp
@@ -64,7 +64,7 @@ EventReporter::EventReporter(EventReporterType type)
{
// If app name has a '\', consider the part after that; otherwise consider whole name.
LPCWSTR appName = wcsrchr(appPath, W('\\'));
- appName = appName ? appName+1 : appPath;
+ appName = appName ? appName+1 : (LPCWSTR)appPath;
m_Description.Append(appName);
m_Description.Append(W("\n"));
}
diff --git a/src/vm/eventtrace.cpp b/src/vm/eventtrace.cpp
index 2b45bf5597..1eb89385a6 100644
--- a/src/vm/eventtrace.cpp
+++ b/src/vm/eventtrace.cpp
@@ -439,8 +439,8 @@ VOID ETW::GCLog::GCSettingsEvent()
ETW::GCLog::ETW_GC_INFO Info;
Info.GCSettings.ServerGC = GCHeapUtilities::IsServerHeap ();
- Info.GCSettings.SegmentSize = GCHeapUtilities::GetGCHeap()->GetValidSegmentSize (FALSE);
- Info.GCSettings.LargeObjectSegmentSize = GCHeapUtilities::GetGCHeap()->GetValidSegmentSize (TRUE);
+ Info.GCSettings.SegmentSize = GCHeapUtilities::GetGCHeap()->GetValidSegmentSize (false);
+ Info.GCSettings.LargeObjectSegmentSize = GCHeapUtilities::GetGCHeap()->GetValidSegmentSize (true);
FireEtwGCSettings_V1(Info.GCSettings.SegmentSize, Info.GCSettings.LargeObjectSegmentSize, Info.GCSettings.ServerGC, GetClrInstanceId());
}
GCHeapUtilities::GetGCHeap()->DiagTraceGCSegments();
@@ -1035,7 +1035,7 @@ HRESULT ETW::GCLog::ForceGCForDiagnostics()
hr = GCHeapUtilities::GetGCHeap()->GarbageCollect(
-1, // all generations should be collected
- FALSE, // low_memory_p
+ false, // low_memory_p
collection_blocking);
#ifndef FEATURE_REDHAWK
@@ -4310,27 +4310,6 @@ HRESULT ETW::CEtwTracer::Register()
{
WRAPPER_NO_CONTRACT;
-#ifndef FEATURE_CORESYSTEM
- OSVERSIONINFO osVer;
- osVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-
- if (GetOSVersion(&osVer) == FALSE) {
- return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
- }
- else if (osVer.dwMajorVersion < ETW_SUPPORTED_MAJORVER) {
- return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
- }
-
- // if running on OS < Longhorn, skip registration unless reg key is set
- // since ETW reg is expensive (in both time and working set) on older OSes
- if (osVer.dwMajorVersion < ETW_ENABLED_MAJORVER && !g_fEnableETW && !CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PreVistaETWEnabled))
- return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
-
- // If running on OS >= Longhorn, skip registration if ETW is not enabled
- if (osVer.dwMajorVersion >= ETW_ENABLED_MAJORVER && !g_fEnableETW && !CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_VistaAndAboveETWEnabled))
- return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
-#endif
-
EventRegisterMicrosoft_Windows_DotNETRuntime();
EventRegisterMicrosoft_Windows_DotNETRuntimePrivate();
EventRegisterMicrosoft_Windows_DotNETRuntimeRundown();
diff --git a/src/vm/exceptionhandling.cpp b/src/vm/exceptionhandling.cpp
index e4ac6897cf..7e82cce604 100644
--- a/src/vm/exceptionhandling.cpp
+++ b/src/vm/exceptionhandling.cpp
@@ -21,7 +21,7 @@
#define USE_CURRENT_CONTEXT_IN_FILTER
#endif // _TARGET_X86_
-#if defined(_TARGET_ARM_) || defined(__TARGET_X86_)
+#if defined(_TARGET_ARM_) || defined(_TARGET_X86_)
#define VSD_STUB_CAN_THROW_AV
#endif // _TARGET_ARM_ || _TARGET_X86_
diff --git a/src/vm/exinfo.h b/src/vm/exinfo.h
index 6b34e71116..4a6c3e5dcc 100644
--- a/src/vm/exinfo.h
+++ b/src/vm/exinfo.h
@@ -134,7 +134,7 @@ public:
return m_pPrevNestedInfo;
}
- // Returns the throwble associated with the tracker
+ // Returns the throwable associated with the tracker
inline OBJECTREF GetThrowable()
{
LIMITED_METHOD_CONTRACT;
diff --git a/src/vm/fcall.h b/src/vm/fcall.h
index 988aa3df74..c3f026bccb 100644
--- a/src/vm/fcall.h
+++ b/src/vm/fcall.h
@@ -377,16 +377,27 @@ LPVOID __FCThrowArgument(LPVOID me, enum RuntimeExceptionKind reKind, LPCWSTR ar
// Choose the appropriate calling convention for FCALL helpers on the basis of the JIT calling convention
#ifdef __GNUC__
-#define F_CALL_CONV __attribute__((stdcall, regparm(3)))
-#else
+#define F_CALL_CONV __attribute__((cdecl, regparm(3)))
+
+// GCC fastcall convention (simulated via stdcall) is different from MSVC fastcall convention. GCC can use up
+// to 3 registers to store parameters. The registers used are EAX, EDX, ECX. Dummy parameters and reordering
+// of the actual parameters in the FCALL signature is used to make the calling convention to look like in MSVC.
+#define SWIZZLE_REGARG_ORDER
+#else // __GNUC__
#define F_CALL_CONV __fastcall
-#endif
+#endif // !__GNUC__
+
+#define SWIZZLE_STKARG_ORDER
+#else // _TARGET_X86_
-#if defined(__GNUC__)
+//
+// non-x86 platforms don't have messed-up calling convention swizzling
+//
+#define F_CALL_CONV
+#endif // !_TARGET_X86_
-// GCC fastcall convention is different from MSVC fastcall convention. GCC can use up to 3 registers to
-// store parameters. The registers used are EAX, EDX, ECX. Dummy parameters and reordering of the
-// actual parameters in the FCALL signature is used to make the calling convention to look like in MSVC.
+#ifdef SWIZZLE_STKARG_ORDER
+#ifdef SWIZZLE_REGARG_ORDER
#define FCDECL0(rettype, funcname) rettype F_CALL_CONV funcname()
#define FCDECL1(rettype, funcname, a1) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a1)
@@ -417,7 +428,7 @@ LPVOID __FCThrowArgument(LPVOID me, enum RuntimeExceptionKind reKind, LPCWSTR ar
#define FCDECL5_IVI(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(int /* EAX */, a3, a1, a5, a4, a2)
#define FCDECL5_VII(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(int /* EAX */, a3, a2, a5, a4, a1)
-#else // __GNUC__
+#else // SWIZZLE_REGARG_ORDER
#define FCDECL0(rettype, funcname) rettype F_CALL_CONV funcname()
#define FCDECL1(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1)
@@ -448,7 +459,7 @@ LPVOID __FCThrowArgument(LPVOID me, enum RuntimeExceptionKind reKind, LPCWSTR ar
#define FCDECL5_IVI(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(a1, a3, a5, a4, a2)
#define FCDECL5_VII(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(a2, a3, a5, a4, a1)
-#endif // __GNUC__
+#endif // !SWIZZLE_REGARG_ORDER
#if 0
//
@@ -472,40 +483,38 @@ LPVOID __FCThrowArgument(LPVOID me, enum RuntimeExceptionKind reKind, LPCWSTR ar
#define FCCALL12(funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) funcname(a1, a2, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3)
#endif // 0
-#else // !_TARGET_X86
+#else // !SWIZZLE_STKARG_ORDER
-#define F_CALL_CONV
-
-#define FCDECL0(rettype, funcname) rettype funcname()
-#define FCDECL1(rettype, funcname, a1) rettype funcname(a1)
-#define FCDECL1_V(rettype, funcname, a1) rettype funcname(a1)
-#define FCDECL2(rettype, funcname, a1, a2) rettype funcname(a1, a2)
-#define FCDECL2VA(rettype, funcname, a1, a2) rettype funcname(a1, a2, ...)
-#define FCDECL2_VV(rettype, funcname, a1, a2) rettype funcname(a1, a2)
-#define FCDECL2_VI(rettype, funcname, a1, a2) rettype funcname(a1, a2)
-#define FCDECL2_IV(rettype, funcname, a1, a2) rettype funcname(a1, a2)
-#define FCDECL3(rettype, funcname, a1, a2, a3) rettype funcname(a1, a2, a3)
-#define FCDECL3_IIV(rettype, funcname, a1, a2, a3) rettype funcname(a1, a2, a3)
-#define FCDECL3_VII(rettype, funcname, a1, a2, a3) rettype funcname(a1, a2, a3)
-#define FCDECL3_IVV(rettype, funcname, a1, a2, a3) rettype funcname(a1, a2, a3)
-#define FCDECL3_IVI(rettype, funcname, a1, a2, a3) rettype funcname(a1, a2, a3)
-#define FCDECL3_VVI(rettype, funcname, a1, a2, a3) rettype funcname(a1, a2, a3)
-#define FCDECL4(rettype, funcname, a1, a2, a3, a4) rettype funcname(a1, a2, a3, a4)
-#define FCDECL5(rettype, funcname, a1, a2, a3, a4, a5) rettype funcname(a1, a2, a3, a4, a5)
-#define FCDECL6(rettype, funcname, a1, a2, a3, a4, a5, a6) rettype funcname(a1, a2, a3, a4, a5, a6)
-#define FCDECL7(rettype, funcname, a1, a2, a3, a4, a5, a6, a7) rettype funcname(a1, a2, a3, a4, a5, a6, a7)
-#define FCDECL8(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8) rettype funcname(a1, a2, a3, a4, a5, a6, a7, a8)
-#define FCDECL9(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9) rettype funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9)
-#define FCDECL10(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) rettype funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
-#define FCDECL11(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) rettype funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)
-#define FCDECL12(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) rettype funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12)
-#define FCDECL13(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) rettype funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13)
-#define FCDECL14(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) rettype funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14)
-
-#define FCDECL5_IVI(rettype, funcname, a1, a2, a3, a4, a5) rettype funcname(a1, a2, a3, a4, a5)
-#define FCDECL5_VII(rettype, funcname, a1, a2, a3, a4, a5) rettype funcname(a1, a2, a3, a4, a5)
-
-#endif // _TARGET_X86_
+#define FCDECL0(rettype, funcname) rettype F_CALL_CONV funcname()
+#define FCDECL1(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1)
+#define FCDECL1_V(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1)
+#define FCDECL2(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2)
+#define FCDECL2VA(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2, ...)
+#define FCDECL2_VV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2)
+#define FCDECL2_VI(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2)
+#define FCDECL2_IV(rettype, funcname, a1, a2) rettype F_CALL_CONV funcname(a1, a2)
+#define FCDECL3(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
+#define FCDECL3_IIV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
+#define FCDECL3_VII(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
+#define FCDECL3_IVV(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
+#define FCDECL3_IVI(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
+#define FCDECL3_VVI(rettype, funcname, a1, a2, a3) rettype F_CALL_CONV funcname(a1, a2, a3)
+#define FCDECL4(rettype, funcname, a1, a2, a3, a4) rettype F_CALL_CONV funcname(a1, a2, a3, a4)
+#define FCDECL5(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5)
+#define FCDECL6(rettype, funcname, a1, a2, a3, a4, a5, a6) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6)
+#define FCDECL7(rettype, funcname, a1, a2, a3, a4, a5, a6, a7) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7)
+#define FCDECL8(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7, a8)
+#define FCDECL9(rettype, funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9)
+#define FCDECL10(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
+#define FCDECL11(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)
+#define FCDECL12(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12)
+#define FCDECL13(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13)
+#define FCDECL14(rettype,funcname, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14)
+
+#define FCDECL5_IVI(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5)
+#define FCDECL5_VII(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(a1, a2, a3, a4, a5)
+
+#endif // !SWIZZLE_STKARG_ORDER
#define HELPER_FRAME_DECL(x) FrameWithCookie<HelperMethodFrame_##x##OBJ> __helperframe
@@ -936,12 +945,14 @@ extern int FC_NO_TAILCALL;
FC_COMMON_PROLOG(__me, FCallAssert)
-#if defined(_DEBUG) && !defined(CROSSGEN_COMPILE)
-
+#if defined(_DEBUG) && !defined(CROSSGEN_COMPILE) && !defined(__GNUC__)
// Build the list of all fcalls signatures. It is used in binder.cpp to verify
// compatibility of managed and unmanaged fcall signatures. The check is currently done
// for x86 only.
+#define CHECK_FCALL_SIGNATURE
+#endif
+#ifdef CHECK_FCALL_SIGNATURE
struct FCSigCheck {
public:
FCSigCheck(void* fnc, char* sig)
@@ -963,16 +974,15 @@ public:
#define FCSIGCHECK(funcname, signature) \
static FCSigCheck UNIQUE_LABEL(FCSigCheck)(GetEEFuncEntryPointMacro(funcname), signature);
-#else
+#else // CHECK_FCALL_SIGNATURE
#define FCSIGCHECK(funcname, signature)
-#endif
+#endif // !CHECK_FCALL_SIGNATURE
-#ifdef _TARGET_X86_
-
-#if defined(__GNUC__)
+#ifdef SWIZZLE_STKARG_ORDER
+#ifdef SWIZZLE_REGARG_ORDER
#define FCIMPL0(rettype, funcname) rettype F_CALL_CONV funcname() { FCIMPL_PROLOG(funcname)
#define FCIMPL1(rettype, funcname, a1) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a1) { FCIMPL_PROLOG(funcname)
@@ -1002,7 +1012,7 @@ public:
#define FCIMPL5_IVI(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(int /* EAX */, a3, a1, a5, a4, a2) { FCIMPL_PROLOG(funcname)
#define FCIMPL5_VII(rettype, funcname, a1, a2, a3, a4, a5) rettype F_CALL_CONV funcname(int /* EAX */, a3, a2, a5, a4, a1) { FCIMPL_PROLOG(funcname)
-#else // __GNUC__
+#else // SWIZZLE_REGARG_ORDER
#define FCIMPL0(rettype, funcname) FCSIGCHECK(funcname, #rettype) \
rettype F_CALL_CONV funcname() { FCIMPL_PROLOG(funcname)
@@ -1060,12 +1070,9 @@ public:
#define FCIMPL5_VII(rettype, funcname, a1, a2, a3, a4, a5) FCSIGCHECK(funcname, #rettype "," "V" #a1 "," #a2 "," #a3 "," #a4 "," #a5) \
rettype F_CALL_CONV funcname(a2, a3, a5, a4, a1) { FCIMPL_PROLOG(funcname)
-#endif // __GNUC__
+#endif // !SWIZZLE_REGARG_ORDER
-#else // !_TARGET_X86_
-//
-// non-x86 platforms don't have messed-up calling convention swizzling
-//
+#else // SWIZZLE_STKARG_ORDER
#define FCIMPL0(rettype, funcname) rettype funcname() { FCIMPL_PROLOG(funcname)
#define FCIMPL1(rettype, funcname, a1) rettype funcname(a1) { FCIMPL_PROLOG(funcname)
@@ -1096,7 +1103,7 @@ public:
#define FCIMPL5_IVI(rettype, funcname, a1, a2, a3, a4, a5) rettype funcname(a1, a2, a3, a4, a5) { FCIMPL_PROLOG(funcname)
#define FCIMPL5_VII(rettype, funcname, a1, a2, a3, a4, a5) rettype funcname(a1, a2, a3, a4, a5) { FCIMPL_PROLOG(funcname)
-#endif
+#endif // !SWIZZLE_STKARG_ORDER
//==============================================================================================
// Use this to terminte an FCIMPLEND.
@@ -1112,9 +1119,8 @@ public:
// they do not remember the function they come from. Thus they will not
// show up in a stack trace. This is what you want for JIT helpers and the like
-#ifdef _TARGET_X86_
-
-#if defined(__GNUC__)
+#ifdef SWIZZLE_STKARG_ORDER
+#ifdef SWIZZLE_REGARG_ORDER
#define HCIMPL0(rettype, funcname) rettype F_CALL_CONV funcname() { HCIMPL_PROLOG(funcname)
#define HCIMPL1(rettype, funcname, a1) rettype F_CALL_CONV funcname(int /* EAX */, int /* EDX */, a1) { HCIMPL_PROLOG(funcname)
@@ -1137,7 +1143,7 @@ public:
#define HCCALL5(funcname, a1, a2, a3, a4, a5) funcname(0, a2, a1, a5, a4, a3)
#define HCCALL1_PTR(rettype, funcptr, a1) rettype (F_CALL_CONV * funcptr)(int /* EAX */, int /* EDX */, a1)
#define HCCALL2_PTR(rettype, funcptr, a1, a2) rettype (F_CALL_CONV * funcptr)(int /* EAX */, a2, a1)
-#else
+#else // SWIZZLE_REGARG_ORDER
#define HCIMPL0(rettype, funcname) rettype F_CALL_CONV funcname() { HCIMPL_PROLOG(funcname)
#define HCIMPL1(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1) { HCIMPL_PROLOG(funcname)
@@ -1160,13 +1166,8 @@ public:
#define HCCALL5(funcname, a1, a2, a3, a4, a5) funcname(a1, a2, a5, a4, a3)
#define HCCALL1_PTR(rettype, funcptr, a1) rettype (F_CALL_CONV * funcptr)(a1)
#define HCCALL2_PTR(rettype, funcptr, a1, a2) rettype (F_CALL_CONV * funcptr)(a1, a2)
-
-#endif
-
-#else // !_TARGET_X86_
-//
-// non-x86 platforms don't have messed-up calling convention swizzling
-//
+#endif // !SWIZZLE_REGARG_ORDER
+#else // SWIZZLE_STKARG_ORDER
#define HCIMPL0(rettype, funcname) rettype F_CALL_CONV funcname() { HCIMPL_PROLOG(funcname)
#define HCIMPL1(rettype, funcname, a1) rettype F_CALL_CONV funcname(a1) { HCIMPL_PROLOG(funcname)
@@ -1190,7 +1191,7 @@ public:
#define HCCALL1_PTR(rettype, funcptr, a1) rettype (F_CALL_CONV * funcptr)(a1)
#define HCCALL2_PTR(rettype, funcptr, a1, a2) rettype (F_CALL_CONV * funcptr)(a1, a2)
-#endif
+#endif // !SWIZZLE_STKARG_ORDER
#define HCIMPLEND_RAW }
#define HCIMPLEND FCALL_TRANSITION_END(); }
diff --git a/src/vm/fieldmarshaler.h b/src/vm/fieldmarshaler.h
index 9ec7e87610..287da41a5b 100644
--- a/src/vm/fieldmarshaler.h
+++ b/src/vm/fieldmarshaler.h
@@ -85,7 +85,12 @@ enum NStructFieldType
//=======================================================================
// Magic number for default struct packing size.
//=======================================================================
+#if defined(_TARGET_X86_) && defined(UNIX_X86_ABI)
+// A double is 4-byte aligned on GCC (without -malign-dobule)
+#define DEFAULT_PACKING_SIZE 4
+#else // _TARGET_X86_ && UNIX_X86_ABI
#define DEFAULT_PACKING_SIZE 8
+#endif // !_TARGET_X86_ || !UNIX_X86_ABI
//=======================================================================
diff --git a/src/vm/finalizerthread.cpp b/src/vm/finalizerthread.cpp
index 51a2ed49c0..0a4da165a1 100644
--- a/src/vm/finalizerthread.cpp
+++ b/src/vm/finalizerthread.cpp
@@ -484,7 +484,7 @@ void FinalizerThread::WaitForFinalizerEvent (CLREvent *event)
case (WAIT_OBJECT_0 + kLowMemoryNotification):
//short on memory GC immediately
GetFinalizerThread()->DisablePreemptiveGC();
- GCHeapUtilities::GetGCHeap()->GarbageCollect(0, TRUE);
+ GCHeapUtilities::GetGCHeap()->GarbageCollect(0, true);
GetFinalizerThread()->EnablePreemptiveGC();
//wait only on the event for 2s
switch (event->Wait(2000, FALSE))
@@ -575,7 +575,7 @@ VOID FinalizerThread::FinalizerThreadWorker(void *args)
{
s_forcedGCInProgress = true;
GetFinalizerThread()->DisablePreemptiveGC();
- GCHeapUtilities::GetGCHeap()->GarbageCollect(2, FALSE, collection_blocking);
+ GCHeapUtilities::GetGCHeap()->GarbageCollect(2, false, collection_blocking);
GetFinalizerThread()->EnablePreemptiveGC();
s_forcedGCInProgress = false;
@@ -645,7 +645,7 @@ VOID FinalizerThread::FinalizerThreadWorker(void *args)
}
else if (UnloadingAppDomain == NULL)
break;
- else if (!GCHeapUtilities::GetGCHeap()->FinalizeAppDomain(UnloadingAppDomain, fRunFinalizersOnUnload))
+ else if (!GCHeapUtilities::GetGCHeap()->FinalizeAppDomain(UnloadingAppDomain, !!fRunFinalizersOnUnload))
{
break;
}
@@ -1345,6 +1345,8 @@ BOOL FinalizerThread::FinalizerThreadWatchDogHelper()
}
ULONGLONG dwCurTickCount = CLRGetTickCount64();
if (pThread && pThread->m_State & (Thread::TS_UserSuspendPending | Thread::TS_DebugSuspendPending)) {
+ // CoreCLR does not support user-requested thread suspension
+ _ASSERTE(!(pThread->m_State & Thread::TS_UserSuspendPending));
dwBeginTickCount = dwCurTickCount;
}
if (dwCurTickCount - dwBeginTickCount >= maxTotalWait)
diff --git a/src/vm/gccover.cpp b/src/vm/gccover.cpp
index 02bb0de5e0..3e195796b4 100644
--- a/src/vm/gccover.cpp
+++ b/src/vm/gccover.cpp
@@ -1759,7 +1759,10 @@ void DoGcStress (PCONTEXT regs, MethodDesc *pMD)
// Do the actual stress work
//
- if (!GCHeapUtilities::GetGCHeap()->StressHeap())
+ // BUG(github #10318) - when not using allocation contexts, the alloc lock
+ // must be acquired here. Until fixed, this assert prevents random heap corruption.
+ assert(GCHeapUtilities::UseThreadAllocationContexts());
+ if (!GCHeapUtilities::GetGCHeap()->StressHeap(GetThread()->GetAllocContext()))
UpdateGCStressInstructionWithoutGC ();
// Must flush instruction cache before returning as instruction has been modified.
diff --git a/src/vm/gcenv.ee.cpp b/src/vm/gcenv.ee.cpp
index baea98f4b9..f3c139e66d 100644
--- a/src/vm/gcenv.ee.cpp
+++ b/src/vm/gcenv.ee.cpp
@@ -626,6 +626,11 @@ void GCToEEInterface::GcStartWork (int condemned, int max_gen)
//
RCWWalker::OnGCStarted(condemned);
#endif // FEATURE_COMINTEROP
+
+ if (condemned == max_gen)
+ {
+ ThreadStore::s_pThreadStore->OnMaxGenerationGCStarted();
+ }
}
void GCToEEInterface::GcDone(int condemned)
@@ -725,10 +730,17 @@ void GCToEEInterface::GcEnumAllocContexts(enum_alloc_context_func* fn, void* par
}
CONTRACTL_END;
- Thread * pThread = NULL;
- while ((pThread = ThreadStore::GetThreadList(pThread)) != NULL)
+ if (GCHeapUtilities::UseThreadAllocationContexts())
+ {
+ Thread * pThread = NULL;
+ while ((pThread = ThreadStore::GetThreadList(pThread)) != NULL)
+ {
+ fn(pThread->GetAllocContext(), param);
+ }
+ }
+ else
{
- fn(pThread->GetAllocContext(), param);
+ fn(&g_global_alloc_context, param);
}
}
@@ -878,7 +890,9 @@ void ProfScanRootsHelper(Object** ppObject, ScanContext *pSC, uint32_t dwFlags)
Object *pObj = *ppObject;
if (dwFlags & GC_CALL_INTERIOR)
{
- pObj = GCHeapUtilities::GetGCHeap()->GetContainingObject(pObj);
+ pObj = GCHeapUtilities::GetGCHeap()->GetContainingObject(pObj, true);
+ if (pObj == nullptr)
+ return;
}
ScanRootsHelper(pObj, ppObject, pSC, dwFlags);
#endif // defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE)
@@ -941,7 +955,7 @@ void GcScanRootsForProfilerAndETW(promote_func* fn, int condemned, int max_gen,
}
}
-void ScanHandleForProfilerAndETW(Object** pRef, Object* pSec, uint32_t flags, ScanContext* context, BOOL isDependent)
+void ScanHandleForProfilerAndETW(Object** pRef, Object* pSec, uint32_t flags, ScanContext* context, bool isDependent)
{
ProfilingScanContext* pSC = (ProfilingScanContext*)context;
@@ -1002,6 +1016,7 @@ void GCProfileWalkHeapWorker(BOOL fProfilerPinned, BOOL fShouldWalkHeapRootsForE
{
{
ProfilingScanContext SC(fProfilerPinned);
+ unsigned max_generation = GCHeapUtilities::GetGCHeap()->GetMaxGeneration();
// **** Scan roots: Only scan roots if profiling API wants them or ETW wants them.
if (fProfilerPinned || fShouldWalkHeapRootsForEtw)
@@ -1054,7 +1069,7 @@ void GCProfileWalkHeapWorker(BOOL fProfilerPinned, BOOL fShouldWalkHeapRootsForE
// **** Walk objects on heap: only if profiling API wants them or ETW wants them.
if (fProfilerPinned || fShouldWalkHeapObjectsForEtw)
{
- GCHeapUtilities::GetGCHeap()->DiagWalkHeap(&HeapWalkHelper, &profilerWalkHeapContext, max_generation, TRUE /* walk the large object heap */);
+ GCHeapUtilities::GetGCHeap()->DiagWalkHeap(&HeapWalkHelper, &profilerWalkHeapContext, max_generation, true /* walk the large object heap */);
}
#ifdef FEATURE_EVENT_TRACE
@@ -1104,7 +1119,7 @@ void GCProfileWalkHeap()
#endif // defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE)
}
-void WalkFReachableObjects(BOOL isCritical, void* objectID)
+void WalkFReachableObjects(bool isCritical, void* objectID)
{
g_profControlBlock.pProfInterface->FinalizeableObjectQueued(isCritical, (ObjectID)objectID);
}
@@ -1122,7 +1137,7 @@ void GCToEEInterface::DiagGCStart(int gen, bool isInduced)
// When we're walking objects allocated by class, then we don't want to walk the large
// object heap because then it would count things that may have been around for a while.
- GCHeapUtilities::GetGCHeap()->DiagWalkHeap(&AllocByClassHelper, (void *)&context, 0, FALSE);
+ GCHeapUtilities::GetGCHeap()->DiagWalkHeap(&AllocByClassHelper, (void *)&context, 0, false);
// Notify that we've reached the end of the Gen 0 scan
g_profControlBlock.pProfInterface->EndAllocByClass(&context);
@@ -1169,13 +1184,13 @@ void GCToEEInterface::DiagWalkFReachableObjects(void* gcContext)
// don't get confused.
void WalkMovedReferences(uint8_t* begin, uint8_t* end,
ptrdiff_t reloc,
- size_t context,
- BOOL fCompacting,
- BOOL fBGC)
+ void* context,
+ bool fCompacting,
+ bool fBGC)
{
ETW::GCLog::MovedReference(begin, end,
(fCompacting ? reloc : 0),
- context,
+ (size_t)context,
fCompacting,
!fBGC);
}
@@ -1187,7 +1202,7 @@ void GCToEEInterface::DiagWalkSurvivors(void* gcContext)
{
size_t context = 0;
ETW::GCLog::BeginMovedReferences(&context);
- GCHeapUtilities::GetGCHeap()->DiagWalkSurvivorsWithType(gcContext, &WalkMovedReferences, context, walk_for_gc);
+ GCHeapUtilities::GetGCHeap()->DiagWalkSurvivorsWithType(gcContext, &WalkMovedReferences, (void*)context, walk_for_gc);
ETW::GCLog::EndMovedReferences(context);
}
#endif //GC_PROFILING || FEATURE_EVENT_TRACE
@@ -1200,7 +1215,7 @@ void GCToEEInterface::DiagWalkLOHSurvivors(void* gcContext)
{
size_t context = 0;
ETW::GCLog::BeginMovedReferences(&context);
- GCHeapUtilities::GetGCHeap()->DiagWalkSurvivorsWithType(gcContext, &WalkMovedReferences, context, walk_for_loh);
+ GCHeapUtilities::GetGCHeap()->DiagWalkSurvivorsWithType(gcContext, &WalkMovedReferences, (void*)context, walk_for_loh);
ETW::GCLog::EndMovedReferences(context);
}
#endif //GC_PROFILING || FEATURE_EVENT_TRACE
@@ -1213,7 +1228,7 @@ void GCToEEInterface::DiagWalkBGCSurvivors(void* gcContext)
{
size_t context = 0;
ETW::GCLog::BeginMovedReferences(&context);
- GCHeapUtilities::GetGCHeap()->DiagWalkSurvivorsWithType(gcContext, &WalkMovedReferences, context, walk_for_bgc);
+ GCHeapUtilities::GetGCHeap()->DiagWalkSurvivorsWithType(gcContext, &WalkMovedReferences, (void*)context, walk_for_bgc);
ETW::GCLog::EndMovedReferences(context);
}
#endif //GC_PROFILING || FEATURE_EVENT_TRACE
@@ -1330,3 +1345,17 @@ void GCToEEInterface::EnableFinalization(bool foundFinalizers)
FinalizerThread::EnableFinalization();
}
}
+
+void GCToEEInterface::HandleFatalError(unsigned int exitCode)
+{
+ EEPOLICY_HANDLE_FATAL_ERROR(exitCode);
+}
+
+bool GCToEEInterface::ShouldFinalizeObjectForUnload(AppDomain* pDomain, Object* obj)
+{
+ // CoreCLR does not have appdomains, so this code path is dead. Other runtimes may
+ // choose to inspect the object being finalized here.
+ // [DESKTOP TODO] Desktop looks for "agile and finalizable" objects and may choose
+ // to move them to a new app domain instead of finalizing them here.
+ return true;
+}
diff --git a/src/vm/gcenv.ee.h b/src/vm/gcenv.ee.h
index 9aa3e59e36..030eb71807 100644
--- a/src/vm/gcenv.ee.h
+++ b/src/vm/gcenv.ee.h
@@ -44,8 +44,10 @@ public:
void StompWriteBarrier(WriteBarrierParameters* args);
void EnableFinalization(bool foundFinalizers);
+ void HandleFatalError(unsigned int exitCode);
+ bool ShouldFinalizeObjectForUnload(AppDomain* pDomain, Object* obj);
};
#endif // FEATURE_STANDALONE_GC
-#endif // _GCENV_EE_H_ \ No newline at end of file
+#endif // _GCENV_EE_H_
diff --git a/src/vm/gcenv.os.cpp b/src/vm/gcenv.os.cpp
index 0cbe016445..6c08558e03 100644
--- a/src/vm/gcenv.os.cpp
+++ b/src/vm/gcenv.os.cpp
@@ -360,13 +360,13 @@ size_t GCToOSInterface::GetVirtualMemoryLimit()
}
+static size_t g_RestrictedPhysicalMemoryLimit = (size_t)MAX_PTR;
+
#ifndef FEATURE_PAL
typedef BOOL (WINAPI *PGET_PROCESS_MEMORY_INFO)(HANDLE handle, PROCESS_MEMORY_COUNTERS* memCounters, uint32_t cb);
static PGET_PROCESS_MEMORY_INFO GCGetProcessMemoryInfo = 0;
-static size_t g_RestrictedPhysicalMemoryLimit = (size_t)MAX_PTR;
-
typedef BOOL (WINAPI *PIS_PROCESS_IN_JOB)(HANDLE processHandle, HANDLE jobHandle, BOOL* result);
typedef BOOL (WINAPI *PQUERY_INFORMATION_JOB_OBJECT)(HANDLE jobHandle, JOBOBJECTINFOCLASS jobObjectInfoClass, void* lpJobObjectInfo, DWORD cbJobObjectInfoLength, LPDWORD lpReturnLength);
@@ -455,6 +455,21 @@ exit:
return g_RestrictedPhysicalMemoryLimit;
}
+#else
+
+static size_t GetRestrictedPhysicalMemoryLimit()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ // The limit was cached already
+ if (g_RestrictedPhysicalMemoryLimit != (size_t)MAX_PTR)
+ return g_RestrictedPhysicalMemoryLimit;
+
+ size_t memory_limit = PAL_GetRestrictedPhysicalMemoryLimit();
+
+ VolatileStore(&g_RestrictedPhysicalMemoryLimit, memory_limit);
+ return g_RestrictedPhysicalMemoryLimit;
+}
#endif // FEATURE_PAL
@@ -465,11 +480,9 @@ uint64_t GCToOSInterface::GetPhysicalMemoryLimit()
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_PAL
size_t restricted_limit = GetRestrictedPhysicalMemoryLimit();
if (restricted_limit != 0)
return restricted_limit;
-#endif
MEMORYSTATUSEX memStatus;
::GetProcessMemoryLoad(&memStatus);
@@ -489,17 +502,29 @@ void GCToOSInterface::GetMemoryStatus(uint32_t* memory_load, uint64_t* available
{
LIMITED_METHOD_CONTRACT;
-#ifndef FEATURE_PAL
uint64_t restricted_limit = GetRestrictedPhysicalMemoryLimit();
if (restricted_limit != 0)
{
+ size_t workingSetSize;
+ BOOL status = FALSE;
+#ifndef FEATURE_PAL
PROCESS_MEMORY_COUNTERS pmc;
- if (GCGetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc)))
+ status = GCGetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc));
+ workingSetSize = pmc.WorkingSetSize;
+#else
+ status = PAL_GetWorkingSetSize(&workingSetSize);
+#endif
+ if(status)
{
if (memory_load)
- *memory_load = (uint32_t)((float)pmc.WorkingSetSize * 100.0 / (float)restricted_limit);
+ *memory_load = (uint32_t)((float)workingSetSize * 100.0 / (float)restricted_limit);
if (available_physical)
- *available_physical = restricted_limit - pmc.WorkingSetSize;
+ {
+ if(workingSetSize > restricted_limit)
+ *available_physical = 0;
+ else
+ *available_physical = restricted_limit - workingSetSize;
+ }
// Available page file doesn't mean much when physical memory is restricted since
// we don't know how much of it is available to this process so we are not going to
// bother to make another OS call for it.
@@ -509,7 +534,6 @@ void GCToOSInterface::GetMemoryStatus(uint32_t* memory_load, uint64_t* available
return;
}
}
-#endif
MEMORYSTATUSEX ms;
::GetProcessMemoryLoad(&ms);
diff --git a/src/vm/gcheaputilities.cpp b/src/vm/gcheaputilities.cpp
index c34d07b30a..91640d30a2 100644
--- a/src/vm/gcheaputilities.cpp
+++ b/src/vm/gcheaputilities.cpp
@@ -4,6 +4,8 @@
#include "common.h"
#include "gcheaputilities.h"
+#include "appdomain.hpp"
+
// These globals are variables used within the GC and maintained
// by the EE for use in write barriers. It is the responsibility
@@ -12,6 +14,7 @@
GPTR_IMPL_INIT(uint32_t, g_card_table, nullptr);
GPTR_IMPL_INIT(uint8_t, g_lowest_address, nullptr);
GPTR_IMPL_INIT(uint8_t, g_highest_address, nullptr);
+GVAL_IMPL_INIT(GCHeapType, g_heap_type, GC_HEAP_INVALID);
uint8_t* g_ephemeral_low = (uint8_t*)1;
uint8_t* g_ephemeral_high = (uint8_t*)~0;
@@ -22,6 +25,8 @@ uint32_t* g_card_bundle_table = nullptr;
// This is the global GC heap, maintained by the VM.
GPTR_IMPL(IGCHeap, g_pGCHeap);
+IGCHandleTable* g_pGCHandleTable = nullptr;
+
GcDacVars g_gc_dac_vars;
GPTR_IMPL(GcDacVars, g_gcDacGlobals);
@@ -31,3 +36,40 @@ uint8_t* g_sw_ww_table = nullptr;
bool g_sw_ww_enabled_for_gc_heap = false;
#endif // FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP
+
+gc_alloc_context g_global_alloc_context = {};
+
+// Debug-only validation for handle.
+void ValidateHandleAndAppDomain(OBJECTHANDLE handle)
+{
+#ifdef _DEBUG_IMPL
+ OBJECTREF objRef = ObjectToOBJECTREF(*(Object**)handle);
+ VALIDATEOBJECTREF(objRef);
+
+ IGCHandleTable *pHandleTable = GCHeapUtilities::GetGCHandleTable();
+
+ void* handleTable = pHandleTable->GetHandleTableForHandle(handle);
+ DWORD context = (DWORD)pHandleTable->GetHandleTableContext(handleTable);
+
+ ADIndex appDomainIndex = ADIndex(context);
+ AppDomain *domain = SystemDomain::GetAppDomainAtIndex(appDomainIndex);
+
+ // Access to a handle in an unloaded domain is not allowed
+ assert(domain != nullptr);
+ assert(!domain->NoAccessToHandleTable());
+
+#if CHECK_APP_DOMAIN_LEAKS
+ if (g_pConfig->AppDomainLeaks() && objRef != NULL)
+ {
+ if (appDomainIndex.m_dwIndex)
+ {
+ objRef->TryAssignAppDomain(domain);
+ }
+ else
+ {
+ objRef->TrySetAppDomainAgile();
+ }
+ }
+#endif // CHECK_APP_DOMAIN_LEAKS
+#endif // _DEBUG_IMPL
+}
diff --git a/src/vm/gcheaputilities.h b/src/vm/gcheaputilities.h
index 48481146b4..baa2558b8e 100644
--- a/src/vm/gcheaputilities.h
+++ b/src/vm/gcheaputilities.h
@@ -16,10 +16,18 @@ extern "C" {
GPTR_DECL(uint8_t,g_lowest_address);
GPTR_DECL(uint8_t,g_highest_address);
GPTR_DECL(uint32_t,g_card_table);
+GVAL_DECL(GCHeapType, g_heap_type);
#ifndef DACCESS_COMPILE
}
#endif // !DACCESS_COMPILE
+// For single-proc machines, the EE will use a single, shared alloc context
+// for all allocations. In order to avoid extra indirections in assembly
+// allocation helpers, the EE owns the global allocation context and the
+// GC will update it when it needs to.
+extern "C" gc_alloc_context g_global_alloc_context;
+
+extern "C" IGCHandleTable* g_pGCHandleTable;
extern "C" uint32_t* g_card_bundle_table;
extern "C" uint8_t* g_ephemeral_low;
extern "C" uint8_t* g_ephemeral_high;
@@ -65,6 +73,15 @@ public:
return g_pGCHeap;
}
+ // Retrieves the GC handle table.
+ static IGCHandleTable* GetGCHandleTable()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ assert(g_pGCHandleTable != nullptr);
+ return g_pGCHandleTable;
+ }
+
// Returns true if the heap has been initialized, false otherwise.
inline static bool IsGCHeapInitialized()
{
@@ -75,7 +92,7 @@ public:
// Returns true if a the heap is initialized and a garbage collection
// is in progress, false otherwise.
- inline static BOOL IsGCInProgress(BOOL bConsiderGCStart = FALSE)
+ inline static bool IsGCInProgress(bool bConsiderGCStart = false)
{
WRAPPER_NO_CONTRACT;
@@ -84,7 +101,7 @@ public:
// Returns true if we should be competing marking for statics. This
// influences the behavior of `GCToEEInterface::GcScanRoots`.
- inline static BOOL MarkShouldCompeteForStatics()
+ inline static bool MarkShouldCompeteForStatics()
{
WRAPPER_NO_CONTRACT;
@@ -92,7 +109,7 @@ public:
}
// Waits until a GC is complete, if the heap has been initialized.
- inline static void WaitForGCCompletion(BOOL bConsiderGCStart = FALSE)
+ inline static void WaitForGCCompletion(bool bConsiderGCStart = false)
{
WRAPPER_NO_CONTRACT;
@@ -100,34 +117,31 @@ public:
GetGCHeap()->WaitUntilGCComplete(bConsiderGCStart);
}
- // Returns true if we should be using allocation contexts, false otherwise.
- inline static bool UseAllocationContexts()
- {
- WRAPPER_NO_CONTRACT;
-#ifdef FEATURE_REDHAWK
- // SIMPLIFY: only use allocation contexts
- return true;
-#else
-#if defined(_TARGET_ARM_) || defined(FEATURE_PAL)
- return true;
-#else
- return ((IsServerHeap() ? true : (g_SystemInfo.dwNumberOfProcessors >= 2)));
-#endif
-#endif
- }
-
// Returns true if the held GC heap is a Server GC heap, false otherwise.
inline static bool IsServerHeap()
{
LIMITED_METHOD_CONTRACT;
+
#ifdef FEATURE_SVR_GC
- _ASSERTE(IGCHeap::gcHeapType != IGCHeap::GC_HEAP_INVALID);
- return (IGCHeap::gcHeapType == IGCHeap::GC_HEAP_SVR);
-#else // FEATURE_SVR_GC
+ _ASSERTE(g_heap_type != GC_HEAP_INVALID);
+ return g_heap_type == GC_HEAP_SVR;
+#else
return false;
#endif // FEATURE_SVR_GC
}
+ static bool UseThreadAllocationContexts()
+ {
+ // When running on a single-proc system, it's more efficient to use a single global
+ // allocation context for SOH allocations than to use one for every thread.
+#if defined(_TARGET_ARM_) || defined(FEATURE_PAL) || defined(FEATURE_REDHAWK)
+ return true;
+#else
+ return IsServerHeap() || ::GetCurrentProcessCpuCount() != 1;
+#endif
+
+ }
+
#ifdef FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP
// Returns True if software write watch is currently enabled for the GC Heap,
@@ -192,11 +206,27 @@ public:
}
#endif // FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP
-
private:
// This class should never be instantiated.
GCHeapUtilities() = delete;
};
+// Handle-related utilities.
+
+void ValidateHandleAndAppDomain(OBJECTHANDLE handle);
+
+// Given a handle, returns an OBJECTREF for the object it refers to.
+inline OBJECTREF ObjectFromHandle(OBJECTHANDLE handle)
+{
+ _ASSERTE(handle);
+
+#ifdef _DEBUG_IMPL
+ ValidateHandleAndAppDomain(handle);
+#endif // _DEBUG_IMPL
+
+ // Wrap the raw OBJECTREF and return it
+ return UNCHECKED_OBJECTREF_TO_OBJECTREF(*PTR_UNCHECKED_OBJECTREF(handle));
+}
+
#endif // _GCHEAPUTILITIES_H_
diff --git a/src/vm/gchelpers.cpp b/src/vm/gchelpers.cpp
index 6b3c2f6650..9669f988d7 100644
--- a/src/vm/gchelpers.cpp
+++ b/src/vm/gchelpers.cpp
@@ -54,11 +54,110 @@ inline gc_alloc_context* GetThreadAllocContext()
{
WRAPPER_NO_CONTRACT;
- assert(GCHeapUtilities::UseAllocationContexts());
+ assert(GCHeapUtilities::UseThreadAllocationContexts());
return & GetThread()->m_alloc_context;
}
+// When not using per-thread allocation contexts, we (the EE) need to take care that
+// no two threads are concurrently modifying the global allocation context. This lock
+// must be acquired before any sort of operations involving the global allocation context
+// can occur.
+//
+// This lock is acquired by all allocations when not using per-thread allocation contexts.
+// It is acquired in two kinds of places:
+// 1) JIT_TrialAllocFastSP (and related assembly alloc helpers), which attempt to
+// acquire it but move into an alloc slow path if acquiring fails
+// (but does not decrement the lock variable when doing so)
+// 2) Alloc and AllocAlign8 in gchelpers.cpp, which acquire the lock using
+// the Acquire and Release methods below.
+class GlobalAllocLock {
+ friend struct AsmOffsets;
+private:
+ // The lock variable. This field must always be first.
+ LONG m_lock;
+
+public:
+ // Creates a new GlobalAllocLock in the unlocked state.
+ GlobalAllocLock() : m_lock(-1) {}
+
+ // Copy and copy-assignment operators should never be invoked
+ // for this type
+ GlobalAllocLock(const GlobalAllocLock&) = delete;
+ GlobalAllocLock& operator=(const GlobalAllocLock&) = delete;
+
+ // Acquires the lock, spinning if necessary to do so. When this method
+ // returns, m_lock will be zero and the lock will be acquired.
+ void Acquire()
+ {
+ CONTRACTL {
+ NOTHROW;
+ GC_TRIGGERS; // switch to preemptive mode
+ MODE_COOPERATIVE;
+ } CONTRACTL_END;
+
+ DWORD spinCount = 0;
+ while(FastInterlockExchange(&m_lock, 0) != -1)
+ {
+ GCX_PREEMP();
+ __SwitchToThread(0, spinCount++);
+ }
+
+ assert(m_lock == 0);
+ }
+
+ // Releases the lock.
+ void Release()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ // the lock may not be exactly 0. This is because the
+ // assembly alloc routines increment the lock variable and
+ // jump if not zero to the slow alloc path, which eventually
+ // will try to acquire the lock again. At that point, it will
+ // spin in Acquire (since m_lock is some number that's not zero).
+ // When the thread that /does/ hold the lock releases it, the spinning
+ // thread will continue.
+ MemoryBarrier();
+ assert(m_lock >= 0);
+ m_lock = -1;
+ }
+
+ // Static helper to acquire a lock, for use with the Holder template.
+ static void AcquireLock(GlobalAllocLock *lock)
+ {
+ WRAPPER_NO_CONTRACT;
+ lock->Acquire();
+ }
+
+ // Static helper to release a lock, for use with the Holder template
+ static void ReleaseLock(GlobalAllocLock *lock)
+ {
+ WRAPPER_NO_CONTRACT;
+ lock->Release();
+ }
+
+ typedef Holder<GlobalAllocLock *, GlobalAllocLock::AcquireLock, GlobalAllocLock::ReleaseLock> Holder;
+};
+
+typedef GlobalAllocLock::Holder GlobalAllocLockHolder;
+
+struct AsmOffsets {
+ static_assert(offsetof(GlobalAllocLock, m_lock) == 0, "ASM code relies on this property");
+};
+
+// For single-proc machines, the global allocation context is protected
+// from concurrent modification by this lock.
+//
+// When not using per-thread allocation contexts, certain methods on IGCHeap
+// require that this lock be held before calling. These methods are documented
+// on the IGCHeap interface.
+extern "C"
+{
+ GlobalAllocLock g_global_alloc_lock;
+}
+
+
// Checks to see if the given allocation size exceeds the
// largest object size allowed - if it does, it throws
// an OutOfMemoryException with a message indicating that
@@ -102,12 +201,12 @@ inline void CheckObjectSize(size_t alloc_size)
// * Call code:Alloc - When the jit helpers fall back, or we do allocations within the runtime code
// itself, we ultimately call here.
// * Call code:AllocLHeap - Used very rarely to force allocation to be on the large object heap.
-//
+//
// While this is a choke point into allocating an object, it is primitive (it does not want to know about
-// MethodTable and thus does not initialize that poitner. It also does not know if the object is finalizable
+// MethodTable and thus does not initialize that pointer. It also does not know if the object is finalizable
// or contains pointers. Thus we quickly wrap this function in more user-friendly ones that know about
// MethodTables etc. (see code:FastAllocatePrimitiveArray code:AllocateArrayEx code:AllocateObject)
-//
+//
// You can get an exhaustive list of code sites that allocate GC objects by finding all calls to
// code:ProfilerObjectAllocatedCallback (since the profiler has to hook them all).
inline Object* Alloc(size_t size, BOOL bFinalize, BOOL bContainsPointers )
@@ -137,10 +236,16 @@ inline Object* Alloc(size_t size, BOOL bFinalize, BOOL bContainsPointers )
// We don't want to throw an SO during the GC, so make sure we have plenty
// of stack before calling in.
INTERIOR_STACK_PROBE_FOR(GetThread(), static_cast<unsigned>(DEFAULT_ENTRY_PROBE_AMOUNT * 1.5));
- if (GCHeapUtilities::UseAllocationContexts())
+ if (GCHeapUtilities::UseThreadAllocationContexts())
+ {
retVal = GCHeapUtilities::GetGCHeap()->Alloc(GetThreadAllocContext(), size, flags);
+ }
else
- retVal = GCHeapUtilities::GetGCHeap()->Alloc(size, flags);
+ {
+ GlobalAllocLockHolder holder(&g_global_alloc_lock);
+ retVal = GCHeapUtilities::GetGCHeap()->Alloc(&g_global_alloc_context, size, flags);
+ }
+
if (!retVal)
{
@@ -172,10 +277,15 @@ inline Object* AllocAlign8(size_t size, BOOL bFinalize, BOOL bContainsPointers,
// We don't want to throw an SO during the GC, so make sure we have plenty
// of stack before calling in.
INTERIOR_STACK_PROBE_FOR(GetThread(), static_cast<unsigned>(DEFAULT_ENTRY_PROBE_AMOUNT * 1.5));
- if (GCHeapUtilities::UseAllocationContexts())
+ if (GCHeapUtilities::UseThreadAllocationContexts())
+ {
retVal = GCHeapUtilities::GetGCHeap()->AllocAlign8(GetThreadAllocContext(), size, flags);
+ }
else
- retVal = GCHeapUtilities::GetGCHeap()->AllocAlign8(size, flags);
+ {
+ GlobalAllocLockHolder holder(&g_global_alloc_lock);
+ retVal = GCHeapUtilities::GetGCHeap()->AllocAlign8(&g_global_alloc_context, size, flags);
+ }
if (!retVal)
{
diff --git a/src/vm/gcstress.h b/src/vm/gcstress.h
index 04487c611e..edf92a947c 100644
--- a/src/vm/gcstress.h
+++ b/src/vm/gcstress.h
@@ -286,7 +286,12 @@ namespace _GCStress
public:
FORCEINLINE
static void Trigger()
- { GCHeapUtilities::GetGCHeap()->StressHeap(); }
+ {
+ // BUG(github #10318) - when not using allocation contexts, the alloc lock
+ // must be acquired here. Until fixed, this assert prevents random heap corruption.
+ _ASSERTE(GCHeapUtilities::UseThreadAllocationContexts());
+ GCHeapUtilities::GetGCHeap()->StressHeap(GetThread()->GetAllocContext());
+ }
FORCEINLINE
static void Trigger(::gc_alloc_context* acontext)
diff --git a/src/vm/gdbjit.cpp b/src/vm/gdbjit.cpp
index 86e86798cf..1f2bedf39a 100644
--- a/src/vm/gdbjit.cpp
+++ b/src/vm/gdbjit.cpp
@@ -16,15 +16,17 @@
#include "gdbjithelpers.h"
TypeInfoBase*
-GetTypeInfoFromTypeHandle(TypeHandle typeHandle, NotifyGdb::PTK_TypeInfoMap pTypeMap)
+GetTypeInfoFromTypeHandle(TypeHandle typeHandle,
+ NotifyGdb::PTK_TypeInfoMap pTypeMap,
+ FunctionMemberPtrArrayHolder &method)
{
- TypeInfoBase *typeInfo = nullptr;
+ TypeInfoBase *foundTypeInfo = nullptr;
TypeKey key = typeHandle.GetTypeKey();
PTR_MethodTable pMT = typeHandle.GetMethodTable();
- if (pTypeMap->Lookup(&key, &typeInfo))
+ if (pTypeMap->Lookup(&key, &foundTypeInfo))
{
- return typeInfo;
+ return foundTypeInfo;
}
CorElementType corType = typeHandle.GetSignatureCorElementType();
@@ -45,13 +47,12 @@ GetTypeInfoFromTypeHandle(TypeHandle typeHandle, NotifyGdb::PTK_TypeInfoMap pTyp
case ELEMENT_TYPE_R8:
case ELEMENT_TYPE_U:
case ELEMENT_TYPE_I:
- typeInfo = new (nothrow) ByteTypeInfo(typeHandle, CorElementTypeToDWEncoding[corType]);
- if (typeInfo == nullptr)
- return nullptr;
-
- typeInfo->m_type_size = CorTypeInfo::Size(corType);
-
- break;
+ {
+ NewHolder<PrimitiveTypeInfo> typeInfo = new PrimitiveTypeInfo(typeHandle);
+ pTypeMap->Add(typeInfo->GetTypeKey(), typeInfo);
+ typeInfo.SuppressRelease();
+ return typeInfo;
+ }
case ELEMENT_TYPE_VALUETYPE:
case ELEMENT_TYPE_CLASS:
{
@@ -59,38 +60,23 @@ GetTypeInfoFromTypeHandle(TypeHandle typeHandle, NotifyGdb::PTK_TypeInfoMap pTyp
pMT->IsString() ? ApproxFieldDescIterator::INSTANCE_FIELDS : ApproxFieldDescIterator::ALL_FIELDS);
ULONG cFields = fieldDescIterator.Count();
- typeInfo = new (nothrow) ClassTypeInfo(typeHandle, cFields);
-
- if (typeInfo == nullptr)
- return nullptr;
-
- if (pMT->IsValueType())
- typeInfo->m_type_size = typeHandle.GetSize();
- else
- typeInfo->m_type_size = typeHandle.AsMethodTable()->GetClass()->GetSize();
+ NewHolder<ClassTypeInfo> typeInfo = new ClassTypeInfo(typeHandle, cFields, method);
- RefTypeInfo* refTypeInfo = nullptr;
+ NewHolder<RefTypeInfo> refTypeInfo = nullptr;
if (!typeHandle.IsValueType())
{
- // name the type
- refTypeInfo = new (nothrow) NamedRefTypeInfo(typeHandle, typeInfo);
- if (refTypeInfo == nullptr)
- {
- return nullptr;
- }
- refTypeInfo->m_type_size = sizeof(TADDR);
- refTypeInfo->m_value_type = typeInfo;
- refTypeInfo->CalculateName();
+ refTypeInfo = new NamedRefTypeInfo(typeHandle, typeInfo);
+ typeInfo.SuppressRelease();
pTypeMap->Add(refTypeInfo->GetTypeKey(), refTypeInfo);
+ refTypeInfo.SuppressRelease();
}
else
{
pTypeMap->Add(typeInfo->GetTypeKey(), typeInfo);
+ typeInfo.SuppressRelease();
}
- typeInfo->CalculateName();
-
//
// Now fill in the array
//
@@ -99,16 +85,15 @@ GetTypeInfoFromTypeHandle(TypeHandle typeHandle, NotifyGdb::PTK_TypeInfoMap pTyp
for (ULONG i = 0; i < cFields; i++)
{
pField = fieldDescIterator.Next();
- ClassTypeInfo *info = static_cast<ClassTypeInfo*>(typeInfo);
LPCUTF8 szName = pField->GetName();
- info->members[i].m_member_name = new char[strlen(szName) + 1];
- strcpy(info->members[i].m_member_name, szName);
+ typeInfo->members[i].m_member_name = new char[strlen(szName) + 1];
+ strcpy(typeInfo->members[i].m_member_name, szName);
if (!pField->IsStatic())
{
- info->members[i].m_member_offset = (ULONG)pField->GetOffset();
+ typeInfo->members[i].m_member_offset = (ULONG)pField->GetOffset();
if (!typeHandle.IsValueType())
- info->members[i].m_member_offset += Object::GetOffsetOfFirstField();
+ typeInfo->members[i].m_member_offset += Object::GetOffsetOfFirstField();
}
else
{
@@ -120,30 +105,27 @@ GetTypeInfoFromTypeHandle(TypeHandle typeHandle, NotifyGdb::PTK_TypeInfoMap pTyp
if (pField->IsRVA() || !pMT->IsDynamicStatics())
{
PTR_VOID pAddress = pField->GetStaticAddressHandle((PTR_VOID)dac_cast<TADDR>(base));
- info->members[i].m_static_member_address = dac_cast<TADDR>(pAddress);
+ typeInfo->members[i].m_static_member_address = dac_cast<TADDR>(pAddress);
}
}
- info->members[i].m_member_type =
- GetTypeInfoFromTypeHandle(pField->GetExactFieldType(typeHandle), pTypeMap);
+ typeInfo->members[i].m_member_type =
+ GetTypeInfoFromTypeHandle(pField->GetExactFieldType(typeHandle), pTypeMap, method);
// handle the System.String case:
// coerce type of the second field into array type
if (pMT->IsString() && i == 1)
{
- TypeInfoBase* elemTypeInfo = info->members[1].m_member_type;
- TypeInfoBase* arrayTypeInfo = new (nothrow) ArrayTypeInfo(typeHandle.MakeSZArray(), 1, elemTypeInfo);
- if (arrayTypeInfo == nullptr)
- return nullptr;
- info->members[1].m_member_type = arrayTypeInfo;
+ TypeInfoBase* elemTypeInfo = typeInfo->members[1].m_member_type;
+ typeInfo->m_array_type = new ArrayTypeInfo(typeHandle.MakeSZArray(), 1, elemTypeInfo);
+ typeInfo->members[1].m_member_type = typeInfo->m_array_type;
}
}
// Ignore inheritance from System.Object and System.ValueType classes.
if (!typeHandle.IsValueType() &&
pMT->GetParentMethodTable() && pMT->GetParentMethodTable()->GetParentMethodTable())
{
- static_cast<ClassTypeInfo*>(typeInfo)->m_parent =
- GetTypeInfoFromTypeHandle(typeHandle.GetParent(), pTypeMap);
+ typeInfo->m_parent = GetTypeInfoFromTypeHandle(typeHandle.GetParent(), pTypeMap, method);
}
if (refTypeInfo)
@@ -154,94 +136,64 @@ GetTypeInfoFromTypeHandle(TypeHandle typeHandle, NotifyGdb::PTK_TypeInfoMap pTyp
case ELEMENT_TYPE_PTR:
case ELEMENT_TYPE_BYREF:
{
- TypeInfoBase* valTypeInfo = GetTypeInfoFromTypeHandle(typeHandle.GetTypeParam(), pTypeMap);
- typeInfo = new (nothrow) RefTypeInfo(typeHandle, valTypeInfo);
- if (typeInfo == nullptr)
- return nullptr;
- typeInfo->m_type_size = sizeof(TADDR);
+ TypeInfoBase* valTypeInfo = GetTypeInfoFromTypeHandle(typeHandle.GetTypeParam(), pTypeMap, method);
+ NewHolder<RefTypeInfo> typeInfo = new RefTypeInfo(typeHandle, valTypeInfo);
+
typeInfo->m_type_offset = valTypeInfo->m_type_offset;
- break;
+
+ pTypeMap->Add(typeInfo->GetTypeKey(), typeInfo);
+ typeInfo.SuppressRelease();
+ return typeInfo;
}
case ELEMENT_TYPE_ARRAY:
case ELEMENT_TYPE_SZARRAY:
{
- typeInfo = new (nothrow) ClassTypeInfo(typeHandle, pMT->GetRank() == 1 ? 2 : 3);
- if (typeInfo == nullptr)
- return nullptr;
- typeInfo->m_type_size = pMT->GetClass()->GetSize();
-
- typeInfo->CalculateName();
- RefTypeInfo *refTypeInfo = new (nothrow) NamedRefTypeInfo(typeHandle, typeInfo);
- if (refTypeInfo == nullptr)
- {
- return nullptr;
- }
- refTypeInfo->m_type_size = sizeof(TADDR);
- refTypeInfo->m_value_type = typeInfo;
- refTypeInfo->CalculateName();
+ NewHolder<ClassTypeInfo> info = new ClassTypeInfo(typeHandle, pMT->GetRank() == 1 ? 2 : 3, method);
+ NewHolder<RefTypeInfo> refTypeInfo = new NamedRefTypeInfo(typeHandle, info);
+ info.SuppressRelease();
pTypeMap->Add(refTypeInfo->GetTypeKey(), refTypeInfo);
+ refTypeInfo.SuppressRelease();
TypeInfoBase* lengthTypeInfo = GetTypeInfoFromTypeHandle(
- TypeHandle(MscorlibBinder::GetElementType(ELEMENT_TYPE_I4)), pTypeMap);
-
- TypeInfoBase* valTypeInfo = GetTypeInfoFromTypeHandle(typeHandle.GetTypeParam(), pTypeMap);
- TypeInfoBase* arrayTypeInfo = new (nothrow) ArrayTypeInfo(typeHandle, 1, valTypeInfo);
- if (arrayTypeInfo == nullptr)
- return nullptr;
+ TypeHandle(MscorlibBinder::GetElementType(ELEMENT_TYPE_I4)), pTypeMap, method);
- ClassTypeInfo *info = static_cast<ClassTypeInfo*>(typeInfo);
+ TypeInfoBase* valTypeInfo = GetTypeInfoFromTypeHandle(typeHandle.GetTypeParam(), pTypeMap, method);
+ info->m_array_type = new ArrayTypeInfo(typeHandle, 1, valTypeInfo);
- info->members[0].m_member_name = new (nothrow) char[16];
+ info->members[0].m_member_name = new char[16];
strcpy(info->members[0].m_member_name, "m_NumComponents");
info->members[0].m_member_offset = ArrayBase::GetOffsetOfNumComponents();
info->members[0].m_member_type = lengthTypeInfo;
- info->members[0].m_member_type->m_type_size = sizeof(DWORD);
- info->members[1].m_member_name = new (nothrow) char[7];
+ info->members[1].m_member_name = new char[7];
strcpy(info->members[1].m_member_name, "m_Data");
info->members[1].m_member_offset = ArrayBase::GetDataPtrOffset(pMT);
- info->members[1].m_member_type = arrayTypeInfo;
+ info->members[1].m_member_type = info->m_array_type;
if (pMT->GetRank() != 1)
{
TypeHandle dwordArray(MscorlibBinder::GetElementType(ELEMENT_TYPE_I4));
- TypeInfoBase* arrayTypeInfo = new (nothrow) ArrayTypeInfo(dwordArray.MakeSZArray(), pMT->GetRank(), lengthTypeInfo);
- if (arrayTypeInfo == nullptr)
- return nullptr;
-
- info->members[2].m_member_name = new (nothrow) char[9];
+ info->m_array_bounds_type = new ArrayTypeInfo(dwordArray.MakeSZArray(), pMT->GetRank(), lengthTypeInfo);
+ info->members[2].m_member_name = new char[9];
strcpy(info->members[2].m_member_name, "m_Bounds");
info->members[2].m_member_offset = ArrayBase::GetBoundsOffset(pMT);
- info->members[2].m_member_type = arrayTypeInfo;
- info->members[2].m_member_type->m_type_size = pMT->GetRank() * sizeof(DWORD);
+ info->members[2].m_member_type = info->m_array_bounds_type;
}
return refTypeInfo;
}
default:
- ASSERT(0 && "not implemented");
- break;
- }
- // name the type
- if (corType == ELEMENT_TYPE_CHAR)
- {
- typeInfo->m_type_name = new char[9];
- strcpy(typeInfo->m_type_name, "char16_t");
+ COMPlusThrowHR(COR_E_NOTSUPPORTED);
}
- else
- {
- typeInfo->CalculateName();
- }
- pTypeMap->Add(typeInfo->GetTypeKey(), typeInfo);
- return typeInfo;
}
-TypeInfoBase* GetArgTypeInfo(MethodDesc* MethodDescPtr,
+TypeInfoBase* GetArgTypeInfo(MethodDesc* methodDescPtr,
NotifyGdb::PTK_TypeInfoMap pTypeMap,
- unsigned ilIndex)
+ unsigned ilIndex,
+ FunctionMemberPtrArrayHolder &method)
{
- MetaSig sig(MethodDescPtr);
+ MetaSig sig(methodDescPtr);
TypeHandle th;
if (ilIndex == 0)
{
@@ -255,20 +207,21 @@ TypeInfoBase* GetArgTypeInfo(MethodDesc* MethodDescPtr,
sig.NextArg();
th = sig.GetLastTypeHandleNT();
}
- return GetTypeInfoFromTypeHandle(th, pTypeMap);
+ return GetTypeInfoFromTypeHandle(th, pTypeMap, method);
}
-TypeInfoBase* GetLocalTypeInfo(MethodDesc *MethodDescPtr,
+TypeInfoBase* GetLocalTypeInfo(MethodDesc *methodDescPtr,
NotifyGdb::PTK_TypeInfoMap pTypeMap,
- unsigned ilIndex)
+ unsigned ilIndex,
+ FunctionMemberPtrArrayHolder &funcs)
{
- COR_ILMETHOD_DECODER method(MethodDescPtr->GetILHeader());
+ COR_ILMETHOD_DECODER method(methodDescPtr->GetILHeader());
if (method.GetLocalVarSigTok())
{
DWORD cbSigLen;
PCCOR_SIGNATURE pComSig;
- if (FAILED(MethodDescPtr->GetMDImport()->GetSigFromToken(method.GetLocalVarSigTok(), &cbSigLen, &pComSig)))
+ if (FAILED(methodDescPtr->GetMDImport()->GetSigFromToken(method.GetLocalVarSigTok(), &cbSigLen, &pComSig)))
{
printf("\nInvalid record");
return nullptr;
@@ -276,8 +229,8 @@ TypeInfoBase* GetLocalTypeInfo(MethodDesc *MethodDescPtr,
_ASSERTE(*pComSig == IMAGE_CEE_CS_CALLCONV_LOCAL_SIG);
- SigTypeContext typeContext(MethodDescPtr, TypeHandle());
- MetaSig sig(pComSig, cbSigLen, MethodDescPtr->GetModule(), &typeContext, MetaSig::sigLocalVars);
+ SigTypeContext typeContext(methodDescPtr, TypeHandle());
+ MetaSig sig(pComSig, cbSigLen, methodDescPtr->GetModule(), &typeContext, MetaSig::sigLocalVars);
if (ilIndex > 0)
{
while (ilIndex--)
@@ -285,14 +238,14 @@ TypeInfoBase* GetLocalTypeInfo(MethodDesc *MethodDescPtr,
}
sig.NextArg();
TypeHandle th = sig.GetLastTypeHandleNT();
- return GetTypeInfoFromTypeHandle(th, pTypeMap);
+ return GetTypeInfoFromTypeHandle(th, pTypeMap, funcs);
}
return nullptr;
}
-HRESULT GetArgNameByILIndex(MethodDesc* MethodDescPtr, unsigned index, LPSTR &paramName)
+HRESULT GetArgNameByILIndex(MethodDesc* methodDescPtr, unsigned index, NewArrayHolder<char> &paramName)
{
- IMDInternalImport* mdImport = MethodDescPtr->GetMDImport();
+ IMDInternalImport* mdImport = methodDescPtr->GetMDImport();
mdParamDef paramToken;
USHORT seq;
DWORD attr;
@@ -301,12 +254,12 @@ HRESULT GetArgNameByILIndex(MethodDesc* MethodDescPtr, unsigned index, LPSTR &pa
// Param indexing is 1-based.
ULONG32 mdIndex = index + 1;
- MetaSig sig(MethodDescPtr);
+ MetaSig sig(methodDescPtr);
if (sig.HasThis())
{
mdIndex--;
}
- status = mdImport->FindParamOfMethod(MethodDescPtr->GetMemberDef(), mdIndex, &paramToken);
+ status = mdImport->FindParamOfMethod(methodDescPtr->GetMemberDef(), mdIndex, &paramToken);
if (status == S_OK)
{
LPCSTR name;
@@ -357,14 +310,14 @@ HRESULT FindNativeInfoInILVariable(DWORD dwIndex,
BYTE* DebugInfoStoreNew(void * pData, size_t cBytes)
{
- return new (nothrow) BYTE[cBytes];
+ return new BYTE[cBytes];
}
/* Get IL to native offsets map */
HRESULT
GetMethodNativeMap(MethodDesc* methodDesc,
ULONG32* numMap,
- DebuggerILToNativeMap** map,
+ NewArrayHolder<DebuggerILToNativeMap> &map,
ULONG32* pcVars,
ICorDebugInfo::NativeVarInfo** ppVars)
{
@@ -395,33 +348,30 @@ GetMethodNativeMap(MethodDesc* methodDesc,
// Need to convert map formats.
*numMap = countMapCopy;
- *map = new (nothrow) DebuggerILToNativeMap[countMapCopy];
- if (!*map)
- {
- return E_OUTOFMEMORY;
- }
+ map = new DebuggerILToNativeMap[countMapCopy];
ULONG32 i;
for (i = 0; i < *numMap; i++)
{
- (*map)[i].ilOffset = mapCopy[i].ilOffset;
- (*map)[i].nativeStartOffset = mapCopy[i].nativeOffset;
+ map[i].ilOffset = mapCopy[i].ilOffset;
+ map[i].nativeStartOffset = mapCopy[i].nativeOffset;
if (i > 0)
{
- (*map)[i - 1].nativeEndOffset = (*map)[i].nativeStartOffset;
+ map[i - 1].nativeEndOffset = map[i].nativeStartOffset;
}
- (*map)[i].source = mapCopy[i].source;
+ map[i].source = mapCopy[i].source;
}
if (*numMap >= 1)
{
- (*map)[i - 1].nativeEndOffset = 0;
+ map[i - 1].nativeEndOffset = 0;
}
return S_OK;
}
HRESULT FunctionMember::GetLocalsDebugInfo(NotifyGdb::PTK_TypeInfoMap pTypeMap,
LocalsInfo& locals,
- int startNativeOffset)
+ int startNativeOffset,
+ FunctionMemberPtrArrayHolder &method)
{
ICorDebugInfo::NativeVarInfo* nativeVar = NULL;
@@ -436,7 +386,7 @@ HRESULT FunctionMember::GetLocalsDebugInfo(NotifyGdb::PTK_TypeInfoMap pTypeMap,
{
if (FindNativeInfoInILVariable(i + thisOffs, startNativeOffset, &locals.pVars, locals.countVars, &nativeVar) == S_OK)
{
- vars[i + thisOffs].m_var_type = GetArgTypeInfo(md, pTypeMap, i + 1);
+ vars[i + thisOffs].m_var_type = GetArgTypeInfo(md, pTypeMap, i + 1, method);
GetArgNameByILIndex(md, i + thisOffs, vars[i + thisOffs].m_var_name);
vars[i + thisOffs].m_il_index = i;
vars[i + thisOffs].m_native_offset = nativeVar->loc.vlStk.vlsOffset;
@@ -448,7 +398,10 @@ HRESULT FunctionMember::GetLocalsDebugInfo(NotifyGdb::PTK_TypeInfoMap pTypeMap,
{
if (FindNativeInfoInILVariable(0, startNativeOffset, &locals.pVars, locals.countVars, &nativeVar) == S_OK)
{
- vars[0].m_var_type = GetTypeInfoFromTypeHandle(TypeHandle(md->GetMethodTable()), pTypeMap);
+ TypeHandle th = TypeHandle(md->GetMethodTable());
+ if (th.IsValueType())
+ th = th.MakePointer();
+ vars[0].m_var_type = GetTypeInfoFromTypeHandle(th, pTypeMap, method);
vars[0].m_var_name = new char[strlen("this") + 1];
strcpy(vars[0].m_var_name, "this");
vars[0].m_il_index = 0;
@@ -462,31 +415,84 @@ HRESULT FunctionMember::GetLocalsDebugInfo(NotifyGdb::PTK_TypeInfoMap pTypeMap,
if (FindNativeInfoInILVariable(
i, startNativeOffset, &locals.pVars, locals.countVars, &nativeVar) == S_OK)
{
- vars[i].m_var_type = GetLocalTypeInfo(md, pTypeMap, i - m_num_args);
- vars[i].m_var_name = new char[strlen(locals.localsName[i - m_num_args]) + 1];
- strcpy(vars[i].m_var_name, locals.localsName[i - m_num_args]);
- vars[i].m_il_index = i - m_num_args;
+ int ilIndex = i - m_num_args;
+ vars[i].m_var_type = GetLocalTypeInfo(md, pTypeMap, ilIndex, method);
+ vars[i].m_var_name = new char[strlen(locals.localsName[ilIndex]) + 1];
+ strcpy(vars[i].m_var_name, locals.localsName[ilIndex]);
+ vars[i].m_il_index = ilIndex;
vars[i].m_native_offset = nativeVar->loc.vlStk.vlsOffset;
vars[i].m_var_abbrev = 5;
+ TADDR nativeStart;
+ TADDR nativeEnd;
+ int ilLen = locals.localsScope[ilIndex].ilEndOffset - locals.localsScope[ilIndex].ilStartOffset;
+ if (GetBlockInNativeCode(locals.localsScope[ilIndex].ilStartOffset, ilLen, &nativeStart, &nativeEnd))
+ {
+ vars[i].m_low_pc = md->GetNativeCode() + nativeStart;
+ vars[i].m_high_pc = nativeEnd - nativeStart;
+ }
}
}
return S_OK;
}
+
+MethodDebugInfo::MethodDebugInfo(int numPoints, int numLocals)
+{
+ points = (SequencePointInfo*) CoTaskMemAlloc(sizeof(SequencePointInfo) * numPoints);
+ if (points == nullptr)
+ {
+ COMPlusThrowOM();
+ }
+ memset(points, 0, sizeof(SequencePointInfo) * numPoints);
+ size = numPoints;
+
+ if (numLocals == 0)
+ {
+ locals = nullptr;
+ localsSize = 0;
+ return;
+ }
+
+ locals = (LocalVarInfo*) CoTaskMemAlloc(sizeof(LocalVarInfo) * numLocals);
+ if (locals == nullptr)
+ {
+ CoTaskMemFree(points);
+ COMPlusThrowOM();
+ }
+ memset(locals, 0, sizeof(LocalVarInfo) * numLocals);
+ localsSize = numLocals;
+}
+
+MethodDebugInfo::~MethodDebugInfo()
+{
+ if (locals)
+ {
+ for (int i = 0; i < localsSize; i++)
+ CoTaskMemFree(locals[i].name);
+ CoTaskMemFree(locals);
+ }
+
+ for (int i = 0; i < size; i++)
+ CoTaskMemFree(points[i].fileName);
+ CoTaskMemFree(points);
+}
+
/* Get mapping of IL offsets to source line numbers */
HRESULT
-GetDebugInfoFromPDB(MethodDesc* MethodDescPtr, SymbolsInfo** symInfo, unsigned int &symInfoLen, LocalsInfo &locals)
+GetDebugInfoFromPDB(MethodDesc* methodDescPtr,
+ NewArrayHolder<SymbolsInfo> &symInfo,
+ unsigned int &symInfoLen,
+ LocalsInfo &locals)
{
- DebuggerILToNativeMap* map = NULL;
-
+ NewArrayHolder<DebuggerILToNativeMap> map;
ULONG32 numMap;
if (!getInfoForMethodDelegate)
return E_FAIL;
-
- if (GetMethodNativeMap(MethodDescPtr, &numMap, &map, &locals.countVars, &locals.pVars) != S_OK)
+
+ if (GetMethodNativeMap(methodDescPtr, &numMap, map, &locals.countVars, &locals.pVars) != S_OK)
return E_FAIL;
- const Module* mod = MethodDescPtr->GetMethodTable()->GetModule();
+ const Module* mod = methodDescPtr->GetMethodTable()->GetModule();
SString modName = mod->GetFile()->GetPath();
if (modName.IsEmpty())
return E_FAIL;
@@ -494,45 +500,39 @@ GetDebugInfoFromPDB(MethodDesc* MethodDescPtr, SymbolsInfo** symInfo, unsigned i
StackScratchBuffer scratch;
const char* szModName = modName.GetUTF8(scratch);
- MethodDebugInfo methodDebugInfo;
-
- methodDebugInfo.points = (SequencePointInfo*) CoTaskMemAlloc(sizeof(SequencePointInfo) * numMap);
- if (methodDebugInfo.points == nullptr)
- return E_OUTOFMEMORY;
+ MethodDebugInfo methodDebugInfo(numMap, locals.countVars);
- methodDebugInfo.size = numMap;
-
- if (getInfoForMethodDelegate(szModName, MethodDescPtr->GetMemberDef(), methodDebugInfo) == FALSE)
+ if (getInfoForMethodDelegate(szModName, methodDescPtr->GetMemberDef(), methodDebugInfo) == FALSE)
return E_FAIL;
symInfoLen = numMap;
- *symInfo = new (nothrow) SymbolsInfo[numMap];
- if (*symInfo == nullptr)
- return E_FAIL;
+ symInfo = new SymbolsInfo[numMap];
+
locals.size = methodDebugInfo.localsSize;
- locals.localsName = new (nothrow) char *[locals.size];
- if (locals.localsName == nullptr)
- return E_FAIL;
+ locals.localsName = new NewArrayHolder<char>[locals.size];
+ locals.localsScope = new LocalsInfo::Scope [locals.size];
for (ULONG32 i = 0; i < locals.size; i++)
{
- size_t sizeRequired = WideCharToMultiByte(CP_UTF8, 0, methodDebugInfo.locals[i], -1, NULL, 0, NULL, NULL);
- locals.localsName[i] = new (nothrow) char[sizeRequired];
+ size_t sizeRequired = WideCharToMultiByte(CP_UTF8, 0, methodDebugInfo.locals[i].name, -1, NULL, 0, NULL, NULL);
+ locals.localsName[i] = new char[sizeRequired];
int len = WideCharToMultiByte(
- CP_UTF8, 0, methodDebugInfo.locals[i], -1, locals.localsName[i], sizeRequired, NULL, NULL);
+ CP_UTF8, 0, methodDebugInfo.locals[i].name, -1, locals.localsName[i], sizeRequired, NULL, NULL);
+ locals.localsScope[i].ilStartOffset = methodDebugInfo.locals[i].startOffset;
+ locals.localsScope[i].ilEndOffset = methodDebugInfo.locals[i].endOffset;
}
for (ULONG32 j = 0; j < numMap; j++)
{
- SymbolsInfo& s = (*symInfo)[j];
+ SymbolsInfo& s = symInfo[j];
if (j == 0) {
s.fileName[0] = 0;
s.lineNumber = 0;
s.fileIndex = 0;
} else {
- s = (*symInfo)[j - 1];
+ s = symInfo[j - 1];
}
s.nativeOffset = map[j].nativeStartOffset;
s.ilOffset = map[j].ilOffset;
@@ -554,7 +554,6 @@ GetDebugInfoFromPDB(MethodDesc* MethodDescPtr, SymbolsInfo** symInfo, unsigned i
}
}
- CoTaskMemFree(methodDebugInfo.points);
return S_OK;
}
@@ -767,6 +766,10 @@ const unsigned char AbbrevTable[] = {
19, DW_TAG_subrange_type, DW_CHILDREN_no,
DW_AT_upper_bound, DW_FORM_udata, 0, 0,
+ 20, DW_TAG_lexical_block, DW_CHILDREN_yes,
+ DW_AT_low_pc, DW_FORM_addr, DW_AT_high_pc, DW_FORM_size,
+ 0, 0,
+
0
};
@@ -816,59 +819,31 @@ struct __attribute__((packed)) DebugInfoSubMember
uint32_t m_obj_ptr;
};
+struct __attribute__((packed)) DebugInfoLexicalBlock
+{
+ uint8_t m_abbrev;
+ uintptr_t m_low_pc, m_high_pc;
+};
+
// Holder for array of pointers to FunctionMember objects
-class FunctionMemberPtrArrayHolder : public NewArrayHolder<FunctionMember*>
+class FunctionMemberPtrArrayHolder : public NewArrayHolder<NewHolder<FunctionMember>>
{
private:
int m_cElements;
- void DeleteElements()
- {
- for (int i = 0; i < m_cElements; i++)
- {
- delete this->m_value[i];
- }
- }
-
public:
- FunctionMemberPtrArrayHolder() :
- NewArrayHolder<FunctionMember*>(),
- m_cElements(0)
+ explicit FunctionMemberPtrArrayHolder(int cElements) :
+ NewArrayHolder<NewHolder<FunctionMember>>(new NewHolder<FunctionMember>[cElements]),
+ m_cElements(cElements)
{
}
- bool Alloc(int cElements)
- {
- FunctionMember** value = new (nothrow) FunctionMember*[cElements];
- if (value == nullptr)
- return false;
-
- for (int i = 0; i < cElements; i++)
- {
- value[i] = nullptr;
- }
-
- // Clean previous elements
- DeleteElements();
-
- NewArrayHolder<FunctionMember*>::operator=(value);
- m_cElements = cElements;
- return true;
- }
-
int GetCount() const
{
return m_cElements;
}
-
- ~FunctionMemberPtrArrayHolder()
- {
- DeleteElements();
- }
};
-static FunctionMemberPtrArrayHolder method;
-
struct __attribute__((packed)) DebugInfoType
{
uint8_t m_type_abbrev;
@@ -1046,33 +1021,44 @@ static const char *GetCSharpTypeName(TypeInfoBase *typeInfo)
}
}
-void ByteTypeInfo::DumpStrings(char* ptr, int& offset)
+PrimitiveTypeInfo::PrimitiveTypeInfo(TypeHandle typeHandle)
+ : TypeInfoBase(typeHandle),
+ m_typedef_info(new TypeDefInfo(nullptr, 0))
+{
+ CorElementType corType = typeHandle.GetSignatureCorElementType();
+ m_type_encoding = CorElementTypeToDWEncoding[corType];
+ m_type_size = CorTypeInfo::Size(corType);
+
+ if (corType == ELEMENT_TYPE_CHAR)
+ {
+ m_type_name = new char[9];
+ strcpy(m_type_name, "char16_t");
+ }
+ else
+ {
+ CalculateName();
+ }
+}
+
+void PrimitiveTypeInfo::DumpStrings(char* ptr, int& offset)
{
- PrimitiveTypeInfo::DumpStrings(ptr, offset);
+ TypeInfoBase::DumpStrings(ptr, offset);
if (!m_typedef_info->m_typedef_name)
{
const char *typeName = GetCSharpTypeName(this);
- m_typedef_info->m_typedef_name = new (nothrow) char[strlen(typeName) + 1];
+ m_typedef_info->m_typedef_name = new char[strlen(typeName) + 1];
strcpy(m_typedef_info->m_typedef_name, typeName);
}
m_typedef_info->DumpStrings(ptr, offset);
}
-void ByteTypeInfo::DumpDebugInfo(char *ptr, int &offset)
-{
- m_typedef_info->DumpDebugInfo(ptr, offset);
- PrimitiveTypeInfo::DumpDebugInfo(ptr, offset);
- // Replace offset from real type to typedef
- if (ptr != nullptr)
- m_type_offset = m_typedef_info->m_typedef_type_offset;
-}
-
-void PrimitiveTypeInfo::DumpDebugInfo(char* ptr, int& offset)
+void PrimitiveTypeInfo::DumpDebugInfo(char *ptr, int &offset)
{
if (m_type_offset != 0)
{
return;
}
+ m_typedef_info->DumpDebugInfo(ptr, offset);
if (ptr != nullptr)
{
@@ -1089,22 +1075,37 @@ void PrimitiveTypeInfo::DumpDebugInfo(char* ptr, int& offset)
}
offset += sizeof(DebugInfoType);
+ // Replace offset from real type to typedef
+ if (ptr != nullptr)
+ m_type_offset = m_typedef_info->m_typedef_type_offset;
}
-ClassTypeInfo::ClassTypeInfo(TypeHandle typeHandle, int num_members)
+ClassTypeInfo::ClassTypeInfo(TypeHandle typeHandle, int num_members, FunctionMemberPtrArrayHolder &method)
: TypeInfoBase(typeHandle),
m_num_members(num_members),
members(new TypeMember[num_members]),
- m_parent(nullptr)
+ m_parent(nullptr),
+ m_method(method),
+ m_array_type(nullptr)
{
-}
+ CorElementType corType = typeHandle.GetSignatureCorElementType();
+ PTR_MethodTable pMT = typeHandle.GetMethodTable();
-ClassTypeInfo::~ClassTypeInfo()
-{
- if (members != nullptr && m_num_members > 0)
+ switch (corType)
{
- delete[] members;
+ case ELEMENT_TYPE_VALUETYPE:
+ case ELEMENT_TYPE_CLASS:
+ m_type_size = pMT->IsValueType() ? typeHandle.GetSize() : typeHandle.AsMethodTable()->GetClass()->GetSize();
+ break;
+ case ELEMENT_TYPE_ARRAY:
+ case ELEMENT_TYPE_SZARRAY:
+ m_type_size = pMT->GetClass()->GetSize();
+ break;
+ default:
+ m_type_size = 0;
}
+
+ CalculateName();
}
void TypeMember::DumpStrings(char* ptr, int& offset)
@@ -1357,6 +1358,68 @@ void FunctionMember::DumpTryCatchDebugInfo(char* ptr, int& offset)
}
}
+void FunctionMember::DumpVarsWithScopes(char *ptr, int &offset)
+{
+ NewArrayHolder<DebugInfoLexicalBlock> scopeStack = new DebugInfoLexicalBlock[m_num_vars];
+
+ int scopeStackSize = 0;
+ for (int i = 0; i < m_num_vars; ++i)
+ {
+ if (vars[i].m_high_pc == 0) // no scope info
+ {
+ vars[i].DumpDebugInfo(ptr, offset);
+ continue;
+ }
+
+ // Try to step out to enclosing scope, finilizing scopes on the way
+ while (scopeStackSize > 0 &&
+ vars[i].m_low_pc >= (scopeStack[scopeStackSize - 1].m_low_pc +
+ scopeStack[scopeStackSize - 1].m_high_pc))
+ {
+ // Finalize scope
+ if (ptr != nullptr)
+ {
+ memset(ptr + offset, 0, 1);
+ }
+ offset += 1;
+
+ scopeStackSize--;
+ }
+ // Continue adding to prev scope?
+ if (scopeStackSize > 0 &&
+ scopeStack[scopeStackSize - 1].m_low_pc == vars[i].m_low_pc &&
+ scopeStack[scopeStackSize - 1].m_high_pc == vars[i].m_high_pc)
+ {
+ vars[i].DumpDebugInfo(ptr, offset);
+ continue;
+ }
+ // Start new scope
+ scopeStackSize++;
+ scopeStack[scopeStackSize - 1].m_abbrev = 20;
+ scopeStack[scopeStackSize - 1].m_low_pc = vars[i].m_low_pc;
+ scopeStack[scopeStackSize - 1].m_high_pc = vars[i].m_high_pc;
+
+ if (ptr != nullptr)
+ {
+ memcpy(ptr + offset, scopeStack + (scopeStackSize - 1), sizeof(DebugInfoLexicalBlock));
+ }
+ offset += sizeof(DebugInfoLexicalBlock);
+
+ vars[i].DumpDebugInfo(ptr, offset);
+ }
+ // Finalize any remaining scopes
+ while (scopeStackSize > 0)
+ {
+ if (ptr != nullptr)
+ {
+ memset(ptr + offset, 0, 1);
+ }
+ offset += 1;
+
+ scopeStackSize--;
+ }
+}
+
void FunctionMember::DumpDebugInfo(char* ptr, int& offset)
{
if (ptr != nullptr)
@@ -1398,10 +1461,8 @@ void FunctionMember::DumpDebugInfo(char* ptr, int& offset)
{
offset += sizeof(DebugInfoSub);
}
- for (int i = 0; i < m_num_vars; ++i)
- {
- vars[i].DumpDebugInfo(ptr, offset);
- }
+
+ DumpVarsWithScopes(ptr, offset);
DumpTryCatchDebugInfo(ptr, offset);
@@ -1547,12 +1608,12 @@ void ClassTypeInfo::DumpDebugInfo(char* ptr, int& offset)
members[i].DumpDebugInfo(ptr, offset);
}
- for (int i = 0; i < method.GetCount(); ++i)
+ for (int i = 0; i < m_method.GetCount(); ++i)
{
- if (method[i]->md->GetMethodTable() == GetTypeHandle().GetMethodTable())
+ if (m_method[i]->md->GetMethodTable() == GetTypeHandle().GetMethodTable())
{
// our method is part of this class, we should dump it now before terminating members
- method[i]->DumpDebugInfo(ptr, offset);
+ m_method[i]->DumpDebugInfo(ptr, offset);
}
}
@@ -1660,13 +1721,8 @@ struct Elf_Symbol {
int m_off;
TADDR m_value;
int m_section, m_size;
- bool m_releaseName;
- Elf_Symbol() : m_name(nullptr), m_off(0), m_value(0), m_section(0), m_size(0), m_releaseName(false) {}
- ~Elf_Symbol()
- {
- if (m_releaseName)
- delete [] m_name;
- }
+ NewArrayHolder<char> m_symbol_name;
+ Elf_Symbol() : m_name(nullptr), m_off(0), m_value(0), m_section(0), m_size(0) {}
};
static int countFuncs(const SymbolsInfo *lines, int nlines)
@@ -1692,14 +1748,27 @@ static int getNextPrologueIndex(int from, const SymbolsInfo *lines, int nlines)
return -1;
}
-int SymbolCount = 0;
-NewArrayHolder<Elf_Symbol> SymbolNames;
-NotifyGdb::AddrSet codeAddrs;
+static NotifyGdb::AddrSet codeAddrs;
/* Create ELF/DWARF debug info for jitted method */
-void NotifyGdb::MethodCompiled(MethodDesc* MethodDescPtr)
+void NotifyGdb::MethodCompiled(MethodDesc* methodDescPtr)
{
- PCODE pCode = MethodDescPtr->GetNativeCode();
+ EX_TRY
+ {
+ NotifyGdb::OnMethodCompiled(methodDescPtr);
+ }
+ EX_CATCH
+ {
+ }
+ EX_END_CATCH(SwallowAllExceptions);
+}
+
+void NotifyGdb::OnMethodCompiled(MethodDesc* methodDescPtr)
+{
+ int symbolCount = 0;
+ NewArrayHolder<Elf_Symbol> symbolNames;
+
+ PCODE pCode = methodDescPtr->GetNativeCode();
if (pCode == NULL)
return;
unsigned int symInfoLen = 0;
@@ -1707,14 +1776,14 @@ void NotifyGdb::MethodCompiled(MethodDesc* MethodDescPtr)
LocalsInfo locals;
/* Get method name & size of jitted code */
- LPCUTF8 methodName = MethodDescPtr->GetName();
+ LPCUTF8 methodName = methodDescPtr->GetName();
EECodeInfo codeInfo(pCode);
TADDR codeSize = codeInfo.GetCodeManager()->GetFunctionSize(codeInfo.GetGCInfoToken());
pCode = PCODEToPINSTR(pCode);
/* Get module name */
- const Module* mod = MethodDescPtr->GetMethodTable()->GetModule();
+ const Module* mod = methodDescPtr->GetMethodTable()->GetModule();
SString modName = mod->GetFile()->GetPath();
StackScratchBuffer scratch;
const char* szModName = modName.GetUTF8(scratch);
@@ -1725,7 +1794,7 @@ void NotifyGdb::MethodCompiled(MethodDesc* MethodDescPtr)
int length = MultiByteToWideChar(CP_UTF8, 0, szModuleFile, -1, NULL, 0);
if (length == 0)
return;
- NewArrayHolder<WCHAR> wszModuleFile = new (nothrow) WCHAR[length+1];
+ NewArrayHolder<WCHAR> wszModuleFile = new WCHAR[length+1];
length = MultiByteToWideChar(CP_UTF8, 0, szModuleFile, -1, wszModuleFile, length);
if (length == 0)
@@ -1787,33 +1856,26 @@ void NotifyGdb::MethodCompiled(MethodDesc* MethodDescPtr)
NewHolder<TK_TypeInfoMap> pTypeMap = new TK_TypeInfoMap();
- if (pTypeMap == nullptr)
- {
- return;
- }
-
/* Get debug info for method from portable PDB */
- HRESULT hr = GetDebugInfoFromPDB(MethodDescPtr, &symInfo, symInfoLen, locals);
+ HRESULT hr = GetDebugInfoFromPDB(methodDescPtr, symInfo, symInfoLen, locals);
if (FAILED(hr) || symInfoLen == 0)
{
return;
}
int method_count = countFuncs(symInfo, symInfoLen);
- if (!method.Alloc(method_count)) {
- return;
- }
+ FunctionMemberPtrArrayHolder method(method_count);
CodeHeader* pCH = (CodeHeader*)pCode - 1;
CalledMethod* pCalledMethods = reinterpret_cast<CalledMethod*>(pCH->GetCalledMethods());
/* Collect addresses of thunks called by method */
- if (!CollectCalledMethods(pCalledMethods, (TADDR)MethodDescPtr->GetNativeCode()))
+ if (!CollectCalledMethods(pCalledMethods, (TADDR)methodDescPtr->GetNativeCode(), method, symbolNames, symbolCount))
{
return;
}
pCH->SetCalledMethods(NULL);
- MetaSig sig(MethodDescPtr);
+ MetaSig sig(methodDescPtr);
int nArgsCount = sig.NumFixedArgs();
if (sig.HasThis())
nArgsCount++;
@@ -1832,7 +1894,7 @@ void NotifyGdb::MethodCompiled(MethodDesc* MethodDescPtr)
for (int method_index = 0; method_index < method.GetCount(); ++method_index)
{
- method[method_index] = new FunctionMember(MethodDescPtr, locals.size, nArgsCount);
+ method[method_index] = new FunctionMember(methodDescPtr, locals.size, nArgsCount);
int end_index = getNextPrologueIndex(start_index + 1, symInfo, symInfoLen);
@@ -1840,10 +1902,12 @@ void NotifyGdb::MethodCompiled(MethodDesc* MethodDescPtr)
TADDR method_size = end_index == -1 ? codeSize - method_start : symInfo[end_index].nativeOffset - method_start;
// method return type
- method[method_index]->m_member_type = GetArgTypeInfo(MethodDescPtr, pTypeMap, 0);
- method[method_index]->GetLocalsDebugInfo(pTypeMap, locals, symInfo[firstLineIndex].nativeOffset);
+ method[method_index]->m_member_type = GetArgTypeInfo(methodDescPtr, pTypeMap, 0, method);
method[method_index]->m_sub_low_pc = pCode + method_start;
method[method_index]->m_sub_high_pc = method_size;
+ method[method_index]->lines = symInfo;
+ method[method_index]->nlines = symInfoLen;
+ method[method_index]->GetLocalsDebugInfo(pTypeMap, locals, symInfo[firstLineIndex].nativeOffset, method);
size_t methodNameSize = strlen(methodName) + 10;
method[method_index]->m_member_name = new char[methodNameSize];
if (method_index == 0)
@@ -1852,7 +1916,7 @@ void NotifyGdb::MethodCompiled(MethodDesc* MethodDescPtr)
sprintf_s(method[method_index]->m_member_name, methodNameSize, "%s_%i", methodName, method_index);
// method's class
- GetTypeInfoFromTypeHandle(TypeHandle(method[method_index]->md->GetMethodTable()), pTypeMap);
+ GetTypeInfoFromTypeHandle(TypeHandle(method[method_index]->md->GetMethodTable()), pTypeMap, method);
start_index = end_index;
}
@@ -1875,21 +1939,23 @@ void NotifyGdb::MethodCompiled(MethodDesc* MethodDescPtr)
DebugStrings[1] = szModuleFile;
/* Build .debug_str section */
- if (!BuildDebugStrings(dbgStr, pTypeMap))
+ if (!BuildDebugStrings(dbgStr, pTypeMap, method))
{
return;
}
/* Build .debug_info section */
- if (!BuildDebugInfo(dbgInfo, pTypeMap, symInfo, symInfoLen))
+ if (!BuildDebugInfo(dbgInfo, pTypeMap, method))
{
return;
}
- for (int i = 0; i < locals.size; i++)
+ for (int i = 0; i < method.GetCount(); ++i)
{
- delete[] locals.localsName[i];
+ method[i]->lines = nullptr;
+ method[i]->nlines = 0;
}
+
/* Build .debug_pubname section */
if (!BuildDebugPub(dbgPubname, methodName, dbgInfo.MemSize, 0x28))
{
@@ -1903,29 +1969,26 @@ void NotifyGdb::MethodCompiled(MethodDesc* MethodDescPtr)
}
/* Build .strtab section */
- SymbolNames[0].m_name = "";
+ symbolNames[0].m_name = "";
for (int i = 0; i < method.GetCount(); ++i)
{
- SymbolNames[1 + i].m_name = method[i]->m_member_name;
- SymbolNames[1 + i].m_value = method[i]->m_sub_low_pc;
- SymbolNames[1 + i].m_section = 1;
- SymbolNames[1 + i].m_size = method[i]->m_sub_high_pc;
+ symbolNames[1 + i].m_name = method[i]->m_member_name;
+ symbolNames[1 + i].m_value = method[i]->m_sub_low_pc;
+ symbolNames[1 + i].m_section = 1;
+ symbolNames[1 + i].m_size = method[i]->m_sub_high_pc;
}
- if (!BuildStringTableSection(sectStrTab))
+ if (!BuildStringTableSection(sectStrTab, symbolNames, symbolCount))
{
return;
}
/* Build .symtab section */
- if (!BuildSymbolTableSection(sectSymTab, pCode, codeSize))
+ if (!BuildSymbolTableSection(sectSymTab, pCode, codeSize, method, symbolNames, symbolCount))
{
return;
}
/* Build section headers table and section names table */
- if (!BuildSectionTables(sectHeaders, sectStr))
- {
- return;
- }
+ BuildSectionTables(sectHeaders, sectStr, method, symbolCount);
/* Patch section offsets & sizes */
long offset = sizeof(Elf_Ehdr);
@@ -1972,10 +2035,10 @@ void NotifyGdb::MethodCompiled(MethodDesc* MethodDescPtr)
offset += sectStrTab.MemSize;
// .thunks
- for (int i = 1 + method.GetCount(); i < SymbolCount; i++)
+ for (int i = 1 + method.GetCount(); i < symbolCount; i++)
{
++pShdr;
- pShdr->sh_addr = PCODEToPINSTR(SymbolNames[i].m_value);
+ pShdr->sh_addr = PCODEToPINSTR(symbolNames[i].m_value);
pShdr->sh_size = 8;
}
@@ -1995,7 +2058,7 @@ void NotifyGdb::MethodCompiled(MethodDesc* MethodDescPtr)
#endif
header->e_shoff = offset;
header->e_shentsize = sizeof(Elf_Shdr);
- int thunks_count = SymbolCount - method.GetCount() - 1;
+ int thunks_count = symbolCount - method.GetCount() - 1;
header->e_shnum = SectionNamesCount + thunks_count;
header->e_shstrndx = GetSectionIndex(".shstrtab");
@@ -2003,12 +2066,8 @@ void NotifyGdb::MethodCompiled(MethodDesc* MethodDescPtr)
elfFile.MemSize = elfHeader.MemSize + sectStr.MemSize + dbgStr.MemSize + dbgAbbrev.MemSize + dbgInfo.MemSize +
dbgPubname.MemSize + dbgPubType.MemSize + dbgLine.MemSize + sectSymTab.MemSize +
sectStrTab.MemSize + sectHeaders.MemSize;
- elfFile.MemPtr = new (nothrow) char[elfFile.MemSize];
- if (elfFile.MemPtr == nullptr)
- {
- return;
- }
-
+ elfFile.MemPtr = new char[elfFile.MemSize];
+
/* Copy section data */
offset = 0;
memcpy(elfFile.MemPtr, elfHeader.MemPtr, elfHeader.MemSize);
@@ -2041,13 +2100,8 @@ void NotifyGdb::MethodCompiled(MethodDesc* MethodDescPtr)
#endif
/* Create GDB JIT structures */
- NewHolder<jit_code_entry> jit_symbols = new (nothrow) jit_code_entry;
-
- if (jit_symbols == nullptr)
- {
- return;
- }
-
+ NewHolder<jit_code_entry> jit_symbols = new jit_code_entry;
+
/* Fill the new entry */
jit_symbols->next_entry = jit_symbols->prev_entry = 0;
jit_symbols->symfile_addr = elfFile.MemPtr;
@@ -2070,14 +2124,14 @@ void NotifyGdb::MethodCompiled(MethodDesc* MethodDescPtr)
__jit_debug_register_code();
}
-void NotifyGdb::MethodDropped(MethodDesc* MethodDescPtr)
+void NotifyGdb::MethodDropped(MethodDesc* methodDescPtr)
{
static const int textSectionIndex = GetSectionIndex(".text");
if (textSectionIndex < 0)
return;
- PCODE pCode = MethodDescPtr->GetNativeCode();
+ PCODE pCode = methodDescPtr->GetNativeCode();
if (pCode == NULL)
return;
@@ -2127,13 +2181,8 @@ bool NotifyGdb::BuildLineTable(MemBuf& buf, PCODE startAddr, TADDR codeSize, Sym
}
buf.MemSize = sizeof(DwarfLineNumHeader) + 1 + fileTable.MemSize + lineProg.MemSize;
- buf.MemPtr = new (nothrow) char[buf.MemSize];
-
- if (buf.MemPtr == nullptr)
- {
- return false;
- }
-
+ buf.MemPtr = new char[buf.MemSize];
+
/* Fill the line info header */
DwarfLineNumHeader* header = reinterpret_cast<DwarfLineNumHeader*>(buf.MemPtr.GetValue());
memcpy(buf.MemPtr, &LineNumHeader, sizeof(DwarfLineNumHeader));
@@ -2155,7 +2204,7 @@ bool NotifyGdb::BuildFileTable(MemBuf& buf, SymbolsInfo* lines, unsigned nlines)
unsigned nfiles = 0;
/* GetValue file names and replace them with indices in file table */
- files = new (nothrow) const char*[nlines];
+ files = new const char*[nlines];
if (files == nullptr)
return false;
for (unsigned i = 0; i < nlines; ++i)
@@ -2195,13 +2244,8 @@ bool NotifyGdb::BuildFileTable(MemBuf& buf, SymbolsInfo* lines, unsigned nlines)
totalSize += 1;
buf.MemSize = totalSize;
- buf.MemPtr = new (nothrow) char[buf.MemSize];
-
- if (buf.MemPtr == nullptr)
- {
- return false;
- }
-
+ buf.MemPtr = new char[buf.MemSize];
+
/* copy collected file names */
char *ptr = buf.MemPtr;
for (unsigned i = 0; i < nfiles; ++i)
@@ -2314,7 +2358,7 @@ bool NotifyGdb::BuildLineProg(MemBuf& buf, PCODE startAddr, TADDR codeSize, Symb
+ nlines * 1 /* copy commands */
+ 6 /* advance PC command */
+ 3; /* end of sequence command */
- buf.MemPtr = new (nothrow) char[buf.MemSize];
+ buf.MemPtr = new char[buf.MemSize];
char* ptr = buf.MemPtr;
if (buf.MemPtr == nullptr)
@@ -2372,7 +2416,7 @@ bool NotifyGdb::BuildLineProg(MemBuf& buf, PCODE startAddr, TADDR codeSize, Symb
}
/* Build the DWARF .debug_str section */
-bool NotifyGdb::BuildDebugStrings(MemBuf& buf, PTK_TypeInfoMap pTypeMap)
+bool NotifyGdb::BuildDebugStrings(MemBuf& buf, PTK_TypeInfoMap pTypeMap, FunctionMemberPtrArrayHolder &method)
{
int totalLength = 0;
@@ -2398,10 +2442,7 @@ bool NotifyGdb::BuildDebugStrings(MemBuf& buf, PTK_TypeInfoMap pTypeMap)
}
buf.MemSize = totalLength;
- buf.MemPtr = new (nothrow) char[totalLength];
-
- if (buf.MemPtr == nullptr)
- return false;
+ buf.MemPtr = new char[totalLength];
/* copy strings */
char* bufPtr = buf.MemPtr;
@@ -2433,18 +2474,15 @@ bool NotifyGdb::BuildDebugStrings(MemBuf& buf, PTK_TypeInfoMap pTypeMap)
/* Build the DWARF .debug_abbrev section */
bool NotifyGdb::BuildDebugAbbrev(MemBuf& buf)
{
- buf.MemPtr = new (nothrow) char[AbbrevTableSize];
+ buf.MemPtr = new char[AbbrevTableSize];
buf.MemSize = AbbrevTableSize;
- if (buf.MemPtr == nullptr)
- return false;
-
memcpy(buf.MemPtr, AbbrevTable, AbbrevTableSize);
return true;
}
/* Build tge DWARF .debug_info section */
-bool NotifyGdb::BuildDebugInfo(MemBuf& buf, PTK_TypeInfoMap pTypeMap, SymbolsInfo* lines, unsigned nlines)
+bool NotifyGdb::BuildDebugInfo(MemBuf& buf, PTK_TypeInfoMap pTypeMap, FunctionMemberPtrArrayHolder &method)
{
int totalTypeVarSubSize = 0;
{
@@ -2459,29 +2497,13 @@ bool NotifyGdb::BuildDebugInfo(MemBuf& buf, PTK_TypeInfoMap pTypeMap, SymbolsInf
for (int i = 0; i < method.GetCount(); ++i)
{
- method[i]->lines = lines;
- method[i]->nlines = nlines;
method[i]->DumpDebugInfo(nullptr, totalTypeVarSubSize);
}
- // Drop pointers to lines when exiting current scope
- struct DropMethodLines
- {
- ~DropMethodLines()
- {
- for (int i = 0; i < method.GetCount(); ++i)
- {
- method[i]->lines = nullptr;
- method[i]->nlines = 0;
- }
- }
- } dropMethodLines;
//int locSize = GetArgsAndLocalsLen(argsDebug, argsDebugSize, localsDebug, localsDebugSize);
buf.MemSize = sizeof(DwarfCompUnit) + sizeof(DebugInfoCU) + totalTypeVarSubSize + 2;
- buf.MemPtr = new (nothrow) char[buf.MemSize];
+ buf.MemPtr = new char[buf.MemSize];
- if (buf.MemPtr == nullptr)
- return false;
int offset = 0;
/* Compile uint header */
DwarfCompUnit* cu = reinterpret_cast<DwarfCompUnit*>(buf.MemPtr.GetValue());
@@ -2526,10 +2548,7 @@ bool NotifyGdb::BuildDebugPub(MemBuf& buf, const char* name, uint32_t size, uint
uint32_t length = sizeof(DwarfPubHeader) + sizeof(uint32_t) + strlen(name) + 1 + sizeof(uint32_t);
buf.MemSize = length;
- buf.MemPtr = new (nothrow) char[buf.MemSize];
-
- if (buf.MemPtr == nullptr)
- return false;
+ buf.MemPtr = new char[buf.MemSize];
DwarfPubHeader* header = reinterpret_cast<DwarfPubHeader*>(buf.MemPtr.GetValue());
header->m_length = length - sizeof(uint32_t);
@@ -2544,7 +2563,11 @@ bool NotifyGdb::BuildDebugPub(MemBuf& buf, const char* name, uint32_t size, uint
}
/* Store addresses and names of the called methods into symbol table */
-bool NotifyGdb::CollectCalledMethods(CalledMethod* pCalledMethods, TADDR nativeCode)
+bool NotifyGdb::CollectCalledMethods(CalledMethod* pCalledMethods,
+ TADDR nativeCode,
+ FunctionMemberPtrArrayHolder &method,
+ NewArrayHolder<Elf_Symbol> &symbolNames,
+ int &symbolCount)
{
AddrSet tmpCodeAddrs;
@@ -2563,12 +2586,12 @@ bool NotifyGdb::CollectCalledMethods(CalledMethod* pCalledMethods, TADDR nativeC
pList = pList->GetNext();
}
- SymbolCount = 1 + method.GetCount() + tmpCodeAddrs.GetCount();
- SymbolNames = new (nothrow) Elf_Symbol[SymbolCount];
+ symbolCount = 1 + method.GetCount() + tmpCodeAddrs.GetCount();
+ symbolNames = new Elf_Symbol[symbolCount];
pList = pCalledMethods;
int i = 1 + method.GetCount();
- while (i < SymbolCount && pList != NULL)
+ while (i < symbolCount && pList != NULL)
{
TADDR callAddr = (TADDR)pList->GetCallAddr();
if (!codeAddrs.Contains(callAddr))
@@ -2576,39 +2599,36 @@ bool NotifyGdb::CollectCalledMethods(CalledMethod* pCalledMethods, TADDR nativeC
MethodDesc* pMD = pList->GetMethodDesc();
LPCUTF8 methodName = pMD->GetName();
int symbolNameLength = strlen(methodName) + sizeof("__thunk_");
- SymbolNames[i].m_name = new char[symbolNameLength];
- SymbolNames[i].m_releaseName = true;
- sprintf_s((char*)SymbolNames[i].m_name, symbolNameLength, "__thunk_%s", methodName);
- SymbolNames[i].m_value = callAddr;
+ symbolNames[i].m_symbol_name = new char[symbolNameLength];
+ symbolNames[i].m_name = symbolNames[i].m_symbol_name;
+ sprintf_s((char*)symbolNames[i].m_name, symbolNameLength, "__thunk_%s", methodName);
+ symbolNames[i].m_value = callAddr;
++i;
codeAddrs.Add(callAddr);
}
- CalledMethod* ptr = pList;
pList = pList->GetNext();
- delete ptr;
}
- SymbolCount = i;
+ symbolCount = i;
return true;
}
/* Build ELF .strtab section */
-bool NotifyGdb::BuildStringTableSection(MemBuf& buf)
+bool NotifyGdb::BuildStringTableSection(MemBuf& buf, NewArrayHolder<Elf_Symbol> &symbolNames, int symbolCount)
{
int len = 0;
- for (int i = 0; i < SymbolCount; ++i)
- len += strlen(SymbolNames[i].m_name) + 1;
+ for (int i = 0; i < symbolCount; ++i)
+ len += strlen(symbolNames[i].m_name) + 1;
len++; // end table with zero-length string
buf.MemSize = len;
- buf.MemPtr = new (nothrow) char[buf.MemSize];
- if (buf.MemPtr == nullptr)
- return false;
+ buf.MemPtr = new char[buf.MemSize];
+
char* ptr = buf.MemPtr;
- for (int i = 0; i < SymbolCount; ++i)
+ for (int i = 0; i < symbolCount; ++i)
{
- SymbolNames[i].m_off = ptr - buf.MemPtr;
- strcpy(ptr, SymbolNames[i].m_name);
- ptr += strlen(SymbolNames[i].m_name) + 1;
+ symbolNames[i].m_off = ptr - buf.MemPtr;
+ strcpy(ptr, symbolNames[i].m_name);
+ ptr += strlen(symbolNames[i].m_name) + 1;
}
buf.MemPtr[buf.MemSize-1] = 0;
@@ -2616,14 +2636,13 @@ bool NotifyGdb::BuildStringTableSection(MemBuf& buf)
}
/* Build ELF .symtab section */
-bool NotifyGdb::BuildSymbolTableSection(MemBuf& buf, PCODE addr, TADDR codeSize)
+bool NotifyGdb::BuildSymbolTableSection(MemBuf& buf, PCODE addr, TADDR codeSize, FunctionMemberPtrArrayHolder &method,
+ NewArrayHolder<Elf_Symbol> &symbolNames, int symbolCount)
{
static const int textSectionIndex = GetSectionIndex(".text");
- buf.MemSize = SymbolCount * sizeof(Elf_Sym);
- buf.MemPtr = new (nothrow) char[buf.MemSize];
- if (buf.MemPtr == nullptr)
- return false;
+ buf.MemSize = symbolCount * sizeof(Elf_Sym);
+ buf.MemPtr = new char[buf.MemSize];
Elf_Sym *sym = reinterpret_cast<Elf_Sym*>(buf.MemPtr.GetValue());
@@ -2636,17 +2655,17 @@ bool NotifyGdb::BuildSymbolTableSection(MemBuf& buf, PCODE addr, TADDR codeSize)
for (int i = 1; i < 1 + method.GetCount(); ++i)
{
- sym[i].st_name = SymbolNames[i].m_off;
+ sym[i].st_name = symbolNames[i].m_off;
sym[i].setBindingAndType(STB_GLOBAL, STT_FUNC);
sym[i].st_other = 0;
- sym[i].st_value = PINSTRToPCODE(SymbolNames[i].m_value - addr);
+ sym[i].st_value = PINSTRToPCODE(symbolNames[i].m_value - addr);
sym[i].st_shndx = textSectionIndex;
- sym[i].st_size = SymbolNames[i].m_size;
+ sym[i].st_size = symbolNames[i].m_size;
}
- for (int i = 1 + method.GetCount(); i < SymbolCount; ++i)
+ for (int i = 1 + method.GetCount(); i < symbolCount; ++i)
{
- sym[i].st_name = SymbolNames[i].m_off;
+ sym[i].st_name = symbolNames[i].m_off;
sym[i].setBindingAndType(STB_GLOBAL, STT_FUNC);
sym[i].st_other = 0;
sym[i].st_shndx = SectionNamesCount + (i - (1 + method.GetCount())); // .thunks section index
@@ -2669,28 +2688,21 @@ int NotifyGdb::GetSectionIndex(const char *sectName)
}
/* Build the ELF section headers table and section names table */
-bool NotifyGdb::BuildSectionTables(MemBuf& sectBuf, MemBuf& strBuf)
+void NotifyGdb::BuildSectionTables(MemBuf& sectBuf, MemBuf& strBuf, FunctionMemberPtrArrayHolder &method,
+ int symbolCount)
{
static const int symtabSectionIndex = GetSectionIndex(".symtab");
static const int nullSectionIndex = GetSectionIndex("");
- const int thunks_count = SymbolCount - 1 - method.GetCount();
+ const int thunks_count = symbolCount - 1 - method.GetCount();
// Approximate length of single section name.
// Used only to reduce memory reallocations.
static const int SECT_NAME_LENGTH = 11;
- if (!strBuf.Resize(SECT_NAME_LENGTH * (SectionNamesCount + thunks_count)))
- {
- return false;
- }
-
- Elf_Shdr* sectionHeaders = new (nothrow) Elf_Shdr[SectionNamesCount + thunks_count];
- if (sectionHeaders == nullptr)
- {
- return false;
- }
+ strBuf.Resize(SECT_NAME_LENGTH * (SectionNamesCount + thunks_count));
+ Elf_Shdr* sectionHeaders = new Elf_Shdr[SectionNamesCount + thunks_count];
sectBuf.MemPtr = reinterpret_cast<char*>(sectionHeaders);
sectBuf.MemSize = sizeof(Elf_Shdr) * (SectionNamesCount + thunks_count);
@@ -2725,8 +2737,7 @@ bool NotifyGdb::BuildSectionTables(MemBuf& sectBuf, MemBuf& strBuf)
if (sectNameOffset > strBuf.MemSize)
{
// Allocate more memory for remaining section names
- if (!strBuf.Resize(sectNameOffset + addSize))
- return false;
+ strBuf.Resize(sectNameOffset + addSize);
addSize *= 2;
}
@@ -2748,19 +2759,12 @@ bool NotifyGdb::BuildSectionTables(MemBuf& sectBuf, MemBuf& strBuf)
// Set actual used size to avoid garbage in ELF section
strBuf.MemSize = sectNameOffset;
- return true;
}
/* Build the ELF header */
bool NotifyGdb::BuildELFHeader(MemBuf& buf)
{
- Elf_Ehdr* header = new (nothrow) Elf_Ehdr;
-
- if (header == nullptr)
- {
- return false;
- }
-
+ Elf_Ehdr* header = new Elf_Ehdr;
buf.MemPtr = reinterpret_cast<char*>(header);
buf.MemSize = sizeof(Elf_Ehdr);
return true;
diff --git a/src/vm/gdbjit.h b/src/vm/gdbjit.h
index 8dfbe14502..84b910932c 100644
--- a/src/vm/gdbjit.h
+++ b/src/vm/gdbjit.h
@@ -123,13 +123,20 @@ public:
virtual void DumpStrings(char* ptr, int& offset) = 0;
virtual void DumpDebugInfo(char* ptr, int& offset) = 0;
+
+ virtual ~DwarfDumpable() {}
};
-class LocalsInfo
+class LocalsInfo
{
public:
+ struct Scope {
+ int ilStartOffset;
+ int ilEndOffset;
+ };
int size;
- char** localsName;
+ NewArrayHolder< NewArrayHolder<char> > localsName;
+ NewArrayHolder<Scope> localsScope;
ULONG32 countVars;
ICorDebugInfo::NativeVarInfo *pVars;
};
@@ -149,21 +156,13 @@ public:
{
}
- virtual ~TypeInfoBase()
- {
- if (m_type_name != nullptr)
- {
- delete[] m_type_name;
- }
- }
-
virtual void DumpStrings(char* ptr, int& offset) override;
void CalculateName();
void SetTypeHandle(TypeHandle handle);
TypeHandle GetTypeHandle();
TypeKey* GetTypeKey();
- char* m_type_name;
+ NewArrayHolder<char> m_type_name;
int m_type_name_offset;
ULONG m_type_size;
int m_type_offset;
@@ -172,20 +171,6 @@ private:
TypeKey typeKey;
};
-class PrimitiveTypeInfo: public TypeInfoBase
-{
-public:
- PrimitiveTypeInfo(TypeHandle typeHandle, int encoding)
- : TypeInfoBase(typeHandle),
- m_type_encoding(encoding)
- {
- }
-
- void DumpDebugInfo(char* ptr, int& offset) override;
-
- int m_type_encoding;
-};
-
class TypeDefInfo : public DwarfDumpable
{
public:
@@ -193,34 +178,23 @@ public:
m_typedef_name(typedef_name), m_typedef_type(typedef_type), m_typedef_type_offset(0) {}
void DumpStrings(char* ptr, int& offset) override;
void DumpDebugInfo(char* ptr, int& offset) override;
- virtual ~TypeDefInfo()
- {
- if (m_typedef_name != nullptr)
- {
- delete [] m_typedef_name;
- }
- }
- char *m_typedef_name;
+
+ NewArrayHolder<char> m_typedef_name;
int m_typedef_type;
int m_typedef_type_offset;
int m_typedef_name_offset;
};
-class ByteTypeInfo : public PrimitiveTypeInfo
+class PrimitiveTypeInfo: public TypeInfoBase
{
public:
- ByteTypeInfo(TypeHandle typeHandle, int encoding) : PrimitiveTypeInfo(typeHandle, encoding)
- {
- m_typedef_info = new (nothrow) TypeDefInfo(nullptr, 0);
- }
- virtual ~ByteTypeInfo()
- {
- delete m_typedef_info;
- }
+ PrimitiveTypeInfo(TypeHandle typeHandle);
+
void DumpDebugInfo(char* ptr, int& offset) override;
void DumpStrings(char* ptr, int& offset) override;
- TypeDefInfo* m_typedef_info;
+ int m_type_encoding;
+ NewHolder<TypeDefInfo> m_typedef_info;
};
class RefTypeInfo: public TypeInfoBase
@@ -230,6 +204,8 @@ public:
: TypeInfoBase(typeHandle),
m_value_type(value_type)
{
+ m_type_size = sizeof(TADDR);
+ CalculateName();
}
void DumpStrings(char* ptr, int& offset) override;
void DumpDebugInfo(char* ptr, int& offset) override;
@@ -240,24 +216,32 @@ class NamedRefTypeInfo: public RefTypeInfo
{
public:
NamedRefTypeInfo(TypeHandle typeHandle, TypeInfoBase *value_type)
- : RefTypeInfo(typeHandle, value_type)
+ : RefTypeInfo(typeHandle, value_type), m_value_type_storage(value_type)
{
}
+
void DumpDebugInfo(char* ptr, int& offset) override;
+
+ NewHolder<TypeInfoBase> m_value_type_storage;
};
+class FunctionMemberPtrArrayHolder;
+class ArrayTypeInfo;
+
class ClassTypeInfo: public TypeInfoBase
{
public:
- ClassTypeInfo(TypeHandle typeHandle, int num_members);
- ~ClassTypeInfo();
+ ClassTypeInfo(TypeHandle typeHandle, int num_members, FunctionMemberPtrArrayHolder &method);
void DumpStrings(char* ptr, int& offset) override;
void DumpDebugInfo(char* ptr, int& offset) override;
int m_num_members;
- TypeMember* members;
+ NewArrayHolder<TypeMember> members;
TypeInfoBase* m_parent;
+ FunctionMemberPtrArrayHolder &m_method;
+ NewHolder<ArrayTypeInfo> m_array_type;
+ NewHolder<ArrayTypeInfo> m_array_bounds_type;
};
class TypeMember: public DwarfDumpable
@@ -272,19 +256,11 @@ public:
{
}
- ~TypeMember()
- {
- if (m_member_name != nullptr)
- {
- delete[] m_member_name;
- }
- }
-
void DumpStrings(char* ptr, int& offset) override;
void DumpDebugInfo(char* ptr, int& offset) override;
void DumpStaticDebugInfo(char* ptr, int& offset);
- char* m_member_name;
+ NewArrayHolder<char> m_member_name;
int m_member_name_offset;
int m_member_offset;
TADDR m_static_member_address;
@@ -301,14 +277,6 @@ public:
{
}
- ~ArrayTypeInfo()
- {
- if (m_elem_type != nullptr)
- {
- delete m_elem_type;
- }
- }
-
void DumpDebugInfo(char* ptr, int& offset) override;
int m_count;
@@ -324,7 +292,9 @@ public:
m_var_name_offset(0),
m_il_index(0),
m_native_offset(0),
- m_var_type(nullptr)
+ m_var_type(nullptr),
+ m_low_pc(0),
+ m_high_pc(0)
{
}
@@ -334,31 +304,32 @@ public:
m_var_name_offset(0),
m_il_index(0),
m_native_offset(0),
- m_var_type(nullptr)
+ m_var_type(nullptr),
+ m_low_pc(0),
+ m_high_pc(0)
{
}
- virtual ~VarDebugInfo()
- {
- delete[] m_var_name;
- }
-
void DumpStrings(char* ptr, int& offset) override;
void DumpDebugInfo(char* ptr, int& offset) override;
- char* m_var_name;
+ NewArrayHolder<char> m_var_name;
int m_var_abbrev;
int m_var_name_offset;
int m_il_index;
int m_native_offset;
TypeInfoBase *m_var_type;
+ uintptr_t m_low_pc;
+ uintptr_t m_high_pc;
};
+struct Elf_Symbol;
+
class NotifyGdb
{
public:
- static void MethodCompiled(MethodDesc* MethodDescPtr);
- static void MethodDropped(MethodDesc* MethodDescPtr);
+ static void MethodCompiled(MethodDesc* methodDescPtr);
+ static void MethodDropped(MethodDesc* methodDescPtr);
template <typename PARENT_TRAITS>
class DeleteValuesOnDestructSHashTraits : public PARENT_TRAITS
{
@@ -416,32 +387,33 @@ private:
unsigned MemSize;
MemBuf() : MemPtr(0), MemSize(0)
{}
- bool Resize(unsigned newSize)
+ void Resize(unsigned newSize)
{
if (newSize == 0)
{
MemPtr = nullptr;
MemSize = 0;
- return true;
+ return;
}
- char *tmp = new (nothrow) char [newSize];
- if (tmp == nullptr)
- return false;
+ char *tmp = new char [newSize];
memmove(tmp, MemPtr.GetValue(), newSize < MemSize ? newSize : MemSize);
MemPtr = tmp;
MemSize = newSize;
- return true;
}
};
+ static void OnMethodCompiled(MethodDesc* methodDescPtr);
+
static int GetSectionIndex(const char *sectName);
static bool BuildELFHeader(MemBuf& buf);
- static bool BuildSectionTables(MemBuf& sectBuf, MemBuf& strBuf);
- static bool BuildSymbolTableSection(MemBuf& buf, PCODE addr, TADDR codeSize);
- static bool BuildStringTableSection(MemBuf& strTab);
- static bool BuildDebugStrings(MemBuf& buf, PTK_TypeInfoMap pTypeMap);
+ static void BuildSectionTables(MemBuf& sectBuf, MemBuf& strBuf, FunctionMemberPtrArrayHolder &method,
+ int symbolCount);
+ static bool BuildSymbolTableSection(MemBuf& buf, PCODE addr, TADDR codeSize, FunctionMemberPtrArrayHolder &method,
+ NewArrayHolder<Elf_Symbol> &symbolNames, int symbolCount);
+ static bool BuildStringTableSection(MemBuf& strTab, NewArrayHolder<Elf_Symbol> &symbolNames, int symbolCount);
+ static bool BuildDebugStrings(MemBuf& buf, PTK_TypeInfoMap pTypeMap, FunctionMemberPtrArrayHolder &method);
static bool BuildDebugAbbrev(MemBuf& buf);
- static bool BuildDebugInfo(MemBuf& buf, PTK_TypeInfoMap pTypeMap, SymbolsInfo* lines, unsigned nlines);
+ static bool BuildDebugInfo(MemBuf& buf, PTK_TypeInfoMap pTypeMap, FunctionMemberPtrArrayHolder &method);
static bool BuildDebugPub(MemBuf& buf, const char* name, uint32_t size, uint32_t dieOffset);
static bool BuildLineTable(MemBuf& buf, PCODE startAddr, TADDR codeSize, SymbolsInfo* lines, unsigned nlines);
static bool BuildFileTable(MemBuf& buf, SymbolsInfo* lines, unsigned nlines);
@@ -451,7 +423,8 @@ private:
static void IssueSimpleCommand(char*& ptr, uint8_t command);
static void IssueParamCommand(char*& ptr, uint8_t command, char* param, int param_len);
static void SplitPathname(const char* path, const char*& pathName, const char*& fileName);
- static bool CollectCalledMethods(CalledMethod* pCM, TADDR nativeCode);
+ static bool CollectCalledMethods(CalledMethod* pCM, TADDR nativeCode, FunctionMemberPtrArrayHolder &method,
+ NewArrayHolder<Elf_Symbol> &symbolNames, int &symbolCount);
#ifdef _DEBUG
static void DumpElf(const char* methodName, const MemBuf& buf);
#endif
@@ -492,17 +465,13 @@ public:
#endif
}
- virtual ~FunctionMember()
- {
- delete[] vars;
- }
-
void DumpStrings(char* ptr, int& offset) override;
void DumpDebugInfo(char* ptr, int& offset) override;
void DumpTryCatchDebugInfo(char* ptr, int& offset);
HRESULT GetLocalsDebugInfo(NotifyGdb::PTK_TypeInfoMap pTypeMap,
LocalsInfo& locals,
- int startNativeOffset);
+ int startNativeOffset,
+ FunctionMemberPtrArrayHolder &method);
BOOL IsDumped()
{
return dumped;
@@ -516,7 +485,7 @@ public:
uint8_t m_num_locals;
uint16_t m_num_vars;
int m_entry_offset;
- VarDebugInfo* vars;
+ NewArrayHolder<VarDebugInfo> vars;
SymbolsInfo* lines;
unsigned nlines;
int m_linkage_name_offset;
@@ -527,6 +496,7 @@ private:
void DumpLinkageName(char* ptr, int& offset);
bool GetBlockInNativeCode(int blockILOffset, int blockILLen, TADDR *startOffset, TADDR *endOffset);
void DumpTryCatchBlock(char* ptr, int& offset, int ilOffset, int ilLen, int abbrev);
+ void DumpVarsWithScopes(char* ptr, int& offset);
BOOL dumped;
};
#endif // #ifndef __GDBJIT_H__
diff --git a/src/vm/gdbjithelpers.h b/src/vm/gdbjithelpers.h
index 199edaa00e..b5612a1b7b 100644
--- a/src/vm/gdbjithelpers.h
+++ b/src/vm/gdbjithelpers.h
@@ -19,12 +19,22 @@ struct SequencePointInfo
char16_t* fileName;
};
+struct LocalVarInfo
+{
+ int startOffset;
+ int endOffset;
+ char16_t *name;
+};
+
struct MethodDebugInfo
{
SequencePointInfo* points;
int size;
- char16_t** locals;
+ LocalVarInfo* locals;
int localsSize;
+
+ MethodDebugInfo(int numPoints, int numLocals);
+ ~MethodDebugInfo();
};
typedef BOOL (CALLBACK *GetInfoForMethodDelegate)(const char*, unsigned int, MethodDebugInfo& methodDebugInfo);
diff --git a/src/vm/i386/asmconstants.h b/src/vm/i386/asmconstants.h
index 58451e0329..0a581cffe0 100644
--- a/src/vm/i386/asmconstants.h
+++ b/src/vm/i386/asmconstants.h
@@ -431,12 +431,6 @@ ASMCONSTANTS_C_ASSERT(UMThunkMarshInfo__m_cbActualArgSize == offsetof(UMThunkMar
#ifdef FEATURE_STUBS_AS_IL
#define UMThunkMarshInfo__m_cbRetPop 0x08
ASMCONSTANTS_C_ASSERT(UMThunkMarshInfo__m_cbRetPop == offsetof(UMThunkMarshInfo, m_cbRetPop))
-
-#define UMThunkMarshInfo__m_ecxArgOffset 0xc
-ASMCONSTANTS_C_ASSERT(UMThunkMarshInfo__m_ecxArgOffset == offsetof(UMThunkMarshInfo, m_ecxArgOffset))
-
-#define UMThunkMarshInfo__m_edxArgOffset 0x10
-ASMCONSTANTS_C_ASSERT(UMThunkMarshInfo__m_edxArgOffset == offsetof(UMThunkMarshInfo, m_edxArgOffset))
#endif //FEATURE_STUBS_AS_IL
#ifndef CROSSGEN_COMPILE
diff --git a/src/vm/i386/asmhelpers.S b/src/vm/i386/asmhelpers.S
index 08d3bc88fd..a19d2a8f5e 100644
--- a/src/vm/i386/asmhelpers.S
+++ b/src/vm/i386/asmhelpers.S
@@ -937,7 +937,9 @@ NESTED_ENTRY DelayLoad_Helper\suffix, _TEXT, NoHandler
mov esi, esp
- push \frameFlags
+.att_syntax
+ pushl $\frameFlags
+.intel_syntax noprefix
push ecx // module
push edx // section index
diff --git a/src/vm/i386/cgencpu.h b/src/vm/i386/cgencpu.h
index ac239533f7..ff76d992fc 100644
--- a/src/vm/i386/cgencpu.h
+++ b/src/vm/i386/cgencpu.h
@@ -483,10 +483,15 @@ inline BOOL IsUnmanagedValueTypeReturnedByRef(UINT sizeofvaluetype)
{
LIMITED_METHOD_CONTRACT;
+#ifndef UNIX_X86_ABI
// odd-sized small structures are not
// enregistered e.g. struct { char a,b,c; }
return (sizeofvaluetype > 8) ||
(sizeofvaluetype & (sizeofvaluetype - 1)); // check that the size is power of two
+#else
+ // For UNIX_X86_ABI, we always return the value type by reference regardless of its size
+ return true;
+#endif
}
#include <pshpack1.h>
diff --git a/src/vm/i386/cgenx86.cpp b/src/vm/i386/cgenx86.cpp
index f85eb04e2e..4c83265ff4 100644
--- a/src/vm/i386/cgenx86.cpp
+++ b/src/vm/i386/cgenx86.cpp
@@ -523,6 +523,8 @@ void ExternalMethodFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
UpdateRegDisplayHelper(pRD, CbStackPopUsingGCRefMap(GetGCRefMap()));
+ LOG((LF_GCROOTS, LL_INFO100000, "STACKWALK ExternalMethodFrane::UpdateRegDisplay(ip:%p, sp:%p)\n", pRD->ControlPC, pRD->SP));
+
RETURN;
}
@@ -561,6 +563,8 @@ void StubDispatchFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
pRD->ControlPC = GetAdjustedCallAddress(pRD->ControlPC);
}
+ LOG((LF_GCROOTS, LL_INFO100000, "STACKWALK StubDispatchFrame::UpdateRegDisplay(ip:%p, sp:%p)\n", pRD->ControlPC, pRD->SP));
+
RETURN;
}
@@ -742,7 +746,7 @@ void ResumableFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
#ifdef WIN64EXCEPTIONS
- memcpy(pRD->pCurrentContext, &m_Regs, sizeof(CONTEXT));
+ CopyMemory(pRD->pCurrentContext, m_Regs, sizeof(T_CONTEXT));
pRD->SP = m_Regs->Esp;
pRD->ControlPC = m_Regs->Eip;
@@ -800,6 +804,8 @@ void ResumableFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
#endif // !WIN64EXCEPTIONS
+ LOG((LF_GCROOTS, LL_INFO100000, "STACKWALK ResumableFrame::UpdateRegDisplay(ip:%p, sp:%p)\n", pRD->ControlPC, pRD->SP));
+
RETURN;
}
@@ -856,6 +862,8 @@ void HijackFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
pRD->SP = (DWORD)(pRD->PCTAddr + sizeof(TADDR));
#endif // WIN64EXCEPTIONS
+
+ LOG((LF_GCROOTS, LL_INFO100000, "STACKWALK HijackFrame::UpdateRegDisplay(ip:%p, sp:%p)\n", pRD->ControlPC, pRD->SP));
}
#endif // FEATURE_HIJACK
@@ -875,6 +883,8 @@ void PInvokeCalliFrame::UpdateRegDisplay(const PREGDISPLAY pRD)
VASigCookie *pVASigCookie = GetVASigCookie();
UpdateRegDisplayHelper(pRD, pVASigCookie->sizeOfArgs+sizeof(int));
+ LOG((LF_GCROOTS, LL_INFO100000, "STACKWALK PInvokeCalliFrame::UpdateRegDisplay(ip:%p, sp:%p)\n", pRD->ControlPC, pRD->SP));
+
RETURN;
}
diff --git a/src/vm/i386/jithelp.S b/src/vm/i386/jithelp.S
index d7cbba09ee..dd3f8042c5 100644
--- a/src/vm/i386/jithelp.S
+++ b/src/vm/i386/jithelp.S
@@ -562,7 +562,7 @@ LEAF_ENTRY JIT_Dbl2LngP4x87, _TEXT
// restore stack
add esp, 8
- ret 8
+ ret
LEAF_END JIT_Dbl2LngP4x87, _TEXT
// *********************************************************************/
@@ -588,7 +588,7 @@ LEAF_ENTRY JIT_Dbl2LngSSE3, _TEXT
// restore stack
add esp, 8
- ret 8
+ ret
LEAF_END JIT_Dbl2LngSSE3, _TEXT
// *********************************************************************/
@@ -605,7 +605,7 @@ LEAF_END JIT_Dbl2LngSSE3, _TEXT
LEAF_ENTRY JIT_Dbl2IntSSE2, _TEXT
movsd xmm0, [esp + 4]
cvttsd2si eax, xmm0
- ret 8
+ ret
LEAF_END JIT_Dbl2IntSSE2, _TEXT
// *********************************************************************/
diff --git a/src/vm/i386/jitinterfacex86.cpp b/src/vm/i386/jitinterfacex86.cpp
index c1769ebb57..18acbf0126 100644
--- a/src/vm/i386/jitinterfacex86.cpp
+++ b/src/vm/i386/jitinterfacex86.cpp
@@ -34,8 +34,7 @@
#define MON_DEBUG 1
#endif
-class generation;
-extern "C" generation generation_table[];
+extern "C" LONG g_global_alloc_lock;
extern "C" void STDCALL JIT_WriteBarrierReg_PreGrow();// JIThelp.asm/JIThelp.s
extern "C" void STDCALL JIT_WriteBarrierReg_PostGrow();// JIThelp.asm/JIThelp.s
@@ -562,9 +561,9 @@ void JIT_TrialAlloc::EmitCore(CPUSTUBLINKER *psl, CodeLabel *noLock, CodeLabel *
else
{
// Take the GC lock (there is no lock prefix required - we will use JIT_TrialAllocSFastMP on an MP System).
- // inc dword ptr [m_GCLock]
+ // inc dword ptr [g_global_alloc_lock]
psl->Emit16(0x05ff);
- psl->Emit32((int)(size_t)&m_GCLock);
+ psl->Emit32((int)(size_t)&g_global_alloc_lock);
// jnz NoLock
psl->X86EmitCondJump(noLock, X86CondCode::kJNZ);
@@ -580,9 +579,9 @@ void JIT_TrialAlloc::EmitCore(CPUSTUBLINKER *psl, CodeLabel *noLock, CodeLabel *
psl->X86EmitIndexRegLoad(kEDX, kECX, offsetof(MethodTable, m_BaseSize));
}
- // mov eax, dword ptr [generation_table]
+ // mov eax, dword ptr [g_global_alloc_context]
psl->Emit8(0xA1);
- psl->Emit32((int)(size_t)&generation_table);
+ psl->Emit32((int)(size_t)&g_global_alloc_context);
// Try the allocation.
// add edx, eax
@@ -591,17 +590,17 @@ void JIT_TrialAlloc::EmitCore(CPUSTUBLINKER *psl, CodeLabel *noLock, CodeLabel *
if (flags & (ALIGN8 | ALIGN8OBJ))
EmitAlignmentRoundup(psl, kEAX, kEDX, flags); // bump up EDX size by 12 if EAX unaligned (so that we are aligned)
- // cmp edx, dword ptr [generation_table+4]
+ // cmp edx, dword ptr [g_global_alloc_context+4]
psl->Emit16(0x153b);
- psl->Emit32((int)(size_t)&generation_table + 4);
+ psl->Emit32((int)(size_t)&g_global_alloc_context + 4);
// ja noAlloc
psl->X86EmitCondJump(noAlloc, X86CondCode::kJA);
// Fill in the allocation and get out.
- // mov dword ptr [generation_table], edx
+ // mov dword ptr [g_global_alloc_context], edx
psl->Emit16(0x1589);
- psl->Emit32((int)(size_t)&generation_table);
+ psl->Emit32((int)(size_t)&g_global_alloc_context);
if (flags & (ALIGN8 | ALIGN8OBJ))
EmitDummyObject(psl, kEAX, flags);
@@ -609,9 +608,9 @@ void JIT_TrialAlloc::EmitCore(CPUSTUBLINKER *psl, CodeLabel *noLock, CodeLabel *
// mov dword ptr [eax], ecx
psl->X86EmitIndexRegStore(kEAX, 0, kECX);
- // mov dword ptr [m_GCLock], 0FFFFFFFFh
+ // mov dword ptr [g_global_alloc_lock], 0FFFFFFFFh
psl->Emit16(0x05C7);
- psl->Emit32((int)(size_t)&m_GCLock);
+ psl->Emit32((int)(size_t)&g_global_alloc_lock);
psl->Emit32(0xFFFFFFFF);
}
@@ -643,6 +642,12 @@ void JIT_TrialAlloc::EmitSetAppDomain(CPUSTUBLINKER *psl)
// Save ECX over function call
psl->X86EmitPushReg(kECX);
+#ifdef UNIX_X86_ABI
+#define STACK_ALIGN_PADDING 8
+ // sub esp, STACK_ALIGN_PADDING; to align the stack
+ psl->X86EmitSubEsp(STACK_ALIGN_PADDING);
+#endif // UNIX_X86_ABI
+
// mov object to ECX
// mov ecx, eax
psl->Emit16(0xc88b);
@@ -650,6 +655,12 @@ void JIT_TrialAlloc::EmitSetAppDomain(CPUSTUBLINKER *psl)
// SetObjectAppDomain pops its arg & returns object in EAX
psl->X86EmitCall(psl->NewExternalCodeLabel((LPVOID)SetObjectAppDomain), 4);
+#ifdef UNIX_X86_ABI
+ // add esp, STACK_ALIGN_PADDING
+ psl->X86EmitAddEsp(STACK_ALIGN_PADDING);
+#undef STACK_ALIGN_PADDING
+#endif // UNIX_X86_ABI
+
psl->X86EmitPopReg(kECX);
}
@@ -667,9 +678,9 @@ void JIT_TrialAlloc::EmitNoAllocCode(CPUSTUBLINKER *psl, Flags flags)
}
else
{
- // mov dword ptr [m_GCLock], 0FFFFFFFFh
+ // mov dword ptr [g_global_alloc_lock], 0FFFFFFFFh
psl->Emit16(0x05c7);
- psl->Emit32((int)(size_t)&m_GCLock);
+ psl->Emit32((int)(size_t)&g_global_alloc_lock);
psl->Emit32(0xFFFFFFFF);
}
}
@@ -1427,7 +1438,7 @@ void InitJITHelpers1()
_ASSERTE(g_SystemInfo.dwNumberOfProcessors != 0);
- JIT_TrialAlloc::Flags flags = GCHeapUtilities::UseAllocationContexts() ?
+ JIT_TrialAlloc::Flags flags = GCHeapUtilities::UseThreadAllocationContexts() ?
JIT_TrialAlloc::MP_ALLOCATOR : JIT_TrialAlloc::NORMAL;
// Get CPU features and check for SSE2 support.
diff --git a/src/vm/i386/stublinkerx86.cpp b/src/vm/i386/stublinkerx86.cpp
index d9c613064d..9742f9647f 100644
--- a/src/vm/i386/stublinkerx86.cpp
+++ b/src/vm/i386/stublinkerx86.cpp
@@ -1251,7 +1251,7 @@ VOID StubLinkerCPU::X86EmitReturn(WORD wArgBytes)
CONTRACTL
{
STANDARD_VM_CHECK;
-#ifdef _TARGET_AMD64_
+#if defined(_TARGET_AMD64_) || defined(UNIX_X86_ABI)
PRECONDITION(wArgBytes == 0);
#endif
@@ -3268,7 +3268,7 @@ VOID StubLinkerCPU::EmitMethodStubEpilog(WORD numArgBytes, int transitionBlockOf
X86EmitPopReg(kR15);
#endif
-#ifdef _TARGET_AMD64_
+#if defined(_TARGET_AMD64_) || defined(UNIX_X86_ABI)
// Caller deallocates argument space. (Bypasses ASSERT in
// X86EmitReturn.)
numArgBytes = 0;
@@ -4223,6 +4223,10 @@ VOID StubLinkerCPU::EmitShuffleThunk(ShuffleEntry *pShuffleEntryArray)
if (haveMemMemMove)
X86EmitPopReg(SCRATCH_REGISTER_X86REG);
+#ifdef UNIX_X86_ABI
+ _ASSERTE(pWalk->stacksizedelta == 0);
+#endif
+
if (pWalk->stacksizedelta)
X86EmitAddEsp(pWalk->stacksizedelta);
@@ -5717,8 +5721,12 @@ COPY_VALUE_CLASS:
X86EmitPopReg(kFactorReg);
X86EmitPopReg(kTotalReg);
+#ifndef UNIX_X86_ABI
// ret N
X86EmitReturn(pArrayOpScript->m_cbretpop);
+#else
+ X86EmitReturn(0);
+#endif
#endif // !_TARGET_AMD64_
// Exception points must clean up the stack for all those extra args.
@@ -6698,20 +6706,34 @@ BOOL FixupPrecode::SetTargetInterlocked(TADDR target, TADDR expected)
INT64 oldValue = *(INT64*)this;
BYTE* pOldValue = (BYTE*)&oldValue;
- if (pOldValue[OFFSETOF_PRECODE_TYPE_CALL_OR_JMP] != FixupPrecode::TypePrestub)
- return FALSE;
-
MethodDesc * pMD = (MethodDesc*)GetMethodDesc();
g_IBCLogger.LogMethodPrecodeWriteAccess(pMD);
INT64 newValue = oldValue;
BYTE* pNewValue = (BYTE*)&newValue;
- pNewValue[OFFSETOF_PRECODE_TYPE_CALL_OR_JMP] = FixupPrecode::Type;
-
- pOldValue[offsetof(FixupPrecode,m_op)] = X86_INSTR_CALL_REL32;
- pNewValue[offsetof(FixupPrecode,m_op)] = X86_INSTR_JMP_REL32;
+ if (pOldValue[OFFSETOF_PRECODE_TYPE_CALL_OR_JMP] == FixupPrecode::TypePrestub)
+ {
+ pNewValue[OFFSETOF_PRECODE_TYPE_CALL_OR_JMP] = FixupPrecode::Type;
+ pOldValue[offsetof(FixupPrecode, m_op)] = X86_INSTR_CALL_REL32;
+ pNewValue[offsetof(FixupPrecode, m_op)] = X86_INSTR_JMP_REL32;
+ }
+ else if (pOldValue[OFFSETOF_PRECODE_TYPE_CALL_OR_JMP] == FixupPrecode::Type)
+ {
+#ifdef FEATURE_TIERED_COMPILATION
+ // No change needed, jmp is already in place
+#else
+ // Setting the target more than once is unexpected
+ return FALSE;
+#endif
+ }
+ else
+ {
+ // Pre-existing code doesn't conform to the expectations for a FixupPrecode
+ return FALSE;
+ }
+
*(INT32*)(&pNewValue[offsetof(FixupPrecode, m_rel32)]) =
#ifdef FIXUP_PRECODE_PREALLOCATE_DYNAMIC_METHOD_JUMP_STUBS
pMD->IsLCGMethod() ?
diff --git a/src/vm/i386/umthunkstub.S b/src/vm/i386/umthunkstub.S
index 6cefda9ec4..98f96ef6ec 100644
--- a/src/vm/i386/umthunkstub.S
+++ b/src/vm/i386/umthunkstub.S
@@ -10,12 +10,16 @@
// eax = UMEntryThunk*
//
NESTED_ENTRY TheUMEntryPrestub, _TEXT, UnhandledExceptionHandlerUnix
+#define STK_ALIGN_PADDING 8
+ sub esp, STK_ALIGN_PADDING
push eax // UMEntryThunk*
+ CHECK_STACK_ALIGNMENT
call C_FUNC(TheUMEntryPrestubWorker)
- add esp, 4
- // eax = PCODE
+ add esp, (4 + STK_ALIGN_PADDING)
+ // eax = PCODE
jmp eax // Tail Jmp
+#undef STK_ALIGN_PADDING
NESTED_END TheUMEntryPrestub, _TEXT
//
@@ -143,54 +147,35 @@ LOCAL_LABEL(DoTrapReturningThreadsTHROW):
LOCAL_LABEL(UMThunkStub_CopyStackArgs):
- // eax = m_cbActualArgSize, in bytes
- // esi = src
- // edi = dest
- // ebx = scratch
- lea esi, [ebp + 0x8]
+ // eax = m_cbActualArgSize (in bytes)
sub esp, eax
- and esp, -16 // align with 16 byte
- lea edi, [esp]
-
- // First, we copy arguments to ecx and edx registers (if needed).
- mov edx, dword ptr [ebp - UMThunkStub_UMENTRYTHUNK_OFFSET]
- mov edx, dword ptr [edx + UMEntryThunk__m_pUMThunkMarshInfo]
- mov ebx, dword ptr [edx + UMThunkMarshInfo__m_ecxArgOffset]
- cmp ebx, -1
- je LOCAL_LABEL(InitCopyStack)
- mov ecx, dword ptr [esi + ebx]
- add eax, -4
- jz LOCAL_LABEL(UMThunkStub_ArgumentsSetup)
-
- mov ebx, dword ptr [edx + UMThunkMarshInfo__m_edxArgOffset]
- cmp ebx, -1
- je LOCAL_LABEL(InitCopyStack)
- mov edx, dword ptr [esi + ebx]
- add eax, -4
- jz LOCAL_LABEL(UMThunkStub_ArgumentsSetup)
-
-LOCAL_LABEL(InitCopyStack):
- push ecx
+ and esp, -16 // align with 16 byte
+ lea edi, [esp] // edi = dest
+
+ lea esi, [ebp + 0x8] // esi = src
+
+ //
+ // EXTERN_C VOID STDCALL UMThunkStubSetupArgumentsWorker(UMThunkMarshInfo *pMarshInfo,
+ // char *pSrc,
+ // UMThunkMarshInfo::ArgumentRegisters *pArgRegs,
+ // char *pDst)
push edx
- mov edx, dword ptr [ebp - UMThunkStub_UMENTRYTHUNK_OFFSET]
- mov edx, dword ptr [edx + UMEntryThunk__m_pUMThunkMarshInfo]
- mov ebx, [edx + UMThunkMarshInfo__m_cbActualArgSize]
- add ebx, -4
-LOCAL_LABEL(CopyStack):
- cmp ebx, dword ptr [edx + UMThunkMarshInfo__m_ecxArgOffset]
- je LOCAL_LABEL(IncreaseOffset)
- cmp ebx, dword ptr [edx + UMThunkMarshInfo__m_edxArgOffset]
- je LOCAL_LABEL(IncreaseOffset)
- add eax, -4
- mov ecx, dword ptr [esi + ebx]
- mov dword ptr [edi + eax], ecx
-LOCAL_LABEL(IncreaseOffset):
- add ebx, -4
- jc LOCAL_LABEL(CopyStack)
+ push ecx
+ lea ecx, [esp]
- pop edx
+ sub esp, 8 // Pad
+ push edi // pSrc
+ push ecx // pArgRegs
+ push esi // pSrc
+ mov ecx, dword ptr [ebp - UMThunkStub_UMENTRYTHUNK_OFFSET]
+ mov ecx, dword ptr [ecx + UMEntryThunk__m_pUMThunkMarshInfo]
+ push ecx // pMarshInfo
+ CHECK_STACK_ALIGNMENT
+ call C_FUNC(UMThunkStubSetupArgumentsWorker)
+ add esp, 8
pop ecx
+ pop edx
jmp LOCAL_LABEL(UMThunkStub_ArgumentsSetup)
#if _DEBUG
diff --git a/src/vm/ilmarshalers.h b/src/vm/ilmarshalers.h
index 7c7f9a6553..5ac5e41242 100644
--- a/src/vm/ilmarshalers.h
+++ b/src/vm/ilmarshalers.h
@@ -607,12 +607,15 @@ public:
// for X86 and AMD64-Windows we bash the return type from struct to U1, U2, U4 or U8
// and use byrefNativeReturn for all other structs.
+ // for UNIX_X86_ABI, we always need a return buffer argument for any size of structs.
switch (nativeSize)
{
+#ifndef UNIX_X86_ABI
case 1: typ = ELEMENT_TYPE_U1; break;
case 2: typ = ELEMENT_TYPE_U2; break;
case 4: typ = ELEMENT_TYPE_U4; break;
case 8: typ = ELEMENT_TYPE_U8; break;
+#endif
default: byrefNativeReturn = true; break;
}
#endif
diff --git a/src/vm/jithelpers.cpp b/src/vm/jithelpers.cpp
index b46ac98ba5..aaab58963b 100644
--- a/src/vm/jithelpers.cpp
+++ b/src/vm/jithelpers.cpp
@@ -2752,7 +2752,7 @@ HCIMPL1(Object*, JIT_NewS_MP_FastPortable, CORINFO_CLASS_HANDLE typeHnd_)
do
{
- _ASSERTE(GCHeapUtilities::UseAllocationContexts());
+ _ASSERTE(GCHeapUtilities::UseThreadAllocationContexts());
// This is typically the only call in the fast path. Making the call early seems to be better, as it allows the compiler
// to use volatile registers for intermediate values. This reduces the number of push/pop instructions and eliminates
@@ -2844,7 +2844,7 @@ HCIMPL1(StringObject*, AllocateString_MP_FastPortable, DWORD stringLength)
do
{
- _ASSERTE(GCHeapUtilities::UseAllocationContexts());
+ _ASSERTE(GCHeapUtilities::UseThreadAllocationContexts());
// Instead of doing elaborate overflow checks, we just limit the number of elements. This will avoid all overflow
// problems, as well as making sure big string objects are correctly allocated in the big object heap.
@@ -3008,7 +3008,7 @@ HCIMPL2(Object*, JIT_NewArr1VC_MP_FastPortable, CORINFO_CLASS_HANDLE arrayTypeHn
do
{
- _ASSERTE(GCHeapUtilities::UseAllocationContexts());
+ _ASSERTE(GCHeapUtilities::UseThreadAllocationContexts());
// Do a conservative check here. This is to avoid overflow while doing the calculations. We don't
// have to worry about "large" objects, since the allocation quantum is never big enough for
@@ -3085,7 +3085,7 @@ HCIMPL2(Object*, JIT_NewArr1OBJ_MP_FastPortable, CORINFO_CLASS_HANDLE arrayTypeH
do
{
- _ASSERTE(GCHeapUtilities::UseAllocationContexts());
+ _ASSERTE(GCHeapUtilities::UseThreadAllocationContexts());
// Make sure that the total size cannot reach LARGE_OBJECT_SIZE, which also allows us to avoid overflow checks. The
// "256" slack is to cover the array header size and round-up, using a constant value here out of laziness.
diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp
index bdccdefd24..338c274014 100644
--- a/src/vm/jitinterface.cpp
+++ b/src/vm/jitinterface.cpp
@@ -6338,7 +6338,7 @@ bool CEEInfo::getReadyToRunHelper(
void CEEInfo::getReadyToRunDelegateCtorHelper(
CORINFO_RESOLVED_TOKEN * pTargetMethod,
CORINFO_CLASS_HANDLE delegateType,
- CORINFO_CONST_LOOKUP * pLookup
+ CORINFO_LOOKUP * pLookup
)
{
LIMITED_METHOD_CONTRACT;
@@ -8714,11 +8714,15 @@ void CEEInfo::getMethodVTableOffset (CORINFO_METHOD_HANDLE methodHnd,
}
/*********************************************************************/
-static CORINFO_METHOD_HANDLE resolveVirtualMethodHelper(MethodDesc* callerMethod,
- CORINFO_METHOD_HANDLE baseMethod,
- CORINFO_CLASS_HANDLE derivedClass)
+CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethodHelper(CORINFO_METHOD_HANDLE baseMethod,
+ CORINFO_CLASS_HANDLE derivedClass,
+ CORINFO_CONTEXT_HANDLE ownerType)
{
- STANDARD_VM_CONTRACT;
+ CONTRACTL {
+ THROWS;
+ GC_TRIGGERS;
+ MODE_PREEMPTIVE;
+ } CONTRACTL_END;
MethodDesc* pBaseMD = GetMethod(baseMethod);
MethodTable* pBaseMT = pBaseMD->GetMethodTable();
@@ -8729,15 +8733,11 @@ static CORINFO_METHOD_HANDLE resolveVirtualMethodHelper(MethodDesc* callerMethod
//@GENERICS: shouldn't be doing this for instantiated methods as they live elsewhere
_ASSERTE(!pBaseMD->HasMethodInstantiation());
- // Interface call devirtualization is not yet supported.
- if (pBaseMT->IsInterface())
- {
- return nullptr;
- }
-
// Method better be virtual
_ASSERTE(pBaseMD->IsVirtual());
+ MethodDesc* pDevirtMD = nullptr;
+
TypeHandle DerivedClsHnd(derivedClass);
MethodTable* pDerivedMT = DerivedClsHnd.GetMethodTable();
_ASSERTE(pDerivedMT->IsRestored() && pDerivedMT->IsFullyLoaded());
@@ -8748,33 +8748,83 @@ static CORINFO_METHOD_HANDLE resolveVirtualMethodHelper(MethodDesc* callerMethod
return nullptr;
}
- // The derived class should be a subclass of the the base class.
- MethodTable* pCheckMT = pDerivedMT;
-
- while (pCheckMT != nullptr)
+ if (pBaseMT->IsInterface())
{
- if (pCheckMT->HasSameTypeDefAs(pBaseMT))
+
+#ifdef FEATURE_COMINTEROP
+ // Don't try and devirtualize com interface calls.
+ if (pDerivedMT->IsComObjectType())
{
- break;
+ return nullptr;
}
+#endif // FEATURE_COMINTEROP
- pCheckMT = pCheckMT->GetParentMethodTable();
- }
+ // Interface call devirtualization.
+ //
+ // We must ensure that pDerivedMT actually implements the
+ // interface corresponding to pBaseMD.
+ if (!pDerivedMT->CanCastToInterface(pBaseMT))
+ {
+ return nullptr;
+ }
- if (pCheckMT == nullptr)
+ // For generic interface methods we must have an ownerType to
+ // safely devirtualize.
+ if (ownerType != nullptr)
+ {
+ TypeHandle OwnerClsHnd = GetTypeFromContext(ownerType);
+ MethodTable* pOwnerMT = OwnerClsHnd.GetMethodTable();
+
+ // If the derived class is a shared class, make sure the
+ // owner class is too.
+ if (pDerivedMT->IsSharedByGenericInstantiations())
+ {
+ pOwnerMT = pOwnerMT->GetCanonicalMethodTable();
+ }
+
+ pDevirtMD = pDerivedMT->GetMethodDescForInterfaceMethod(TypeHandle(pOwnerMT), pBaseMD);
+ }
+ else if (!pBaseMD->HasClassOrMethodInstantiation())
+ {
+ pDevirtMD = pDerivedMT->GetMethodDescForInterfaceMethod(pBaseMD);
+ }
+ else
+ {
+ return nullptr;
+ }
+ }
+ else
{
- return nullptr;
+ // Virtual call devirtualization.
+ //
+ // The derived class should be a subclass of the the base class.
+ MethodTable* pCheckMT = pDerivedMT;
+
+ while (pCheckMT != nullptr)
+ {
+ if (pCheckMT->HasSameTypeDefAs(pBaseMT))
+ {
+ break;
+ }
+
+ pCheckMT = pCheckMT->GetParentMethodTable();
+ }
+
+ if (pCheckMT == nullptr)
+ {
+ return nullptr;
+ }
+
+ // The base method should be in the base vtable
+ WORD slot = pBaseMD->GetSlot();
+ _ASSERTE(slot < pBaseMT->GetNumVirtuals());
+
+ // Fetch the method that would be invoked if the class were
+ // exactly derived class. It is up to the jit to determine whether
+ // directly calling this method is correct.
+ pDevirtMD = pDerivedMT->GetMethodDescForSlot(slot);
}
- // The base method should be in the base vtable
- WORD slot = pBaseMD->GetSlot();
- _ASSERTE(slot < pBaseMT->GetNumVirtuals());
- _ASSERTE(pBaseMD == pBaseMT->GetMethodDescForSlot(slot));
-
- // Fetch the method that would be invoked if the class were
- // exactly derived class. It is up to the jit to determine whether
- // directly calling this method is correct.
- MethodDesc* pDevirtMD = pDerivedMT->GetMethodDescForSlot(slot);
_ASSERTE(pDevirtMD->IsRestored());
#ifdef FEATURE_READYTORUN_COMPILER
@@ -8782,6 +8832,7 @@ static CORINFO_METHOD_HANDLE resolveVirtualMethodHelper(MethodDesc* callerMethod
// bubble information and if so, disallow it.
if (IsReadyToRunCompilation())
{
+ MethodDesc* callerMethod = m_pMethodBeingCompiled;
Assembly* pCallerAssembly = callerMethod->GetModule()->GetAssembly();
bool allowDevirt =
IsInSameVersionBubble(pCallerAssembly , pDevirtMD->GetModule()->GetAssembly())
@@ -8798,15 +8849,21 @@ static CORINFO_METHOD_HANDLE resolveVirtualMethodHelper(MethodDesc* callerMethod
}
CORINFO_METHOD_HANDLE CEEInfo::resolveVirtualMethod(CORINFO_METHOD_HANDLE methodHnd,
- CORINFO_CLASS_HANDLE derivedClass)
+ CORINFO_CLASS_HANDLE derivedClass,
+ CORINFO_CONTEXT_HANDLE ownerType)
{
- STANDARD_VM_CONTRACT;
+ CONTRACTL {
+ SO_TOLERANT;
+ THROWS;
+ GC_TRIGGERS;
+ MODE_PREEMPTIVE;
+ } CONTRACTL_END;
CORINFO_METHOD_HANDLE result = nullptr;
JIT_TO_EE_TRANSITION();
- result = resolveVirtualMethodHelper(m_pMethodBeingCompiled, methodHnd, derivedClass);
+ result = resolveVirtualMethodHelper(methodHnd, derivedClass, ownerType);
EE_TO_JIT_TRANSITION();
@@ -9859,15 +9916,12 @@ void CEEInfo::getEEInfo(CORINFO_EE_INFO *pEEInfoOut)
pEEInfoOut->maxUncheckedOffsetForNullObject = MAX_UNCHECKED_OFFSET_FOR_NULL_OBJECT;
pEEInfoOut->targetAbi = CORINFO_CORECLR_ABI;
- OSVERSIONINFO sVerInfo;
- sVerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetOSVersion(&sVerInfo);
-
pEEInfoOut->osType = CORINFO_WINNT;
- pEEInfoOut->osMajor = sVerInfo.dwMajorVersion;
- pEEInfoOut->osMinor = sVerInfo.dwMinorVersion;
- pEEInfoOut->osBuild = sVerInfo.dwBuildNumber;
+ // hardcode OS version to 0.0.0. These fields can be removed from JITEE interface
+ pEEInfoOut->osMajor = 0;
+ pEEInfoOut->osMinor = 0;
+ pEEInfoOut->osBuild = 0;
EE_TO_JIT_TRANSITION();
}
diff --git a/src/vm/jitinterface.h b/src/vm/jitinterface.h
index c0df0cf34f..d287248d24 100644
--- a/src/vm/jitinterface.h
+++ b/src/vm/jitinterface.h
@@ -520,7 +520,7 @@ public:
void getReadyToRunDelegateCtorHelper(
CORINFO_RESOLVED_TOKEN * pTargetMethod,
CORINFO_CLASS_HANDLE delegateType,
- CORINFO_CONST_LOOKUP * pLookup
+ CORINFO_LOOKUP * pLookup
);
CorInfoInitClassResult initClass(
@@ -731,7 +731,14 @@ public:
CORINFO_METHOD_HANDLE resolveVirtualMethod(
CORINFO_METHOD_HANDLE virtualMethod,
- CORINFO_CLASS_HANDLE implementingClass
+ CORINFO_CLASS_HANDLE implementingClass,
+ CORINFO_CONTEXT_HANDLE ownerType
+ );
+
+ CORINFO_METHOD_HANDLE resolveVirtualMethodHelper(
+ CORINFO_METHOD_HANDLE virtualMethod,
+ CORINFO_CLASS_HANDLE implementingClass,
+ CORINFO_CONTEXT_HANDLE ownerType
);
CorInfoIntrinsics getIntrinsicID(CORINFO_METHOD_HANDLE method,
diff --git a/src/vm/jitinterfacegen.cpp b/src/vm/jitinterfacegen.cpp
index 99e03f4b6b..ce4c1e90e3 100644
--- a/src/vm/jitinterfacegen.cpp
+++ b/src/vm/jitinterfacegen.cpp
@@ -218,7 +218,7 @@ void InitJITHelpers1()
))
{
// if (multi-proc || server GC)
- if (GCHeapUtilities::UseAllocationContexts())
+ if (GCHeapUtilities::UseThreadAllocationContexts())
{
#ifdef FEATURE_IMPLICIT_TLS
SetJitHelperFunction(CORINFO_HELP_NEWSFAST, JIT_NewS_MP_FastPortable);
diff --git a/src/vm/method.cpp b/src/vm/method.cpp
index bfd9c73e32..834ab63d58 100644
--- a/src/vm/method.cpp
+++ b/src/vm/method.cpp
@@ -2300,7 +2300,7 @@ PCODE MethodDesc::TryGetMultiCallableAddrOfCode(CORINFO_ACCESS_FLAGS accessFlags
}
else
{
- if (IsPointingToNativeCode())
+ if (IsPointingToStableNativeCode())
return GetNativeCode();
}
diff --git a/src/vm/method.hpp b/src/vm/method.hpp
index bbcb012d54..9545da2248 100644
--- a/src/vm/method.hpp
+++ b/src/vm/method.hpp
@@ -1290,6 +1290,58 @@ public:
public:
+#ifdef FEATURE_TIERED_COMPILATION
+ // Is this method allowed to be recompiled and the entrypoint redirected so that we
+ // can optimize its performance? Eligibility is invariant for the lifetime of a method.
+ BOOL IsEligibleForTieredCompilation()
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ // This policy will need to change some more before tiered compilation feature
+ // can be properly supported across a broad range of scenarios. For instance it
+ // wouldn't interact correctly debugging or profiling at the moment because we
+ // enable it too aggresively and it conflicts with the operations of those features.
+
+ //Keep in-sync with MethodTableBuilder::NeedsNativeCodeSlot(bmtMDMethod * pMDMethod)
+ //In the future we might want mutable vtable slots too, but that would require
+ //more work around the runtime to prevent those mutable pointers from leaking
+ return g_pConfig->TieredCompilation() &&
+ !GetModule()->HasNativeOrReadyToRunImage() &&
+ !IsEnCMethod() &&
+ HasNativeCodeSlot();
+
+ }
+#endif
+
+ // Does this method force the NativeCodeSlot to stay fixed after it
+ // is first initialized to native code? Consumers of the native code
+ // pointer need to be very careful about if and when they cache it
+ // if it is not stable.
+ //
+ // The stability of the native code pointer is separate from the
+ // stability of the entrypoint. A stable entrypoint can be a precode
+ // which dispatches to an unstable native code pointer.
+ BOOL IsNativeCodeStableAfterInit()
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return
+#ifdef FEATURE_TIERED_COMPILATION
+ !IsEligibleForTieredCompilation() &&
+#endif
+ !IsEnCMethod();
+ }
+
+ //Is this method currently pointing to native code that will never change?
+ BOOL IsPointingToStableNativeCode()
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ if (!IsNativeCodeStableAfterInit())
+ return FALSE;
+
+ return IsPointingToNativeCode();
+ }
+
// Note: We are skipping the prestub based on addition information from the JIT.
// (e.g. that the call is on same this ptr or that the this ptr is not null).
// Thus we can end up with a running NGENed method for which IsPointingToNativeCode is false!
diff --git a/src/vm/methodtablebuilder.cpp b/src/vm/methodtablebuilder.cpp
index 7de35101ff..503c13af5b 100644
--- a/src/vm/methodtablebuilder.cpp
+++ b/src/vm/methodtablebuilder.cpp
@@ -1942,7 +1942,7 @@ MethodTableBuilder::BuildMethodTableThrowing(
}
// Check for the RemotingProxy Attribute
- // structs with GC poitners MUST be pointer sized aligned because the GC assumes it
+ // structs with GC pointers MUST be pointer sized aligned because the GC assumes it
if (IsValueClass() && pMT->ContainsPointers() && (bmtFP->NumInstanceFieldBytes % sizeof(void*) != 0))
{
BuildMethodTableThrowException(IDS_CLASSLOAD_BADFORMAT);
@@ -7032,6 +7032,16 @@ MethodTableBuilder::NeedsNativeCodeSlot(bmtMDMethod * pMDMethod)
LIMITED_METHOD_CONTRACT;
+#ifdef FEATURE_TIERED_COMPILATION
+ // Keep in-sync with MethodDesc::IsEligibleForTieredCompilation()
+ if (g_pConfig->TieredCompilation() &&
+ !GetModule()->HasNativeOrReadyToRunImage() &&
+ (pMDMethod->GetMethodType() == METHOD_TYPE_NORMAL || pMDMethod->GetMethodType() == METHOD_TYPE_INSTANTIATED))
+ {
+ return TRUE;
+ }
+#endif
+
return GetModule()->IsEditAndContinueEnabled();
}
@@ -9856,7 +9866,7 @@ void MethodTableBuilder::CheckForSystemTypes()
}
else if (strcmp(name, g_ArgIteratorName) == 0)
{
- // Mark the special types that have embeded stack poitners in them
+ // Mark the special types that have embeded stack pointers in them
pMT->SetIsByRefLike();
}
else if (strcmp(name, g_RuntimeArgumentHandleName) == 0)
diff --git a/src/vm/mscorlib.cpp b/src/vm/mscorlib.cpp
index 963e8903c6..5deaaefa90 100644
--- a/src/vm/mscorlib.cpp
+++ b/src/vm/mscorlib.cpp
@@ -34,6 +34,7 @@
#include "excep.h"
#include "fcall.h"
#include "nlsinfo.h"
+#include "clrconfignative.h"
#include "commodule.h"
#include "marshalnative.h"
#include "system.h"
diff --git a/src/vm/object.cpp b/src/vm/object.cpp
index dc53757bac..1725ef7db4 100644
--- a/src/vm/object.cpp
+++ b/src/vm/object.cpp
@@ -19,7 +19,6 @@
#include "eeconfig.h"
#include "gcheaputilities.h"
#include "field.h"
-#include "gcscan.h"
#include "argdestination.h"
@@ -1727,7 +1726,7 @@ VOID Object::ValidateInner(BOOL bDeep, BOOL bVerifyNextHeader, BOOL bVerifySyncB
BOOL bSmallObjectHeapPtr = FALSE, bLargeObjectHeapPtr = FALSE;
if (!noRangeChecks)
{
- bSmallObjectHeapPtr = GCHeapUtilities::GetGCHeap()->IsHeapPointer(this, TRUE);
+ bSmallObjectHeapPtr = GCHeapUtilities::GetGCHeap()->IsHeapPointer(this, true);
if (!bSmallObjectHeapPtr)
bLargeObjectHeapPtr = GCHeapUtilities::GetGCHeap()->IsHeapPointer(this);
@@ -1773,12 +1772,13 @@ VOID Object::ValidateInner(BOOL bDeep, BOOL bVerifyNextHeader, BOOL bVerifySyncB
lastTest = 7;
+ _ASSERTE(GCHeapUtilities::IsGCHeapInitialized());
// try to validate next object's header
if (bDeep
&& bVerifyNextHeader
- && GCScan::GetGcRuntimeStructuresValid ()
+ && GCHeapUtilities::GetGCHeap()->RuntimeStructuresValid()
//NextObj could be very slow if concurrent GC is going on
- && !(GCHeapUtilities::IsGCHeapInitialized() && GCHeapUtilities::GetGCHeap ()->IsConcurrentGCInProgress ()))
+ && !GCHeapUtilities::GetGCHeap ()->IsConcurrentGCInProgress ())
{
Object * nextObj = GCHeapUtilities::GetGCHeap ()->NextObj (this);
if ((nextObj != NULL) &&
diff --git a/src/vm/peimage.cpp b/src/vm/peimage.cpp
index 508f368e0e..39b71ff62f 100644
--- a/src/vm/peimage.cpp
+++ b/src/vm/peimage.cpp
@@ -808,7 +808,7 @@ void PEImage::EnumMemoryRegions(CLRDataEnumMemoryFlags flags)
m_pLayouts[IMAGE_MAPPED]->EnumMemoryRegions(flags);
if (m_pLayouts[IMAGE_LOADED].IsValid() && m_pLayouts[IMAGE_LOADED]!=NULL)
m_pLayouts[IMAGE_LOADED]->EnumMemoryRegions(flags);
- if (m_pLayouts[IMAGE_LOADED_FOR_INTROSPECTION].IsValid() && m_pLayouts[IMAGE_LOADED]!=NULL)
+ if (m_pLayouts[IMAGE_LOADED_FOR_INTROSPECTION].IsValid() && m_pLayouts[IMAGE_LOADED_FOR_INTROSPECTION]!=NULL)
m_pLayouts[IMAGE_LOADED_FOR_INTROSPECTION]->EnumMemoryRegions(flags);
}
diff --git a/src/vm/precode.cpp b/src/vm/precode.cpp
index 180e1709c5..9707b2756b 100644
--- a/src/vm/precode.cpp
+++ b/src/vm/precode.cpp
@@ -421,14 +421,14 @@ void Precode::Init(PrecodeType t, MethodDesc* pMD, LoaderAllocator *pLoaderAlloc
_ASSERTE(IsValidType(GetType()));
}
-BOOL Precode::SetTargetInterlocked(PCODE target)
+BOOL Precode::SetTargetInterlocked(PCODE target, BOOL fOnlyRedirectFromPrestub)
{
WRAPPER_NO_CONTRACT;
PCODE expected = GetTarget();
BOOL ret = FALSE;
- if (!IsPointingToPrestub(expected))
+ if (fOnlyRedirectFromPrestub && !IsPointingToPrestub(expected))
return FALSE;
g_IBCLogger.LogMethodPrecodeWriteAccess(GetMethodDesc());
diff --git a/src/vm/precode.h b/src/vm/precode.h
index 0afa762647..7dd4cd22f0 100644
--- a/src/vm/precode.h
+++ b/src/vm/precode.h
@@ -256,7 +256,7 @@ public:
void Init(PrecodeType t, MethodDesc* pMD, LoaderAllocator *pLoaderAllocator);
#ifndef DACCESS_COMPILE
- BOOL SetTargetInterlocked(PCODE target);
+ BOOL SetTargetInterlocked(PCODE target, BOOL fOnlyRedirectFromPrestub = TRUE);
// Reset precode to point to prestub
void Reset();
diff --git a/src/vm/prestub.cpp b/src/vm/prestub.cpp
index 2f84b9df9d..67639e99b2 100644
--- a/src/vm/prestub.cpp
+++ b/src/vm/prestub.cpp
@@ -48,6 +48,10 @@
#include "perfmap.h"
#endif
+#ifdef FEATURE_TIERED_COMPILATION
+#include "callcounter.h"
+#endif
+
#ifndef DACCESS_COMPILE
EXTERN_C void STDCALL ThePreStub();
@@ -267,10 +271,12 @@ PCODE MethodDesc::MakeJitWorker(COR_ILMETHOD_DECODER* ILHeader, CORJIT_FLAGS fla
PCODE pCode = NULL;
ULONG sizeOfCode = 0;
+#if defined(FEATURE_INTERPRETER) || defined(FEATURE_TIERED_COMPILATION)
+ BOOL fStable = TRUE; // True iff the new code address (to be stored in pCode), is a stable entry point.
+#endif
#ifdef FEATURE_INTERPRETER
PCODE pPreviousInterpStub = NULL;
BOOL fInterpreted = FALSE;
- BOOL fStable = TRUE; // True iff the new code address (to be stored in pCode), is a stable entry point.
#endif
#ifdef FEATURE_MULTICOREJIT
@@ -279,6 +285,20 @@ PCODE MethodDesc::MakeJitWorker(COR_ILMETHOD_DECODER* ILHeader, CORJIT_FLAGS fla
bool fBackgroundThread = flags.IsSet(CORJIT_FLAGS::CORJIT_FLAG_MCJIT_BACKGROUND);
#endif
+ // If this is the first stage of a tiered compilation progression, use tier0, otherwise
+ // use default compilation options
+#ifdef FEATURE_TIERED_COMPILATION
+ if (!IsEligibleForTieredCompilation())
+ {
+ fStable = TRUE;
+ }
+ else
+ {
+ fStable = FALSE;
+ flags.Add(CORJIT_FLAGS(CORJIT_FLAGS::CORJIT_FLAG_TIER0));
+ }
+#endif
+
{
// Enter the global lock which protects the list of all functions being JITd
ListLockHolder pJitLock (GetDomain()->GetJitLock());
@@ -681,8 +701,10 @@ void CreateInstantiatingILStubTargetSig(MethodDesc *pBaseMD,
SigPointer pReturn = msig.GetReturnProps();
pReturn.ConvertToInternalExactlyOne(msig.GetModule(), &typeContext, stubSigBuilder, FALSE);
+#ifndef _TARGET_X86_
// The hidden context parameter
stubSigBuilder->AppendElementType(ELEMENT_TYPE_I);
+#endif // !_TARGET_X86_
// Copy rest of the arguments
msig.NextArg();
@@ -692,6 +714,10 @@ void CreateInstantiatingILStubTargetSig(MethodDesc *pBaseMD,
pArgs.ConvertToInternalExactlyOne(msig.GetModule(), &typeContext, stubSigBuilder);
}
+#ifdef _TARGET_X86_
+ // The hidden context parameter
+ stubSigBuilder->AppendElementType(ELEMENT_TYPE_I);
+#endif // _TARGET_X86_
}
Stub * CreateUnboxingILStubForSharedGenericValueTypeMethods(MethodDesc* pTargetMD)
@@ -891,7 +917,7 @@ Stub * CreateInstantiatingILStub(MethodDesc* pTargetMD, void* pHiddenArg)
}
#endif
-/* Make a stub that for a value class method that expects a BOXed this poitner */
+/* Make a stub that for a value class method that expects a BOXed this pointer */
Stub * MakeUnboxingStubWorker(MethodDesc *pMD)
{
CONTRACT(Stub*)
@@ -1277,6 +1303,22 @@ PCODE MethodDesc::DoPrestub(MethodTable *pDispatchingMT)
if (!IsPointingToPrestub())
#endif
{
+ // If we are counting calls for tiered compilation, leave the prestub
+ // in place so that we can continue intercepting method invocations.
+ // When the TieredCompilationManager has received enough call notifications
+ // for this method only then do we back-patch it.
+#ifdef FEATURE_TIERED_COMPILATION
+ PCODE pNativeCode = GetNativeCode();
+ if (pNativeCode && IsEligibleForTieredCompilation())
+ {
+ CallCounter * pCallCounter = GetAppDomain()->GetCallCounter();
+ BOOL doBackPatch = pCallCounter->OnMethodCalled(this);
+ if (!doBackPatch)
+ {
+ return pNativeCode;
+ }
+ }
+#endif
LOG((LF_CLASSLOADER, LL_INFO10000,
" In PreStubWorker, method already jitted, backpatching call point\n"));
@@ -1302,8 +1344,8 @@ PCODE MethodDesc::DoPrestub(MethodTable *pDispatchingMT)
else if (IsIL() || IsNoMetadata())
{
// remember if we need to backpatch the MethodTable slot
- BOOL fBackpatch = !fRemotingIntercepted
- && !IsEnCMethod();
+ BOOL fBackpatch = !fRemotingIntercepted
+ && IsNativeCodeStableAfterInit();
#ifdef FEATURE_PREJIT
//
@@ -1577,6 +1619,22 @@ PCODE MethodDesc::DoPrestub(MethodTable *pDispatchingMT)
MemoryBarrier();
#endif
+ // If we are counting calls for tiered compilation, leave the prestub
+ // in place so that we can continue intercepting method invocations.
+ // When the TieredCompilationManager has received enough call notifications
+ // for this method only then do we back-patch it.
+#ifdef FEATURE_TIERED_COMPILATION
+ if (pCode && IsEligibleForTieredCompilation())
+ {
+ CallCounter * pCallCounter = GetAppDomain()->GetCallCounter();
+ BOOL doBackPatch = pCallCounter->OnMethodCalled(this);
+ if (!doBackPatch)
+ {
+ return pCode;
+ }
+ }
+#endif
+
if (pCode != NULL)
{
if (HasPrecode())
@@ -1706,7 +1764,7 @@ static PCODE PatchNonVirtualExternalMethod(MethodDesc * pMD, PCODE pCode, PTR_CO
//
#ifdef HAS_FIXUP_PRECODE
if (pMD->HasPrecode() && pMD->GetPrecode()->GetType() == PRECODE_FIXUP
- && !pMD->IsEnCMethod()
+ && pMD->IsNativeCodeStableAfterInit()
#ifndef HAS_REMOTING_PRECODE
&& !pMD->IsRemotingInterceptedViaPrestub()
#endif
diff --git a/src/vm/proftoeeinterfaceimpl.cpp b/src/vm/proftoeeinterfaceimpl.cpp
index 40f0864d72..cfd99adf27 100644
--- a/src/vm/proftoeeinterfaceimpl.cpp
+++ b/src/vm/proftoeeinterfaceimpl.cpp
@@ -1022,7 +1022,7 @@ ClassID SafeGetClassIDFromObject(Object * pObj)
//---------------------------------------------------------------------------------------
//
-// Callback of type walk_fn used by GCHeapUtilities::DiagWalkObject. Keeps a count of each
+// Callback of type walk_fn used by IGCHeap::DiagWalkObject. Keeps a count of each
// object reference found.
//
// Arguments:
@@ -1033,7 +1033,7 @@ ClassID SafeGetClassIDFromObject(Object * pObj)
// Always returns TRUE to object walker so it walks the entire object
//
-BOOL CountContainedObjectRef(Object * pBO, void * context)
+bool CountContainedObjectRef(Object * pBO, void * context)
{
LIMITED_METHOD_CONTRACT;
// Increase the count
@@ -1044,7 +1044,7 @@ BOOL CountContainedObjectRef(Object * pBO, void * context)
//---------------------------------------------------------------------------------------
//
-// Callback of type walk_fn used by GCHeapUtilities::DiagWalkObject. Stores each object reference
+// Callback of type walk_fn used by IGCHeap::DiagWalkObject. Stores each object reference
// encountered into an array.
//
// Arguments:
@@ -1058,7 +1058,7 @@ BOOL CountContainedObjectRef(Object * pBO, void * context)
// Always returns TRUE to object walker so it walks the entire object
//
-BOOL SaveContainedObjectRef(Object * pBO, void * context)
+bool SaveContainedObjectRef(Object * pBO, void * context)
{
LIMITED_METHOD_CONTRACT;
// Assign the value
@@ -1096,7 +1096,7 @@ BOOL SaveContainedObjectRef(Object * pBO, void * context)
//
extern bool s_forcedGCInProgress;
-BOOL HeapWalkHelper(Object * pBO, void * pvContext)
+bool HeapWalkHelper(Object * pBO, void * pvContext)
{
CONTRACTL
{
@@ -1221,7 +1221,7 @@ BOOL HeapWalkHelper(Object * pBO, void * pvContext)
// Currently always returns TRUE
//
-BOOL AllocByClassHelper(Object * pBO, void * pv)
+bool AllocByClassHelper(Object * pBO, void * pv)
{
CONTRACTL
{
diff --git a/src/vm/rcwwalker.cpp b/src/vm/rcwwalker.cpp
index 0b875360fd..7ecf2b68c5 100644
--- a/src/vm/rcwwalker.cpp
+++ b/src/vm/rcwwalker.cpp
@@ -129,7 +129,7 @@ STDMETHODIMP CLRServicesImpl::GarbageCollect(DWORD dwFlags)
{
GCX_COOP_THREAD_EXISTS(GET_THREAD());
if (dwFlags & GC_FOR_APPX_SUSPEND) {
- GCHeapUtilities::GetGCHeap()->GarbageCollect(2, TRUE, collection_blocking | collection_optimized);
+ GCHeapUtilities::GetGCHeap()->GarbageCollect(2, true, collection_blocking | collection_optimized);
}
else
GCHeapUtilities::GetGCHeap()->GarbageCollect();
diff --git a/src/vm/readytoruninfo.cpp b/src/vm/readytoruninfo.cpp
index 623556d793..b85cf9a9c3 100644
--- a/src/vm/readytoruninfo.cpp
+++ b/src/vm/readytoruninfo.cpp
@@ -53,7 +53,7 @@ MethodDesc * ReadyToRunInfo::GetMethodDescForEntryPoint(PCODE entryPoint)
}
CONTRACTL_END;
-#ifdef _TARGET_AMD64_
+#if defined(_TARGET_AMD64_) || (defined(_TARGET_X86_) && defined(FEATURE_PAL))
// A normal method entry point is always 8 byte aligned, but a funclet can start at an odd address.
// Since PtrHashMap can't handle odd pointers, check for this case and return NULL.
if ((entryPoint & 0x1) != 0)
diff --git a/src/vm/rexcep.h b/src/vm/rexcep.h
index 0417bef5be..b4a8318d92 100644
--- a/src/vm/rexcep.h
+++ b/src/vm/rexcep.h
@@ -109,8 +109,7 @@
//
DEFINE_EXCEPTION(g_ReflectionNS, AmbiguousMatchException, false, COR_E_AMBIGUOUSMATCH)
-// ApplicationException is removed in CoreCLR
-#define kApplicationException kException
+DEFINE_EXCEPTION(g_SystemNS, ApplicationException, false, COR_E_APPLICATION)
DEFINE_EXCEPTION(g_SystemNS, AppDomainUnloadedException, false, COR_E_APPDOMAINUNLOADED)
DEFINE_EXCEPTION(g_SystemNS, ArithmeticException, false, COR_E_ARITHMETIC)
diff --git a/src/vm/stubhelpers.cpp b/src/vm/stubhelpers.cpp
index 899e88e629..0a5c143bf4 100644
--- a/src/vm/stubhelpers.cpp
+++ b/src/vm/stubhelpers.cpp
@@ -21,7 +21,6 @@
#include "comdatetime.h"
#include "gcheaputilities.h"
#include "interoputil.h"
-#include "gcscan.h"
#ifdef FEATURE_COMINTEROP
#include <oletls.h>
@@ -58,7 +57,7 @@ void StubHelpers::ValidateObjectInternal(Object *pObjUNSAFE, BOOL fValidateNextO
}
CONTRACTL_END;
- _ASSERTE(GCScan::GetGcRuntimeStructuresValid());
+ _ASSERTE(GCHeapUtilities::GetGCHeap()->RuntimeStructuresValid());
// validate the object - there's no need to validate next object's
// header since we validate the next object explicitly below
@@ -159,7 +158,7 @@ void StubHelpers::ProcessByrefValidationList()
{
entry = s_ByrefValidationEntries[i];
- Object *pObjUNSAFE = GCHeapUtilities::GetGCHeap()->GetContainingObject(entry.pByref);
+ Object *pObjUNSAFE = GCHeapUtilities::GetGCHeap()->GetContainingObject(entry.pByref, false);
ValidateObjectInternal(pObjUNSAFE, TRUE);
}
}
diff --git a/src/vm/syncblk.cpp b/src/vm/syncblk.cpp
index b8a818c107..78e455a580 100644
--- a/src/vm/syncblk.cpp
+++ b/src/vm/syncblk.cpp
@@ -30,7 +30,6 @@
#include "corhost.h"
#include "comdelegate.h"
#include "finalizerthread.h"
-#include "gcscan.h"
#ifdef FEATURE_COMINTEROP
#include "runtimecallablewrapper.h"
@@ -2518,7 +2517,7 @@ BOOL ObjHeader::Validate (BOOL bVerifySyncBlkIndex)
//rest of the DWORD is SyncBlk Index
if (!(bits & BIT_SBLK_IS_HASHCODE))
{
- if (bVerifySyncBlkIndex && GCScan::GetGcRuntimeStructuresValid ())
+ if (bVerifySyncBlkIndex && GCHeapUtilities::GetGCHeap()->RuntimeStructuresValid ())
{
DWORD sbIndex = bits & MASK_SYNCBLOCKINDEX;
ASSERT_AND_CHECK(SyncTableEntry::GetSyncTableEntry()[sbIndex].m_Object == obj);
diff --git a/src/vm/threads.cpp b/src/vm/threads.cpp
index b5f750778b..68a81bf606 100644
--- a/src/vm/threads.cpp
+++ b/src/vm/threads.cpp
@@ -1825,6 +1825,7 @@ Thread::Thread()
#ifdef FEATURE_COMINTEROP
m_fDisableComObjectEagerCleanup = false;
#endif //FEATURE_COMINTEROP
+ m_fHasDeadThreadBeenConsideredForGCTrigger = false;
m_Context = NULL;
m_TraceCallCount = 0;
m_ThrewControlForThread = 0;
@@ -2170,28 +2171,17 @@ BOOL Thread::AllocHandles()
{
WRAPPER_NO_CONTRACT;
- _ASSERTE(!m_SafeEvent.IsValid());
- _ASSERTE(!m_UserSuspendEvent.IsValid());
_ASSERTE(!m_DebugSuspendEvent.IsValid());
_ASSERTE(!m_EventWait.IsValid());
BOOL fOK = TRUE;
EX_TRY {
// create a manual reset event for getting the thread to a safe point
- m_SafeEvent.CreateManualEvent(FALSE);
- m_UserSuspendEvent.CreateManualEvent(FALSE);
m_DebugSuspendEvent.CreateManualEvent(FALSE);
m_EventWait.CreateManualEvent(TRUE);
}
EX_CATCH {
fOK = FALSE;
- if (!m_SafeEvent.IsValid()) {
- m_SafeEvent.CloseEvent();
- }
-
- if (!m_UserSuspendEvent.IsValid()) {
- m_UserSuspendEvent.CloseEvent();
- }
if (!m_DebugSuspendEvent.IsValid()) {
m_DebugSuspendEvent.CloseEvent();
@@ -2404,30 +2394,8 @@ FAILURE:
}
#endif // PROFILING_SUPPORTED
- // Is there a pending user suspension?
- if (m_State & TS_SuspendUnstarted)
- {
- BOOL doSuspend = FALSE;
-
- {
- ThreadStoreLockHolder TSLockHolder;
-
- // Perhaps we got resumed before it took effect?
- if (m_State & TS_SuspendUnstarted)
- {
- FastInterlockAnd((ULONG *) &m_State, ~TS_SuspendUnstarted);
- SetupForSuspension(TS_UserSuspendPending);
- MarkForSuspension(TS_UserSuspendPending);
- doSuspend = TRUE;
- }
- }
-
- if (doSuspend)
- {
- GCX_PREEMP();
- WaitSuspendEvents();
- }
- }
+ // CoreCLR does not support user-requested thread suspension
+ _ASSERTE(!(m_State & TS_SuspendUnstarted));
}
return res;
@@ -3064,14 +3032,6 @@ Thread::~Thread()
CloseHandle(GetThreadHandle());
}
- if (m_SafeEvent.IsValid())
- {
- m_SafeEvent.CloseEvent();
- }
- if (m_UserSuspendEvent.IsValid())
- {
- m_UserSuspendEvent.CloseEvent();
- }
if (m_DebugSuspendEvent.IsValid())
{
m_DebugSuspendEvent.CloseEvent();
@@ -3440,7 +3400,7 @@ void Thread::OnThreadTerminate(BOOL holdingLock)
if (ThisThreadID == CurrentThreadID)
{
GCX_COOP();
- GCHeapUtilities::GetGCHeap()->FixAllocContext(&m_alloc_context, FALSE, NULL, NULL);
+ GCHeapUtilities::GetGCHeap()->FixAllocContext(&m_alloc_context, false, NULL, NULL);
m_alloc_context.init();
}
}
@@ -3497,12 +3457,13 @@ void Thread::OnThreadTerminate(BOOL holdingLock)
{
// We must be holding the ThreadStore lock in order to clean up alloc context.
// We should never call FixAllocContext during GC.
- GCHeapUtilities::GetGCHeap()->FixAllocContext(&m_alloc_context, FALSE, NULL, NULL);
+ GCHeapUtilities::GetGCHeap()->FixAllocContext(&m_alloc_context, false, NULL, NULL);
m_alloc_context.init();
}
FastInterlockOr((ULONG *) &m_State, TS_Dead);
ThreadStore::s_pThreadStore->m_DeadThreadCount++;
+ ThreadStore::s_pThreadStore->IncrementDeadThreadCountForGCTrigger();
if (IsUnstarted())
ThreadStore::s_pThreadStore->m_UnstartedThreadCount--;
@@ -3527,8 +3488,8 @@ void Thread::OnThreadTerminate(BOOL holdingLock)
if (m_State & TS_DebugSuspendPending)
UnmarkForSuspension(~TS_DebugSuspendPending);
- if (m_State & TS_UserSuspendPending)
- UnmarkForSuspension(~TS_UserSuspendPending);
+ // CoreCLR does not support user-requested thread suspension
+ _ASSERTE(!(m_State & TS_UserSuspendPending));
if (CurrentThreadID == ThisThreadID && IsAbortRequested())
{
@@ -5739,6 +5700,8 @@ ThreadStore::ThreadStore()
m_BackgroundThreadCount(0),
m_PendingThreadCount(0),
m_DeadThreadCount(0),
+ m_DeadThreadCountForGCTrigger(0),
+ m_TriggerGCForDeadThreads(false),
m_GuidCreated(FALSE),
m_HoldingThread(0)
{
@@ -5778,6 +5741,16 @@ void ThreadStore::InitThreadStore()
s_pWaitForStackCrawlEvent = new CLREvent();
s_pWaitForStackCrawlEvent->CreateManualEvent(FALSE);
+
+ s_DeadThreadCountThresholdForGCTrigger =
+ static_cast<LONG>(CLRConfig::GetConfigValue(CLRConfig::INTERNAL_Thread_DeadThreadCountThresholdForGCTrigger));
+ if (s_DeadThreadCountThresholdForGCTrigger < 0)
+ {
+ s_DeadThreadCountThresholdForGCTrigger = 0;
+ }
+ s_DeadThreadGCTriggerPeriodMilliseconds =
+ CLRConfig::GetConfigValue(CLRConfig::INTERNAL_Thread_DeadThreadGCTriggerPeriodMilliseconds);
+ s_DeadThreadGenerationCounts = nullptr;
}
// Enter and leave the critical section around the thread store. Clients should
@@ -5920,7 +5893,10 @@ BOOL ThreadStore::RemoveThread(Thread *target)
s_pThreadStore->m_ThreadCount--;
if (target->IsDead())
+ {
s_pThreadStore->m_DeadThreadCount--;
+ s_pThreadStore->DecrementDeadThreadCountForGCTrigger();
+ }
// Unstarted threads are not in the Background count:
if (target->IsUnstarted())
@@ -6009,6 +5985,200 @@ void ThreadStore::TransferStartedThread(Thread *thread, BOOL bRequiresTSL)
CheckForEEShutdown();
}
+LONG ThreadStore::s_DeadThreadCountThresholdForGCTrigger = 0;
+DWORD ThreadStore::s_DeadThreadGCTriggerPeriodMilliseconds = 0;
+SIZE_T *ThreadStore::s_DeadThreadGenerationCounts = nullptr;
+
+void ThreadStore::IncrementDeadThreadCountForGCTrigger()
+{
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ // Although all increments and decrements are usually done inside a lock, that is not sufficient to synchronize with a
+ // background GC thread resetting this value, hence the interlocked operation. Ignore overflow; overflow would likely never
+ // occur, the count is treated as unsigned, and nothing bad would happen if it were to overflow.
+ SIZE_T count = static_cast<SIZE_T>(FastInterlockIncrement(&m_DeadThreadCountForGCTrigger));
+
+ SIZE_T countThreshold = static_cast<SIZE_T>(s_DeadThreadCountThresholdForGCTrigger);
+ if (count < countThreshold || countThreshold == 0)
+ {
+ return;
+ }
+
+ IGCHeap *gcHeap = GCHeapUtilities::GetGCHeap();
+ if (gcHeap == nullptr)
+ {
+ return;
+ }
+
+ SIZE_T gcLastMilliseconds = gcHeap->GetLastGCStartTime(gcHeap->GetMaxGeneration());
+ SIZE_T gcNowMilliseconds = gcHeap->GetNow();
+ if (gcNowMilliseconds - gcLastMilliseconds < s_DeadThreadGCTriggerPeriodMilliseconds)
+ {
+ return;
+ }
+
+ if (!g_fEEStarted) // required for FinalizerThread::EnableFinalization() below
+ {
+ return;
+ }
+
+ // The GC is triggered on the finalizer thread since it's not safe to trigger it on DLL_THREAD_DETACH.
+ // TriggerGCForDeadThreadsIfNecessary() will determine which generation of GC to trigger, and may not actually trigger a GC.
+ // If a GC is triggered, since there would be a delay before the dead thread count is updated, clear the count and wait for
+ // it to reach the threshold again. If a GC would not be triggered, the count is still cleared here to prevent waking up the
+ // finalizer thread to do the work in TriggerGCForDeadThreadsIfNecessary() for every dead thread.
+ m_DeadThreadCountForGCTrigger = 0;
+ m_TriggerGCForDeadThreads = true;
+ FinalizerThread::EnableFinalization();
+}
+
+void ThreadStore::DecrementDeadThreadCountForGCTrigger()
+{
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ // Although all increments and decrements are usually done inside a lock, that is not sufficient to synchronize with a
+ // background GC thread resetting this value, hence the interlocked operation.
+ if (FastInterlockDecrement(&m_DeadThreadCountForGCTrigger) < 0)
+ {
+ m_DeadThreadCountForGCTrigger = 0;
+ }
+}
+
+void ThreadStore::OnMaxGenerationGCStarted()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ // A dead thread may contribute to triggering a GC at most once. After a max-generation GC occurs, if some dead thread
+ // objects are still reachable due to references to the thread objects, they will not contribute to triggering a GC again.
+ // Synchronize the store with increment/decrement operations occurring on different threads, and make the change visible to
+ // other threads in order to prevent unnecessary GC triggers.
+ FastInterlockExchange(&m_DeadThreadCountForGCTrigger, 0);
+}
+
+bool ThreadStore::ShouldTriggerGCForDeadThreads()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return m_TriggerGCForDeadThreads;
+}
+
+void ThreadStore::TriggerGCForDeadThreadsIfNecessary()
+{
+ CONTRACTL {
+ NOTHROW;
+ GC_TRIGGERS;
+ }
+ CONTRACTL_END;
+
+ if (!m_TriggerGCForDeadThreads)
+ {
+ return;
+ }
+ m_TriggerGCForDeadThreads = false;
+
+ if (g_fEEShutDown)
+ {
+ // Not safe to touch CLR state
+ return;
+ }
+
+ unsigned gcGenerationToTrigger = 0;
+ IGCHeap *gcHeap = GCHeapUtilities::GetGCHeap();
+ _ASSERTE(gcHeap != nullptr);
+ SIZE_T generationCountThreshold = static_cast<SIZE_T>(s_DeadThreadCountThresholdForGCTrigger) / 2;
+ unsigned maxGeneration = gcHeap->GetMaxGeneration();
+ if (!s_DeadThreadGenerationCounts)
+ {
+ // initialize this field on first use with an entry for every table.
+ s_DeadThreadGenerationCounts = new (nothrow) SIZE_T[maxGeneration + 1];
+ if (!s_DeadThreadGenerationCounts)
+ {
+ return;
+ }
+ }
+
+ memset(s_DeadThreadGenerationCounts, 0, sizeof(SIZE_T) * (maxGeneration + 1));
+ {
+ ThreadStoreLockHolder threadStoreLockHolder;
+ GCX_COOP();
+
+ // Determine the generation for which to trigger a GC. Iterate over all dead threads that have not yet been considered
+ // for triggering a GC and see how many are in which generations.
+ for (Thread *thread = ThreadStore::GetAllThreadList(NULL, Thread::TS_Dead, Thread::TS_Dead);
+ thread != nullptr;
+ thread = ThreadStore::GetAllThreadList(thread, Thread::TS_Dead, Thread::TS_Dead))
+ {
+ if (thread->HasDeadThreadBeenConsideredForGCTrigger())
+ {
+ continue;
+ }
+
+ Object *exposedObject = OBJECTREFToObject(thread->GetExposedObjectRaw());
+ if (exposedObject == nullptr)
+ {
+ continue;
+ }
+
+ unsigned exposedObjectGeneration = gcHeap->WhichGeneration(exposedObject);
+ SIZE_T newDeadThreadGenerationCount = ++s_DeadThreadGenerationCounts[exposedObjectGeneration];
+ if (exposedObjectGeneration > gcGenerationToTrigger && newDeadThreadGenerationCount >= generationCountThreshold)
+ {
+ gcGenerationToTrigger = exposedObjectGeneration;
+ if (gcGenerationToTrigger >= maxGeneration)
+ {
+ break;
+ }
+ }
+ }
+
+ // Make sure that enough time has elapsed since the last GC of the desired generation. We don't want to trigger GCs
+ // based on this heuristic too often. Give it some time to let the memory pressure trigger GCs automatically, and only
+ // if it doesn't in the given time, this heuristic may kick in to trigger a GC.
+ SIZE_T gcLastMilliseconds = gcHeap->GetLastGCStartTime(gcGenerationToTrigger);
+ SIZE_T gcNowMilliseconds = gcHeap->GetNow();
+ if (gcNowMilliseconds - gcLastMilliseconds < s_DeadThreadGCTriggerPeriodMilliseconds)
+ {
+ return;
+ }
+
+ // For threads whose exposed objects are in the generation of GC that will be triggered or in a lower GC generation,
+ // mark them as having contributed to a GC trigger to prevent redundant GC triggers
+ for (Thread *thread = ThreadStore::GetAllThreadList(NULL, Thread::TS_Dead, Thread::TS_Dead);
+ thread != nullptr;
+ thread = ThreadStore::GetAllThreadList(thread, Thread::TS_Dead, Thread::TS_Dead))
+ {
+ if (thread->HasDeadThreadBeenConsideredForGCTrigger())
+ {
+ continue;
+ }
+
+ Object *exposedObject = OBJECTREFToObject(thread->GetExposedObjectRaw());
+ if (exposedObject == nullptr)
+ {
+ continue;
+ }
+
+ if (gcGenerationToTrigger < maxGeneration &&
+ gcHeap->WhichGeneration(exposedObject) > gcGenerationToTrigger)
+ {
+ continue;
+ }
+
+ thread->SetHasDeadThreadBeenConsideredForGCTrigger();
+ }
+ } // ThreadStoreLockHolder, GCX_COOP()
+
+ GCHeapUtilities::GetGCHeap()->GarbageCollect(gcGenerationToTrigger, FALSE, collection_non_blocking);
+}
+
#endif // #ifndef DACCESS_COMPILE
@@ -6226,8 +6396,8 @@ Retry:
if (cur->m_State & Thread::TS_DebugSuspendPending)
cntReturn++;
- if (cur->m_State & Thread::TS_UserSuspendPending)
- cntReturn++;
+ // CoreCLR does not support user-requested thread suspension
+ _ASSERTE(!(cur->m_State & Thread::TS_UserSuspendPending));
if (cur->m_TraceCallCount > 0)
cntReturn++;
@@ -8697,7 +8867,8 @@ BOOL Thread::HaveExtraWorkForFinalizer()
|| Thread::CleanupNeededForFinalizedThread()
|| (m_DetachCount > 0)
|| AppDomain::HasWorkForFinalizerThread()
- || SystemDomain::System()->RequireAppDomainCleanup();
+ || SystemDomain::System()->RequireAppDomainCleanup()
+ || ThreadStore::s_pThreadStore->ShouldTriggerGCForDeadThreads();
}
void Thread::DoExtraWorkForFinalizer()
@@ -8754,7 +8925,8 @@ void Thread::DoExtraWorkForFinalizer()
// If there were any TimerInfos waiting to be released, they'll get flushed now
ThreadpoolMgr::FlushQueueOfTimerInfos();
-
+
+ ThreadStore::s_pThreadStore->TriggerGCForDeadThreadsIfNecessary();
}
diff --git a/src/vm/threads.h b/src/vm/threads.h
index ff0d1669ce..697ffea454 100644
--- a/src/vm/threads.h
+++ b/src/vm/threads.h
@@ -1450,6 +1450,24 @@ public:
}
#endif //FEATURE_COMINTEROP
+#ifndef DACCESS_COMPILE
+ bool HasDeadThreadBeenConsideredForGCTrigger()
+ {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(IsDead());
+
+ return m_fHasDeadThreadBeenConsideredForGCTrigger;
+ }
+
+ void SetHasDeadThreadBeenConsideredForGCTrigger()
+ {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(IsDead());
+
+ m_fHasDeadThreadBeenConsideredForGCTrigger = true;
+ }
+#endif // !DACCESS_COMPILE
+
// returns if there is some extra work for the finalizer thread.
BOOL HaveExtraWorkForFinalizer();
@@ -3712,9 +3730,11 @@ private:
void SetupForSuspension(ULONG bit)
{
WRAPPER_NO_CONTRACT;
- if (bit & TS_UserSuspendPending) {
- m_UserSuspendEvent.Reset();
- }
+
+ // CoreCLR does not support user-requested thread suspension
+ _ASSERTE(!(bit & TS_UserSuspendPending));
+
+
if (bit & TS_DebugSuspendPending) {
m_DebugSuspendEvent.Reset();
}
@@ -3731,8 +3751,14 @@ private:
//
ThreadState oldState = m_State;
+ // CoreCLR does not support user-requested thread suspension
+ _ASSERTE(!(oldState & TS_UserSuspendPending));
+
while ((oldState & (TS_UserSuspendPending | TS_DebugSuspendPending)) == 0)
{
+ // CoreCLR does not support user-requested thread suspension
+ _ASSERTE(!(oldState & TS_UserSuspendPending));
+
//
// Construct the destination state we desire - all suspension bits turned off.
//
@@ -3751,9 +3777,8 @@ private:
oldState = m_State;
}
- if (bit & TS_UserSuspendPending) {
- m_UserSuspendEvent.Set();
- }
+ // CoreCLR does not support user-requested thread suspension
+ _ASSERTE(!(bit & TS_UserSuspendPending));
if (bit & TS_DebugSuspendPending) {
m_DebugSuspendEvent.Set();
@@ -3761,10 +3786,6 @@ private:
}
- // For getting a thread to a safe point. A client waits on the event, which is
- // set by the thread when it reaches a safe spot.
- void SetSafeEvent();
-
public:
FORCEINLINE void UnhijackThreadNoAlloc()
{
@@ -3885,8 +3906,6 @@ public:
private:
// For suspends:
- CLREvent m_SafeEvent;
- CLREvent m_UserSuspendEvent;
CLREvent m_DebugSuspendEvent;
// For Object::Wait, Notify and NotifyAll, we use an Event inside the
@@ -5230,6 +5249,9 @@ private:
// Disables pumping and thread join in RCW creation
bool m_fDisableComObjectEagerCleanup;
+ // See ThreadStore::TriggerGCForDeadThreadsIfNecessary()
+ bool m_fHasDeadThreadBeenConsideredForGCTrigger;
+
private:
CLRRandom m_random;
@@ -5516,6 +5538,8 @@ private:
LONG m_PendingThreadCount;
LONG m_DeadThreadCount;
+ LONG m_DeadThreadCountForGCTrigger;
+ bool m_TriggerGCForDeadThreads;
private:
// Space for the lazily-created GUID.
@@ -5528,6 +5552,11 @@ private:
Thread *m_HoldingThread;
EEThreadId m_holderthreadid; // current holder (or NULL)
+private:
+ static LONG s_DeadThreadCountThresholdForGCTrigger;
+ static DWORD s_DeadThreadGCTriggerPeriodMilliseconds;
+ static SIZE_T *s_DeadThreadGenerationCounts;
+
public:
static BOOL HoldingThreadStore()
@@ -5601,6 +5630,14 @@ public:
LIMITED_METHOD_CONTRACT;
s_pWaitForStackCrawlEvent->Reset();
}
+
+private:
+ void IncrementDeadThreadCountForGCTrigger();
+ void DecrementDeadThreadCountForGCTrigger();
+public:
+ void OnMaxGenerationGCStarted();
+ bool ShouldTriggerGCForDeadThreads();
+ void TriggerGCForDeadThreadsIfNecessary();
};
struct TSSuspendHelper {
diff --git a/src/vm/threadsuspend.cpp b/src/vm/threadsuspend.cpp
index 52c4aa62c3..ab1f2bbff5 100644
--- a/src/vm/threadsuspend.cpp
+++ b/src/vm/threadsuspend.cpp
@@ -1978,6 +1978,9 @@ LRetry:
m_dwAbortPoint = 7;
#endif
+ // CoreCLR does not support user-requested thread suspension
+ _ASSERTE(!(m_State & TS_UserSuspendPending));
+
//
// If it's stopped by the debugger, we don't want to throw an exception.
// Debugger suspension is to have no effect of the runtime behaviour.
@@ -3090,6 +3093,9 @@ void Thread::RareDisablePreemptiveGC()
goto Exit;
}
+ // CoreCLR does not support user-requested thread suspension
+ _ASSERTE(!(m_State & TS_UserSuspendPending));
+
// Note IsGCInProgress is also true for say Pause (anywhere SuspendEE happens) and GCThread is the
// thread that did the Pause. While in Pause if another thread attempts Rev/Pinvoke it should get inside the following and
// block until resume
@@ -3105,6 +3111,9 @@ void Thread::RareDisablePreemptiveGC()
do
{
+ // CoreCLR does not support user-requested thread suspension
+ _ASSERTE(!(m_State & TS_UserSuspendPending));
+
EnablePreemptiveGC();
// Cannot use GCX_PREEMP_NO_DTOR here because we're inside of the thread
@@ -3495,7 +3504,11 @@ void Thread::PerformPreemptiveGC()
{
GCX_COOP();
m_bGCStressing = TRUE;
- GCHeapUtilities::GetGCHeap()->StressHeap();
+
+ // BUG(github #10318) - when not using allocation contexts, the alloc lock
+ // must be acquired here. Until fixed, this assert prevents random heap corruption.
+ _ASSERTE(GCHeapUtilities::UseThreadAllocationContexts());
+ GCHeapUtilities::GetGCHeap()->StressHeap(GetThread()->GetAllocContext());
m_bGCStressing = FALSE;
}
m_GCOnTransitionsOK = TRUE;
@@ -3554,7 +3567,6 @@ void Thread::RareEnablePreemptiveGC()
#endif // FEATURE_HIJACK
// wake up any threads waiting to suspend us, like the GC thread.
- SetSafeEvent();
ThreadSuspend::g_pGCSuspendEvent->Set();
// for GC, the fact that we are leaving the EE means that it no longer needs to
@@ -3562,6 +3574,9 @@ void Thread::RareEnablePreemptiveGC()
// Give the debugger precedence over user suspensions:
while (m_State & (TS_DebugSuspendPending | TS_UserSuspendPending))
{
+ // CoreCLR does not support user-requested thread suspension
+ _ASSERTE(!(m_State & TS_UserSuspendPending));
+
#ifdef DEBUGGING_SUPPORTED
// We don't notify the debugger that this thread is now suspended. We'll just
// let the debugger's helper thread sweep and pick it up.
@@ -3899,13 +3914,6 @@ void __stdcall Thread::RedirectedHandledJITCase(RedirectReason reason)
// Enable PGC before calling out to the client to allow runtime suspend to finish
GCX_PREEMP_NO_DTOR();
- // <REVISIT_TODO>@TODO: Is this necessary? Does debugger wait on the events, or does it just
- // poll every so often?</REVISIT_TODO>
- // Notify the thread that is performing the suspension that this thread
- // is now in PGC mode and that it can remove this thread from the list of
- // threads it needs to wait for.
- pThread->SetSafeEvent();
-
// Notify the interface of the pending suspension
switch (reason) {
case RedirectReason_GCSuspension:
@@ -6012,20 +6020,6 @@ void Thread::SysResumeFromDebug(AppDomain *pAppDomain)
LOG((LF_CORDB, LL_INFO1000, "RESUME: resume complete. Trap count: %d\n", g_TrapReturningThreads.Load()));
}
-
-
-void Thread::SetSafeEvent()
-{
- CONTRACTL {
- NOTHROW;
- GC_NOTRIGGER;
- }
- CONTRACTL_END;
-
- m_SafeEvent.Set();
-}
-
-
/*
*
* WaitSuspendEventsHelper
@@ -6052,28 +6046,10 @@ BOOL Thread::WaitSuspendEventsHelper(void)
EX_TRY {
- if (m_State & TS_UserSuspendPending) {
+ // CoreCLR does not support user-requested thread suspension
+ _ASSERTE(!(m_State & TS_UserSuspendPending));
- ThreadState oldState = m_State;
-
- while (oldState & TS_UserSuspendPending) {
-
- ThreadState newState = (ThreadState)(oldState | TS_SyncSuspended);
- if (FastInterlockCompareExchange((LONG *)&m_State, newState, oldState) == (LONG)oldState)
- {
- result = m_UserSuspendEvent.Wait(INFINITE,FALSE);
-#if _DEBUG
- newState = m_State;
- _ASSERTE(!(newState & TS_SyncSuspended) || (newState & TS_DebugSuspendPending));
-#endif
- break;
- }
-
- oldState = m_State;
- }
-
-
- } else if (m_State & TS_DebugSuspendPending) {
+ if (m_State & TS_DebugSuspendPending) {
ThreadState oldState = m_State;
@@ -6123,6 +6099,9 @@ void Thread::WaitSuspendEvents(BOOL fDoWait)
ThreadState oldState = m_State;
+ // CoreCLR does not support user-requested thread suspension
+ _ASSERTE(!(oldState & TS_UserSuspendPending));
+
//
// If all reasons to suspend are off, we think we can exit
// this loop, but we need to check atomically.
@@ -7102,9 +7081,9 @@ void Thread::MarkForSuspension(ULONG bit)
}
CONTRACTL_END;
+ // CoreCLR does not support user-requested thread suspension
_ASSERTE(bit == TS_DebugSuspendPending ||
- bit == (TS_DebugSuspendPending | TS_DebugWillSync) ||
- bit == TS_UserSuspendPending);
+ bit == (TS_DebugSuspendPending | TS_DebugWillSync));
_ASSERTE(IsAtProcessExit() || ThreadStore::HoldingThreadStore());
@@ -7122,8 +7101,8 @@ void Thread::UnmarkForSuspension(ULONG mask)
}
CONTRACTL_END;
- _ASSERTE(mask == ~TS_DebugSuspendPending ||
- mask == ~TS_UserSuspendPending);
+ // CoreCLR does not support user-requested thread suspension
+ _ASSERTE(mask == ~TS_DebugSuspendPending);
_ASSERTE(IsAtProcessExit() || ThreadStore::HoldingThreadStore());
@@ -7185,7 +7164,7 @@ void ThreadSuspend::RestartEE(BOOL bFinishedGC, BOOL SuspendSucceded)
// Revert to being a normal thread
//
ClrFlsClearThreadType (ThreadType_DynamicSuspendEE);
- GCHeapUtilities::GetGCHeap()->SetGCInProgress(FALSE);
+ GCHeapUtilities::GetGCHeap()->SetGCInProgress(false);
//
// Allow threads to enter COOP mode (though we still need to wake the ones
@@ -7353,7 +7332,7 @@ retry_for_debugger:
// It seems like much of the above is redundant. We should investigate reducing the number
// of mechanisms we use to indicate that a suspension is in progress.
//
- GCHeapUtilities::GetGCHeap()->SetGCInProgress(TRUE);
+ GCHeapUtilities::GetGCHeap()->SetGCInProgress(true);
//
// Gratuitous memory barrier. (may be needed - but I'm not sure why.)
diff --git a/src/vm/tieredcompilation.cpp b/src/vm/tieredcompilation.cpp
new file mode 100644
index 0000000000..2032e66f1b
--- /dev/null
+++ b/src/vm/tieredcompilation.cpp
@@ -0,0 +1,377 @@
+// 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.
+// ===========================================================================
+// File: TieredCompilation.CPP
+//
+// ===========================================================================
+
+
+
+#include "common.h"
+#include "excep.h"
+#include "log.h"
+#include "win32threadpool.h"
+#include "tieredcompilation.h"
+
+// TieredCompilationManager determines which methods should be recompiled and
+// how they should be recompiled to best optimize the running code. It then
+// handles logistics of getting new code created and installed.
+//
+//
+// # Current feature state
+//
+// This feature is incomplete and currently experimental. To enable it
+// you need to set COMPLUS_EXPERIMENTAL_TieredCompilation = 1. When the environment
+// variable is unset the runtime should work as normal, but when it is set there are
+// anticipated incompatibilities and limited cross cutting test coverage so far.
+// Profiler - Anticipated incompatible with ReJIT, untested in general
+// ETW - Anticipated incompatible with the ReJIT id of the MethodJitted rundown events
+// Managed debugging - Anticipated incompatible with breakpoints/stepping that are
+// active when a method is recompiled.
+//
+//
+// Testing that has been done so far largely consists of regression testing with
+// the environment variable off + functional/perf testing of the Music Store ASP.Net
+// workload as a basic example that the feature can work. Running the coreclr repo
+// tests with the env var on generates about a dozen failures in JIT tests. The issues
+// are likely related to assertions about optimization behavior but haven't been
+// properly investigated yet.
+//
+// If you decide to try this out on a new workload and run into trouble a quick note
+// on github is appreciated but this code may have high churn for a while to come and
+// there will be no sense investing a lot of time investigating only to have it rendered
+// moot by changes. I aim to keep this comment updated as things change.
+//
+//
+// # Important entrypoints in this code:
+//
+//
+// a) .ctor and Init(...) - called once during AppDomain initialization
+// b) OnMethodCalled(...) - called when a method is being invoked. When a method
+// has been called enough times this is currently the only
+// trigger that initiates re-compilation.
+// c) OnAppDomainShutdown() - called during AppDomain::Exit() to begin the process
+// of stopping tiered compilation. After this point no more
+// background optimization work will be initiated but in-progress
+// work still needs to complete.
+//
+// # Overall workflow
+//
+// Methods initially call into OnMethodCalled() and once the call count exceeds
+// a fixed limit we queue work on to our internal list of methods needing to
+// be recompiled (m_methodsToOptimize). If there is currently no thread
+// servicing our queue asynchronously then we use the runtime threadpool
+// QueueUserWorkItem to recruit one. During the callback for each threadpool work
+// item we handle as many methods as possible in a fixed period of time, then
+// queue another threadpool work item if m_methodsToOptimize hasn't been drained.
+//
+// The background thread enters at StaticOptimizeMethodsCallback(), enters the
+// appdomain, and then begins calling OptimizeMethod on each method in the
+// queue. For each method we jit it, then update the precode so that future
+// entrypoint callers will run the new code.
+//
+// # Error handling
+//
+// The overall principle is don't swallow terminal failures that may have corrupted the
+// process (AV for example), but otherwise for any transient issue or functional limitation
+// that prevents us from optimizing log it for diagnostics and then back out gracefully,
+// continuing to run the less optimal code. The feature should be constructed so that
+// errors are limited to OS resource exhaustion or poorly behaved managed code
+// (for example within an AssemblyResolve event or static constructor triggered by the JIT).
+
+#ifdef FEATURE_TIERED_COMPILATION
+
+// Called at AppDomain construction
+TieredCompilationManager::TieredCompilationManager() :
+ m_isAppDomainShuttingDown(FALSE),
+ m_countOptimizationThreadsRunning(0),
+ m_callCountOptimizationThreshhold(30),
+ m_optimizationQuantumMs(50)
+{
+ LIMITED_METHOD_CONTRACT;
+ m_lock.Init(LOCK_TYPE_DEFAULT);
+}
+
+// Called at AppDomain Init
+void TieredCompilationManager::Init(ADID appDomainId)
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CAN_TAKE_LOCK;
+ MODE_PREEMPTIVE;
+ }
+ CONTRACTL_END;
+
+ SpinLockHolder holder(&m_lock);
+ m_domainId = appDomainId;
+}
+
+// Called each time code in this AppDomain has been run. This is our sole entrypoint to begin
+// tiered compilation for now. Returns TRUE if no more notifications are necessary, but
+// more notifications may come anyways.
+//
+// currentCallCount is pre-incremented, that is to say the value is 1 on first call for a given
+// method.
+BOOL TieredCompilationManager::OnMethodCalled(MethodDesc* pMethodDesc, DWORD currentCallCount)
+{
+ STANDARD_VM_CONTRACT;
+
+ if (currentCallCount < m_callCountOptimizationThreshhold)
+ {
+ return FALSE; // continue notifications for this method
+ }
+ else if (currentCallCount > m_callCountOptimizationThreshhold)
+ {
+ return TRUE; // stop notifications for this method
+ }
+
+ // Insert the method into the optimization queue and trigger a thread to service
+ // the queue if needed.
+ //
+ // Terminal exceptions escape as exceptions, but all other errors should gracefully
+ // return to the caller. Non-terminal error conditions should be rare (ie OOM,
+ // OS failure to create thread) and we consider it reasonable for some methods
+ // to go unoptimized or have their optimization arbitrarily delayed under these
+ // circumstances. Note an error here could affect concurrent threads running this
+ // code. Those threads will observe m_countOptimizationThreadsRunning > 0 and return,
+ // then QueueUserWorkItem fails on this thread lowering the count and leaves them
+ // unserviced. Synchronous retries appear unlikely to offer any material improvement
+ // and complicating the code to narrow an already rare error case isn't desirable.
+ {
+ SListElem<MethodDesc*>* pMethodListItem = new (nothrow) SListElem<MethodDesc*>(pMethodDesc);
+ SpinLockHolder holder(&m_lock);
+ if (pMethodListItem != NULL)
+ {
+ m_methodsToOptimize.InsertTail(pMethodListItem);
+ }
+
+ if (0 == m_countOptimizationThreadsRunning && !m_isAppDomainShuttingDown)
+ {
+ // Our current policy throttles at 1 thread, but in the future we
+ // could experiment with more parallelism.
+ m_countOptimizationThreadsRunning++;
+ }
+ else
+ {
+ return TRUE; // stop notifications for this method
+ }
+ }
+
+ EX_TRY
+ {
+ if (!ThreadpoolMgr::QueueUserWorkItem(StaticOptimizeMethodsCallback, this, QUEUE_ONLY, TRUE))
+ {
+ SpinLockHolder holder(&m_lock);
+ m_countOptimizationThreadsRunning--;
+ STRESS_LOG1(LF_TIEREDCOMPILATION, LL_WARNING, "TieredCompilationManager::OnMethodCalled: "
+ "ThreadpoolMgr::QueueUserWorkItem returned FALSE (no thread will run), method=%pM\n",
+ pMethodDesc);
+ }
+ }
+ EX_CATCH
+ {
+ SpinLockHolder holder(&m_lock);
+ m_countOptimizationThreadsRunning--;
+ STRESS_LOG2(LF_TIEREDCOMPILATION, LL_WARNING, "TieredCompilationManager::OnMethodCalled: "
+ "Exception queuing work item to threadpool, hr=0x%x, method=%pM\n",
+ GET_EXCEPTION()->GetHR(), pMethodDesc);
+ }
+ EX_END_CATCH(RethrowTerminalExceptions);
+
+ return TRUE; // stop notifications for this method
+}
+
+void TieredCompilationManager::OnAppDomainShutdown()
+{
+ SpinLockHolder holder(&m_lock);
+ m_isAppDomainShuttingDown = TRUE;
+}
+
+// This is the initial entrypoint for the background thread, called by
+// the threadpool.
+DWORD WINAPI TieredCompilationManager::StaticOptimizeMethodsCallback(void *args)
+{
+ STANDARD_VM_CONTRACT;
+
+ TieredCompilationManager * pTieredCompilationManager = (TieredCompilationManager *)args;
+ pTieredCompilationManager->OptimizeMethodsCallback();
+
+ return 0;
+}
+
+//This method will process one or more methods from optimization queue
+// on a background thread. Each such method will be jitted with code
+// optimizations enabled and then installed as the active implementation
+// of the method entrypoint.
+//
+// We need to be carefuly not to work for too long in a single invocation
+// of this method or we could starve the threadpool and force
+// it to create unnecessary additional threads.
+void TieredCompilationManager::OptimizeMethodsCallback()
+{
+ STANDARD_VM_CONTRACT;
+
+ // This app domain shutdown check isn't required for correctness
+ // but it should reduce some unneeded exceptions trying
+ // to enter a closed AppDomain
+ {
+ SpinLockHolder holder(&m_lock);
+ if (m_isAppDomainShuttingDown)
+ {
+ m_countOptimizationThreadsRunning--;
+ return;
+ }
+ }
+
+ ULONGLONG startTickCount = CLRGetTickCount64();
+ MethodDesc* pMethod = NULL;
+ EX_TRY
+ {
+ ENTER_DOMAIN_ID(m_domainId);
+ {
+ while (true)
+ {
+ {
+ SpinLockHolder holder(&m_lock);
+ pMethod = GetNextMethodToOptimize();
+ if (pMethod == NULL ||
+ m_isAppDomainShuttingDown)
+ {
+ m_countOptimizationThreadsRunning--;
+ break;
+ }
+
+ }
+ OptimizeMethod(pMethod);
+
+ // If we have been running for too long return the thread to the threadpool and queue another event
+ // This gives the threadpool a chance to service other requests on this thread before returning to
+ // this work.
+ ULONGLONG currentTickCount = CLRGetTickCount64();
+ if (currentTickCount >= startTickCount + m_optimizationQuantumMs)
+ {
+ if (!ThreadpoolMgr::QueueUserWorkItem(StaticOptimizeMethodsCallback, this, QUEUE_ONLY, TRUE))
+ {
+ SpinLockHolder holder(&m_lock);
+ m_countOptimizationThreadsRunning--;
+ STRESS_LOG0(LF_TIEREDCOMPILATION, LL_WARNING, "TieredCompilationManager::OptimizeMethodsCallback: "
+ "ThreadpoolMgr::QueueUserWorkItem returned FALSE (no thread will run)\n");
+ }
+ break;
+ }
+ }
+ }
+ END_DOMAIN_TRANSITION;
+ }
+ EX_CATCH
+ {
+ STRESS_LOG2(LF_TIEREDCOMPILATION, LL_ERROR, "TieredCompilationManager::OptimizeMethodsCallback: "
+ "Unhandled exception during method optimization, hr=0x%x, last method=%pM\n",
+ GET_EXCEPTION()->GetHR(), pMethod);
+ }
+ EX_END_CATCH(RethrowTerminalExceptions);
+}
+
+// Jit compiles and installs new optimized code for a method.
+// Called on a background thread.
+void TieredCompilationManager::OptimizeMethod(MethodDesc* pMethod)
+{
+ STANDARD_VM_CONTRACT;
+
+ _ASSERTE(pMethod->IsEligibleForTieredCompilation());
+ PCODE pJittedCode = CompileMethod(pMethod);
+ if (pJittedCode != NULL)
+ {
+ InstallMethodCode(pMethod, pJittedCode);
+ }
+}
+
+// Compiles new optimized code for a method.
+// Called on a background thread.
+PCODE TieredCompilationManager::CompileMethod(MethodDesc* pMethod)
+{
+ STANDARD_VM_CONTRACT;
+
+ PCODE pCode = NULL;
+ ULONG sizeOfCode = 0;
+ EX_TRY
+ {
+ CORJIT_FLAGS flags = CORJIT_FLAGS(CORJIT_FLAGS::CORJIT_FLAG_MCJIT_BACKGROUND);
+ flags.Add(CORJIT_FLAGS(CORJIT_FLAGS::CORJIT_FLAG_TIER1));
+
+ if (pMethod->IsDynamicMethod())
+ {
+ ILStubResolver* pResolver = pMethod->AsDynamicMethodDesc()->GetILStubResolver();
+ flags.Add(pResolver->GetJitFlags());
+ COR_ILMETHOD_DECODER* pILheader = pResolver->GetILHeader();
+ pCode = UnsafeJitFunction(pMethod, pILheader, flags, &sizeOfCode);
+ }
+ else
+ {
+ COR_ILMETHOD_DECODER::DecoderStatus status;
+ COR_ILMETHOD_DECODER header(pMethod->GetILHeader(), pMethod->GetModule()->GetMDImport(), &status);
+ pCode = UnsafeJitFunction(pMethod, &header, flags, &sizeOfCode);
+ }
+ }
+ EX_CATCH
+ {
+ // Failing to jit should be rare but acceptable. We will leave whatever code already exists in place.
+ STRESS_LOG2(LF_TIEREDCOMPILATION, LL_INFO10, "TieredCompilationManager::CompileMethod: Method %pM failed to jit, hr=0x%x\n",
+ pMethod, GET_EXCEPTION()->GetHR());
+ }
+ EX_END_CATCH(RethrowTerminalExceptions)
+
+ return pCode;
+}
+
+// Updates the MethodDesc and precode so that future invocations of a method will
+// execute the native code pointed to by pCode.
+// Called on a background thread.
+void TieredCompilationManager::InstallMethodCode(MethodDesc* pMethod, PCODE pCode)
+{
+ STANDARD_VM_CONTRACT;
+
+ _ASSERTE(!pMethod->IsNativeCodeStableAfterInit());
+
+ PCODE pExistingCode = pMethod->GetNativeCode();
+ if (!pMethod->SetNativeCodeInterlocked(pCode, pExistingCode))
+ {
+ //We aren't there yet, but when the feature is finished we shouldn't be racing against any other code mutator and there would be no
+ //reason for this to fail
+ STRESS_LOG2(LF_TIEREDCOMPILATION, LL_INFO10, "TieredCompilationManager::InstallMethodCode: Method %pM failed to update native code slot. Code=%pK\n",
+ pMethod, pCode);
+ }
+ else
+ {
+ Precode* pPrecode = pMethod->GetPrecode();
+ if (!pPrecode->SetTargetInterlocked(pCode, FALSE))
+ {
+ //We aren't there yet, but when the feature is finished we shouldn't be racing against any other code mutator and there would be no
+ //reason for this to fail
+ STRESS_LOG2(LF_TIEREDCOMPILATION, LL_INFO10, "TieredCompilationManager::InstallMethodCode: Method %pM failed to update precode. Code=%pK\n",
+ pMethod, pCode);
+ }
+ }
+}
+
+// Dequeues the next method in the optmization queue.
+// This should be called with m_lock already held and runs
+// on the background thread.
+MethodDesc* TieredCompilationManager::GetNextMethodToOptimize()
+{
+ STANDARD_VM_CONTRACT;
+
+ SListElem<MethodDesc*>* pElem = m_methodsToOptimize.RemoveHead();
+ if (pElem != NULL)
+ {
+ MethodDesc* pMD = pElem->GetValue();
+ delete pElem;
+ return pMD;
+ }
+ return NULL;
+}
+
+#endif // FEATURE_TIERED_COMPILATION
diff --git a/src/vm/tieredcompilation.h b/src/vm/tieredcompilation.h
new file mode 100644
index 0000000000..71236c5374
--- /dev/null
+++ b/src/vm/tieredcompilation.h
@@ -0,0 +1,51 @@
+// 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.
+// ===========================================================================
+// File: TieredCompilation.h
+//
+// ===========================================================================
+
+
+#ifndef TIERED_COMPILATION_H
+#define TIERED_COMPILATION_H
+
+#ifdef FEATURE_TIERED_COMPILATION
+
+// TieredCompilationManager determines which methods should be recompiled and
+// how they should be recompiled to best optimize the running code. It then
+// handles logistics of getting new code created and installed.
+class TieredCompilationManager
+{
+public:
+#if defined(DACCESS_COMPILE) || defined(CROSSGEN_COMPILE)
+ TieredCompilationManager() {}
+#else
+ TieredCompilationManager();
+#endif
+
+ void Init(ADID appDomainId);
+ BOOL OnMethodCalled(MethodDesc* pMethodDesc, DWORD currentCallCount);
+ void OnAppDomainShutdown();
+
+private:
+
+ static DWORD StaticOptimizeMethodsCallback(void* args);
+ void OptimizeMethodsCallback();
+ void OptimizeMethod(MethodDesc* pMethod);
+ MethodDesc* GetNextMethodToOptimize();
+ PCODE CompileMethod(MethodDesc* pMethod);
+ void InstallMethodCode(MethodDesc* pMethod, PCODE pCode);
+
+ SpinLock m_lock;
+ SList<SListElem<MethodDesc*>> m_methodsToOptimize;
+ ADID m_domainId;
+ BOOL m_isAppDomainShuttingDown;
+ DWORD m_countOptimizationThreadsRunning;
+ DWORD m_callCountOptimizationThreshhold;
+ DWORD m_optimizationQuantumMs;
+};
+
+#endif // FEATURE_TIERED_COMPILATION
+
+#endif // TIERED_COMPILATION_H
diff --git a/src/zap/zapimage.cpp b/src/zap/zapimage.cpp
index 457b82e1fd..cb69ba9f96 100644
--- a/src/zap/zapimage.cpp
+++ b/src/zap/zapimage.cpp
@@ -1089,14 +1089,14 @@ HANDLE ZapImage::SaveImage(LPCWSTR wszOutputFileName, CORCOMPILE_NGEN_SIGNATURE
OutputTables();
- // Create a empty export table. This makes tools like symchk not think
- // that native images are resoure-only DLLs. It is important to NOT
- // be a resource-only DLL because those DLL's PDBS are not put up on the
- // symbol server and we want NEN PDBS to be placed there.
- ZapPEExports* exports = new(GetHeap()) ZapPEExports(wszOutputFileName);
- m_pDebugSection->Place(exports);
- SetDirectoryEntry(IMAGE_DIRECTORY_ENTRY_EXPORT, exports);
-
+ // Create a empty export table. This makes tools like symchk not think
+ // that native images are resoure-only DLLs. It is important to NOT
+ // be a resource-only DLL because those DLL's PDBS are not put up on the
+ // symbol server and we want NEN PDBS to be placed there.
+ ZapPEExports* exports = new(GetHeap()) ZapPEExports(wszOutputFileName);
+ m_pDebugSection->Place(exports);
+ SetDirectoryEntry(IMAGE_DIRECTORY_ENTRY_EXPORT, exports);
+
ComputeRVAs();
if (!IsReadyToRunCompilation())
@@ -1588,13 +1588,53 @@ ZapImage::CompileStatus ZapImage::CompileProfileDataWorker(mdToken token, unsign
return TryCompileMethodDef(token, methodProfilingDataFlags);
}
-void ZapImage::CompileProfileData()
+// ProfileDisableInlining
+// Before we start compiling any methods we may need to suppress the inlining
+// of certain methods based upon our profile data.
+// This method will arrange to disable this inlining.
+//
+void ZapImage::ProfileDisableInlining()
{
+ // We suppress the inlining of any Hot methods that have the ExcludeHotMethodCode flag.
+ // We want such methods to be Jitted at runtime rather than compiled in the AOT native image.
+ // The inlining of such a method also need to be suppressed.
+ //
+ ProfileDataSection* methodProfileData = &(m_profileDataSections[MethodProfilingData]);
+ if (methodProfileData->tableSize > 0)
+ {
+ for (DWORD i = 0; i < methodProfileData->tableSize; i++)
+ {
+ CORBBTPROF_TOKEN_INFO * pTokenInfo = &(methodProfileData->pTable[i]);
+ unsigned methodProfilingDataFlags = pTokenInfo->flags;
+
+ // Hot methods can be marked to be excluded from the AOT native image.
+ // We also need to disable inlining of such methods.
+ //
+ if ((methodProfilingDataFlags & (1 << DisableInlining)) != 0)
+ {
+ // Disable the inlining of this method
+ //
+ // @ToDo: Figure out how to disable inlining for this method.
+ }
+ }
+ }
+}
+
+// CompileHotRegion
+// Performs the compilation and placement for all methods in the the "Hot" code region
+// Methods placed in this region typically correspond to all of the methods that were
+// executed during any of the profiling scenarios.
+//
+void ZapImage::CompileHotRegion()
+{
+ // Compile all of the methods that were executed during profiling into the "Hot" code region.
+ //
BeginRegion(CORINFO_REGION_HOT);
CorProfileData* pProfileData = GetProfileData();
- if (m_profileDataSections[MethodProfilingData].tableSize > 0)
+ ProfileDataSection* methodProfileData = &(m_profileDataSections[MethodProfilingData]);
+ if (methodProfileData->tableSize > 0)
{
// record the start of hot IBC methods.
m_iIBCMethod = m_MethodCompilationOrder.GetCount();
@@ -1602,19 +1642,21 @@ void ZapImage::CompileProfileData()
//
// Compile the hot methods in the order specified in the MethodProfilingData
//
- for (DWORD i = 0; i < m_profileDataSections[MethodProfilingData].tableSize; i++)
+ for (DWORD i = 0; i < methodProfileData->tableSize; i++)
{
- unsigned methodProfilingDataFlags = m_profileDataSections[MethodProfilingData].pTable[i].flags;
- _ASSERTE(methodProfilingDataFlags != 0);
+ CompileStatus compileResult = NOT_COMPILED;
+ CORBBTPROF_TOKEN_INFO * pTokenInfo = &(methodProfileData->pTable[i]);
- mdToken token = m_profileDataSections[MethodProfilingData].pTable[i].token;
+ mdToken token = pTokenInfo->token;
+ unsigned methodProfilingDataFlags = pTokenInfo->flags;
+ _ASSERTE(methodProfilingDataFlags != 0);
if (TypeFromToken(token) == mdtMethodDef)
{
//
// Compile a non-generic method
//
- CompileProfileDataWorker(token, methodProfilingDataFlags);
+ compileResult = CompileProfileDataWorker(token, methodProfilingDataFlags);
}
else if (TypeFromToken(token) == ibcMethodSpec)
{
@@ -1638,10 +1680,14 @@ void ZapImage::CompileProfileData()
{
m_pPreloader->AddMethodToTransitiveClosureOfInstantiations(pMethod);
- TryCompileInstantiatedMethod(pMethod, methodProfilingDataFlags);
+ compileResult = TryCompileInstantiatedMethod(pMethod, methodProfilingDataFlags);
}
}
}
+
+ // Update the 'flags' and 'compileResult' saved in the profileDataHashTable hash table.
+ //
+ hashBBUpdateFlagsAndCompileResult(token, methodProfilingDataFlags, compileResult);
}
// record the start of hot Generics methods.
m_iGenericsMethod = m_MethodCompilationOrder.GetCount();
@@ -1653,72 +1699,92 @@ void ZapImage::CompileProfileData()
EndRegion(CORINFO_REGION_HOT);
}
-void ZapImage::Compile()
+// CompileColdRegion
+// Performs the compilation and placement for all methods in the the "Cold" code region
+// Methods placed in this region typically correspond to all of the methods that were
+// NOT executed during any of the profiling scenarios.
+//
+void ZapImage::CompileColdRegion()
{
+ // Compile all of the methods that were NOT executed during profiling into the "Cold" code region.
//
- // First, compile methods in the load order array.
- //
- bool doNothingNgen = false;
-#ifdef _DEBUG
- static ConfigDWORD fDoNothingNGen;
- doNothingNgen = !!fDoNothingNGen.val(CLRConfig::INTERNAL_ZapDoNothing);
-#endif
- if (!doNothingNgen)
+ BeginRegion(CORINFO_REGION_COLD);
+
+ IMDInternalImport * pMDImport = m_pMDImport;
+
+ HENUMInternalHolder hEnum(pMDImport);
+ hEnum.EnumAllInit(mdtMethodDef);
+
+ mdMethodDef md;
+ while (pMDImport->EnumNext(&hEnum, &md))
{
//
- // Compile the methods specified by the IBC profile data
- //
- CompileProfileData();
-
- BeginRegion(CORINFO_REGION_COLD);
-
-
- IMDInternalImport * pMDImport = m_pMDImport;
-
- HENUMInternalHolder hEnum(pMDImport);
- hEnum.EnumAllInit(mdtMethodDef);
-
- mdMethodDef md;
- while (pMDImport->EnumNext(&hEnum, &md))
- {
- if (m_pILMetaData != NULL)
- {
- // Copy IL for all methods. We treat errors during copying IL
- // over as fatal error. These errors are typically caused by
- // corrupted IL images.
- //
- m_pILMetaData->EmitMethodIL(md);
- }
+ // Compile the remaining methods that weren't compiled during the CompileHotRegion phase
+ //
+ TryCompileMethodDef(md, 0);
+ }
- //
- // Compile the remaining methods that weren't compiled during the CompileProfileData phase
- //
- TryCompileMethodDef(md, 0);
- }
+ // Compile any generic code which lands in this LoaderModule
+ // that resulted from the above compilations
+ CORINFO_METHOD_HANDLE handle = m_pPreloader->NextUncompiledMethod();
+ while (handle != NULL)
+ {
+ TryCompileInstantiatedMethod(handle, 0);
+ handle = m_pPreloader->NextUncompiledMethod();
+ }
+
+ EndRegion(CORINFO_REGION_COLD);
+}
- // Compile any generic code which lands in this LoaderModule
- // that resulted from the above compilations
- CORINFO_METHOD_HANDLE handle = m_pPreloader->NextUncompiledMethod();
- while (handle != NULL)
+// PlaceMethodIL
+// Copy the IL for all method into the AOT native image
+//
+void ZapImage::PlaceMethodIL()
+{
+ // Place the IL for all of the methods
+ //
+ IMDInternalImport * pMDImport = m_pMDImport;
+ HENUMInternalHolder hEnum(pMDImport);
+ hEnum.EnumAllInit(mdtMethodDef);
+
+ mdMethodDef md;
+ while (pMDImport->EnumNext(&hEnum, &md))
+ {
+ if (m_pILMetaData != NULL)
{
- TryCompileInstantiatedMethod(handle, 0);
- handle = m_pPreloader->NextUncompiledMethod();
+ // Copy IL for all methods. We treat errors during copying IL
+ // over as fatal error. These errors are typically caused by
+ // corrupted IL images.
+ //
+ m_pILMetaData->EmitMethodIL(md);
}
+ }
+}
- EndRegion(CORINFO_REGION_COLD);
+void ZapImage::Compile()
+{
+ //
+ // Compile all of the methods for our AOT native image
+ //
- // If we want ngen to fail when we create partial ngen images we can
- // throw an NGEN failure HRESULT here.
-#if 0
- if (m_zapper->m_failed)
- {
- ThrowHR(NGEN_E_TP_PARTIAL_IMAGE);
- }
+ bool doNothingNgen = false;
+#ifdef _DEBUG
+ static ConfigDWORD fDoNothingNGen;
+ doNothingNgen = !!fDoNothingNGen.val(CLRConfig::INTERNAL_ZapDoNothing);
#endif
+ ProfileDisableInlining();
+
+ if (!doNothingNgen)
+ {
+ CompileHotRegion();
+
+ CompileColdRegion();
}
+ PlaceMethodIL();
+
// Compute a preferred class layout order based on analyzing the graph
// of which classes contain calls to other classes.
ComputeClassLayoutOrder();
@@ -2022,20 +2088,64 @@ ZapImage::CompileStatus ZapImage::TryCompileMethodWorker(CORINFO_METHOD_HANDLE h
}
#endif
+ // Do we have a profile entry for this method?
+ //
if (methodProfilingDataFlags != 0)
{
// Report the profiling data flags for layout of the EE datastructures
m_pPreloader->SetMethodProfilingFlags(handle, methodProfilingDataFlags);
- // Only proceed with compilation if the code is hot
+ // Hot methods can be marked to be excluded from the AOT native image.
+ // A Jitted method executes faster than a ReadyToRun compiled method.
+ //
+ if ((methodProfilingDataFlags & (1 << ExcludeHotMethodCode)) != 0)
+ {
+ // returning COMPILE_HOT_EXCLUDED excludes this method from the AOT native image
+ return COMPILE_HOT_EXCLUDED;
+ }
+
+ // Cold methods can be marked to be excluded from the AOT native image.
+ // We can reduced the size of the AOT native image by selectively
+ // excluding the code for some of the cold methods.
+ //
+ if ((methodProfilingDataFlags & (1 << ExcludeColdMethodCode)) != 0)
+ {
+ // returning COMPILE_COLD_EXCLUDED excludes this method from the AOT native image
+ return COMPILE_COLD_EXCLUDED;
+ }
+
+ // If the code was never executed based on the profile data
+ // then don't compile this method now. Wait until until later
+ // when we are compiling the methods in the cold section.
//
if ((methodProfilingDataFlags & (1 << ReadMethodCode)) == 0)
+ {
+ // returning NOT_COMPILED will defer until later the compilation of this method
return NOT_COMPILED;
+ }
}
- else
+ else // we are compiling methods for the cold region
{
+ // When Partial Ngen is specified we will omit the AOT native code for every
+ // method that was not executed based on the profile data.
+ //
if (m_zapper->m_pOpt->m_fPartialNGen)
- return COMPILE_EXCLUDED;
+ {
+ // returning COMPILE_COLD_EXCLUDED excludes this method from the AOT native image
+ return COMPILE_COLD_EXCLUDED;
+ }
+
+ // Retrieve any information that we have about a previous compilation attempt of this method
+ const ProfileDataHashEntry* pEntry = profileDataHashTable.LookupPtr(md);
+
+ if (pEntry != nullptr)
+ {
+ if ((pEntry->status == COMPILE_HOT_EXCLUDED) || (pEntry->status == COMPILE_COLD_EXCLUDED))
+ {
+ // returning COMPILE_HOT_EXCLUDED excludes this method from the AOT native image
+ return pEntry->status;
+ }
+ }
}
// Have we already compiled it?
@@ -3207,6 +3317,8 @@ HRESULT ZapImage::hashBBProfileData ()
READ(methodHeader,CORBBTPROF_METHOD_HEADER);
newEntry.md = methodHeader->method.token;
newEntry.size = methodHeader->size;
+ newEntry.flags = 0;
+ newEntry.status = NOT_COMPILED;
// Add the new entry to the table
profileDataHashTable.Add(newEntry);
@@ -3219,6 +3331,33 @@ HRESULT ZapImage::hashBBProfileData ()
return S_OK;
}
+void ZapImage::hashBBUpdateFlagsAndCompileResult(mdToken token, unsigned methodProfilingDataFlags, ZapImage::CompileStatus compileResult)
+{
+ // SHash only supports replacing an entry so we setup our newEntry and then perform a lookup
+ //
+ ProfileDataHashEntry newEntry;
+ newEntry.md = token;
+ newEntry.flags = methodProfilingDataFlags;
+ newEntry.status = compileResult;
+
+ const ProfileDataHashEntry* pEntry = profileDataHashTable.LookupPtr(token);
+ if (pEntry != nullptr)
+ {
+ assert(pEntry->md == newEntry.md);
+ assert(pEntry->flags == 0); // the flags should not be set at this point.
+
+ // Copy and keep the two fleids that were previously set
+ newEntry.size = pEntry->size;
+ newEntry.pos = pEntry->pos;
+ }
+ else // We have a method that doesn't have basic block counts
+ {
+ newEntry.size = 0;
+ newEntry.pos = 0;
+ }
+ profileDataHashTable.AddOrReplace(newEntry);
+}
+
void ZapImage::LoadProfileData()
{
HRESULT hr = E_FAIL;
diff --git a/src/zap/zapimage.h b/src/zap/zapimage.h
index f014fd249a..f0bcbcb033 100644
--- a/src/zap/zapimage.h
+++ b/src/zap/zapimage.h
@@ -336,12 +336,33 @@ private:
COUNT_T m_cRawProfileData;
CorProfileData * m_pCorProfileData;
- // ProfileData hash table
+public:
+ enum CompileStatus {
+ // Failure status values are negative
+ LOOKUP_FAILED = -2,
+ COMPILE_FAILED = -1,
+
+ // Info status values are [0..9]
+ NOT_COMPILED = 0,
+ COMPILE_EXCLUDED = 1,
+ COMPILE_HOT_EXCLUDED = 2,
+ COMPILE_COLD_EXCLUDED = 3,
+
+ // Successful status values are 10 or greater
+ COMPILE_SUCCEED = 10,
+ ALREADY_COMPILED = 11
+ };
+
+private:
+ // A hash table entry that contains the profile infomation and the CompileStatus for a given method
struct ProfileDataHashEntry
{
- mdMethodDef md; // A copy of the method.token of the profile data
- DWORD size; // A copy of the size of the profile data
- ULONG pos;
+ mdMethodDef md; // The method.token, also used as the key for the ProfileDataHashTable
+ DWORD size; // The size of the CORBBTPROF_BLOCK_DATA region, set by ZapImage::hashBBProfileData()
+ ULONG pos; // the offset to the CORBBTPROF_BLOCK_DATA region, set by ZapImage::hashBBProfileData()
+
+ unsigned flags; // The methodProfilingDataFlags, set by ZapImage::CompileHotRegion()
+ CompileStatus status; // The compileResult, set by ZapImage::CompileHotRegion()
};
class ProfileDataHashTraits : public NoRemoveSHashTraits< DefaultSHashTraits<ProfileDataHashEntry> >
@@ -365,8 +386,24 @@ private:
return (count_t)k;
}
- static const element_t Null() { LIMITED_METHOD_CONTRACT; ProfileDataHashEntry e; e.pos = 0; e.size = 0; e.md = 0; return e; } // Assuming method profile data cannot start from position 0.
- static bool IsNull(const element_t &e) { LIMITED_METHOD_CONTRACT; return e.pos == 0; }
+ static const element_t Null()
+ {
+ LIMITED_METHOD_CONTRACT;
+ ProfileDataHashEntry e;
+ e.md = 0;
+ e.size = 0;
+ e.pos = 0;
+ e.flags = 0;
+ e.status = NOT_COMPILED;
+ return e;
+ }
+
+ static bool IsNull(const element_t &e)
+ {
+ LIMITED_METHOD_CONTRACT;
+ // returns true if both md and pos are zero
+ return (e.md == 0) && (e.pos == 0);
+ }
};
typedef SHash<ProfileDataHashTraits> ProfileDataHashTable;
@@ -653,11 +690,6 @@ public:
return m_CompiledMethods.Lookup(handle);
}
-
- enum CompileStatus { LOOKUP_FAILED = -2, COMPILE_FAILED = -1, // Failure
- NOT_COMPILED = 0, COMPILE_EXCLUDED = 1, // Info
- COMPILE_SUCCEED = 10, ALREADY_COMPILED = 11}; // Success
-
static void __stdcall TryCompileMethodStub(LPVOID pContext, CORINFO_METHOD_HANDLE hStub, CORJIT_FLAGS jitFlags);
BOOL IsVTableGapMethod(mdMethodDef md);
@@ -813,6 +845,7 @@ public:
void RehydrateBlobStream();
HRESULT RehydrateProfileData();
HRESULT hashBBProfileData ();
+ void hashBBUpdateFlagsAndCompileResult(mdToken token, unsigned methodProfilingDataFlags, CompileStatus compileResult);
void LoadProfileData();
CorProfileData * NewProfileData();
@@ -820,7 +853,11 @@ public:
bool CanConvertIbcData();
CompileStatus CompileProfileDataWorker(mdToken token, unsigned methodProfilingDataFlags);
- void CompileProfileData();
+
+ void ProfileDisableInlining();
+ void CompileHotRegion();
+ void CompileColdRegion();
+ void PlaceMethodIL();
};
class BinaryWriter
diff --git a/src/zap/zapinfo.cpp b/src/zap/zapinfo.cpp
index e817e4459e..af0c41c4e4 100644
--- a/src/zap/zapinfo.cpp
+++ b/src/zap/zapinfo.cpp
@@ -1009,12 +1009,19 @@ HRESULT ZapInfo::getBBProfileData (
}
// The md must match.
- _ASSERTE(foundEntry->md == md);
+ _ASSERTE(foundEntry->md == md);
+ if (foundEntry->pos == 0)
+ {
+ // We might not have profile data and instead only have CompileStatus and flags
+ assert(foundEntry->size == 0);
+ return E_FAIL;
+ }
+
+ //
//
// We found the md. Let's retrieve the profile data.
//
- _ASSERTE(foundEntry->pos > 0); // The target position cannot be 0.
_ASSERTE(foundEntry->size >= sizeof(CORBBTPROF_METHOD_HEADER)); // The size must at least this
ProfileReader profileReader(DataSection_MethodBlockCounts->pData, DataSection_MethodBlockCounts->dataSize);
@@ -3500,14 +3507,14 @@ bool ZapInfo::getReadyToRunHelper(CORINFO_RESOLVED_TOKEN * pResolvedToken,
void ZapInfo::getReadyToRunDelegateCtorHelper(
CORINFO_RESOLVED_TOKEN * pTargetMethod,
CORINFO_CLASS_HANDLE delegateType,
- CORINFO_CONST_LOOKUP * pLookup
+ CORINFO_LOOKUP * pLookup
)
{
#ifdef FEATURE_READYTORUN_COMPILER
_ASSERTE(IsReadyToRunCompilation());
-
- pLookup->accessType = IAT_PVALUE;
- pLookup->addr = m_pImage->GetImportTable()->GetDynamicHelperCell(
+ pLookup->lookupKind.needsRuntimeLookup = false;
+ pLookup->constLookup.accessType = IAT_PVALUE;
+ pLookup->constLookup.addr = m_pImage->GetImportTable()->GetDynamicHelperCell(
(CORCOMPILE_FIXUP_BLOB_KIND)(ENCODE_DELEGATE_CTOR), pTargetMethod->hMethod, pTargetMethod, delegateType);
#endif
}
@@ -3729,10 +3736,11 @@ void ZapInfo::getMethodVTableOffset(CORINFO_METHOD_HANDLE method,
CORINFO_METHOD_HANDLE ZapInfo::resolveVirtualMethod(
CORINFO_METHOD_HANDLE virtualMethod,
- CORINFO_CLASS_HANDLE implementingClass
+ CORINFO_CLASS_HANDLE implementingClass,
+ CORINFO_CONTEXT_HANDLE ownerType
)
{
- return m_pEEJitInfo->resolveVirtualMethod(virtualMethod, implementingClass);
+ return m_pEEJitInfo->resolveVirtualMethod(virtualMethod, implementingClass, ownerType);
}
CorInfoIntrinsics ZapInfo::getIntrinsicID(CORINFO_METHOD_HANDLE method,
diff --git a/src/zap/zapinfo.h b/src/zap/zapinfo.h
index c0846d1044..6e83657170 100644
--- a/src/zap/zapinfo.h
+++ b/src/zap/zapinfo.h
@@ -558,7 +558,7 @@ public:
void getReadyToRunDelegateCtorHelper(
CORINFO_RESOLVED_TOKEN * pTargetMethod,
CORINFO_CLASS_HANDLE delegateType,
- CORINFO_CONST_LOOKUP * pLookup
+ CORINFO_LOOKUP * pLookup
);
CorInfoInitClassResult initClass(
@@ -667,7 +667,8 @@ public:
CORINFO_METHOD_HANDLE resolveVirtualMethod(
CORINFO_METHOD_HANDLE virtualMethod,
- CORINFO_CLASS_HANDLE implementingClass
+ CORINFO_CLASS_HANDLE implementingClass,
+ CORINFO_CONTEXT_HANDLE ownerType
);
CorInfoIntrinsics getIntrinsicID(CORINFO_METHOD_HANDLE method,
diff --git a/src/zap/zapper.cpp b/src/zap/zapper.cpp
index 50e86db435..4d1330ee1f 100644
--- a/src/zap/zapper.cpp
+++ b/src/zap/zapper.cpp
@@ -105,7 +105,7 @@ STDAPI NGenWorker(LPCWSTR pwzFilename, DWORD dwFlags, LPCWSTR pwzPlatformAssembl
ngo.fDebug = false;
ngo.fDebugOpt = false;
ngo.fProf = false;
- ngo.fSilent = false;
+ ngo.fSilent = (dwFlags & NGENWORKER_FLAGS_SILENT) != 0;
ngo.lpszExecutableFileName = pwzFilename;
// V2 (Whidbey)