summaryrefslogtreecommitdiff
path: root/src/mscorlib/src
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2016-12-27 07:46:08 (GMT)
committerJiyoung Yun <jy910.yun@samsung.com>2016-12-27 07:46:08 (GMT)
commitdb20f3f1bb8595633a7e16c8900fd401a453a6b5 (patch)
treee5435159cd1bf0519276363a6fe1663d1721bed3 /src/mscorlib/src
parent4b4aad7217d3292650e77eec2cf4c198ea9c3b4b (diff)
downloadcoreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.zip
coreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.tar.gz
coreclr-db20f3f1bb8595633a7e16c8900fd401a453a6b5.tar.bz2
Imported Upstream version 1.0.0.9127upstream/1.0.0.9127
Diffstat (limited to 'src/mscorlib/src')
-rw-r--r--src/mscorlib/src/Internal/Runtime/Augments/EnvironmentAugments.cs7
-rw-r--r--src/mscorlib/src/Internal/Runtime/Augments/RuntimeThread.cs198
-rw-r--r--src/mscorlib/src/Microsoft/Win32/OAVariantLib.cs6
-rw-r--r--src/mscorlib/src/Microsoft/Win32/Registry.cs24
-rw-r--r--src/mscorlib/src/Microsoft/Win32/RegistryKey.cs296
-rw-r--r--src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.cs43
-rw-r--r--src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileMappingHandle.cs4
-rw-r--r--src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFindHandle.cs3
-rw-r--r--src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs12
-rw-r--r--src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs6
-rw-r--r--src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs4
-rw-r--r--src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeViewOfFileHandle.cs4
-rw-r--r--src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeWaitHandle.cs2
-rw-r--r--src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs25
-rw-r--r--src/mscorlib/src/Microsoft/Win32/UnsafeNativeMethods.cs8
-rw-r--r--src/mscorlib/src/Microsoft/Win32/Win32Native.cs115
-rw-r--r--src/mscorlib/src/System.Private.CoreLib.txt1251
-rw-r--r--src/mscorlib/src/System/Action.cs43
-rw-r--r--src/mscorlib/src/System/Activator.cs136
-rw-r--r--src/mscorlib/src/System/AggregateException.cs17
-rw-r--r--src/mscorlib/src/System/AppContext/AppContext.cs56
-rw-r--r--src/mscorlib/src/System/AppContext/AppContextDefaultValues.Defaults.cs12
-rw-r--r--src/mscorlib/src/System/AppContext/AppContextDefaultValues.cs6
-rw-r--r--src/mscorlib/src/System/AppContext/AppContextSwitches.cs30
-rw-r--r--src/mscorlib/src/System/AppDomain.cs2188
-rw-r--r--src/mscorlib/src/System/AppDomainManager.cs171
-rw-r--r--src/mscorlib/src/System/AppDomainSetup.cs469
-rw-r--r--src/mscorlib/src/System/ApplicationId.cs6
-rw-r--r--src/mscorlib/src/System/ArgIterator.cs11
-rw-r--r--src/mscorlib/src/System/ArgumentException.cs3
-rw-r--r--src/mscorlib/src/System/ArgumentNullException.cs1
-rw-r--r--src/mscorlib/src/System/ArgumentOutOfRangeException.cs3
-rw-r--r--src/mscorlib/src/System/Array.cs433
-rw-r--r--src/mscorlib/src/System/ArraySegment.cs96
-rw-r--r--src/mscorlib/src/System/Attribute.cs137
-rw-r--r--src/mscorlib/src/System/BCLDebug.cs32
-rw-r--r--src/mscorlib/src/System/BadImageFormatException.cs3
-rw-r--r--src/mscorlib/src/System/BitConverter.cs61
-rw-r--r--src/mscorlib/src/System/Boolean.cs2
-rw-r--r--src/mscorlib/src/System/Buffer.cs50
-rw-r--r--src/mscorlib/src/System/ByReference.cs31
-rw-r--r--src/mscorlib/src/System/Byte.cs4
-rw-r--r--src/mscorlib/src/System/CLRConfig.cs2
-rw-r--r--src/mscorlib/src/System/CfgParser.cs14
-rw-r--r--src/mscorlib/src/System/Char.cs94
-rw-r--r--src/mscorlib/src/System/Collections/ArrayList.cs179
-rw-r--r--src/mscorlib/src/System/Collections/BitArray.cs524
-rw-r--r--src/mscorlib/src/System/Collections/CollectionBase.cs10
-rw-r--r--src/mscorlib/src/System/Collections/Comparer.cs5
-rw-r--r--src/mscorlib/src/System/Collections/CompatibleComparer.cs2
-rw-r--r--src/mscorlib/src/System/Collections/Concurrent/ConcurrentDictionary.cs216
-rw-r--r--src/mscorlib/src/System/Collections/Concurrent/ConcurrentQueue.cs21
-rw-r--r--src/mscorlib/src/System/Collections/Concurrent/ConcurrentStack.cs91
-rw-r--r--src/mscorlib/src/System/Collections/Concurrent/IProducerConsumerCollection.cs2
-rw-r--r--src/mscorlib/src/System/Collections/Concurrent/OrderablePartitioner.cs1
-rw-r--r--src/mscorlib/src/System/Collections/Concurrent/Partitioner.cs1
-rw-r--r--src/mscorlib/src/System/Collections/Concurrent/PartitionerStatic.cs104
-rw-r--r--src/mscorlib/src/System/Collections/DictionaryEntry.cs7
-rw-r--r--src/mscorlib/src/System/Collections/EmptyReadOnlyDictionaryInternal.cs20
-rw-r--r--src/mscorlib/src/System/Collections/Generic/ArraySortHelper.cs452
-rw-r--r--src/mscorlib/src/System/Collections/Generic/Comparer.cs18
-rw-r--r--src/mscorlib/src/System/Collections/Generic/DebugView.cs2
-rw-r--r--src/mscorlib/src/System/Collections/Generic/Dictionary.cs101
-rw-r--r--src/mscorlib/src/System/Collections/Generic/EqualityComparer.cs171
-rw-r--r--src/mscorlib/src/System/Collections/Generic/KeyValuePair.cs17
-rw-r--r--src/mscorlib/src/System/Collections/Generic/List.cs116
-rw-r--r--src/mscorlib/src/System/Collections/Hashtable.cs187
-rw-r--r--src/mscorlib/src/System/Collections/ListDictionaryInternal.cs30
-rw-r--r--src/mscorlib/src/System/Collections/ObjectModel/Collection.cs8
-rw-r--r--src/mscorlib/src/System/Collections/ObjectModel/KeyedCollection.cs4
-rw-r--r--src/mscorlib/src/System/Collections/ObjectModel/ReadOnlyCollection.cs8
-rw-r--r--src/mscorlib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs14
-rw-r--r--src/mscorlib/src/System/Collections/SortedList.cs39
-rw-r--r--src/mscorlib/src/System/Collections/Stack.cs13
-rw-r--r--src/mscorlib/src/System/CompatibilitySwitches.cs72
-rw-r--r--src/mscorlib/src/System/ContextBoundObject.cs24
-rw-r--r--src/mscorlib/src/System/ContextStaticAttribute.cs32
-rw-r--r--src/mscorlib/src/System/Convert.cs80
-rw-r--r--src/mscorlib/src/System/Currency.cs2
-rw-r--r--src/mscorlib/src/System/CurrentTimeZone.cs276
-rw-r--r--src/mscorlib/src/System/DBNull.cs1
-rw-r--r--src/mscorlib/src/System/DateTime.cs86
-rw-r--r--src/mscorlib/src/System/DateTimeOffset.cs34
-rw-r--r--src/mscorlib/src/System/Decimal.cs60
-rw-r--r--src/mscorlib/src/System/DefaultBinder.cs26
-rw-r--r--src/mscorlib/src/System/Delegate.cs107
-rw-r--r--src/mscorlib/src/System/DelegateSerializationHolder.cs29
-rw-r--r--src/mscorlib/src/System/Diagnostics/Assert.cs18
-rw-r--r--src/mscorlib/src/System/Diagnostics/AssertFilter.cs1
-rw-r--r--src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs19
-rw-r--r--src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs62
-rw-r--r--src/mscorlib/src/System/Diagnostics/Debugger.cs9
-rw-r--r--src/mscorlib/src/System/Diagnostics/DebuggerAttributes.cs20
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/ActivityTracker.cs13
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/EventProvider.cs66
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs465
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/EventSource_CoreCLR.cs4
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/DataCollector.cs1
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventPayload.cs9
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventSourceActivity.cs2
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/FieldMetadata.cs2
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/PropertyValue.cs7
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/SimpleTypeInfos.cs3
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/Statics.cs2
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingDataCollector.cs1
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventSource.cs18
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventTypes.cs10
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingMetadataCollector.cs6
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingTypeInfo.cs4
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/XplatEventLogger.cs28
-rw-r--r--src/mscorlib/src/System/Diagnostics/LogSwitch.cs7
-rw-r--r--src/mscorlib/src/System/Diagnostics/Stackframe.cs23
-rw-r--r--src/mscorlib/src/System/Diagnostics/Stacktrace.cs79
-rw-r--r--src/mscorlib/src/System/Diagnostics/SymbolStore/ISymWriter.cs30
-rw-r--r--src/mscorlib/src/System/Diagnostics/log.cs5
-rw-r--r--src/mscorlib/src/System/Double.cs8
-rw-r--r--src/mscorlib/src/System/Empty.cs3
-rw-r--r--src/mscorlib/src/System/Enum.cs174
-rw-r--r--src/mscorlib/src/System/Environment.cs1154
-rw-r--r--src/mscorlib/src/System/Exception.cs88
-rw-r--r--src/mscorlib/src/System/FormattableString.cs2
-rw-r--r--src/mscorlib/src/System/GC.cs172
-rw-r--r--src/mscorlib/src/System/Globalization/Calendar.cs18
-rw-r--r--src/mscorlib/src/System/Globalization/CalendarData.cs6
-rw-r--r--src/mscorlib/src/System/Globalization/CalendricalCalculationsHelper.cs17
-rw-r--r--src/mscorlib/src/System/Globalization/CharUnicodeInfo.cs66
-rw-r--r--src/mscorlib/src/System/Globalization/ChineseLunisolarCalendar.cs4
-rw-r--r--src/mscorlib/src/System/Globalization/CompareInfo.cs171
-rw-r--r--src/mscorlib/src/System/Globalization/CultureData.cs445
-rw-r--r--src/mscorlib/src/System/Globalization/CultureInfo.cs167
-rw-r--r--src/mscorlib/src/System/Globalization/CultureNotFoundException.cs3
-rw-r--r--src/mscorlib/src/System/Globalization/DateTimeFormat.cs134
-rw-r--r--src/mscorlib/src/System/Globalization/DateTimeFormatInfo.cs248
-rw-r--r--src/mscorlib/src/System/Globalization/DateTimeFormatInfoScanner.cs3
-rw-r--r--src/mscorlib/src/System/Globalization/DateTimeParse.cs90
-rw-r--r--src/mscorlib/src/System/Globalization/DaylightTime.cs23
-rw-r--r--src/mscorlib/src/System/Globalization/EastAsianLunisolarCalendar.cs26
-rw-r--r--src/mscorlib/src/System/Globalization/EncodingDataItem.cs7
-rw-r--r--src/mscorlib/src/System/Globalization/EncodingTable.Unix.cs9
-rw-r--r--src/mscorlib/src/System/Globalization/EncodingTable.cs16
-rw-r--r--src/mscorlib/src/System/Globalization/GlobalizationAssembly.cs8
-rw-r--r--src/mscorlib/src/System/Globalization/GregorianCalendar.cs50
-rw-r--r--src/mscorlib/src/System/Globalization/GregorianCalendarHelper.cs24
-rw-r--r--src/mscorlib/src/System/Globalization/HebrewCalendar.cs31
-rw-r--r--src/mscorlib/src/System/Globalization/HebrewNumber.cs3
-rw-r--r--src/mscorlib/src/System/Globalization/HijriCalendar.cs24
-rw-r--r--src/mscorlib/src/System/Globalization/IdnMapping.cs156
-rw-r--r--src/mscorlib/src/System/Globalization/JapaneseCalendar.cs5
-rw-r--r--src/mscorlib/src/System/Globalization/JulianCalendar.cs18
-rw-r--r--src/mscorlib/src/System/Globalization/KoreanCalendar.cs2
-rw-r--r--src/mscorlib/src/System/Globalization/KoreanLunisolarCalendar.cs4
-rw-r--r--src/mscorlib/src/System/Globalization/NumberFormatInfo.cs66
-rw-r--r--src/mscorlib/src/System/Globalization/PersianCalendar.cs37
-rw-r--r--src/mscorlib/src/System/Globalization/RegionInfo.cs200
-rw-r--r--src/mscorlib/src/System/Globalization/SortKey.cs7
-rw-r--r--src/mscorlib/src/System/Globalization/StringInfo.cs29
-rw-r--r--src/mscorlib/src/System/Globalization/TaiwanCalendar.cs4
-rw-r--r--src/mscorlib/src/System/Globalization/TextElementEnumerator.cs7
-rw-r--r--src/mscorlib/src/System/Globalization/TextInfo.cs77
-rw-r--r--src/mscorlib/src/System/Globalization/ThaiBuddhistCalendar.cs2
-rw-r--r--src/mscorlib/src/System/Globalization/TimeSpanFormat.cs30
-rw-r--r--src/mscorlib/src/System/Globalization/TimeSpanParse.cs33
-rw-r--r--src/mscorlib/src/System/Globalization/UmAlQuraCalendar.cs31
-rw-r--r--src/mscorlib/src/System/Guid.cs37
-rw-r--r--src/mscorlib/src/System/IAppDomain.cs246
-rw-r--r--src/mscorlib/src/System/IAppDomainPauseManager.cs15
-rw-r--r--src/mscorlib/src/System/IO/BinaryReader.cs46
-rw-r--r--src/mscorlib/src/System/IO/BinaryWriter.cs37
-rw-r--r--src/mscorlib/src/System/IO/BufferedStream.cs1320
-rw-r--r--src/mscorlib/src/System/IO/Directory.cs642
-rw-r--r--src/mscorlib/src/System/IO/DirectoryInfo.cs265
-rw-r--r--src/mscorlib/src/System/IO/DriveInfo.cs281
-rw-r--r--src/mscorlib/src/System/IO/EncodingCache.cs (renamed from src/mscorlib/src/System/Runtime/CompilerServices/IsPinned.cs)8
-rw-r--r--src/mscorlib/src/System/IO/File.cs658
-rw-r--r--src/mscorlib/src/System/IO/FileAttributes.cs20
-rw-r--r--src/mscorlib/src/System/IO/FileInfo.cs207
-rw-r--r--src/mscorlib/src/System/IO/FileLoadException.cs14
-rw-r--r--src/mscorlib/src/System/IO/FileNotFoundException.cs11
-rw-r--r--src/mscorlib/src/System/IO/FileSecurityState.cs133
-rw-r--r--src/mscorlib/src/System/IO/FileSecurityStateAccess.cs32
-rw-r--r--src/mscorlib/src/System/IO/FileStream.cs2695
-rw-r--r--src/mscorlib/src/System/IO/FileSystemEnumerable.cs185
-rw-r--r--src/mscorlib/src/System/IO/FileSystemInfo.cs137
-rw-r--r--src/mscorlib/src/System/IO/LongPathHelper.cs521
-rw-r--r--src/mscorlib/src/System/IO/MemoryStream.cs112
-rw-r--r--src/mscorlib/src/System/IO/Path.cs1435
-rw-r--r--src/mscorlib/src/System/IO/PathHelper.cs448
-rw-r--r--src/mscorlib/src/System/IO/PathInternal.cs806
-rw-r--r--src/mscorlib/src/System/IO/PinnedBufferMemoryStream.cs6
-rw-r--r--src/mscorlib/src/System/IO/Stream.cs144
-rw-r--r--src/mscorlib/src/System/IO/StreamHelpers.CopyValidation.cs46
-rw-r--r--src/mscorlib/src/System/IO/StreamReader.cs100
-rw-r--r--src/mscorlib/src/System/IO/StreamWriter.cs175
-rw-r--r--src/mscorlib/src/System/IO/StringReader.cs187
-rw-r--r--src/mscorlib/src/System/IO/StringWriter.cs196
-rw-r--r--src/mscorlib/src/System/IO/TextReader.cs36
-rw-r--r--src/mscorlib/src/System/IO/TextWriter.cs37
-rw-r--r--src/mscorlib/src/System/IO/UnmanagedMemoryAccessor.cs215
-rw-r--r--src/mscorlib/src/System/IO/UnmanagedMemoryStream.cs187
-rw-r--r--src/mscorlib/src/System/IO/UnmanagedMemoryStreamWrapper.cs9
-rw-r--r--src/mscorlib/src/System/IO/__DebugOutputTextWriter.cs76
-rw-r--r--src/mscorlib/src/System/IO/__Error.cs12
-rw-r--r--src/mscorlib/src/System/Int16.cs3
-rw-r--r--src/mscorlib/src/System/Int32.cs4
-rw-r--r--src/mscorlib/src/System/Int64.cs4
-rw-r--r--src/mscorlib/src/System/IntPtr.cs27
-rw-r--r--src/mscorlib/src/System/Internal.cs19
-rw-r--r--src/mscorlib/src/System/InvalidTimeZoneException.cs12
-rw-r--r--src/mscorlib/src/System/Lazy.cs23
-rw-r--r--src/mscorlib/src/System/LowLevelConsole.cs3
-rw-r--r--src/mscorlib/src/System/MarshalByRefObject.cs245
-rw-r--r--src/mscorlib/src/System/Math.cs191
-rw-r--r--src/mscorlib/src/System/MathF.cs253
-rw-r--r--src/mscorlib/src/System/MissingFieldException.cs1
-rw-r--r--src/mscorlib/src/System/MissingMemberException.cs5
-rw-r--r--src/mscorlib/src/System/MissingMethodException.cs1
-rw-r--r--src/mscorlib/src/System/MulticastDelegate.cs40
-rw-r--r--src/mscorlib/src/System/NotFiniteNumberException.cs3
-rw-r--r--src/mscorlib/src/System/Nullable.cs2
-rw-r--r--src/mscorlib/src/System/Number.cs191
-rw-r--r--src/mscorlib/src/System/Numerics/Hashing/HashHelpers.cs19
-rw-r--r--src/mscorlib/src/System/Object.cs48
-rw-r--r--src/mscorlib/src/System/ObjectDisposedException.cs1
-rw-r--r--src/mscorlib/src/System/OleAutBinder.cs21
-rw-r--r--src/mscorlib/src/System/OperatingSystem.cs7
-rw-r--r--src/mscorlib/src/System/ParseNumbers.cs8
-rw-r--r--src/mscorlib/src/System/Progress.cs4
-rw-r--r--src/mscorlib/src/System/Random.cs74
-rw-r--r--src/mscorlib/src/System/ReadOnlySpan.cs397
-rw-r--r--src/mscorlib/src/System/Reflection/Assembly.cs1048
-rw-r--r--src/mscorlib/src/System/Reflection/AssemblyAttributes.cs2
-rw-r--r--src/mscorlib/src/System/Reflection/AssemblyName.cs274
-rw-r--r--src/mscorlib/src/System/Reflection/Associates.cs9
-rw-r--r--src/mscorlib/src/System/Reflection/ComInterfaces.cs572
-rw-r--r--src/mscorlib/src/System/Reflection/ConstructorInfo.cs145
-rw-r--r--src/mscorlib/src/System/Reflection/CustomAttribute.cs168
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/AQNBuilder.cs30
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/AssemblyBuilder.cs1145
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderAccess.cs6
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs40
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/ComInterfaces.cs173
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/ConstructorBuilder.cs61
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/CustomAttributeBuilder.cs143
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/DynamicILGenerator.cs69
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs224
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/EnumBuilder.cs30
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/EventBuilder.cs47
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/FieldBuilder.cs54
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/FlowControl.cs3
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs3
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs111
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/ISymWrapperCore.cs136
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/LocalBuilder.cs22
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/MethodBuilder.cs165
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/ModuleBuilder.cs489
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/ModuleBuilderData.cs6
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/Opcode.cs118
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/OpcodeType.cs3
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/OperandType.cs3
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/ParameterBuilder.cs35
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/PropertyBuilder.cs49
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/SignatureHelper.cs69
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/SymbolMethod.cs1
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/SymbolType.cs2
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs324
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs4
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/UnmanagedMarshal.cs1
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/XXXOnTypeBuilderInstantiation.cs13
-rw-r--r--src/mscorlib/src/System/Reflection/EventInfo.cs55
-rw-r--r--src/mscorlib/src/System/Reflection/FieldInfo.cs98
-rw-r--r--src/mscorlib/src/System/Reflection/IntrospectionExtensions.cs23
-rw-r--r--src/mscorlib/src/System/Reflection/InvalidFilterCriteriaException.cs4
-rw-r--r--src/mscorlib/src/System/Reflection/LoaderAllocator.cs2
-rw-r--r--src/mscorlib/src/System/Reflection/MdConstant.cs1
-rw-r--r--src/mscorlib/src/System/Reflection/MdImport.cs55
-rw-r--r--src/mscorlib/src/System/Reflection/MemberInfo.cs31
-rw-r--r--src/mscorlib/src/System/Reflection/MemberInfoSerializationHolder.cs6
-rw-r--r--src/mscorlib/src/System/Reflection/Metadata/AssemblyExtensions.cs4
-rw-r--r--src/mscorlib/src/System/Reflection/MethodBase.cs50
-rw-r--r--src/mscorlib/src/System/Reflection/MethodBody.cs3
-rw-r--r--src/mscorlib/src/System/Reflection/MethodInfo.cs164
-rw-r--r--src/mscorlib/src/System/Reflection/Missing.cs3
-rw-r--r--src/mscorlib/src/System/Reflection/Module.cs158
-rw-r--r--src/mscorlib/src/System/Reflection/ParameterInfo.cs90
-rw-r--r--src/mscorlib/src/System/Reflection/Pointer.cs14
-rw-r--r--src/mscorlib/src/System/Reflection/PropertyInfo.cs51
-rw-r--r--src/mscorlib/src/System/Reflection/ReflectionContext.cs2
-rw-r--r--src/mscorlib/src/System/Reflection/ReflectionTypeLoadException.cs3
-rw-r--r--src/mscorlib/src/System/Reflection/RuntimeReflectionExtensions.cs4
-rw-r--r--src/mscorlib/src/System/Reflection/StrongNameKeyPair.cs115
-rw-r--r--src/mscorlib/src/System/Reflection/TargetException.cs4
-rw-r--r--src/mscorlib/src/System/Reflection/TargetInvocationException.cs4
-rw-r--r--src/mscorlib/src/System/Reflection/TargetParameterCountException.cs4
-rw-r--r--src/mscorlib/src/System/Reflection/TypeDelegator.cs5
-rw-r--r--src/mscorlib/src/System/Resources/FileBasedResourceGroveler.cs31
-rw-r--r--src/mscorlib/src/System/Resources/IResourceGroveler.cs5
-rw-r--r--src/mscorlib/src/System/Resources/LooselyLinkedResourceReference.cs10
-rw-r--r--src/mscorlib/src/System/Resources/ManifestBasedResourceGroveler.cs153
-rw-r--r--src/mscorlib/src/System/Resources/NeutralResourcesLanguageAttribute.cs4
-rw-r--r--src/mscorlib/src/System/Resources/ResourceFallbackManager.cs14
-rw-r--r--src/mscorlib/src/System/Resources/ResourceManager.cs306
-rw-r--r--src/mscorlib/src/System/Resources/ResourceReader.cs71
-rw-r--r--src/mscorlib/src/System/Resources/ResourceSet.cs21
-rw-r--r--src/mscorlib/src/System/Resources/RuntimeResourceSet.cs9
-rw-r--r--src/mscorlib/src/System/Resources/SatelliteContractVersionAttribute.cs2
-rw-r--r--src/mscorlib/src/System/Resources/__FastResourceComparer.cs14
-rw-r--r--src/mscorlib/src/System/RtType.cs861
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/AsyncMethodBuilder.cs58
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/CallingConvention.cs30
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs905
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/DecimalConstantAttribute.cs7
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/FormattableStringFactory.cs4
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/HasCopySemanticsAttribute.cs14
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IDispatchConstantAttribute.cs26
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/INotifyCompletion.cs1
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IUnknownConstantAttribute.cs27
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsBoxed.cs11
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsByValue.cs11
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsConst.cs11
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsCopyConstructed.cs11
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsExplicitlyDereferenced.cs22
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsImplicitlyDereferenced.cs22
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsJitIntrinsic.cs12
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsLong.cs18
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsSignUnspecifiedByte.cs16
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsUdtReturn.cs11
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/NativeCppClassAttribute.cs16
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/RequiredAttributeAttribute.cs26
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs92
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs3
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/ScopelessEnumAttribute.cs14
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/TaskAwaiter.cs23
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/TypeDependencyAttribute.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedFromAttribute.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedToAttribute.cs1
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/Unsafe.cs80
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/YieldAwaitable.cs6
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/jithelpers.cs52
-rw-r--r--src/mscorlib/src/System/Runtime/ExceptionServices/ExceptionNotification.cs41
-rw-r--r--src/mscorlib/src/System/Runtime/ExceptionServices/ExceptionServicesCommon.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/GcSettings.cs7
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ArrayWithOffset.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/Attributes.cs12
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/BStrWrapper.cs8
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/COMException.cs1
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComEventsHelper.cs16
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComEventsInfo.cs5
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComEventsSink.cs9
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/CriticalHandle.cs11
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/CurrencyWrapper.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/DispatchWrapper.cs4
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ErrorWrapper.cs6
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ExtensibleClassFactory.cs1
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ExternalException.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/GcHandle.cs21
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ICustomQueryInterface.cs1
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/IException.cs48
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/IRegistrationServices.cs6
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs622
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/NativeBuffer.cs175
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/NativeMethods.cs4
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/NonPortable.cs34
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/RegistrationServices.cs52
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs57
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/SafeBuffer.cs28
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/SafeHandle.cs13
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/SafeHeapHandle.cs115
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/StringBuffer.cs402
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/TCEAdapterGen/EventProviderWriter.cs67
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/TCEAdapterGen/EventSinkHelperWriter.cs9
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/TypeLibConverter.cs595
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/Variant.cs1
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToCollectionAdapter.cs11
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToListAdapter.cs30
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIPropertyValueImpl.cs8
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs11
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ConstantSplittableMap.cs4
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CustomPropertyImpl.cs6
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryKeyCollection.cs8
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryToMapAdapter.cs12
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryValueCollection.cs8
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/EnumeratorToIteratorAdapter.cs7
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IClosable.cs8
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ICustomPropertyProvider.cs7
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IMapViewToIReadOnlyDictionaryAdapter.cs29
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyDictionaryToIMapViewAdapter.cs6
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyListToIVectorViewAdapter.cs8
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IRestrictedErrorInfo.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IVectorViewToIReadOnlyListAdapter.cs8
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IteratorToEnumeratorAdapter.cs19
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorAdapter.cs15
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorViewAdapter.cs4
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToVectorAdapter.cs19
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ManagedActivationFactory.cs5
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToCollectionAdapter.cs14
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToDictionaryAdapter.cs23
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapViewToReadOnlyCollectionAdapter.cs4
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/NativeMethods.cs7
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/RuntimeClass.cs9
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToCollectionAdapter.cs14
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToListAdapter.cs24
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorViewToReadOnlyCollectionAdapter.cs4
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeBufferHelper.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshal.cs52
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMetadata.cs5
-rw-r--r--src/mscorlib/src/System/Runtime/Loader/AssemblyLoadContext.cs92
-rw-r--r--src/mscorlib/src/System/Runtime/MemoryFailPoint.cs16
-rw-r--r--src/mscorlib/src/System/Runtime/ProfileOptimization.cs4
-rw-r--r--src/mscorlib/src/System/Runtime/Reliability/CriticalFinalizerObject.cs6
-rw-r--r--src/mscorlib/src/System/Runtime/Remoting/ObjectHandle.cs42
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/FormatterConverter.cs34
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/FormatterServices.cs76
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/IObjectReference.cs1
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/ISerializable.cs1
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/ISerializationSurrogate.cs2
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/ISurrogateSelector.cs3
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/SafeSerializationManager.cs446
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/SerializationFieldInfo.cs36
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs98
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/SerializationInfoEnumerator.cs15
-rw-r--r--src/mscorlib/src/System/Runtime/Versioning/BinaryCompatibility.cs485
-rw-r--r--src/mscorlib/src/System/Runtime/Versioning/CompatibilitySwitch.cs5
-rw-r--r--src/mscorlib/src/System/Runtime/Versioning/ComponentGuaranteesAttribute.cs44
-rw-r--r--src/mscorlib/src/System/Runtime/Versioning/ResourceAttributes.cs237
-rw-r--r--src/mscorlib/src/System/Runtime/Versioning/TargetFrameworkAttribute.cs2
-rw-r--r--src/mscorlib/src/System/RuntimeHandles.cs273
-rw-r--r--src/mscorlib/src/System/SByte.cs3
-rw-r--r--src/mscorlib/src/System/Security/AccessControl/Enums.cs6
-rw-r--r--src/mscorlib/src/System/Security/Attributes.cs11
-rw-r--r--src/mscorlib/src/System/Security/BuiltInPermissionSets.cs103
-rw-r--r--src/mscorlib/src/System/Security/CodeAccessPermission.cs69
-rw-r--r--src/mscorlib/src/System/Security/CodeAccessSecurityEngine.cs468
-rw-r--r--src/mscorlib/src/System/Security/FrameSecurityDescriptor.cs31
-rw-r--r--src/mscorlib/src/System/Security/HostProtectionException.cs5
-rw-r--r--src/mscorlib/src/System/Security/HostSecurityManager.cs131
-rw-r--r--src/mscorlib/src/System/Security/IEvidenceFactory.cs15
-rw-r--r--src/mscorlib/src/System/Security/ISecurityEncodable.cs18
-rw-r--r--src/mscorlib/src/System/Security/ISecurityPolicyEncodable.cs17
-rw-r--r--src/mscorlib/src/System/Security/NamedPermissionSet.cs202
-rw-r--r--src/mscorlib/src/System/Security/PermissionListSet.cs29
-rw-r--r--src/mscorlib/src/System/Security/PermissionSet.cs1100
-rw-r--r--src/mscorlib/src/System/Security/PermissionSetEnumerator.cs14
-rw-r--r--src/mscorlib/src/System/Security/PermissionSetTriple.cs20
-rw-r--r--src/mscorlib/src/System/Security/PermissionToken.cs202
-rw-r--r--src/mscorlib/src/System/Security/Permissions/EnvironmentPermission.cs60
-rw-r--r--src/mscorlib/src/System/Security/Permissions/FileDialogPermission.cs33
-rw-r--r--src/mscorlib/src/System/Security/Permissions/FileIOPermission.cs304
-rw-r--r--src/mscorlib/src/System/Security/Permissions/GACIdentityPermission.cs16
-rw-r--r--src/mscorlib/src/System/Security/Permissions/HostProtectionPermission.cs34
-rw-r--r--src/mscorlib/src/System/Security/Permissions/IsolatedStorageFilePermission.cs13
-rw-r--r--src/mscorlib/src/System/Security/Permissions/IsolatedStoragePermission.cs91
-rw-r--r--src/mscorlib/src/System/Security/Permissions/PermissionAttributes.cs314
-rw-r--r--src/mscorlib/src/System/Security/Permissions/ReflectionPermission.cs39
-rw-r--r--src/mscorlib/src/System/Security/Permissions/RegistryPermission.cs131
-rw-r--r--src/mscorlib/src/System/Security/Permissions/SecurityPermission.cs96
-rw-r--r--src/mscorlib/src/System/Security/Permissions/SiteIdentityPermission.cs108
-rw-r--r--src/mscorlib/src/System/Security/Permissions/StrongNameIdentityPermission.cs90
-rw-r--r--src/mscorlib/src/System/Security/Permissions/StrongNamePublicKeyBlob.cs2
-rw-r--r--src/mscorlib/src/System/Security/Permissions/UIPermission.cs44
-rw-r--r--src/mscorlib/src/System/Security/Permissions/URLIdentityPermission.cs111
-rw-r--r--src/mscorlib/src/System/Security/Permissions/ZoneIdentityPermission.cs101
-rw-r--r--src/mscorlib/src/System/Security/Permissions/keycontainerpermission.cs72
-rw-r--r--src/mscorlib/src/System/Security/Policy/ApplicationTrust.cs573
-rw-r--r--src/mscorlib/src/System/Security/Policy/Evidence.cs1865
-rw-r--r--src/mscorlib/src/System/Security/Policy/EvidenceBase.cs31
-rw-r--r--src/mscorlib/src/System/Security/Policy/EvidenceTypeDescriptor.cs20
-rw-r--r--src/mscorlib/src/System/Security/Policy/IDelayEvaluatedEvidence.cs1
-rw-r--r--src/mscorlib/src/System/Security/Policy/PolicyStatement.cs302
-rw-r--r--src/mscorlib/src/System/Security/Policy/Site.cs29
-rw-r--r--src/mscorlib/src/System/Security/Policy/StrongName.cs59
-rw-r--r--src/mscorlib/src/System/Security/Policy/URL.cs29
-rw-r--r--src/mscorlib/src/System/Security/Policy/Zone.cs66
-rw-r--r--src/mscorlib/src/System/Security/Principal/TokenImpersonationLevel.cs9
-rw-r--r--src/mscorlib/src/System/Security/SafeSecurityHandles.cs16
-rw-r--r--src/mscorlib/src/System/Security/SecurityContext.cs238
-rw-r--r--src/mscorlib/src/System/Security/SecurityElement.cs100
-rw-r--r--src/mscorlib/src/System/Security/SecurityException.cs608
-rw-r--r--src/mscorlib/src/System/Security/SecurityManager.cs524
-rw-r--r--src/mscorlib/src/System/Security/SecurityRuntime.cs156
-rw-r--r--src/mscorlib/src/System/Security/SecurityState.cs10
-rw-r--r--src/mscorlib/src/System/Security/Util/Config.cs48
-rw-r--r--src/mscorlib/src/System/Security/Util/Hex.cs2
-rw-r--r--src/mscorlib/src/System/Security/Util/StringExpressionSet.cs41
-rw-r--r--src/mscorlib/src/System/Security/Util/TokenBasedSet.cs32
-rw-r--r--src/mscorlib/src/System/Security/Util/URLString.cs17
-rw-r--r--src/mscorlib/src/System/Security/Util/XMLUtil.cs272
-rw-r--r--src/mscorlib/src/System/Security/securestring.cs31
-rw-r--r--src/mscorlib/src/System/SharedStatics.cs64
-rw-r--r--src/mscorlib/src/System/Single.cs16
-rw-r--r--src/mscorlib/src/System/Span.cs477
-rw-r--r--src/mscorlib/src/System/String.Comparison.cs82
-rw-r--r--src/mscorlib/src/System/String.Manipulation.cs475
-rw-r--r--src/mscorlib/src/System/String.Searching.cs36
-rw-r--r--src/mscorlib/src/System/String.cs126
-rw-r--r--src/mscorlib/src/System/StringComparer.cs35
-rw-r--r--src/mscorlib/src/System/StubHelpers.cs161
-rw-r--r--src/mscorlib/src/System/Text/ASCIIEncoding.cs77
-rw-r--r--src/mscorlib/src/System/Text/BaseCodePageEncoding.cs30
-rw-r--r--src/mscorlib/src/System/Text/CodePageEncoding.cs13
-rw-r--r--src/mscorlib/src/System/Text/DBCSCodePageEncoding.cs102
-rw-r--r--src/mscorlib/src/System/Text/Decoder.cs32
-rw-r--r--src/mscorlib/src/System/Text/DecoderBestFitFallback.cs9
-rw-r--r--src/mscorlib/src/System/Text/DecoderFallback.cs13
-rw-r--r--src/mscorlib/src/System/Text/DecoderNLS.cs43
-rw-r--r--src/mscorlib/src/System/Text/DecoderReplacementFallback.cs9
-rw-r--r--src/mscorlib/src/System/Text/EUCJPEncoding.cs3
-rw-r--r--src/mscorlib/src/System/Text/Encoder.cs32
-rw-r--r--src/mscorlib/src/System/Text/EncoderBestFitFallback.cs12
-rw-r--r--src/mscorlib/src/System/Text/EncoderExceptionFallback.cs6
-rw-r--r--src/mscorlib/src/System/Text/EncoderFallback.cs8
-rw-r--r--src/mscorlib/src/System/Text/EncoderNLS.cs43
-rw-r--r--src/mscorlib/src/System/Text/EncoderReplacementFallback.cs10
-rw-r--r--src/mscorlib/src/System/Text/Encoding.cs222
-rw-r--r--src/mscorlib/src/System/Text/EncodingForwarder.cs98
-rw-r--r--src/mscorlib/src/System/Text/EncodingNLS.cs4
-rw-r--r--src/mscorlib/src/System/Text/EncodingProvider.cs2
-rw-r--r--src/mscorlib/src/System/Text/GB18030Encoding.cs60
-rw-r--r--src/mscorlib/src/System/Text/ISCIIEncoding.cs88
-rw-r--r--src/mscorlib/src/System/Text/ISO2022Encoding.cs74
-rw-r--r--src/mscorlib/src/System/Text/Latin1Encoding.cs66
-rw-r--r--src/mscorlib/src/System/Text/MLangCodePageEncoding.cs19
-rw-r--r--src/mscorlib/src/System/Text/Normalization.Unix.cs123
-rw-r--r--src/mscorlib/src/System/Text/Normalization.Windows.cs286
-rw-r--r--src/mscorlib/src/System/Text/Normalization.cs314
-rw-r--r--src/mscorlib/src/System/Text/SBCSCodePageEncoding.cs93
-rw-r--r--src/mscorlib/src/System/Text/StringBuilder.cs309
-rw-r--r--src/mscorlib/src/System/Text/SurrogateEncoder.cs7
-rw-r--r--src/mscorlib/src/System/Text/UTF32Encoding.cs71
-rw-r--r--src/mscorlib/src/System/Text/UTF7Encoding.cs55
-rw-r--r--src/mscorlib/src/System/Text/UTF8Encoding.cs96
-rw-r--r--src/mscorlib/src/System/Text/UnicodeEncoding.cs92
-rw-r--r--src/mscorlib/src/System/Threading/AsyncLocal.cs387
-rw-r--r--src/mscorlib/src/System/Threading/AutoResetEvent.cs1
-rw-r--r--src/mscorlib/src/System/Threading/CancellationToken.cs14
-rw-r--r--src/mscorlib/src/System/Threading/CancellationTokenRegistration.cs1
-rw-r--r--src/mscorlib/src/System/Threading/CancellationTokenSource.cs37
-rw-r--r--src/mscorlib/src/System/Threading/CountdownEvent.cs23
-rw-r--r--src/mscorlib/src/System/Threading/EventWaitHandle.cs69
-rw-r--r--src/mscorlib/src/System/Threading/ExecutionContext.cs1222
-rw-r--r--src/mscorlib/src/System/Threading/Interlocked.cs17
-rw-r--r--src/mscorlib/src/System/Threading/LazyInitializer.cs4
-rw-r--r--src/mscorlib/src/System/Threading/LockRecursionException.cs3
-rw-r--r--src/mscorlib/src/System/Threading/ManualResetEvent.cs1
-rw-r--r--src/mscorlib/src/System/Threading/ManualResetEventSlim.cs33
-rw-r--r--src/mscorlib/src/System/Threading/Monitor.cs26
-rw-r--r--src/mscorlib/src/System/Threading/Mutex.cs208
-rw-r--r--src/mscorlib/src/System/Threading/Overlapped.cs42
-rw-r--r--src/mscorlib/src/System/Threading/ReaderWriterLock.cs36
-rw-r--r--src/mscorlib/src/System/Threading/Semaphore.cs35
-rw-r--r--src/mscorlib/src/System/Threading/SemaphoreFullException.cs3
-rw-r--r--src/mscorlib/src/System/Threading/SemaphoreSlim.cs50
-rw-r--r--src/mscorlib/src/System/Threading/SpinLock.cs110
-rw-r--r--src/mscorlib/src/System/Threading/SpinWait.cs18
-rw-r--r--src/mscorlib/src/System/Threading/SynchronizationContext.cs90
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/AsyncCausalityTracer.cs4
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/BeginEndAwaitableAdapter.cs16
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/ConcurrentExclusiveSchedulerPair.cs42
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/FutureFactory.cs148
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/Parallel.cs229
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/ParallelLoopState.cs7
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/ParallelRangeManager.cs9
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/ProducerConsumerQueues.cs12
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/TPLETWProvider.cs12
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/Task.cs229
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/TaskCompletionSource.cs6
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/TaskContinuation.cs64
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/TaskExceptionHolder.cs36
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/TaskFactory.cs100
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/TaskScheduler.cs21
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/TaskToApm.cs5
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/ThreadPoolTaskScheduler.cs7
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/future.cs27
-rw-r--r--src/mscorlib/src/System/Threading/Thread.cs633
-rw-r--r--src/mscorlib/src/System/Threading/ThreadAbortException.cs1
-rw-r--r--src/mscorlib/src/System/Threading/ThreadLocal.cs17
-rw-r--r--src/mscorlib/src/System/Threading/ThreadPool.cs230
-rw-r--r--src/mscorlib/src/System/Threading/Timer.cs79
-rw-r--r--src/mscorlib/src/System/Threading/Volatile.cs6
-rw-r--r--src/mscorlib/src/System/Threading/WaitHandle.cs83
-rw-r--r--src/mscorlib/src/System/Threading/WaitHandleCannotBeOpenedException.cs4
-rw-r--r--src/mscorlib/src/System/Threading/WaitHandleExtensions.cs46
-rw-r--r--src/mscorlib/src/System/ThrowHelper.cs211
-rw-r--r--src/mscorlib/src/System/TimeSpan.cs28
-rw-r--r--src/mscorlib/src/System/TimeZone.cs4
-rw-r--r--src/mscorlib/src/System/TimeZoneInfo.cs641
-rw-r--r--src/mscorlib/src/System/TimeZoneNotFoundException.cs3
-rw-r--r--src/mscorlib/src/System/Tuple.cs23
-rw-r--r--src/mscorlib/src/System/Type.cs144
-rw-r--r--src/mscorlib/src/System/TypeInitializationException.cs1
-rw-r--r--src/mscorlib/src/System/TypeLoadException.cs9
-rw-r--r--src/mscorlib/src/System/TypeNameParser.cs30
-rw-r--r--src/mscorlib/src/System/TypedReference.cs10
-rw-r--r--src/mscorlib/src/System/UInt16.cs4
-rw-r--r--src/mscorlib/src/System/UInt32.cs4
-rw-r--r--src/mscorlib/src/System/UInt64.cs4
-rw-r--r--src/mscorlib/src/System/UIntPtr.cs25
-rw-r--r--src/mscorlib/src/System/UnSafeCharBuffer.cs57
-rw-r--r--src/mscorlib/src/System/UnhandledExceptionEventHandler.cs3
-rw-r--r--src/mscorlib/src/System/UnitySerializationHolder.cs4
-rw-r--r--src/mscorlib/src/System/ValueType.cs4
-rw-r--r--src/mscorlib/src/System/Variant.cs27
-rw-r--r--src/mscorlib/src/System/Version.cs164
-rw-r--r--src/mscorlib/src/System/WeakReference.cs23
-rw-r--r--src/mscorlib/src/System/WeakReferenceOfT.cs10
-rw-r--r--src/mscorlib/src/System/_LocalDataStore.cs6
-rw-r--r--src/mscorlib/src/System/_LocalDataStoreMgr.cs13
-rw-r--r--src/mscorlib/src/System/__ComObject.cs13
-rw-r--r--src/mscorlib/src/System/cominterfaces.cs34
-rw-r--r--src/mscorlib/src/System/mda.cs11
-rw-r--r--src/mscorlib/src/mscorlib.Friends.cs2
-rw-r--r--src/mscorlib/src/mscorlib.txt3494
611 files changed, 12247 insertions, 52382 deletions
diff --git a/src/mscorlib/src/Internal/Runtime/Augments/EnvironmentAugments.cs b/src/mscorlib/src/Internal/Runtime/Augments/EnvironmentAugments.cs
index 2810468..b22310e 100644
--- a/src/mscorlib/src/Internal/Runtime/Augments/EnvironmentAugments.cs
+++ b/src/mscorlib/src/Internal/Runtime/Augments/EnvironmentAugments.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System;
+using System.Collections;
namespace Internal.Runtime.Augments
{
@@ -17,5 +18,11 @@ namespace Internal.Runtime.Augments
public static bool HasShutdownStarted => Environment.HasShutdownStarted;
public static string StackTrace => Environment.StackTrace;
public static int TickCount => Environment.TickCount;
+ public static string GetEnvironmentVariable(string variable) => Environment.GetEnvironmentVariable(variable);
+ public static string GetEnvironmentVariable(string variable, EnvironmentVariableTarget target) => Environment.GetEnvironmentVariable(variable, target);
+ public static IDictionary GetEnvironmentVariables() => Environment.GetEnvironmentVariables();
+ public static IDictionary GetEnvironmentVariables(EnvironmentVariableTarget target) => Environment.GetEnvironmentVariables(target);
+ public static void SetEnvironmentVariable(string variable, string value) => Environment.SetEnvironmentVariable(variable, value);
+ public static void SetEnvironmentVariable(string variable, string value, EnvironmentVariableTarget target) => Environment.SetEnvironmentVariable(variable, value, target);
}
}
diff --git a/src/mscorlib/src/Internal/Runtime/Augments/RuntimeThread.cs b/src/mscorlib/src/Internal/Runtime/Augments/RuntimeThread.cs
new file mode 100644
index 0000000..3aafe01
--- /dev/null
+++ b/src/mscorlib/src/Internal/Runtime/Augments/RuntimeThread.cs
@@ -0,0 +1,198 @@
+// 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;
+using System.Diagnostics.Contracts;
+using System.Runtime.CompilerServices;
+using System.Runtime.ConstrainedExecution;
+using System.Runtime.InteropServices;
+using System.Security;
+using System.Security.Permissions;
+using System.Threading;
+
+namespace Internal.Runtime.Augments
+{
+ public class RuntimeThread : CriticalFinalizerObject
+ {
+ public static RuntimeThread Create(ThreadStart start) => new Thread(start);
+ public static RuntimeThread Create(ThreadStart start, int maxStackSize) => new Thread(start, maxStackSize);
+ public static RuntimeThread Create(ParameterizedThreadStart start) => new Thread(start);
+ public static RuntimeThread Create(ParameterizedThreadStart start, int maxStackSize) => new Thread(start, maxStackSize);
+
+ private Thread AsThread()
+ {
+ Debug.Assert(this is Thread);
+ return (Thread)this;
+ }
+
+ public static RuntimeThread CurrentThread => Thread.CurrentThread;
+
+ /*=========================================================================
+ ** Returns true if the thread has been started and is not dead.
+ =========================================================================*/
+ public extern bool IsAlive
+ {
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ /*=========================================================================
+ ** Return whether or not this thread is a background thread. Background
+ ** threads do not affect when the Execution Engine shuts down.
+ **
+ ** Exceptions: ThreadStateException if the thread is dead.
+ =========================================================================*/
+ public bool IsBackground
+ {
+ get { return IsBackgroundNative(); }
+ set { SetBackgroundNative(value); }
+ }
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ private extern bool IsBackgroundNative();
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ private extern void SetBackgroundNative(bool isBackground);
+
+ /*=========================================================================
+ ** Returns true if the thread is a threadpool thread.
+ =========================================================================*/
+ public extern bool IsThreadPoolThread
+ {
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public int ManagedThreadId => AsThread().ManagedThreadId;
+ public string Name { get { return AsThread().Name; } set { AsThread().Name = value; } }
+
+ /*=========================================================================
+ ** Returns the priority of the thread.
+ **
+ ** Exceptions: ThreadStateException if the thread is dead.
+ =========================================================================*/
+ public ThreadPriority Priority
+ {
+ get { return (ThreadPriority)GetPriorityNative(); }
+ set { SetPriorityNative((int)value); }
+ }
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ private extern int GetPriorityNative();
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ private extern void SetPriorityNative(int priority);
+
+ /*=========================================================================
+ ** Return the thread state as a consistent set of bits. This is more
+ ** general then IsAlive or IsBackground.
+ =========================================================================*/
+ public ThreadState ThreadState
+ {
+ get { return (ThreadState)GetThreadStateNative(); }
+ }
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ private extern int GetThreadStateNative();
+
+ public ApartmentState GetApartmentState()
+ {
+#if FEATURE_COMINTEROP_APARTMENT_SUPPORT
+ return (ApartmentState)GetApartmentStateNative();
+#else // !FEATURE_COMINTEROP_APARTMENT_SUPPORT
+ Debug.Assert(false); // the Thread class in CoreFX should have handled this case
+ return ApartmentState.MTA;
+#endif // FEATURE_COMINTEROP_APARTMENT_SUPPORT
+ }
+
+ /*=========================================================================
+ ** An unstarted thread can be marked to indicate that it will host a
+ ** single-threaded or multi-threaded apartment.
+ =========================================================================*/
+ public bool TrySetApartmentState(ApartmentState state)
+ {
+#if FEATURE_COMINTEROP_APARTMENT_SUPPORT
+ return SetApartmentStateHelper(state, false);
+#else // !FEATURE_COMINTEROP_APARTMENT_SUPPORT
+ Debug.Assert(false); // the Thread class in CoreFX should have handled this case
+ return false;
+#endif // FEATURE_COMINTEROP_APARTMENT_SUPPORT
+ }
+
+#if FEATURE_COMINTEROP_APARTMENT_SUPPORT
+ internal bool SetApartmentStateHelper(ApartmentState state, bool fireMDAOnMismatch)
+ {
+ ApartmentState retState = (ApartmentState)SetApartmentStateNative((int)state, fireMDAOnMismatch);
+
+ // Special case where we pass in Unknown and get back MTA.
+ // Once we CoUninitialize the thread, the OS will still
+ // report the thread as implicitly in the MTA if any
+ // other thread in the process is CoInitialized.
+ if ((state == System.Threading.ApartmentState.Unknown) && (retState == System.Threading.ApartmentState.MTA))
+ return true;
+
+ if (retState != state)
+ return false;
+
+ return true;
+ }
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern int GetApartmentStateNative();
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ internal extern int SetApartmentStateNative(int state, bool fireMDAOnMismatch);
+#endif // FEATURE_COMINTEROP_APARTMENT_SUPPORT
+
+#if FEATURE_COMINTEROP
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ public extern void DisableComObjectEagerCleanup();
+#else // !FEATURE_COMINTEROP
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+ public void DisableComObjectEagerCleanup()
+ {
+ Debug.Assert(false); // the Thread class in CoreFX should have handled this case
+ }
+#endif // FEATURE_COMINTEROP
+
+ /*=========================================================================
+ ** Interrupts a thread that is inside a Wait(), Sleep() or Join(). If that
+ ** thread is not currently blocked in that manner, it will be interrupted
+ ** when it next begins to block.
+ =========================================================================*/
+#pragma warning disable 618 // obsolete types: SecurityPermissionAttribute, SecurityAction
+#pragma warning restore 618 // obsolete types: SecurityPermissionAttribute, SecurityAction
+ public void Interrupt() => InterruptInternal();
+
+ // Internal helper (since we can't place security demands on
+ // ecalls/fcalls).
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ private extern void InterruptInternal();
+
+ /*=========================================================================
+ ** Waits for the thread to die or for timeout milliseconds to elapse.
+ ** Returns true if the thread died, or false if the wait timed out. If
+ ** Timeout.Infinite is given as the parameter, no timeout will occur.
+ **
+ ** Exceptions: ArgumentException if timeout < 0.
+ ** ThreadInterruptedException if the thread is interrupted while waiting.
+ ** ThreadStateException if the thread has not been started yet.
+ =========================================================================*/
+ public void Join() => JoinInternal(Timeout.Infinite);
+
+ public bool Join(int millisecondsTimeout) => JoinInternal(millisecondsTimeout);
+
+ [MethodImpl(MethodImplOptions.InternalCall)]
+ private extern bool JoinInternal(int millisecondsTimeout);
+
+ public static void Sleep(int millisecondsTimeout) => Thread.Sleep(millisecondsTimeout);
+ public static void SpinWait(int iterations) => Thread.SpinWait(iterations);
+ public static bool Yield() => Thread.Yield();
+
+ public void Start() => AsThread().Start();
+ public void Start(object parameter) => AsThread().Start(parameter);
+ }
+}
diff --git a/src/mscorlib/src/Microsoft/Win32/OAVariantLib.cs b/src/mscorlib/src/Microsoft/Win32/OAVariantLib.cs
index 118c69b..6c2c6e9 100644
--- a/src/mscorlib/src/Microsoft/Win32/OAVariantLib.cs
+++ b/src/mscorlib/src/Microsoft/Win32/OAVariantLib.cs
@@ -73,13 +73,12 @@ namespace Microsoft.Win32 {
* Variant and the types that CLR supports explicitly in the
* CLR Variant class.
*/
- [System.Security.SecurityCritical] // auto-generated
internal static Variant ChangeType(Variant source, Type targetClass, short options, CultureInfo culture)
{
if (targetClass == null)
- throw new ArgumentNullException("targetClass");
+ throw new ArgumentNullException(nameof(targetClass));
if (culture == null)
- throw new ArgumentNullException("culture");
+ throw new ArgumentNullException(nameof(culture));
Variant result = new Variant ();
ChangeTypeEx(ref result, ref source,
#if FEATURE_USE_LCID
@@ -125,7 +124,6 @@ namespace Microsoft.Win32 {
#region Private FCalls
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern void ChangeTypeEx(ref Variant result, ref Variant source, int lcid, IntPtr typeHandle, int cvType, short flags);
diff --git a/src/mscorlib/src/Microsoft/Win32/Registry.cs b/src/mscorlib/src/Microsoft/Win32/Registry.cs
index 4faf29d..3ee5f46 100644
--- a/src/mscorlib/src/Microsoft/Win32/Registry.cs
+++ b/src/mscorlib/src/Microsoft/Win32/Registry.cs
@@ -17,7 +17,6 @@ namespace Microsoft.Win32 {
//This class contains only static members and does not need to be serializable.
[ComVisible(true)]
public static class Registry {
- [System.Security.SecuritySafeCritical] // auto-generated
static Registry()
{
}
@@ -63,17 +62,6 @@ namespace Microsoft.Win32 {
* This is where current configuration information is stored.
*/
public static readonly RegistryKey CurrentConfig = RegistryKey.GetBaseKey(RegistryKey.HKEY_CURRENT_CONFIG);
-
-#if !FEATURE_CORECLR
- /**
- * Dynamic Data Root Key.
- *
- * LEGACY: This is where dynamic performance data is stored on Win9X.
- * This does not exist on NT.
- */
- [Obsolete("The DynData registry key only works on Win9x, which is no longer supported by the CLR. On NT-based operating systems, use the PerformanceData registry key instead.")]
- public static readonly RegistryKey DynData = RegistryKey.GetBaseKey(RegistryKey.HKEY_DYN_DATA);
-#endif
//
// Following function will parse a keyName and returns the basekey for it.
@@ -81,10 +69,9 @@ namespace Microsoft.Win32 {
// If the keyName is not valid, we will throw ArgumentException.
// The return value shouldn't be null.
//
- [System.Security.SecurityCritical] // auto-generated
private static RegistryKey GetBaseKeyFromKeyName(string keyName, out string subKeyName) {
if( keyName == null) {
- throw new ArgumentNullException("keyName");
+ throw new ArgumentNullException(nameof(keyName));
}
string basekeyName;
@@ -116,13 +103,8 @@ namespace Microsoft.Win32 {
case "HKEY_CURRENT_CONFIG":
basekey = Registry.CurrentConfig;
break;
-#if !FEATURE_CORECLR
- case "HKEY_DYN_DATA":
- basekey = RegistryKey.GetBaseKey(RegistryKey.HKEY_DYN_DATA);
- break;
-#endif
default:
- throw new ArgumentException(Environment.GetResourceString("Arg_RegInvalidKeyName", "keyName"));
+ throw new ArgumentException(Environment.GetResourceString("Arg_RegInvalidKeyName", nameof(keyName)));
}
if( i == -1 || i == keyName.Length) {
subKeyName = string.Empty;
@@ -133,7 +115,6 @@ namespace Microsoft.Win32 {
return basekey;
}
- [System.Security.SecuritySafeCritical] // auto-generated
public static object GetValue(string keyName, string valueName, object defaultValue ) {
string subKeyName;
RegistryKey basekey = GetBaseKeyFromKeyName(keyName, out subKeyName);
@@ -154,7 +135,6 @@ namespace Microsoft.Win32 {
SetValue(keyName, valueName, value, RegistryValueKind.Unknown);
}
- [System.Security.SecuritySafeCritical] // auto-generated
public static void SetValue(string keyName, string valueName, object value, RegistryValueKind valueKind ) {
string subKeyName;
RegistryKey basekey = GetBaseKeyFromKeyName(keyName, out subKeyName);
diff --git a/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs b/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs
index dcf31dc..ff678f1 100644
--- a/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs
+++ b/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs
@@ -49,15 +49,12 @@
*/
-namespace Microsoft.Win32 {
-
+namespace Microsoft.Win32
+{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Security;
-#if FEATURE_MACL
- using System.Security.AccessControl;
-#endif
using System.Security.Permissions;
using System.Text;
using System.Threading;
@@ -74,7 +71,7 @@ namespace Microsoft.Win32 {
* Registry hive values. Useful only for GetRemoteBaseKey
*/
[Serializable]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public enum RegistryHive
{
ClassesRoot = unchecked((int)0x80000000),
@@ -83,9 +80,6 @@ namespace Microsoft.Win32 {
Users = unchecked((int)0x80000003),
PerformanceData = unchecked((int)0x80000004),
CurrentConfig = unchecked((int)0x80000005),
-#if !FEATURE_CORECLR
- DynData = unchecked((int)0x80000006),
-#endif
}
/**
@@ -96,13 +90,8 @@ namespace Microsoft.Win32 {
* @security(checkDllCalls=off)
* @security(checkClassLinking=on)
*/
-#if FEATURE_REMOTING
[ComVisible(true)]
public sealed class RegistryKey : MarshalByRefObject, IDisposable
-#else
- [ComVisible(true)]
- public sealed class RegistryKey : IDisposable
-#endif
{
// We could use const here, if C# supported ELEMENT_TYPE_I fully.
@@ -112,9 +101,6 @@ namespace Microsoft.Win32 {
internal static readonly IntPtr HKEY_USERS = new IntPtr(unchecked((int)0x80000003));
internal static readonly IntPtr HKEY_PERFORMANCE_DATA = new IntPtr(unchecked((int)0x80000004));
internal static readonly IntPtr HKEY_CURRENT_CONFIG = new IntPtr(unchecked((int)0x80000005));
-#if !FEATURE_CORECLR
- internal static readonly IntPtr HKEY_DYN_DATA = new IntPtr(unchecked((int)0x80000006));
-#endif
// Dirty indicates that we have munged data that should be potentially
// written to disk.
@@ -142,9 +128,6 @@ namespace Microsoft.Win32 {
"HKEY_USERS",
"HKEY_PERFORMANCE_DATA",
"HKEY_CURRENT_CONFIG",
-#if !FEATURE_CORECLR
- "HKEY_DYN_DATA"
-#endif
};
// MSDN defines the following limits for registry key names & values:
@@ -154,7 +137,6 @@ namespace Microsoft.Win32 {
private const int MaxKeyLength = 255;
private const int MaxValueLength = 16383;
- [System.Security.SecurityCritical] // auto-generated
private volatile SafeRegistryHandle hkey = null;
private volatile int state = 0;
private volatile String keyName;
@@ -188,7 +170,6 @@ namespace Microsoft.Win32 {
* This key is bound to hkey, if writable is <b>false</b> then no write operations
* will be allowed.
*/
- [System.Security.SecurityCritical] // auto-generated
private RegistryKey(SafeRegistryHandle hkey, bool writable, RegistryView view)
: this(hkey, writable, false, false, false, view) {
}
@@ -203,7 +184,6 @@ namespace Microsoft.Win32 {
* The remoteKey flag when set to true indicates that we are dealing with registry entries
* on a remote machine and requires the program making these calls to have full trust.
*/
- [System.Security.SecurityCritical] // auto-generated
private RegistryKey(SafeRegistryHandle hkey, bool writable, bool systemkey, bool remoteKey, bool isPerfData, RegistryView view) {
this.hkey = hkey;
this.keyName = "";
@@ -227,7 +207,6 @@ namespace Microsoft.Win32 {
Dispose(true);
}
- [System.Security.SecuritySafeCritical] // auto-generated
private void Dispose(bool disposing) {
if (hkey != null) {
@@ -260,7 +239,6 @@ namespace Microsoft.Win32 {
}
}
- [System.Security.SecuritySafeCritical] // auto-generated
public void Flush() {
if (hkey != null) {
if (IsDirty()) {
@@ -269,11 +247,7 @@ namespace Microsoft.Win32 {
}
}
-#if FEATURE_CORECLR
void IDisposable.Dispose()
-#else
- public void Dispose()
-#endif
{
Dispose(true);
}
@@ -314,22 +288,6 @@ namespace Microsoft.Win32 {
return CreateSubKeyInternal(subkey, writable ? RegistryKeyPermissionCheck.ReadWriteSubTree : RegistryKeyPermissionCheck.ReadSubTree, null, options);
}
-
-#if FEATURE_MACL
- [ComVisible(false)]
- public unsafe RegistryKey CreateSubKey(String subkey, RegistryKeyPermissionCheck permissionCheck, RegistrySecurity registrySecurity)
- {
- return CreateSubKeyInternal(subkey, permissionCheck, registrySecurity, RegistryOptions.None);
- }
-
- [ComVisible(false)]
- public unsafe RegistryKey CreateSubKey(String subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions registryOptions, RegistrySecurity registrySecurity)
- {
- return CreateSubKeyInternal(subkey, permissionCheck, registrySecurity, registryOptions);
- }
-#endif
-
- [System.Security.SecuritySafeCritical] // auto-generated
[ComVisible(false)]
private unsafe RegistryKey CreateSubKeyInternal(String subkey, RegistryKeyPermissionCheck permissionCheck, object registrySecurityObj, RegistryOptions registryOptions)
{
@@ -351,23 +309,9 @@ namespace Microsoft.Win32 {
}
CheckPermission(RegistryInternalCheck.CheckSubKeyCreatePermission, subkey, false, RegistryKeyPermissionCheck.Default);
-
+
Win32Native.SECURITY_ATTRIBUTES secAttrs = null;
-#if FEATURE_MACL
- RegistrySecurity registrySecurity = (RegistrySecurity)registrySecurityObj;
- // For ACL's, get the security descriptor from the RegistrySecurity.
- if (registrySecurity != null) {
- secAttrs = new Win32Native.SECURITY_ATTRIBUTES();
- secAttrs.nLength = (int)Marshal.SizeOf(secAttrs);
-
- byte[] sd = registrySecurity.GetSecurityDescriptorBinaryForm();
- // We allocate memory on the stack to improve the speed.
- // So this part of code can't be refactored into a method.
- byte* pSecDescriptor = stackalloc byte[sd.Length];
- Buffer.Memcpy(pSecDescriptor, 0, sd, 0, sd.Length);
- secAttrs.pSecurityDescriptor = pSecDescriptor;
- }
-#endif
+
int disposition = 0;
// By default, the new key will be writable.
@@ -412,7 +356,6 @@ namespace Microsoft.Win32 {
DeleteSubKey(subkey, true);
}
- [System.Security.SecuritySafeCritical] // auto-generated
public void DeleteSubKey(String subkey, bool throwOnMissingSubKey) {
ValidateKeyName(subkey);
EnsureWriteable();
@@ -466,7 +409,6 @@ namespace Microsoft.Win32 {
DeleteSubKeyTree(subkey, true /*throwOnMissingSubKey*/);
}
- [System.Security.SecuritySafeCritical] // auto-generated
[ComVisible(false)]
public void DeleteSubKeyTree(String subkey, Boolean throwOnMissingSubKey) {
ValidateKeyName(subkey);
@@ -514,7 +456,6 @@ namespace Microsoft.Win32 {
// An internal version which does no security checks or argument checking. Skipping the
// security checks should give us a slight perf gain on large trees.
- [System.Security.SecurityCritical] // auto-generated
private void DeleteSubKeyTreeInternal(string subkey) {
RegistryKey key = InternalOpenSubKey(subkey, true);
if (key != null) {
@@ -541,7 +482,7 @@ namespace Microsoft.Win32 {
if (ret!=0) Win32Error(ret, null);
}
else {
- ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RegSubKeyAbsent);
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RegSubKeyAbsent);
}
}
@@ -554,7 +495,6 @@ namespace Microsoft.Win32 {
DeleteValue(name, true);
}
- [System.Security.SecuritySafeCritical] // auto-generated
public void DeleteValue(String name, bool throwOnMissingValue) {
EnsureWriteable();
CheckPermission(RegistryInternalCheck.CheckValueWritePermission, name, false, RegistryKeyPermissionCheck.Default);
@@ -592,12 +532,10 @@ namespace Microsoft.Win32 {
*
* @return the RegistryKey requested.
*/
- [System.Security.SecurityCritical] // auto-generated
internal static RegistryKey GetBaseKey(IntPtr hKey) {
return GetBaseKey(hKey, RegistryView.Default);
}
- [System.Security.SecurityCritical] // auto-generated
internal static RegistryKey GetBaseKey(IntPtr hKey, RegistryView view) {
int index = ((int)hKey) & 0x0FFFFFFF;
@@ -615,7 +553,6 @@ namespace Microsoft.Win32 {
}
- [System.Security.SecuritySafeCritical] // auto-generated
[ComVisible(false)]
public static RegistryKey OpenBaseKey(RegistryHive hKey, RegistryView view) {
ValidateKeyView(view);
@@ -645,11 +582,10 @@ namespace Microsoft.Win32 {
return OpenRemoteBaseKey(hKey, machineName, RegistryView.Default);
}
- [System.Security.SecuritySafeCritical] // auto-generated
[ComVisible(false)]
public static RegistryKey OpenRemoteBaseKey(RegistryHive hKey, String machineName, RegistryView view) {
if (machineName==null)
- throw new ArgumentNullException("machineName");
+ throw new ArgumentNullException(nameof(machineName));
int index = (int)hKey & 0x0FFFFFFF;
if (index < 0 || index >= hkeyNames.Length || ((int)hKey & 0xFFFFFFF0) != 0x80000000) {
throw new ArgumentException(Environment.GetResourceString("Arg_RegKeyOutOfRange"));
@@ -687,11 +623,6 @@ namespace Microsoft.Win32 {
*
* @return the Subkey requested, or <b>null</b> if the operation failed.
*/
- #if FEATURE_CORECLR
- [System.Security.SecurityCritical] // auto-generated
- #else
- [System.Security.SecuritySafeCritical]
- #endif
public RegistryKey OpenSubKey(string name, bool writable ) {
ValidateKeyName(name);
EnsureNotDisposed();
@@ -722,63 +653,8 @@ namespace Microsoft.Win32 {
return null;
}
-#if FEATURE_MACL
-
- [System.Security.SecuritySafeCritical] // auto-generated
- [ComVisible(false)]
- public RegistryKey OpenSubKey(String name, RegistryKeyPermissionCheck permissionCheck) {
- ValidateKeyMode(permissionCheck);
- return InternalOpenSubKey(name, permissionCheck, GetRegistryKeyAccess(permissionCheck));
- }
-
- [System.Security.SecuritySafeCritical]
- [ComVisible(false)]
- public RegistryKey OpenSubKey(String name, RegistryRights rights)
- {
- return InternalOpenSubKey(name, this.checkMode, (int)rights);
- }
-
- [System.Security.SecuritySafeCritical] // auto-generated
- [ComVisible(false)]
- public RegistryKey OpenSubKey(String name, RegistryKeyPermissionCheck permissionCheck, RegistryRights rights) {
- return InternalOpenSubKey(name, permissionCheck, (int)rights);
- }
-
- [System.Security.SecurityCritical] // auto-generated
- private RegistryKey InternalOpenSubKey(String name, RegistryKeyPermissionCheck permissionCheck, int rights) {
- ValidateKeyName(name);
- ValidateKeyMode(permissionCheck);
-
- ValidateKeyRights(rights);
-
- EnsureNotDisposed();
- name = FixupName(name); // Fixup multiple slashes to a single slash
-
- CheckPermission(RegistryInternalCheck.CheckOpenSubKeyPermission, name, false, permissionCheck);
- CheckPermission(RegistryInternalCheck.CheckSubTreePermission, name, false, permissionCheck);
- SafeRegistryHandle result = null;
- int ret = Win32Native.RegOpenKeyEx(hkey, name, 0, (rights | (int)regView), out result);
- if (ret == 0 && !result.IsInvalid) {
- RegistryKey key = new RegistryKey(result, (permissionCheck == RegistryKeyPermissionCheck.ReadWriteSubTree), false, remoteKey, false, regView);
- key.keyName = keyName + "\\" + name;
- key.checkMode = permissionCheck;
- return key;
- }
-
- // Return null if we didn't find the key.
- if (ret == Win32Native.ERROR_ACCESS_DENIED || ret == Win32Native.ERROR_BAD_IMPERSONATION_LEVEL) {
- // We need to throw SecurityException here for compatiblity reason,
- // although UnauthorizedAccessException will make more sense.
- ThrowHelper.ThrowSecurityException(ExceptionResource.Security_RegistryPermission);
- }
-
- return null;
- }
-#endif
-
// This required no security checks. This is to get around the Deleting SubKeys which only require
// write permission. They call OpenSubKey which required read. Now instead call this function w/o security checks
- [System.Security.SecurityCritical] // auto-generated
internal RegistryKey InternalOpenSubKey(String name, bool writable) {
ValidateKeyName(name);
EnsureNotDisposed();
@@ -805,9 +681,6 @@ namespace Microsoft.Win32 {
*
* @return the Subkey requested, or <b>null</b> if the operation failed.
*/
-#if FEATURE_CORECLR
- [System.Security.SecurityCritical]
-#endif
public RegistryKey OpenSubKey(String name) {
return OpenSubKey(name, false);
}
@@ -818,7 +691,6 @@ namespace Microsoft.Win32 {
* @return a count of subkeys.
*/
public int SubKeyCount {
- [System.Security.SecuritySafeCritical] // auto-generated
get {
CheckPermission(RegistryInternalCheck.CheckKeyReadPermission, null, false, RegistryKeyPermissionCheck.Default);
return InternalSubKeyCount();
@@ -827,90 +699,12 @@ namespace Microsoft.Win32 {
[ComVisible(false)]
public RegistryView View {
- [System.Security.SecuritySafeCritical]
get {
EnsureNotDisposed();
return regView;
}
}
-#if !FEATURE_CORECLR
- [ComVisible(false)]
- public SafeRegistryHandle Handle {
- [System.Security.SecurityCritical]
- [SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
- get {
- EnsureNotDisposed();
- int ret = Win32Native.ERROR_INVALID_HANDLE;
- if (IsSystemKey()) {
- IntPtr baseKey = (IntPtr)0;
- switch (keyName) {
- case "HKEY_CLASSES_ROOT":
- baseKey = HKEY_CLASSES_ROOT;
- break;
- case "HKEY_CURRENT_USER":
- baseKey = HKEY_CURRENT_USER;
- break;
- case "HKEY_LOCAL_MACHINE":
- baseKey = HKEY_LOCAL_MACHINE;
- break;
- case "HKEY_USERS":
- baseKey = HKEY_USERS;
- break;
- case "HKEY_PERFORMANCE_DATA":
- baseKey = HKEY_PERFORMANCE_DATA;
- break;
- case "HKEY_CURRENT_CONFIG":
- baseKey = HKEY_CURRENT_CONFIG;
- break;
- case "HKEY_DYN_DATA":
- baseKey = HKEY_DYN_DATA;
- break;
- default:
- Win32Error(ret, null);
- break;
- }
- // open the base key so that RegistryKey.Handle will return a valid handle
- SafeRegistryHandle result;
- ret = Win32Native.RegOpenKeyEx(baseKey,
- null,
- 0,
- GetRegistryKeyAccess(IsWritable()) | (int)regView,
- out result);
-
- if (ret == 0 && !result.IsInvalid) {
- return result;
- }
- else {
- Win32Error(ret, null);
- }
- }
- else {
- return hkey;
- }
- throw new IOException(Win32Native.GetMessage(ret), ret);
- }
- }
-
- [System.Security.SecurityCritical]
- [ComVisible(false)]
- [SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
- public static RegistryKey FromHandle(SafeRegistryHandle handle) {
- return FromHandle(handle, RegistryView.Default);
- }
-
- [System.Security.SecurityCritical]
- [ComVisible(false)]
- [SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
- public static RegistryKey FromHandle(SafeRegistryHandle handle, RegistryView view) {
- if (handle == null) throw new ArgumentNullException("handle");
- ValidateKeyView(view);
-
- return new RegistryKey(handle, true /* isWritable */, view);
- }
-#endif
-
- [System.Security.SecurityCritical] // auto-generated
internal int InternalSubKeyCount() {
EnsureNotDisposed();
@@ -939,17 +733,11 @@ namespace Microsoft.Win32 {
*
* @return all subkey names.
*/
- #if FEATURE_CORECLR
- [System.Security.SecurityCritical] // auto-generated
- #else
- [System.Security.SecuritySafeCritical]
- #endif
public String[] GetSubKeyNames() {
CheckPermission(RegistryInternalCheck.CheckKeyReadPermission, null, false, RegistryKeyPermissionCheck.Default);
return InternalGetSubKeyNames();
}
- [System.Security.SecurityCritical] // auto-generated
internal unsafe String[] InternalGetSubKeyNames() {
EnsureNotDisposed();
int subkeys = InternalSubKeyCount();
@@ -988,14 +776,12 @@ namespace Microsoft.Win32 {
* @return a count of values.
*/
public int ValueCount {
- [System.Security.SecuritySafeCritical] // auto-generated
get {
CheckPermission(RegistryInternalCheck.CheckKeyReadPermission, null, false, RegistryKeyPermissionCheck.Default);
return InternalValueCount();
}
}
- [System.Security.SecurityCritical] // auto-generated
internal int InternalValueCount() {
EnsureNotDisposed();
int values = 0;
@@ -1022,7 +808,6 @@ namespace Microsoft.Win32 {
*
* @return all value names.
*/
- [System.Security.SecuritySafeCritical] // auto-generated
public unsafe String[] GetValueNames() {
CheckPermission(RegistryInternalCheck.CheckKeyReadPermission, null, false, RegistryKeyPermissionCheck.Default);
EnsureNotDisposed();
@@ -1073,7 +858,6 @@ namespace Microsoft.Win32 {
*
* @return the data associated with the value.
*/
- [System.Security.SecuritySafeCritical] // auto-generated
public Object GetValue(String name) {
CheckPermission(RegistryInternalCheck.CheckValueReadPermission, name, false, RegistryKeyPermissionCheck.Default);
return InternalGetValue(name, null, false, true);
@@ -1094,32 +878,21 @@ namespace Microsoft.Win32 {
*
* @return the data associated with the value.
*/
- #if FEATURE_CORECLR
- [System.Security.SecurityCritical] // auto-generated
- #else
- [System.Security.SecuritySafeCritical]
- #endif
public Object GetValue(String name, Object defaultValue) {
CheckPermission(RegistryInternalCheck.CheckValueReadPermission, name, false, RegistryKeyPermissionCheck.Default);
return InternalGetValue(name, defaultValue, false, true);
}
- #if FEATURE_CORECLR
- [System.Security.SecurityCritical] // auto-generated
- #else
- [System.Security.SecuritySafeCritical]
- #endif
[ComVisible(false)]
public Object GetValue(String name, Object defaultValue, RegistryValueOptions options) {
if( options < RegistryValueOptions.None || options > RegistryValueOptions.DoNotExpandEnvironmentNames) {
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)options), "options");
+ throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)options), nameof(options));
}
bool doNotExpand = (options == RegistryValueOptions.DoNotExpandEnvironmentNames);
CheckPermission(RegistryInternalCheck.CheckValueReadPermission, name, false, RegistryKeyPermissionCheck.Default);
return InternalGetValue(name, defaultValue, doNotExpand, true);
}
- [System.Security.SecurityCritical] // auto-generated
internal Object InternalGetValue(String name, Object defaultValue, bool doNotExpand, bool checkSecurity) {
if (checkSecurity) {
// Name can be null! It's the most common use of RegQueryValueEx
@@ -1338,7 +1111,6 @@ namespace Microsoft.Win32 {
}
- [System.Security.SecuritySafeCritical] // auto-generated
[ComVisible(false)]
public RegistryValueKind GetValueKind(string name) {
CheckPermission(RegistryInternalCheck.CheckValueReadPermission, name, false, RegistryKeyPermissionCheck.Default);
@@ -1382,7 +1154,6 @@ namespace Microsoft.Win32 {
}
public String Name {
- [System.Security.SecuritySafeCritical] // auto-generated
get {
EnsureNotDisposed();
return keyName;
@@ -1403,7 +1174,6 @@ namespace Microsoft.Win32 {
SetValue(name, value, RegistryValueKind.Unknown);
}
- [System.Security.SecuritySafeCritical] //auto-generated
[ComVisible(false)]
public unsafe void SetValue(String name, Object value, RegistryValueKind valueKind) {
if (value==null)
@@ -1414,7 +1184,7 @@ namespace Microsoft.Win32 {
}
if (!Enum.IsDefined(typeof(RegistryValueKind), valueKind))
- throw new ArgumentException(Environment.GetResourceString("Arg_RegBadKeyKind"), "valueKind");
+ throw new ArgumentException(Environment.GetResourceString("Arg_RegBadKeyKind"), nameof(valueKind));
EnsureWriteable();
@@ -1575,33 +1345,11 @@ namespace Microsoft.Win32 {
*
* @return a string representing the key.
*/
- [System.Security.SecuritySafeCritical] // auto-generated
public override String ToString() {
EnsureNotDisposed();
return keyName;
}
-#if FEATURE_MACL
- public RegistrySecurity GetAccessControl() {
- return GetAccessControl(AccessControlSections.Access | AccessControlSections.Owner | AccessControlSections.Group);
- }
-
- [System.Security.SecuritySafeCritical] // auto-generated
- public RegistrySecurity GetAccessControl(AccessControlSections includeSections) {
- EnsureNotDisposed();
- return new RegistrySecurity(hkey, keyName, includeSections);
- }
-
- [System.Security.SecuritySafeCritical] // auto-generated
- public void SetAccessControl(RegistrySecurity registrySecurity) {
- EnsureWriteable();
- if (registrySecurity == null)
- throw new ArgumentNullException("registrySecurity");
-
- registrySecurity.Persist(hkey, keyName);
- }
-#endif
-
/**
* After calling GetLastWin32Error(), it clears the last error field,
* so you must save the HResult and pass it to this method. This method
@@ -1609,7 +1357,6 @@ namespace Microsoft.Win32 {
* error, and depending on the error, insert a string into the message
* gotten from the ResourceManager.
*/
- [System.Security.SecuritySafeCritical] // auto-generated
internal void Win32Error(int errorCode, String str) {
switch (errorCode) {
case Win32Native.ERROR_ACCESS_DENIED:
@@ -1645,7 +1392,6 @@ namespace Microsoft.Win32 {
}
}
- [SecuritySafeCritical]
internal static void Win32ErrorStatic(int errorCode, String str) {
switch (errorCode) {
case Win32Native.ERROR_ACCESS_DENIED:
@@ -1778,18 +1524,12 @@ namespace Microsoft.Win32 {
path = keyName + "\\.";
}
- [System.Security.SecurityCritical] // auto-generated
- private void CheckPermission(RegistryInternalCheck check, string item, bool subKeyWritable, RegistryKeyPermissionCheck subKeyCheck) {
+ private void CheckPermission(RegistryInternalCheck check, string item, bool subKeyWritable, RegistryKeyPermissionCheck subKeyCheck)
+ {
bool demand = false;
RegistryPermissionAccess access = RegistryPermissionAccess.NoAccess;
string path = null;
-#if !FEATURE_CORECLR
- if (CodeAccessSecurityEngine.QuickCheckForAllDemands()) {
- return; // full trust fast path
- }
-#endif // !FEATURE_CORECLR
-
switch (check) {
//
// Read/Write/Create SubKey Permission
@@ -2020,14 +1760,12 @@ namespace Microsoft.Win32 {
}
}
- [System.Security.SecurityCritical] // auto-generated
static private void CheckUnmanagedCodePermission() {
#pragma warning disable 618
new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand();
#pragma warning restore 618
}
- [System.Security.SecurityCritical] // auto-generated
private bool ContainsRegistryValue(string name) {
int type = 0;
int datasize = 0;
@@ -2035,14 +1773,12 @@ namespace Microsoft.Win32 {
return retval == 0;
}
- [System.Security.SecurityCritical] // auto-generated
private void EnsureNotDisposed(){
if (hkey == null) {
ThrowHelper.ThrowObjectDisposedException(keyName, ExceptionResource.ObjectDisposed_RegKeyClosed);
}
}
- [System.Security.SecurityCritical] // auto-generated
private void EnsureWriteable() {
EnsureNotDisposed();
if (!IsWritable()) {
@@ -2134,16 +1870,6 @@ namespace Microsoft.Win32 {
}
}
-
-#if FEATURE_MACL
- static private void ValidateKeyRights(int rights) {
- if(0 != (rights & ~((int)RegistryRights.FullControl))) {
- // We need to throw SecurityException here for compatiblity reason,
- // although UnauthorizedAccessException will make more sense.
- ThrowHelper.ThrowSecurityException(ExceptionResource.Security_RegistryPermission);
- }
- }
-#endif
// Win32 constants for error handling
private const int FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200;
private const int FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000;
diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.cs
deleted file mode 100644
index ab06347..0000000
--- a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.cs
+++ /dev/null
@@ -1,43 +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 wrapper for file handles
-**
-**
-===========================================================*/
-
-using System;
-using System.Security;
-using System.Security.Permissions;
-using System.Runtime.InteropServices;
-using System.Runtime.CompilerServices;
-using System.Runtime.ConstrainedExecution;
-using System.Runtime.Versioning;
-using Microsoft.Win32;
-
-namespace Microsoft.Win32.SafeHandles {
-
- [System.Security.SecurityCritical] // auto-generated_required
- public sealed class SafeFileHandle: SafeHandleZeroOrMinusOneIsInvalid {
-
- private SafeFileHandle() : base(true)
- {
- }
-
- public SafeFileHandle(IntPtr preexistingHandle, bool ownsHandle) : base(ownsHandle) {
- SetHandle(preexistingHandle);
- }
-
- [System.Security.SecurityCritical]
- override protected bool ReleaseHandle()
- {
- return Win32Native.CloseHandle(handle);
- }
- }
-}
-
diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileMappingHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileMappingHandle.cs
index 5e1b510..cb915fe 100644
--- a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileMappingHandle.cs
+++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileMappingHandle.cs
@@ -20,20 +20,16 @@ using System.Runtime.Versioning;
namespace Microsoft.Win32.SafeHandles
{
- [System.Security.SecurityCritical] // auto-generated
internal sealed class SafeFileMappingHandle : SafeHandleZeroOrMinusOneIsInvalid
{
- [System.Security.SecurityCritical] // auto-generated_required
internal SafeFileMappingHandle() : base(true) {}
// 0 is an Invalid Handle
- [System.Security.SecurityCritical] // auto-generated_required
internal SafeFileMappingHandle(IntPtr handle, bool ownsHandle) : base (ownsHandle)
{
SetHandle(handle);
}
- [System.Security.SecurityCritical]
override protected bool ReleaseHandle()
{
return Win32Native.CloseHandle(handle);
diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFindHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFindHandle.cs
index b24535f..219fb77 100644
--- a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFindHandle.cs
+++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFindHandle.cs
@@ -20,13 +20,10 @@ using System.Runtime.ConstrainedExecution;
using Microsoft.Win32;
namespace Microsoft.Win32.SafeHandles {
- [System.Security.SecurityCritical] // auto-generated
internal sealed class SafeFindHandle : SafeHandleZeroOrMinusOneIsInvalid
{
- [System.Security.SecurityCritical] // auto-generated_required
internal SafeFindHandle() : base(true) {}
- [System.Security.SecurityCritical]
override protected bool ReleaseHandle()
{
return Win32Native.FindClose(handle);
diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs
index d2ea42b..2363198 100644
--- a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs
+++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs
@@ -3,24 +3,12 @@
// See the LICENSE file in the project root for more information.
namespace Microsoft.Win32 {
- using Microsoft.Win32;
using Microsoft.Win32.SafeHandles;
- using System;
- using System.Runtime.CompilerServices;
- using System.Runtime.ConstrainedExecution;
- using System.Runtime.InteropServices;
- using System.Runtime.Serialization;
- using System.Runtime.Versioning;
- using System.Security;
using System.Security.Permissions;
- using System.Text;
- [System.Security.SecurityCritical] // auto-generated
- [HostProtectionAttribute(MayLeakOnAbort = true)]
sealed internal class SafeLibraryHandle : SafeHandleZeroOrMinusOneIsInvalid {
internal SafeLibraryHandle() : base(true) {}
- [System.Security.SecurityCritical]
override protected bool ReleaseHandle()
{
return UnsafeNativeMethods.FreeLibrary(handle);
diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs
index 3eea2b9..d6c1577 100644
--- a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs
+++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs
@@ -1,13 +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 Microsoft.Win32.SafeHandles {
+
+namespace Microsoft.Win32.SafeHandles
+{
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.ConstrainedExecution;
- [System.Security.SecurityCritical] // auto-generated
internal sealed class SafeLocalAllocHandle : SafeBuffer {
private SafeLocalAllocHandle () : base(true) {}
@@ -20,7 +21,6 @@ namespace Microsoft.Win32.SafeHandles {
get { return new SafeLocalAllocHandle(IntPtr.Zero); }
}
- [System.Security.SecurityCritical]
override protected bool ReleaseHandle()
{
return Win32Native.LocalFree(handle) == IntPtr.Zero;
diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs
index d0e3f04..4f96b81 100644
--- a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs
+++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs
@@ -17,17 +17,13 @@ namespace Microsoft.Win32.SafeHandles {
using System.Runtime.ConstrainedExecution;
using System.Runtime.Versioning;
- [System.Security.SecurityCritical]
public sealed class SafeRegistryHandle : SafeHandleZeroOrMinusOneIsInvalid {
- [System.Security.SecurityCritical]
internal SafeRegistryHandle() : base(true) {}
- [System.Security.SecurityCritical]
public SafeRegistryHandle(IntPtr preexistingHandle, bool ownsHandle) : base(ownsHandle) {
SetHandle(preexistingHandle);
}
- [System.Security.SecurityCritical]
override protected bool ReleaseHandle() {
return (RegCloseKey(handle) == Win32Native.ERROR_SUCCESS);
}
diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeViewOfFileHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeViewOfFileHandle.cs
index 01ec4d2..38a9323 100644
--- a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeViewOfFileHandle.cs
+++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeViewOfFileHandle.cs
@@ -22,19 +22,15 @@ using Microsoft.Win32.SafeHandles;
namespace Microsoft.Win32.SafeHandles
{
- [System.Security.SecurityCritical] // auto-generated
internal sealed class SafeViewOfFileHandle : SafeHandleZeroOrMinusOneIsInvalid
{
- [System.Security.SecurityCritical] // auto-generated_required
internal SafeViewOfFileHandle() : base(true) {}
// 0 is an Invalid Handle
- [System.Security.SecurityCritical] // auto-generated_required
internal SafeViewOfFileHandle(IntPtr handle, bool ownsHandle) : base (ownsHandle) {
SetHandle(handle);
}
- [System.Security.SecurityCritical]
override protected bool ReleaseHandle()
{
if (Win32Native.UnmapViewOfFile(handle))
diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeWaitHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeWaitHandle.cs
index fa24c96..0e57136 100644
--- a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeWaitHandle.cs
+++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeWaitHandle.cs
@@ -24,7 +24,6 @@ using System.Threading;
namespace Microsoft.Win32.SafeHandles {
- [System.Security.SecurityCritical] // auto-generated_required
public sealed class SafeWaitHandle : SafeHandleZeroOrMinusOneIsInvalid
{
// Called by P/Invoke marshaler
@@ -38,7 +37,6 @@ namespace Microsoft.Win32.SafeHandles {
SetHandle(existingHandle);
}
- [System.Security.SecurityCritical]
override protected bool ReleaseHandle()
{
return Win32Native.CloseHandle(handle);
diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs
index 58e0d7a..08ae095 100644
--- a/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs
+++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs
@@ -22,10 +22,6 @@ namespace Microsoft.Win32.SafeHandles
using System.Runtime.ConstrainedExecution;
// Class of safe handle which uses 0 or -1 as an invalid handle.
- [System.Security.SecurityCritical] // auto-generated_required
-#if !FEATURE_CORECLR
- [SecurityPermission(SecurityAction.InheritanceDemand, UnmanagedCode=true)]
-#endif
public abstract class SafeHandleZeroOrMinusOneIsInvalid : SafeHandle
{
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
@@ -33,25 +29,18 @@ namespace Microsoft.Win32.SafeHandles
{
}
-#if FEATURE_CORECLR
// A default constructor is needed to satisfy CoreCLR inheritence rules. It should not be called at runtime
protected SafeHandleZeroOrMinusOneIsInvalid()
{
throw new NotImplementedException();
}
-#endif // FEATURE_CORECLR
public override bool IsInvalid {
- [System.Security.SecurityCritical]
get { return handle.IsNull() || handle == new IntPtr(-1); }
}
}
// Class of safe handle which uses only -1 as an invalid handle.
- [System.Security.SecurityCritical] // auto-generated_required
-#if !FEATURE_CORECLR
- [SecurityPermission(SecurityAction.InheritanceDemand, UnmanagedCode=true)]
-#endif
public abstract class SafeHandleMinusOneIsInvalid : SafeHandle
{
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
@@ -59,25 +48,18 @@ namespace Microsoft.Win32.SafeHandles
{
}
-#if FEATURE_CORECLR
// A default constructor is needed to satisfy CoreCLR inheritence rules. It should not be called at runtime
protected SafeHandleMinusOneIsInvalid()
{
throw new NotImplementedException();
}
-#endif // FEATURE_CORECLR
public override bool IsInvalid {
- [System.Security.SecurityCritical]
get { return handle == new IntPtr(-1); }
}
}
// Class of critical handle which uses 0 or -1 as an invalid handle.
- [System.Security.SecurityCritical] // auto-generated_required
-#if !FEATURE_CORECLR
- [SecurityPermission(SecurityAction.InheritanceDemand, UnmanagedCode=true)]
-#endif
public abstract class CriticalHandleZeroOrMinusOneIsInvalid : CriticalHandle
{
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
@@ -86,16 +68,11 @@ namespace Microsoft.Win32.SafeHandles
}
public override bool IsInvalid {
- [System.Security.SecurityCritical]
get { return handle.IsNull() || handle == new IntPtr(-1); }
}
}
// Class of critical handle which uses only -1 as an invalid handle.
- [System.Security.SecurityCritical] // auto-generated_required
-#if !FEATURE_CORECLR
- [SecurityPermission(SecurityAction.InheritanceDemand, UnmanagedCode=true)]
-#endif
public abstract class CriticalHandleMinusOneIsInvalid : CriticalHandle
{
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
@@ -104,9 +81,7 @@ namespace Microsoft.Win32.SafeHandles
}
public override bool IsInvalid {
- [System.Security.SecurityCritical]
get { return handle == new IntPtr(-1); }
}
}
-
}
diff --git a/src/mscorlib/src/Microsoft/Win32/UnsafeNativeMethods.cs b/src/mscorlib/src/Microsoft/Win32/UnsafeNativeMethods.cs
index 9da9811..19d638d 100644
--- a/src/mscorlib/src/Microsoft/Win32/UnsafeNativeMethods.cs
+++ b/src/mscorlib/src/Microsoft/Win32/UnsafeNativeMethods.cs
@@ -16,7 +16,6 @@ namespace Microsoft.Win32 {
using System.Text;
using System.Diagnostics.Tracing;
- [System.Security.SecurityCritical] // auto-generated
[SuppressUnmanagedCodeSecurityAttribute()]
internal static class UnsafeNativeMethods {
@@ -64,7 +63,6 @@ namespace Microsoft.Win32 {
internal static extern bool FreeLibrary(IntPtr hModule);
- [SecurityCritical]
[SuppressUnmanagedCodeSecurityAttribute()]
internal static unsafe class ManifestEtw
{
@@ -96,7 +94,6 @@ namespace Microsoft.Win32 {
//
// Callback
//
- [SecurityCritical]
internal unsafe delegate void EtwEnableCallback(
[In] ref Guid sourceId,
[In] int isEnabled,
@@ -110,7 +107,6 @@ namespace Microsoft.Win32 {
//
// Registration APIs
//
- [SecurityCritical]
[DllImport(Win32Native.ADVAPI32, ExactSpelling = true, EntryPoint = "EventRegister", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
internal static extern unsafe uint EventRegister(
[In] ref Guid providerId,
@@ -120,7 +116,6 @@ namespace Microsoft.Win32 {
);
//
- [SecurityCritical]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
[DllImport(Win32Native.ADVAPI32, ExactSpelling = true, EntryPoint = "EventUnregister", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
internal static extern uint EventUnregister([In] long registrationHandle);
@@ -129,7 +124,6 @@ namespace Microsoft.Win32 {
// Writing (Publishing/Logging) APIs
//
//
- [SecurityCritical]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
[DllImport(Win32Native.ADVAPI32, ExactSpelling = true, EntryPoint = "EventWrite", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
internal static extern unsafe int EventWrite(
@@ -139,7 +133,6 @@ namespace Microsoft.Win32 {
[In] EventProvider.EventData* userData
);
- [SecurityCritical]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
[DllImport(Win32Native.ADVAPI32, ExactSpelling = true, EntryPoint = "EventWriteString", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
internal static extern unsafe int EventWriteString(
@@ -270,7 +263,6 @@ namespace Microsoft.Win32 {
}
#if FEATURE_COMINTEROP
- [SecurityCritical]
[DllImport("combase.dll", PreserveSig = true)]
internal static extern int RoGetActivationFactory(
[MarshalAs(UnmanagedType.HString)] string activatableClassId,
diff --git a/src/mscorlib/src/Microsoft/Win32/Win32Native.cs b/src/mscorlib/src/Microsoft/Win32/Win32Native.cs
index ebe53f4..b5b808b 100644
--- a/src/mscorlib/src/Microsoft/Win32/Win32Native.cs
+++ b/src/mscorlib/src/Microsoft/Win32/Win32Native.cs
@@ -90,9 +90,6 @@
namespace Microsoft.Win32 {
using System;
using System.Security;
-#if FEATURE_IMPERSONATION
- using System.Security.Principal;
-#endif
using System.Text;
using System.Configuration.Assemblies;
using System.Runtime.Remoting;
@@ -113,7 +110,6 @@ namespace Microsoft.Win32 {
// Remove the default demands for all P/Invoke methods with this
// global declaration on the class.
- [System.Security.SecurityCritical]
[SuppressUnmanagedCodeSecurityAttribute()]
internal static class Win32Native {
@@ -327,7 +323,7 @@ namespace Microsoft.Win32 {
// } REG_TZI_FORMAT;
//
if (bytes == null || bytes.Length != 44) {
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidREG_TZI_FORMAT"), "bytes");
+ throw new ArgumentException(Environment.GetResourceString("Argument_InvalidREG_TZI_FORMAT"), nameof(bytes));
}
Bias = BitConverter.ToInt32(bytes, 0);
StandardBias = BitConverter.ToInt32(bytes, 4);
@@ -454,7 +450,6 @@ namespace Microsoft.Win32 {
internal int fileSizeHigh;
internal int fileSizeLow;
- [System.Security.SecurityCritical]
internal void PopulateFrom(WIN32_FIND_DATA findData) {
// Copy the information to data
fileAttributes = findData.dwFileAttributes;
@@ -516,7 +511,6 @@ namespace Microsoft.Win32 {
/// strings created with this version of the constructor will be unsafe to use after the buffer
/// has been freed.
/// </remarks>
- [System.Security.SecurityCritical] // auto-generated
internal UNICODE_INTPTR_STRING (int stringBytes, SafeLocalAllocHandle buffer) {
BCLDebug.Assert(buffer == null || (stringBytes >= 0 && (ulong)stringBytes <= buffer.ByteLength),
"buffer == null || (stringBytes >= 0 && stringBytes <= buffer.ByteLength)");
@@ -802,7 +796,6 @@ namespace Microsoft.Win32 {
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
private static extern IntPtr GetModuleHandle(String moduleName);
- [System.Security.SecurityCritical] // auto-generated
internal static bool DoesWin32MethodExist(String moduleName, String methodName)
{
// GetModuleHandle does not increment the module's ref count, so we don't need to call FreeLibrary.
@@ -910,56 +903,6 @@ namespace Microsoft.Win32 {
[DllImport(KERNEL32, SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)]
internal static extern uint GetLongPathNameW(string lpszShortPath, SafeHandle lpszLongPath, uint cchBuffer);
- // Disallow access to all non-file devices from methods that take
- // a String. This disallows DOS devices like "con:", "com1:",
- // "lpt1:", etc. Use this to avoid security problems, like allowing
- // a web client asking a server for "http://server/com1.aspx" and
- // then causing a worker process to hang.
- [System.Security.SecurityCritical] // auto-generated
- internal static SafeFileHandle SafeCreateFile(String lpFileName,
- int dwDesiredAccess, System.IO.FileShare dwShareMode,
- SECURITY_ATTRIBUTES securityAttrs, System.IO.FileMode dwCreationDisposition,
- int dwFlagsAndAttributes, IntPtr hTemplateFile)
- {
- SafeFileHandle handle = CreateFile( lpFileName, dwDesiredAccess, dwShareMode,
- securityAttrs, dwCreationDisposition,
- dwFlagsAndAttributes, hTemplateFile );
-
- if (!handle.IsInvalid)
- {
- int fileType = Win32Native.GetFileType(handle);
- if (fileType != Win32Native.FILE_TYPE_DISK) {
- handle.Dispose();
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_FileStreamOnNonFiles"));
- }
- }
-
- return handle;
- }
-
- [System.Security.SecurityCritical] // auto-generated
- internal static SafeFileHandle UnsafeCreateFile(String lpFileName,
- int dwDesiredAccess, System.IO.FileShare dwShareMode,
- SECURITY_ATTRIBUTES securityAttrs, System.IO.FileMode dwCreationDisposition,
- int dwFlagsAndAttributes, IntPtr hTemplateFile)
- {
- SafeFileHandle handle = CreateFile( lpFileName, dwDesiredAccess, dwShareMode,
- securityAttrs, dwCreationDisposition,
- dwFlagsAndAttributes, hTemplateFile );
-
- return handle;
- }
-
- // Do not use these directly, use the safe or unsafe versions above.
- // The safe version does not support devices (aka if will only open
- // files on disk), while the unsafe version give you the full semantic
- // of the native version.
- [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
- private static extern SafeFileHandle CreateFile(String lpFileName,
- int dwDesiredAccess, System.IO.FileShare dwShareMode,
- SECURITY_ATTRIBUTES securityAttrs, System.IO.FileMode dwCreationDisposition,
- int dwFlagsAndAttributes, IntPtr hTemplateFile);
-
[DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
internal static extern SafeFileMappingHandle CreateFileMapping(SafeFileHandle hFile, IntPtr lpAttributes, uint fProtect, uint dwMaximumSizeHigh, uint dwMaximumSizeLow, String lpName);
@@ -988,7 +931,6 @@ namespace Microsoft.Win32 {
[DllImport(KERNEL32, SetLastError=true, EntryPoint="SetFilePointer")]
private unsafe static extern int SetFilePointerWin32(SafeFileHandle handle, int lo, int * hi, int origin);
- [System.Security.SecurityCritical] // auto-generated
internal unsafe static long SetFilePointer(SafeFileHandle handle, long offset, System.IO.SeekOrigin origin, out int hr) {
hr = 0;
int lo = (int) offset;
@@ -1070,7 +1012,6 @@ namespace Microsoft.Win32 {
internal const int FIND_FROMSTART = 0x00400000; // look for value in source, starting at the beginning
internal const int FIND_FROMEND = 0x00800000; // look for value in source, starting at the end
-#if !FEATURE_CORECLR
[StructLayout(LayoutKind.Sequential)]
internal struct NlsVersionInfoEx
{
@@ -1080,7 +1021,6 @@ namespace Microsoft.Win32 {
internal int dwEffectiveId;
internal Guid guidCustomVersion;
}
-#endif
[DllImport(KERNEL32, CharSet=CharSet.Auto, SetLastError=true, BestFitMapping=false)]
internal static extern int GetWindowsDirectory([Out]StringBuilder sb, int length);
@@ -1797,18 +1737,11 @@ namespace Microsoft.Win32 {
[In] uint dwFlags);
#endif // FEATURE_LEGACYSURFACE
-#if FEATURE_CORECLR
[DllImport(NTDLL, CharSet=CharSet.Unicode, SetLastError=true)]
internal static extern
int RtlNtStatusToDosError (
[In] int status);
-#else
- // identical to RtlNtStatusToDosError, but we are in ask mode for desktop CLR
- [DllImport(ADVAPI32, CharSet = CharSet.Unicode, SetLastError = true)]
- internal static extern
- int LsaNtStatusToWinError (
- [In] int status);
-#endif
+
// Get the current FIPS policy setting on Vista and above
[DllImport("bcrypt.dll")]
internal static extern uint BCryptGetFipsAlgorithmMode(
@@ -1930,28 +1863,6 @@ namespace Microsoft.Win32 {
[In] bool bInheritHandle,
[In] uint dwOptions);
-#if FEATURE_IMPERSONATION
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
- [DllImport(ADVAPI32, CharSet=CharSet.Auto, SetLastError=true)]
- internal static extern
- bool DuplicateTokenEx (
- [In] SafeAccessTokenHandle ExistingTokenHandle,
- [In] TokenAccessLevels DesiredAccess,
- [In] IntPtr TokenAttributes,
- [In] SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
- [In] System.Security.Principal.TokenType TokenType,
- [In,Out] ref SafeAccessTokenHandle DuplicateTokenHandle );
-
- [DllImport(ADVAPI32, CharSet=CharSet.Auto, SetLastError=true)]
- internal static extern
- bool DuplicateTokenEx (
- [In] SafeAccessTokenHandle hExistingToken,
- [In] uint dwDesiredAccess,
- [In] IntPtr lpTokenAttributes, // LPSECURITY_ATTRIBUTES
- [In] uint ImpersonationLevel,
- [In] uint TokenType,
- [In,Out] ref SafeAccessTokenHandle phNewToken);
-#endif
[DllImport(
ADVAPI32,
EntryPoint="EqualDomainSid",
@@ -2345,15 +2256,6 @@ namespace Microsoft.Win32 {
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
internal static extern int LsaFreeReturnBuffer(IntPtr handle);
-#if FEATURE_IMPERSONATION
- [DllImport (ADVAPI32, CharSet=CharSet.Unicode, SetLastError=true)]
- internal static extern
- bool OpenProcessToken (
- [In] IntPtr ProcessToken,
- [In] TokenAccessLevels DesiredAccess,
- [Out] out SafeAccessTokenHandle TokenHandle);
-#endif
-
[DllImport(
ADVAPI32,
EntryPoint="SetNamedSecurityInfoW",
@@ -2386,16 +2288,6 @@ namespace Microsoft.Win32 {
byte[] dacl,
byte[] sacl );
- // Fusion APIs
-#if FEATURE_FUSION
- [DllImport(MSCORWKS, CharSet=CharSet.Unicode)]
- internal static extern int CreateAssemblyNameObject(out IAssemblyName ppEnum, String szAssemblyName, uint dwFlags, IntPtr pvReserved);
-
- [DllImport(MSCORWKS, CharSet=CharSet.Auto)]
- internal static extern int CreateAssemblyEnum(out IAssemblyEnum ppEnum, IApplicationContext pAppCtx, IAssemblyName pName, uint dwFlags, IntPtr pvReserved);
-#endif // FEATURE_FUSION
-
-#if FEATURE_CORECLR
[DllImport(KERNEL32, CharSet=CharSet.Unicode)]
[SuppressUnmanagedCodeSecurityAttribute()]
internal unsafe static extern int WideCharToMultiByte(
@@ -2417,13 +2309,11 @@ namespace Microsoft.Win32 {
int cchMultiByte,
char* lpWideCharStr,
int cchWideChar);
-#endif // FEATURE_CORECLR
[DllImport(KERNEL32, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal extern static bool QueryUnbiasedInterruptTime(out ulong UnbiasedTime);
-#if FEATURE_CORECLR
#if FEATURE_PAL
[DllImport(KERNEL32, EntryPoint = "PAL_Random")]
internal extern static bool Random(bool bStrong,
@@ -2450,6 +2340,5 @@ namespace Microsoft.Win32 {
}
}
#endif
-#endif
}
}
diff --git a/src/mscorlib/src/System.Private.CoreLib.txt b/src/mscorlib/src/System.Private.CoreLib.txt
index 0369344..cf17dae 100644
--- a/src/mscorlib/src/System.Private.CoreLib.txt
+++ b/src/mscorlib/src/System.Private.CoreLib.txt
@@ -49,10 +49,6 @@ 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 !FEATURE_CORECLR
-UnknownError = Unknown error.
-#endif // !FEATURE_CORECLR
-
#if INCLUDE_DEBUG
; For code contracts
@@ -70,25 +66,6 @@ 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.
-; Access Control
-#if FEATURE_MACL
-AccessControl_MustSpecifyContainerAcl = The named parameter must be a container ACL.
-AccessControl_MustSpecifyLeafObjectAcl = The named parameter must be a non-container ACL.
-AccessControl_AclTooLong = Length of the access control list exceed the allowed maximum.
-AccessControl_MustSpecifyDirectoryObjectAcl = The named parameter must be a directory-object ACL.
-AccessControl_MustSpecifyNonDirectoryObjectAcl = The named parameter must be a non-directory-object ACL.
-AccessControl_InvalidSecurityDescriptorRevision = Security descriptor with revision other than '1' are not legal.
-AccessControl_InvalidSecurityDescriptorSelfRelativeForm = Security descriptor must be in the self-relative form.
-AccessControl_NoAssociatedSecurity = Unable to perform a security operation on an object that has no associated security. This can happen when trying to get an ACL of an anonymous kernel object.
-AccessControl_InvalidHandle = The supplied handle is invalid. This can happen when trying to set an ACL on an anonymous kernel object.
-AccessControl_UnexpectedError = Method failed with unexpected error code {0}.
-AccessControl_InvalidSidInSDDLString = The SDDL string contains an invalid sid or a sid that cannot be translated.
-AccessControl_InvalidOwner = The security identifier is not allowed to be the owner of this object.
-AccessControl_InvalidGroup = The security identifier is not allowed to be the primary group of this object.
-AccessControl_InvalidAccessRuleType = The access rule is not the correct type.
-AccessControl_InvalidAuditRuleType = The audit rule is not the correct type.
-#endif // FEATURE_MACL
-
; Identity Reference Library
#if FEATURE_IDENTITY_REFERENCE
IdentityReference_IdentityNotMapped = Some or all identity references could not be translated.
@@ -121,9 +98,7 @@ Access_Void = Cannot create an instance of void.
Arg_TypedReference_Null = The TypedReference must be initialized.
Argument_AddingDuplicate__ = Item has already been added. Key in dictionary: '{0}' Key being added: '{1}'
Argument_AddingDuplicate = An item with the same key has already been added.
-#if FEATURE_CORECLR
Argument_AddingDuplicateWithKey = An item with the same key has already been added. Key: {0}
-#endif // FEATURE_CORECLR
Argument_MethodDeclaringTypeGenericLcg = Method '{0}' has a generic declaring type '{1}'. Explicitly provide the declaring type to GetTokenFor.
Argument_MethodDeclaringTypeGeneric = Cannot resolve method {0} because the declaring type of the method handle {1} is generic. Explicitly provide the declaring type to GetMethodFromHandle.
Argument_FieldDeclaringTypeGeneric = Cannot resolve field {0} because the declaring type of the field handle {1} is generic. Explicitly provide the declaring type to GetFieldFromHandle.
@@ -206,6 +181,7 @@ 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.
@@ -553,26 +529,6 @@ 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.
-#if FEATURE_CAS_POLICY
-Argument_UninitializedCertificate = Uninitialized certificate object.
-Argument_MembershipConditionElement = Element must be a <IMembershipCondition> element.
-Argument_ReservedNPMS = Cannot remove or modify reserved permissions set '{0}'.
-Argument_NPMSInUse = Permission set '{0}' was in use and could not be deleted.
-Argument_StrongNameGetPublicKey = Unable to obtain public key for StrongNameKeyPair.
-Argument_SiteCannotBeNull = Site name must be specified.
-Argument_BlobCannotBeNull = Public key must be specified.
-Argument_ZoneCannotBeNull = Zone must be specified.
-Argument_UrlCannotBeNull = URL must be specified.
-Argument_NoNPMS = Unable to find a permission set with the provided name.
-Argument_FailedCodeGroup = Failed to create a code group of type '{0}'.
-Argument_CodeGroupChildrenMustBeCodeGroups = All objects in the input list must have a parent type of 'CodeGroup'.
-#endif // FEATURE_CAS_POLICY
-#if FEATURE_IMPERSONATION
-Argument_InvalidPrivilegeName = Privilege '{0}' is not valid on this system.
-Argument_TokenZero = Token cannot be zero.
-Argument_InvalidImpersonationToken = Invalid token for impersonation - it cannot be duplicated.
-Argument_ImpersonateUser = Unable to impersonate user.
-#endif // FEATURE_IMPERSONATION
Argument_InvalidHexFormat = Improperly formatted hex string.
Argument_InvalidSite = Invalid site.
Argument_InterfaceMap = 'this' type cannot be an interface itself.
@@ -630,6 +586,14 @@ Argument_UnmanagedMemAccessorWrapAround = The UnmanagedMemoryAccessor capacity a
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.
+#if FEATURE_SPAN_OF_T
+Argument_InvalidTypeWithPointersNotSupported = Cannot use type '{0}'. Only value types without pointers or references are supported.
+Argument_DestinationTooShort = Destination is too short.
+#endif // FEATURE_SPAN_OF_T
;
; =====================================================
@@ -1140,9 +1104,6 @@ InvalidOperation_EnumFailedVersion = Collection was modified; enumeration operat
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.
-#if FEATURE_CAS_POLICY
-InvalidOperation_ModifyROPermSet = ReadOnlyPermissionSet objects may not be modified.
-#endif // FEATURE_CAS_POLICY
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.
@@ -1157,6 +1118,7 @@ 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.
@@ -1242,7 +1204,7 @@ InvalidOperation_CannotUseAFCOtherThread = AsyncFlowControl object must be used
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 the Context that had its flow suppressed.
+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.
@@ -1405,6 +1367,7 @@ NotSupported_SignalAndWaitSTAThread = SignalAndWait on a STA thread is not suppo
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.
@@ -1451,12 +1414,6 @@ NotSupported_NonBlittableTypes = Non-blittable parameter types are not supported
NotSupported_UserDllImport = DllImport cannot be used on user-defined methods.
NotSupported_UserCOM = COM Interop is not supported for user-defined types.
#endif //FEATURE_WINDOWSPHONE
-#if FEATURE_CAS_POLICY
-NotSupported_RequiresCasPolicyExplicit = This method explicitly uses CAS policy, which has been obsoleted by the .NET Framework. In order to enable CAS policy for compatibility reasons, please use the NetFx40_LegacySecurityPolicy configuration switch. Please see http://go.microsoft.com/fwlink/?LinkID=155570 for more information.
-NotSupported_RequiresCasPolicyImplicit = This method implicitly uses CAS policy, which has been obsoleted by the .NET Framework. In order to enable CAS policy for compatibility reasons, please use the NetFx40_LegacySecurityPolicy configuration switch. Please see http://go.microsoft.com/fwlink/?LinkID=155570 for more information.
-NotSupported_CasDeny = The Deny stack modifier has been obsoleted by the .NET Framework. Please see http://go.microsoft.com/fwlink/?LinkId=155571 for more information.
-NotSupported_SecurityContextSourceAppDomainInHeterogenous = SecurityContextSource.CurrentAppDomain is not supported in heterogenous AppDomains.
-#endif // FEATURE_CAS_POLICY
#if FEATURE_APPX
NotSupported_AppX = {0} is not supported in AppX.
LoadOfFxAssemblyNotSupported_AppX = {0} of .NET Framework assemblies is not supported in AppX.
@@ -1466,9 +1423,6 @@ NotSupported_WinRT_PartialTrust = Windows Runtime is not supported in partial tr
#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_CORECLR
-NotSupported_NoTypeInfo = Cannot resolve {0} to a TypeInfo object.
-#endif
#if FEATURE_COMINTEROP
NotSupported_PIAInAppxProcess = A Primary Interop Assembly is not supported in AppX.
#endif
@@ -1476,7 +1430,12 @@ NotSupported_PIAInAppxProcess = A Primary Interop Assembly is not supported in A
; Not referring to "Windows Phone" in the messages, as FEATURE_WINDOWSPHONE is defined for .NET Core as well.
NotSupported_WindowsPhone = {0} is not supported.
NotSupported_AssemblyLoadCodeBase = Assembly.Load with a Codebase is not supported.
+NotSupported_AssemblyLoadFromHash = Assembly.LoadFrom with hashValue is not supported.
#endif
+#if FEATURE_SPAN_OF_T
+NotSupported_CannotCallEqualsOnSpan = Equals() on Span and ReadOnlySpan is not supported. Use operator== instead.
+NotSupported_CannotCallGetHashCodeOnSpan = GetHashCode() on Span and ReadOnlySpan is not supported.
+#endif // FEATURE_SPAN_OF_T
; TypeLoadException
TypeLoad_ResolveType = Could not resolve type '{0}'.
@@ -1536,81 +1495,12 @@ PlatformNotSupported_WinRT = Windows Runtime is not supported on this operating
; 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.
-#if FEATURE_IMPERSONATION
-Policy_PrincipalTwice = Default principal object cannot be set twice.
-#endif // FEATURE_IMPERSONATION
-#if FEATURE_CAS_POLICY
-Policy_PolicyAlreadySet = Policy for this domain cannot be set twice.
-Policy_NoExecutionPermission = Execution permission cannot be acquired.
-Policy_NoRequiredPermission = Required permissions cannot be acquired.
-Policy_MultipleExclusive = More than one exclusive group is not allowed.
-Policy_RecoverNotFileBased = PolicyLevel object not based on a file cannot be recovered.
-Policy_RecoverNoConfigFile = No old configuration file exists to recover.
-Policy_UnableToSave = Policy level '{0}' could not be saved: {1}.
-Policy_BadXml = Policy configuration XML is invalid. The required tag '{0}' is missing.
-Policy_NonFullTrustAssembly = Policy references an assembly not in the full trust assemblies list.
-Policy_MissingActivationContextInAppEvidence = The application evidence does not contain a Fusion activation context.
-Policy_NoTrustManager = A trust manager could not be loaded for this application.
-Policy_GrantSetDoesNotMatchDomain = An assembly was provided an invalid grant set by runtime host '{0}'. In a homogenous AppDomain, the only valid grant sets are FullTrust and the AppDomain's sandbox grant set.
-#endif // FEATURE_CAS_POLICY
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.
-#if FEATURE_CAS_POLICY
-Policy_EvidenceMustBeSerializable = Objects used as evidence must be serializable.
-Policy_DuplicateEvidence = The evidence collection already contains evidence of type '{0}'. Multiple pieces of the same type of evidence are not allowed.
-Policy_IncorrectHostEvidence = Runtime host '{0}' returned evidence of type '{1}' from a request for evidence of type '{2}'.
-Policy_NullHostEvidence = Runtime host '{0}' returned null when asked for assembly evidence for assembly '{1}'.
-Policy_NullHostGrantSet = Runtime host '{0}' returned a null grant set from ResolvePolicy.
-#endif // FEATURE_CAS_POLICY
-
-; Policy codegroup and permission set names and descriptions
-#if FEATURE_CAS_POLICY
-Policy_AllCode_Name = All_Code
-Policy_AllCode_DescriptionFullTrust = Code group grants all code full trust and forms the root of the code group tree.
-Policy_AllCode_DescriptionNothing = Code group grants no permissions and forms the root of the code group tree.
-Policy_MyComputer_Name = My_Computer_Zone
-Policy_MyComputer_Description = Code group grants full trust to all code originating on the local computer
-Policy_Intranet_Name = LocalIntranet_Zone
-Policy_Intranet_Description = Code group grants the intranet permission set to code from the intranet zone. This permission set grants intranet code the right to use isolated storage, full UI access, some capability to do reflection, and limited access to environment variables.
-Policy_IntranetNet_Name = Intranet_Same_Site_Access
-Policy_IntranetNet_Description = All intranet code gets the right to connect back to the site of its origin.
-Policy_IntranetFile_Name = Intranet_Same_Directory_Access
-Policy_IntranetFile_Description = All intranet code gets the right to read from its install directory.
-Policy_Internet_Name = Internet_Zone
-Policy_Internet_Description = Code group grants code from the Internet zone the Internet permission set. This permission set grants Internet code the right to use isolated storage and limited UI access.
-Policy_InternetNet_Name = Internet_Same_Site_Access
-Policy_InternetNet_Description = All Internet code gets the right to connect back to the site of its origin.
-Policy_Trusted_Name = Trusted_Zone
-Policy_Trusted_Description = Code from a trusted zone is granted the Internet permission set. This permission set grants the right to use isolated storage and limited UI access.
-Policy_TrustedNet_Name = Trusted_Same_Site_Access
-Policy_TrustedNet_Description = All Trusted Code gets the right to connect back to the site of its origin.
-Policy_Untrusted_Name = Restricted_Zone
-Policy_Untrusted_Description = Code coming from a restricted zone does not receive any permissions.
-Policy_Microsoft_Name = Microsoft_Strong_Name
-Policy_Microsoft_Description = Code group grants full trust to code signed with the Microsoft strong name.
-Policy_Ecma_Name = ECMA_Strong_Name
-Policy_Ecma_Description = Code group grants full trust to code signed with the ECMA strong name.
-
-; Policy permission set descriptions
-Policy_PS_FullTrust = Allows full access to all resources
-Policy_PS_Everything = Allows unrestricted access to all resources covered by built-in permissions
-Policy_PS_Nothing = Denies all resources, including the right to execute
-Policy_PS_Execution = Permits execution
-Policy_PS_SkipVerification = Grants right to bypass the verification
-Policy_PS_Internet = Default rights given to Internet applications
-Policy_PS_LocalIntranet = Default rights given to applications on the local intranet
-
-; default Policy level names
-Policy_PL_Enterprise = Enterprise
-Policy_PL_Machine = Machine
-Policy_PL_User = User
-Policy_PL_AppDomain = AppDomain
-#endif // FEATURE_CAS_POLICY
-
; RankException
Rank_MultiDimNotSupported = Only single dimension arrays are supported here.
Rank_MustMatch = The specified arrays must have the same number of dimensions.
@@ -1658,125 +1548,6 @@ Remoting_Message_BadRetValOrOutArg = Bad return value or out-argument inside the
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.
-#if FEATURE_REMOTING
-Remoting_Activation_BadAttribute = Activation attribute does not implement the IContextAttribute interface.
-Remoting_Activation_BadObject = Proxy Attribute returned an incompatible object when constructing an instance of type {0}.
-Remoting_Activation_MBR_ProxyAttribute = Proxy Attributes are supported on ContextBound types only.
-Remoting_Activation_ConnectFailed = An attempt to connect to the remote activator failed with exception '{0}'.
-Remoting_Activation_Failed = Activation failed due to an unknown reason.
-Remoting_Activation_InconsistentState = Inconsistent state during activation; there may be two proxies for the same object.
-Remoting_Activation_MissingRemoteAppEntry = Cannot find an entry for remote application '{0}'.
-Remoting_Activation_NullReturnValue = Return value of construction call was null.
-Remoting_Activation_NullFromInternalUnmarshal = InternalUnmarshal of returned ObjRef from activation call returned null.
-Remoting_Activation_WellKnownCTOR = Cannot run a non-default constructor when connecting to well-known objects.
-Remoting_Activation_PermissionDenied = Type '{0}' is not registered for activation.
-Remoting_Activation_PropertyUnhappy = A context property did not approve the candidate context for activating the object.
-Remoting_Activation_AsyncUnsupported = Async Activation not supported.
-Remoting_AmbiguousCTOR = Cannot resolve the invocation to the correct constructor.
-Remoting_AmbiguousMethod = Cannot resolve the invocation to the correct method.
-Remoting_AppDomains_NYI = This feature is not yet supported for cross-application domain.
-Remoting_AppDomainsCantBeCalledRemotely = Permission denied: cannot call methods on the AppDomain class remotely.
-Remoting_AssemblyLoadFailed = Cannot load assembly '{0}'.
-Remoting_Attribute_UseAttributeNotsettable = UseAttribute not allowed in SoapTypeAttribute.
-Remoting_BadType = Cannot load type '{0}'.
-Remoting_BadField = Remoting cannot find field '{0}' on type '{1}'.
-Remoting_BadInternalState_ActivationFailure = Invalid internal state: Activation service failed to initialize.
-Remoting_BadInternalState_ProxySameAppDomain = Invalid internal state: A marshal by ref object should not have a proxy in its own AppDomain.
-Remoting_BadInternalState_FailEnvoySink = Invalid internal state: Failed to create an envoy sink for the object.
-Remoting_CantDisconnectClientProxy = Cannot call disconnect on a proxy.
-Remoting_CantInvokeIRemoteDispatch = Cannot invoke methods on IRemoteDispatch.
-Remoting_ChannelNameAlreadyRegistered = The channel '{0}' is already registered.
-Remoting_ChannelNotRegistered = The channel '{0}' is not registered with remoting services.
-Remoting_Channel_PopOnEmptySinkStack = Tried to pop data from an empty channel sink stack.
-Remoting_Channel_PopFromSinkStackWithoutPush = A channel sink tried to pop data from the stack without first pushing data onto the stack.
-Remoting_Channel_StoreOnEmptySinkStack = A channel sink called the Store method when the sink stack was empty.
-Remoting_Channel_StoreOnSinkStackWithoutPush = A channel sink called the Store method on the sink stack without first pushing data onto the stack.
-Remoting_Channel_CantCallAPRWhenStackEmpty = Cannot call the AsyncProcessResponse method on the previous channel sink because the stack is empty.
-Remoting_Channel_CantCallFRSWhenStackEmtpy = Called FlipRememberedStack() when stack was not null.
-Remoting_Channel_CantCallGetResponseStreamWhenStackEmpty = Cannot call the GetResponseStream method on the previous channel sink because the stack is empty.
-Remoting_Channel_DispatchSinkMessageMissing = No message was deserialized prior to calling the DispatchChannelSink.
-Remoting_Channel_DispatchSinkWantsNullRequestStream = The request stream should be null when the DispatchChannelSink is called.
-Remoting_Channel_CannotBeSecured = Channel {0} cannot be secured. Please consider using a channel that implements ISecurableChannel
-Remoting_Config_ChannelMissingCtor = To be used from a .config file, the channel type '{0}' must have a constructor of the form '{1}'
-Remoting_Config_SinkProviderMissingCtor = To be used from a .config file, the sink provider type '{0}' must have a constructor of the form '{1}'
-Remoting_Config_SinkProviderNotFormatter = A sink provider of type '{0}' is incorrectly labeled as a 'formatter'.
-Remoting_Config_ConfigurationFailure = Remoting configuration failed with the exception '{0}'.
-Remoting_Config_InvalidTimeFormat = Invalid time format '{0}'. Examples of valid time formats include 7D, 10H, 5M, 30S, or 20MS.
-Remoting_Config_AppNameSet = The remoting application name, '{0}', had already been set.
-Remoting_Config_ErrorsModeSet = The remoting custom errors mode had already been set.
-Remoting_Config_CantRedirectActivationOfWellKnownService = Attempt to redirect activation for type '{0}, {1}'. This is not allowed since either a well-known service type has already been registered with that type or that type has been registered has a activated service type.
-Remoting_Config_CantUseRedirectedTypeForWellKnownService = Attempt to register a well-known or activated service type of type '{0}, {1}'. This is not allowed since the type has already been redirected to activate elsewhere.
-Remoting_Config_InvalidChannelType = '{0}' does not implement IChannelReceiver or IChannelSender. All channels must implement one of these interfaces.
-Remoting_Config_InvalidSinkProviderType = Unable to use '{0}' as a channel sink provider. It does not implement '{1}'.
-Remoting_Config_MissingWellKnownModeAttribute = Well-known service entries must contain a 'mode' attribute with a value of 'Singleton' or 'SingleCall'.
-Remoting_Config_MissingTypeAttribute = '{0}' entries must contain a '{1}' attribute of the form 'typeName, assemblyName'.
-Remoting_Config_MissingXmlTypeAttribute = '{0}' entries must contain a '{1}' attribute of the form 'xmlTypeName, xmlTypeNamespace'.
-Remoting_Config_NoAppName = Improper remoting configuration: missing ApplicationName property.
-Remoting_Config_NonTemplateIdAttribute = Only '{0}' templates can have an 'id' attribute.
-Remoting_Config_PreloadRequiresTypeOrAssembly = Preload entries require a type or assembly attribute.
-Remoting_Config_ProviderNeedsElementName = Sink providers must have an element name of 'formatter' or 'provider'.
-Remoting_Config_RequiredXmlAttribute = '{0}' entries require a '{1}' attribute.
-Remoting_Config_ReadFailure = .Config file '{0}' cannot be read successfully due to exception '{1}'.
-Remoting_Config_NodeMustBeUnique = There can be only one '{0}' node in the '{1}' section of a config file.
-Remoting_Config_TemplateCannotReferenceTemplate = A '{0}' template cannot reference another '{0}' template.
-Remoting_Config_TypeAlreadyRedirected = Attempt to redirect activation of type '{0}, {1}' which is already redirected.
-Remoting_Config_UnknownValue = Unknown value {1} was found on the {0} node.
-Remoting_Config_UnableToResolveTemplate = Cannot resolve '{0}' template reference: '{1}'.
-Remoting_Config_VersionPresent = Version information is present in the assembly name '{0}' which is not allowed for '{1}' entries.
-Remoting_Contexts_BadProperty = A property that contributed a bad sink to the chain was found.
-Remoting_Contexts_NoProperty = A property with the name '{0}' was not found.
-Remoting_Contexts_ContextNotFrozenForCallBack = Context should be frozen before calling the DoCallBack method.
-Remoting_Default = Unknown remoting error.
-Remoting_HandlerNotRegistered = The tracking handler of type '{0}' is not registered with Remoting Services.
-Remoting_InvalidMsg = Invalid Message Object.
-Remoting_InvalidCallingType = Attempted to call a method declared on type '{0}' on an object which exposes '{1}'.
-Remoting_InvalidRequestedType = The server object type cannot be cast to the requested type '{0}'.
-Remoting_InternalError = Server encountered an internal error. For more information, turn off customErrors in the server's .config file.
-Remoting_Lifetime_ILeaseReturn = Expected a return object of type ILease, but received '{0}'.
-Remoting_Lifetime_InitialStateInitialLeaseTime = InitialLeaseTime property can only be set when the lease is in initial state. The state is '{0}'.
-Remoting_Lifetime_InitialStateRenewOnCall = RenewOnCallTime property can only be set when the lease is in initial state. The state is '{0}'.
-Remoting_Lifetime_InitialStateSponsorshipTimeout = SponsorshipTimeout property can only be set when the lease is in initial state. State is '{0}'.
-Remoting_Lifetime_SetOnce = '{0}' can only be set once within an AppDomain.
-Remoting_Message_ArgMismatch = {2} arguments were passed to '{0}::{1}'. {3} arguments were expected by this method.
-Remoting_Message_BadAsyncResult = The async result object is null or of an unexpected type.
-Remoting_Message_BadType = The method was called with a Message of an unexpected type.
-Remoting_Message_CoercionFailed = The argument type '{0}' cannot be converted into parameter type '{1}'.
-Remoting_Message_MissingArgValue = Expecting an instance of type '{0}' at pos {1} in the args array.
-Remoting_Message_BadSerialization = Invalid or malformed serialization information for the message object.
-Remoting_NoIdentityEntry = No remoting information was found for this object.
-Remoting_NotRemotableByReference = Trying to create a proxy to an unbound type.
-Remoting_NullMessage = The method was called with a null message.
-Remoting_Proxy_BadType = The proxy is of an unsupported type.
-Remoting_ResetURI = Attempt to reset the URI for an object from '{0}' to '{1}'.
-Remoting_ServerObjectNotFound = The server object for URI '{0}' is not registered with the remoting infrastructure (it may have been disconnected).
-Remoting_SetObjectUriForMarshal__ObjectNeedsToBeLocal = SetObjectUriForMarshal method should only be called for MarshalByRefObjects that exist in the current AppDomain.
-Remoting_SetObjectUriForMarshal__UriExists = SetObjectUriForMarshal method has already been called on this object or the object has already been marshaled.
-Remoting_Proxy_BadReturnType = Return argument has an invalid type.
-Remoting_Proxy_ReturnValueTypeCannotBeNull = ByRef value type parameter cannot be null.
-Remoting_Proxy_BadReturnTypeForActivation = Bad return type for activation call via Invoke: must be of type IConstructionReturnMessage.
-Remoting_Proxy_BadTypeForActivation = Type mismatch between proxy type '{0}' and activation type '{1}'.
-Remoting_Proxy_ExpectedOriginalMessage = The message passed to Invoke should be passed to PropagateOutParameters.
-Remoting_Proxy_InvalidCall = Trying to call proxy while constructor call is in progress.
-Remoting_Proxy_InvalidState = Channel sink does not exist. Failed to dispatch async call.
-Remoting_Proxy_NoChannelSink = This remoting proxy has no channel sink which means either the server has no registered server channels that are listening, or this application has no suitable client channel to talk to the server.
-Remoting_Proxy_InvalidCallType = Only the synchronous call type is supported for messages that are not of type Message.
-Remoting_Proxy_WrongContext = ExecuteMessage can be called only from the native context of the object.
-Remoting_SOAPInteropxsdInvalid = Soap Parse error, xsd:type '{0}' invalid {1}
-Remoting_SOAPQNameNamespace = SoapQName missing a Namespace value '{0}'.
-Remoting_ThreadAffinity_InvalidFlag = The specified flag '{0}' does not have one of the valid values.
-Remoting_TrackingHandlerAlreadyRegistered = The handler has already been registered with TrackingServices.
-Remoting_URIClash = Found two different objects associated with the same URI, '{0}'.
-Remoting_URIExists = The remoted object already has an associated URI.
-Remoting_URIToProxy = Trying to associate the URI with a proxy.
-Remoting_WellKnown_MustBeMBR = Attempted to create well-known object of type '{0}'. Well-known objects must derive from the MarshalByRefObject class.
-Remoting_WellKnown_CtorCantMarshal = '{0}': A well-known object cannot marshal itself in its constructor, or perform any action that would cause it to be marshaled (such as passing the 'this' pointer as a parameter to a remote method).
-Remoting_WellKnown_CantDirectlyConnect = Attempt to connect to a server using its object URI: '{0}'. A valid, complete URL must be used.
-Remoting_Connect_CantCreateChannelSink = Cannot create channel sink to connect to URL '{0}'. An appropriate channel has probably not been registered.
-Remoting_UnexpectedNullTP = Failed to create a transparent proxy. If a custom RealProxy is being used ensure it sets the proxy type.
-; The following remoting exception messages appear in native resources too (mscorrc.rc)
-Remoting_Disconnected = Object '{0}' has been disconnected or does not exist at the server.
-Remoting_Message_MethodMissing = The method '{0}' was not found on the interface/type '{1}'.
-#endif // FEATURE_REMOTING
; Resources exceptions
;
@@ -1805,24 +1576,6 @@ 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.
-#if FEATURE_CAS_POLICY
-Security_CannotGenerateHash = Hash for the assembly cannot be generated.
-Security_CannotGetRawData = Assembly bytes could not be retrieved.
-Security_PrincipalPermission = Request for principal permission failed.
-Security_Action = The action that failed was:
-Security_TypeFirstPermThatFailed = The type of the first permission that failed was:
-Security_FirstPermThatFailed = The first permission that failed was:
-Security_Demanded = The demand was for:
-Security_GrantedSet = The granted set of the failing assembly was:
-Security_RefusedSet = The refused set of the failing assembly was:
-Security_Denied = The denied permissions were:
-Security_PermitOnly = The only permitted permissions were:
-Security_Assembly = The assembly or AppDomain that failed was:
-Security_Method = The method that caused the failure was:
-Security_Zone = The Zone of the assembly that failed was:
-Security_Url = The Url of the assembly that failed was:
-Security_AnonymouslyHostedDynamicMethodCheckFailed = The demand failed due to the code access security information captured during the creation of an anonymously hosted dynamic method. In order for this operation to succeed, ensure that the demand would have succeeded at the time the method was created. See http://go.microsoft.com/fwlink/?LinkId=288746 for more information.
-#endif // FEATURE_CAS_POLICY
;
; HostProtection exceptions
@@ -1872,12 +1625,10 @@ 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 path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
+IO.PathTooLong = The specified file name or path is too long, or a component of the specified path is too long.
-#if FEATURE_CORECLR
; SecurityException
FileSecurityState_OperationNotPermitted = File operation not permitted. Access to path '{0}' is denied.
-#endif
; PrivilegeNotHeldException
PrivilegeNotHeld_Default = The process does not possess some privilege required for this operation.
@@ -2275,14 +2026,6 @@ XMLSyntax_InvalidSyntaxSatAssemTag = Invalid XML in file "{0}" near element "{1}
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.
-; CodeGroup
-#if FEATURE_CAS_POLICY
-NetCodeGroup_PermissionSet = Same site Web
-MergeLogic_Union = Union
-MergeLogic_FirstMatch = First Match
-FileCodeGroup_PermissionSet = Same directory FileIO - '{0}'
-#endif // FEATURE_CAS_POLICY
-
; MembershipConditions
StrongName_ToString = StrongName - {0}{1}{2}
StrongName_Name = name = {0}
@@ -2295,12 +2038,6 @@ Zone_ToString = Zone - {0}
All_ToString = All code
Url_ToString = Url
GAC_ToString = GAC
-#if FEATURE_CAS_POLICY
-Site_ToStringArg = Site - {0}
-Publisher_ToStringArg = Publisher - {0}
-Url_ToStringArg = Url - {0}
-#endif // FEATURE_CAS_POLICY
-
; Interop non exception strings.
TypeLibConverter_ImportedTypeLibProductName = Assembly imported from type library '{0}'.
@@ -2381,956 +2118,8 @@ InvalidOperation_CollectionBackingListTooLarge=The collection backing this List
InvalidOperation_CollectionBackingDictionaryTooLarge=The collection backing this Dictionary contains too many elements.
InvalidOperation_CannotRemoveLastFromEmptyCollection=Cannot remove the last element from an empty collection.
-; Globalization resources
-;------------------
-
-#if !FEATURE_CORECLR
-Globalization.LegacyModifier = Legacy
-
-;
-;Total items: 809
-;
-Globalization.ci_ = Invariant Language (Invariant Country)
-Globalization.ci_aa = Afar
-Globalization.ci_aa-DJ = Afar (Djibouti)
-Globalization.ci_aa-ER = Afar (Eritrea)
-Globalization.ci_aa-ET = Afar (Ethiopia)
-Globalization.ci_af = Afrikaans
-Globalization.ci_af-NA = Afrikaans (Namibia)
-Globalization.ci_af-ZA = Afrikaans (South Africa)
-Globalization.ci_agq = Aghem
-Globalization.ci_agq-CM = Aghem (Cameroon)
-Globalization.ci_ak = Akan
-Globalization.ci_ak-GH = Akan (Ghana)
-Globalization.ci_am = Amharic
-Globalization.ci_am-ET = Amharic (Ethiopia)
-Globalization.ci_ar = Arabic
-Globalization.ci_ar-001 = Arabic (World)
-Globalization.ci_ar-AE = Arabic (U.A.E.)
-Globalization.ci_ar-BH = Arabic (Bahrain)
-Globalization.ci_ar-DJ = Arabic (Djibouti)
-Globalization.ci_ar-DZ = Arabic (Algeria)
-Globalization.ci_ar-EG = Arabic (Egypt)
-Globalization.ci_ar-ER = Arabic (Eritrea)
-Globalization.ci_ar-IL = Arabic (Israel)
-Globalization.ci_ar-IQ = Arabic (Iraq)
-Globalization.ci_ar-JO = Arabic (Jordan)
-Globalization.ci_ar-KM = Arabic (Comoros)
-Globalization.ci_ar-KW = Arabic (Kuwait)
-Globalization.ci_ar-LB = Arabic (Lebanon)
-Globalization.ci_ar-LY = Arabic (Libya)
-Globalization.ci_ar-MA = Arabic (Morocco)
-Globalization.ci_ar-MR = Arabic (Mauritania)
-Globalization.ci_ar-OM = Arabic (Oman)
-Globalization.ci_ar-PS = Arabic (Palestinian Authority)
-Globalization.ci_ar-QA = Arabic (Qatar)
-Globalization.ci_ar-SA = Arabic (Saudi Arabia)
-Globalization.ci_ar-SD = Arabic (Sudan)
-Globalization.ci_ar-SO = Arabic (Somalia)
-Globalization.ci_ar-SS = Arabic (South Sudan)
-Globalization.ci_ar-SY = Arabic (Syria)
-Globalization.ci_ar-TD = Arabic (Chad)
-Globalization.ci_ar-TN = Arabic (Tunisia)
-Globalization.ci_ar-YE = Arabic (Yemen)
-Globalization.ci_arn = Mapudungun
-Globalization.ci_arn-CL = Mapudungun (Chile)
-Globalization.ci_as = Assamese
-Globalization.ci_as-IN = Assamese (India)
-Globalization.ci_asa = Asu
-Globalization.ci_asa-TZ = Asu (Tanzania)
-Globalization.ci_ast = Asturian
-Globalization.ci_ast-ES = Asturian (Spain)
-Globalization.ci_az = Azerbaijani
-Globalization.ci_az-Cyrl = Azerbaijani (Cyrillic)
-Globalization.ci_az-Cyrl-AZ = Azerbaijani (Cyrillic, Azerbaijan)
-Globalization.ci_az-Latn = Azerbaijani (Latin)
-Globalization.ci_az-Latn-AZ = Azerbaijani (Latin, Azerbaijan)
-Globalization.ci_ba = Bashkir
-Globalization.ci_ba-RU = Bashkir (Russia)
-Globalization.ci_bas = Basaa
-Globalization.ci_bas-CM = Basaa (Cameroon)
-Globalization.ci_be = Belarusian
-Globalization.ci_be-BY = Belarusian (Belarus)
-Globalization.ci_bem = Bemba
-Globalization.ci_bem-ZM = Bemba (Zambia)
-Globalization.ci_bez = Bena
-Globalization.ci_bez-TZ = Bena (Tanzania)
-Globalization.ci_bg = Bulgarian
-Globalization.ci_bg-BG = Bulgarian (Bulgaria)
-Globalization.ci_bm = Bambara
-Globalization.ci_bm-Latn = Bambara (Latin)
-Globalization.ci_bm-Latn-ML = Bambara (Latin, Mali)
-Globalization.ci_bm-ML = Bamanankan (Latin, Mali)
-Globalization.ci_bn = Bangla
-Globalization.ci_bn-BD = Bangla (Bangladesh)
-Globalization.ci_bn-IN = Bangla (India)
-Globalization.ci_bo = Tibetan
-Globalization.ci_bo-CN = Tibetan (PRC)
-Globalization.ci_bo-IN = Tibetan (India)
-Globalization.ci_br = Breton
-Globalization.ci_br-FR = Breton (France)
-Globalization.ci_brx = Bodo
-Globalization.ci_brx-IN = Bodo (India)
-Globalization.ci_bs = Bosnian
-Globalization.ci_bs-Cyrl = Bosnian (Cyrillic)
-Globalization.ci_bs-Cyrl-BA = Bosnian (Cyrillic, Bosnia and Herzegovina)
-Globalization.ci_bs-Latn = Bosnian (Latin)
-Globalization.ci_bs-Latn-BA = Bosnian (Latin, Bosnia and Herzegovina)
-Globalization.ci_byn = Blin
-Globalization.ci_byn-ER = Blin (Eritrea)
-Globalization.ci_ca = Catalan
-Globalization.ci_ca-AD = Catalan (Andorra)
-Globalization.ci_ca-ES = Catalan (Catalan)
-Globalization.ci_ca-ES-valencia = Valencian (Spain)
-Globalization.ci_ca-FR = Catalan (France)
-Globalization.ci_ca-IT = Catalan (Italy)
-Globalization.ci_cgg = Chiga
-Globalization.ci_cgg-UG = Chiga (Uganda)
-Globalization.ci_chr = Cherokee
-Globalization.ci_chr-Cher = Cherokee (Cherokee)
-Globalization.ci_chr-Cher-US = Cherokee (Cherokee)
-Globalization.ci_co = Corsican
-Globalization.ci_co-FR = Corsican (France)
-Globalization.ci_cs = Czech
-Globalization.ci_cs-CZ = Czech (Czech Republic)
-Globalization.ci_cy = Welsh
-Globalization.ci_cy-GB = Welsh (United Kingdom)
-Globalization.ci_da = Danish
-Globalization.ci_da-DK = Danish (Denmark)
-Globalization.ci_da-GL = Danish (Greenland)
-Globalization.ci_dav = Taita
-Globalization.ci_dav-KE = Taita (Kenya)
-Globalization.ci_de = German
-Globalization.ci_de-AT = German (Austria)
-Globalization.ci_de-BE = German (Belgium)
-Globalization.ci_de-CH = German (Switzerland)
-Globalization.ci_de-DE = German (Germany)
-Globalization.ci_de-DE_phoneb = German (Germany)
-Globalization.ci_de-LI = German (Liechtenstein)
-Globalization.ci_de-LU = German (Luxembourg)
-Globalization.ci_dje = Zarma
-Globalization.ci_dje-NE = Zarma (Niger)
-Globalization.ci_dsb = Lower Sorbian
-Globalization.ci_dsb-DE = Lower Sorbian (Germany)
-Globalization.ci_dua = Duala
-Globalization.ci_dua-CM = Duala (Cameroon)
-Globalization.ci_dv = Divehi
-Globalization.ci_dv-MV = Divehi (Maldives)
-Globalization.ci_dyo = Jola-Fonyi
-Globalization.ci_dyo-SN = Jola-Fonyi (Senegal)
-Globalization.ci_dz = Dzongkha
-Globalization.ci_dz-BT = Dzongkha (Bhutan)
-Globalization.ci_ebu = Embu
-Globalization.ci_ebu-KE = Embu (Kenya)
-Globalization.ci_ee = Ewe
-Globalization.ci_ee-GH = Ewe (Ghana)
-Globalization.ci_ee-TG = Ewe (Togo)
-Globalization.ci_el = Greek
-Globalization.ci_el-CY = Greek (Cyprus)
-Globalization.ci_el-GR = Greek (Greece)
-Globalization.ci_en = English
-Globalization.ci_en-001 = English (World)
-Globalization.ci_en-029 = English (Caribbean)
-Globalization.ci_en-150 = English (Europe)
-Globalization.ci_en-AG = English (Antigua and Barbuda)
-Globalization.ci_en-AI = English (Anguilla)
-Globalization.ci_en-AS = English (American Samoa)
-Globalization.ci_en-AU = English (Australia)
-Globalization.ci_en-BB = English (Barbados)
-Globalization.ci_en-BE = English (Belgium)
-Globalization.ci_en-BM = English (Bermuda)
-Globalization.ci_en-BS = English (Bahamas)
-Globalization.ci_en-BW = English (Botswana)
-Globalization.ci_en-BZ = English (Belize)
-Globalization.ci_en-CA = English (Canada)
-Globalization.ci_en-CC = English (Cocos [Keeling] Islands)
-Globalization.ci_en-CK = English (Cook Islands)
-Globalization.ci_en-CM = English (Cameroon)
-Globalization.ci_en-CX = English (Christmas Island)
-Globalization.ci_en-DM = English (Dominica)
-Globalization.ci_en-ER = English (Eritrea)
-Globalization.ci_en-FJ = English (Fiji)
-Globalization.ci_en-FK = English (Falkland Islands)
-Globalization.ci_en-FM = English (Micronesia)
-Globalization.ci_en-GB = English (United Kingdom)
-Globalization.ci_en-GD = English (Grenada)
-Globalization.ci_en-GG = English (Guernsey)
-Globalization.ci_en-GH = English (Ghana)
-Globalization.ci_en-GI = English (Gibraltar)
-Globalization.ci_en-GM = English (Gambia)
-Globalization.ci_en-GU = English (Guam)
-Globalization.ci_en-GY = English (Guyana)
-Globalization.ci_en-HK = English (Hong Kong SAR)
-Globalization.ci_en-IE = English (Ireland)
-Globalization.ci_en-IM = English (Isle of Man)
-Globalization.ci_en-IN = English (India)
-Globalization.ci_en-IO = English (British Indian Ocean Territory)
-Globalization.ci_en-JE = English (Jersey)
-Globalization.ci_en-JM = English (Jamaica)
-Globalization.ci_en-KE = English (Kenya)
-Globalization.ci_en-KI = English (Kiribati)
-Globalization.ci_en-KN = English (Saint Kitts and Nevis)
-Globalization.ci_en-KY = English (Cayman Islands)
-Globalization.ci_en-LC = English (Saint Lucia)
-Globalization.ci_en-LR = English (Liberia)
-Globalization.ci_en-LS = English (Lesotho)
-Globalization.ci_en-MG = English (Madagascar)
-Globalization.ci_en-MH = English (Marshall Islands)
-Globalization.ci_en-MO = English (Macao SAR)
-Globalization.ci_en-MP = English (Northern Mariana Islands)
-Globalization.ci_en-MS = English (Montserrat)
-Globalization.ci_en-MT = English (Malta)
-Globalization.ci_en-MU = English (Mauritius)
-Globalization.ci_en-MW = English (Malawi)
-Globalization.ci_en-MY = English (Malaysia)
-Globalization.ci_en-NA = English (Namibia)
-Globalization.ci_en-NF = English (Norfolk Island)
-Globalization.ci_en-NG = English (Nigeria)
-Globalization.ci_en-NR = English (Nauru)
-Globalization.ci_en-NU = English (Niue)
-Globalization.ci_en-NZ = English (New Zealand)
-Globalization.ci_en-PG = English (Papua New Guinea)
-Globalization.ci_en-PH = English (Republic of the Philippines)
-Globalization.ci_en-PK = English (Pakistan)
-Globalization.ci_en-PN = English (Pitcairn Islands)
-Globalization.ci_en-PR = English (Puerto Rico)
-Globalization.ci_en-PW = English (Palau)
-Globalization.ci_en-RW = English (Rwanda)
-Globalization.ci_en-SB = English (Solomon Islands)
-Globalization.ci_en-SC = English (Seychelles)
-Globalization.ci_en-SD = English (Sudan)
-Globalization.ci_en-SG = English (Singapore)
-Globalization.ci_en-SH = English (St Helena, Ascension, Tristan da Cunha)
-Globalization.ci_en-SL = English (Sierra Leone)
-Globalization.ci_en-SS = English (South Sudan)
-Globalization.ci_en-SX = English (Sint Maarten)
-Globalization.ci_en-SZ = English (Swaziland)
-Globalization.ci_en-TC = English (Turks and Caicos Islands)
-Globalization.ci_en-TK = English (Tokelau)
-Globalization.ci_en-TO = English (Tonga)
-Globalization.ci_en-TT = English (Trinidad and Tobago)
-Globalization.ci_en-TV = English (Tuvalu)
-Globalization.ci_en-TZ = English (Tanzania)
-Globalization.ci_en-UG = English (Uganda)
-Globalization.ci_en-UM = English (US Minor Outlying Islands)
-Globalization.ci_en-US = English (United States)
-Globalization.ci_en-VC = English (Saint Vincent and the Grenadines)
-Globalization.ci_en-VG = English (British Virgin Islands)
-Globalization.ci_en-VI = English (US Virgin Islands)
-Globalization.ci_en-VU = English (Vanuatu)
-Globalization.ci_en-WS = English (Samoa)
-Globalization.ci_en-ZA = English (South Africa)
-Globalization.ci_en-ZM = English (Zambia)
-Globalization.ci_en-ZW = English (Zimbabwe)
-Globalization.ci_eo = Esperanto
-Globalization.ci_eo-001 = Esperanto (World)
-Globalization.ci_es = Spanish
-Globalization.ci_es-419 = Spanish (Latin America)
-Globalization.ci_es-AR = Spanish (Argentina)
-Globalization.ci_es-BO = Spanish (Bolivia)
-Globalization.ci_es-CL = Spanish (Chile)
-Globalization.ci_es-CO = Spanish (Colombia)
-Globalization.ci_es-CR = Spanish (Costa Rica)
-Globalization.ci_es-CU = Spanish (Cuba)
-Globalization.ci_es-DO = Spanish (Dominican Republic)
-Globalization.ci_es-EC = Spanish (Ecuador)
-Globalization.ci_es-ES = Spanish (Spain)
-Globalization.ci_es-ES_tradnl = Spanish (Spain)
-Globalization.ci_es-GQ = Spanish (Equatorial Guinea)
-Globalization.ci_es-GT = Spanish (Guatemala)
-Globalization.ci_es-HN = Spanish (Honduras)
-Globalization.ci_es-MX = Spanish (Mexico)
-Globalization.ci_es-NI = Spanish (Nicaragua)
-Globalization.ci_es-PA = Spanish (Panama)
-Globalization.ci_es-PE = Spanish (Peru)
-Globalization.ci_es-PH = Spanish (Philippines)
-Globalization.ci_es-PR = Spanish (Puerto Rico)
-Globalization.ci_es-PY = Spanish (Paraguay)
-Globalization.ci_es-SV = Spanish (El Salvador)
-Globalization.ci_es-US = Spanish (United States)
-Globalization.ci_es-UY = Spanish (Uruguay)
-Globalization.ci_es-VE = Spanish (Bolivarian Republic of Venezuela)
-Globalization.ci_et = Estonian
-Globalization.ci_et-EE = Estonian (Estonia)
-Globalization.ci_eu = Basque
-Globalization.ci_eu-ES = Basque (Basque)
-Globalization.ci_ewo = Ewondo
-Globalization.ci_ewo-CM = Ewondo (Cameroon)
-Globalization.ci_fa = Persian
-Globalization.ci_fa-AF = Persian (Afghanistan)
-Globalization.ci_fa-IR = Persian (Iran)
-Globalization.ci_ff = Fulah
-Globalization.ci_ff-CM = Fulah (Cameroon)
-Globalization.ci_ff-GN = Fulah (Guinea)
-Globalization.ci_ff-Latn = Fulah (Latin)
-Globalization.ci_ff-Latn-SN = Fulah (Latin, Senegal)
-Globalization.ci_ff-MR = Fulah (Mauritania)
-Globalization.ci_fi = Finnish
-Globalization.ci_fi-FI = Finnish (Finland)
-Globalization.ci_fil = Filipino
-Globalization.ci_fil-PH = Filipino (Philippines)
-Globalization.ci_fo = Faroese
-Globalization.ci_fo-FO = Faroese (Faroe Islands)
-Globalization.ci_fr = French
-Globalization.ci_fr-BE = French (Belgium)
-Globalization.ci_fr-BF = French (Burkina Faso)
-Globalization.ci_fr-BI = French (Burundi)
-Globalization.ci_fr-BJ = French (Benin)
-Globalization.ci_fr-BL = French (Saint Barthélemy)
-Globalization.ci_fr-CA = French (Canada)
-Globalization.ci_fr-CD = French (Congo DRC)
-Globalization.ci_fr-CF = French (Central African Republic)
-Globalization.ci_fr-CG = French (Congo)
-Globalization.ci_fr-CH = French (Switzerland)
-Globalization.ci_fr-CI = French (Côte d’Ivoire)
-Globalization.ci_fr-CM = French (Cameroon)
-Globalization.ci_fr-DJ = French (Djibouti)
-Globalization.ci_fr-DZ = French (Algeria)
-Globalization.ci_fr-FR = French (France)
-Globalization.ci_fr-GA = French (Gabon)
-Globalization.ci_fr-GF = French (French Guiana)
-Globalization.ci_fr-GN = French (Guinea)
-Globalization.ci_fr-GP = French (Guadeloupe)
-Globalization.ci_fr-GQ = French (Equatorial Guinea)
-Globalization.ci_fr-HT = French (Haiti)
-Globalization.ci_fr-KM = French (Comoros)
-Globalization.ci_fr-LU = French (Luxembourg)
-Globalization.ci_fr-MA = French (Morocco)
-Globalization.ci_fr-MC = French (Monaco)
-Globalization.ci_fr-MF = French (Saint Martin)
-Globalization.ci_fr-MG = French (Madagascar)
-Globalization.ci_fr-ML = French (Mali)
-Globalization.ci_fr-MQ = French (Martinique)
-Globalization.ci_fr-MR = French (Mauritania)
-Globalization.ci_fr-MU = French (Mauritius)
-Globalization.ci_fr-NC = French (New Caledonia)
-Globalization.ci_fr-NE = French (Niger)
-Globalization.ci_fr-PF = French (French Polynesia)
-Globalization.ci_fr-PM = French (Saint Pierre and Miquelon)
-Globalization.ci_fr-RE = French (Reunion)
-Globalization.ci_fr-RW = French (Rwanda)
-Globalization.ci_fr-SC = French (Seychelles)
-Globalization.ci_fr-SN = French (Senegal)
-Globalization.ci_fr-SY = French (Syria)
-Globalization.ci_fr-TD = French (Chad)
-Globalization.ci_fr-TG = French (Togo)
-Globalization.ci_fr-TN = French (Tunisia)
-Globalization.ci_fr-VU = French (Vanuatu)
-Globalization.ci_fr-WF = French (Wallis and Futuna)
-Globalization.ci_fr-YT = French (Mayotte)
-Globalization.ci_fur = Friulian
-Globalization.ci_fur-IT = Friulian (Italy)
-Globalization.ci_fy = Frisian
-Globalization.ci_fy-NL = Frisian (Netherlands)
-Globalization.ci_ga = Irish
-Globalization.ci_ga-IE = Irish (Ireland)
-Globalization.ci_gd = Scottish Gaelic
-Globalization.ci_gd-GB = Scottish Gaelic (United Kingdom)
-Globalization.ci_gl = Galician
-Globalization.ci_gl-ES = Galician (Galician)
-Globalization.ci_gn = Guarani
-Globalization.ci_gn-PY = Guarani (Paraguay)
-Globalization.ci_gsw = Alsatian
-Globalization.ci_gsw-CH = Alsatian (Switzerland)
-Globalization.ci_gsw-FR = Alsatian (France)
-Globalization.ci_gsw-LI = Alsatian (Liechtenstein)
-Globalization.ci_gu = Gujarati
-Globalization.ci_gu-IN = Gujarati (India)
-Globalization.ci_guz = Gusii
-Globalization.ci_guz-KE = Gusii (Kenya)
-Globalization.ci_gv = Manx
-Globalization.ci_gv-IM = Manx (Isle of Man)
-Globalization.ci_ha = Hausa
-Globalization.ci_ha-Latn = Hausa (Latin)
-Globalization.ci_ha-Latn-GH = Hausa (Latin, Ghana)
-Globalization.ci_ha-Latn-NE = Hausa (Latin, Niger)
-Globalization.ci_ha-Latn-NG = Hausa (Latin, Nigeria)
-Globalization.ci_haw = Hawaiian
-Globalization.ci_haw-US = Hawaiian (United States)
-Globalization.ci_he = Hebrew
-Globalization.ci_he-IL = Hebrew (Israel)
-Globalization.ci_hi = Hindi
-Globalization.ci_hi-IN = Hindi (India)
-Globalization.ci_hr = Croatian
-Globalization.ci_hr-BA = Croatian (Latin, Bosnia and Herzegovina)
-Globalization.ci_hr-HR = Croatian (Croatia)
-Globalization.ci_hsb = Upper Sorbian
-Globalization.ci_hsb-DE = Upper Sorbian (Germany)
-Globalization.ci_hu = Hungarian
-Globalization.ci_hu-HU = Hungarian (Hungary)
-Globalization.ci_hu-HU_technl = Hungarian (Hungary)
-Globalization.ci_hy = Armenian
-Globalization.ci_hy-AM = Armenian (Armenia)
-Globalization.ci_ia = Interlingua
-Globalization.ci_ia-001 = Interlingua (World)
-Globalization.ci_ia-FR = Interlingua (France)
-Globalization.ci_id = Indonesian
-Globalization.ci_id-ID = Indonesian (Indonesia)
-Globalization.ci_ig = Igbo
-Globalization.ci_ig-NG = Igbo (Nigeria)
-Globalization.ci_ii = Yi
-Globalization.ci_ii-CN = Yi (PRC)
-Globalization.ci_is = Icelandic
-Globalization.ci_is-IS = Icelandic (Iceland)
-Globalization.ci_it = Italian
-Globalization.ci_it-CH = Italian (Switzerland)
-Globalization.ci_it-IT = Italian (Italy)
-Globalization.ci_it-SM = Italian (San Marino)
-Globalization.ci_iu = Inuktitut
-Globalization.ci_iu-Cans = Inuktitut (Syllabics)
-Globalization.ci_iu-Cans-CA = Inuktitut (Syllabics, Canada)
-Globalization.ci_iu-Latn = Inuktitut (Latin)
-Globalization.ci_iu-Latn-CA = Inuktitut (Latin, Canada)
-Globalization.ci_ja = Japanese
-Globalization.ci_ja-JP = Japanese (Japan)
-Globalization.ci_ja-JP_radstr = Japanese (Japan)
-Globalization.ci_jgo = Ngomba
-Globalization.ci_jgo-CM = Ngomba (Cameroon)
-Globalization.ci_jmc = Machame
-Globalization.ci_jmc-TZ = Machame (Tanzania)
-Globalization.ci_jv = Javanese
-Globalization.ci_jv-Latn = Javanese
-Globalization.ci_jv-Latn-ID = Javanese (Indonesia)
-Globalization.ci_ka = Georgian
-Globalization.ci_ka-GE = Georgian (Georgia)
-Globalization.ci_ka-GE_modern = Georgian (Georgia)
-Globalization.ci_kab = Kabyle
-Globalization.ci_kab-DZ = Kabyle (Algeria)
-Globalization.ci_kam = Kamba
-Globalization.ci_kam-KE = Kamba (Kenya)
-Globalization.ci_kde = Makonde
-Globalization.ci_kde-TZ = Makonde (Tanzania)
-Globalization.ci_kea = Kabuverdianu
-Globalization.ci_kea-CV = Kabuverdianu (Cabo Verde)
-Globalization.ci_khq = Koyra Chiini
-Globalization.ci_khq-ML = Koyra Chiini (Mali)
-Globalization.ci_ki = Kikuyu
-Globalization.ci_ki-KE = Kikuyu (Kenya)
-Globalization.ci_kk = Kazakh
-Globalization.ci_kk-KZ = Kazakh (Kazakhstan)
-Globalization.ci_kkj = Kako
-Globalization.ci_kkj-CM = Kako (Cameroon)
-Globalization.ci_kl = Greenlandic
-Globalization.ci_kl-GL = Greenlandic (Greenland)
-Globalization.ci_kln = Kalenjin
-Globalization.ci_kln-KE = Kalenjin (Kenya)
-Globalization.ci_km = Khmer
-Globalization.ci_km-KH = Khmer (Cambodia)
-Globalization.ci_kn = Kannada
-Globalization.ci_kn-IN = Kannada (India)
-Globalization.ci_ko = Korean
-Globalization.ci_ko-KR = Korean (Korea)
-Globalization.ci_kok = Konkani
-Globalization.ci_kok-IN = Konkani (India)
-Globalization.ci_ks = Kashmiri
-Globalization.ci_ks-Arab = Kashmiri (Perso-Arabic)
-Globalization.ci_ks-Arab-IN = Kashmiri (Perso-Arabic)
-Globalization.ci_ksb = Shambala
-Globalization.ci_ksb-TZ = Shambala (Tanzania)
-Globalization.ci_ksf = Bafia
-Globalization.ci_ksf-CM = Bafia (Cameroon)
-Globalization.ci_ksh = Colognian
-Globalization.ci_ksh-DE = Ripuarian (Germany)
-Globalization.ci_ku = Central Kurdish
-Globalization.ci_ku-Arab = Central Kurdish (Arabic)
-Globalization.ci_ku-Arab-IQ = Central Kurdish (Iraq)
-Globalization.ci_kw = Cornish
-Globalization.ci_kw-GB = Cornish (United Kingdom)
-Globalization.ci_ky = Kyrgyz
-Globalization.ci_ky-KG = Kyrgyz (Kyrgyzstan)
-Globalization.ci_lag = Langi
-Globalization.ci_lag-TZ = Langi (Tanzania)
-Globalization.ci_lb = Luxembourgish
-Globalization.ci_lb-LU = Luxembourgish (Luxembourg)
-Globalization.ci_lg = Ganda
-Globalization.ci_lg-UG = Ganda (Uganda)
-Globalization.ci_lkt = Lakota
-Globalization.ci_lkt-US = Lakota (United States)
-Globalization.ci_ln = Lingala
-Globalization.ci_ln-AO = Lingala (Angola)
-Globalization.ci_ln-CD = Lingala (Congo DRC)
-Globalization.ci_ln-CF = Lingala (Central African Republic)
-Globalization.ci_ln-CG = Lingala (Congo)
-Globalization.ci_lo = Lao
-Globalization.ci_lo-LA = Lao (Lao P.D.R.)
-Globalization.ci_lt = Lithuanian
-Globalization.ci_lt-LT = Lithuanian (Lithuania)
-Globalization.ci_lu = Luba-Katanga
-Globalization.ci_lu-CD = Luba-Katanga (Congo DRC)
-Globalization.ci_luo = Luo
-Globalization.ci_luo-KE = Luo (Kenya)
-Globalization.ci_luy = Luyia
-Globalization.ci_luy-KE = Luyia (Kenya)
-Globalization.ci_lv = Latvian
-Globalization.ci_lv-LV = Latvian (Latvia)
-Globalization.ci_mas = Masai
-Globalization.ci_mas-KE = Masai (Kenya)
-Globalization.ci_mas-TZ = Masai (Tanzania)
-Globalization.ci_mer = Meru
-Globalization.ci_mer-KE = Meru (Kenya)
-Globalization.ci_mfe = Morisyen
-Globalization.ci_mfe-MU = Morisyen (Mauritius)
-Globalization.ci_mg = Malagasy
-Globalization.ci_mg-MG = Malagasy (Madagascar)
-Globalization.ci_mgh = Makhuwa-Meetto
-Globalization.ci_mgh-MZ = Makhuwa-Meetto (Mozambique)
-Globalization.ci_mgo = Meta'
-Globalization.ci_mgo-CM = Meta' (Cameroon)
-Globalization.ci_mi = Maori
-Globalization.ci_mi-NZ = Maori (New Zealand)
-Globalization.ci_mk = Macedonian (FYROM)
-Globalization.ci_mk-MK = Macedonian (Former Yugoslav Republic of Macedonia)
-Globalization.ci_ml = Malayalam
-Globalization.ci_ml-IN = Malayalam (India)
-Globalization.ci_mn = Mongolian
-Globalization.ci_mn-Cyrl = Mongolian (Cyrillic)
-Globalization.ci_mn-MN = Mongolian (Cyrillic, Mongolia)
-Globalization.ci_mn-Mong = Mongolian (Traditional Mongolian)
-Globalization.ci_mn-Mong-CN = Mongolian (Traditional Mongolian, PRC)
-Globalization.ci_mn-Mong-MN = Mongolian (Traditional Mongolian, Mongolia)
-Globalization.ci_moh = Mohawk
-Globalization.ci_moh-CA = Mohawk (Mohawk)
-Globalization.ci_mr = Marathi
-Globalization.ci_mr-IN = Marathi (India)
-Globalization.ci_ms = Malay
-Globalization.ci_ms-BN = Malay (Brunei Darussalam)
-Globalization.ci_ms-MY = Malay (Malaysia)
-Globalization.ci_ms-SG = Malay (Latin, Singapore)
-Globalization.ci_mt = Maltese
-Globalization.ci_mt-MT = Maltese (Malta)
-Globalization.ci_mua = Mundang
-Globalization.ci_mua-CM = Mundang (Cameroon)
-Globalization.ci_my = Burmese
-Globalization.ci_my-MM = Burmese (Myanmar)
-Globalization.ci_naq = Nama
-Globalization.ci_naq-NA = Nama (Namibia)
-Globalization.ci_nb = Norwegian (Bokmål)
-Globalization.ci_nb-NO = Norwegian, Bokmål (Norway)
-Globalization.ci_nb-SJ = Norwegian, Bokmål (Svalbard and Jan Mayen)
-Globalization.ci_nd = North Ndebele
-Globalization.ci_nd-ZW = North Ndebele (Zimbabwe)
-Globalization.ci_ne = Nepali
-Globalization.ci_ne-IN = Nepali (India)
-Globalization.ci_ne-NP = Nepali (Nepal)
-Globalization.ci_nl = Dutch
-Globalization.ci_nl-AW = Dutch (Aruba)
-Globalization.ci_nl-BE = Dutch (Belgium)
-Globalization.ci_nl-BQ = Dutch (Bonaire, Sint Eustatius and Saba)
-Globalization.ci_nl-CW = Dutch (Curaçao)
-Globalization.ci_nl-NL = Dutch (Netherlands)
-Globalization.ci_nl-SR = Dutch (Suriname)
-Globalization.ci_nl-SX = Dutch (Sint Maarten)
-Globalization.ci_nmg = Kwasio
-Globalization.ci_nmg-CM = Kwasio (Cameroon)
-Globalization.ci_nn = Norwegian (Nynorsk)
-Globalization.ci_nn-NO = Norwegian, Nynorsk (Norway)
-Globalization.ci_nnh = Ngiemboon
-Globalization.ci_nnh-CM = Ngiemboon (Cameroon)
-Globalization.ci_no = Norwegian
-Globalization.ci_nqo = N'ko
-Globalization.ci_nqo-GN = N'ko (Guinea)
-Globalization.ci_nr = South Ndebele
-Globalization.ci_nr-ZA = South Ndebele (South Africa)
-Globalization.ci_nso = Sesotho sa Leboa
-Globalization.ci_nso-ZA = Sesotho sa Leboa (South Africa)
-Globalization.ci_nus = Nuer
-Globalization.ci_nus-SD = Nuer (Sudan)
-Globalization.ci_nyn = Nyankole
-Globalization.ci_nyn-UG = Nyankole (Uganda)
-Globalization.ci_oc = Occitan
-Globalization.ci_oc-FR = Occitan (France)
-Globalization.ci_om = Oromo
-Globalization.ci_om-ET = Oromo (Ethiopia)
-Globalization.ci_om-KE = Oromo (Kenya)
-Globalization.ci_or = Odia
-Globalization.ci_or-IN = Odia (India)
-Globalization.ci_os = Ossetic
-Globalization.ci_os-GE = Ossetian (Cyrillic, Georgia)
-Globalization.ci_os-RU = Ossetian (Cyrillic, Russia)
-Globalization.ci_pa = Punjabi
-Globalization.ci_pa-Arab = Punjabi (Arabic)
-Globalization.ci_pa-Arab-PK = Punjabi (Islamic Republic of Pakistan)
-Globalization.ci_pa-IN = Punjabi (India)
-Globalization.ci_pl = Polish
-Globalization.ci_pl-PL = Polish (Poland)
-Globalization.ci_prs = Dari
-Globalization.ci_prs-AF = Dari (Afghanistan)
-Globalization.ci_ps = Pashto
-Globalization.ci_ps-AF = Pashto (Afghanistan)
-Globalization.ci_pt = Portuguese
-Globalization.ci_pt-AO = Portuguese (Angola)
-Globalization.ci_pt-BR = Portuguese (Brazil)
-Globalization.ci_pt-CV = Portuguese (Cabo Verde)
-Globalization.ci_pt-GW = Portuguese (Guinea-Bissau)
-Globalization.ci_pt-MO = Portuguese (Macao SAR)
-Globalization.ci_pt-MZ = Portuguese (Mozambique)
-Globalization.ci_pt-PT = Portuguese (Portugal)
-Globalization.ci_pt-ST = Portuguese (São Tomé and Príncipe)
-Globalization.ci_pt-TL = Portuguese (Timor-Leste)
-Globalization.ci_qps-ploc = Pseudo Language (Pseudo)
-Globalization.ci_qps-ploca = Pseudo Language (Pseudo Asia)
-Globalization.ci_qps-plocm = Pseudo Language (Pseudo Mirrored)
-Globalization.ci_qu = Quechua
-Globalization.ci_qu-BO = Quechua (Bolivia)
-Globalization.ci_qu-EC = Quechua (Ecuador)
-Globalization.ci_qu-PE = Quechua (Peru)
-Globalization.ci_quc = K'iche'
-Globalization.ci_quc-Latn = K'iche'
-Globalization.ci_quc-Latn-GT = K'iche' (Guatemala)
-Globalization.ci_qut = K'iche
-Globalization.ci_qut-GT = K'iche (Guatemala)
-Globalization.ci_quz = Quechua
-Globalization.ci_quz-BO = Quechua (Bolivia)
-Globalization.ci_quz-EC = Quechua (Ecuador)
-Globalization.ci_quz-PE = Quechua (Peru)
-Globalization.ci_rm = Romansh
-Globalization.ci_rm-CH = Romansh (Switzerland)
-Globalization.ci_rn = Rundi
-Globalization.ci_rn-BI = Rundi (Burundi)
-Globalization.ci_ro = Romanian
-Globalization.ci_ro-MD = Romanian (Moldova)
-Globalization.ci_ro-RO = Romanian (Romania)
-Globalization.ci_rof = Rombo
-Globalization.ci_rof-TZ = Rombo (Tanzania)
-Globalization.ci_ru = Russian
-Globalization.ci_ru-BY = Russian (Belarus)
-Globalization.ci_ru-KG = Russian (Kyrgyzstan)
-Globalization.ci_ru-KZ = Russian (Kazakhstan)
-Globalization.ci_ru-MD = Russian (Moldova)
-Globalization.ci_ru-RU = Russian (Russia)
-Globalization.ci_ru-UA = Russian (Ukraine)
-Globalization.ci_rw = Kinyarwanda
-Globalization.ci_rw-RW = Kinyarwanda (Rwanda)
-Globalization.ci_rwk = Rwa
-Globalization.ci_rwk-TZ = Rwa (Tanzania)
-Globalization.ci_sa = Sanskrit
-Globalization.ci_sa-IN = Sanskrit (India)
-Globalization.ci_sah = Sakha
-Globalization.ci_sah-RU = Sakha (Russia)
-Globalization.ci_saq = Samburu
-Globalization.ci_saq-KE = Samburu (Kenya)
-Globalization.ci_sbp = Sangu
-Globalization.ci_sbp-TZ = Sangu (Tanzania)
-Globalization.ci_sd = Sindhi
-Globalization.ci_sd-Arab = Sindhi (Arabic)
-Globalization.ci_sd-Arab-PK = Sindhi (Islamic Republic of Pakistan)
-Globalization.ci_se = Sami (Northern)
-Globalization.ci_se-FI = Sami, Northern (Finland)
-Globalization.ci_se-NO = Sami, Northern (Norway)
-Globalization.ci_se-SE = Sami, Northern (Sweden)
-Globalization.ci_seh = Sena
-Globalization.ci_seh-MZ = Sena (Mozambique)
-Globalization.ci_ses = Koyraboro Senni
-Globalization.ci_ses-ML = Koyraboro Senni (Mali)
-Globalization.ci_sg = Sango
-Globalization.ci_sg-CF = Sango (Central African Republic)
-Globalization.ci_shi = Tachelhit
-Globalization.ci_shi-Latn = Tachelhit (Latin)
-Globalization.ci_shi-Latn-MA = Tachelhit (Latin, Morocco)
-Globalization.ci_shi-Tfng = Tachelhit (Tifinagh)
-Globalization.ci_shi-Tfng-MA = Tachelhit (Tifinagh, Morocco)
-Globalization.ci_si = Sinhala
-Globalization.ci_si-LK = Sinhala (Sri Lanka)
-Globalization.ci_sk = Slovak
-Globalization.ci_sk-SK = Slovak (Slovakia)
-Globalization.ci_sl = Slovenian
-Globalization.ci_sl-SI = Slovenian (Slovenia)
-Globalization.ci_sma = Sami (Southern)
-Globalization.ci_sma-NO = Sami, Southern (Norway)
-Globalization.ci_sma-SE = Sami, Southern (Sweden)
-Globalization.ci_smj = Sami (Lule)
-Globalization.ci_smj-NO = Sami, Lule (Norway)
-Globalization.ci_smj-SE = Sami, Lule (Sweden)
-Globalization.ci_smn = Sami (Inari)
-Globalization.ci_smn-FI = Sami, Inari (Finland)
-Globalization.ci_sms = Sami (Skolt)
-Globalization.ci_sms-FI = Sami, Skolt (Finland)
-Globalization.ci_sn = Shona
-Globalization.ci_sn-Latn = Shona (Latin)
-Globalization.ci_sn-Latn-ZW = Shona (Latin, Zimbabwe)
-Globalization.ci_so = Somali
-Globalization.ci_so-DJ = Somali (Djibouti)
-Globalization.ci_so-ET = Somali (Ethiopia)
-Globalization.ci_so-KE = Somali (Kenya)
-Globalization.ci_so-SO = Somali (Somalia)
-Globalization.ci_sq = Albanian
-Globalization.ci_sq-AL = Albanian (Albania)
-Globalization.ci_sq-MK = Albanian (Macedonia, FYRO)
-Globalization.ci_sr = Serbian
-Globalization.ci_sr-Cyrl = Serbian (Cyrillic)
-Globalization.ci_sr-Cyrl-BA = Serbian (Cyrillic, Bosnia and Herzegovina)
-Globalization.ci_sr-Cyrl-CS = Serbian (Cyrillic, Serbia and Montenegro (Former))
-Globalization.ci_sr-Cyrl-ME = Serbian (Cyrillic, Montenegro)
-Globalization.ci_sr-Cyrl-RS = Serbian (Cyrillic, Serbia)
-Globalization.ci_sr-Latn = Serbian (Latin)
-Globalization.ci_sr-Latn-BA = Serbian (Latin, Bosnia and Herzegovina)
-Globalization.ci_sr-Latn-CS = Serbian (Latin, Serbia and Montenegro (Former))
-Globalization.ci_sr-Latn-ME = Serbian (Latin, Montenegro)
-Globalization.ci_sr-Latn-RS = Serbian (Latin, Serbia)
-Globalization.ci_ss = Swati
-Globalization.ci_ss-SZ = Swati (Swaziland)
-Globalization.ci_ss-ZA = Swati (South Africa)
-Globalization.ci_ssy = Saho
-Globalization.ci_ssy-ER = Saho (Eritrea)
-Globalization.ci_st = Southern Sotho
-Globalization.ci_st-LS = Sesotho (Lesotho)
-Globalization.ci_st-ZA = Southern Sotho (South Africa)
-Globalization.ci_sv = Swedish
-Globalization.ci_sv-AX = Swedish (Åland Islands)
-Globalization.ci_sv-FI = Swedish (Finland)
-Globalization.ci_sv-SE = Swedish (Sweden)
-Globalization.ci_sw = Kiswahili
-Globalization.ci_sw-KE = Kiswahili (Kenya)
-Globalization.ci_sw-TZ = Kiswahili (Tanzania)
-Globalization.ci_sw-UG = Kiswahili (Uganda)
-Globalization.ci_swc = Congo Swahili
-Globalization.ci_swc-CD = Congo Swahili (Congo DRC)
-Globalization.ci_syr = Syriac
-Globalization.ci_syr-SY = Syriac (Syria)
-Globalization.ci_ta = Tamil
-Globalization.ci_ta-IN = Tamil (India)
-Globalization.ci_ta-LK = Tamil (Sri Lanka)
-Globalization.ci_ta-MY = Tamil (Malaysia)
-Globalization.ci_ta-SG = Tamil (Singapore)
-Globalization.ci_te = Telugu
-Globalization.ci_te-IN = Telugu (India)
-Globalization.ci_teo = Teso
-Globalization.ci_teo-KE = Teso (Kenya)
-Globalization.ci_teo-UG = Teso (Uganda)
-Globalization.ci_tg = Tajik
-Globalization.ci_tg-Cyrl = Tajik (Cyrillic)
-Globalization.ci_tg-Cyrl-TJ = Tajik (Cyrillic, Tajikistan)
-Globalization.ci_th = Thai
-Globalization.ci_th-TH = Thai (Thailand)
-Globalization.ci_ti = Tigrinya
-Globalization.ci_ti-ER = Tigrinya (Eritrea)
-Globalization.ci_ti-ET = Tigrinya (Ethiopia)
-Globalization.ci_tig = Tigre
-Globalization.ci_tig-ER = Tigre (Eritrea)
-Globalization.ci_tk = Turkmen
-Globalization.ci_tk-TM = Turkmen (Turkmenistan)
-Globalization.ci_tn = Setswana
-Globalization.ci_tn-BW = Setswana (Botswana)
-Globalization.ci_tn-ZA = Setswana (South Africa)
-Globalization.ci_to = Tongan
-Globalization.ci_to-TO = Tongan (Tonga)
-Globalization.ci_tr = Turkish
-Globalization.ci_tr-CY = Turkish (Cyprus)
-Globalization.ci_tr-TR = Turkish (Turkey)
-Globalization.ci_ts = Tsonga
-Globalization.ci_ts-ZA = Tsonga (South Africa)
-Globalization.ci_tt = Tatar
-Globalization.ci_tt-RU = Tatar (Russia)
-Globalization.ci_twq = Tasawaq
-Globalization.ci_twq-NE = Tasawaq (Niger)
-Globalization.ci_tzm = Tamazight
-Globalization.ci_tzm-Latn = Tamazight (Latin)
-Globalization.ci_tzm-Latn-DZ = Tamazight (Latin, Algeria)
-Globalization.ci_tzm-Latn-MA = Central Atlas Tamazight (Latin, Morocco)
-Globalization.ci_tzm-Tfng = Tamazight (Tifinagh)
-Globalization.ci_tzm-Tfng-MA = Central Atlas Tamazight (Tifinagh, Morocco)
-Globalization.ci_ug = Uyghur
-Globalization.ci_ug-CN = Uyghur (PRC)
-Globalization.ci_uk = Ukrainian
-Globalization.ci_uk-UA = Ukrainian (Ukraine)
-Globalization.ci_ur = Urdu
-Globalization.ci_ur-IN = Urdu (India)
-Globalization.ci_ur-PK = Urdu (Islamic Republic of Pakistan)
-Globalization.ci_uz = Uzbek
-Globalization.ci_uz-Arab = Uzbek (Perso-Arabic)
-Globalization.ci_uz-Arab-AF = Uzbek (Perso-Arabic, Afghanistan)
-Globalization.ci_uz-Cyrl = Uzbek (Cyrillic)
-Globalization.ci_uz-Cyrl-UZ = Uzbek (Cyrillic, Uzbekistan)
-Globalization.ci_uz-Latn = Uzbek (Latin)
-Globalization.ci_uz-Latn-UZ = Uzbek (Latin, Uzbekistan)
-Globalization.ci_vai = Vai
-Globalization.ci_vai-Latn = Vai (Latin)
-Globalization.ci_vai-Latn-LR = Vai (Latin, Liberia)
-Globalization.ci_vai-Vaii = Vai (Vai)
-Globalization.ci_vai-Vaii-LR = Vai (Vai, Liberia)
-Globalization.ci_ve = Venda
-Globalization.ci_ve-ZA = Venda (South Africa)
-Globalization.ci_vi = Vietnamese
-Globalization.ci_vi-VN = Vietnamese (Vietnam)
-Globalization.ci_vo = Volapük
-Globalization.ci_vo-001 = Volapük (World)
-Globalization.ci_vun = Vunjo
-Globalization.ci_vun-TZ = Vunjo (Tanzania)
-Globalization.ci_wae = Walser
-Globalization.ci_wae-CH = Walser (Switzerland)
-Globalization.ci_wal = Wolaytta
-Globalization.ci_wal-ET = Wolaytta (Ethiopia)
-Globalization.ci_wo = Wolof
-Globalization.ci_wo-SN = Wolof (Senegal)
-Globalization.ci_x-IV = Invariant Language (Invariant Country)
-Globalization.ci_x-IV_mathan = Invariant Language (Invariant Country)
-Globalization.ci_xh = isiXhosa
-Globalization.ci_xh-ZA = isiXhosa (South Africa)
-Globalization.ci_xog = Soga
-Globalization.ci_xog-UG = Soga (Uganda)
-Globalization.ci_yav = Yangben
-Globalization.ci_yav-CM = Yangben (Cameroon)
-Globalization.ci_yi = Yiddish
-Globalization.ci_yi-001 = Yiddish (World)
-Globalization.ci_yo = Yoruba
-Globalization.ci_yo-BJ = Yoruba (Benin)
-Globalization.ci_yo-NG = Yoruba (Nigeria)
-Globalization.ci_zgh = Standard Moroccan Tamazight
-Globalization.ci_zgh-Tfng = Standard Moroccan Tamazight (Tifinagh)
-Globalization.ci_zgh-Tfng-MA = Standard Moroccan Tamazight (Tifinagh, Morocco)
-Globalization.ci_zh = Chinese
-Globalization.ci_zh-CHS = Chinese (Simplified) Legacy
-Globalization.ci_zh-CHT = Chinese (Traditional) Legacy
-Globalization.ci_zh-CN = Chinese (Simplified, PRC)
-Globalization.ci_zh-CN_stroke = Chinese (Simplified, PRC)
-Globalization.ci_zh-Hans = Chinese (Simplified)
-Globalization.ci_zh-Hant = Chinese (Traditional)
-Globalization.ci_zh-HK = Chinese (Traditional, Hong Kong S.A.R.)
-Globalization.ci_zh-HK_radstr = Chinese (Traditional, Hong Kong S.A.R.)
-Globalization.ci_zh-MO = Chinese (Traditional, Macao S.A.R.)
-Globalization.ci_zh-MO_radstr = Chinese (Traditional, Macao S.A.R.)
-Globalization.ci_zh-MO_stroke = Chinese (Traditional, Macao S.A.R.)
-Globalization.ci_zh-SG = Chinese (Simplified, Singapore)
-Globalization.ci_zh-SG_stroke = Chinese (Simplified, Singapore)
-Globalization.ci_zh-TW = Chinese (Traditional, Taiwan)
-Globalization.ci_zh-TW_pronun = Chinese (Traditional, Taiwan)
-Globalization.ci_zh-TW_radstr = Chinese (Traditional, Taiwan)
-Globalization.ci_zu = isiZulu
-Globalization.ci_zu-ZA = isiZulu (South Africa)
-;------------------
-;
-;Total items: 129
-;
-Globalization.ri_029 = Caribbean
-Globalization.ri_AE = U.A.E.
-Globalization.ri_AF = Afghanistan
-Globalization.ri_AL = Albania
-Globalization.ri_AM = Armenia
-Globalization.ri_AR = Argentina
-Globalization.ri_AT = Austria
-Globalization.ri_AU = Australia
-Globalization.ri_AZ = Azerbaijan
-Globalization.ri_BA = Bosnia and Herzegovina
-Globalization.ri_BD = Bangladesh
-Globalization.ri_BE = Belgium
-Globalization.ri_BG = Bulgaria
-Globalization.ri_BH = Bahrain
-Globalization.ri_BN = Brunei Darussalam
-Globalization.ri_BO = Bolivia
-Globalization.ri_BR = Brazil
-Globalization.ri_BY = Belarus
-Globalization.ri_BZ = Belize
-Globalization.ri_CA = Canada
-Globalization.ri_CH = Switzerland
-Globalization.ri_CL = Chile
-Globalization.ri_CN = People's Republic of China
-Globalization.ri_CO = Colombia
-Globalization.ri_CR = Costa Rica
-Globalization.ri_CS = Serbia and Montenegro (Former)
-Globalization.ri_CZ = Czech Republic
-Globalization.ri_DE = Germany
-Globalization.ri_DK = Denmark
-Globalization.ri_DO = Dominican Republic
-Globalization.ri_DZ = Algeria
-Globalization.ri_EC = Ecuador
-Globalization.ri_EE = Estonia
-Globalization.ri_EG = Egypt
-Globalization.ri_ER = Eritrea
-Globalization.ri_ES = Spain
-Globalization.ri_ET = Ethiopia
-Globalization.ri_FI = Finland
-Globalization.ri_FO = Faroe Islands
-Globalization.ri_FR = France
-Globalization.ri_GB = United Kingdom
-Globalization.ri_GE = Georgia
-Globalization.ri_GL = Greenland
-Globalization.ri_GR = Greece
-Globalization.ri_GT = Guatemala
-Globalization.ri_HK = Hong Kong S.A.R.
-Globalization.ri_HN = Honduras
-Globalization.ri_HR = Croatia
-Globalization.ri_HU = Hungary
-Globalization.ri_ID = Indonesia
-Globalization.ri_IE = Ireland
-Globalization.ri_IL = Israel
-Globalization.ri_IN = India
-Globalization.ri_IQ = Iraq
-Globalization.ri_IR = Iran
-Globalization.ri_IS = Iceland
-Globalization.ri_IT = Italy
-Globalization.ri_IV = Invariant Country
-Globalization.ri_JM = Jamaica
-Globalization.ri_JO = Jordan
-Globalization.ri_JP = Japan
-Globalization.ri_KE = Kenya
-Globalization.ri_KG = Kyrgyzstan
-Globalization.ri_KH = Cambodia
-Globalization.ri_KR = Korea
-Globalization.ri_KW = Kuwait
-Globalization.ri_KZ = Kazakhstan
-Globalization.ri_LA = Lao P.D.R.
-Globalization.ri_LB = Lebanon
-Globalization.ri_LI = Liechtenstein
-Globalization.ri_LK = Sri Lanka
-Globalization.ri_LT = Lithuania
-Globalization.ri_LU = Luxembourg
-Globalization.ri_LV = Latvia
-Globalization.ri_LY = Libya
-Globalization.ri_MA = Morocco
-Globalization.ri_MC = Principality of Monaco
-Globalization.ri_ME = Montenegro
-Globalization.ri_MK = Macedonia (FYROM)
-Globalization.ri_MN = Mongolia
-Globalization.ri_MO = Macao S.A.R.
-Globalization.ri_MT = Malta
-Globalization.ri_MV = Maldives
-Globalization.ri_MX = Mexico
-Globalization.ri_MY = Malaysia
-Globalization.ri_NG = Nigeria
-Globalization.ri_NI = Nicaragua
-Globalization.ri_NL = Netherlands
-Globalization.ri_NO = Norway
-Globalization.ri_NP = Nepal
-Globalization.ri_NZ = New Zealand
-Globalization.ri_OM = Oman
-Globalization.ri_PA = Panama
-Globalization.ri_PE = Peru
-Globalization.ri_PH = Philippines
-Globalization.ri_PK = Islamic Republic of Pakistan
-Globalization.ri_PL = Poland
-Globalization.ri_PR = Puerto Rico
-Globalization.ri_PT = Portugal
-Globalization.ri_PY = Paraguay
-Globalization.ri_QA = Qatar
-Globalization.ri_RO = Romania
-Globalization.ri_RS = Serbia
-Globalization.ri_RU = Russia
-Globalization.ri_RW = Rwanda
-Globalization.ri_SA = Saudi Arabia
-Globalization.ri_SE = Sweden
-Globalization.ri_SG = Singapore
-Globalization.ri_SI = Slovenia
-Globalization.ri_SK = Slovakia
-Globalization.ri_SN = Senegal
-Globalization.ri_SV = El Salvador
-Globalization.ri_SY = Syria
-Globalization.ri_TH = Thailand
-Globalization.ri_TJ = Tajikistan
-Globalization.ri_TM = Turkmenistan
-Globalization.ri_TN = Tunisia
-Globalization.ri_TR = Turkey
-Globalization.ri_TT = Trinidad and Tobago
-Globalization.ri_TW = Taiwan
-Globalization.ri_UA = Ukraine
-Globalization.ri_US = United States
-Globalization.ri_UY = Uruguay
-Globalization.ri_UZ = Uzbekistan
-Globalization.ri_VE = Bolivarian Republic of Venezuela
-Globalization.ri_VN = Vietnam
-Globalization.ri_YE = Yemen
-Globalization.ri_ZA = South Africa
-Globalization.ri_ZW = Zimbabwe
-#endif //!FEATURE_CORECLR
+; Buffers
+ArgumentException_BufferNotFromPool=The buffer is not associated with this pool and may not be returned to it.
;------------------
; Encoding names:
diff --git a/src/mscorlib/src/System/Action.cs b/src/mscorlib/src/System/Action.cs
index d6653c7..27f7faf 100644
--- a/src/mscorlib/src/System/Action.cs
+++ b/src/mscorlib/src/System/Action.cs
@@ -2,62 +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.
-//
-
-namespace System {
- using System.Runtime.CompilerServices;
-
+namespace System
+{
public delegate void Action<in T>(T obj);
// Action/Func delegates first shipped with .NET Framework 3.5 in System.Core.dll as part of LINQ
// These were type forwarded to mscorlib.dll in .NET Framework 4.0 and in Silverlight 5.0
-
-#if !FEATURE_CORECLR
- [TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
-#endif
public delegate void Action();
-
-#if !FEATURE_CORECLR
- [TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
-#endif
public delegate void Action<in T1,in T2>(T1 arg1, T2 arg2);
-
-#if !FEATURE_CORECLR
- [TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
-#endif
public delegate void Action<in T1,in T2,in T3>(T1 arg1, T2 arg2, T3 arg3);
-
-#if !FEATURE_CORECLR
- [TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
-#endif
public delegate void Action<in T1,in T2,in T3,in T4>(T1 arg1, T2 arg2, T3 arg3, T4 arg4);
-#if !FEATURE_CORECLR
- [TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
-#endif
public delegate TResult Func<out TResult>();
-
-#if !FEATURE_CORECLR
- [TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
-#endif
public delegate TResult Func<in T, out TResult>(T arg);
-
-#if !FEATURE_CORECLR
- [TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
-#endif
public delegate TResult Func<in T1, in T2, out TResult>(T1 arg1, T2 arg2);
-
-#if !FEATURE_CORECLR
- [TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
-#endif
public delegate TResult Func<in T1, in T2, in T3, out TResult>(T1 arg1, T2 arg2, T3 arg3);
-
-#if !FEATURE_CORECLR
- [TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
-#endif
public delegate TResult Func<in T1, in T2, in T3, in T4, out TResult>(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);
diff --git a/src/mscorlib/src/System/Activator.cs b/src/mscorlib/src/System/Activator.cs
index 274b0e7..6fad8f3 100644
--- a/src/mscorlib/src/System/Activator.cs
+++ b/src/mscorlib/src/System/Activator.cs
@@ -16,10 +16,6 @@ namespace System {
using System;
using System.Reflection;
using System.Runtime.Remoting;
-#if FEATURE_REMOTING
- using System.Runtime.Remoting.Activation;
- using Message = System.Runtime.Remoting.Messaging.Message;
-#endif
using System.Security;
using CultureInfo = System.Globalization.CultureInfo;
using Evidence = System.Security.Policy.Evidence;
@@ -34,7 +30,7 @@ namespace System {
// Only statics, does not need to be marked with the serializable attribute
[ClassInterface(ClassInterfaceType.None)]
[ComDefaultInterface(typeof(_Activator))]
-[System.Runtime.InteropServices.ComVisible(true)]
+ [System.Runtime.InteropServices.ComVisible(true)]
public sealed class Activator : _Activator
{
internal const int LookupMask = 0x000000FF;
@@ -60,7 +56,6 @@ namespace System {
return CreateInstance(type, bindingAttr, binder, args, culture, null);
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
static public Object CreateInstance(Type type,
BindingFlags bindingAttr,
@@ -70,7 +65,7 @@ namespace System {
Object[] activationAttributes)
{
if ((object)type == null)
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException(nameof(type));
Contract.EndContractBlock();
if (type is System.Reflection.Emit.TypeBuilder)
@@ -81,26 +76,13 @@ namespace System {
bindingAttr |= Activator.ConstructorDefault;
if (activationAttributes != null && activationAttributes.Length > 0){
- // If type does not derive from MBR
- // throw notsupportedexception
-#if FEATURE_REMOTING
- if(type.IsMarshalByRef){
- // The fix below is preventative.
- //
- if(!(type.IsContextful)){
- if(activationAttributes.Length > 1 || !(activationAttributes[0] is UrlAttribute))
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_NonUrlAttrOnMBR"));
- }
- }
- else
-#endif
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_ActivAttrOnNonMBR" ));
+ throw new PlatformNotSupportedException(Environment.GetResourceString("NotSupported_ActivAttr" ));
}
RuntimeType rt = type.UnderlyingSystemType as RuntimeType;
if (rt == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"),"type");
+ throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(type));
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return rt.CreateInstanceImpl(bindingAttr,binder,args,culture,activationAttributes, ref stackMark);
@@ -138,7 +120,6 @@ namespace System {
* types to be created remotely without having to load the type locally.
*/
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
static public ObjectHandle CreateInstance(String assemblyName,
String typeName)
@@ -156,7 +137,6 @@ namespace System {
ref stackMark);
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
static public ObjectHandle CreateInstance(String assemblyName,
String typeName,
@@ -180,13 +160,13 @@ namespace System {
static public Object CreateInstance(Type type, bool nonPublic)
{
if ((object)type == null)
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException(nameof(type));
Contract.EndContractBlock();
RuntimeType rt = type.UnderlyingSystemType as RuntimeType;
if (rt == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), "type");
+ throw new ArgumentException(Environment.GetResourceString("Arg_MustBeType"), nameof(type));
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return rt.CreateInstanceDefaultCtor(!nonPublic, false, true, ref stackMark);
@@ -230,7 +210,6 @@ namespace System {
activationAttributes);
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
[Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of CreateInstance which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
static public ObjectHandle CreateInstance(String assemblyName,
@@ -256,7 +235,6 @@ namespace System {
ref stackMark);
}
- [SecuritySafeCritical]
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
public static ObjectHandle CreateInstance(string assemblyName,
string typeName,
@@ -280,7 +258,6 @@ namespace System {
ref stackMark);
}
- [System.Security.SecurityCritical] // auto-generated
static internal ObjectHandle CreateInstance(String assemblyString,
String typeName,
bool ignoreCase,
@@ -292,13 +269,6 @@ namespace System {
Evidence securityInfo,
ref StackCrawlMark stackMark)
{
-#if FEATURE_CAS_POLICY
- if (securityInfo != null && !AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled)
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
- }
-#endif // FEATURE_CAS_POLICY
-
Type type = null;
Assembly assembly = null;
if (assemblyString == null) {
@@ -356,13 +326,6 @@ namespace System {
Evidence securityInfo)
{
-#if FEATURE_CAS_POLICY
- if (securityInfo != null && !AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled)
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
- }
-#endif // FEATURE_CAS_POLICY
-
return CreateInstanceFromInternal(assemblyFile,
typeName,
ignoreCase,
@@ -404,10 +367,6 @@ namespace System {
Object[] activationAttributes,
Evidence securityInfo)
{
-#if FEATURE_CAS_POLICY
- Contract.Assert(AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled || securityInfo == null);
-#endif // FEATURE_CAS_POLICY
-
#pragma warning disable 618
Assembly assembly = Assembly.LoadFrom(assemblyFile, securityInfo);
#pragma warning restore 618
@@ -436,15 +395,13 @@ namespace System {
// to pass the security checks when activating the type.
//
- [System.Security.SecurityCritical] // auto-generated_required
public static ObjectHandle CreateInstance (AppDomain domain, string assemblyName, string typeName) {
if (domain == null)
- throw new ArgumentNullException("domain");
+ throw new ArgumentNullException(nameof(domain));
Contract.EndContractBlock();
return domain.InternalCreateInstanceWithNoSecurity(assemblyName, typeName);
}
- [System.Security.SecurityCritical] // auto-generated_required
[Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of CreateInstance which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
public static ObjectHandle CreateInstance (AppDomain domain,
string assemblyName,
@@ -457,20 +414,12 @@ namespace System {
Object[] activationAttributes,
Evidence securityAttributes) {
if (domain == null)
- throw new ArgumentNullException("domain");
+ throw new ArgumentNullException(nameof(domain));
Contract.EndContractBlock();
-#if FEATURE_CAS_POLICY
- if (securityAttributes != null && !AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled)
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
- }
-#endif // FEATURE_CAS_POLICY
-
return domain.InternalCreateInstanceWithNoSecurity(assemblyName, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes, securityAttributes);
}
- [SecurityCritical]
public static ObjectHandle CreateInstance(AppDomain domain,
string assemblyName,
string typeName,
@@ -482,7 +431,7 @@ namespace System {
object[] activationAttributes)
{
if (domain == null)
- throw new ArgumentNullException("domain");
+ throw new ArgumentNullException(nameof(domain));
Contract.EndContractBlock();
return domain.InternalCreateInstanceWithNoSecurity(assemblyName,
@@ -503,15 +452,13 @@ namespace System {
// to pass the security checks when activating the type.
//
- [System.Security.SecurityCritical] // auto-generated_required
public static ObjectHandle CreateInstanceFrom (AppDomain domain, string assemblyFile, string typeName) {
if (domain == null)
- throw new ArgumentNullException("domain");
+ throw new ArgumentNullException(nameof(domain));
Contract.EndContractBlock();
return domain.InternalCreateInstanceFromWithNoSecurity(assemblyFile, typeName);
}
- [System.Security.SecurityCritical] // auto-generated_required
[Obsolete("Methods which use Evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of CreateInstanceFrom which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
public static ObjectHandle CreateInstanceFrom (AppDomain domain,
string assemblyFile,
@@ -524,20 +471,12 @@ namespace System {
Object[] activationAttributes,
Evidence securityAttributes) {
if (domain == null)
- throw new ArgumentNullException("domain");
+ throw new ArgumentNullException(nameof(domain));
Contract.EndContractBlock();
-#if FEATURE_CAS_POLICY
- if (securityAttributes != null && !AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled)
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
- }
-#endif // FEATURE_CAS_POLICY
-
return domain.InternalCreateInstanceFromWithNoSecurity(assemblyFile, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes, securityAttributes);
}
- [SecurityCritical]
public static ObjectHandle CreateInstanceFrom(AppDomain domain,
string assemblyFile,
string typeName,
@@ -549,7 +488,7 @@ namespace System {
object[] activationAttributes)
{
if (domain == null)
- throw new ArgumentNullException("domain");
+ throw new ArgumentNullException(nameof(domain));
Contract.EndContractBlock();
return domain.InternalCreateInstanceFromWithNoSecurity(assemblyFile,
@@ -563,28 +502,8 @@ namespace System {
null);
}
-#if FEATURE_CLICKONCE
- [System.Security.SecuritySafeCritical] // auto-generated
- public static ObjectHandle CreateInstance (ActivationContext activationContext) {
- AppDomainManager domainManager = AppDomain.CurrentDomain.DomainManager;
- if (domainManager == null)
- domainManager = new AppDomainManager();
-
- return domainManager.ApplicationActivator.CreateInstance(activationContext);
- }
-
- [System.Security.SecuritySafeCritical] // auto-generated
- public static ObjectHandle CreateInstance (ActivationContext activationContext, string[] activationCustomData) {
- AppDomainManager domainManager = AppDomain.CurrentDomain.DomainManager;
- if (domainManager == null)
- domainManager = new AppDomainManager();
-
- return domainManager.ApplicationActivator.CreateInstance(activationContext, activationCustomData);
- }
-#endif // FEATURE_CLICKONCE
-
public static ObjectHandle CreateComInstanceFrom(String assemblyName,
- String typeName)
+ String typeName)
{
return CreateComInstanceFrom(assemblyName,
typeName,
@@ -630,38 +549,11 @@ namespace System {
}
}
-#if FEATURE_REMOTING
- // This method is a helper method and delegates to the remoting
- // services to do the actual work.
- [System.Security.SecurityCritical] // auto-generated_required
- static public Object GetObject(Type type, String url)
- {
- return GetObject(type, url, null);
- }
-
- // This method is a helper method and delegates to the remoting
- // services to do the actual work.
- [System.Security.SecurityCritical] // auto-generated_required
- static public Object GetObject(Type type, String url, Object state)
- {
- if (type == null)
- throw new ArgumentNullException("type");
- Contract.EndContractBlock();
- return RemotingServices.Connect(type, url, state);
- }
-#endif
-
[System.Diagnostics.Conditional("_DEBUG")]
private static void Log(bool test, string title, string success, string failure)
{
-#if FEATURE_REMOTING
- if(test)
- BCLDebug.Trace("REMOTE", "{0}{1}", title, success);
- else
- BCLDebug.Trace("REMOTE", "{0}{1}", title, failure);
-#endif
}
-
+
void _Activator.GetTypeInfoCount(out uint pcTInfo)
{
throw new NotImplementedException();
diff --git a/src/mscorlib/src/System/AggregateException.cs b/src/mscorlib/src/System/AggregateException.cs
index 064432a..c0f2122 100644
--- a/src/mscorlib/src/System/AggregateException.cs
+++ b/src/mscorlib/src/System/AggregateException.cs
@@ -69,7 +69,7 @@ namespace System
{
if (innerException == null)
{
- throw new ArgumentNullException("innerException");
+ throw new ArgumentNullException(nameof(innerException));
}
m_innerExceptions = new ReadOnlyCollection<Exception>(new Exception[] { innerException });
@@ -149,7 +149,7 @@ namespace System
{
if (innerExceptions == null)
{
- throw new ArgumentNullException("innerExceptions");
+ throw new ArgumentNullException(nameof(innerExceptions));
}
// Copy exceptions to our internal array and validate them. We must copy them,
@@ -227,7 +227,7 @@ namespace System
{
if (innerExceptionInfos == null)
{
- throw new ArgumentNullException("innerExceptionInfos");
+ throw new ArgumentNullException(nameof(innerExceptionInfos));
}
// Copy exceptions to our internal array and validate them. We must copy them,
@@ -258,13 +258,12 @@ namespace System
/// contains contextual information about the source or destination. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> argument is null.</exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The exception could not be deserialized correctly.</exception>
- [SecurityCritical]
protected AggregateException(SerializationInfo info, StreamingContext context) :
base(info, context)
{
if (info == null)
{
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
}
Exception[] innerExceptions = info.GetValue("InnerExceptions", typeof(Exception[])) as Exception[];
@@ -285,12 +284,11 @@ namespace System
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that
/// contains contextual information about the source or destination. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="info"/> argument is null.</exception>
- [SecurityCritical]
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
{
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
}
base.GetObjectData(info, context);
@@ -351,7 +349,7 @@ namespace System
{
if (predicate == null)
{
- throw new ArgumentNullException("predicate");
+ throw new ArgumentNullException(nameof(predicate));
}
List<Exception> unhandledExceptions = null;
@@ -379,7 +377,8 @@ namespace System
/// <summary>
- /// Flattens an <see cref="AggregateException"/> instances into a single, new instance.
+ /// Flattens the inner instances of <see cref="AggregateException"/> by expanding its contained <see cref="Exception"/> instances
+ /// into a new <see cref="AggregateException"/>
/// </summary>
/// <returns>A new, flattened <see cref="AggregateException"/>.</returns>
/// <remarks>
diff --git a/src/mscorlib/src/System/AppContext/AppContext.cs b/src/mscorlib/src/System/AppContext/AppContext.cs
index 0b0643d..41e4450 100644
--- a/src/mscorlib/src/System/AppContext/AppContext.cs
+++ b/src/mscorlib/src/System/AppContext/AppContext.cs
@@ -21,9 +21,6 @@ namespace System
public static string BaseDirectory
{
-#if FEATURE_CORECLR
- [System.Security.SecuritySafeCritical]
-#endif
get
{
// The value of APP_CONTEXT_BASE_DIRECTORY key has to be a string and it is not allowed to be any other type.
@@ -41,14 +38,53 @@ namespace System
}
}
-#if FEATURE_CORECLR
- [System.Security.SecuritySafeCritical]
-#endif
public static object GetData(string name)
{
return AppDomain.CurrentDomain.GetData(name);
}
+ public static void SetData(string name, object data)
+ {
+ AppDomain.CurrentDomain.SetData(name, data);
+ }
+
+ public static event UnhandledExceptionEventHandler UnhandledException
+ {
+ add
+ {
+ AppDomain.CurrentDomain.UnhandledException += value;
+ }
+
+ remove
+ {
+ AppDomain.CurrentDomain.UnhandledException -= value;
+ }
+ }
+
+ public static event System.EventHandler<System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs> FirstChanceException
+ {
+ add
+ {
+ AppDomain.CurrentDomain.FirstChanceException += value;
+ }
+ remove
+ {
+ AppDomain.CurrentDomain.FirstChanceException -= value;
+ }
+ }
+
+ public static event System.EventHandler ProcessExit
+ {
+ add
+ {
+ AppDomain.CurrentDomain.ProcessExit += value;
+ }
+ remove
+ {
+ AppDomain.CurrentDomain.ProcessExit -= value;
+ }
+ }
+
#region Switch APIs
static AppContext()
{
@@ -65,9 +101,9 @@ namespace System
public static bool TryGetSwitch(string switchName, out bool isEnabled)
{
if (switchName == null)
- throw new ArgumentNullException("switchName");
+ throw new ArgumentNullException(nameof(switchName));
if (switchName.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "switchName");
+ throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(switchName));
// By default, the switch is not enabled.
isEnabled = false;
@@ -161,9 +197,9 @@ namespace System
public static void SetSwitch(string switchName, bool isEnabled)
{
if (switchName == null)
- throw new ArgumentNullException("switchName");
+ throw new ArgumentNullException(nameof(switchName));
if (switchName.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "switchName");
+ throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), nameof(switchName));
SwitchValueState switchValue = (isEnabled ? SwitchValueState.HasTrueValue : SwitchValueState.HasFalseValue)
| SwitchValueState.HasLookedForOverride;
diff --git a/src/mscorlib/src/System/AppContext/AppContextDefaultValues.Defaults.cs b/src/mscorlib/src/System/AppContext/AppContextDefaultValues.Defaults.cs
index c80913e..52bdf9d 100644
--- a/src/mscorlib/src/System/AppContext/AppContextDefaultValues.Defaults.cs
+++ b/src/mscorlib/src/System/AppContext/AppContextDefaultValues.Defaults.cs
@@ -12,10 +12,6 @@ namespace System
internal static readonly string SwitchNoAsyncCurrentCulture = "Switch.System.Globalization.NoAsyncCurrentCulture";
internal static readonly string SwitchThrowExceptionIfDisposedCancellationTokenSource = "Switch.System.Threading.ThrowExceptionIfDisposedCancellationTokenSource";
internal static readonly string SwitchPreserveEventListnerObjectIdentity = "Switch.System.Diagnostics.EventSource.PreserveEventListnerObjectIdentity";
-#if FEATURE_PATHCOMPAT
- internal static readonly string SwitchUseLegacyPathHandling = "Switch.System.IO.UseLegacyPathHandling";
- internal static readonly string SwitchBlockLongPaths = "Switch.System.IO.BlockLongPaths";
-#endif
// This is a partial method. Platforms can provide an implementation of it that will set override values
// from whatever mechanism is available on that platform. If no implementation is provided, the compiler is going to remove the calls
@@ -43,13 +39,7 @@ namespace System
AppContext.DefineSwitchDefault(SwitchNoAsyncCurrentCulture, true);
AppContext.DefineSwitchDefault(SwitchThrowExceptionIfDisposedCancellationTokenSource, true);
}
-#if FEATURE_PATHCOMPAT
- if (version <= 40601)
- {
- AppContext.DefineSwitchDefault(SwitchUseLegacyPathHandling, true);
- AppContext.DefineSwitchDefault(SwitchBlockLongPaths, true);
- }
-#endif
+
break;
}
case "WindowsPhone":
diff --git a/src/mscorlib/src/System/AppContext/AppContextDefaultValues.cs b/src/mscorlib/src/System/AppContext/AppContextDefaultValues.cs
index 7ab7ffb..9f00e81 100644
--- a/src/mscorlib/src/System/AppContext/AppContextDefaultValues.cs
+++ b/src/mscorlib/src/System/AppContext/AppContextDefaultValues.cs
@@ -30,7 +30,6 @@ namespace System
if (!TryParseFrameworkName(targetFrameworkMoniker, out identifier, out version, out profile))
{
-#if FEATURE_CORECLR
// If we can't parse the TFM or we don't have a TFM, default to latest behavior for all
// switches (ie. all of them false).
// If we want to use the latest behavior it is enough to set the value of the switch to string.Empty.
@@ -39,11 +38,6 @@ namespace System
// identifier we are simply saying -- don't turn on any switches, and we are going to get the latest
// behavior for all the switches
identifier = string.Empty;
-#else
- identifier = ".NETFramework";
- version = 40000;
- profile = string.Empty;
-#endif
}
}
diff --git a/src/mscorlib/src/System/AppContext/AppContextSwitches.cs b/src/mscorlib/src/System/AppContext/AppContextSwitches.cs
index 3a96ec2..5fdd2bc 100644
--- a/src/mscorlib/src/System/AppContext/AppContextSwitches.cs
+++ b/src/mscorlib/src/System/AppContext/AppContextSwitches.cs
@@ -39,36 +39,6 @@ namespace System
}
}
-#if FEATURE_PATHCOMPAT
- private static int _useLegacyPathHandling;
-
- /// <summary>
- /// Use legacy path normalization logic and blocking of extended syntax.
- /// </summary>
- public static bool UseLegacyPathHandling
- {
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
- {
- return GetCachedSwitchValue(AppContextDefaultValues.SwitchUseLegacyPathHandling, ref _useLegacyPathHandling);
- }
- }
-
- private static int _blockLongPaths;
-
- /// <summary>
- /// Throw PathTooLongException for paths greater than MAX_PATH or directories greater than 248 (as per CreateDirectory Win32 limitations)
- /// </summary>
- public static bool BlockLongPaths
- {
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- get
- {
- return GetCachedSwitchValue(AppContextDefaultValues.SwitchBlockLongPaths, ref _blockLongPaths);
- }
- }
-#endif // FEATURE_PATHCOMPAT
-
//
// Implementation details
//
diff --git a/src/mscorlib/src/System/AppDomain.cs b/src/mscorlib/src/System/AppDomain.cs
index abaaf48..fe524c4 100644
--- a/src/mscorlib/src/System/AppDomain.cs
+++ b/src/mscorlib/src/System/AppDomain.cs
@@ -13,46 +13,29 @@
**
=============================================================================*/
-namespace System {
+namespace System
+{
using System;
-#if FEATURE_CLICKONCE
- using System.Deployment.Internal.Isolation;
- using System.Deployment.Internal.Isolation.Manifest;
- using System.Runtime.Hosting;
-#endif
using System.Reflection;
using System.Runtime;
using System.Runtime.CompilerServices;
-#if FEATURE_REMOTING
- using System.Runtime.Remoting.Channels;
- using System.Runtime.Remoting.Contexts;
-#endif
using System.Security;
using System.Security.Permissions;
-#if FEATURE_IMPERSONATION
- using System.Security.Principal;
-#endif
using System.Security.Policy;
using System.Security.Util;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using System.Runtime.InteropServices;
- using System.Runtime.Remoting;
-#if FEATURE_REMOTING
- using Context = System.Runtime.Remoting.Contexts.Context;
-#endif
+ using System.Runtime.Remoting;
using System.Reflection.Emit;
using CultureInfo = System.Globalization.CultureInfo;
-#if !FEATURE_CORECLR
- using System.Globalization;
-#endif
using System.IO;
using AssemblyHashAlgorithm = System.Configuration.Assemblies.AssemblyHashAlgorithm;
using System.Text;
- using Microsoft.Win32;
using System.Runtime.ConstrainedExecution;
using System.Runtime.Versioning;
+ using System.Diagnostics;
using System.Diagnostics.Contracts;
#if FEATURE_EXCEPTION_NOTIFICATIONS
using System.Runtime.ExceptionServices;
@@ -107,10 +90,6 @@ namespace System {
}
}
-
- #if FEATURE_CORECLR
- [System.Security.SecurityCritical] // auto-generated
- #endif
[Serializable]
[ComVisible(true)]
public delegate Assembly ResolveEventHandler(Object sender, ResolveEventArgs args);
@@ -177,7 +156,6 @@ namespace System {
Info = itemInfo.ToArray();
}
- [System.Security.SecuritySafeCritical] // auto-generated
internal AppDomainInitializer Unwrap()
{
if (Info==null)
@@ -204,17 +182,13 @@ namespace System {
[ComDefaultInterface(typeof(System._AppDomain))]
[ComVisible(true)]
public sealed class AppDomain :
-#if FEATURE_REMOTING
- MarshalByRefObject,
-#endif
_AppDomain, IEvidenceFactory
{
// Domain security information
// These fields initialized from the other side only. (NOTE: order
// of these fields cannot be changed without changing the layout in
- // the EE)
+ // the EE- AppDomainBaseObject in this case)
- [System.Security.SecurityCritical] // auto-generated
private AppDomainManager _domainManager;
private Dictionary<String, Object[]> _LocalStore;
private AppDomainSetup _FusionStore;
@@ -225,12 +199,10 @@ namespace System {
[method: System.Security.SecurityCritical]
public event AssemblyLoadEventHandler AssemblyLoad;
- [System.Security.SecurityCritical]
private ResolveEventHandler _TypeResolve;
public event ResolveEventHandler TypeResolve
{
- [System.Security.SecurityCritical]
add
{
lock (this)
@@ -239,7 +211,6 @@ namespace System {
}
}
- [System.Security.SecurityCritical]
remove
{
lock (this)
@@ -249,12 +220,10 @@ namespace System {
}
}
- [System.Security.SecurityCritical]
private ResolveEventHandler _ResourceResolve;
public event ResolveEventHandler ResourceResolve
{
- [System.Security.SecurityCritical]
add
{
lock (this)
@@ -263,7 +232,6 @@ namespace System {
}
}
- [System.Security.SecurityCritical]
remove
{
lock (this)
@@ -273,12 +241,10 @@ namespace System {
}
}
- [System.Security.SecurityCritical]
private ResolveEventHandler _AssemblyResolve;
public event ResolveEventHandler AssemblyResolve
{
- [System.Security.SecurityCritical]
add
{
lock (this)
@@ -287,7 +253,6 @@ namespace System {
}
}
- [System.Security.SecurityCritical]
remove
{
lock (this)
@@ -302,38 +267,13 @@ namespace System {
public event ResolveEventHandler ReflectionOnlyAssemblyResolve;
#endif // FEATURE_REFLECTION_ONLY
-#if FEATURE_REMOTING
- private Context _DefaultContext;
-#endif
-
-#if FEATURE_CLICKONCE
- private ActivationContext _activationContext;
- private ApplicationIdentity _applicationIdentity;
-#endif
private ApplicationTrust _applicationTrust;
-
-#if FEATURE_IMPERSONATION
- private IPrincipal _DefaultPrincipal;
-#endif // FEATURE_IMPERSONATION
-#if FEATURE_REMOTING
- private DomainSpecificRemotingData _RemotingData;
-#endif
private EventHandler _processExit;
- #if FEATURE_CORECLR
- [System.Security.SecurityCritical]
- #endif
private EventHandler _domainUnload;
- #if FEATURE_CORECLR
- [System.Security.SecurityCritical] // auto-generated
- #endif
private UnhandledExceptionEventHandler _unhandledException;
-#if FEATURE_APTCA
- private String[] _aptcaVisibleAssemblies;
-#endif
-
// The compat flags are set at domain creation time to indicate that the given breaking
// changes (named in the strings) should not be used in this domain. We only use the
// keys, the vhe values are ignored.
@@ -346,9 +286,6 @@ namespace System {
private IntPtr _pDomain; // this is an unmanaged pointer (AppDomain * m_pDomain)` used from the VM.
-#if FEATURE_CAS_POLICY
- private PrincipalPolicy _PrincipalPolicy; // this is an enum
-#endif
private bool _HasSetPolicy;
private bool _IsFastFullTrustDomain; // quick check to see if the AppDomain is fully trusted and homogenous
private bool _compatFlagsInitialized;
@@ -378,20 +315,18 @@ namespace System {
private static APPX_FLAGS Flags
{
- [SecuritySafeCritical]
get
{
if (s_flags == 0)
s_flags = nGetAppXFlags();
- Contract.Assert(s_flags != 0);
+ Debug.Assert(s_flags != 0);
return s_flags;
}
}
internal static bool ProfileAPICheck
{
- [SecuritySafeCritical]
get
{
return (Flags & APPX_FLAGS.APPX_FLAGS_API_CHECK) != 0;
@@ -400,7 +335,6 @@ namespace System {
internal static bool IsAppXNGen
{
- [SecuritySafeCritical]
get
{
return (Flags & APPX_FLAGS.APPX_FLAGS_APPX_NGEN) != 0;
@@ -409,56 +343,37 @@ namespace System {
#endif // FEATURE_APPX
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
- [SecurityCritical]
[SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool DisableFusionUpdatesFromADManager(AppDomainHandle domain);
#if FEATURE_APPX
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
- [SecurityCritical]
[SuppressUnmanagedCodeSecurity]
[return: MarshalAs(UnmanagedType.I4)]
private static extern APPX_FLAGS nGetAppXFlags();
#endif
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
- [SecurityCritical]
[SuppressUnmanagedCodeSecurity]
private static extern void GetAppDomainManagerType(AppDomainHandle domain,
StringHandleOnStack retAssembly,
StringHandleOnStack retType);
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
- [SecurityCritical]
[SuppressUnmanagedCodeSecurity]
private static extern void SetAppDomainManagerType(AppDomainHandle domain,
string assembly,
string type);
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern void nSetHostSecurityManagerFlags (HostSecurityManagerOptions flags);
- [SecurityCritical]
[SuppressUnmanagedCodeSecurity]
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
private static extern void SetSecurityHomogeneousFlag(AppDomainHandle domain,
[MarshalAs(UnmanagedType.Bool)] bool runtimeSuppliedHomogenousGrantSet);
-#if FEATURE_CAS_POLICY
- [SecurityCritical]
- [SuppressUnmanagedCodeSecurity]
- [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
- private static extern void SetLegacyCasPolicyEnabled(AppDomainHandle domain);
-
- [SecurityCritical]
- private void SetLegacyCasPolicyEnabled()
- {
- SetLegacyCasPolicyEnabled(GetNativeHandle());
- }
-#endif // FEATURE_CAS_POLICY
-
/// <summary>
/// Get a handle used to make a call into the VM pointing to this domain
/// </summary>
@@ -471,9 +386,6 @@ namespace System {
throw new InvalidOperationException(Environment.GetResourceString("Argument_InvalidHandle"));
}
-#if FEATURE_REMOTING
- BCLDebug.Assert(!RemotingServices.IsTransparentProxy(this), "QCalls should be made with the real AppDomain object rather than a transparent proxy");
-#endif // FEATURE_REMOTING
return new AppDomainHandle(_pDomain);
}
@@ -481,10 +393,9 @@ namespace System {
/// If this AppDomain is configured to have an AppDomain manager then create the instance of it.
/// This method is also called from the VM to create the domain manager in the default domain.
/// </summary>
- [SecuritySafeCritical]
private void CreateAppDomainManager()
{
- Contract.Assert(_domainManager == null, "_domainManager == null");
+ Debug.Assert(_domainManager == null, "_domainManager == null");
AppDomainSetup adSetup = FusionStore;
#if FEATURE_VERSIONING
@@ -566,17 +477,9 @@ namespace System {
if (notifyFusion)
SetupFusionStore(_FusionStore, FusionStoreOld); // Notify Fusion about the changes the user implementation of InitializeNewDomain may have made to the FusionStore object.
-
-#if FEATURE_APPDOMAINMANAGER_INITOPTIONS
- AppDomainManagerInitializationOptions flags = _domainManager.InitializationFlags;
- if ((flags & AppDomainManagerInitializationOptions.RegisterWithHost) == AppDomainManagerInitializationOptions.RegisterWithHost)
- {
- _domainManager.RegisterWithHost();
- }
-#endif // FEATURE_APPDOMAINMANAGER_INITOPTIONS
}
- InitializeCompatibilityFlags();
+ InitializeCompatibilityFlags();
}
/// <summary>
@@ -596,7 +499,7 @@ namespace System {
// for perf, we don't intialize the _compatFlags dictionary when we don't need to. However, we do need to make a
// note that we've run this method, because IsCompatibilityFlagsSet needs to return different values for the
// case where the compat flags have been setup.
- Contract.Assert(!_compatFlagsInitialized);
+ Debug.Assert(!_compatFlagsInitialized);
_compatFlagsInitialized = true;
CompatibilitySwitches.InitializeSwitches();
@@ -606,7 +509,6 @@ namespace System {
// either by a host in native, a host in managed using an AppDomainSetup, or by the
// TargetFrameworkAttribute on the executable (VS emits its target framework moniker using this
// attribute starting in version 4).
- [SecuritySafeCritical]
internal String GetTargetFrameworkName()
{
String targetFrameworkName = _FusionStore.TargetFrameworkName;
@@ -621,7 +523,7 @@ namespace System {
TargetFrameworkAttribute[] attrs = (TargetFrameworkAttribute[])assembly.GetCustomAttributes(typeof(TargetFrameworkAttribute));
if (attrs != null && attrs.Length > 0)
{
- Contract.Assert(attrs.Length == 1);
+ Debug.Assert(attrs.Length == 1);
targetFrameworkName = attrs[0].FrameworkName;
_FusionStore.TargetFrameworkName = targetFrameworkName;
}
@@ -635,7 +537,6 @@ namespace System {
/// <summary>
/// Returns the setting of the corresponding compatibility config switch (see CreateAppDomainManager for the impact).
/// </summary>
- [SecuritySafeCritical]
internal bool DisableFusionUpdatesFromADManager()
{
return DisableFusionUpdatesFromADManager(GetNativeHandle());
@@ -644,7 +545,6 @@ namespace System {
/// <summary>
/// Returns whether the current AppDomain follows the AppX rules.
/// </summary>
- [SecuritySafeCritical]
[Pure]
internal static bool IsAppXModel()
{
@@ -658,7 +558,6 @@ namespace System {
/// <summary>
/// Returns the setting of the AppXDevMode config switch.
/// </summary>
- [SecuritySafeCritical]
[Pure]
internal static bool IsAppXDesignMode()
{
@@ -672,7 +571,6 @@ namespace System {
/// <summary>
/// Checks (and throws on failure) if the domain supports Assembly.LoadFrom.
/// </summary>
- [SecuritySafeCritical]
[Pure]
internal static void CheckLoadFromSupported()
{
@@ -685,7 +583,6 @@ namespace System {
/// <summary>
/// Checks (and throws on failure) if the domain supports Assembly.LoadFile.
/// </summary>
- [SecuritySafeCritical]
[Pure]
internal static void CheckLoadFileSupported()
{
@@ -698,7 +595,6 @@ namespace System {
/// <summary>
/// Checks (and throws on failure) if the domain supports Assembly.ReflectionOnlyLoad.
/// </summary>
- [SecuritySafeCritical]
[Pure]
internal static void CheckReflectionOnlyLoadSupported()
{
@@ -711,7 +607,6 @@ namespace System {
/// <summary>
/// Checks (and throws on failure) if the domain supports Assembly.LoadWithPartialName.
/// </summary>
- [SecuritySafeCritical]
[Pure]
internal static void CheckLoadWithPartialNameSupported(StackCrawlMark stackMark)
{
@@ -731,7 +626,6 @@ namespace System {
/// <summary>
/// Checks (and throws on failure) if the domain supports DefinePInvokeMethod.
/// </summary>
- [SecuritySafeCritical]
[Pure]
internal static void CheckDefinePInvokeSupported()
{
@@ -745,7 +639,6 @@ namespace System {
/// <summary>
/// Checks (and throws on failure) if the domain supports Assembly.Load(byte[] ...).
/// </summary>
- [SecuritySafeCritical]
[Pure]
internal static void CheckLoadByteArraySupported()
{
@@ -758,7 +651,6 @@ namespace System {
/// <summary>
/// Checks (and throws on failure) if the domain supports AppDomain.CreateDomain.
/// </summary>
- [SecuritySafeCritical]
[Pure]
internal static void CheckCreateDomainSupported()
{
@@ -779,7 +671,6 @@ namespace System {
/// <summary>
/// Get the name of the assembly and type that act as the AppDomainManager for this domain
/// </summary>
- [SecuritySafeCritical]
internal void GetAppDomainManagerType(out string assembly, out string type)
{
// We can't just use our parameters because we need to ensure that the strings used for hte QCall
@@ -798,77 +689,16 @@ namespace System {
/// <summary>
/// Set the assembly and type which act as the AppDomainManager for this domain
/// </summary>
- [SecuritySafeCritical]
private void SetAppDomainManagerType(string assembly, string type)
{
- Contract.Assert(assembly != null, "assembly != null");
- Contract.Assert(type != null, "type != null");
+ Debug.Assert(assembly != null, "assembly != null");
+ Debug.Assert(type != null, "type != null");
SetAppDomainManagerType(GetNativeHandle(), assembly, type);
}
-#if FEATURE_APTCA
- internal String[] PartialTrustVisibleAssemblies
- {
- get { return _aptcaVisibleAssemblies; }
-
- [SecuritySafeCritical]
- set
- {
- _aptcaVisibleAssemblies = value;
-
- // Build up the canonical representaiton of this list to allow the VM to do optimizations in
- // common cases
- string canonicalConditionalAptcaList = null;
- if (value != null)
- {
- StringBuilder conditionalAptcaListBuilder = StringBuilderCache.Acquire();
- for (int i = 0; i < value.Length; ++i)
- {
- if (value[i] != null)
- {
- conditionalAptcaListBuilder.Append(value[i].ToUpperInvariant());
- if (i != value.Length - 1)
- {
- conditionalAptcaListBuilder.Append(';');
- }
- }
- }
-
- canonicalConditionalAptcaList = StringBuilderCache.GetStringAndRelease(conditionalAptcaListBuilder);
- }
-
- SetCanonicalConditionalAptcaList(canonicalConditionalAptcaList);
- }
- }
-
- [SecurityCritical]
- [SuppressUnmanagedCodeSecurity]
- [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
- private static extern void SetCanonicalConditionalAptcaList(AppDomainHandle appDomain, string canonicalList);
-
- [SecurityCritical]
- private void SetCanonicalConditionalAptcaList(string canonicalList)
- {
- SetCanonicalConditionalAptcaList(GetNativeHandle(), canonicalList);
- }
-#endif // FEATURE_APTCA
-
-#if FEATURE_CLICKONCE
- /// <summary>
- /// If the CLR is being started up to run a ClickOnce applicaiton, setup the default AppDomain
- /// with information about that application.
- /// </summary>
- private void SetupDefaultClickOnceDomain(string fullName, string[] manifestPaths, string[] activationData)
- {
- Contract.Requires(fullName != null, "fullName != null");
- FusionStore.ActivationArguments = new ActivationArguments(fullName, manifestPaths, activationData);
- }
-#endif // FEATURE_CLICKONCE
-
/// <summary>
/// Called for every AppDomain (including the default domain) to initialize the security of the AppDomain)
/// </summary>
- [SecurityCritical]
private void InitializeDomainSecurity(Evidence providedSecurityInfo,
Evidence creatorsSecurityInfo,
bool generateDefaultEvidence,
@@ -877,91 +707,23 @@ namespace System {
{
AppDomainSetup adSetup = FusionStore;
-#if FEATURE_CAS_POLICY
- // If the AppDomain is setup to use legacy CAS policy, then set that bit in the application
- // security descriptor.
- if (CompatibilitySwitches.IsNetFx40LegacySecurityPolicy)
- {
- SetLegacyCasPolicyEnabled();
- }
-#endif // FEATURE_CAS_POLICY
-
-#if FEATURE_CLICKONCE
-
- // Check if the domain manager set an ActivationContext (Debug-In-Zone for example)
- // or if this is an AppDomain with an ApplicationTrust.
- if (adSetup.ActivationArguments != null) {
- // Merge the new evidence with the manifest's evidence if applicable
- ActivationContext activationContext = null;
- ApplicationIdentity appIdentity = null;
- string[] activationData = null;
- CmsUtils.CreateActivationContext(adSetup.ActivationArguments.ApplicationFullName,
- adSetup.ActivationArguments.ApplicationManifestPaths,
- adSetup.ActivationArguments.UseFusionActivationContext,
- out appIdentity, out activationContext);
- activationData = adSetup.ActivationArguments.ActivationData;
- providedSecurityInfo = CmsUtils.MergeApplicationEvidence(providedSecurityInfo,
- appIdentity,
- activationContext,
- activationData,
- adSetup.ApplicationTrust);
- SetupApplicationHelper(providedSecurityInfo, creatorsSecurityInfo, appIdentity, activationContext, activationData);
- }
- else
-#endif // FEATURE_CLICKONCE
- {
- bool runtimeSuppliedHomogenousGrant = false;
- ApplicationTrust appTrust = adSetup.ApplicationTrust;
-
-#if FEATURE_CAS_POLICY
- // In non-legacy CAS mode, domains should be homogenous. If the host has not specified a sandbox
- // of their own, we'll set it up to be fully trusted. We must read the IsLegacyCasPolicy
- // enabled property here rathern than just reading the switch from above because the entire
- // process may also be opted into legacy CAS policy mode.
- if (appTrust == null && !IsLegacyCasPolicyEnabled) {
- _IsFastFullTrustDomain = true;
- runtimeSuppliedHomogenousGrant = true;
- }
-#endif // FEATURE_CAS_POLICY
+ bool runtimeSuppliedHomogenousGrant = false;
+ ApplicationTrust appTrust = adSetup.ApplicationTrust;
- if (appTrust != null) {
- SetupDomainSecurityForHomogeneousDomain(appTrust, runtimeSuppliedHomogenousGrant);
- }
- else if (_IsFastFullTrustDomain) {
- SetSecurityHomogeneousFlag(GetNativeHandle(), runtimeSuppliedHomogenousGrant);
- }
+ if (appTrust != null) {
+ SetupDomainSecurityForHomogeneousDomain(appTrust, runtimeSuppliedHomogenousGrant);
+ }
+ else if (_IsFastFullTrustDomain) {
+ SetSecurityHomogeneousFlag(GetNativeHandle(), runtimeSuppliedHomogenousGrant);
}
// Get the evidence supplied for the domain. If no evidence was supplied, it means that we want
// to use the default evidence creation strategy for this domain
Evidence newAppDomainEvidence = (providedSecurityInfo != null ? providedSecurityInfo : creatorsSecurityInfo);
if (newAppDomainEvidence == null && generateDefaultEvidence) {
-#if FEATURE_CAS_POLICY
- newAppDomainEvidence = new Evidence(new AppDomainEvidenceFactory(this));
-#else // !FEATURE_CAS_POLICY
newAppDomainEvidence = new Evidence();
-#endif // FEATURE_CAS_POLICY
}
-#if FEATURE_CAS_POLICY
- if (_domainManager != null) {
- // Give the host a chance to alter the AppDomain evidence
- HostSecurityManager securityManager = _domainManager.HostSecurityManager;
- if (securityManager != null) {
- nSetHostSecurityManagerFlags (securityManager.Flags);
- if ((securityManager.Flags & HostSecurityManagerOptions.HostAppDomainEvidence) == HostSecurityManagerOptions.HostAppDomainEvidence) {
- newAppDomainEvidence = securityManager.ProvideAppDomainEvidence(newAppDomainEvidence);
- // If this is a disconnected evidence collection, then attach it to the AppDomain,
- // allowing the host security manager to get callbacks for delay generated evidence
- if (newAppDomainEvidence != null && newAppDomainEvidence.Target == null) {
- newAppDomainEvidence.Target = new AppDomainEvidenceFactory(this);
- }
- }
- }
- }
-
-#endif // FEATURE_CAS_POLICY
-
// Set the evidence on the managed side
_SecurityIdentity = newAppDomainEvidence;
@@ -971,106 +733,8 @@ namespace System {
SetupDomainSecurity(newAppDomainEvidence,
parentSecurityDescriptor,
publishAppDomain);
-
-#if FEATURE_CAS_POLICY
- // The AppDomain is now resolved. Go ahead and set the PolicyLevel
- // from the HostSecurityManager if specified.
- if (_domainManager != null)
- RunDomainManagerPostInitialization(_domainManager);
-#endif // FEATURE_CAS_POLICY
- }
-
-#if FEATURE_CAS_POLICY
- [System.Security.SecurityCritical] // auto-generated
- private void RunDomainManagerPostInitialization (AppDomainManager domainManager)
- {
- // force creation of the HostExecutionContextManager for the current AppDomain
- HostExecutionContextManager contextManager = domainManager.HostExecutionContextManager;
-
- if (IsLegacyCasPolicyEnabled)
- {
-#pragma warning disable 618
- HostSecurityManager securityManager = domainManager.HostSecurityManager;
- if (securityManager != null)
- {
- if ((securityManager.Flags & HostSecurityManagerOptions.HostPolicyLevel) == HostSecurityManagerOptions.HostPolicyLevel)
- {
- // set AppDomain policy if specified
- PolicyLevel level = securityManager.DomainPolicy;
- if (level != null)
- SetAppDomainPolicy(level);
- }
- }
-#pragma warning restore 618
- }
- }
-#endif
-
-
-#if FEATURE_CLICKONCE
-
- [System.Security.SecurityCritical] // auto-generated
- private void SetupApplicationHelper (Evidence providedSecurityInfo, Evidence creatorsSecurityInfo, ApplicationIdentity appIdentity, ActivationContext activationContext, string[] activationData) {
- Contract.Requires(providedSecurityInfo != null);
- HostSecurityManager securityManager = AppDomain.CurrentDomain.HostSecurityManager;
- ApplicationTrust appTrust = securityManager.DetermineApplicationTrust(providedSecurityInfo, creatorsSecurityInfo, new TrustManagerContext());
- if (appTrust == null || !appTrust.IsApplicationTrustedToRun)
- throw new PolicyException(Environment.GetResourceString("Policy_NoExecutionPermission"),
- System.__HResults.CORSEC_E_NO_EXEC_PERM,
- null);
-
- // The application is trusted to run. Set up the AppDomain according to the manifests.
- if (activationContext != null)
- SetupDomainForApplication(activationContext, activationData);
- SetupDomainSecurityForApplication(appIdentity, appTrust);
- }
-
- [System.Security.SecurityCritical] // auto-generated
- private void SetupDomainForApplication(ActivationContext activationContext, string[] activationData) {
- Contract.Requires(activationContext != null);
- if (IsDefaultAppDomain()) {
- // make the ActivationArguments available off the AppDomain object.
- AppDomainSetup adSetup = this.FusionStore;
- adSetup.ActivationArguments = new ActivationArguments(activationContext, activationData);
-
- // set the application base to point at where the application resides
- string entryPointPath = CmsUtils.GetEntryPointFullPath(activationContext);
- if (!String.IsNullOrEmpty(entryPointPath))
- adSetup.SetupDefaults(entryPointPath);
- else
- adSetup.ApplicationBase = activationContext.ApplicationDirectory;
-
- // update fusion context
- SetupFusionStore(adSetup, null);
- }
-
- // perform app data directory migration.
- activationContext.PrepareForExecution();
- activationContext.SetApplicationState(ActivationContext.ApplicationState.Starting);
- // set current app data directory.
- activationContext.SetApplicationState(ActivationContext.ApplicationState.Running);
-
- // make data directory path available.
- IPermission permission = null;
- string dataDirectory = activationContext.DataDirectory;
- if (dataDirectory != null && dataDirectory.Length > 0)
- permission = new FileIOPermission(FileIOPermissionAccess.PathDiscovery, dataDirectory);
- this.SetData("DataDirectory", dataDirectory, permission);
-
- _activationContext = activationContext;
- }
-
- [System.Security.SecurityCritical] // auto-generated
- private void SetupDomainSecurityForApplication(ApplicationIdentity appIdentity,
- ApplicationTrust appTrust)
- {
- // Set the Application trust on the managed side.
- _applicationIdentity = appIdentity;
- SetupDomainSecurityForHomogeneousDomain(appTrust, false);
}
-#endif // FEATURE_CLICKONCE
- [System.Security.SecurityCritical] // auto-generated
private void SetupDomainSecurityForHomogeneousDomain(ApplicationTrust appTrust,
bool runtimeSuppliedHomogenousGrantSet)
{
@@ -1084,9 +748,6 @@ namespace System {
if (runtimeSuppliedHomogenousGrantSet)
{
BCLDebug.Assert(_FusionStore.ApplicationTrust != null, "Expected to find runtime supplied ApplicationTrust");
-#if FEATURE_CAS_POLICY
- _FusionStore.ApplicationTrust = null;
-#endif // FEATURE_CAS_POLICY
}
_applicationTrust = appTrust;
@@ -1096,38 +757,13 @@ namespace System {
runtimeSuppliedHomogenousGrantSet);
}
- // This method is called from CorHost2::ExecuteApplication to activate a ClickOnce application in the default AppDomain.
-#if FEATURE_CLICKONCE
- [System.Security.SecuritySafeCritical] // auto-generated
- private int ActivateApplication () {
- ObjectHandle oh = Activator.CreateInstance(AppDomain.CurrentDomain.ActivationContext);
- return (int) oh.Unwrap();
- }
-#endif //FEATURE_CLICKONCE
-
public AppDomainManager DomainManager {
- [System.Security.SecurityCritical] // auto-generated_required
get {
return _domainManager;
}
}
-#if FEATURE_CAS_POLICY
- internal HostSecurityManager HostSecurityManager {
- [System.Security.SecurityCritical] // auto-generated
- get {
- HostSecurityManager securityManager = null;
- AppDomainManager domainManager = AppDomain.CurrentDomain.DomainManager;
- if (domainManager != null)
- securityManager = domainManager.HostSecurityManager;
-
- if (securityManager == null)
- securityManager = new HostSecurityManager();
- return securityManager;
- }
- }
-#endif // FEATURE_CAS_POLICY
-#if FEATURE_REFLECTION_ONLY_LOAD
+#if FEATURE_REFLECTION_ONLY_LOAD
private Assembly ResolveAssemblyForIntrospection(Object sender, ResolveEventArgs args)
{
Contract.Requires(args != null);
@@ -1143,7 +779,6 @@ namespace System {
_packageGraphFilePaths = packageGraphFilePaths;
}
- [System.Security.SecurityCritical]
public void ResolveNamespace(
object sender,
System.Runtime.InteropServices.WindowsRuntime.NamespaceResolveEventArgs args)
@@ -1162,7 +797,6 @@ namespace System {
}
// Called only by native function code:ValidateWorker
- [System.Security.SecuritySafeCritical]
private void EnableResolveAssembliesForIntrospection(string verifiedFileDirectory)
{
CurrentDomain.ReflectionOnlyAssemblyResolve += new ResolveEventHandler(ResolveAssemblyForIntrospection);
@@ -1183,7 +817,6 @@ namespace System {
* to have a strong name and a hash will be computed when the assembly
* is saved.
**********************************************/
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
public AssemblyBuilder DefineDynamicAssembly(
AssemblyName name,
@@ -1196,7 +829,6 @@ namespace System {
null, null, null, null, ref stackMark, null, SecurityContextSource.CurrentAssembly);
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
public AssemblyBuilder DefineDynamicAssembly(
AssemblyName name,
@@ -1214,7 +846,6 @@ namespace System {
}
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Due to the stack crawl mark
- [SecuritySafeCritical]
public AssemblyBuilder DefineDynamicAssembly(AssemblyName name,
AssemblyBuilderAccess access,
IEnumerable<CustomAttributeBuilder> assemblyAttributes,
@@ -1231,7 +862,6 @@ namespace System {
securityContextSource);
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
public AssemblyBuilder DefineDynamicAssembly(
AssemblyName name,
@@ -1248,7 +878,6 @@ namespace System {
SecurityContextSource.CurrentAssembly);
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
[Obsolete("Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
public AssemblyBuilder DefineDynamicAssembly(
@@ -1266,7 +895,6 @@ namespace System {
SecurityContextSource.CurrentAssembly);
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
[Obsolete("Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
public AssemblyBuilder DefineDynamicAssembly(
@@ -1288,7 +916,6 @@ namespace System {
SecurityContextSource.CurrentAssembly);
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
[Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of DefineDynamicAssembly which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkId=155570 for more information.")]
public AssemblyBuilder DefineDynamicAssembly(
@@ -1304,7 +931,6 @@ namespace System {
null, null, null, ref stackMark, null, SecurityContextSource.CurrentAssembly);
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
[Obsolete("Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
public AssemblyBuilder DefineDynamicAssembly(
@@ -1327,7 +953,6 @@ namespace System {
SecurityContextSource.CurrentAssembly);
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
[Obsolete("Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
public AssemblyBuilder DefineDynamicAssembly(
@@ -1351,7 +976,6 @@ namespace System {
SecurityContextSource.CurrentAssembly);
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
[Obsolete("Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. Please see http://go.microsoft.com/fwlink/?LinkId=155570 for more information.")]
public AssemblyBuilder DefineDynamicAssembly(
@@ -1376,8 +1000,6 @@ namespace System {
SecurityContextSource.CurrentAssembly);
}
-
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
[Obsolete("Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
public AssemblyBuilder DefineDynamicAssembly(
@@ -1405,7 +1027,6 @@ namespace System {
SecurityContextSource.CurrentAssembly);
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
[Obsolete("Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
public AssemblyBuilder DefineDynamicAssembly(
@@ -1434,7 +1055,6 @@ namespace System {
SecurityContextSource.CurrentAssembly);
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
public AssemblyBuilder DefineDynamicAssembly(
AssemblyName name,
@@ -1458,7 +1078,6 @@ namespace System {
SecurityContextSource.CurrentAssembly);
}
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
private AssemblyBuilder InternalDefineDynamicAssembly(
AssemblyName name,
@@ -1484,7 +1103,6 @@ namespace System {
securityContextSource);
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern String nApplyPolicy(AssemblyName an);
@@ -1506,7 +1124,6 @@ namespace System {
return nApplyPolicy(asmName);
}
-
public ObjectHandle CreateInstance(String assemblyName,
String typeName)
@@ -1516,14 +1133,13 @@ namespace System {
throw new NullReferenceException();
if (assemblyName == null)
- throw new ArgumentNullException("assemblyName");
+ throw new ArgumentNullException(nameof(assemblyName));
Contract.EndContractBlock();
return Activator.CreateInstance(assemblyName,
typeName);
}
- [System.Security.SecurityCritical] // auto-generated
internal ObjectHandle InternalCreateInstanceWithNoSecurity (string assemblyName, string typeName) {
PermissionSet.s_fullTrust.Assert();
return CreateInstance(assemblyName, typeName);
@@ -1542,7 +1158,6 @@ namespace System {
typeName);
}
- [System.Security.SecurityCritical] // auto-generated
internal ObjectHandle InternalCreateInstanceFromWithNoSecurity (string assemblyName, string typeName) {
PermissionSet.s_fullTrust.Assert();
return CreateInstanceFrom(assemblyName, typeName);
@@ -1591,7 +1206,7 @@ namespace System {
throw new NullReferenceException();
if (assemblyName == null)
- throw new ArgumentNullException("assemblyName");
+ throw new ArgumentNullException(nameof(assemblyName));
Contract.EndContractBlock();
return Activator.CreateInstance(assemblyName,
@@ -1630,16 +1245,9 @@ namespace System {
throw new NullReferenceException();
if (assemblyName == null)
- throw new ArgumentNullException("assemblyName");
+ throw new ArgumentNullException(nameof(assemblyName));
Contract.EndContractBlock();
-#if FEATURE_CAS_POLICY
- if (securityAttributes != null && !IsLegacyCasPolicyEnabled)
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
- }
-#endif // FEATURE_CAS_POLICY
-
#pragma warning disable 618
return Activator.CreateInstance(assemblyName,
typeName,
@@ -1667,7 +1275,7 @@ namespace System {
throw new NullReferenceException();
if (assemblyName == null)
- throw new ArgumentNullException("assemblyName");
+ throw new ArgumentNullException(nameof(assemblyName));
Contract.EndContractBlock();
return Activator.CreateInstance(assemblyName,
@@ -1680,7 +1288,6 @@ namespace System {
activationAttributes);
}
- [System.Security.SecurityCritical] // auto-generated
internal ObjectHandle InternalCreateInstanceWithNoSecurity (string assemblyName,
string typeName,
bool ignoreCase,
@@ -1691,10 +1298,6 @@ namespace System {
Object[] activationAttributes,
Evidence securityAttributes)
{
-#if FEATURE_CAS_POLICY
- Contract.Assert(IsLegacyCasPolicyEnabled || securityAttributes == null);
-#endif // FEATURE_CAS_POLICY
-
PermissionSet.s_fullTrust.Assert();
#pragma warning disable 618
return CreateInstance(assemblyName, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes, securityAttributes);
@@ -1718,13 +1321,6 @@ namespace System {
throw new NullReferenceException();
Contract.EndContractBlock();
-#if FEATURE_CAS_POLICY
- if (securityAttributes != null && !IsLegacyCasPolicyEnabled)
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
- }
-#endif // FEATURE_CAS_POLICY
-
return Activator.CreateInstanceFrom(assemblyFile,
typeName,
ignoreCase,
@@ -1760,7 +1356,6 @@ namespace System {
activationAttributes);
}
- [System.Security.SecurityCritical] // auto-generated
internal ObjectHandle InternalCreateInstanceFromWithNoSecurity (string assemblyName,
string typeName,
bool ignoreCase,
@@ -1771,17 +1366,12 @@ namespace System {
Object[] activationAttributes,
Evidence securityAttributes)
{
-#if FEATURE_CAS_POLICY
- Contract.Assert(IsLegacyCasPolicyEnabled || securityAttributes == null);
-#endif // FEATURE_CAS_POLICY
-
PermissionSet.s_fullTrust.Assert();
#pragma warning disable 618
return CreateInstanceFrom(assemblyName, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes, securityAttributes);
#pragma warning restore 618
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
public Assembly Load(AssemblyName assemblyRef)
{
@@ -1789,7 +1379,6 @@ namespace System {
return RuntimeAssembly.InternalLoadAssemblyName(assemblyRef, null, null, ref stackMark, true /*thrownOnFileNotFound*/, false, false);
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
public Assembly Load(String assemblyString)
{
@@ -1797,7 +1386,6 @@ namespace System {
return RuntimeAssembly.InternalLoad(assemblyString, null, ref stackMark, false);
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
public Assembly Load(byte[] rawAssembly)
{
@@ -1811,7 +1399,6 @@ namespace System {
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
public Assembly Load(byte[] rawAssembly,
byte[] rawSymbolStore)
@@ -1825,23 +1412,12 @@ namespace System {
SecurityContextSource.CurrentAssembly);
}
- [System.Security.SecuritySafeCritical] // auto-generated
-#pragma warning disable 618
- [SecurityPermissionAttribute(SecurityAction.Demand, ControlEvidence = true)]
-#pragma warning restore 618
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
[Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of Load which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkId=155570 for more information.")]
public Assembly Load(byte[] rawAssembly,
byte[] rawSymbolStore,
Evidence securityEvidence)
{
-#if FEATURE_CAS_POLICY
- if (securityEvidence != null && !IsLegacyCasPolicyEnabled)
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
- }
-#endif // FEATURE_CAS_POLICY
-
StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
return RuntimeAssembly.nLoadImage(rawAssembly,
rawSymbolStore,
@@ -1851,7 +1427,6 @@ namespace System {
SecurityContextSource.CurrentAssembly);
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
[Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of Load which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
public Assembly Load(AssemblyName assemblyRef,
@@ -1861,7 +1436,6 @@ namespace System {
return RuntimeAssembly.InternalLoadAssemblyName(assemblyRef, assemblySecurity, null, ref stackMark, true /*thrownOnFileNotFound*/, false, false);
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
[Obsolete("Methods which use evidence to sandbox are obsolete and will be removed in a future release of the .NET Framework. Please use an overload of Load which does not take an Evidence parameter. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
public Assembly Load(String assemblyString,
@@ -1888,15 +1462,8 @@ namespace System {
Evidence assemblySecurity,
String[] args)
{
-#if FEATURE_CAS_POLICY
- if (assemblySecurity != null && !IsLegacyCasPolicyEnabled)
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
- }
-#endif // FEATURE_CAS_POLICY
-
RuntimeAssembly assembly = (RuntimeAssembly)Assembly.LoadFrom(assemblyFile, assemblySecurity);
-
+
if (args == null)
args = new String[0];
@@ -1920,13 +1487,6 @@ namespace System {
byte[] hashValue,
AssemblyHashAlgorithm hashAlgorithm)
{
-#if FEATURE_CAS_POLICY
- if (assemblySecurity != null && !IsLegacyCasPolicyEnabled)
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
- }
-#endif // FEATURE_CAS_POLICY
-
RuntimeAssembly assembly = (RuntimeAssembly)Assembly.LoadFrom(assemblyFile,
assemblySecurity,
hashValue,
@@ -1951,9 +1511,6 @@ namespace System {
return nExecuteAssembly(assembly, args);
}
- #if FEATURE_CORECLR
- [System.Security.SecurityCritical] // auto-generated
- #endif
public int ExecuteAssemblyByName(String assemblyName)
{
return ExecuteAssemblyByName(assemblyName, (string[])null);
@@ -1973,15 +1530,8 @@ namespace System {
Evidence assemblySecurity,
params String[] args)
{
-#if FEATURE_CAS_POLICY
- if (assemblySecurity != null && !IsLegacyCasPolicyEnabled)
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
- }
-#endif // FEATURE_CAS_POLICY
-
RuntimeAssembly assembly = (RuntimeAssembly)Assembly.Load(assemblyName, assemblySecurity);
-
+
if (args == null)
args = new String[0];
@@ -2003,15 +1553,8 @@ namespace System {
Evidence assemblySecurity,
params String[] args)
{
-#if FEATURE_CAS_POLICY
- if (assemblySecurity != null && !IsLegacyCasPolicyEnabled)
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
- }
-#endif // FEATURE_CAS_POLICY
-
RuntimeAssembly assembly = (RuntimeAssembly)Assembly.Load(assemblyName, assemblySecurity);
-
+
if (args == null)
args = new String[0];
@@ -2036,114 +1579,28 @@ namespace System {
}
}
-#if FEATURE_CAS_POLICY
- public Evidence Evidence
- {
- [System.Security.SecuritySafeCritical] // auto-generated
- [SecurityPermissionAttribute(SecurityAction.Demand, ControlEvidence = true)]
- get {
- return EvidenceNoDemand;
- }
- }
-
- internal Evidence EvidenceNoDemand {
- [SecurityCritical]
- get {
- if (_SecurityIdentity == null) {
- if (!IsDefaultAppDomain() && nIsDefaultAppDomainForEvidence()) {
-#if !FEATURE_CORECLR
- //
- // V1.x compatibility: If this is an AppDomain created
- // by the default appdomain without an explicit evidence
- // then reuse the evidence of the default AppDomain.
- //
- return GetDefaultDomain().Evidence;
-#else
- Contract.Assert(false,"This code should not be called for core CLR");
-
- // This operation is not allowed
- throw new InvalidOperationException();
-#endif
- }
- else {
- // We can't cache this value, since the VM needs to differentiate between AppDomains
- // which have no user supplied evidence and those which do and it uses the presence
- // of Evidence on the domain to make that switch.
- return new Evidence(new AppDomainEvidenceFactory(this));
- }
- }
- else {
- return _SecurityIdentity.Clone();
- }
- }
- }
-
- internal Evidence InternalEvidence
- {
- get {
- return _SecurityIdentity;
- }
- }
-
- internal EvidenceBase GetHostEvidence(Type type)
- {
- if (_SecurityIdentity != null)
- {
- return _SecurityIdentity.GetHostEvidence(type);
- }
- else
- {
- return new Evidence(new AppDomainEvidenceFactory(this)).GetHostEvidence(type);
- }
- }
-#endif // FEATURE_CAS_POLICY
-
public String FriendlyName
{
- [System.Security.SecuritySafeCritical] // auto-generated
get { return nGetFriendlyName(); }
}
public String BaseDirectory
{
-#if FEATURE_CORECLR
- [System.Security.SecurityCritical]
-#endif
get {
return FusionStore.ApplicationBase;
}
}
-#if FEATURE_FUSION
- public String RelativeSearchPath
- {
- get { return FusionStore.PrivateBinPath; }
- }
-
- public bool ShadowCopyFiles
- {
- get {
- String s = FusionStore.ShadowCopyFiles;
- if((s != null) &&
- (String.Compare(s, "true", StringComparison.OrdinalIgnoreCase) == 0))
- return true;
- else
- return false;
- }
- }
-#endif
-
- [System.Security.SecuritySafeCritical] // auto-generated
public override String ToString()
{
StringBuilder sb = StringBuilderCache.Acquire();
-
+
String fn = nGetFriendlyName();
if (fn != null) {
sb.Append(Environment.GetResourceString("Loader_Name") + fn);
sb.Append(Environment.NewLine);
}
-
+
if(_Policies == null || _Policies.Length == 0)
sb.Append(Environment.GetResourceString("Loader_NoContextPolicies")
+ Environment.NewLine);
@@ -2164,222 +1621,67 @@ namespace System {
return nGetAssemblies(false /* forIntrospection */);
}
-
public Assembly[] ReflectionOnlyGetAssemblies()
{
return nGetAssemblies(true /* forIntrospection */);
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern Assembly[] nGetAssemblies(bool forIntrospection);
// this is true when we've removed the handles etc so really can't do anything
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal extern bool IsUnloadingForcedFinalize();
- // this is true when we've just started going through the finalizers and are forcing objects to finalize
- // so must be aware that certain infrastructure may have gone away
- [System.Security.SecuritySafeCritical] // auto-generated
+ // this is true when we've just started going through the finalizers and are forcing objects to finalize
+ // so must be aware that certain infrastructure may have gone away
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern bool IsFinalizingForUnload();
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern void PublishAnonymouslyHostedDynamicMethodsAssembly(RuntimeAssembly assemblyHandle);
-#if FEATURE_FUSION
- // Appends the following string to the private path. Valid paths
- // are of the form "bin;util/i386" etc.
- [System.Security.SecurityCritical] // auto-generated_required
- [Obsolete("AppDomain.AppendPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. http://go.microsoft.com/fwlink/?linkid=14202")]
- public void AppendPrivatePath(String path)
- {
- if(path == null || path.Length == 0)
- return;
-
- String current = FusionStore.Value[(int) AppDomainSetup.LoaderInformation.PrivateBinPathValue];
- StringBuilder appendPath = StringBuilderCache.Acquire();
-
- if(current != null && current.Length > 0) {
- // See if the last character is a separator
- appendPath.Append(current);
- if((current[current.Length-1] != Path.PathSeparator) &&
- (path[0] != Path.PathSeparator))
- appendPath.Append(Path.PathSeparator);
- }
- appendPath.Append(path);
-
- String result = StringBuilderCache.GetStringAndRelease(appendPath);
- InternalSetPrivateBinPath(result);
- }
-
-
- [System.Security.SecurityCritical] // auto-generated_required
- [Obsolete("AppDomain.ClearPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead. http://go.microsoft.com/fwlink/?linkid=14202")]
- public void ClearPrivatePath()
- {
- InternalSetPrivateBinPath(String.Empty);
- }
-
- [System.Security.SecurityCritical] // auto-generated_required
- [Obsolete("AppDomain.ClearShadowCopyPath has been deprecated. Please investigate the use of AppDomainSetup.ShadowCopyDirectories instead. http://go.microsoft.com/fwlink/?linkid=14202")]
- public void ClearShadowCopyPath()
- {
- InternalSetShadowCopyPath(String.Empty);
- }
-
- [System.Security.SecurityCritical] // auto-generated_required
- [Obsolete("AppDomain.SetCachePath has been deprecated. Please investigate the use of AppDomainSetup.CachePath instead. http://go.microsoft.com/fwlink/?linkid=14202")]
- public void SetCachePath(String path)
- {
- InternalSetCachePath(path);
- }
-#endif // FEATURE_FUSION
-
- [System.Security.SecurityCritical] // auto-generated_required
public void SetData (string name, object data) {
-#if FEATURE_CORECLR
- if (!name.Equals("LOCATION_URI"))
- {
- // Only LOCATION_URI can be set using AppDomain.SetData
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_SetData_OnlyLocationURI", name));
- }
-#endif // FEATURE_CORECLR
SetDataHelper(name, data, null);
}
- [System.Security.SecurityCritical] // auto-generated_required
- public void SetData (string name, object data, IPermission permission) {
-#if FEATURE_CORECLR
+ public void SetData (string name, object data, IPermission permission)
+ {
if (!name.Equals("LOCATION_URI"))
{
// Only LOCATION_URI can be set using AppDomain.SetData
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_SetData_OnlyLocationURI", name));
}
-#endif // FEATURE_CORECLR
+
SetDataHelper(name, data, permission);
}
- [System.Security.SecurityCritical] // auto-generated
- private void SetDataHelper (string name, object data, IPermission permission) {
+ private void SetDataHelper (string name, object data, IPermission permission)
+ {
if (name == null)
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
Contract.EndContractBlock();
- //
- // Synopsis:
- // IgnoreSystemPolicy is provided as a legacy flag to allow callers to
- // skip enterprise, machine and user policy levels. When this flag is set,
- // any demands triggered in this AppDomain will be evaluated against the
- // AppDomain CAS policy level that is set on the AppDomain.
- // Security Requirements:
- // The caller needs to be fully trusted in order to be able to set
- // this legacy mode.
- // Remarks:
- // There needs to be an AppDomain policy level set before this compat
- // switch can be set on the AppDomain.
- //
-#if FEATURE_FUSION
- if (name.Equals(TargetFrameworkNameAppCompatSetting)) {
- _FusionStore.TargetFrameworkName = (String) data;
- return;
- }
-#if FEATURE_CAS_POLICY
- if (name.Equals("IgnoreSystemPolicy")) {
- lock (this) {
- if (!_HasSetPolicy)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_SetData"));
- }
- new PermissionSet(PermissionState.Unrestricted).Demand();
- }
-#endif
- int key = AppDomainSetup.Locate(name);
-
- if(key == -1) {
- lock (((ICollection)LocalStore).SyncRoot) {
- LocalStore[name] = new object[] {data, permission};
- }
- }
- else {
- if (permission != null)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_SetData"));
- // Be sure to call these properties, not Value, since
- // these do more than call Value.
- switch(key) {
- case (int) AppDomainSetup.LoaderInformation.DynamicBaseValue:
- FusionStore.DynamicBase = (string) data;
- break;
- case (int) AppDomainSetup.LoaderInformation.DevPathValue:
- FusionStore.DeveloperPath = (string) data;
- break;
- case (int) AppDomainSetup.LoaderInformation.ShadowCopyDirectoriesValue:
- FusionStore.ShadowCopyDirectories = (string) data;
- break;
- case (int) AppDomainSetup.LoaderInformation.DisallowPublisherPolicyValue:
- if(data != null)
- FusionStore.DisallowPublisherPolicy = true;
- else
- FusionStore.DisallowPublisherPolicy = false;
- break;
- case (int) AppDomainSetup.LoaderInformation.DisallowCodeDownloadValue:
- if (data != null)
- FusionStore.DisallowCodeDownload = true;
- else
- FusionStore.DisallowCodeDownload = false;
- break;
- case (int) AppDomainSetup.LoaderInformation.DisallowBindingRedirectsValue:
- if(data != null)
- FusionStore.DisallowBindingRedirects = true;
- else
- FusionStore.DisallowBindingRedirects = false;
- break;
- case (int) AppDomainSetup.LoaderInformation.DisallowAppBaseProbingValue:
- if(data != null)
- FusionStore.DisallowApplicationBaseProbing = true;
- else
- FusionStore.DisallowApplicationBaseProbing = false;
- break;
- case (int) AppDomainSetup.LoaderInformation.ConfigurationBytesValue:
- FusionStore.SetConfigurationBytes((byte[]) data);
- break;
- default:
- FusionStore.Value[key] = (string) data;
- break;
- }
- }
-#else // FEATURE_FUSION
-#if FEATURE_CORECLR
// SetData should only be used to set values that don't already exist.
+ object[] currentVal;
+ lock (((ICollection)LocalStore).SyncRoot) {
+ LocalStore.TryGetValue(name, out currentVal);
+ }
+ if (currentVal != null && currentVal[0] != null)
{
- object[] currentVal;
- lock (((ICollection)LocalStore).SyncRoot) {
- LocalStore.TryGetValue(name, out currentVal);
- }
- if (currentVal != null && currentVal[0] != null)
- {
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_SetData_OnlyOnce"));
- }
+ throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_SetData_OnlyOnce"));
}
-#endif // FEATURE_CORECLR
lock (((ICollection)LocalStore).SyncRoot) {
LocalStore[name] = new object[] {data, permission};
}
-#endif // FEATURE_FUSION
}
[Pure]
- #if FEATURE_CORECLR
- [System.Security.SecurityCritical] // auto-generated
- #else
- [System.Security.SecuritySafeCritical]
- #endif
public Object GetData(string name)
{
if(name == null)
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
Contract.EndContractBlock();
int key = AppDomainSetup.Locate(name);
@@ -2412,43 +1714,11 @@ namespace System {
return FusionStore.ApplicationBase;
case (int) AppDomainSetup.LoaderInformation.ApplicationNameValue:
return FusionStore.ApplicationName;
-#if FEATURE_FUSION
- case (int) AppDomainSetup.LoaderInformation.ConfigurationFileValue:
- return FusionStore.ConfigurationFile;
- case (int) AppDomainSetup.LoaderInformation.DynamicBaseValue:
- return FusionStore.DynamicBase;
- case (int) AppDomainSetup.LoaderInformation.DevPathValue:
- return FusionStore.DeveloperPath;
- case (int) AppDomainSetup.LoaderInformation.PrivateBinPathValue:
- return FusionStore.PrivateBinPath;
- case (int) AppDomainSetup.LoaderInformation.PrivateBinPathProbeValue:
- return FusionStore.PrivateBinPathProbe;
- case (int) AppDomainSetup.LoaderInformation.ShadowCopyDirectoriesValue:
- return FusionStore.ShadowCopyDirectories;
- case (int) AppDomainSetup.LoaderInformation.ShadowCopyFilesValue:
- return FusionStore.ShadowCopyFiles;
- case (int) AppDomainSetup.LoaderInformation.CachePathValue:
- return FusionStore.CachePath;
- case (int) AppDomainSetup.LoaderInformation.LicenseFileValue:
- return FusionStore.LicenseFile;
- case (int) AppDomainSetup.LoaderInformation.DisallowPublisherPolicyValue:
- return FusionStore.DisallowPublisherPolicy;
- case (int) AppDomainSetup.LoaderInformation.DisallowCodeDownloadValue:
- return FusionStore.DisallowCodeDownload;
- case (int) AppDomainSetup.LoaderInformation.DisallowBindingRedirectsValue:
- return FusionStore.DisallowBindingRedirects;
- case (int) AppDomainSetup.LoaderInformation.DisallowAppBaseProbingValue:
- return FusionStore.DisallowApplicationBaseProbing;
- case (int) AppDomainSetup.LoaderInformation.ConfigurationBytesValue:
- return FusionStore.GetConfigurationBytes();
-#endif //FEATURE_FUSION
-
default:
- Contract.Assert(false, "Need to handle new LoaderInformation value in AppDomain.GetData()");
+ Debug.Assert(false, "Need to handle new LoaderInformation value in AppDomain.GetData()");
return null;
}
}
-
}
// The compat flags are set at domain creation time to indicate that the given breaking
@@ -2477,84 +1747,8 @@ namespace System {
[DllImport(Microsoft.Win32.Win32Native.KERNEL32)]
public static extern int GetCurrentThreadId();
-#if FEATURE_REMOTING
- [System.Security.SecuritySafeCritical] // auto-generated
- [SecurityPermissionAttribute( SecurityAction.Demand, ControlAppDomain = true ),
- ReliabilityContract(Consistency.MayCorruptAppDomain, Cer.MayFail)]
- public static void Unload(AppDomain domain)
+ internal ApplicationTrust ApplicationTrust
{
- if (domain == null)
- throw new ArgumentNullException("domain");
- Contract.EndContractBlock();
-
- try {
- Int32 domainID = AppDomain.GetIdForUnload(domain);
- if (domainID==0)
- throw new CannotUnloadAppDomainException();
- AppDomain.nUnload(domainID);
- }
- catch(Exception e) {
- throw e; // throw it again to reset stack trace
- }
- }
-#endif
-
- // Explicitly set policy for a domain (providing policy hasn't been set
- // previously). Making this call will guarantee that previously loaded
- // assemblies will be granted permissions based on the default machine
- // policy that was in place prior to this call.
-#if FEATURE_CAS_POLICY
- [System.Security.SecurityCritical] // auto-generated_required
- [Obsolete("AppDomain policy levels are obsolete and will be removed in a future release of the .NET Framework. See http://go.microsoft.com/fwlink/?LinkID=155570 for more information.")]
- public void SetAppDomainPolicy(PolicyLevel domainPolicy)
- {
- if (domainPolicy == null)
- throw new ArgumentNullException("domainPolicy");
- Contract.EndContractBlock();
-
- if (!IsLegacyCasPolicyEnabled)
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyExplicit"));
- }
-
- // Check that policy has not been set previously.
- lock (this) {
- if (_HasSetPolicy)
- throw new PolicyException(Environment.GetResourceString("Policy_PolicyAlreadySet"));
- _HasSetPolicy = true;
-
- // Make sure that the loader allows us to change security policy
- // at this time (this will throw if not.)
- nChangeSecurityPolicy();
- }
-
- // Add the new policy level.
- SecurityManager.PolicyManager.AddLevel(domainPolicy);
- }
-#endif //#if !FEATURE_CAS_POLICY
-#if FEATURE_CLICKONCE
- public ActivationContext ActivationContext {
- [System.Security.SecurityCritical] // auto-generated_required
- get {
- return _activationContext;
- }
- }
-
- public ApplicationIdentity ApplicationIdentity {
- [System.Security.SecurityCritical] // auto-generated_required
- get {
- return _applicationIdentity;
- }
- }
-#endif // FEATURE_CLICKONCE
-
-
-#if FEATURE_CLICKONCE
- public ApplicationTrust ApplicationTrust {
- [System.Security.SecurityCritical] // auto-generated_required
-#else // FEATURE_CLICKONCE
- internal ApplicationTrust ApplicationTrust {
-#endif // FEATURE_CLICKONCE
get {
if (_applicationTrust == null && _IsFastFullTrustDomain) {
_applicationTrust = new ApplicationTrust(new PermissionSet(PermissionState.Unrestricted));
@@ -2564,66 +1758,8 @@ namespace System {
}
}
-#if FEATURE_IMPERSONATION
- // Set the default principal object to be attached to threads if they
- // attempt to bind to a principal while executing in this appdomain. The
- // default can only be set once.
- [System.Security.SecuritySafeCritical] // auto-generated
- [SecurityPermissionAttribute(SecurityAction.Demand, Flags=SecurityPermissionFlag.ControlPrincipal)]
- public void SetThreadPrincipal(IPrincipal principal)
- {
- if (principal == null)
- throw new ArgumentNullException("principal");
- Contract.EndContractBlock();
-
- lock (this) {
- // Check that principal has not been set previously.
- if (_DefaultPrincipal != null)
- throw new PolicyException(Environment.GetResourceString("Policy_PrincipalTwice"));
-
- _DefaultPrincipal = principal;
- }
- }
-#endif // FEATURE_IMPERSONATION
-
-#if FEATURE_CAS_POLICY
- // Similar to the above, but sets the class of principal to be created
- // instead.
- [System.Security.SecuritySafeCritical] // auto-generated
- [SecurityPermissionAttribute(SecurityAction.Demand, Flags=SecurityPermissionFlag.ControlPrincipal)]
- public void SetPrincipalPolicy(PrincipalPolicy policy)
- {
- _PrincipalPolicy = policy;
- }
-#endif
-
-
-#if FEATURE_REMOTING
- // This method gives AppDomain an infinite life time by preventing a lease from being
- // created
- [System.Security.SecurityCritical] // auto-generated_required
- public override Object InitializeLifetimeService()
- {
- return null;
- }
- // This is useful for requesting execution of some code
- // in another appDomain ... the delegate may be defined
- // on a marshal-by-value object or a marshal-by-ref or
- // contextBound object.
- public void DoCallBack(CrossAppDomainDelegate callBackDelegate)
- {
- if (callBackDelegate == null)
- throw new ArgumentNullException("callBackDelegate");
- Contract.EndContractBlock();
-
- callBackDelegate();
- }
-#endif
-
-
public String DynamicDirectory
{
- [System.Security.SecuritySafeCritical] // auto-generated
get {
String dyndir = GetDynamicDir();
if (dyndir != null)
@@ -2633,211 +1769,13 @@ namespace System {
}
}
-#if FEATURE_CAS_POLICY
- public static AppDomain CreateDomain(String friendlyName,
- Evidence securityInfo) // Optional
- {
- return CreateDomain(friendlyName,
- securityInfo,
- null);
- }
-
- public static AppDomain CreateDomain(String friendlyName,
- Evidence securityInfo, // Optional
- String appBasePath,
- String appRelativeSearchPath,
- bool shadowCopyFiles)
- {
- AppDomainSetup info = new AppDomainSetup();
- info.ApplicationBase = appBasePath;
- info.PrivateBinPath = appRelativeSearchPath;
- if(shadowCopyFiles)
- info.ShadowCopyFiles = "true";
-
- return CreateDomain(friendlyName,
- securityInfo,
- info);
- }
-#endif // #if FEATURE_CAS_POLICY (not exposed in core)
-
-
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern private String GetDynamicDir();
- // Private helpers called from unmanaged code.
-
-#if FEATURE_REMOTING
-
- public static AppDomain CreateDomain(String friendlyName)
- {
- return CreateDomain(friendlyName, null, null);
- }
-
-
- // Marshal a single object into a serialized blob.
- [System.Security.SecurityCritical] // auto-generated
- private static byte[] MarshalObject(Object o)
- {
- CodeAccessPermission.Assert(true);
-
- return Serialize(o);
- }
-
- // Marshal two objects into serialized blobs.
- [System.Security.SecurityCritical] // auto-generated
- private static byte[] MarshalObjects(Object o1, Object o2, out byte[] blob2)
- {
- CodeAccessPermission.Assert(true);
-
- byte[] blob1 = Serialize(o1);
- blob2 = Serialize(o2);
- return blob1;
- }
-
- // Unmarshal a single object from a serialized blob.
- [System.Security.SecurityCritical] // auto-generated
- private static Object UnmarshalObject(byte[] blob)
- {
- CodeAccessPermission.Assert(true);
-
- return Deserialize(blob);
- }
-
- // Unmarshal two objects from serialized blobs.
- [System.Security.SecurityCritical] // auto-generated
- private static Object UnmarshalObjects(byte[] blob1, byte[] blob2, out Object o2)
- {
- CodeAccessPermission.Assert(true);
-
- Object o1 = Deserialize(blob1);
- o2 = Deserialize(blob2);
- return o1;
- }
-
- // Helper routines.
- [System.Security.SecurityCritical] // auto-generated
- private static byte[] Serialize(Object o)
- {
- if (o == null)
- {
- return null;
- }
- else if (o is ISecurityEncodable)
- {
- SecurityElement element = ((ISecurityEncodable)o).ToXml();
- MemoryStream ms = new MemoryStream( 4096 );
- ms.WriteByte( 0 );
- StreamWriter writer = new StreamWriter( ms, Encoding.UTF8 );
- element.ToWriter( writer );
- writer.Flush();
- return ms.ToArray();
- }
- else
- {
- MemoryStream ms = new MemoryStream();
- ms.WriteByte( 1 );
- CrossAppDomainSerializer.SerializeObject(o, ms);
- return ms.ToArray();
- }
- }
-
- [System.Security.SecurityCritical] // auto-generated
- private static Object Deserialize(byte[] blob)
- {
- if (blob == null)
- return null;
-
- if (blob[0] == 0)
- {
- Parser parser = new Parser( blob, Tokenizer.ByteTokenEncoding.UTF8Tokens, 1 );
- SecurityElement root = parser.GetTopElement();
- if (root.Tag.Equals( "IPermission" ) || root.Tag.Equals( "Permission" ))
- {
- IPermission ip = System.Security.Util.XMLUtil.CreatePermission( root, PermissionState.None, false );
-
- if (ip == null)
- {
- return null;
- }
-
- ip.FromXml( root );
-
- return ip;
- }
- else if (root.Tag.Equals( "PermissionSet" ))
- {
- PermissionSet permissionSet = new PermissionSet();
-
- permissionSet.FromXml( root, false, false );
-
- return permissionSet;
- }
- else if (root.Tag.Equals( "PermissionToken" ))
- {
- PermissionToken pToken = new PermissionToken();
-
- pToken.FromXml( root );
-
- return pToken;
- }
- else
- {
- return null;
- }
-
- }
- else
- {
- Object obj = null;
- using(MemoryStream stream = new MemoryStream( blob, 1, blob.Length - 1 )) {
- obj = CrossAppDomainSerializer.DeserializeObject(stream);
- }
-
- Contract.Assert( !(obj is IPermission), "IPermission should be xml deserialized" );
- Contract.Assert( !(obj is PermissionSet), "PermissionSet should be xml deserialized" );
-
- return obj;
- }
- }
-
-#endif // FEATURE_REMOTING
-
-#if !FEATURE_CORECLR
- //
- // Called by the VM if ICLRExecutionManager::Pause is called with the PAUSE_APP_DOMAINS flag.
- // This mimics the behavior of the CoreCLR FAS (fast application switching) model, to ensure
- // that code that depends on things happening in a particular order will work.
- //
- [System.Security.SecurityCritical]
- internal static void Pause()
- {
- AppDomainPauseManager.Instance.Pausing();
- AppDomainPauseManager.Instance.Paused();
- }
-
- //
- // Called by the VM if ICLRExecutionManager::Resume is called after ICLRExecutionManager::Pause
- // was called with the PAUSE_APP_DOMAINS flag.
- // This mimics the behavior of the CoreCLR FAS (fast application switching) model, to ensure
- // that code that depends on things happening in a particular order will work.
- //
- [System.Security.SecurityCritical]
- internal static void Resume()
- {
- if (AppDomainPauseManager.IsPaused)
- {
- AppDomainPauseManager.Instance.Resuming();
- AppDomainPauseManager.Instance.Resumed();
- }
- }
-#endif
-
private AppDomain() {
throw new NotSupportedException(Environment.GetResourceString(ResId.NotSupported_Constructor));
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern int _nExecuteAssembly(RuntimeAssembly assembly, String[] args);
internal int nExecuteAssembly(RuntimeAssembly assembly, String[] args)
@@ -2849,45 +1787,18 @@ namespace System {
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal extern void nCreateContext();
- [System.Security.SecurityCritical]
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
[SuppressUnmanagedCodeSecurity]
private static extern void nSetupBindingPaths(String trustedPlatformAssemblies, String platformResourceRoots, String appPath, String appNiPaths, String appLocalWinMD);
- #if FEATURE_CORECLR
- [System.Security.SecurityCritical] // auto-generated
- #endif
internal void SetupBindingPaths(String trustedPlatformAssemblies, String platformResourceRoots, String appPath, String appNiPaths, String appLocalWinMD)
{
nSetupBindingPaths(trustedPlatformAssemblies, platformResourceRoots, appPath, appNiPaths, appLocalWinMD);
}
#endif // FEATURE_VERSIONING
-#if FEATURE_REMOTING
- internal void CreateRemotingData()
- {
- lock(this) {
- if (_RemotingData == null)
- _RemotingData = new DomainSpecificRemotingData();
- }
- }
-
- internal DomainSpecificRemotingData RemotingData
- {
- get
- {
- if (_RemotingData == null)
- CreateRemotingData();
-
- return _RemotingData;
- }
- }
-#endif // FEATURE_REMOTING
-
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern String nGetFriendlyName();
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern bool nIsDefaultAppDomainForEvidence();
@@ -2899,7 +1810,6 @@ namespace System {
public event EventHandler ProcessExit
{
- [System.Security.SecuritySafeCritical] // auto-generated_required
add
{
if (value != null)
@@ -2919,7 +1829,6 @@ namespace System {
public event EventHandler DomainUnload
{
- [System.Security.SecuritySafeCritical] // auto-generated_required
add
{
if (value != null)
@@ -2929,9 +1838,6 @@ namespace System {
_domainUnload += value;
}
}
-#if FEATURE_CORECLR
- [System.Security.SecuritySafeCritical]
-#endif
remove
{
lock(this)
@@ -2942,7 +1848,6 @@ namespace System {
public event UnhandledExceptionEventHandler UnhandledException
{
- [System.Security.SecurityCritical] // auto-generated_required
add
{
if (value != null)
@@ -2952,7 +1857,6 @@ namespace System {
_unhandledException += value;
}
}
- [System.Security.SecurityCritical] // auto-generated_required
remove
{
lock(this)
@@ -2967,7 +1871,6 @@ namespace System {
// To register/unregister the callback, the code must be SecurityCritical.
public event EventHandler<FirstChanceExceptionEventArgs> FirstChanceException
{
- [System.Security.SecurityCritical] // auto-generated_required
add
{
if (value != null)
@@ -2977,7 +1880,6 @@ namespace System {
_firstChanceException += value;
}
}
- [System.Security.SecurityCritical] // auto-generated_required
remove
{
lock(this)
@@ -2996,7 +1898,6 @@ namespace System {
}
// This method is called by the VM.
- [System.Security.SecurityCritical]
private RuntimeAssembly OnResourceResolveEvent(RuntimeAssembly assembly, String resourceName)
{
ResolveEventHandler eventHandler = _ResourceResolve;
@@ -3016,7 +1917,6 @@ namespace System {
}
// This method is called by the VM
- [System.Security.SecurityCritical]
private RuntimeAssembly OnTypeResolveEvent(RuntimeAssembly assembly, String typeName)
{
ResolveEventHandler eventHandler = _TypeResolve;
@@ -3036,7 +1936,6 @@ namespace System {
}
// This method is called by the VM.
- [System.Security.SecurityCritical]
private RuntimeAssembly OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
{
ResolveEventHandler eventHandler = _AssemblyResolve;
@@ -3058,36 +1957,6 @@ namespace System {
return null;
}
-#if FEATURE_REFLECTION_ONLY_LOAD
-
- private RuntimeAssembly OnReflectionOnlyAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
- {
- ResolveEventHandler eventHandler = ReflectionOnlyAssemblyResolve;
- if (eventHandler != null) {
-
- Delegate[] ds = eventHandler.GetInvocationList();
- int len = ds.Length;
- for (int i = 0; i < len; i++) {
- Assembly asm = ((ResolveEventHandler)ds[i])(this, new ResolveEventArgs(assemblyFullName, assembly));
- RuntimeAssembly ret = GetRuntimeAssembly(asm);
- if (ret != null)
- return ret;
- }
- }
-
- return null;
- }
-
-#if FEATURE_COMINTEROP
- // Called by VM - code:CLRPrivTypeCacheReflectionOnlyWinRT::RaiseNamespaceResolveEvent
- private RuntimeAssembly[] OnReflectionOnlyNamespaceResolveEvent(RuntimeAssembly assembly, string namespaceName)
- {
- return System.Runtime.InteropServices.WindowsRuntime.WindowsRuntimeMetadata.OnReflectionOnlyNamespaceResolveEvent(this, assembly, namespaceName);
- }
-#endif // FEATURE_COMINTEROP
-
-#endif // FEATURE_REFLECTION_ONLY_LOAD
-
#if FEATURE_COMINTEROP
// Called by VM - code:CLRPrivTypeCacheWinRT::RaiseDesignerNamespaceResolveEvent
private string[] OnDesignerNamespaceResolveEvent(string namespaceName)
@@ -3099,7 +1968,7 @@ namespace System {
internal AppDomainSetup FusionStore
{
get {
- Contract.Assert(_FusionStore != null,
+ Debug.Assert(_FusionStore != null,
"Fusion store has not been correctly setup in this domain");
return _FusionStore;
}
@@ -3133,319 +2002,33 @@ namespace System {
}
}
-#if FEATURE_FUSION
- private void TurnOnBindingRedirects()
- {
- _FusionStore.DisallowBindingRedirects = false;
- }
-#endif
-
- // This will throw a CannotUnloadAppDomainException if the appdomain is
- // in another process.
-#if FEATURE_REMOTING
- [System.Security.SecurityCritical] // auto-generated
- [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
- internal static Int32 GetIdForUnload(AppDomain domain)
- {
- if (RemotingServices.IsTransparentProxy(domain))
- {
- return RemotingServices.GetServerDomainIdForProxy(domain);
- }
- else
- return domain.Id;
- }
-#endif
-
// Used to determine if server object context is valid in
// x-domain remoting scenarios.
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
internal static extern bool IsDomainIdValid(Int32 id);
-
-#if FEATURE_REMOTING
- [System.Security.SecurityCritical] // auto-generated
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- static internal extern AppDomain GetDefaultDomain();
-#endif
-
-#if FEATURE_IMPERSONATION
- // Internal routine to retrieve the default principal object. If this is
- // called before the principal has been explicitly set, it will
- // automatically allocate a default principal based on the policy set by
- // SetPrincipalPolicy.
- internal IPrincipal GetThreadPrincipal()
- {
- IPrincipal principal = null;
- if (_DefaultPrincipal == null) {
-#if FEATURE_CAS_POLICY
- switch (_PrincipalPolicy) {
- case PrincipalPolicy.NoPrincipal:
- principal = null;
- break;
- case PrincipalPolicy.UnauthenticatedPrincipal:
- principal = new GenericPrincipal(new GenericIdentity("", ""),
- new String[] {""});
- break;
- case PrincipalPolicy.WindowsPrincipal:
- principal = new WindowsPrincipal(WindowsIdentity.GetCurrent());
- break;
- default:
- principal = null;
- break;
- }
-#else
- principal = new GenericPrincipal(new GenericIdentity("", ""),
- new String[] {""});
-
-#endif
- }
- else
- principal = _DefaultPrincipal;
-
- return principal;
- }
-#endif // FEATURE_IMPERSONATION
-
-#if FEATURE_REMOTING
-
- [System.Security.SecurityCritical] // auto-generated
- internal void CreateDefaultContext()
- {
- lock(this) {
- // if it has not been created we ask the Context class to
- // create a new default context for this appdomain.
- if (_DefaultContext == null)
- _DefaultContext = Context.CreateDefaultContext();
- }
- }
-
- [System.Security.SecurityCritical] // auto-generated
- internal Context GetDefaultContext()
- {
- if (_DefaultContext == null)
- CreateDefaultContext();
- return _DefaultContext;
- }
-
- // Ensure that evidence provided when creating an AppDomain would not have been used to create a
- // sandbox in legacy CAS mode. If it could have been used to create a sandbox, and we're not in CAS
- // mode, then we throw an exception to prevent acciental creation of unsandboxed domains where a
- // sandbox would have been expected.
- [SecuritySafeCritical]
- internal static void CheckDomainCreationEvidence(AppDomainSetup creationDomainSetup,
- Evidence creationEvidence)
- {
- if (creationEvidence != null && !CurrentDomain.IsLegacyCasPolicyEnabled)
- {
- if (creationDomainSetup == null || creationDomainSetup.ApplicationTrust == null)
- {
- // We allow non-null evidence in CAS mode to support the common pattern of passing in
- // AppDomain.CurrentDomain.Evidence. Since the zone evidence must have been changed
- // if the user has any expectation of sandboxing the domain under legacy CAS policy,
- // we use a zone comparison to check for this pattern. A strict comparison will not
- // work, since MSDN samples for creating a domain show using a modified version of the
- // current domain's evidence and we would capturce people who copied and pasted these
- // samples without intending to sandbox.
- Zone creatorsZone = CurrentDomain.EvidenceNoDemand.GetHostEvidence<Zone>();
- SecurityZone creatorsSecurityZone = creatorsZone != null ?
- creatorsZone.SecurityZone :
- SecurityZone.MyComputer;
-
- Zone suppliedZone = creationEvidence.GetHostEvidence<Zone>();
- if (suppliedZone != null)
- {
- if (suppliedZone.SecurityZone != creatorsSecurityZone &&
- suppliedZone.SecurityZone != SecurityZone.MyComputer)
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
- }
- }
- }
- }
- }
-
-#if FEATURE_CAS_POLICY
- [System.Security.SecuritySafeCritical] // auto-generated
- [SecurityPermissionAttribute( SecurityAction.Demand, ControlAppDomain = true )]
- public static AppDomain CreateDomain(String friendlyName,
- Evidence securityInfo,
- AppDomainSetup info)
- {
- return InternalCreateDomain(friendlyName, securityInfo, info);
- }
-#else
- internal static AppDomain CreateDomain(String friendlyName,
- Evidence securityInfo,
- AppDomainSetup info)
- {
- return InternalCreateDomain(friendlyName, securityInfo, info);
- }
-#endif
-
- [System.Security.SecurityCritical] // auto-generated
- internal static AppDomain InternalCreateDomain(String friendlyName,
- Evidence securityInfo,
- AppDomainSetup info)
- {
- if (friendlyName == null)
- throw new ArgumentNullException("friendlyName", Environment.GetResourceString("ArgumentNull_String"));
-
- Contract.EndContractBlock();
-
- AppDomain.CheckCreateDomainSupported();
-
- if (info == null)
- info = new AppDomainSetup();
- if (info.TargetFrameworkName == null)
- info.TargetFrameworkName = AppDomain.CurrentDomain.GetTargetFrameworkName();
- AppDomainManager domainManager = AppDomain.CurrentDomain.DomainManager;
- if (domainManager != null)
- return domainManager.CreateDomain(friendlyName, securityInfo, info);
-
- // No AppDomainManager is set up for this domain
-
- // If evidence is provided, we check to make sure that is allowed.
- if (securityInfo != null)
- {
- new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
-
- // If we're potentially trying to sandbox without using a homogenous domain, we need to reject
- // the domain creation.
- CheckDomainCreationEvidence(info, securityInfo);
- }
-
- return nCreateDomain(friendlyName,
- info,
- securityInfo,
- securityInfo == null ? AppDomain.CurrentDomain.InternalEvidence : null,
- AppDomain.CurrentDomain.GetSecurityDescriptor());
- }
-#endif // FEATURE_REMOTING
-
-#if FEATURE_CAS_POLICY
-
- public static AppDomain CreateDomain (string friendlyName,
- Evidence securityInfo,
- AppDomainSetup info,
- PermissionSet grantSet,
- params StrongName[] fullTrustAssemblies)
- {
- if (info == null)
- throw new ArgumentNullException("info");
- if (info.ApplicationBase == null)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_AppDomainSandboxAPINeedsExplicitAppBase"));
- Contract.EndContractBlock();
-
- if (fullTrustAssemblies == null)
- {
- fullTrustAssemblies = new StrongName[0];
- }
-
- info.ApplicationTrust = new ApplicationTrust(grantSet, fullTrustAssemblies);
- return CreateDomain(friendlyName, securityInfo, info);
- }
-
- public static AppDomain CreateDomain(String friendlyName,
- Evidence securityInfo, // Optional
- String appBasePath,
- String appRelativeSearchPath,
- bool shadowCopyFiles,
- AppDomainInitializer adInit,
- string[] adInitArgs)
- {
- AppDomainSetup info = new AppDomainSetup();
- info.ApplicationBase = appBasePath;
- info.PrivateBinPath = appRelativeSearchPath;
- info.AppDomainInitializer=adInit;
- info.AppDomainInitializerArguments=adInitArgs;
- if(shadowCopyFiles)
- info.ShadowCopyFiles = "true";
-
- return CreateDomain(friendlyName,
- securityInfo,
- info);
- }
-#endif // FEATURE_CAS_POLICY
-
-#if FEATURE_CORECLR
- [System.Security.SecurityCritical]
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
[SuppressUnmanagedCodeSecurity]
private static extern void nSetNativeDllSearchDirectories(string paths);
-#endif
- [System.Security.SecurityCritical] // auto-generated
private void SetupFusionStore(AppDomainSetup info, AppDomainSetup oldInfo)
{
Contract.Requires(info != null);
-#if FEATURE_FUSION
- if (oldInfo == null) {
-
- // Create the application base and configuration file from the imagelocation
- // passed in or use the Win32 Image name.
- if(info.Value[(int) AppDomainSetup.LoaderInformation.ApplicationBaseValue] == null ||
- info.Value[(int) AppDomainSetup.LoaderInformation.ConfigurationFileValue] == null )
-#else
if (info.ApplicationBase == null)
-#endif
-
{
-#if FEATURE_FUSION
- AppDomain defaultDomain = GetDefaultDomain();
- if (this == defaultDomain) {
- // The default domain gets its defaults from the main process.
- info.SetupDefaults(RuntimeEnvironment.GetModuleFileName(), imageLocationAlreadyNormalized : true);
- }
- else {
- // Other domains get their defaults from the default domain. This way, a host process
- // can use AppDomainManager to set up the defaults for every domain created in the process.
- if (info.Value[(int) AppDomainSetup.LoaderInformation.ConfigurationFileValue] == null)
- info.ConfigurationFile = defaultDomain.FusionStore.Value[(int) AppDomainSetup.LoaderInformation.ConfigurationFileValue];
- if (info.Value[(int) AppDomainSetup.LoaderInformation.ApplicationBaseValue] == null)
- info.ApplicationBase = defaultDomain.FusionStore.Value[(int) AppDomainSetup.LoaderInformation.ApplicationBaseValue];
- if (info.Value[(int) AppDomainSetup.LoaderInformation.ApplicationNameValue] == null)
- info.ApplicationName = defaultDomain.FusionStore.Value[(int) AppDomainSetup.LoaderInformation.ApplicationNameValue];
- }
-#else
info.SetupDefaults(RuntimeEnvironment.GetModuleFileName(), imageLocationAlreadyNormalized : true);
-#endif
-
- }
-
-#if FEATURE_FUSION
- // If there is no relative path then check the
- // environment
- if(info.Value[(int) AppDomainSetup.LoaderInformation.PrivateBinPathValue] == null)
- info.PrivateBinPath = Environment.nativeGetEnvironmentVariable(AppDomainSetup.PrivateBinPathEnvironmentVariable);
-
- // Add the developer path if it exists on this
- // machine.
- if(info.DeveloperPath == null)
- info.DeveloperPath = RuntimeEnvironment.GetDeveloperPath();
-
}
-
- // Set up the fusion context
- IntPtr fusionContext = GetFusionContext();
- info.SetupFusionContext(fusionContext, oldInfo);
- // Set loader optimization policy
-#else
#if FEATURE_VERSIONING
nCreateContext();
#endif // FEATURE_VERSIONING
-#endif // FEATURE_FUSION
#if FEATURE_LOADER_OPTIMIZATION
if (info.LoaderOptimization != LoaderOptimization.NotSpecified || (oldInfo != null && info.LoaderOptimization != oldInfo.LoaderOptimization))
UpdateLoaderOptimization(info.LoaderOptimization);
-#endif
-
-
-
+#endif
// This must be the last action taken
_FusionStore = info;
}
@@ -3475,7 +2058,6 @@ namespace System {
// are any remoting sinks registered, they can add non-mscorlib
// objects to the message (causing an assembly load exception when
// we try to deserialize it on the other side)
- [System.Security.SecurityCritical] // auto-generated
private static object PrepareDataForSetup(String friendlyName,
AppDomainSetup setup,
Evidence providedSecurityInfo,
@@ -3488,54 +2070,6 @@ namespace System {
byte[] serializedEvidence = null;
bool generateDefaultEvidence = false;
-#if FEATURE_CAS_POLICY
- // serialize evidence
- EvidenceCollection evidenceCollection = null;
-
- if (providedSecurityInfo != null || creatorsSecurityInfo != null)
- {
- // If we're just passing through AppDomain.CurrentDomain.Evidence, and that evidence is just
- // using the standard runtime AppDomainEvidenceFactory, don't waste time serializing it and
- // deserializing it back -- instead, we can recreate a new AppDomainEvidenceFactory in the new
- // domain. We only want to do this if there is no HostSecurityManager, otherwise the
- // HostSecurityManager could have added additional evidence on top of our standard factory.
- HostSecurityManager hsm = CurrentDomain.DomainManager != null ? CurrentDomain.DomainManager.HostSecurityManager : null;
- bool hostMayContributeEvidence = hsm != null &&
- hsm.GetType() != typeof(HostSecurityManager) &&
- (hsm.Flags & HostSecurityManagerOptions.HostAppDomainEvidence) == HostSecurityManagerOptions.HostAppDomainEvidence;
- if (!hostMayContributeEvidence)
- {
- if (providedSecurityInfo != null &&
- providedSecurityInfo.IsUnmodified &&
- providedSecurityInfo.Target != null &&
- providedSecurityInfo.Target is AppDomainEvidenceFactory)
- {
- providedSecurityInfo = null;
- generateDefaultEvidence = true;
- }
- if (creatorsSecurityInfo != null &&
- creatorsSecurityInfo.IsUnmodified &&
- creatorsSecurityInfo.Target != null &&
- creatorsSecurityInfo.Target is AppDomainEvidenceFactory)
- {
- creatorsSecurityInfo = null;
- generateDefaultEvidence = true;
- }
- }
- }
- if ((providedSecurityInfo != null) ||
- (creatorsSecurityInfo != null)) {
- evidenceCollection = new EvidenceCollection();
- evidenceCollection.ProvidedSecurityInfo = providedSecurityInfo;
- evidenceCollection.CreatorsSecurityInfo = creatorsSecurityInfo;
- }
-
- if (evidenceCollection != null) {
- serializedEvidence =
- CrossAppDomainSerializer.SerializeObject(evidenceCollection).GetBuffer();
- }
-#endif // FEATURE_CAS_POLICY
-
AppDomainInitializerInfo initializerInfo = null;
if (setup!=null && setup.AppDomainInitializer!=null)
initializerInfo=new AppDomainInitializerInfo(setup.AppDomainInitializer);
@@ -3543,7 +2077,6 @@ namespace System {
// will travel x-Ad, drop non-agile data
AppDomainSetup newSetup = new AppDomainSetup(setup, false);
-#if FEATURE_CORECLR
// Remove the special AppDomainCompatSwitch entries from the set of name value pairs
// And add them to the AppDomainSetup
//
@@ -3551,7 +2084,7 @@ namespace System {
// Desktop code should use System.AppDomain.CreateDomain() or
// System.AppDomainManager.CreateDomain() and add the flags to the AppDomainSetup
List<String> compatList = new List<String>();
-
+
if(propertyNames!=null && propertyValues != null)
{
for (int i=0; i<propertyNames.Length; i++)
@@ -3559,7 +2092,7 @@ namespace System {
if(String.Compare(propertyNames[i], "AppDomainCompatSwitch", StringComparison.OrdinalIgnoreCase) == 0)
{
compatList.Add(propertyValues[i]);
- propertyNames[i] = null;
+ propertyNames[i] = null;
propertyValues[i] = null;
}
@@ -3568,10 +2101,8 @@ namespace System {
if (compatList.Count > 0)
{
newSetup.SetCompatibilitySwitches(compatList);
- }
+ }
}
-#endif // FEATURE_CORECLR
-
return new Object[]
{
@@ -3587,8 +2118,6 @@ namespace System {
};
} // PrepareDataForSetup
-
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.NoInlining)]
private static Object Setup(Object arg)
{
@@ -3604,44 +2133,47 @@ namespace System {
AppDomainInitializerInfo initializerInfo = (AppDomainInitializerInfo)args[5];
string sandboxName = (string)args[6];
string[] propertyNames = (string[])args[7]; // can contain null elements
- string[] propertyValues = (string[])args[8]; // can contain null elements
+ string[] propertyValues = (string[])args[8]; // can contain null elements
// extract evidence
Evidence providedSecurityInfo = null;
Evidence creatorsSecurityInfo = null;
-
AppDomain ad = AppDomain.CurrentDomain;
AppDomainSetup newSetup=new AppDomainSetup(setup,false);
if(propertyNames!=null && propertyValues != null)
{
-#if FEATURE_CORECLR
- StringBuilder normalisedAppPathList = null;
-#endif // FEATURE_CORECLR
+ for (int i = 0; i < propertyNames.Length; i++)
+ {
+ // We want to set native dll probing directories before any P/Invokes have a
+ // chance to fire. The Path class, for one, has P/Invokes.
+ if (propertyNames[i] == "NATIVE_DLL_SEARCH_DIRECTORIES")
+ {
+ if (propertyValues[i] == null)
+ throw new ArgumentNullException("NATIVE_DLL_SEARCH_DIRECTORIES");
+
+ string paths = propertyValues[i];
+ if (paths.Length == 0)
+ break;
+
+ nSetNativeDllSearchDirectories(paths);
+ }
+ }
+
for (int i=0; i<propertyNames.Length; i++)
{
if(propertyNames[i]=="APPBASE") // make sure in sync with Fusion
{
if(propertyValues[i]==null)
throw new ArgumentNullException("APPBASE");
-
- if (Path.IsRelative(propertyValues[i]))
+
+ if (PathInternal.IsPartiallyQualified(propertyValues[i]))
throw new ArgumentException( Environment.GetResourceString( "Argument_AbsolutePathRequired" ) );
newSetup.ApplicationBase = NormalizePath(propertyValues[i], fullCheck: true);
-
- }
-#if FEATURE_CAS_POLICY
- else if(propertyNames[i]=="LOCATION_URI" && providedSecurityInfo==null)
- {
- providedSecurityInfo=new Evidence();
- providedSecurityInfo.AddHostEvidence(new Url(propertyValues[i]));
- ad.SetDataHelper(propertyNames[i],propertyValues[i],null);
}
-#endif // FEATURE_CAS_POLICY
#if FEATURE_LOADER_OPTIMIZATION
- else
- if(propertyNames[i]=="LOADER_OPTIMIZATION")
+ else if(propertyNames[i]=="LOADER_OPTIMIZATION")
{
if(propertyValues[i]==null)
throw new ArgumentNullException("LOADER_OPTIMIZATION");
@@ -3656,119 +2188,32 @@ namespace System {
}
}
#endif // FEATURE_LOADER_OPTIMIZATION
-#if FEATURE_CORECLR
- else
- if(propertyNames[i]=="NATIVE_DLL_SEARCH_DIRECTORIES")
- {
- if(propertyValues[i]==null)
- throw new ArgumentNullException("NATIVE_DLL_SEARCH_DIRECTORIES");
- ad.SetDataHelper(propertyNames[i],propertyValues[i],null);
- string paths = (string)propertyValues[i];
- if( paths.Length==0 )
- continue;
- nSetNativeDllSearchDirectories(paths);
- }
- else
- if(propertyNames[i]=="TRUSTED_PLATFORM_ASSEMBLIES" ||
+ else if(propertyNames[i]=="TRUSTED_PLATFORM_ASSEMBLIES" ||
propertyNames[i]=="PLATFORM_RESOURCE_ROOTS" ||
propertyNames[i]=="APP_PATHS" ||
propertyNames[i]=="APP_NI_PATHS")
{
string values = propertyValues[i];
- if(values==null)
+ if(values == null)
throw new ArgumentNullException(propertyNames[i]);
- int estimatedLength = values.Length + 1; // +1 for extra separator temporarily added at end
- if (normalisedAppPathList == null) {
- normalisedAppPathList = new StringBuilder(estimatedLength);
- }
- else {
- normalisedAppPathList.Clear();
- if (normalisedAppPathList.Capacity < estimatedLength)
- normalisedAppPathList.Capacity = estimatedLength;
- }
-
- for (int pos = 0; pos < values.Length; pos++)
- {
- string path;
-
- int nextPos = values.IndexOf(Path.PathSeparator, pos);
- if (nextPos == -1)
- {
- path = values.Substring(pos);
- pos = values.Length - 1;
- }
- else
- {
- path = values.Substring(pos, nextPos - pos);
- pos = nextPos;
- }
-
- if( path.Length==0 ) // skip empty dirs
- continue;
-
- if (Path.IsRelative(path))
- throw new ArgumentException( Environment.GetResourceString( "Argument_AbsolutePathRequired" ) );
-
- string appPath = NormalizePath(path, fullCheck: true);
- normalisedAppPathList.Append(appPath);
- normalisedAppPathList.Append(Path.PathSeparator);
- }
- // Strip the last separator
- if (normalisedAppPathList.Length > 0)
- {
- normalisedAppPathList.Remove(normalisedAppPathList.Length - 1, 1);
- }
- ad.SetDataHelper(propertyNames[i],normalisedAppPathList.ToString(),null); // not supported by fusion, so set explicitly
+ ad.SetDataHelper(propertyNames[i], NormalizeAppPaths(values), null);
}
- else
- if(propertyNames[i]!= null)
+ else if(propertyNames[i]!= null)
{
ad.SetDataHelper(propertyNames[i],propertyValues[i],null); // just propagate
}
-#endif
-
}
}
-#if !FEATURE_CORECLR
- AppDomainSortingSetupInfo sortingSetup = newSetup._AppDomainSortingSetupInfo;
-
- if(sortingSetup != null)
- {
- if(sortingSetup._pfnIsNLSDefinedString == IntPtr.Zero || sortingSetup._pfnCompareStringEx == IntPtr.Zero || sortingSetup._pfnLCMapStringEx == IntPtr.Zero || sortingSetup._pfnFindNLSStringEx == IntPtr.Zero
- || sortingSetup._pfnCompareStringOrdinal == IntPtr.Zero || sortingSetup._pfnGetNLSVersionEx == IntPtr.Zero)
- {
-
- if(!(sortingSetup._pfnIsNLSDefinedString == IntPtr.Zero && sortingSetup._pfnCompareStringEx == IntPtr.Zero && sortingSetup._pfnLCMapStringEx == IntPtr.Zero && sortingSetup._pfnFindNLSStringEx == IntPtr.Zero
- && sortingSetup._pfnCompareStringOrdinal == IntPtr.Zero && sortingSetup._pfnGetNLSVersionEx == IntPtr.Zero))
- {
- // Some functions defined but not all of them.
- throw new ArgumentException(Environment.GetResourceString("ArgumentException_NotAllCustomSortingFuncsDefined"));
- }
-
- }
- }
-#endif
-
ad.SetupFusionStore(newSetup, null); // makes FusionStore a ref to newSetup
// technically, we don't need this, newSetup refers to the same object as FusionStore
// but it's confusing since it isn't immediately obvious whether we have a ref or a copy
AppDomainSetup adSetup = ad.FusionStore;
-#if FEATURE_CORECLR
adSetup.InternalSetApplicationTrust(sandboxName);
-#endif // FEATURE_CORECLR
-
-#if !FEATURE_CORECLR // not used by coreclr
- if (serializedEvidence != null) {
- EvidenceCollection evidenceCollection = (EvidenceCollection)
- CrossAppDomainSerializer.DeserializeObject(new MemoryStream(serializedEvidence));
- providedSecurityInfo = evidenceCollection.ProvidedSecurityInfo;
- creatorsSecurityInfo = evidenceCollection.CreatorsSecurityInfo;
- }
-#endif
+
// set up the friendly name
ad.nSetupFriendlyName(friendlyName);
@@ -3785,11 +2230,6 @@ namespace System {
ad.SetAppDomainManagerType(adSetup.AppDomainManagerAssembly, adSetup.AppDomainManagerType);
}
-#if FEATURE_APTCA
- // set any conditial-aptca visible assemblies
- ad.PartialTrustVisibleAssemblies = adSetup.PartialTrustVisibleAssemblies;
-#endif // FEATURE_APTCA
-
ad.CreateAppDomainManager(); // could modify FusionStore's object
ad.InitializeDomainSecurity(providedSecurityInfo,
creatorsSecurityInfo,
@@ -3802,221 +2242,81 @@ namespace System {
adSetup.AppDomainInitializer=initializerInfo.Unwrap();
RunInitializer(adSetup);
- // Activate the application if needed.
-#if FEATURE_CLICKONCE
- ObjectHandle oh = null;
- if (adSetup.ActivationArguments != null && adSetup.ActivationArguments.ActivateInstance)
- oh = Activator.CreateInstance(ad.ActivationContext);
- return RemotingServices.MarshalInternal(oh, null, null);
-#else
return null;
-#endif // FEATURE_CLICKONCE
}
- [SecuritySafeCritical]
- internal static string NormalizePath(string path, bool fullCheck)
+ private static string NormalizeAppPaths(string values)
{
-#if FEATURE_PATHCOMPAT
- // Appcontext switches can't currently be safely hit during AppDomain bringup
- return Path.LegacyNormalizePath(
- path: path,
- fullCheck: fullCheck,
- maxPathLength: PathInternal.MaxShortPath,
- expandShortPaths: true);
-#else
- return Path.NormalizePath(
- path: path,
- fullCheck: fullCheck,
- expandShortPaths: true);
-#endif
- }
+ int estimatedLength = values.Length + 1; // +1 for extra separator temporarily added at end
+ StringBuilder sb = StringBuilderCache.Acquire(estimatedLength);
-#if FEATURE_APTCA
- // Called from DomainAssembly in Conditional APTCA cases
- [PermissionSet(SecurityAction.Assert, Unrestricted = true)]
- [SecuritySafeCritical]
- private bool IsAssemblyOnAptcaVisibleList(RuntimeAssembly assembly)
- {
- if (_aptcaVisibleAssemblies == null)
- return false;
-
- AssemblyName assemblyName = assembly.GetName();
- String name = assemblyName.GetNameWithPublicKey();
-
- name = name.ToUpperInvariant();
-
- int index = Array.BinarySearch<string>(_aptcaVisibleAssemblies, name,
- StringComparer.OrdinalIgnoreCase);
- return (index >=0);
-
- }
-
- //Used to binary search the list of C-APTCA strings for an AssemblyName. It compares assembly name
- //and public key token.
- private class CAPTCASearcher : IComparer
- {
- int IComparer.Compare(object /*string*/lhs, object /*AssemblyName*/rhs)
+ for (int pos = 0; pos < values.Length; pos++)
{
- AssemblyName captcaEntry = new AssemblyName((string)lhs);
- AssemblyName comparand = (AssemblyName)rhs;
- int nameComp = string.Compare(captcaEntry.Name,
- comparand.Name,
- StringComparison.OrdinalIgnoreCase);
- if (nameComp != 0)
- {
- return nameComp;
- }
-
- //simple names match. Compare public key tokens.
- byte[] lhsKey = captcaEntry.GetPublicKeyToken();
- byte[] rhsKey = comparand.GetPublicKeyToken();
+ string path;
- // We require both sides have a public key token
- if (lhsKey == null)
+ int nextPos = values.IndexOf(Path.PathSeparator, pos);
+ if (nextPos == -1)
{
- return -1;
+ path = values.Substring(pos);
+ pos = values.Length - 1;
}
- if (rhsKey == null)
- {
- return 1;
- }
- if (lhsKey.Length < rhsKey.Length)
- {
- return -1;
- }
- if (lhsKey.Length > rhsKey.Length)
+ else
{
- return 1;
+ path = values.Substring(pos, nextPos - pos);
+ pos = nextPos;
}
- // Tokens seem valid - make sure the compare correctly
- for (int i = 0; i < lhsKey.Length; ++i)
- {
- byte lhsByte = lhsKey[i];
- byte rhsByte = rhsKey[i];
+ // Skip empty directories
+ if (path.Length == 0)
+ continue;
- if (lhsByte < rhsByte)
- {
- return -1;
- }
- if (lhsByte > rhsByte)
- {
- return 1;
- }
- }
+ if (PathInternal.IsPartiallyQualified(path))
+ throw new ArgumentException(Environment.GetResourceString("Argument_AbsolutePathRequired"));
- //They match.
- return 0;
+ string appPath = NormalizePath(path, fullCheck: true);
+ sb.Append(appPath);
+ sb.Append(Path.PathSeparator);
}
- }
- [System.Security.SecurityCritical]
- private unsafe bool IsAssemblyOnAptcaVisibleListRaw(char * namePtr, int nameLen, byte * keyTokenPtr,
- int keyTokenLen)
- {
- //This version is used for checking ngen dependencies against the C-APTCA list. It lets us
- //reject ngen images that depend on an assembly that has been disabled in the current domain.
- //Since we only have the public key token in the ngen image, we'll check against that. The
- //rationale is that if you have a public key token collision in your process you have many
- //problems. Since the source of this public key token is an ngen image for a full trust
- //assembly, there is essentially no risk to the reduced check.
- if (_aptcaVisibleAssemblies == null)
- return false;
-
- string name = new string(namePtr, 0, nameLen);
- byte[] keyToken = new byte[keyTokenLen];
- for( int i = 0; i < keyToken.Length; ++i )
- keyToken[i] = keyTokenPtr[i];
-
- AssemblyName asmName = new AssemblyName();
- asmName.Name = name;
- asmName.SetPublicKeyToken(keyToken);
- try
+ // Strip the last separator
+ if (sb.Length > 0)
{
- int index = Array.BinarySearch(_aptcaVisibleAssemblies, asmName, new CAPTCASearcher());
- return (index >= 0);
+ sb.Remove(sb.Length - 1, 1);
}
- catch (InvalidOperationException) { /* Can happen for poorly formed assembly names */ return false; }
+
+ return StringBuilderCache.GetStringAndRelease(sb);
}
-#endif
+ internal static string NormalizePath(string path, bool fullCheck)
+ {
+ return Path.GetFullPath(path);
+ }
// This routine is called from unmanaged code to
// set the default fusion context.
- [System.Security.SecurityCritical] // auto-generated
private void SetupDomain(bool allowRedirects, String path, String configFile, String[] propertyNames, String[] propertyValues)
{
// It is possible that we could have multiple threads initializing
// the default domain. We will just take the winner of these two.
// (eg. one thread doing a com call and another doing attach for IJW)
- lock (this) {
- if(_FusionStore == null) {
+ lock (this)
+ {
+ if(_FusionStore == null)
+ {
AppDomainSetup setup = new AppDomainSetup();
-#if FEATURE_CORECLR
+
// always use internet permission set
setup.InternalSetApplicationTrust("Internet");
-#endif // FEATURE_CORECLR
-#if FEATURE_FUSION
- setup.SetupDefaults(RuntimeEnvironment.GetModuleFileName(), imageLocationAlreadyNormalized : true);
- if(path != null)
- setup.Value[(int) AppDomainSetup.LoaderInformation.ApplicationBaseValue] = path;
- if(configFile != null)
- setup.Value[(int) AppDomainSetup.LoaderInformation.ConfigurationFileValue] = configFile;
-
- // Default fusion context starts with binding redirects turned off.
- if (!allowRedirects)
- setup.DisallowBindingRedirects = true;
-#endif
-
-#if !FEATURE_CORECLR
- if (propertyNames != null) {
- BCLDebug.Assert(propertyValues != null, "propertyValues != null");
- BCLDebug.Assert(propertyNames.Length == propertyValues.Length, "propertyNames.Length == propertyValues.Length");
-
- for (int i = 0; i < propertyNames.Length; ++i) {
- if (String.Equals(propertyNames[i], "PARTIAL_TRUST_VISIBLE_ASSEMBLIES", StringComparison.Ordinal)) {
- // The value of the PARTIAL_TRUST_VISIBLE_ASSEMBLIES property is a semicolon
- // delimited list of assembly names to add to the
- // PartialTrustVisibleAssemblies setting of the domain setup
- if (propertyValues[i] != null) {
- if (propertyValues[i].Length > 0) {
- setup.PartialTrustVisibleAssemblies = propertyValues[i].Split(';');
- }
- else {
- setup.PartialTrustVisibleAssemblies = new string[0];
- }
- }
- }
- else {
- // In v4 we disallow anything but PARTIAL_TRUST_VISIBLE_ASSEMBLIES to come
- // in via the default domain properties. That restriction could be lifted
- // in a future release, at which point this assert should be removed.
- //
- // This should be kept in sync with the real externally facing filter code
- // in CorHost2::SetPropertiesForDefaultAppDomain
- BCLDebug.Assert(false, "Unexpected default domain property");
- }
- }
- }
-#endif // !FEATURE_CORECLR
-
-#if FEATURE_APTCA
- // Propigate the set of conditional APTCA assemblies that will be used in the default
- // domain onto the domain itself and also into the VM
- PartialTrustVisibleAssemblies = setup.PartialTrustVisibleAssemblies;
-#endif // FEATURE_APTCA
-
SetupFusionStore(setup, null);
}
}
}
#if FEATURE_LOADER_OPTIMIZATION
- [System.Security.SecurityCritical] // auto-generated
private void SetupLoaderOptimization(LoaderOptimization policy)
{
if(policy != LoaderOptimization.NotSpecified) {
- Contract.Assert(FusionStore.LoaderOptimization == LoaderOptimization.NotSpecified,
+ Debug.Assert(FusionStore.LoaderOptimization == LoaderOptimization.NotSpecified,
"It is illegal to change the Loader optimization on a domain");
FusionStore.LoaderOptimization = policy;
@@ -4024,36 +2324,10 @@ namespace System {
}
}
#endif
-
-#if FEATURE_FUSION
- [System.Security.SecurityCritical] // auto-generated
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal extern IntPtr GetFusionContext();
-#endif // FEATURE_FUSION
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal extern IntPtr GetSecurityDescriptor();
-#if FEATURE_REMOTING
- [System.Security.SecurityCritical] // auto-generated
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern AppDomain nCreateDomain(String friendlyName,
- AppDomainSetup setup,
- Evidence providedSecurityInfo,
- Evidence creatorsSecurityInfo,
- IntPtr parentSecurityDescriptor);
-
- [System.Security.SecurityCritical] // auto-generated
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern ObjRef nCreateInstance(String friendlyName,
- AppDomainSetup setup,
- Evidence providedSecurityInfo,
- Evidence creatorsSecurityInfo,
- IntPtr parentSecurityDescriptor);
-#endif
-
- [SecurityCritical]
private void SetupDomainSecurity(Evidence appDomainEvidence,
IntPtr creatorsSecurityDescriptor,
bool publishAppDomain)
@@ -4066,7 +2340,6 @@ namespace System {
}
- [SecurityCritical]
[SuppressUnmanagedCodeSecurity]
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
private static extern void SetupDomainSecurity(AppDomainHandle appDomain,
@@ -4074,7 +2347,6 @@ namespace System {
IntPtr creatorsSecurityDescriptor,
[MarshalAs(UnmanagedType.Bool)] bool publishAppDomain);
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern void nSetupFriendlyName(string friendlyName);
@@ -4084,39 +2356,10 @@ namespace System {
#endif // FEATURE_COMINTEROP
#if FEATURE_LOADER_OPTIMIZATION
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal extern void UpdateLoaderOptimization(LoaderOptimization optimization);
#endif
-#if FEATURE_FUSION
- //
- // This is just designed to prevent compiler warnings.
- // This field is used from native, but we need to prevent the compiler warnings.
- //
-
- [System.Security.SecurityCritical] // auto-generated_required
- [Obsolete("AppDomain.SetShadowCopyPath has been deprecated. Please investigate the use of AppDomainSetup.ShadowCopyDirectories instead. http://go.microsoft.com/fwlink/?linkid=14202")]
- public void SetShadowCopyPath(String path)
- {
- InternalSetShadowCopyPath(path);
- }
-
- [System.Security.SecurityCritical] // auto-generated_required
- [Obsolete("AppDomain.SetShadowCopyFiles has been deprecated. Please investigate the use of AppDomainSetup.ShadowCopyFiles instead. http://go.microsoft.com/fwlink/?linkid=14202")]
- public void SetShadowCopyFiles()
- {
- InternalSetShadowCopyFiles();
- }
-
- [System.Security.SecurityCritical] // auto-generated_required
- [Obsolete("AppDomain.SetDynamicBase has been deprecated. Please investigate the use of AppDomainSetup.DynamicBase instead. http://go.microsoft.com/fwlink/?linkid=14202")]
- public void SetDynamicBase(String path)
- {
- InternalSetDynamicBase(path);
- }
-#endif // FEATURE_FUSION
-
public AppDomainSetup SetupInformation
{
get {
@@ -4124,84 +2367,19 @@ namespace System {
}
}
-#if FEATURE_FUSION
- [System.Security.SecurityCritical] // auto-generated
- internal void InternalSetShadowCopyPath(String path)
- {
- if (path != null)
- {
- IntPtr fusionContext = GetFusionContext();
- AppDomainSetup.UpdateContextProperty(fusionContext, AppDomainSetup.ShadowCopyDirectoriesKey, path);
- }
- FusionStore.ShadowCopyDirectories = path;
- }
-
- [System.Security.SecurityCritical] // auto-generated
- internal void InternalSetShadowCopyFiles()
- {
- IntPtr fusionContext = GetFusionContext();
- AppDomainSetup.UpdateContextProperty(fusionContext, AppDomainSetup.ShadowCopyFilesKey, "true");
- FusionStore.ShadowCopyFiles = "true";
- }
-
- [System.Security.SecurityCritical] // auto-generated
- internal void InternalSetCachePath(String path)
- {
- FusionStore.CachePath = path;
- if (FusionStore.Value[(int) AppDomainSetup.LoaderInformation.CachePathValue] != null)
- {
- IntPtr fusionContext = GetFusionContext();
- AppDomainSetup.UpdateContextProperty(fusionContext, AppDomainSetup.CachePathKey,
- FusionStore.Value[(int) AppDomainSetup.LoaderInformation.CachePathValue]);
- }
- }
-
- [System.Security.SecurityCritical] // auto-generated
- internal void InternalSetPrivateBinPath(String path)
- {
- IntPtr fusionContext = GetFusionContext();
- AppDomainSetup.UpdateContextProperty(fusionContext, AppDomainSetup.PrivateBinPathKey, path);
- FusionStore.PrivateBinPath = path;
- }
-
- [System.Security.SecurityCritical] // auto-generated
- internal void InternalSetDynamicBase(String path)
- {
- FusionStore.DynamicBase = path;
- if (FusionStore.Value[(int) AppDomainSetup.LoaderInformation.DynamicBaseValue] != null)
- {
- IntPtr fusionContext = GetFusionContext();
- AppDomainSetup.UpdateContextProperty(fusionContext, AppDomainSetup.DynamicBaseKey,
- FusionStore.Value[(int) AppDomainSetup.LoaderInformation.DynamicBaseValue]);
- }
- }
-#endif // FEATURE_FUSION
-
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal extern String IsStringInterned(String str);
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal extern String GetOrInternString(String str);
- [SecurityCritical]
[SuppressUnmanagedCodeSecurity]
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
private static extern void GetGrantSet(AppDomainHandle domain, ObjectHandleOnStack retGrantSet);
-#if FEATURE_CAS_POLICY
- [SecurityCritical]
- [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
- [SuppressUnmanagedCodeSecurity]
- [return: MarshalAs(UnmanagedType.Bool)]
- private static extern bool GetIsLegacyCasPolicyEnabled(AppDomainHandle domain);
-#endif // FEATURE_CAS_POLICY
-
public PermissionSet PermissionSet
{
// SecurityCritical because permissions can contain sensitive information such as paths
- [SecurityCritical]
get
{
PermissionSet grantSet = null;
@@ -4220,7 +2398,6 @@ namespace System {
public bool IsFullyTrusted
{
- [SecuritySafeCritical]
get
{
PermissionSet grantSet = null;
@@ -4239,62 +2416,9 @@ namespace System {
}
}
-#if FEATURE_CAS_POLICY
- internal bool IsLegacyCasPolicyEnabled
- {
- [SecuritySafeCritical]
- get
- {
- return GetIsLegacyCasPolicyEnabled(GetNativeHandle());
- }
- }
-
- // Determine what this homogenous domain thinks the grant set should be for a specific set of evidence
- [SecuritySafeCritical]
- internal PermissionSet GetHomogenousGrantSet(Evidence evidence)
- {
- Contract.Assert(evidence != null);
- Contract.Assert(IsHomogenous);
- Contract.Assert(evidence.GetHostEvidence<GacInstalled>() == null);
-
- if (_IsFastFullTrustDomain)
- {
- return new PermissionSet(PermissionState.Unrestricted);
- }
-
- // If the ApplicationTrust's full trust list calls out the assembly, then it is fully trusted
- if (evidence.GetDelayEvaluatedHostEvidence<StrongName>() != null)
- {
- foreach (StrongName fullTrustAssembly in ApplicationTrust.FullTrustAssemblies)
- {
- StrongNameMembershipCondition sn = new StrongNameMembershipCondition(fullTrustAssembly.PublicKey,
- fullTrustAssembly.Name,
- fullTrustAssembly.Version);
-
- object usedEvidence = null;
- if ((sn as IReportMatchMembershipCondition).Check(evidence, out usedEvidence))
- {
- IDelayEvaluatedEvidence delayEvidence = usedEvidence as IDelayEvaluatedEvidence;
- if (usedEvidence != null)
- {
- delayEvidence.MarkUsed();
- }
-
- return new PermissionSet(PermissionState.Unrestricted);
- }
- }
- }
-
- // Otherwise, the grant set is just the default grant set
- return ApplicationTrust.DefaultGrantSet.PermissionSet.Copy();
- }
-#endif // FEATURE_CAS_POLICY
-
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern void nChangeSecurityPolicy();
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
[ReliabilityContract(Consistency.MayCorruptAppDomain, Cer.MayFail)]
internal static extern void nUnload(Int32 domainInternal);
@@ -4309,7 +2433,6 @@ namespace System {
return oh.Unwrap();
} // CreateInstanceAndUnwrap
-
public Object CreateInstanceAndUnwrap(String assemblyName,
String typeName,
Object[] activationAttributes)
@@ -4454,7 +2577,6 @@ namespace System {
}
}
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
internal extern Int32 GetId();
@@ -4468,76 +2590,35 @@ namespace System {
return false;
}
-#if FEATURE_FUSION
- private static AppDomainSetup InternalCreateDomainSetup(String imageLocation)
- {
- int i = imageLocation.LastIndexOf('\\');
-
- Contract.Assert(i != -1, "invalid image location");
-
- AppDomainSetup info = new AppDomainSetup();
- info.ApplicationBase = imageLocation.Substring(0, i+1);
-
- StringBuilder config = new StringBuilder(imageLocation.Substring(i+1));
- config.Append(AppDomainSetup.ConfigurationExtension);
- info.ConfigurationFile = config.ToString();
-
- return info;
- }
-
- // Used by the validator for testing but not executing an assembly
- private static AppDomain InternalCreateDomain(String imageLocation)
- {
- AppDomainSetup info = InternalCreateDomainSetup(imageLocation);
- return CreateDomain("Validator",
- null,
- info);
- }
-
- [System.Security.SecurityCritical] // auto-generated
- private void InternalSetDomainContext(String imageLocation)
- {
- SetupFusionStore(InternalCreateDomainSetup(imageLocation), null);
- }
-#endif
-
#if FEATURE_APPDOMAIN_RESOURCE_MONITORING
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern void nEnableMonitoring();
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern bool nMonitoringIsEnabled();
// return -1 if ARM is not supported.
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern Int64 nGetTotalProcessorTime();
// return -1 if ARM is not supported.
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern Int64 nGetTotalAllocatedMemorySize();
// return -1 if ARM is not supported.
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern Int64 nGetLastSurvivedMemorySize();
// return -1 if ARM is not supported.
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern Int64 nGetLastSurvivedProcessMemorySize();
public static bool MonitoringIsEnabled
{
- [System.Security.SecurityCritical]
get {
return nMonitoringIsEnabled();
}
- [System.Security.SecurityCritical]
set {
if (value == false)
{
@@ -4554,7 +2635,6 @@ namespace System {
// Throws NotSupportedException if ARM is not enabled.
public TimeSpan MonitoringTotalProcessorTime
{
- [System.Security.SecurityCritical]
get {
Int64 i64ProcessorTime = nGetTotalProcessorTime();
if (i64ProcessorTime == -1)
@@ -4570,7 +2650,6 @@ namespace System {
// Throws NotSupportedException if ARM is not enabled.
public Int64 MonitoringTotalAllocatedMemorySize
{
- [System.Security.SecurityCritical]
get {
Int64 i64AllocatedMemory = nGetTotalAllocatedMemorySize();
if (i64AllocatedMemory == -1)
@@ -4588,7 +2667,6 @@ namespace System {
// Throws NotSupportedException if ARM is not enabled.
public Int64 MonitoringSurvivedMemorySize
{
- [System.Security.SecurityCritical]
get {
Int64 i64LastSurvivedMemory = nGetLastSurvivedMemorySize();
if (i64LastSurvivedMemory == -1)
@@ -4608,7 +2686,6 @@ namespace System {
// Throws NotSupportedException if ARM is not enabled.
public static Int64 MonitoringSurvivedProcessMemorySize
{
- [System.Security.SecurityCritical]
get {
Int64 i64LastSurvivedProcessMemory = nGetLastSurvivedProcessMemorySize();
if (i64LastSurvivedProcessMemory == -1)
@@ -4619,49 +2696,8 @@ namespace System {
}
}
#endif
-
-#if !FEATURE_CORECLR
- // this method is required so Object.GetType is not made virtual by the compiler
- // _AppDomain.GetType()
- public new Type GetType()
- {
- return base.GetType();
- }
-
- void _AppDomain.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _AppDomain.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _AppDomain.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- // If you implement this method, make sure to include _AppDomain.Invoke in VM\DangerousAPIs.h and
- // include _AppDomain in SystemDomain::IsReflectionInvocationMethod in AppDomain.cpp.
- void _AppDomain.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
}
- // CallBacks provide a facility to request execution of some code
- // in another context/appDomain.
- // CrossAppDomainDelegate type is defined for appdomain call backs.
- // The delegate used to request a callbak through the DoCallBack method
- // must be of CrossContextDelegate type.
-#if FEATURE_REMOTING
-[System.Runtime.InteropServices.ComVisible(true)]
- public delegate void CrossAppDomainDelegate();
-#endif
-
/// <summary>
/// Handle used to marshal an AppDomain to the VM (eg QCall). When marshaled via a QCall, the target
/// method in the VM will recieve a QCall::AppDomainHandle parameter.
diff --git a/src/mscorlib/src/System/AppDomainManager.cs b/src/mscorlib/src/System/AppDomainManager.cs
index 291099e..71bc088 100644
--- a/src/mscorlib/src/System/AppDomainManager.cs
+++ b/src/mscorlib/src/System/AppDomainManager.cs
@@ -8,151 +8,28 @@
// participate in the creation and control the settings of new AppDomains.
//
-namespace System {
- using System.Collections;
- using System.Globalization;
- using System.IO;
+namespace System
+{
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
- using System.Security.Permissions;
- using System.Security.Policy;
- using System.Threading;
-#if FEATURE_CLICKONCE
- using System.Runtime.Hosting;
-#endif
- using System.Runtime.Versioning;
using System.Runtime.InteropServices;
- using System.Diagnostics.Contracts;
-#if FEATURE_APPDOMAINMANAGER_INITOPTIONS
- [Flags]
[System.Runtime.InteropServices.ComVisible(true)]
- public enum AppDomainManagerInitializationOptions {
- None = 0x0000,
- RegisterWithHost = 0x0001
- }
-#endif // FEATURE_APPDOMAINMANAGER_INITOPTIONS
-
- [System.Security.SecurityCritical] // auto-generated_required
- [System.Runtime.InteropServices.ComVisible(true)]
-#if !FEATURE_CORECLR
- [SecurityPermissionAttribute(SecurityAction.InheritanceDemand, Flags = SecurityPermissionFlag.Infrastructure)]
-#endif
-#if FEATURE_REMOTING
- public class AppDomainManager : MarshalByRefObject {
-#else // FEATURE_REMOTING
- public class AppDomainManager {
-#endif // FEATURE_REMOTING
+ public class AppDomainManager : MarshalByRefObject
+ {
public AppDomainManager () {}
-#if FEATURE_REMOTING
- [System.Security.SecurityCritical] // auto-generated
- public virtual AppDomain CreateDomain (string friendlyName,
- Evidence securityInfo,
- AppDomainSetup appDomainInfo) {
- return CreateDomainHelper(friendlyName, securityInfo, appDomainInfo);
- }
-
- [System.Security.SecurityCritical] // auto-generated_required
- [SecurityPermissionAttribute(SecurityAction.Demand, ControlAppDomain = true)]
- protected static AppDomain CreateDomainHelper (string friendlyName,
- Evidence securityInfo,
- AppDomainSetup appDomainInfo) {
- if (friendlyName == null)
- throw new ArgumentNullException("friendlyName", Environment.GetResourceString("ArgumentNull_String"));
-
- Contract.EndContractBlock();
- // If evidence is provided, we check to make sure that is allowed.
- if (securityInfo != null) {
- new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
-
- // Check the evidence to ensure that if it expects a sandboxed domain, it actually gets one.
- AppDomain.CheckDomainCreationEvidence(appDomainInfo, securityInfo);
- }
-
- if (appDomainInfo == null) {
- appDomainInfo = new AppDomainSetup();
- }
-
- // If there was no specified AppDomainManager for the new domain, default it to being the same
- // as the current domain's AppDomainManager.
- if (appDomainInfo.AppDomainManagerAssembly == null || appDomainInfo.AppDomainManagerType == null) {
- string inheritedDomainManagerAssembly;
- string inheritedDomainManagerType;
-
- AppDomain.CurrentDomain.GetAppDomainManagerType(out inheritedDomainManagerAssembly,
- out inheritedDomainManagerType);
- if (appDomainInfo.AppDomainManagerAssembly == null) {
- appDomainInfo.AppDomainManagerAssembly = inheritedDomainManagerAssembly;
- }
- if (appDomainInfo.AppDomainManagerType == null) {
- appDomainInfo.AppDomainManagerType = inheritedDomainManagerType;
- }
- }
-
- // If there was no specified TargetFrameworkName for the new domain, default it to the current domain's.
- if (appDomainInfo.TargetFrameworkName == null)
- appDomainInfo.TargetFrameworkName = AppDomain.CurrentDomain.GetTargetFrameworkName();
-
- return AppDomain.nCreateDomain(friendlyName,
- appDomainInfo,
- securityInfo,
- securityInfo == null ? AppDomain.CurrentDomain.InternalEvidence : null,
- AppDomain.CurrentDomain.GetSecurityDescriptor());
- }
-#endif // FEATURE_REMOTING
-
- [System.Security.SecurityCritical]
- public virtual void InitializeNewDomain (AppDomainSetup appDomainInfo) {
+ public virtual void InitializeNewDomain (AppDomainSetup appDomainInfo)
+ {
// By default, InitializeNewDomain does nothing. AppDomain.CreateAppDomainManager relies on this fact.
}
-#if FEATURE_APPDOMAINMANAGER_INITOPTIONS
-
- private AppDomainManagerInitializationOptions m_flags = AppDomainManagerInitializationOptions.None;
- public AppDomainManagerInitializationOptions InitializationFlags {
- get {
- return m_flags;
- }
- set {
- m_flags = value;
- }
- }
-#endif // FEATURE_APPDOMAINMANAGER_INITOPTIONS
-
-#if FEATURE_CLICKONCE
- private ApplicationActivator m_appActivator = null;
- public virtual ApplicationActivator ApplicationActivator {
- get {
- if (m_appActivator == null)
- m_appActivator = new ApplicationActivator();
- return m_appActivator;
- }
- }
-#endif //#if FEATURE_CLICKONCE
-
-#if FEATURE_CAS_POLICY
- public virtual HostSecurityManager HostSecurityManager {
- get {
- return null;
- }
- }
-
- public virtual HostExecutionContextManager HostExecutionContextManager {
- get {
- // By default, the AppDomainManager returns the HostExecutionContextManager.
- return HostExecutionContextManager.GetInternalHostExecutionContextManager();
- }
- }
-#endif // FEATURE_CAS_POLICY
-
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode), SuppressUnmanagedCodeSecurity]
private static extern void GetEntryAssembly(ObjectHandleOnStack retAssembly);
private Assembly m_entryAssembly = null;
public virtual Assembly EntryAssembly {
- [System.Security.SecurityCritical] // auto-generated
get {
// The default AppDomainManager sets the EntryAssembly depending on whether the
// AppDomain is a manifest application domain or not. In the first case, we parse
@@ -160,14 +37,6 @@ namespace System {
// In the second case, we maintain the old behavior by calling GetEntryAssembly().
if (m_entryAssembly == null)
{
-
-#if FEATURE_CLICKONCE
- AppDomain domain = AppDomain.CurrentDomain;
- if (domain.IsDefaultAppDomain() && domain.ActivationContext != null) {
- ManifestRunner runner = new ManifestRunner(domain, domain.ActivationContext);
- m_entryAssembly = runner.EntryAssembly;
- } else
-#endif //#if FEATURE_CLICKONCE
{
RuntimeAssembly entryAssembly = null;
GetEntryAssembly(JitHelpers.GetObjectHandleOnStack(ref entryAssembly));
@@ -179,7 +48,6 @@ namespace System {
}
internal static AppDomainManager CurrentAppDomainManager {
- [System.Security.SecurityCritical] // auto-generated
get {
return AppDomain.CurrentDomain.DomainManager;
}
@@ -189,32 +57,5 @@ namespace System {
{
return false;
}
-
-#if FEATURE_APPDOMAINMANAGER_INITOPTIONS
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static extern bool HasHost();
-
- [DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
- [SecurityCritical]
- [SuppressUnmanagedCodeSecurity]
- private static extern void RegisterWithHost(IntPtr appDomainManager);
-
- internal void RegisterWithHost() {
- if (HasHost()) {
- IntPtr punkAppDomainManager = IntPtr.Zero;
-
- RuntimeHelpers.PrepareConstrainedRegions();
- try {
- punkAppDomainManager = Marshal.GetIUnknownForObject(this);
- RegisterWithHost(punkAppDomainManager);
- }
- finally {
- if (!punkAppDomainManager.IsNull()) {
- Marshal.Release(punkAppDomainManager);
- }
- }
- }
- }
-#endif // FEATURE_APPDOMAINMANAGER_INITOPTIONS
}
}
diff --git a/src/mscorlib/src/System/AppDomainSetup.cs b/src/mscorlib/src/System/AppDomainSetup.cs
index f1057da..fc8a64c 100644
--- a/src/mscorlib/src/System/AppDomainSetup.cs
+++ b/src/mscorlib/src/System/AppDomainSetup.cs
@@ -13,28 +13,16 @@
**
=============================================================================*/
-namespace System {
- using System;
-#if FEATURE_CLICKONCE
- using System.Deployment.Internal.Isolation;
- using System.Deployment.Internal.Isolation.Manifest;
- using System.Runtime.Hosting;
-#endif
- using System.Runtime.CompilerServices;
- using System.Runtime;
+namespace System
+{
using System.Text;
- using System.Threading;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
- using System.Reflection;
using System.Security;
- using System.Security.Permissions;
using System.Security.Policy;
- using System.Globalization;
using Path = System.IO.Path;
- using System.Runtime.Versioning;
+ using System.Diagnostics;
using System.Diagnostics.Contracts;
- using System.Collections;
using System.Collections.Generic;
[Serializable]
@@ -75,10 +63,6 @@ namespace System {
private const string MACHINE_CONFIGURATION_FILE = "config\\machine.config";
private const string ACTAG_HOST_CONFIG_FILE = "HOST_CONFIG";
-#if FEATURE_FUSION
- private const string LICENSE_FILE = "LICENSE_FILE";
-#endif
-
// Constants from fusionpriv.h
private const string ACTAG_APP_CONFIG_FILE = "APP_CONFIG_FILE";
private const string ACTAG_MACHINE_CONFIG = "MACHINE_CONFIG";
@@ -109,14 +93,9 @@ namespace System {
private AppDomainInitializer _AppDomainInitializer;
[OptionalField(VersionAdded = 2)]
private string[] _AppDomainInitializerArguments;
-#if FEATURE_CLICKONCE
- [OptionalField(VersionAdded = 2)]
- private ActivationArguments _ActivationArguments;
-#endif
-#if FEATURE_CORECLR
+
// On the CoreCLR, this contains just the name of the permission set that we install in the new appdomain.
// Not the ToXml().ToString() of an ApplicationTrust object.
-#endif
[OptionalField(VersionAdded = 2)]
private string _ApplicationTrust;
[OptionalField(VersionAdded = 2)]
@@ -130,11 +109,6 @@ namespace System {
[OptionalField(VersionAdded = 4)]
private string _AppDomainManagerType;
-#if FEATURE_APTCA
- [OptionalField(VersionAdded = 4)]
- private string[] _AptcaVisibleAssemblies;
-#endif
-
// A collection of strings used to indicate which breaking changes shouldn't be applied
// to an AppDomain. We only use the keys, the values are ignored.
[OptionalField(VersionAdded = 4)]
@@ -143,11 +117,6 @@ namespace System {
[OptionalField(VersionAdded = 5)] // This was added in .NET FX v4.5
private String _TargetFrameworkName;
-#if !FEATURE_CORECLR
- [NonSerialized]
- internal AppDomainSortingSetupInfo _AppDomainSortingSetupInfo;
-#endif
-
[OptionalField(VersionAdded = 5)] // This was added in .NET FX v4.5
private bool _CheckedForTargetFrameworkName;
@@ -156,7 +125,6 @@ namespace System {
private bool _UseRandomizedStringHashing;
#endif
- [SecuritySafeCritical]
internal AppDomainSetup(AppDomainSetup copy, bool copyDomainBoundData)
{
string[] mine = Value;
@@ -180,10 +148,8 @@ namespace System {
_LoaderOptimization = copy._LoaderOptimization;
_AppDomainInitializerArguments = copy.AppDomainInitializerArguments;
-#if FEATURE_CLICKONCE
- _ActivationArguments = copy.ActivationArguments;
-#endif
_ApplicationTrust = copy._ApplicationTrust;
+
if (copyDomainBoundData)
_AppDomainInitializer = copy.AppDomainInitializer;
else
@@ -195,21 +161,12 @@ namespace System {
#endif // FEATURE_COMINTEROP
_AppDomainManagerAssembly = copy.AppDomainManagerAssembly;
_AppDomainManagerType = copy.AppDomainManagerType;
-#if FEATURE_APTCA
- _AptcaVisibleAssemblies = copy.PartialTrustVisibleAssemblies;
-#endif
if (copy._CompatFlags != null)
{
SetCompatibilitySwitches(copy._CompatFlags.Keys);
}
-#if !FEATURE_CORECLR
- if(copy._AppDomainSortingSetupInfo != null)
- {
- _AppDomainSortingSetupInfo = new AppDomainSortingSetupInfo(copy._AppDomainSortingSetupInfo);
- }
-#endif
_TargetFrameworkName = copy._TargetFrameworkName;
#if FEATURE_RANDOMIZED_STRING_HASHING
@@ -226,32 +183,6 @@ namespace System {
_LoaderOptimization = LoaderOptimization.NotSpecified;
}
-#if FEATURE_CLICKONCE
- // Creates an AppDomainSetup object from an application identity.
- public AppDomainSetup (ActivationContext activationContext) : this (new ActivationArguments(activationContext)) {}
-
- [System.Security.SecuritySafeCritical] // auto-generated
- public AppDomainSetup (ActivationArguments activationArguments) {
- if (activationArguments == null)
- throw new ArgumentNullException("activationArguments");
- Contract.EndContractBlock();
-
- _LoaderOptimization = LoaderOptimization.NotSpecified;
- ActivationArguments = activationArguments;
-
- Contract.Assert(activationArguments.ActivationContext != null, "Cannot set base directory without activation context");
- string entryPointPath = CmsUtils.GetEntryPointFullPath(activationArguments);
- if (!String.IsNullOrEmpty(entryPointPath))
- SetupDefaults(entryPointPath);
- else
- ApplicationBase = activationArguments.ActivationContext.ApplicationDirectory;
-
- }
-#endif // !FEATURE_CLICKONCE
-
- #if FEATURE_CORECLR
- [System.Security.SecurityCritical] // auto-generated
- #endif
internal void SetupDefaults(string imageLocation, bool imageLocationAlreadyNormalized = false) {
char[] sep = {'\\', '/'};
int i = imageLocation.LastIndexOfAny(sep);
@@ -297,37 +228,13 @@ namespace System {
set { _AppDomainManagerType = value; }
}
-#if FEATURE_APTCA
- public string[] PartialTrustVisibleAssemblies
- {
- get { return _AptcaVisibleAssemblies; }
- set {
- if (value != null) {
- _AptcaVisibleAssemblies = (string[])value.Clone();
- Array.Sort<string>(_AptcaVisibleAssemblies, StringComparer.OrdinalIgnoreCase);
- }
- else {
- _AptcaVisibleAssemblies = null;
- }
- }
- }
-#endif
-
public String ApplicationBase
{
- #if FEATURE_CORECLR
- [System.Security.SecurityCritical] // auto-generated
- #else
- [System.Security.SecuritySafeCritical]
- #endif
[Pure]
get {
return VerifyDir(GetUnsecureApplicationBase(), false);
}
- #if FEATURE_CORECLR
- [System.Security.SecurityCritical] // auto-generated
- #endif
set {
Value[(int) LoaderInformation.ApplicationBaseValue] = NormalizePath(value, false);
}
@@ -550,7 +457,6 @@ namespace System {
public String ConfigurationFile
{
- [System.Security.SecuritySafeCritical] // auto-generated
get {
return VerifyDir(Value[(int) LoaderInformation.ConfigurationFileValue], true);
}
@@ -604,15 +510,6 @@ namespace System {
public void SetCompatibilitySwitches(IEnumerable<String> switches)
{
-
-#if !FEATURE_CORECLR
- if(_AppDomainSortingSetupInfo != null)
- {
- _AppDomainSortingSetupInfo._useV2LegacySorting = false;
- _AppDomainSortingSetupInfo._useV4LegacySorting = false;
- }
-#endif
-
#if FEATURE_RANDOMIZED_STRING_HASHING
_UseRandomizedStringHashing = false;
#endif
@@ -621,30 +518,11 @@ namespace System {
_CompatFlags = new Dictionary<string, object>();
foreach (String str in switches)
{
-#if !FEATURE_CORECLR
- if(StringComparer.OrdinalIgnoreCase.Equals("NetFx40_Legacy20SortingBehavior", str)) {
- if(_AppDomainSortingSetupInfo == null)
- {
- _AppDomainSortingSetupInfo = new AppDomainSortingSetupInfo();
- }
- _AppDomainSortingSetupInfo._useV2LegacySorting = true;
- }
-
- if(StringComparer.OrdinalIgnoreCase.Equals("NetFx45_Legacy40SortingBehavior", str)) {
- if(_AppDomainSortingSetupInfo == null)
- {
- _AppDomainSortingSetupInfo = new AppDomainSortingSetupInfo();
- }
- _AppDomainSortingSetupInfo._useV4LegacySorting = true;
- }
-#endif
-
#if FEATURE_RANDOMIZED_STRING_HASHING
if(StringComparer.OrdinalIgnoreCase.Equals("UseRandomizedStringHashAlgorithm", str)) {
_UseRandomizedStringHashing = true;
}
#endif
-
_CompatFlags.Add(str, null);
}
}
@@ -671,82 +549,12 @@ namespace System {
set { _CheckedForTargetFrameworkName = value; }
}
-#if !FEATURE_CORECLR
- [SecurityCritical]
- public void SetNativeFunction(string functionName, int functionVersion, IntPtr functionPointer)
- {
- if(functionName == null)
- {
- throw new ArgumentNullException("functionName");
- }
-
- if(functionPointer == IntPtr.Zero)
- {
- throw new ArgumentNullException("functionPointer");
- }
-
- if(String.IsNullOrWhiteSpace(functionName))
- {
- throw new ArgumentException(Environment.GetResourceString("Argument_NPMSInvalidName"), "functionName");
- }
-
- Contract.EndContractBlock();
-
- if(functionVersion < 1)
- {
- throw new ArgumentException(Environment.GetResourceString("ArgumentException_MinSortingVersion", 1, functionName));
- }
-
- if(_AppDomainSortingSetupInfo == null)
- {
- _AppDomainSortingSetupInfo = new AppDomainSortingSetupInfo();
- }
-
- if(String.Equals(functionName, "IsNLSDefinedString", StringComparison.OrdinalIgnoreCase))
- {
- _AppDomainSortingSetupInfo._pfnIsNLSDefinedString = functionPointer;
- }
-
- if (String.Equals(functionName, "CompareStringEx", StringComparison.OrdinalIgnoreCase))
- {
- _AppDomainSortingSetupInfo._pfnCompareStringEx = functionPointer;
- }
-
- if (String.Equals(functionName, "LCMapStringEx", StringComparison.OrdinalIgnoreCase))
- {
- _AppDomainSortingSetupInfo._pfnLCMapStringEx = functionPointer;
- }
-
- if (String.Equals(functionName, "FindNLSStringEx", StringComparison.OrdinalIgnoreCase))
- {
- _AppDomainSortingSetupInfo._pfnFindNLSStringEx = functionPointer;
- }
-
- if (String.Equals(functionName, "CompareStringOrdinal", StringComparison.OrdinalIgnoreCase))
- {
- _AppDomainSortingSetupInfo._pfnCompareStringOrdinal = functionPointer;
- }
-
- if (String.Equals(functionName, "GetNLSVersionEx", StringComparison.OrdinalIgnoreCase))
- {
- _AppDomainSortingSetupInfo._pfnGetNLSVersionEx = functionPointer;
- }
-
- if (String.Equals(functionName, "FindStringOrdinal", StringComparison.OrdinalIgnoreCase))
- {
- _AppDomainSortingSetupInfo._pfnFindStringOrdinal = functionPointer;
- }
- }
-#endif
-
public String DynamicBase
{
- [System.Security.SecuritySafeCritical] // auto-generated
get {
return VerifyDir(Value[(int) LoaderInformation.DynamicBaseValue], true);
}
- [System.Security.SecuritySafeCritical] // auto-generated
set {
if (value == null)
Value[(int) LoaderInformation.DynamicBaseValue] = null;
@@ -772,7 +580,6 @@ namespace System {
}
}
-
public bool DisallowPublisherPolicy
{
get
@@ -835,7 +642,6 @@ namespace System {
}
}
- [System.Security.SecurityCritical] // auto-generated
private String VerifyDir(String dir, bool normalize)
{
if (dir != null) {
@@ -844,22 +650,12 @@ namespace System {
else {
if (normalize)
dir = NormalizePath(dir, true);
-
- // The only way AppDomainSetup is exposed in coreclr is through the AppDomainManager
- // and the AppDomainManager is a SecurityCritical type. Also, all callers of callstacks
- // leading from VerifyDir are SecurityCritical. So we can remove the Demand because
- // we have validated that all callers are SecurityCritical
-#if !FEATURE_CORECLR
- if (IsFilePath(dir))
- new FileIOPermission( FileIOPermissionAccess.PathDiscovery, dir ).Demand();
-#endif // !FEATURE_CORECLR
}
}
return dir;
}
- [System.Security.SecurityCritical] // auto-generated
private void VerifyDirList(String dirs)
{
if (dirs != null) {
@@ -873,7 +669,6 @@ namespace System {
internal String DeveloperPath
{
- [System.Security.SecurityCritical] // auto-generated
get {
String dirs = Value[(int) LoaderInformation.DevPathValue];
VerifyDirList(dirs);
@@ -896,7 +691,7 @@ namespace System {
else
fDelimiter = true;
- newPath.Append(Path.GetFullPathInternal(directories[i]));
+ newPath.Append(Path.GetFullPath(directories[i]));
}
}
@@ -988,83 +783,29 @@ namespace System {
}
}
-#if FEATURE_CLICKONCE
- [XmlIgnoreMember]
- public ActivationArguments ActivationArguments {
- [Pure]
- get {
- return _ActivationArguments;
- }
- set {
- _ActivationArguments = value;
- }
- }
-#endif // !FEATURE_CLICKONCE
-
internal ApplicationTrust InternalGetApplicationTrust()
{
-
if (_ApplicationTrust == null) return null;
-
-
-#if FEATURE_CORECLR
ApplicationTrust grantSet = new ApplicationTrust(NamedPermissionSet.GetBuiltInSet(_ApplicationTrust));
-#else
- SecurityElement securityElement = SecurityElement.FromString(_ApplicationTrust);
- ApplicationTrust grantSet = new ApplicationTrust();
- grantSet.FromXml(securityElement);
-#endif
return grantSet;
}
-#if FEATURE_CORECLR
internal void InternalSetApplicationTrust(String permissionSetName)
{
_ApplicationTrust = permissionSetName;
}
-#else
- internal void InternalSetApplicationTrust(ApplicationTrust value)
- {
- if (value != null)
- {
- _ApplicationTrust = value.ToXml().ToString();
- }
- else
- {
- _ApplicationTrust = null;
- }
- }
-#endif
-#if FEATURE_CLICKONCE
- [XmlIgnoreMember]
- public ApplicationTrust ApplicationTrust
- {
- get {
- return InternalGetApplicationTrust();
- }
- set {
- InternalSetApplicationTrust(value);
- }
- }
-#else // FEATURE_CLICKONCE
[XmlIgnoreMember]
internal ApplicationTrust ApplicationTrust
{
- get {
+ get
+ {
return InternalGetApplicationTrust();
}
-#if !FEATURE_CORECLR
- set {
- InternalSetApplicationTrust(value);
- }
-#endif
}
-#endif // FEATURE_CLICKONCE
public String PrivateBinPath
{
- [System.Security.SecuritySafeCritical] // auto-generated
get {
String dirs = Value[(int) LoaderInformation.PrivateBinPathValue];
VerifyDirList(dirs);
@@ -1083,7 +824,6 @@ namespace System {
}
}
-
public String PrivateBinPathProbe
{
get {
@@ -1104,7 +844,6 @@ namespace System {
public String ShadowCopyDirectories
{
- [System.Security.SecuritySafeCritical] // auto-generated
get {
String dirs = Value[(int) LoaderInformation.ShadowCopyDirectoriesValue];
VerifyDirList(dirs);
@@ -1147,7 +886,6 @@ namespace System {
public String CachePath
{
- [System.Security.SecuritySafeCritical] // auto-generated
get {
return VerifyDir(Value[(int) LoaderInformation.CachePathValue], false);
}
@@ -1166,7 +904,6 @@ namespace System {
public String LicenseFile
{
- [System.Security.SecuritySafeCritical] // auto-generated
get {
return VerifyDir(Value[(int) LoaderInformation.LicenseFileValue], true);
}
@@ -1229,203 +966,17 @@ namespace System {
}
}
-#if FEATURE_FUSION
- [SecurityCritical]
- internal bool UpdateContextPropertyIfNeeded(LoaderInformation FieldValue, String FieldKey, String UpdatedField, IntPtr fusionContext, AppDomainSetup oldADS)
- {
- String FieldString = Value[(int) FieldValue],
- OldFieldString = (oldADS == null ? null : oldADS.Value[(int) FieldValue]);
- if (FieldString != OldFieldString) { // Compare references since strings are immutable
- UpdateContextProperty(fusionContext, FieldKey, UpdatedField == null ? FieldString : UpdatedField);
- return true;
- }
-
- return false;
- }
-
- [SecurityCritical]
- internal void UpdateBooleanContextPropertyIfNeeded(LoaderInformation FieldValue, String FieldKey, IntPtr fusionContext, AppDomainSetup oldADS)
- {
- if (Value[(int) FieldValue] != null)
- UpdateContextProperty(fusionContext, FieldKey, "true");
- else if (oldADS != null && oldADS.Value[(int) FieldValue] != null)
- UpdateContextProperty(fusionContext, FieldKey, "false");
- }
-
- [SecurityCritical]
- internal static bool ByteArraysAreDifferent(Byte[] A, Byte[] B)
- {
- int length = A.Length;
- if (length != B.Length)
- return true;
-
- for(int i = 0; i < length; i++) {
- if (A[i] != B[i])
- return true;
- }
-
- return false;
- }
-
- [System.Security.SecurityCritical] // auto-generated
- internal static void UpdateByteArrayContextPropertyIfNeeded(Byte[] NewArray, Byte[] OldArray, String FieldKey, IntPtr fusionContext)
- {
- if ((NewArray != null && OldArray == null) ||
- (NewArray == null && OldArray != null) ||
- (NewArray != null && OldArray != null && ByteArraysAreDifferent(NewArray, OldArray)))
- UpdateContextProperty(fusionContext, FieldKey, NewArray);
- }
-
- [System.Security.SecurityCritical] // auto-generated
- internal void SetupFusionContext(IntPtr fusionContext, AppDomainSetup oldADS)
- {
- UpdateContextPropertyIfNeeded(LoaderInformation.ApplicationBaseValue, ApplicationBaseKey, null, fusionContext, oldADS);
- UpdateContextPropertyIfNeeded(LoaderInformation.PrivateBinPathValue, PrivateBinPathKey, null, fusionContext, oldADS);
- UpdateContextPropertyIfNeeded(LoaderInformation.DevPathValue, DeveloperPathKey, null, fusionContext, oldADS);
-
- UpdateBooleanContextPropertyIfNeeded(LoaderInformation.DisallowPublisherPolicyValue, DisallowPublisherPolicyKey, fusionContext, oldADS);
- UpdateBooleanContextPropertyIfNeeded(LoaderInformation.DisallowCodeDownloadValue, DisallowCodeDownloadKey, fusionContext, oldADS);
- UpdateBooleanContextPropertyIfNeeded(LoaderInformation.DisallowBindingRedirectsValue, DisallowBindingRedirectsKey, fusionContext, oldADS);
- UpdateBooleanContextPropertyIfNeeded(LoaderInformation.DisallowAppBaseProbingValue, DisallowAppBaseProbingKey, fusionContext, oldADS);
-
- if(UpdateContextPropertyIfNeeded(LoaderInformation.ShadowCopyFilesValue, ShadowCopyFilesKey, ShadowCopyFiles, fusionContext, oldADS)) {
-
- // If we are asking for shadow copy directories then default to
- // only to the ones that are in the private bin path.
- if(Value[(int) LoaderInformation.ShadowCopyDirectoriesValue] == null)
- ShadowCopyDirectories = BuildShadowCopyDirectories();
-
- UpdateContextPropertyIfNeeded(LoaderInformation.ShadowCopyDirectoriesValue, ShadowCopyDirectoriesKey, null, fusionContext, oldADS);
- }
-
- UpdateContextPropertyIfNeeded(LoaderInformation.CachePathValue, CachePathKey, null, fusionContext, oldADS);
- UpdateContextPropertyIfNeeded(LoaderInformation.PrivateBinPathProbeValue, PrivateBinPathProbeKey, PrivateBinPathProbe, fusionContext, oldADS);
- UpdateContextPropertyIfNeeded(LoaderInformation.ConfigurationFileValue, ConfigurationFileKey, null, fusionContext, oldADS);
-
- UpdateByteArrayContextPropertyIfNeeded(_ConfigurationBytes, oldADS == null ? null : oldADS.GetConfigurationBytes(), ConfigurationBytesKey, fusionContext);
-
- UpdateContextPropertyIfNeeded(LoaderInformation.ApplicationNameValue, ApplicationNameKey, ApplicationName, fusionContext, oldADS);
- UpdateContextPropertyIfNeeded(LoaderInformation.DynamicBaseValue, DynamicBaseKey, null, fusionContext, oldADS);
-
- // Always add the runtime configuration file to the appdomain
- UpdateContextProperty(fusionContext, MachineConfigKey, RuntimeEnvironment.GetRuntimeDirectoryImpl() + RuntimeConfigurationFile);
-
- String hostBindingFile = RuntimeEnvironment.GetHostBindingFile();
- if(hostBindingFile != null || oldADS != null) // If oldADS != null, we don't know the old value of the hostBindingFile, so we force an update even when hostBindingFile == null.
- UpdateContextProperty(fusionContext, HostBindingKey, hostBindingFile);
- }
-
- [System.Security.SecurityCritical] // auto-generated
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern void UpdateContextProperty(IntPtr fusionContext, string key, Object value);
-#endif // FEATURE_FUSION
-
static internal int Locate(String s)
{
if(String.IsNullOrEmpty(s))
return -1;
-#if FEATURE_FUSION
-
- // verify assumptions hardcoded into the switch below
- Contract.Assert('A' == ACTAG_APP_CONFIG_FILE[0] , "Assumption violated");
- Contract.Assert('A' == ACTAG_APP_NAME[0] , "Assumption violated");
- Contract.Assert('A' == ACTAG_APP_BASE_URL[0] , "Assumption violated");
- Contract.Assert('B' == ACTAG_BINPATH_PROBE_ONLY[0] , "Assumption violated");
- Contract.Assert('C' == ACTAG_APP_CACHE_BASE[0] , "Assumption violated");
- Contract.Assert('D' == ACTAG_DEV_PATH[0] , "Assumption violated");
- Contract.Assert('D' == ACTAG_APP_DYNAMIC_BASE[0] , "Assumption violated");
- Contract.Assert('F' == ACTAG_FORCE_CACHE_INSTALL[0] , "Assumption violated");
- Contract.Assert('L' == LICENSE_FILE[0] , "Assumption violated");
- Contract.Assert('P' == ACTAG_APP_PRIVATE_BINPATH[0] , "Assumption violated");
- Contract.Assert('S' == ACTAG_APP_SHADOW_COPY_DIRS[0], "Assumption violated");
- Contract.Assert('D' == ACTAG_DISALLOW_APPLYPUBLISHERPOLICY[0], "Assumption violated");
- Contract.Assert('C' == ACTAG_CODE_DOWNLOAD_DISABLED[0], "Assumption violated");
- Contract.Assert('D' == ACTAG_DISALLOW_APP_BINDING_REDIRECTS[0], "Assumption violated");
- Contract.Assert('D' == ACTAG_DISALLOW_APP_BASE_PROBING[0], "Assumption violated");
- Contract.Assert('A' == ACTAG_APP_CONFIG_BLOB[0], "Assumption violated");
-
- switch (s[0]) {
- case 'A':
- if (s == ACTAG_APP_CONFIG_FILE) return (int)LoaderInformation.ConfigurationFileValue;
- if (s == ACTAG_APP_NAME) return (int)LoaderInformation.ApplicationNameValue;
- if (s == ACTAG_APP_BASE_URL) return (int)LoaderInformation.ApplicationBaseValue;
- if (s == ACTAG_APP_CONFIG_BLOB) return (int)LoaderInformation.ConfigurationBytesValue;
- break;
- case 'B':
- if (s == ACTAG_BINPATH_PROBE_ONLY) return (int)LoaderInformation.PrivateBinPathProbeValue;
- break;
- case 'C':
- if (s == ACTAG_APP_CACHE_BASE) return (int)LoaderInformation.CachePathValue;
- if (s == ACTAG_CODE_DOWNLOAD_DISABLED) return (int)LoaderInformation.DisallowCodeDownloadValue;
- break;
- case 'D':
- if (s == ACTAG_DEV_PATH) return (int)LoaderInformation.DevPathValue;
- if (s == ACTAG_APP_DYNAMIC_BASE) return (int)LoaderInformation.DynamicBaseValue;
- if (s == ACTAG_DISALLOW_APPLYPUBLISHERPOLICY) return (int)LoaderInformation.DisallowPublisherPolicyValue;
- if (s == ACTAG_DISALLOW_APP_BINDING_REDIRECTS) return (int)LoaderInformation.DisallowBindingRedirectsValue;
- if (s == ACTAG_DISALLOW_APP_BASE_PROBING) return (int)LoaderInformation.DisallowAppBaseProbingValue;
- break;
- case 'F':
- if (s == ACTAG_FORCE_CACHE_INSTALL) return (int)LoaderInformation.ShadowCopyFilesValue;
- break;
- case 'L':
- if (s == LICENSE_FILE) return (int)LoaderInformation.LicenseFileValue;
- break;
- case 'P':
- if (s == ACTAG_APP_PRIVATE_BINPATH) return (int)LoaderInformation.PrivateBinPathValue;
- break;
- case 'S':
- if (s == ACTAG_APP_SHADOW_COPY_DIRS) return (int)LoaderInformation.ShadowCopyDirectoriesValue;
- break;
- }
-#else
- Contract.Assert('A' == ACTAG_APP_BASE_URL[0] , "Assumption violated");
+
+ Debug.Assert('A' == ACTAG_APP_BASE_URL[0] , "Assumption violated");
if (s[0]=='A' && s == ACTAG_APP_BASE_URL)
return (int)LoaderInformation.ApplicationBaseValue;
-#endif //FEATURE_FUSION
-
return -1;
}
-#if FEATURE_FUSION
- private string BuildShadowCopyDirectories()
- {
- // Default to only to the ones that are in the private bin path.
- String binPath = Value[(int) LoaderInformation.PrivateBinPathValue];
- if(binPath == null)
- return null;
-
- StringBuilder result = StringBuilderCache.Acquire();
- String appBase = Value[(int) LoaderInformation.ApplicationBaseValue];
- if(appBase != null) {
- char[] sep = {';'};
- string[] directories = binPath.Split(sep);
- int size = directories.Length;
- bool appendSlash = !( (appBase[appBase.Length-1] == '/') ||
- (appBase[appBase.Length-1] == '\\') );
-
- if (size == 0) {
- result.Append(appBase);
- if (appendSlash)
- result.Append('\\');
- result.Append(binPath);
- }
- else {
- for(int i = 0; i < size; i++) {
- result.Append(appBase);
- if (appendSlash)
- result.Append('\\');
- result.Append(directories[i]);
-
- if (i < size-1)
- result.Append(';');
- }
- }
- }
-
- return StringBuilderCache.GetStringAndRelease(result);
- }
-#endif // FEATURE_FUSION
#if FEATURE_COMINTEROP
public bool SandboxInterop
diff --git a/src/mscorlib/src/System/ApplicationId.cs b/src/mscorlib/src/System/ApplicationId.cs
index fa8be95..93fc37d 100644
--- a/src/mscorlib/src/System/ApplicationId.cs
+++ b/src/mscorlib/src/System/ApplicationId.cs
@@ -33,13 +33,13 @@ namespace System {
public ApplicationId (byte[] publicKeyToken, string name, Version version, string processorArchitecture, string culture) {
if (name == null)
- throw new ArgumentNullException("name");
+ throw new ArgumentNullException(nameof(name));
if (name.Length == 0)
throw new ArgumentException(Environment.GetResourceString("Argument_EmptyApplicationName"));
if (version == null)
- throw new ArgumentNullException("version");
+ throw new ArgumentNullException(nameof(version));
if (publicKeyToken == null)
- throw new ArgumentNullException("publicKeyToken");
+ throw new ArgumentNullException(nameof(publicKeyToken));
Contract.EndContractBlock();
m_publicKeyToken = new byte[publicKeyToken.Length];
diff --git a/src/mscorlib/src/System/ArgIterator.cs b/src/mscorlib/src/System/ArgIterator.cs
index 0ce27ed..c5bc379 100644
--- a/src/mscorlib/src/System/ArgIterator.cs
+++ b/src/mscorlib/src/System/ArgIterator.cs
@@ -16,19 +16,16 @@ namespace System {
[StructLayout(LayoutKind.Sequential)]
public struct ArgIterator
{
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern ArgIterator(IntPtr arglist);
// create an arg iterator that points at the first argument that
// is not statically declared (that is the first ... arg)
// 'arglist' is the value returned by the ARGLIST instruction
- [System.Security.SecuritySafeCritical] // auto-generated
public ArgIterator(RuntimeArgumentHandle arglist) : this(arglist.Value)
{
}
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private unsafe extern ArgIterator(IntPtr arglist, void *ptr);
@@ -36,7 +33,6 @@ namespace System {
// 'arglist' is the value returned by the ARGLIST instruction
// This is much like the C va_start macro
- [System.Security.SecurityCritical] // auto-generated
[CLSCompliant(false)]
public unsafe ArgIterator(RuntimeArgumentHandle arglist, void* ptr) : this(arglist.Value, ptr)
@@ -45,7 +41,6 @@ namespace System {
// Fetch an argument as a typed referece, advance the iterator.
// Throws an exception if past end of argument list
- [System.Security.SecuritySafeCritical] // auto-generated
[CLSCompliant(false)]
public TypedReference GetNextArg()
{
@@ -58,14 +53,12 @@ namespace System {
return result;
}
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
// reference to TypedReference is banned, so have to pass result as void pointer
private unsafe extern void FCallGetNextArg(void * result);
// Alternate version of GetNextArg() intended primarily for IJW code
// generated by VC's "va_arg()" construct.
- [System.Security.SecuritySafeCritical] // auto-generated
[CLSCompliant(false)]
public TypedReference GetNextArg(RuntimeTypeHandle rth)
{
@@ -96,7 +89,6 @@ namespace System {
}
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
// reference to TypedReference is banned, so have to pass result as void pointer
private unsafe extern void InternalGetNextArg(void * result, RuntimeType rt);
@@ -107,16 +99,13 @@ namespace System {
}
// How many arguments are left in the list
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern int GetRemainingCount();
// Gets the type of the current arg, does NOT advance the iterator
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern unsafe void* _GetNextArgType();
- [System.Security.SecuritySafeCritical] // auto-generated
public unsafe RuntimeTypeHandle GetNextArgType()
{
return new RuntimeTypeHandle(Type.GetTypeFromHandleUnsafe((IntPtr)_GetNextArgType()));
diff --git a/src/mscorlib/src/System/ArgumentException.cs b/src/mscorlib/src/System/ArgumentException.cs
index 8edb7e4..f37b769 100644
--- a/src/mscorlib/src/System/ArgumentException.cs
+++ b/src/mscorlib/src/System/ArgumentException.cs
@@ -82,10 +82,9 @@ namespace System {
get { return m_paramName; }
}
- [System.Security.SecurityCritical] // auto-generated_required
public override void GetObjectData(SerializationInfo info, StreamingContext context) {
if (info==null) {
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
}
Contract.EndContractBlock();
base.GetObjectData(info, context);
diff --git a/src/mscorlib/src/System/ArgumentNullException.cs b/src/mscorlib/src/System/ArgumentNullException.cs
index 4bcb537..661ebd2 100644
--- a/src/mscorlib/src/System/ArgumentNullException.cs
+++ b/src/mscorlib/src/System/ArgumentNullException.cs
@@ -48,7 +48,6 @@ namespace System {
SetErrorCode(__HResults.E_POINTER);
}
- [System.Security.SecurityCritical] // auto-generated_required
protected ArgumentNullException(SerializationInfo info, StreamingContext context) : base(info, context) {
}
}
diff --git a/src/mscorlib/src/System/ArgumentOutOfRangeException.cs b/src/mscorlib/src/System/ArgumentOutOfRangeException.cs
index a54380b..78a90db 100644
--- a/src/mscorlib/src/System/ArgumentOutOfRangeException.cs
+++ b/src/mscorlib/src/System/ArgumentOutOfRangeException.cs
@@ -89,10 +89,9 @@ namespace System {
get { return m_actualValue; }
}
- [System.Security.SecurityCritical] // auto-generated_required
public override void GetObjectData(SerializationInfo info, StreamingContext context) {
if (info==null) {
- throw new ArgumentNullException("info");
+ throw new ArgumentNullException(nameof(info));
}
Contract.EndContractBlock();
base.GetObjectData(info, context);
diff --git a/src/mscorlib/src/System/Array.cs b/src/mscorlib/src/System/Array.cs
index 0879049..7bb6ebb 100644
--- a/src/mscorlib/src/System/Array.cs
+++ b/src/mscorlib/src/System/Array.cs
@@ -19,6 +19,7 @@ namespace System {
using System.Runtime.ConstrainedExecution;
using System.Runtime.Versioning;
using System.Security;
+ using System.Diagnostics;
using System.Security.Permissions;
using System.Diagnostics.Contracts;
@@ -64,13 +65,12 @@ namespace System {
}
// Create instance will create an array
- [System.Security.SecuritySafeCritical] // auto-generated
public unsafe static Array CreateInstance(Type elementType, int length)
{
if ((object)elementType == null)
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.elementType);
if (length < 0)
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.length, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
+ ThrowHelper.ThrowLengthArgumentOutOfRange_ArgumentOutOfRange_NeedNonNegNum();
Contract.Ensures(Contract.Result<Array>() != null);
Contract.Ensures(Contract.Result<Array>().Length == length);
Contract.Ensures(Contract.Result<Array>().Rank == 1);
@@ -82,7 +82,6 @@ namespace System {
return InternalCreate((void*)t.TypeHandle.Value,1,&length,null);
}
- [System.Security.SecuritySafeCritical] // auto-generated
public unsafe static Array CreateInstance(Type elementType, int length1, int length2)
{
if ((object)elementType == null)
@@ -105,7 +104,6 @@ namespace System {
return InternalCreate((void*)t.TypeHandle.Value,2,pLengths,null);
}
- [System.Security.SecuritySafeCritical] // auto-generated
public unsafe static Array CreateInstance(Type elementType, int length1, int length2, int length3)
{
if ((object)elementType == null)
@@ -132,7 +130,6 @@ namespace System {
return InternalCreate((void*)t.TypeHandle.Value,3,pLengths,null);
}
- [System.Security.SecuritySafeCritical] // auto-generated
public unsafe static Array CreateInstance(Type elementType, params int[] lengths)
{
if ((object)elementType == null)
@@ -186,7 +183,6 @@ namespace System {
}
- [System.Security.SecuritySafeCritical] // auto-generated
public unsafe static Array CreateInstance(Type elementType, int[] lengths,int[] lowerBounds)
{
if (elementType == null)
@@ -219,41 +215,25 @@ namespace System {
fixed(int* pLowerBounds = lowerBounds)
return InternalCreate((void*)t.TypeHandle.Value,lengths.Length,pLengths,pLowerBounds);
}
- [System.Security.SecurityCritical] // auto-generated
+
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private unsafe static extern Array InternalCreate(void* elementType,int rank,int *pLengths,int *pLowerBounds);
- [SecurityCritical]
-#if !FEATURE_CORECLR
- [PermissionSet(SecurityAction.Assert, Unrestricted = true)]
-#endif
internal static Array UnsafeCreateInstance(Type elementType, int length)
{
return CreateInstance(elementType, length);
}
- [SecurityCritical]
-#if !FEATURE_CORECLR
- [PermissionSet(SecurityAction.Assert, Unrestricted = true)]
-#endif
internal static Array UnsafeCreateInstance(Type elementType, int length1, int length2)
{
return CreateInstance(elementType, length1, length2);
}
- [SecurityCritical]
-#if !FEATURE_CORECLR
- [PermissionSet(SecurityAction.Assert, Unrestricted = true)]
-#endif
internal static Array UnsafeCreateInstance(Type elementType, params int[] lengths)
{
return CreateInstance(elementType, lengths);
}
- [SecurityCritical]
-#if !FEATURE_CORECLR
- [PermissionSet(SecurityAction.Assert, Unrestricted = true)]
-#endif
internal static Array UnsafeCreateInstance(Type elementType, int[] lengths, int[] lowerBounds)
{
return CreateInstance(elementType, lengths, lowerBounds);
@@ -262,7 +242,6 @@ namespace System {
// Copies length elements from sourceArray, starting at index 0, to
// destinationArray, starting at index 0.
//
- [System.Security.SecuritySafeCritical] // auto-generated
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
public static void Copy(Array sourceArray, Array destinationArray, int length)
{
@@ -284,7 +263,6 @@ namespace System {
// Copies length elements from sourceArray, starting at sourceIndex, to
// destinationArray, starting at destinationIndex.
//
- [System.Security.SecuritySafeCritical] // auto-generated
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
public static void Copy(Array sourceArray, int sourceIndex, Array destinationArray, int destinationIndex, int length)
{
@@ -295,7 +273,6 @@ namespace System {
// instance & might fail when called from within a CER, or if the
// reliable flag is true, it will either always succeed or always
// throw an exception with no side effects.
- [System.Security.SecurityCritical] // auto-generated
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern void Copy(Array sourceArray, int sourceIndex, Array destinationArray, int destinationIndex, int length, bool reliable);
@@ -305,7 +282,6 @@ namespace System {
// compatible array types based on the array element type - this
// method does not support casting, boxing, or primitive widening.
// It will up-cast, assuming the array types are correct.
- [System.Security.SecuritySafeCritical] // auto-generated
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static void ConstrainedCopy(Array sourceArray, int sourceIndex, Array destinationArray, int destinationIndex, int length)
{
@@ -338,13 +314,11 @@ namespace System {
// Sets length elements in array to 0 (or null for Object arrays), starting
// at index.
//
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public static extern void Clear(Array array, int index, int length);
// The various Get values...
- [System.Security.SecuritySafeCritical] // auto-generated
public unsafe Object GetValue(params int[] indices)
{
if (indices == null)
@@ -359,7 +333,6 @@ namespace System {
return TypedReference.InternalToObject(&elemref);
}
- [System.Security.SecuritySafeCritical] // auto-generated
public unsafe Object GetValue(int index)
{
if (Rank != 1)
@@ -371,7 +344,6 @@ namespace System {
return TypedReference.InternalToObject(&elemref);
}
- [System.Security.SecuritySafeCritical] // auto-generated
public unsafe Object GetValue(int index1, int index2)
{
if (Rank != 2)
@@ -387,7 +359,6 @@ namespace System {
return TypedReference.InternalToObject(&elemref);
}
- [System.Security.SecuritySafeCritical] // auto-generated
public unsafe Object GetValue(int index1, int index2, int index3)
{
if (Rank != 3)
@@ -463,7 +434,6 @@ namespace System {
}
- [System.Security.SecuritySafeCritical] // auto-generated
public unsafe void SetValue(Object value,int index)
{
if (Rank != 1)
@@ -475,7 +445,6 @@ namespace System {
InternalSetValue(&elemref,value);
}
- [System.Security.SecuritySafeCritical] // auto-generated
public unsafe void SetValue(Object value,int index1, int index2)
{
if (Rank != 2)
@@ -491,7 +460,6 @@ namespace System {
InternalSetValue(&elemref,value);
}
- [System.Security.SecuritySafeCritical] // auto-generated
public unsafe void SetValue(Object value,int index1, int index2, int index3)
{
if (Rank != 3)
@@ -508,7 +476,6 @@ namespace System {
InternalSetValue(&elemref,value);
}
- [System.Security.SecuritySafeCritical] // auto-generated
public unsafe void SetValue(Object value,params int[] indices)
{
if (indices == null)
@@ -581,20 +548,17 @@ namespace System {
this.SetValue(value, intIndices);
}
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
// reference to TypedReference is banned, so have to pass result as pointer
private unsafe extern void InternalGetReference(void * elemRef, int rank, int * pIndices);
// Ideally, we would like to use TypedReference.SetValue instead. Unfortunately, TypedReference.SetValue
// always throws not-supported exception
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private unsafe extern static void InternalSetValue(void * target, Object value);
public extern int Length {
[Pure]
- [System.Security.SecuritySafeCritical] // auto-generated
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
@@ -604,7 +568,7 @@ namespace System {
private static int GetMedian(int low, int hi) {
// Note both may be negative, if we are dealing with arrays w/ negative lower bounds.
Contract.Requires(low <= hi);
- Contract.Assert( hi - low >= 0, "Length overflow!");
+ Debug.Assert( hi - low >= 0, "Length overflow!");
return low + ((hi - low) >> 1);
}
@@ -619,14 +583,12 @@ namespace System {
[ComVisible(false)]
public extern long LongLength {
[Pure]
- [System.Security.SecuritySafeCritical] // auto-generated
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImpl(MethodImplOptions.InternalCall)]
get;
}
[Pure]
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern int GetLength(int dimension);
@@ -639,25 +601,21 @@ namespace System {
public extern int Rank {
[Pure]
- [System.Security.SecuritySafeCritical] // auto-generated
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
get;
}
- [System.Security.SecuritySafeCritical] // auto-generated
[Pure]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
public extern int GetUpperBound(int dimension);
- [System.Security.SecuritySafeCritical] // auto-generated
[Pure]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern int GetLowerBound(int dimension);
- [System.Security.SecurityCritical] // auto-generated
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal extern int GetDataPtrOffsetInternal();
@@ -894,7 +852,6 @@ namespace System {
// is larger than the given search value.
//
[Pure]
- [System.Security.SecuritySafeCritical] // auto-generated
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
public static int BinarySearch(Array array, int index, int length, Object value, IComparer comparer) {
if (array==null)
@@ -904,7 +861,7 @@ namespace System {
if (index < lb)
ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
if (length < 0)
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.length, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
+ ThrowHelper.ThrowLengthArgumentOutOfRange_ArgumentOutOfRange_NeedNonNegNum();
if (array.Length - (index - lb) < length)
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
if (array.Rank != 1)
@@ -965,7 +922,6 @@ namespace System {
return ~lo;
}
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
private static extern bool TrySZBinarySearch(Array sourceArray, int sourceIndex, int count, Object value, out int retVal);
@@ -1002,7 +958,7 @@ namespace System {
if (index < 0)
ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
if (length < 0)
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.length, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
+ ThrowHelper.ThrowLengthArgumentOutOfRange_ArgumentOutOfRange_NeedNonNegNum();
if (array.Length - index < length)
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
@@ -1073,6 +1029,42 @@ namespace System {
return Array.FindIndex(array, match) != -1;
}
+ public static void Fill<T>(T[] array, T value)
+ {
+ if (array == null)
+ {
+ ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
+ }
+
+ for (int i = 0; i < array.Length; i++)
+ {
+ array[i] = value;
+ }
+ }
+
+ public static void Fill<T>(T[] array, T value, int startIndex, int count)
+ {
+ if (array == null)
+ {
+ ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
+ }
+
+ if (startIndex < 0 || startIndex > array.Length)
+ {
+ ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index();
+ }
+
+ if (count < 0 || startIndex > array.Length - count)
+ {
+ ThrowHelper.ThrowCountArgumentOutOfRange_ArgumentOutOfRange_Count();
+ }
+
+ for (int i = startIndex; i < startIndex + count; i++)
+ {
+ array[i] = value;
+ }
+ }
+
public static T Find<T>(T[] array, Predicate<T> match) {
if( array == null) {
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
@@ -1136,11 +1128,11 @@ namespace System {
}
if( startIndex < 0 || startIndex > array.Length ) {
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
+ ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index();
}
if (count < 0 || startIndex > array.Length - count) {
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_Count);
+ ThrowHelper.ThrowCountArgumentOutOfRange_ArgumentOutOfRange_Count();
}
if( match == null) {
@@ -1205,19 +1197,19 @@ namespace System {
if(array.Length == 0) {
// Special case for 0 length List
if( startIndex != -1) {
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
+ ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index();
}
}
else {
// Make sure we're not out of range
if ( startIndex < 0 || startIndex >= array.Length) {
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
+ ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index();
}
}
// 2nd have of this also catches when startIndex == MAXINT, so MAXINT - 0 + 1 == -1, which is < 0.
if (count < 0 || startIndex - count + 1 < 0) {
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_Count);
+ ThrowHelper.ThrowCountArgumentOutOfRange_ArgumentOutOfRange_Count();
}
int endIndex = startIndex - count;
@@ -1293,7 +1285,6 @@ namespace System {
// elements of the array are compared to the given value using the
// Object.Equals method.
//
- [System.Security.SecuritySafeCritical] // auto-generated
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
public static int IndexOf(Array array, Object value, int startIndex, int count) {
if (array==null)
@@ -1305,9 +1296,9 @@ namespace System {
int lb = array.GetLowerBound(0);
if (startIndex < lb || startIndex > array.Length + lb)
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
+ ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index();
if (count < 0 || count > array.Length - startIndex + lb)
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_Count);
+ ThrowHelper.ThrowCountArgumentOutOfRange_ArgumentOutOfRange_Count();
// Try calling a quick native method to handle primitive types.
int retVal;
@@ -1376,11 +1367,11 @@ namespace System {
}
if (startIndex < 0 || startIndex > array.Length ) {
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
+ ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index();
}
if (count < 0 || count > array.Length - startIndex) {
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_Count);
+ ThrowHelper.ThrowCountArgumentOutOfRange_ArgumentOutOfRange_Count();
}
Contract.Ensures(Contract.Result<int>() < array.Length);
Contract.EndContractBlock();
@@ -1388,7 +1379,6 @@ namespace System {
return EqualityComparer<T>.Default.IndexOf(array, value, startIndex, count);
}
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
private static extern bool TrySZIndexOf(Array sourceArray, int sourceIndex, int count, Object value, out int retVal);
@@ -1429,7 +1419,6 @@ namespace System {
// the array are compared to the given value using the Object.Equals
// method.
//
- [System.Security.SecuritySafeCritical] // auto-generated
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
public static int LastIndexOf(Array array, Object value, int startIndex, int count) {
if (array==null)
@@ -1442,9 +1431,9 @@ namespace System {
}
if (startIndex < lb || startIndex >= array.Length + lb)
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
+ ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index();
if (count < 0)
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_Count);
+ ThrowHelper.ThrowCountArgumentOutOfRange_ArgumentOutOfRange_Count();
if (count > startIndex - lb + 1)
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.endIndex, ExceptionResource.ArgumentOutOfRange_EndIndexStartIndex);
if (array.Rank != 1)
@@ -1518,30 +1507,29 @@ namespace System {
// accept -1 and 0 as valid startIndex for compablility reason.
//
if( startIndex != -1 && startIndex != 0) {
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
+ ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index();
}
// only 0 is a valid value for count if array is empty
if( count != 0) {
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_Count);
+ ThrowHelper.ThrowCountArgumentOutOfRange_ArgumentOutOfRange_Count();
}
return -1;
}
// Make sure we're not out of range
if ( startIndex < 0 || startIndex >= array.Length) {
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
+ ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index();
}
// 2nd have of this also catches when startIndex == MAXINT, so MAXINT - 0 + 1 == -1, which is < 0.
if (count < 0 || startIndex - count + 1 < 0) {
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_Count);
+ ThrowHelper.ThrowCountArgumentOutOfRange_ArgumentOutOfRange_Count();
}
return EqualityComparer<T>.Default.LastIndexOf(array, value, startIndex, count);
}
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
private static extern bool TrySZLastIndexOf(Array sourceArray, int sourceIndex, int count, Object value, out int retVal);
@@ -1566,7 +1554,6 @@ namespace System {
// index index + (index + count - i - 1).
// Reliability note: This may fail because it may have to box objects.
//
- [System.Security.SecuritySafeCritical] // auto-generated
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
public static void Reverse(Array array, int index, int length) {
if (array==null)
@@ -1575,7 +1562,7 @@ namespace System {
if (index < lowerBound)
ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
if (length < 0)
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.length, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
+ ThrowHelper.ThrowLengthArgumentOutOfRange_ArgumentOutOfRange_NeedNonNegNum();
if (array.Length - (index - lowerBound) < length)
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
@@ -1610,11 +1597,44 @@ namespace System {
}
}
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
private static extern bool TrySZReverse(Array array, int index, int count);
-
+
+ [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
+ public static void Reverse<T>(T[] array)
+ {
+ if (array == null)
+ ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
+ Contract.EndContractBlock();
+ Reverse(array, 0, array.Length);
+ }
+
+ [ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
+ public static void Reverse<T>(T[] array, int index, int length)
+ {
+ if (array == null)
+ ThrowHelper.ThrowArgumentNullException(ExceptionArgument.array);
+ if (index < 0)
+ ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
+ if (length < 0)
+ ThrowHelper.ThrowLengthArgumentOutOfRange_ArgumentOutOfRange_NeedNonNegNum();
+ if (array.Length - index < length)
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
+ Contract.EndContractBlock();
+
+ int i = index;
+ int j = index + length - 1;
+ while (i < j)
+ {
+ T temp = array[i];
+ array[i] = array[j];
+ array[j] = temp;
+ i++;
+ j--;
+ }
+ }
+
// Sorts the elements of an array. The sort compares the elements to each
// other using the IComparable interface, which must be implemented
// by all elements of the array.
@@ -1710,7 +1730,6 @@ namespace System {
// the IComparable interface, which in that case must be implemented
// by all elements of the given section of the keys array.
//
- [System.Security.SecuritySafeCritical] // auto-generated
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
public static void Sort(Array keys, Array items, int index, int length, IComparer comparer) {
if (keys==null)
@@ -1723,7 +1742,7 @@ namespace System {
if (index < keysLowerBound)
ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
if (length < 0)
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.length, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
+ ThrowHelper.ThrowLengthArgumentOutOfRange_ArgumentOutOfRange_NeedNonNegNum();
if (keys.Length - (index - keysLowerBound) < length || (items != null && (index - keysLowerBound) > items.Length - length))
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
@@ -1752,7 +1771,6 @@ namespace System {
}
}
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
private static extern bool TrySZSort(Array keys, Array items, int left, int right);
@@ -1799,7 +1817,6 @@ namespace System {
Sort<TKey, TValue>(keys, items, 0, keys.Length, comparer);
}
- [System.Security.SecuritySafeCritical] // auto-generated
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
public static void Sort<T>(T[] array, int index, int length, System.Collections.Generic.IComparer<T> comparer) {
if (array==null)
@@ -1807,7 +1824,7 @@ namespace System {
if (index < 0)
ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
if (length < 0)
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.length, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
+ ThrowHelper.ThrowLengthArgumentOutOfRange_ArgumentOutOfRange_NeedNonNegNum();
if (array.Length - index < length)
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
Contract.EndContractBlock();
@@ -1823,7 +1840,6 @@ namespace System {
}
}
- [System.Security.SecuritySafeCritical] // auto-generated
[ReliabilityContract(Consistency.MayCorruptInstance, Cer.MayFail)]
public static void Sort<TKey, TValue>(TKey[] keys, TValue[] items, int index, int length, System.Collections.Generic.IComparer<TKey> comparer) {
if (keys==null)
@@ -1831,7 +1847,7 @@ namespace System {
if (index < 0)
ThrowHelper.ThrowIndexArgumentOutOfRange_NeedNonNegNumException();
if (length < 0)
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.length, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum);
+ ThrowHelper.ThrowLengthArgumentOutOfRange_ArgumentOutOfRange_NeedNonNegNum();
if (keys.Length - index < length || (items != null && index > items.Length - length))
ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidOffLen);
Contract.EndContractBlock();
@@ -1863,8 +1879,7 @@ namespace System {
}
Contract.EndContractBlock();
- IComparer<T> comparer = Comparer<T>.Create(comparison);
- Array.Sort(array, comparer);
+ ArraySortHelper<T>.Sort(array, 0, array.Length, comparison);
}
public static bool TrueForAll<T>(T[] array, Predicate<T> match) {
@@ -1935,120 +1950,7 @@ namespace System {
internal void Sort(int left, int length)
{
-#if FEATURE_CORECLR
- // Since QuickSort and IntrospectiveSort produce different sorting sequence for equal keys the upgrade
- // to IntrospectiveSort was quirked. However since the phone builds always shipped with the new sort aka
- // IntrospectiveSort and we would want to continue using this sort moving forward CoreCLR always uses the new sort.
-
IntrospectiveSort(left, length);
-#else
- if (BinaryCompatibility.TargetsAtLeast_Desktop_V4_5)
- {
- IntrospectiveSort(left, length);
- }
- else
- {
- DepthLimitedQuickSort(left, length + left - 1, IntrospectiveSortUtilities.QuickSortDepthThreshold);
- }
-#endif
- }
-
- private void DepthLimitedQuickSort(int left, int right, int depthLimit)
- {
- // Can use the much faster jit helpers for array access.
- do
- {
- if (depthLimit == 0)
- {
- // Add a try block here to detect IComparers (or their
- // underlying IComparables, etc) that are bogus.
- try
- {
- Heapsort(left, right);
- return;
- }
- catch (IndexOutOfRangeException)
- {
- ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_BogusIComparer, ExceptionArgument.comparer);
- }
- catch (Exception e)
- {
- ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_IComparerFailed, e);
- }
- }
-
- int i = left;
- int j = right;
-
- // pre-sort the low, middle (pivot), and high values in place.
- // this improves performance in the face of already sorted data, or
- // data that is made up of multiple sorted runs appended together.
- int middle = GetMedian(i, j);
-
- // Add a try block here to detect IComparers (or their
- // underlying IComparables, etc) that are bogus.
- try
- {
- SwapIfGreaterWithItems(i, middle); // swap the low with the mid point
- SwapIfGreaterWithItems(i, j); // swap the low with the high
- SwapIfGreaterWithItems(middle, j); // swap the middle with the high
- }
- catch (Exception e)
- {
- ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_IComparerFailed, e);
- }
- Object x = keys[middle];
- do
- {
- // Add a try block here to detect IComparers (or their
- // underlying IComparables, etc) that are bogus.
- try
- {
- while (comparer.Compare(keys[i], x) < 0) i++;
- while (comparer.Compare(x, keys[j]) < 0) j--;
- }
- catch (IndexOutOfRangeException)
- {
- ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_BogusIComparer, ExceptionArgument.comparer);
- }
- catch (Exception e)
- {
- ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_IComparerFailed, e);
- }
- Contract.Assert(i >= left && j <= right, "(i>=left && j<=right) Sort failed - Is your IComparer bogus?");
- if (i > j) break;
- if (i < j)
- {
- Object key = keys[i];
- keys[i] = keys[j];
- keys[j] = key;
- if (items != null)
- {
- Object item = items[i];
- items[i] = items[j];
- items[j] = item;
- }
- }
- i++;
- j--;
- } while (i <= j);
-
- // The next iteration of the while loop is to "recursively" sort the larger half of the array and the
- // following calls recursively sort the smaller half. So we subtract one from depthLimit here so
- // both sorts see the new value.
- depthLimit--;
-
- if (j - left <= right - i)
- {
- if (left < j) DepthLimitedQuickSort(left, j, depthLimit);
- left = i;
- }
- else
- {
- if (i < right) DepthLimitedQuickSort(i, right, depthLimit);
- right = j;
- }
- } while (left < right);
}
private void IntrospectiveSort(int left, int length)
@@ -2254,118 +2156,7 @@ namespace System {
internal void Sort(int left, int length)
{
-#if FEATURE_CORECLR
- // Since QuickSort and IntrospectiveSort produce different sorting sequence for equal keys the upgrade
- // to IntrospectiveSort was quirked. However since the phone builds always shipped with the new sort aka
- // IntrospectiveSort and we would want to continue using this sort moving forward CoreCLR always uses the new sort.
-
IntrospectiveSort(left, length);
-#else
- if (BinaryCompatibility.TargetsAtLeast_Desktop_V4_5)
- {
- IntrospectiveSort(left, length);
- }
- else
- {
- DepthLimitedQuickSort(left, length + left - 1, IntrospectiveSortUtilities.QuickSortDepthThreshold);
- }
-#endif
- }
-
- private void DepthLimitedQuickSort(int left, int right, int depthLimit)
- {
- // Must use slow Array accessors (GetValue & SetValue)
- do
- {
- if (depthLimit == 0)
- {
- // Add a try block here to detect IComparers (or their
- // underlying IComparables, etc) that are bogus.
- try
- {
- Heapsort(left, right);
- return;
- }
- catch (IndexOutOfRangeException)
- {
- ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_BogusIComparer, ExceptionArgument.comparer);
- }
- catch (Exception e)
- {
- ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_IComparerFailed, e);
- }
- }
-
- int i = left;
- int j = right;
-
- // pre-sort the low, middle (pivot), and high values in place.
- // this improves performance in the face of already sorted data, or
- // data that is made up of multiple sorted runs appended together.
- int middle = GetMedian(i, j);
- try
- {
- SwapIfGreaterWithItems(i, middle); // swap the low with the mid point
- SwapIfGreaterWithItems(i, j); // swap the low with the high
- SwapIfGreaterWithItems(middle, j); // swap the middle with the high
- }
- catch (Exception e)
- {
- ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_IComparerFailed, e);
- }
-
- Object x = keys.GetValue(middle);
- do
- {
- // Add a try block here to detect IComparers (or their
- // underlying IComparables, etc) that are bogus.
- try
- {
- while (comparer.Compare(keys.GetValue(i), x) < 0) i++;
- while (comparer.Compare(x, keys.GetValue(j)) < 0) j--;
- }
- catch (IndexOutOfRangeException)
- {
- ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_BogusIComparer, ExceptionArgument.comparer);
- }
- catch (Exception e)
- {
- ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_IComparerFailed, e);
- }
- Contract.Assert(i >= left && j <= right, "(i>=left && j<=right) Sort failed - Is your IComparer bogus?");
- if (i > j) break;
- if (i < j)
- {
- Object key = keys.GetValue(i);
- keys.SetValue(keys.GetValue(j), i);
- keys.SetValue(key, j);
- if (items != null)
- {
- Object item = items.GetValue(i);
- items.SetValue(items.GetValue(j), i);
- items.SetValue(item, j);
- }
- }
- if (i != Int32.MaxValue) ++i;
- if (j != Int32.MinValue) --j;
- } while (i <= j);
-
- // The next iteration of the while loop is to "recursively" sort the larger half of the array and the
- // following calls recursively sort the smaller half. So we subtract one from depthLimit here so
- // both sorts see the new value.
- depthLimit--;
-
- if (j - left <= right - i)
- {
- if (left < j) DepthLimitedQuickSort(left, j, depthLimit);
- left = i;
- }
- else
- {
- if (i < right) DepthLimitedQuickSort(i, right, depthLimit);
- right = j;
- }
- } while (left < right);
}
private void IntrospectiveSort(int left, int length)
@@ -2530,7 +2321,7 @@ namespace System {
private int _endIndex; // cache array length, since it's a little slow.
internal SZArrayEnumerator(Array array) {
- Contract.Assert(array.Rank == 1 && array.GetLowerBound(0) == 0, "SZArrayEnumerator only works on single dimension arrays w/ a lower bound of zero.");
+ Debug.Assert(array.Rank == 1 && array.GetLowerBound(0) == 0, "SZArrayEnumerator only works on single dimension arrays w/ a lower bound of zero.");
_array = array;
_index = -1;
_endIndex = array.Length;
@@ -2551,8 +2342,8 @@ namespace System {
public Object Current {
get {
- if (_index < 0) ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumNotStarted);
- if (_index >= _endIndex) ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumEnded);
+ if (_index < 0) ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumNotStarted();
+ if (_index >= _endIndex) ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumEnded();
return _array.GetValue(_index);
}
}
@@ -2629,8 +2420,8 @@ namespace System {
public Object Current {
get {
- if (index < startIndex) ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumNotStarted);
- if (_complete) ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumEnded);
+ if (index < startIndex) ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumNotStarted();
+ if (_complete) ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumEnded();
return array.GetValue(_indices);
}
}
@@ -2652,7 +2443,6 @@ namespace System {
// if this is an array of value classes and that value class has a default constructor
// then this calls this default constructor on every element in the value class array.
// otherwise this is a no-op. Generally this method is called automatically by the compiler
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern void Initialize();
}
@@ -2689,13 +2479,12 @@ namespace System {
sealed class SZArrayHelper {
// It is never legal to instantiate this class.
private SZArrayHelper() {
- Contract.Assert(false, "Hey! How'd I get here?");
+ Debug.Assert(false, "Hey! How'd I get here?");
}
// -----------------------------------------------------------
// ------- Implement IEnumerable<T> interface methods --------
// -----------------------------------------------------------
- [SecuritySafeCritical]
internal IEnumerator<T> GetEnumerator<T>() {
//! Warning: "this" is an array, not an SZArrayHelper. See comments above
//! or you may introduce a security hole!
@@ -2707,7 +2496,6 @@ namespace System {
// -----------------------------------------------------------
// ------- Implement ICollection<T> interface methods --------
// -----------------------------------------------------------
- [SecuritySafeCritical]
void CopyTo<T>(T[] array, int index) {
//! Warning: "this" is an array, not an SZArrayHelper. See comments above
//! or you may introduce a security hole!
@@ -2716,7 +2504,6 @@ namespace System {
Array.Copy(_this, 0, array, index, _this.Length);
}
- [SecuritySafeCritical]
internal int get_Count<T>() {
//! Warning: "this" is an array, not an SZArrayHelper. See comments above
//! or you may introduce a security hole!
@@ -2727,7 +2514,6 @@ namespace System {
// -----------------------------------------------------------
// ---------- Implement IList<T> interface methods -----------
// -----------------------------------------------------------
- [SecuritySafeCritical]
internal T get_Item<T>(int index) {
//! Warning: "this" is an array, not an SZArrayHelper. See comments above
//! or you may introduce a security hole!
@@ -2739,7 +2525,6 @@ namespace System {
return _this[index];
}
- [SecuritySafeCritical]
internal void set_Item<T>(int index, T value) {
//! Warning: "this" is an array, not an SZArrayHelper. See comments above
//! or you may introduce a security hole!
@@ -2756,12 +2541,11 @@ namespace System {
ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_FixedSizeCollection);
}
- [SecuritySafeCritical]
bool Contains<T>(T value) {
//! Warning: "this" is an array, not an SZArrayHelper. See comments above
//! or you may introduce a security hole!
T[] _this = JitHelpers.UnsafeCast<T[]>(this);
- return Array.IndexOf(_this, value) != -1;
+ return Array.IndexOf(_this, value, 0, _this.Length) >= 0;
}
bool get_IsReadOnly<T>() {
@@ -2775,12 +2559,11 @@ namespace System {
ThrowHelper.ThrowNotSupportedException(ExceptionResource.NotSupported_ReadOnlyCollection);
}
- [SecuritySafeCritical]
int IndexOf<T>(T value) {
//! Warning: "this" is an array, not an SZArrayHelper. See comments above
//! or you may introduce a security hole!
T[] _this = JitHelpers.UnsafeCast<T[]>(this);
- return Array.IndexOf(_this, value);
+ return Array.IndexOf(_this, value, 0, _this.Length);
}
void Insert<T>(int index, T value) {
@@ -2812,7 +2595,7 @@ namespace System {
internal SZGenericArrayEnumerator(T[] array, int endIndex) {
// We allow passing null array in case of empty enumerator.
- Contract.Assert(array != null || endIndex == -1, "endIndex should be -1 in the case of a null array (for the empty enumerator).");
+ Debug.Assert(array != null || endIndex == -1, "endIndex should be -1 in the case of a null array (for the empty enumerator).");
_array = array;
_index = -1;
_endIndex = endIndex;
@@ -2828,8 +2611,8 @@ namespace System {
public T Current {
get {
- if (_index < 0) ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumNotStarted);
- if (_index >= _endIndex) ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumEnded);
+ if (_index < 0) ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumNotStarted();
+ if (_index >= _endIndex) ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumEnded();
return _array[_index];
}
}
diff --git a/src/mscorlib/src/System/ArraySegment.cs b/src/mscorlib/src/System/ArraySegment.cs
index bc39c24..b767e7b 100644
--- a/src/mscorlib/src/System/ArraySegment.cs
+++ b/src/mscorlib/src/System/ArraySegment.cs
@@ -16,6 +16,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
+using System.Diagnostics;
using System.Diagnostics.Contracts;
namespace System
@@ -28,10 +29,10 @@ namespace System
[Serializable]
public struct ArraySegment<T> : IList<T>, IReadOnlyList<T>
{
- private T[] _array;
- private int _offset;
- private int _count;
-
+ private readonly T[] _array;
+ private readonly int _offset;
+ private readonly int _count;
+
public ArraySegment(T[] array)
{
if (array == null)
@@ -64,10 +65,10 @@ namespace System
{
get
{
- Contract.Assert( (null == _array && 0 == _offset && 0 == _count)
+ Debug.Assert( (null == _array && 0 == _offset && 0 == _count)
|| (null != _array && _offset >= 0 && _count >= 0 && _offset + _count <= _array.Length),
"ArraySegment is invalid");
-
+
return _array;
}
}
@@ -83,7 +84,7 @@ namespace System
// after reading each field out of an ArraySegment into their stack.
Contract.Ensures(Contract.Result<int>() >= 0);
- Contract.Assert( (null == _array && 0 == _offset && 0 == _count)
+ Debug.Assert( (null == _array && 0 == _offset && 0 == _count)
|| (null != _array && _offset >= 0 && _count >= 0 && _offset + _count <= _array.Length),
"ArraySegment is invalid");
@@ -102,19 +103,38 @@ namespace System
// after reading each field out of an ArraySegment into their stack.
Contract.Ensures(Contract.Result<int>() >= 0);
- Contract.Assert( (null == _array && 0 == _offset && 0 == _count)
+ Debug.Assert( (null == _array && 0 == _offset && 0 == _count)
|| (null != _array && _offset >= 0 && _count >= 0 && _offset + _count <= _array.Length),
"ArraySegment is invalid");
return _count;
}
}
-
+
+ public Enumerator GetEnumerator()
+ {
+ if (_array == null)
+ ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_NullArray);
+ Contract.EndContractBlock();
+
+ return new Enumerator(this);
+ }
+
public override int GetHashCode()
{
- return null == _array
- ? 0
- : _array.GetHashCode() ^ _offset ^ _count;
+ if (_array == null)
+ {
+ return 0;
+ }
+
+ int hash = 5381;
+ hash = System.Numerics.Hashing.HashHelpers.Combine(hash, _offset);
+ hash = System.Numerics.Hashing.HashHelpers.Combine(hash, _count);
+
+ // The array hash is expected to be an evenly-distributed mixture of bits,
+ // so rather than adding the cost of another rotation we just xor it.
+ hash ^= _array.GetHashCode();
+ return hash;
}
public override bool Equals(Object obj)
@@ -174,7 +194,7 @@ namespace System
int index = System.Array.IndexOf<T>(_array, item, _offset, _count);
- Contract.Assert(index == -1 ||
+ Debug.Assert(index == -1 ||
(index >= _offset && index < _offset + _count));
return index >= 0 ? index - _offset : -1;
@@ -236,7 +256,7 @@ namespace System
int index = System.Array.IndexOf<T>(_array, item, _offset, _count);
- Contract.Assert(index == -1 ||
+ Debug.Assert(index == -1 ||
(index >= _offset && index < _offset + _count));
return index >= 0;
@@ -259,46 +279,34 @@ namespace System
#endregion
#region IEnumerable<T>
- IEnumerator<T> IEnumerable<T>.GetEnumerator()
- {
- if (_array == null)
- ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_NullArray);
- Contract.EndContractBlock();
- return new ArraySegmentEnumerator(this);
- }
+ IEnumerator<T> IEnumerable<T>.GetEnumerator() => GetEnumerator();
#endregion
#region IEnumerable
- IEnumerator IEnumerable.GetEnumerator()
- {
- if (_array == null)
- ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_NullArray);
- Contract.EndContractBlock();
- return new ArraySegmentEnumerator(this);
- }
+ IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
#endregion
[Serializable]
- private sealed class ArraySegmentEnumerator : IEnumerator<T>
+ public struct Enumerator : IEnumerator<T>
{
- private T[] _array;
- private int _start;
- private int _end;
+ private readonly T[] _array;
+ private readonly int _start;
+ private readonly int _end; // cache Offset + Count, since it's a little slow
private int _current;
- internal ArraySegmentEnumerator(ArraySegment<T> arraySegment)
+ internal Enumerator(ArraySegment<T> arraySegment)
{
Contract.Requires(arraySegment.Array != null);
Contract.Requires(arraySegment.Offset >= 0);
Contract.Requires(arraySegment.Count >= 0);
Contract.Requires(arraySegment.Offset + arraySegment.Count <= arraySegment.Array.Length);
- _array = arraySegment._array;
- _start = arraySegment._offset;
- _end = _start + arraySegment._count;
- _current = _start - 1;
+ _array = arraySegment.Array;
+ _start = arraySegment.Offset;
+ _end = arraySegment.Offset + arraySegment.Count;
+ _current = arraySegment.Offset - 1;
}
public bool MoveNext()
@@ -315,19 +323,15 @@ namespace System
{
get
{
- if (_current < _start) ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumNotStarted);
- if (_current >= _end) ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_EnumEnded);
+ if (_current < _start)
+ ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumNotStarted();
+ if (_current >= _end)
+ ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumEnded();
return _array[_current];
}
}
- object IEnumerator.Current
- {
- get
- {
- return Current;
- }
- }
+ object IEnumerator.Current => Current;
void IEnumerator.Reset()
{
diff --git a/src/mscorlib/src/System/Attribute.cs b/src/mscorlib/src/System/Attribute.cs
index 6475d8d..e77450e 100644
--- a/src/mscorlib/src/System/Attribute.cs
+++ b/src/mscorlib/src/System/Attribute.cs
@@ -10,6 +10,7 @@ namespace System {
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Globalization;
+ using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Security;
using System.Security.Permissions;
@@ -436,7 +437,6 @@ namespace System {
Environment.GetResourceString("Format_AttributeUsage", type));
}
- [System.Security.SecuritySafeCritical]
private static Attribute[] CreateAttributeArrayHelper(Type elementType, int elementCount)
{
return (Attribute[])Array.UnsafeCreateInstance(elementType, elementCount);
@@ -456,10 +456,10 @@ namespace System {
public static Attribute[] GetCustomAttributes(MemberInfo element, Type type, bool inherit)
{
if (element == null)
- throw new ArgumentNullException("element");
+ throw new ArgumentNullException(nameof(element));
if (type == null)
- throw new ArgumentNullException("type");
+ throw new ArgumentNullException(nameof(type));
if (!type.IsSubclassOf(typeof(Attribute)) && type != typeof(Attribute))
throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
@@ -486,7 +486,7 @@ namespace System {
public static Attribute[] GetCustomAttributes(MemberInfo element, bool inherit)
{
if (element == null)
- throw new ArgumentNullException("element");
+ throw new ArgumentNullException(nameof(element));
Contract.EndContractBlock();
switch (element.MemberType)
@@ -511,10 +511,10 @@ namespace System {
{
// Returns true if a custom attribute subclass of attributeType class/interface with inheritance walk
if (element == null)
- throw new ArgumentNullException("element");
+ throw new ArgumentNullException(nameof(element));
if (attributeType == null)
- throw new ArgumentNullException("attributeType");
+ throw new ArgumentNullException(nameof(attributeType));
if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
@@ -568,16 +568,16 @@ namespace System {
public static Attribute[] GetCustomAttributes(ParameterInfo element, Type attributeType, bool inherit)
{
if (element == null)
- throw new ArgumentNullException("element");
+ throw new ArgumentNullException(nameof(element));
if (attributeType == null)
- throw new ArgumentNullException("attributeType");
+ throw new ArgumentNullException(nameof(attributeType));
if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
if (element.Member == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidParameterInfo"), "element");
+ throw new ArgumentException(Environment.GetResourceString("Argument_InvalidParameterInfo"), nameof(element));
Contract.EndContractBlock();
@@ -591,10 +591,10 @@ namespace System {
public static Attribute[] GetCustomAttributes(ParameterInfo element, bool inherit)
{
if (element == null)
- throw new ArgumentNullException("element");
+ throw new ArgumentNullException(nameof(element));
if (element.Member == null)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidParameterInfo"), "element");
+ throw new ArgumentException(Environment.GetResourceString("Argument_InvalidParameterInfo"), nameof(element));
Contract.EndContractBlock();
@@ -614,10 +614,10 @@ namespace System {
{
// Returns true is a custom attribute subclass of attributeType class/interface with inheritance walk
if (element == null)
- throw new ArgumentNullException("element");
+ throw new ArgumentNullException(nameof(element));
if (attributeType == null)
- throw new ArgumentNullException("attributeType");
+ throw new ArgumentNullException(nameof(attributeType));
if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
@@ -637,7 +637,7 @@ namespace System {
return element.IsDefined(attributeType, false);
default:
- Contract.Assert(false, "Invalid type for ParameterInfo member in Attribute class");
+ Debug.Assert(false, "Invalid type for ParameterInfo member in Attribute class");
throw new ArgumentException(Environment.GetResourceString("Argument_InvalidParamInfo"));
}
}
@@ -681,7 +681,7 @@ namespace System {
public static Attribute[] GetCustomAttributes(Module element, bool inherit)
{
if (element == null)
- throw new ArgumentNullException("element");
+ throw new ArgumentNullException(nameof(element));
Contract.EndContractBlock();
return (Attribute[])element.GetCustomAttributes(typeof(Attribute), inherit);
@@ -690,10 +690,10 @@ namespace System {
public static Attribute[] GetCustomAttributes(Module element, Type attributeType, bool inherit)
{
if (element == null)
- throw new ArgumentNullException("element");
+ throw new ArgumentNullException(nameof(element));
if (attributeType == null)
- throw new ArgumentNullException("attributeType");
+ throw new ArgumentNullException(nameof(attributeType));
if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
@@ -711,10 +711,10 @@ namespace System {
{
// Returns true is a custom attribute subclass of attributeType class/interface with no inheritance walk
if (element == null)
- throw new ArgumentNullException("element");
+ throw new ArgumentNullException(nameof(element));
if (attributeType == null)
- throw new ArgumentNullException("attributeType");
+ throw new ArgumentNullException(nameof(attributeType));
if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
@@ -754,10 +754,10 @@ namespace System {
public static Attribute[] GetCustomAttributes(Assembly element, Type attributeType, bool inherit)
{
if (element == null)
- throw new ArgumentNullException("element");
+ throw new ArgumentNullException(nameof(element));
if (attributeType == null)
- throw new ArgumentNullException("attributeType");
+ throw new ArgumentNullException(nameof(attributeType));
if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
@@ -774,7 +774,7 @@ namespace System {
public static Attribute[] GetCustomAttributes(Assembly element, bool inherit)
{
if (element == null)
- throw new ArgumentNullException("element");
+ throw new ArgumentNullException(nameof(element));
Contract.EndContractBlock();
return (Attribute[])element.GetCustomAttributes(typeof(Attribute), inherit);
@@ -789,10 +789,10 @@ namespace System {
{
// Returns true is a custom attribute subclass of attributeType class/interface with no inheritance walk
if (element == null)
- throw new ArgumentNullException("element");
+ throw new ArgumentNullException(nameof(element));
if (attributeType == null)
- throw new ArgumentNullException("attributeType");
+ throw new ArgumentNullException(nameof(attributeType));
if (!attributeType.IsSubclassOf(typeof(Attribute)) && attributeType != typeof(Attribute))
throw new ArgumentException(Environment.GetResourceString("Argument_MustHaveAttributeBaseClass"));
@@ -830,14 +830,13 @@ namespace System {
#endregion
#region Object Overrides
- [SecuritySafeCritical]
public override bool Equals(Object obj)
{
if (obj == null)
return false;
- RuntimeType thisType = (RuntimeType)this.GetType();
- RuntimeType thatType = (RuntimeType)obj.GetType();
+ Type thisType = this.GetType();
+ Type thatType = obj.GetType();
if (thatType != thisType)
return false;
@@ -845,18 +844,22 @@ namespace System {
Object thisObj = this;
Object thisResult, thatResult;
- FieldInfo[] thisFields = thisType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
-
- for (int i = 0; i < thisFields.Length; i++)
+ while (thisType != typeof(Attribute))
{
- // Visibility check and consistency check are not necessary.
- thisResult = ((RtFieldInfo)thisFields[i]).UnsafeGetValue(thisObj);
- thatResult = ((RtFieldInfo)thisFields[i]).UnsafeGetValue(obj);
+ FieldInfo[] thisFields = thisType.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly);
- if (!AreFieldValuesEqual(thisResult, thatResult))
+ for (int i = 0; i < thisFields.Length; i++)
{
- return false;
+ // Visibility check and consistency check are not necessary.
+ thisResult = ((RtFieldInfo)thisFields[i]).UnsafeGetValue(thisObj);
+ thatResult = ((RtFieldInfo)thisFields[i]).UnsafeGetValue(obj);
+
+ if (!AreFieldValuesEqual(thisResult, thatResult))
+ {
+ return false;
+ }
}
+ thisType = thisType.BaseType;
}
return true;
@@ -887,7 +890,7 @@ namespace System {
// Attributes can only contain single-dimension arrays, so we don't need to worry about
// multidimensional arrays.
- Contract.Assert(thisValueArray.Rank == 1 && thatValueArray.Rank == 1);
+ Debug.Assert(thisValueArray.Rank == 1 && thatValueArray.Rank == 1);
for (int j = 0; j < thisValueArray.Length; j++)
{
if (!AreFieldValuesEqual(thisValueArray.GetValue(j), thatValueArray.GetValue(j)))
@@ -901,7 +904,7 @@ namespace System {
// An object of type Attribute will cause a stack overflow.
// However, this should never happen because custom attributes cannot contain values other than
// constants, single-dimensional arrays and typeof expressions.
- Contract.Assert(!(thisValue is Attribute));
+ Debug.Assert(!(thisValue is Attribute));
if (!thisValue.Equals(thatValue))
return false;
}
@@ -909,32 +912,36 @@ namespace System {
return true;
}
- [SecuritySafeCritical]
public override int GetHashCode()
{
Type type = GetType();
- FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
- Object vThis = null;
-
- for (int i = 0; i < fields.Length; i++)
+ while (type != typeof(Attribute))
{
- // Visibility check and consistency check are not necessary.
- Object fieldValue = ((RtFieldInfo)fields[i]).UnsafeGetValue(this);
+ FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly);
+ Object vThis = null;
- // The hashcode of an array ignores the contents of the array, so it can produce
- // different hashcodes for arrays with the same contents.
- // Since we do deep comparisons of arrays in Equals(), this means Equals and GetHashCode will
- // be inconsistent for arrays. Therefore, we ignore hashes of arrays.
- if (fieldValue != null && !fieldValue.GetType().IsArray)
- vThis = fieldValue;
+ for (int i = 0; i < fields.Length; i++)
+ {
+ // Visibility check and consistency check are not necessary.
+ Object fieldValue = ((RtFieldInfo)fields[i]).UnsafeGetValue(this);
+
+ // The hashcode of an array ignores the contents of the array, so it can produce
+ // different hashcodes for arrays with the same contents.
+ // Since we do deep comparisons of arrays in Equals(), this means Equals and GetHashCode will
+ // be inconsistent for arrays. Therefore, we ignore hashes of arrays.
+ if (fieldValue != null && !fieldValue.GetType().IsArray)
+ vThis = fieldValue;
+
+ if (vThis != null)
+ break;
+ }
if (vThis != null)
- break;
- }
+ return vThis.GetHashCode();
- if (vThis != null)
- return vThis.GetHashCode();
+ type = type.BaseType;
+ }
return type.GetHashCode();
}
@@ -949,27 +956,5 @@ namespace System {
#region Public Members
public virtual bool IsDefaultAttribute() { return false; }
#endregion
-
-#if !FEATURE_CORECLR
- void _Attribute.GetTypeInfoCount(out uint pcTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _Attribute.GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException();
- }
-
- void _Attribute.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException();
- }
-
- void _Attribute.Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException();
- }
-#endif
}
}
diff --git a/src/mscorlib/src/System/BCLDebug.cs b/src/mscorlib/src/System/BCLDebug.cs
index 9b2ade2..0ca6e61 100644
--- a/src/mscorlib/src/System/BCLDebug.cs
+++ b/src/mscorlib/src/System/BCLDebug.cs
@@ -119,7 +119,6 @@ namespace System {
[Pure]
[Conditional("_LOGGING")]
- [SecuritySafeCritical]
static public void Log(String message) {
if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize())
return;
@@ -132,7 +131,6 @@ namespace System {
[Pure]
[Conditional("_LOGGING")]
- [SecuritySafeCritical]
static public void Log(String switchName, String message) {
if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize())
return;
@@ -160,7 +158,6 @@ namespace System {
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static int GetRegistryLoggingValues(out bool loggingEnabled, out bool logToConsole, out int logLevel, out bool perfWarnings, out bool correctnessWarnings, out bool safeHandleStackTraces);
- [SecuritySafeCritical]
private static void CheckRegistry() {
if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize())
return;
@@ -207,7 +204,6 @@ namespace System {
}
}
- [SecuritySafeCritical]
internal static bool CheckEnabled(String switchName) {
if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize())
return false;
@@ -220,7 +216,6 @@ namespace System {
return ((int)logSwitch.MinimumLevel<=(int)LogLevel.Trace);
}
- [SecuritySafeCritical]
private static bool CheckEnabled(String switchName, LogLevel level, out LogSwitch logSwitch) {
if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize())
{
@@ -236,7 +231,6 @@ namespace System {
[Pure]
[Conditional("_LOGGING")]
- [SecuritySafeCritical]
public static void Log(String switchName, LogLevel level, params Object[]messages) {
if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize())
return;
@@ -338,33 +332,9 @@ namespace System {
System.Diagnostics.Log.LogMessage(LoggingLevels.TraceLevel0, logSwitch, trace.ToString());
}
- // For logging errors related to the console - we often can't expect to
- // write to stdout if it doesn't exist.
- [SecuritySafeCritical]
- [Conditional("_DEBUG")]
- internal static void ConsoleError(String msg)
- {
- if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize())
- return;
-
- if (m_MakeConsoleErrorLoggingWork == null) {
- PermissionSet perms = new PermissionSet();
- perms.AddPermission(new EnvironmentPermission(PermissionState.Unrestricted));
- perms.AddPermission(new FileIOPermission(FileIOPermissionAccess.AllAccess, Path.GetFullPath(".")));
- m_MakeConsoleErrorLoggingWork = perms;
- }
- m_MakeConsoleErrorLoggingWork.Assert();
-
- using (TextWriter err = File.AppendText("ConsoleErrors.log"))
- {
- err.WriteLine(msg);
- }
- }
-
// For perf-related asserts. On a debug build, set the registry key
// BCLPerfWarnings to non-zero.
[Conditional("_DEBUG")]
- [SecuritySafeCritical]
internal static void Perf(bool expr, String msg)
{
if (AppDomain.CurrentDomain.IsUnloadingForcedFinalize())
@@ -384,7 +354,6 @@ namespace System {
// BCLCorrectnessWarnings to non-zero.
[Conditional("_DEBUG")]
#if _DEBUG
- [SecuritySafeCritical]
#endif
internal static void Correctness(bool expr, String msg)
{
@@ -409,7 +378,6 @@ namespace System {
}
#if !BIT64 // 32
- [SecuritySafeCritical]
#endif
internal static bool CorrectnessEnabled()
{
diff --git a/src/mscorlib/src/System/BadImageFormatException.cs b/src/mscorlib/src/System/BadImageFormatException.cs
index b71fcc3..3f3f4a5 100644
--- a/src/mscorlib/src/System/BadImageFormatException.cs
+++ b/src/mscorlib/src/System/BadImageFormatException.cs
@@ -132,14 +132,11 @@ namespace System {
}
public String FusionLog {
- [System.Security.SecuritySafeCritical] // auto-generated
#pragma warning disable CS0618 // Type or member is obsolete
- [SecurityPermissionAttribute( SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlEvidence | SecurityPermissionFlag.ControlPolicy)]
#pragma warning restore CS0618 // Type or member is obsolete
get { return _fusionLog; }
}
- [System.Security.SecurityCritical] // auto-generated_required
public override void GetObjectData(SerializationInfo info, StreamingContext context) {
// Serialize data for our base classes. base will verify info != null.
base.GetObjectData(info, context);
diff --git a/src/mscorlib/src/System/BitConverter.cs b/src/mscorlib/src/System/BitConverter.cs
index e4bb9dd..3a6d1c0 100644
--- a/src/mscorlib/src/System/BitConverter.cs
+++ b/src/mscorlib/src/System/BitConverter.cs
@@ -15,6 +15,7 @@ namespace System {
using System;
using System.Runtime.CompilerServices;
+ using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Security;
@@ -56,7 +57,6 @@ namespace System {
// Converts a short into an array of bytes with length
// two.
- [System.Security.SecuritySafeCritical] // auto-generated
public unsafe static byte[] GetBytes(short value)
{
Contract.Ensures(Contract.Result<byte[]>() != null);
@@ -70,7 +70,6 @@ namespace System {
// Converts an int into an array of bytes with length
// four.
- [System.Security.SecuritySafeCritical] // auto-generated
public unsafe static byte[] GetBytes(int value)
{
Contract.Ensures(Contract.Result<byte[]>() != null);
@@ -84,7 +83,6 @@ namespace System {
// Converts a long into an array of bytes with length
// eight.
- [System.Security.SecuritySafeCritical] // auto-generated
public unsafe static byte[] GetBytes(long value)
{
Contract.Ensures(Contract.Result<byte[]>() != null);
@@ -128,7 +126,6 @@ namespace System {
// Converts a float into an array of bytes with length
// four.
- [System.Security.SecuritySafeCritical] // auto-generated
public unsafe static byte[] GetBytes(float value)
{
Contract.Ensures(Contract.Result<byte[]>() != null);
@@ -139,7 +136,6 @@ namespace System {
// Converts a double into an array of bytes with length
// eight.
- [System.Security.SecuritySafeCritical] // auto-generated
public unsafe static byte[] GetBytes(double value)
{
Contract.Ensures(Contract.Result<byte[]>() != null);
@@ -156,7 +152,7 @@ namespace System {
}
if ((uint)startIndex >= value.Length) {
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
+ ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index();
}
if (startIndex > value.Length - 2) {
@@ -168,14 +164,13 @@ namespace System {
}
// Converts an array of bytes into a short.
- [System.Security.SecuritySafeCritical] // auto-generated
public static unsafe short ToInt16(byte[] value, int startIndex) {
if( value == null) {
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
}
if ((uint) startIndex >= value.Length) {
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
+ ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index();
}
if (startIndex > value.Length -2) {
@@ -200,14 +195,13 @@ namespace System {
}
// Converts an array of bytes into an int.
- [System.Security.SecuritySafeCritical] // auto-generated
public static unsafe int ToInt32 (byte[] value, int startIndex) {
if( value == null) {
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
}
if ((uint) startIndex >= value.Length) {
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
+ ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index();
}
if (startIndex > value.Length -4) {
@@ -231,14 +225,13 @@ namespace System {
}
// Converts an array of bytes into a long.
- [System.Security.SecuritySafeCritical] // auto-generated
public static unsafe long ToInt64 (byte[] value, int startIndex) {
if (value == null) {
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
}
if ((uint) startIndex >= value.Length) {
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
+ ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index();
}
if (startIndex > value.Length -8) {
@@ -274,7 +267,7 @@ namespace System {
if (value == null)
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
if ((uint)startIndex >= value.Length)
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
+ ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index();
if (startIndex > value.Length - 2)
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
Contract.EndContractBlock();
@@ -290,7 +283,7 @@ namespace System {
if (value == null)
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
if ((uint)startIndex >= value.Length)
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
+ ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index();
if (startIndex > value.Length - 4)
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
Contract.EndContractBlock();
@@ -306,7 +299,7 @@ namespace System {
if (value == null)
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
if ((uint)startIndex >= value.Length)
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
+ ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index();
if (startIndex > value.Length - 8)
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
Contract.EndContractBlock();
@@ -315,13 +308,12 @@ namespace System {
}
// Converts an array of bytes into a float.
- [System.Security.SecuritySafeCritical] // auto-generated
unsafe public static float ToSingle (byte[] value, int startIndex)
{
if (value == null)
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
if ((uint)startIndex >= value.Length)
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
+ ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index();
if (startIndex > value.Length - 4)
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
Contract.EndContractBlock();
@@ -331,13 +323,12 @@ namespace System {
}
// Converts an array of bytes into a double.
- [System.Security.SecuritySafeCritical] // auto-generated
unsafe public static double ToDouble (byte[] value, int startIndex)
{
if (value == null)
ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
if ((uint)startIndex >= value.Length)
- ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
+ ThrowHelper.ThrowStartIndexArgumentOutOfRange_ArgumentOutOfRange_Index();
if (startIndex > value.Length - 8)
ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall);
Contract.EndContractBlock();
@@ -347,7 +338,7 @@ namespace System {
}
private static char GetHexValue(int i) {
- Contract.Assert( i >=0 && i <16, "i is out of range.");
+ Debug.Assert( i >=0 && i <16, "i is out of range.");
if (i<10) {
return (char)(i + '0');
}
@@ -358,15 +349,15 @@ namespace System {
// Converts an array of bytes into a String.
public static String ToString (byte[] value, int startIndex, int length) {
if (value == null) {
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
}
if (startIndex < 0 || startIndex >= value.Length && startIndex > 0) { // Don't throw for a 0 length array.
- throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("ArgumentOutOfRange_StartIndex"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_StartIndex"));
}
if (length < 0) {
- throw new ArgumentOutOfRangeException("length", Environment.GetResourceString("ArgumentOutOfRange_GenericPositive"));
+ throw new ArgumentOutOfRangeException(nameof(length), Environment.GetResourceString("ArgumentOutOfRange_GenericPositive"));
}
if (startIndex > value.Length - length) {
@@ -380,7 +371,7 @@ namespace System {
if (length > (Int32.MaxValue / 3)) {
// (Int32.MaxValue / 3) == 715,827,882 Bytes == 699 MB
- throw new ArgumentOutOfRangeException("length", Environment.GetResourceString("ArgumentOutOfRange_LengthTooLarge", (Int32.MaxValue / 3)));
+ throw new ArgumentOutOfRangeException(nameof(length), Environment.GetResourceString("ArgumentOutOfRange_LengthTooLarge", (Int32.MaxValue / 3)));
}
int chArrayLength = length * 3;
@@ -402,7 +393,7 @@ namespace System {
// Converts an array of bytes into a String.
public static String ToString(byte [] value) {
if (value == null)
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
Contract.Ensures(Contract.Result<String>() != null);
Contract.EndContractBlock();
return ToString(value, 0, value.Length);
@@ -411,7 +402,7 @@ namespace System {
// Converts an array of bytes into a String.
public static String ToString (byte [] value, int startIndex) {
if (value == null)
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
Contract.Ensures(Contract.Result<String>() != null);
Contract.EndContractBlock();
return ToString(value, startIndex, value.Length - startIndex);
@@ -428,24 +419,30 @@ namespace System {
// Converts an array of bytes into a boolean.
public static bool ToBoolean(byte[] value, int startIndex) {
if (value==null)
- throw new ArgumentNullException("value");
+ throw new ArgumentNullException(nameof(value));
if (startIndex < 0)
- throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
if (startIndex > value.Length - 1)
- throw new ArgumentOutOfRangeException("startIndex", Environment.GetResourceString("ArgumentOutOfRange_Index"));
+ throw new ArgumentOutOfRangeException(nameof(startIndex), Environment.GetResourceString("ArgumentOutOfRange_Index"));
Contract.EndContractBlock();
return (value[startIndex]==0)?false:true;
}
- [SecuritySafeCritical]
public static unsafe long DoubleToInt64Bits(double value) {
return *((long *)&value);
}
- [SecuritySafeCritical]
public static unsafe double Int64BitsToDouble(long value) {
return *((double*)&value);
- }
+ }
+
+ public static unsafe int SingleToInt32Bits(float value) {
+ return *((int*)&value);
+ }
+
+ public static unsafe float Int32BitsToSingle(int value) {
+ return *((float*)&value);
+ }
}
}
diff --git a/src/mscorlib/src/System/Boolean.cs b/src/mscorlib/src/System/Boolean.cs
index c5cd45a..9aaec9a 100644
--- a/src/mscorlib/src/System/Boolean.cs
+++ b/src/mscorlib/src/System/Boolean.cs
@@ -151,7 +151,7 @@ namespace System {
// Determines whether a String represents true or false.
//
public static Boolean Parse (String value) {
- if (value==null) throw new ArgumentNullException("value");
+ if (value==null) throw new ArgumentNullException(nameof(value));
Contract.EndContractBlock();
Boolean result = false;
if (!TryParse(value, out result)) {
diff --git a/src/mscorlib/src/System/Buffer.cs b/src/mscorlib/src/System/Buffer.cs
index ea647f1..eee2a81 100644
--- a/src/mscorlib/src/System/Buffer.cs
+++ b/src/mscorlib/src/System/Buffer.cs
@@ -11,6 +11,7 @@ namespace System {
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
+ using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Security;
using System.Runtime;
@@ -28,7 +29,6 @@ namespace System {
// respecting types. This calls memmove internally. The count and
// offset parameters here are in bytes. If you want to use traditional
// array element indices and counts, use Array.Copy.
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public static extern void BlockCopy(Array src, int srcOffset,
Array dst, int dstOffset, int count);
@@ -37,7 +37,6 @@ namespace System {
// parameter validation has already been done. The count and offset
// parameters here are in bytes. If you want to use traditional
// array element indices and counts, use Array.Copy.
- [System.Security.SecuritySafeCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern void InternalBlockCopy(Array src, int srcOffsetBytes,
Array dst, int dstOffsetBytes, int byteCount);
@@ -47,10 +46,9 @@ namespace System {
// It is however cross platform as the CRT hasn't ported their fast version to 64-bit
// platforms.
//
- [System.Security.SecurityCritical] // auto-generated
internal unsafe static int IndexOfByte(byte* src, byte value, int index, int count)
{
- Contract.Assert(src != null, "src should not be null");
+ Debug.Assert(src != null, "src should not be null");
byte* pByte = src + index;
@@ -122,7 +120,6 @@ namespace System {
// Returns a bool to indicate if the array is of primitive data types
// or not.
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern bool IsPrimitiveTypeArray(Array array);
@@ -132,24 +129,22 @@ namespace System {
// This essentially does the following:
// return ((byte*)array) + index.
//
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern byte _GetByte(Array array, int index);
- [System.Security.SecuritySafeCritical] // auto-generated
public static byte GetByte(Array array, int index)
{
// Is the array present?
if (array == null)
- throw new ArgumentNullException("array");
+ throw new ArgumentNullException(nameof(array));
// Is it of primitive types?
if (!IsPrimitiveTypeArray(array))
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBePrimArray"), "array");
+ throw new ArgumentException(Environment.GetResourceString("Arg_MustBePrimArray"), nameof(array));
// Is the index in valid range of the array?
if (index < 0 || index >= _ByteLength(array))
- throw new ArgumentOutOfRangeException("index");
+ throw new ArgumentOutOfRangeException(nameof(index));
return _GetByte(array, index);
}
@@ -160,24 +155,22 @@ namespace System {
// This essentially does the following:
// *(((byte*)array) + index) = value.
//
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern void _SetByte(Array array, int index, byte value);
- [System.Security.SecuritySafeCritical] // auto-generated
public static void SetByte(Array array, int index, byte value)
{
// Is the array present?
if (array == null)
- throw new ArgumentNullException("array");
+ throw new ArgumentNullException(nameof(array));
// Is it of primitive types?
if (!IsPrimitiveTypeArray(array))
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBePrimArray"), "array");
+ throw new ArgumentException(Environment.GetResourceString("Arg_MustBePrimArray"), nameof(array));
// Is the index in valid range of the array?
if (index < 0 || index >= _ByteLength(array))
- throw new ArgumentOutOfRangeException("index");
+ throw new ArgumentOutOfRangeException(nameof(index));
// Make the FCall to do the work
_SetByte(array, index, value);
@@ -190,36 +183,32 @@ namespace System {
// This essentially does the following:
// return array.length * sizeof(array.UnderlyingElementType).
//
- [System.Security.SecurityCritical] // auto-generated
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern int _ByteLength(Array array);
- [System.Security.SecuritySafeCritical] // auto-generated
public static int ByteLength(Array array)
{
// Is the array present?
if (array == null)
- throw new ArgumentNullException("array");
+ throw new ArgumentNullException(nameof(array));
// Is it of primitive types?
if (!IsPrimitiveTypeArray(array))
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBePrimArray"), "array");
+ throw new ArgumentException(Environment.GetResourceString("Arg_MustBePrimArray"), nameof(array));
return _ByteLength(array);
}
- [System.Security.SecurityCritical] // auto-generated
internal unsafe static void ZeroMemory(byte* src, long len)
{
while(len-- > 0)
*(src + len) = 0;
}
- [System.Security.SecurityCritical] // auto-generated
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
internal unsafe static void Memcpy(byte[] dest, int destIndex, byte* src, int srcIndex, int len) {
- Contract.Assert( (srcIndex >= 0) && (destIndex >= 0) && (len >= 0), "Index and length must be non-negative!");
- Contract.Assert(dest.Length - destIndex >= len, "not enough bytes in dest");
+ Debug.Assert( (srcIndex >= 0) && (destIndex >= 0) && (len >= 0), "Index and length must be non-negative!");
+ Debug.Assert(dest.Length - destIndex >= len, "not enough bytes in dest");
// If dest has 0 elements, the fixed statement will throw an
// IndexOutOfRangeException. Special-case 0-byte copies.
if (len==0)
@@ -229,12 +218,11 @@ namespace System {
}
}
- [SecurityCritical]
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
internal unsafe static void Memcpy(byte* pDest, int destIndex, byte[] src, int srcIndex, int len)
{
- Contract.Assert( (srcIndex >= 0) && (destIndex >= 0) && (len >= 0), "Index and length must be non-negative!");
- Contract.Assert(src.Length - srcIndex >= len, "not enough bytes in src");
+