-2.0.0-prerelease-02217-03
+2.0.0-prerelease-02219-01
class Foo
{
- // All QCalls should have the following DllImport and
- // SuppressUnmanagedCodeSecurity attributes
+ // All QCalls should have the following DllImport attribute
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
- [SuppressUnmanagedCodeSecurity]
// QCalls should always be static extern.
private static extern bool Bar(int flags, string inString, StringHandleOnStack retString);
<!-- Source of truth for dependency tooling: the commit hash of the dotnet/versions master branch as of the last auto-upgrade. -->
<PropertyGroup>
- <CoreFxCurrentRef>aa4fb5d5604af80d55d4c8ddb8f7775e5a541558</CoreFxCurrentRef>
- <CoreClrCurrentRef>aa4fb5d5604af80d55d4c8ddb8f7775e5a541558</CoreClrCurrentRef>
- <BuildToolsCurrentRef>aa4fb5d5604af80d55d4c8ddb8f7775e5a541558</BuildToolsCurrentRef>
+ <CoreFxCurrentRef>e57b24cdf9893390fa838d11557234c3f1e4aeda</CoreFxCurrentRef>
+ <CoreClrCurrentRef>e57b24cdf9893390fa838d11557234c3f1e4aeda</CoreClrCurrentRef>
+ <BuildToolsCurrentRef>e57b24cdf9893390fa838d11557234c3f1e4aeda</BuildToolsCurrentRef>
<PgoDataCurrentRef>aa4fb5d5604af80d55d4c8ddb8f7775e5a541558</PgoDataCurrentRef>
</PropertyGroup>
<!-- Tests/infrastructure dependency versions. -->
<PropertyGroup>
- <MicrosoftPrivateCoreFxNETCoreAppPackageVersion>4.5.0-preview1-25917-04</MicrosoftPrivateCoreFxNETCoreAppPackageVersion>
- <MicrosoftNETCorePlatformsPackageVersion>2.1.0-preview1-25917-04</MicrosoftNETCorePlatformsPackageVersion>
+ <MicrosoftPrivateCoreFxNETCoreAppPackageVersion>4.5.0-preview1-25920-01</MicrosoftPrivateCoreFxNETCoreAppPackageVersion>
+ <MicrosoftNETCorePlatformsPackageVersion>2.1.0-preview1-25920-01</MicrosoftNETCorePlatformsPackageVersion>
<PgoDataPackageVersion>99.99.99-master-20171116-0044</PgoDataPackageVersion>
- <MicrosoftNETCoreRuntimeCoreCLRPackageVersion>2.1.0-preview1-25918-04</MicrosoftNETCoreRuntimeCoreCLRPackageVersion>
+ <MicrosoftNETCoreRuntimeCoreCLRPackageVersion>2.1.0-preview1-25920-01</MicrosoftNETCoreRuntimeCoreCLRPackageVersion>
<XunitPackageVersion>2.2.0-beta2-build3300</XunitPackageVersion>
<XunitConsoleNetcorePackageVersion>1.0.2-prerelease-00177</XunitConsoleNetcorePackageVersion>
<XunitPerformanceApiPackageVersion>1.0.0-beta-build0012</XunitPerformanceApiPackageVersion>
<!-- Package versions used as toolsets -->
<PropertyGroup>
<FeedTasksPackage>Microsoft.DotNet.Build.Tasks.Feed</FeedTasksPackage>
- <FeedTasksPackageVersion>1.0.0-prerelease-02217-03</FeedTasksPackageVersion>
+ <FeedTasksPackageVersion>1.0.0-prerelease-02219-01</FeedTasksPackageVersion>
</PropertyGroup>
<!-- Package dependency verification/auto-upgrade configuration. -->
#define FRIEND_ASSEMBLY_TYPE "System.Runtime.CompilerServices.InternalsVisibleToAttribute"
#define FRIEND_ASSEMBLY_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 2, ELEMENT_TYPE_VOID, ELEMENT_TYPE_STRING, ELEMENT_TYPE_BOOLEAN}
-#define FRIEND_ACCESS_ALLOWED_ATTRIBUTE_TYPE_W L"System.Runtime.CompilerServices.FriendAccessAllowedAttribute"
-#define FRIEND_ACCESS_ALLOWED_ATTRIBUTE_TYPE "System.Runtime.CompilerServices.FriendAccessAllowedAttribute"
-#define FRIEND_ACCESS_ALLOWED_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
-
#define SUBJECT_ASSEMBLY_TYPE_W L"System.Runtime.CompilerServices.IgnoresAccessChecksToAttribute"
#define SUBJECT_ASSEMBLY_TYPE "System.Runtime.CompilerServices.IgnoresAccessChecksToAttribute"
#define SUBJECT_ASSEMBLY_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_STRING}
assert(genIsValidFloatReg(targetReg));
assert(genIsValidFloatReg(op1Reg));
assert(genIsValidIntReg(op2Reg) || genIsValidFloatReg(op2Reg));
+ assert(targetReg != op2Reg);
emitAttr attr = emitTypeSize(baseType);
#ifdef _TARGET_ARM_
// We need to support alignment requirements to access memory on ARM
unsigned alignment = 1;
- pComp->codeGen->InferOpSizeAlign(tree, &alignment);
+ pComp->codeGen->InferOpSizeAlign(lcl, &alignment);
alignment = roundUp(alignment, TARGET_POINTER_SIZE);
padding = roundUp(padding, alignment);
#endif // _TARGET_ARM_
case SIMDIntrinsicBitwiseXor:
case SIMDIntrinsicMin:
case SIMDIntrinsicMax:
- case SIMDIntrinsicSetX:
- case SIMDIntrinsicSetY:
- case SIMDIntrinsicSetZ:
- case SIMDIntrinsicSetW:
case SIMDIntrinsicEqual:
case SIMDIntrinsicLessThan:
case SIMDIntrinsicGreaterThan:
info->srcCount = 2;
break;
+ case SIMDIntrinsicSetX:
+ case SIMDIntrinsicSetY:
+ case SIMDIntrinsicSetZ:
+ case SIMDIntrinsicSetW:
case SIMDIntrinsicNarrow:
info->srcCount = 2;
<value>Search pattern '{0}' cannot contain ".." to move up directories and can be contained only internally in file/directory names, as in "a..b".</value>
</data>
<data name="Arg_InvalidTypeInRetType" xml:space="preserve">
- <value>The return Type contains some invalid type (i.e. null, ByRef)</value>
+ <value>The return Type must be a type provided by the runtime.</value>
</data>
<data name="Arg_InvalidTypeInSignature" xml:space="preserve">
<value>The signature Type array contains some invalid type (i.e. null, void)</value>
<data name="IndexOutOfRange_ArrayRankIndex" xml:space="preserve">
<value>Array does not have that many dimensions.</value>
</data>
- <data name="IndexOutOfRange_IORaceCondition" xml:space="preserve">
- <value>Probable I/O race condition detected while copying memory. The I/O package is not thread safe by default. In multithreaded applications, a stream must be accessed in a thread-safe way, such as a thread-safe wrapper returned by TextReader's or TextWriter's Synchronized methods. This also applies to classes like StreamWriter and StreamReader.</value>
- </data>
<data name="IndexOutOfRange_UMSPosition" xml:space="preserve">
<value>Unmanaged memory stream position was beyond the capacity of the stream.</value>
</data>
<data name="NotSupported_SignatureType" xml:space="preserve">
<value>This method is not supported on signature types.</value>
</data>
- <data name="Memory_ThrowIfDisposed" xml:space="preserve">
+ <data name="Memory_ThrowIfDisposed" xml:space="preserve">
<value>Memory<T> has been disposed.</value>
</data>
<data name="Memory_OutstandingReferences" xml:space="preserve">
<!-- Sources -->
<ItemGroup>
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\RuntimeHelpers.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\FriendAccessAllowedAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\TypeDependencyAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\jithelpers.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\Unsafe.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\WindowsRuntime\ICustomPropertyProvider.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\WindowsRuntime\ICustomProperty.cs" />
<Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\WindowsRuntime\CustomPropertyImpl.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\WindowsRuntime\WindowsRuntimeBufferHelper.cs" />
</ItemGroup>
<ItemGroup Condition="'$(FeatureCominterop)' == 'true'">
<Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\WindowsRuntime\IIterable.cs" />
<Compile Include="$(BclSourcesRoot)\System\Attribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\BadImageFormatException.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\Buffer.cs" />
- <Compile Include="$(BclSourcesRoot)\System\CompatibilitySwitches.cs" />
<Compile Include="$(BclSourcesRoot)\System\Currency.cs" />
<Compile Include="$(BclSourcesRoot)\System\Decimal.cs" />
<Compile Include="$(BclSourcesRoot)\System\DefaultBinder.CanConvert.cs" />
<Compile Include="$(BclSourcesRoot)\System\Threading\Tasks\ConcurrentExclusiveSchedulerPair.cs" />
<Compile Include="$(BclSourcesRoot)\System\Threading\Tasks\ProducerConsumerQueues.cs" />
<Compile Include="$(BclSourcesRoot)\System\Threading\Tasks\TPLETWProvider.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Threading\Tasks\TaskToApm.cs" />
<Compile Condition="'$(FeatureCominterop)' == 'true'" Include="$(BclSourcesRoot)\System\Threading\Tasks\IAsyncCausalityTracerStatics.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="$(BclSourcesRoot)\System\Threading\ClrThreadPoolPreAllocatedOverlapped.cs" />
</ItemGroup>
<ItemGroup>
- <Compile Include="$(BclSourcesRoot)\System\IO\__Error.cs" />
<Compile Include="$(BclSourcesRoot)\System\IO\BinaryReader.cs" />
<Compile Include="$(BclSourcesRoot)\System\IO\Directory.cs" />
<Compile Include="$(BclSourcesRoot)\System\IO\SearchOption.cs" />
<Compile Include="$(BclSourcesRoot)\System\IO\File.cs" />
<Compile Include="$(BclSourcesRoot)\System\IO\FileLoadException.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\IO\FileNotFoundException.CoreCLR.cs" />
- <Compile Include="$(BclSourcesRoot)\System\IO\MemoryStream.cs" />
<Compile Include="$(BclSourcesRoot)\System\IO\Stream.cs" />
<Compile Include="$(BclSourcesRoot)\System\IO\UnmanagedMemoryAccessor.cs" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\Debugger.cs" />
- <Compile Include="$(BclSourcesRoot)\System\Diagnostics\DebuggerAttributes.cs" />
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\ICustomDebuggerNotification.cs" />
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\Stacktrace.cs" />
<Compile Include="$(BclSourcesRoot)\System\Diagnostics\Stackframe.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\CodeAnalysis\SuppressMessageAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\ConditionalAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\Debug.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\DebuggableAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\DebuggerBrowsableAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\DebuggerDisplayAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\DebuggerHiddenAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\DebuggerNonUserCodeAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\DebuggerStepThroughAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\DebuggerStepperBoundaryAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\DebuggerTypeProxyAttribute.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\DebuggerVisualizerAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Diagnostics\StackTraceHiddenAttribute.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\DivideByZeroException.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\DllNotFoundException.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\IO\FileShare.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\IO\FileStream.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\IO\IOException.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\IO\MemoryStream.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\IO\Path.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\IO\PathInternal.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\IO\PathTooLongException.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\SynchronizationLockException.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\TaskCanceledException.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\TaskExtensions.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\TaskToApm.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\TaskSchedulerException.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\ValueTask.cs" />
<Compile Include="$(MSBuildThisFileDirectory)System\Threading\ThreadAbortException.cs" />
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Diagnostics
+{
+ // Attribute class used by the compiler to mark modules.
+ // If present, then debugging information for everything in the
+ // assembly was generated by the compiler, and will be preserved
+ // by the Runtime so that the debugger can provide full functionality
+ // in the case of JIT attach. If not present, then the compiler may
+ // or may not have included debugging information, and the Runtime
+ // won't preserve the debugging info, which will make debugging after
+ // a JIT attach difficult.
+ [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module, AllowMultiple = false)]
+ public sealed class DebuggableAttribute : Attribute
+ {
+ [Flags]
+ public enum DebuggingModes
+ {
+ None = 0x0,
+ Default = 0x1,
+ DisableOptimizations = 0x100,
+ IgnoreSymbolStoreSequencePoints = 0x2,
+ EnableEditAndContinue = 0x4
+ }
+
+ public DebuggableAttribute(bool isJITTrackingEnabled, bool isJITOptimizerDisabled)
+ {
+ DebuggingFlags = 0;
+
+ if (isJITTrackingEnabled)
+ {
+ DebuggingFlags |= DebuggingModes.Default;
+ }
+
+ if (isJITOptimizerDisabled)
+ {
+ DebuggingFlags |= DebuggingModes.DisableOptimizations;
+ }
+ }
+
+ public DebuggableAttribute(DebuggingModes modes)
+ {
+ DebuggingFlags = modes;
+ }
+
+ public bool IsJITTrackingEnabled => (DebuggingFlags & DebuggingModes.Default) != 0;
+
+ public bool IsJITOptimizerDisabled => (DebuggingFlags & DebuggingModes.DisableOptimizations) != 0;
+
+ public DebuggingModes DebuggingFlags { get; }
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Diagnostics
+{
+ // DebuggerBrowsableState states are defined as follows:
+ // Never never show this element
+ // Expanded expansion of the class is done, so that all visible internal members are shown
+ // Collapsed expansion of the class is not performed. Internal visible members are hidden
+ // RootHidden The target element itself should not be shown, but should instead be
+ // automatically expanded to have its members displayed.
+ // Default value is collapsed
+
+ // Please also change the code which validates DebuggerBrowsableState variable (in this file)
+ // if you change this enum.
+ public enum DebuggerBrowsableState
+ {
+ Never = 0,
+ //Expanded is not supported in this release
+ //Expanded = 1,
+ Collapsed = 2,
+ RootHidden = 3
+ }
+
+
+ // the one currently supported with the csee.dat
+ // (mcee.dat, autoexp.dat) file.
+ [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
+ public sealed class DebuggerBrowsableAttribute : Attribute
+ {
+ public DebuggerBrowsableAttribute(DebuggerBrowsableState state)
+ {
+ if (state < DebuggerBrowsableState.Never || state > DebuggerBrowsableState.RootHidden)
+ throw new ArgumentOutOfRangeException(nameof(state));
+
+ State = state;
+ }
+ public DebuggerBrowsableState State { get; }
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Diagnostics
+{
+ // This attribute is used to control what is displayed for the given class or field
+ // in the data windows in the debugger. The single argument to this attribute is
+ // the string that will be displayed in the value column for instances of the type.
+ // This string can include text between { and } which can be either a field,
+ // property or method (as will be documented in mscorlib). In the C# case,
+ // a general expression will be allowed which only has implicit access to the this pointer
+ // for the current instance of the target type. The expression will be limited,
+ // however: there is no access to aliases, locals, or pointers.
+ // In addition, attributes on properties referenced in the expression are not processed.
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Delegate | AttributeTargets.Enum | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Assembly, AllowMultiple = true)]
+ public sealed class DebuggerDisplayAttribute : Attribute
+ {
+ private Type _target;
+
+ public DebuggerDisplayAttribute(string value)
+ {
+ Value = value ?? "";
+ Name = "";
+ Type = "";
+ }
+
+ public string Value { get; }
+
+ public string Name { get; set; }
+
+ public string Type { get; set; }
+
+ public Type Target
+ {
+ get => _target;
+ set
+ {
+ if (value == null)
+ {
+ throw new ArgumentNullException(nameof(value));
+ }
+
+ TargetTypeName = value.AssemblyQualifiedName;
+ _target = value;
+ }
+ }
+
+ public string TargetTypeName { get; set; }
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Diagnostics
+{
+ [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Constructor, Inherited = false)]
+ public sealed class DebuggerHiddenAttribute : Attribute
+ {
+ public DebuggerHiddenAttribute() { }
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Diagnostics
+{
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Constructor | AttributeTargets.Struct, Inherited = false)]
+ public sealed class DebuggerNonUserCodeAttribute : Attribute
+ {
+ public DebuggerNonUserCodeAttribute() { }
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Diagnostics
+{
+#if PROJECTN
+ // Used by the IL2IL toolchain to mark generated code to control debugger stepping policy
+ [System.Runtime.CompilerServices.DependencyReductionRoot]
+#endif
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Constructor, Inherited = false)]
+ public sealed class DebuggerStepThroughAttribute : Attribute
+ {
+ public DebuggerStepThroughAttribute() { }
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Diagnostics
+{
+ /// <summary>Indicates the code following the attribute is to be executed in run, not step, mode.</summary>
+ [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method, Inherited = false)]
+ public sealed class DebuggerStepperBoundaryAttribute : Attribute
+ {
+ public DebuggerStepperBoundaryAttribute() { }
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Diagnostics
+{
+ [AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = true)]
+ public sealed class DebuggerTypeProxyAttribute : Attribute
+ {
+ private Type _target;
+
+ public DebuggerTypeProxyAttribute(Type type)
+ {
+ if (type == null)
+ {
+ throw new ArgumentNullException(nameof(type));
+ }
+
+ ProxyTypeName = type.AssemblyQualifiedName;
+ }
+
+ public DebuggerTypeProxyAttribute(string typeName)
+ {
+ ProxyTypeName = typeName;
+ }
+
+ public string ProxyTypeName { get; }
+
+ public Type Target
+ {
+ get => _target;
+ set
+ {
+ if (value == null)
+ {
+ throw new ArgumentNullException(nameof(value));
+ }
+
+ TargetTypeName = value.AssemblyQualifiedName;
+ _target = value;
+ }
+ }
+
+ public string TargetTypeName { get; set; }
+ }
+}
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Diagnostics
+{
+ /// <summary>
+ /// Signifies that the attributed type has a visualizer which is pointed
+ /// to by the parameter type name strings.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = true)]
+ public sealed class DebuggerVisualizerAttribute : Attribute
+ {
+ private Type _target;
+
+ public DebuggerVisualizerAttribute(string visualizerTypeName)
+ {
+ VisualizerTypeName = visualizerTypeName;
+ }
+
+ public DebuggerVisualizerAttribute(string visualizerTypeName, string visualizerObjectSourceTypeName)
+ {
+ VisualizerTypeName = visualizerTypeName;
+ VisualizerObjectSourceTypeName = visualizerObjectSourceTypeName;
+ }
+
+ public DebuggerVisualizerAttribute(string visualizerTypeName, Type visualizerObjectSource)
+ {
+ if (visualizerObjectSource == null)
+ {
+ throw new ArgumentNullException(nameof(visualizerObjectSource));
+ }
+
+ VisualizerTypeName = visualizerTypeName;
+ VisualizerObjectSourceTypeName = visualizerObjectSource.AssemblyQualifiedName;
+ }
+
+ public DebuggerVisualizerAttribute(Type visualizer)
+ {
+ if (visualizer == null)
+ {
+ throw new ArgumentNullException(nameof(visualizer));
+ }
+
+ VisualizerTypeName = visualizer.AssemblyQualifiedName;
+ }
+
+ public DebuggerVisualizerAttribute(Type visualizer, Type visualizerObjectSource)
+ {
+ if (visualizer == null)
+ {
+ throw new ArgumentNullException(nameof(visualizer));
+ }
+ if (visualizerObjectSource == null)
+ {
+ throw new ArgumentNullException(nameof(visualizerObjectSource));
+ }
+
+ VisualizerTypeName = visualizer.AssemblyQualifiedName;
+ VisualizerObjectSourceTypeName = visualizerObjectSource.AssemblyQualifiedName;
+ }
+
+ public DebuggerVisualizerAttribute(Type visualizer, string visualizerObjectSourceTypeName)
+ {
+ if (visualizer == null)
+ {
+ throw new ArgumentNullException(nameof(visualizer));
+ }
+
+ VisualizerTypeName = visualizer.AssemblyQualifiedName;
+ VisualizerObjectSourceTypeName = visualizerObjectSourceTypeName;
+ }
+
+ public string VisualizerObjectSourceTypeName { get; }
+
+ public string VisualizerTypeName { get; }
+
+ public string Description { get; set; }
+
+ public Type Target
+ {
+ get => _target;
+ set
+ {
+ if (value == null)
+ {
+ throw new ArgumentNullException(nameof(value));
+ }
+
+ TargetTypeName = value.AssemblyQualifiedName;
+ _target = value;
+ }
+ }
+
+ public string TargetTypeName { get; set; }
+ }
+}
/// <summary>
/// WindowsEventTask. Custom values must be in the range from 1 through 65534
/// </summary>
-#if (!ES_BUILD_STANDALONE && !ES_BUILD_PN)
- [System.Runtime.CompilerServices.FriendAccessAllowed]
-#endif
public enum EventTask
{
/// <summary>
/// <summary>
/// EventOpcode. Custom values must be in the range from 11 through 239
/// </summary>
-#if (!ES_BUILD_STANDALONE && !ES_BUILD_PN)
- [System.Runtime.CompilerServices.FriendAccessAllowed]
-#endif
public enum EventOpcode
{
/// <summary>
/// EventChannel. Custom values must be in the range from 16 through 255. Currently only predefined values allowed.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1028:EnumStorageShouldBeInt32", Justification = "Backwards compatibility")]
-#if (!ES_BUILD_STANDALONE && !ES_BUILD_PN)
- [System.Runtime.CompilerServices.FriendAccessAllowed]
-#endif
public enum EventChannel : byte
{
/// <summary>
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*============================================================
-**
-**
-**
-**
-**
-** Purpose: A Stream whose backing store is memory. Great
-** for temporary storage without creating a temp file. Also
-** lets users expose a byte[] as a stream.
-**
-**
-===========================================================*/
-
using System;
-using System.Runtime;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
using System.Diagnostics;
+using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
private Task<int> _lastReadTask; // The last successful task returned from ReadAsync
- private const int MemStreamMaxLength = Int32.MaxValue;
+ private const int MemStreamMaxLength = int.MaxValue;
public MemoryStream()
: this(0)
public MemoryStream(int capacity)
{
if (capacity < 0)
- {
throw new ArgumentOutOfRangeException(nameof(capacity), SR.ArgumentOutOfRange_NegativeCapacity);
- }
_buffer = capacity != 0 ? new byte[capacity] : Array.Empty<byte>();
_capacity = capacity;
public MemoryStream(byte[] buffer, bool writable)
{
- if (buffer == null) throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
+ if (buffer == null)
+ throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
+
_buffer = buffer;
_length = _capacity = buffer.Length;
_writable = writable;
_isOpen = true;
}
- public override bool CanRead
- {
- get { return _isOpen; }
- }
+ public override bool CanRead => _isOpen;
- public override bool CanSeek
- {
- get { return _isOpen; }
- }
+ public override bool CanSeek => _isOpen;
- public override bool CanWrite
+ public override bool CanWrite => _writable;
+
+ private void EnsureNotClosed()
{
- get { return _writable; }
+ if (!_isOpen)
+ throw Error.GetStreamIsClosed();
}
private void EnsureWriteable()
{
- if (!CanWrite) __Error.WriteNotSupported();
+ if (!CanWrite)
+ throw Error.GetWriteNotSupported();
}
protected override void Dispose(bool disposing)
// Check for overflow
if (value < 0)
throw new IOException(SR.IO_StreamTooLong);
+
if (value > _capacity)
{
int newCapacity = value;
if (newCapacity < 256)
+ {
newCapacity = 256;
+ }
+
// We are ok with this overflowing since the next statement will deal
// with the cases where _capacity*2 overflows.
if (newCapacity < _capacity * 2)
+ {
newCapacity = _capacity * 2;
- // We want to expand the array up to Array.MaxArrayLengthOneDimensional
+ }
+
+ // We want to expand the array up to Array.MaxByteArrayLength
// And we want to give the user the value that they asked for
if ((uint)(_capacity * 2) > Array.MaxByteArrayLength)
+ {
newCapacity = value > Array.MaxByteArrayLength ? value : Array.MaxByteArrayLength;
+ }
Capacity = newCapacity;
return true;
return _buffer;
}
- // PERF: Get origin and length - used in ResourceWriter.
- [FriendAccessAllowed]
- internal void InternalGetOriginAndLength(out int origin, out int length)
- {
- if (!_isOpen) __Error.StreamIsClosed();
- origin = _origin;
- length = _length;
- }
-
// PERF: True cursor position, we don't need _origin for direct access
internal int InternalGetPosition()
{
- if (!_isOpen) __Error.StreamIsClosed();
return _position;
}
// PERF: Takes out Int32 as fast as possible
internal int InternalReadInt32()
{
- if (!_isOpen)
- __Error.StreamIsClosed();
+ EnsureNotClosed();
int pos = (_position += 4); // use temp to avoid a race condition
if (pos > _length)
{
_position = _length;
- __Error.EndOfFile();
+ throw Error.GetEndOfFile();
}
return (int)(_buffer[pos - 4] | _buffer[pos - 3] << 8 | _buffer[pos - 2] << 16 | _buffer[pos - 1] << 24);
}
// PERF: Get actual length of bytes available for read; do sanity checks; shift position - i.e. everything except actual copying bytes
internal int InternalEmulateRead(int count)
{
- if (!_isOpen) __Error.StreamIsClosed();
+ EnsureNotClosed();
int n = _length - _position;
- if (n > count) n = count;
- if (n < 0) n = 0;
+ if (n > count)
+ n = count;
+ if (n < 0)
+ n = 0;
Debug.Assert(_position + n >= 0, "_position + n >= 0"); // len is less than 2^31 -1.
_position += n;
{
get
{
- if (!_isOpen) __Error.StreamIsClosed();
+ EnsureNotClosed();
return _capacity - _origin;
}
set
{
// Only update the capacity if the MS is expandable and the value is different than the current capacity.
// Special behavior if the MS isn't expandable: we don't throw if value is the same as the current capacity
- if (value < Length) throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_SmallCapacity);
+ if (value < Length)
+ throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_SmallCapacity);
- if (!_isOpen) __Error.StreamIsClosed();
- if (!_expandable && (value != Capacity)) __Error.MemoryStreamNotExpandable();
+ EnsureNotClosed();
+
+ if (!_expandable && (value != Capacity))
+ throw new NotSupportedException(SR.NotSupported_MemStreamNotExpandable);
// MemoryStream has this invariant: _origin > 0 => !expandable (see ctors)
if (_expandable && value != _capacity)
if (value > 0)
{
byte[] newBuffer = new byte[value];
- if (_length > 0) Buffer.InternalBlockCopy(_buffer, 0, newBuffer, 0, _length);
+ if (_length > 0)
+ {
+ Buffer.BlockCopy(_buffer, 0, newBuffer, 0, _length);
+ }
_buffer = newBuffer;
}
else
{
get
{
- if (!_isOpen) __Error.StreamIsClosed();
+ EnsureNotClosed();
return _length - _origin;
}
}
{
get
{
- if (!_isOpen) __Error.StreamIsClosed();
+ EnsureNotClosed();
return _position - _origin;
}
set
if (value < 0)
throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_NeedNonNegNum);
- if (!_isOpen) __Error.StreamIsClosed();
+ EnsureNotClosed();
if (value > MemStreamMaxLength)
throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_StreamLength);
}
}
- public override int Read([In, Out] byte[] buffer, int offset, int count)
+ public override int Read(byte[] buffer, int offset, int count)
{
if (buffer == null)
throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
if (buffer.Length - offset < count)
throw new ArgumentException(SR.Argument_InvalidOffLen);
- if (!_isOpen) __Error.StreamIsClosed();
+ EnsureNotClosed();
int n = _length - _position;
- if (n > count) n = count;
+ if (n > count)
+ n = count;
if (n <= 0)
return 0;
buffer[offset + byteCount] = _buffer[_position + byteCount];
}
else
- Buffer.InternalBlockCopy(_buffer, _position, buffer, offset, n);
+ Buffer.BlockCopy(_buffer, _position, buffer, offset, n);
_position += n;
return n;
return base.Read(destination);
}
- if (!_isOpen)
- {
- __Error.StreamIsClosed();
- }
+ EnsureNotClosed();
int n = Math.Min(_length - _position, destination.Length);
if (n <= 0)
- {
return 0;
- }
- // TODO https://github.com/dotnet/corefx/issues/22388:
+ // TODO https://github.com/dotnet/coreclr/issues/15076:
// Read(byte[], int, int) has an n <= 8 optimization, presumably based
// on benchmarking. Determine if/where such a cut-off is here and add
// an equivalent optimization if necessary.
}
}
-
public override int ReadByte()
{
- if (!_isOpen) __Error.StreamIsClosed();
+ EnsureNotClosed();
- if (_position >= _length) return -1;
+ if (_position >= _length)
+ return -1;
return _buffer[_position++];
}
}
}
- public override Task CopyToAsync(Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
+ public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
{
// This implementation offers beter performance compared to the base class version.
// since it does not call through to ReadAsync() which a subclass might have overridden.
// To be safe we will only use this implementation in cases where we know it is safe to do so,
// and delegate to our base class (which will call into ReadAsync) when we are not sure.
- if (this.GetType() != typeof(MemoryStream))
+ if (GetType() != typeof(MemoryStream))
return base.CopyToAsync(destination, bufferSize, cancellationToken);
// If cancelled - return fast:
// (require that InternalEmulateRead does not throw,
// otherwise it needs to be wrapped into try-catch-Task.FromException like memStrDest.Write below)
- Int32 pos = _position;
- Int32 n = InternalEmulateRead(_length - _position);
+ int pos = _position;
+ int n = InternalEmulateRead(_length - _position);
// If we were already at or past the end, there's no copying to do so just quit.
if (n == 0)
public override long Seek(long offset, SeekOrigin loc)
{
- if (!_isOpen) __Error.StreamIsClosed();
+ EnsureNotClosed();
if (offset > MemStreamMaxLength)
throw new ArgumentOutOfRangeException(nameof(offset), SR.ArgumentOutOfRange_StreamLength);
+
switch (loc)
{
case SeekOrigin.Begin:
// Sets the length of the stream to a given value. The new
// value must be nonnegative and less than the space remaining in
- // the array, Int32.MaxValue - origin
+ // the array, int.MaxValue - origin
// Origin is 0 in all cases other than a MemoryStream created on
// top of an existing array and a specific starting offset was passed
// into the MemoryStream constructor. The upper bounds prevents any
// situations where a stream may be created on top of an array then
// the stream is made longer than the maximum possible length of the
- // array (Int32.MaxValue).
+ // array (int.MaxValue).
//
public override void SetLength(long value)
{
- if (value < 0 || value > Int32.MaxValue)
- {
+ if (value < 0 || value > int.MaxValue)
throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_StreamLength);
- }
+
EnsureWriteable();
// Origin wasn't publicly exposed above.
- Debug.Assert(MemStreamMaxLength == Int32.MaxValue); // Check parameter validation logic in this method if this fails.
- if (value > (Int32.MaxValue - _origin))
- {
+ Debug.Assert(MemStreamMaxLength == int.MaxValue); // Check parameter validation logic in this method if this fails.
+ if (value > (int.MaxValue - _origin))
throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_StreamLength);
- }
int newLength = _origin + (int)value;
bool allocatedNewArray = EnsureCapacity(newLength);
if (!allocatedNewArray && newLength > _length)
Array.Clear(_buffer, _length, newLength - _length);
_length = newLength;
- if (_position > newLength) _position = newLength;
+ if (_position > newLength)
+ _position = newLength;
}
public virtual byte[] ToArray()
{
- byte[] copy = new byte[_length - _origin];
- Buffer.InternalBlockCopy(_buffer, _origin, copy, 0, _length - _origin);
+ int count = _length - _origin;
+ if (count == 0)
+ return Array.Empty<byte>();
+ byte[] copy = new byte[count];
+ Buffer.BlockCopy(_buffer, _origin, copy, 0, count);
return copy;
}
if (buffer.Length - offset < count)
throw new ArgumentException(SR.Argument_InvalidOffLen);
- if (!_isOpen) __Error.StreamIsClosed();
+ EnsureNotClosed();
EnsureWriteable();
int i = _position + count;
{
bool allocatedNewArray = EnsureCapacity(i);
if (allocatedNewArray)
+ {
mustZero = false;
+ }
}
if (mustZero)
+ {
Array.Clear(_buffer, _length, i - _length);
+ }
_length = i;
}
if ((count <= 8) && (buffer != _buffer))
{
int byteCount = count;
while (--byteCount >= 0)
+ {
_buffer[_position + byteCount] = buffer[offset + byteCount];
+ }
}
else
- Buffer.InternalBlockCopy(buffer, offset, _buffer, _position, count);
+ {
+ Buffer.BlockCopy(buffer, offset, _buffer, _position, count);
+ }
_position = i;
}
return;
}
- if (!_isOpen)
- {
- __Error.StreamIsClosed();
- }
+ EnsureNotClosed();
EnsureWriteable();
// Check for overflow
int i = _position + source.Length;
if (i < 0)
- {
throw new IOException(SR.IO_StreamTooLong);
- }
if (i > _length)
{
public override void WriteByte(byte value)
{
- if (!_isOpen) __Error.StreamIsClosed();
+ EnsureNotClosed();
EnsureWriteable();
if (_position >= _length)
{
bool allocatedNewArray = EnsureCapacity(newLength);
if (allocatedNewArray)
+ {
mustZero = false;
+ }
}
if (mustZero)
+ {
Array.Clear(_buffer, _length, _position - _length);
+ }
_length = newLength;
}
_buffer[_position++] = value;
if (stream == null)
throw new ArgumentNullException(nameof(stream), SR.ArgumentNull_Stream);
- if (!_isOpen) __Error.StreamIsClosed();
+ EnsureNotClosed();
+
stream.Write(_buffer, _origin, _length - _origin);
}
}
base.Dispose(disposing);
}
+ private void EnsureNotClosed()
+ {
+ if (!_isOpen)
+ throw Error.GetStreamIsClosed();
+ }
+
+ private void EnsureReadable()
+ {
+ if (!CanRead)
+ throw Error.GetReadNotSupported();
+ }
+
+ private void EnsureWriteable()
+ {
+ if (!CanWrite)
+ throw Error.GetWriteNotSupported();
+ }
+
/// <summary>
/// Since it's a memory stream, this method does nothing.
/// </summary>
public override void Flush()
{
- if (!_isOpen) throw Error.GetStreamIsClosed();
+ EnsureNotClosed();
}
/// <summary>
{
get
{
- if (!_isOpen) throw Error.GetStreamIsClosed();
+ EnsureNotClosed();
return Interlocked.Read(ref _length);
}
}
{
get
{
- if (!_isOpen) throw Error.GetStreamIsClosed();
+ EnsureNotClosed();
return _capacity;
}
}
{
get
{
- if (_buffer != null) throw new NotSupportedException(SR.NotSupported_UmsSafeBuffer);
- if (!_isOpen) throw Error.GetStreamIsClosed();
+ if (_buffer != null)
+ throw new NotSupportedException(SR.NotSupported_UmsSafeBuffer);
+
+ EnsureNotClosed();
// Use a temp to avoid a race
long pos = Interlocked.Read(ref _position);
}
set
{
- if (_buffer != null) throw new NotSupportedException(SR.NotSupported_UmsSafeBuffer);
- if (!_isOpen) throw Error.GetStreamIsClosed();
+ if (_buffer != null)
+ throw new NotSupportedException(SR.NotSupported_UmsSafeBuffer);
+
+ EnsureNotClosed();
if (value < _mem)
throw new IOException(SR.IO_SeekBeforeBegin);
internal int ReadCore(Span<byte> destination)
{
- if (!_isOpen) throw Error.GetStreamIsClosed();
- if (!CanRead) throw Error.GetReadNotSupported();
+ EnsureNotClosed();
+ EnsureReadable();
// Use a local variable to avoid a race where another thread
// changes our position after we decide we can read some bytes.
/// <returns></returns>
public override int ReadByte()
{
- if (!_isOpen) throw Error.GetStreamIsClosed();
- if (!CanRead) throw Error.GetReadNotSupported();
+ EnsureNotClosed();
+ EnsureReadable();
long pos = Interlocked.Read(ref _position); // Use a local to avoid a race condition
long len = Interlocked.Read(ref _length);
/// <returns></returns>
public override long Seek(long offset, SeekOrigin loc)
{
- if (!_isOpen) throw Error.GetStreamIsClosed();
+ EnsureNotClosed();
+
switch (loc)
{
case SeekOrigin.Begin:
throw new ArgumentOutOfRangeException(nameof(value), SR.ArgumentOutOfRange_NeedNonNegNum);
if (_buffer != null)
throw new NotSupportedException(SR.NotSupported_UmsSafeBuffer);
- if (!_isOpen) throw Error.GetStreamIsClosed();
- if (!CanWrite) throw Error.GetWriteNotSupported();
+
+ EnsureNotClosed();
+ EnsureWriteable();
if (value > _capacity)
throw new IOException(SR.IO_FixedCapacity);
internal unsafe void WriteCore(ReadOnlySpan<byte> source)
{
- if (!_isOpen) throw Error.GetStreamIsClosed();
- if (!CanWrite) throw Error.GetWriteNotSupported();
+ EnsureNotClosed();
+ EnsureWriteable();
long pos = Interlocked.Read(ref _position); // Use a local to avoid a race condition
long len = Interlocked.Read(ref _length);
/// <param name="value"></param>
public override void WriteByte(byte value)
{
- if (!_isOpen) throw Error.GetStreamIsClosed();
- if (!CanWrite) throw Error.GetWriteNotSupported();
+ EnsureNotClosed();
+ EnsureWriteable();
long pos = Interlocked.Read(ref _position); // Use a local to avoid a race condition
long len = Interlocked.Read(ref _length);
private const int MaxUInt32HexDigits = 8;
private const int MaxUInt32DecDigits = 10;
private const int MaxUInt64DecDigits = 20;
- private const int MinStringBufferSize = 105;
+ private const int CharStackBufferSize = 32;
private const string PosNumberFormat = "#";
- private static readonly char[] s_numberToStringScratch = new char[MinStringBufferSize];
-
private static readonly string[] s_posCurrencyFormats =
{
"$#", "#$", "$ #", "# $"
{
NumberBuffer number = default;
Int32ToNumber(value, ref number);
- var sb = new ValueStringBuilder(s_numberToStringScratch);
+ ValueStringBuilder sb;
+ unsafe
+ {
+ char* stackPtr = stackalloc char[CharStackBufferSize];
+ sb = new ValueStringBuilder(new Span<char>(stackPtr, CharStackBufferSize));
+ }
if (fmt != 0)
{
NumberToString(ref sb, ref number, fmt, digits, info, false);
{
NumberBuffer number = default;
Int32ToNumber(value, ref number);
- var sb = new ValueStringBuilder(s_numberToStringScratch);
+ ValueStringBuilder sb;
+ unsafe
+ {
+ char* stackPtr = stackalloc char[CharStackBufferSize];
+ sb = new ValueStringBuilder(new Span<char>(stackPtr, CharStackBufferSize));
+ }
if (fmt != 0)
{
NumberToString(ref sb, ref number, fmt, digits, info, false);
{
NumberBuffer number = default;
UInt32ToNumber(value, ref number);
- var sb = new ValueStringBuilder(s_numberToStringScratch);
+ ValueStringBuilder sb;
+ unsafe
+ {
+ char* stackPtr = stackalloc char[CharStackBufferSize];
+ sb = new ValueStringBuilder(new Span<char>(stackPtr, CharStackBufferSize));
+ }
if (fmt != 0)
{
NumberToString(ref sb, ref number, fmt, digits, info, false);
{
NumberBuffer number = default;
UInt32ToNumber(value, ref number);
- var sb = new ValueStringBuilder(s_numberToStringScratch);
+ ValueStringBuilder sb;
+ unsafe
+ {
+ char* stackPtr = stackalloc char[CharStackBufferSize];
+ sb = new ValueStringBuilder(new Span<char>(stackPtr, CharStackBufferSize));
+ }
if (fmt != 0)
{
NumberToString(ref sb, ref number, fmt, digits, info, false);
{
NumberBuffer number = default;
Int64ToNumber(value, ref number);
- var sb = new ValueStringBuilder(s_numberToStringScratch);
+ ValueStringBuilder sb;
+ unsafe
+ {
+ char* stackPtr = stackalloc char[CharStackBufferSize];
+ sb = new ValueStringBuilder(new Span<char>(stackPtr, CharStackBufferSize));
+ }
if (fmt != 0)
{
NumberToString(ref sb, ref number, fmt, digits, info, false);
{
NumberBuffer number = default;
Int64ToNumber(value, ref number);
- var sb = new ValueStringBuilder(s_numberToStringScratch);
+ ValueStringBuilder sb;
+ unsafe
+ {
+ char* stackPtr = stackalloc char[CharStackBufferSize];
+ sb = new ValueStringBuilder(new Span<char>(stackPtr, CharStackBufferSize));
+ }
if (fmt != 0)
{
NumberToString(ref sb, ref number, fmt, digits, info, false);
{
NumberBuffer number = default;
UInt64ToNumber(value, ref number);
- var sb = new ValueStringBuilder(s_numberToStringScratch);
+ ValueStringBuilder sb;
+ unsafe
+ {
+ char* stackPtr = stackalloc char[CharStackBufferSize];
+ sb = new ValueStringBuilder(new Span<char>(stackPtr, CharStackBufferSize));
+ }
if (fmt != 0)
{
NumberToString(ref sb, ref number, fmt, digits, info, false);
{
NumberBuffer number = default;
UInt64ToNumber(value, ref number);
- var sb = new ValueStringBuilder(s_numberToStringScratch);
+ ValueStringBuilder sb;
+ unsafe
+ {
+ char* stackPtr = stackalloc char[CharStackBufferSize];
+ sb = new ValueStringBuilder(new Span<char>(stackPtr, CharStackBufferSize));
+ }
if (fmt != 0)
{
NumberToString(ref sb, ref number, fmt, digits, info, false);
{
get
{
- if ((_objectName == null)) // && !CompatibilitySwitches.IsAppEarlierThanWindowsPhone8)
+ if (_objectName == null)
{
return String.Empty;
}
_chars = _arrayToReturnToPool = poolArray;
if (toReturn != null)
{
- ArrayPool<char>.Shared.Return(_arrayToReturnToPool);
+ ArrayPool<char>.Shared.Return(toReturn);
}
}
}
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-// =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
-//
-//
-//
// Helper methods for using Tasks to implement the APM pattern.
//
// Example usage, wrapping a Task<int>-returning FooAsync method with Begin/EndFoo methods:
+//
// public IAsyncResult BeginFoo(..., AsyncCallback callback, object state)
// {
// Task<int> t = FooAsync(...);
// {
// return TaskToApm.End<int>(asyncResult);
// }
-//
-// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-using System.IO;
using System.Diagnostics;
namespace System.Threading.Tasks
IAsyncResult asyncResult;
if (task.IsCompleted)
{
- // Synchronous completion
+ // Synchronous completion.
asyncResult = new TaskWrapperAsyncResult(task, state, completedSynchronously: true);
- if (callback != null)
- callback(asyncResult);
+ callback?.Invoke(asyncResult);
}
- // Otherwise, we need to schedule a callback. Whether we can use the Task as the IAsyncResult
- // depends on whether the Task's AsyncState has reference equality with the requested state.
else
{
- // Asynchronous completion
+ // For asynchronous completion we need to schedule a callback. Whether we can use the Task as the IAsyncResult
+ // depends on whether the Task's AsyncState has reference equality with the requested state.
asyncResult = task.AsyncState == state ? (IAsyncResult)task : new TaskWrapperAsyncResult(task, state, completedSynchronously: false);
if (callback != null)
+ {
InvokeCallbackWhenTaskCompletes(task, callback, asyncResult);
+ }
}
return asyncResult;
}
task = twar.Task;
Debug.Assert(task != null, "TaskWrapperAsyncResult should never wrap a null Task.");
}
- // Otherwise, the IAsyncResult should be a Task.
else
{
+ // Otherwise, the IAsyncResult should be a Task.
task = asyncResult as Task;
}
// Make sure we actually got a task, then complete the operation by waiting on it.
if (task == null)
- __Error.WrongAsyncResult();
+ {
+ throw new ArgumentNullException();
+ }
+
task.GetAwaiter().GetResult();
}
task = twar.Task as Task<TResult>;
Debug.Assert(twar.Task != null, "TaskWrapperAsyncResult should never wrap a null Task.");
}
- // Otherwise, the IAsyncResult should be a Task<TResult>.
else
{
+ // Otherwise, the IAsyncResult should be a Task<TResult>.
task = asyncResult as Task<TResult>;
}
// Make sure we actually got a task, then complete the operation by waiting on it.
if (task == null)
- __Error.WrongAsyncResult();
+ {
+ throw new ArgumentNullException();
+ }
+
return task.GetAwaiter().GetResult();
}
/// <summary>The wrapped Task.</summary>
internal readonly Task Task;
/// <summary>The new AsyncState value.</summary>
- private readonly object m_state;
+ private readonly object _state;
/// <summary>The new CompletedSynchronously value.</summary>
- private readonly bool m_completedSynchronously;
+ private readonly bool _completedSynchronously;
/// <summary>Initializes the IAsyncResult with the Task to wrap and the overriding AsyncState and CompletedSynchronously values.</summary>
/// <param name="task">The Task to wrap.</param>
Debug.Assert(!completedSynchronously || task.IsCompleted, "If completedSynchronously is true, the task must be completed.");
this.Task = task;
- m_state = state;
- m_completedSynchronously = completedSynchronously;
+ _state = state;
+ _completedSynchronously = completedSynchronously;
}
// The IAsyncResult implementation.
// - IsCompleted and AsyncWaitHandle just pass through to the Task.
// - AsyncState and CompletedSynchronously return the corresponding values stored in this object.
- object IAsyncResult.AsyncState { get { return m_state; } }
- bool IAsyncResult.CompletedSynchronously { get { return m_completedSynchronously; } }
+ object IAsyncResult.AsyncState { get { return _state; } }
+ bool IAsyncResult.CompletedSynchronously { get { return _completedSynchronously; } }
bool IAsyncResult.IsCompleted { get { return this.Task.IsCompleted; } }
WaitHandle IAsyncResult.AsyncWaitHandle { get { return ((IAsyncResult)this.Task).AsyncWaitHandle; } }
}
// case where the compat flags have been setup.
Debug.Assert(!_compatFlagsInitialized);
_compatFlagsInitialized = true;
-
- CompatibilitySwitches.InitializeSwitches();
}
/// <summary>
public static extern void BlockCopy(Array src, int srcOffset,
Array dst, int dstOffset, int count);
- // A very simple and efficient memmove that assumes all of the
- // 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.
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern void InternalBlockCopy(Array src, int srcOffsetBytes,
- Array dst, int dstOffsetBytes, int byteCount);
-
// This is ported from the optimized CRT assembly in memchr.asm. The JIT generates
// pretty good code here and this ends up being within a couple % of the CRT asm.
// It is however cross platform as the CRT hasn't ported their fast version to 64-bit
// This behavioral difference is unfortunate but intentional because
// 1. This method is given access to other internal dlls and this close to release we do not want to change it.
// 2. It is difficult to get this right for arm and again due to release dates we would like to visit it later.
- [FriendAccessAllowed]
#if ARM
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal unsafe static extern void Memcpy(byte* dest, byte* src, int len);
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Runtime.CompilerServices;
-
-namespace System
-{
- [FriendAccessAllowed]
- internal static class CompatibilitySwitches
- {
- private static bool s_AreSwitchesSet;
-
- public static bool IsCompatibilityBehaviorDefined
- {
- get
- {
- return s_AreSwitchesSet;
- }
- }
-
- internal static void InitializeSwitches()
- {
- s_AreSwitchesSet = true;
- }
- }
-}
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*============================================================
-**
-**
-**
-** Purpose: Attributes for debugger
-**
-**
-===========================================================*/
-
-
-using System;
-using System.Runtime.InteropServices;
-
-namespace System.Diagnostics
-{
- [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Constructor, Inherited = false)]
- public sealed class DebuggerStepThroughAttribute : Attribute
- {
- public DebuggerStepThroughAttribute() { }
- }
-
- [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Constructor, Inherited = false)]
- public sealed class DebuggerHiddenAttribute : Attribute
- {
- public DebuggerHiddenAttribute() { }
- }
-
- [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Constructor | AttributeTargets.Struct, Inherited = false)]
- public sealed class DebuggerNonUserCodeAttribute : Attribute
- {
- public DebuggerNonUserCodeAttribute() { }
- }
-
- // Attribute class used by the compiler to mark modules.
- // If present, then debugging information for everything in the
- // assembly was generated by the compiler, and will be preserved
- // by the Runtime so that the debugger can provide full functionality
- // in the case of JIT attach. If not present, then the compiler may
- // or may not have included debugging information, and the Runtime
- // won't preserve the debugging info, which will make debugging after
- // a JIT attach difficult.
- [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module, AllowMultiple = false)]
- public sealed class DebuggableAttribute : Attribute
- {
- [Flags]
- public enum DebuggingModes
- {
- None = 0x0,
- Default = 0x1,
- DisableOptimizations = 0x100,
- IgnoreSymbolStoreSequencePoints = 0x2,
- EnableEditAndContinue = 0x4
- }
-
- private DebuggingModes m_debuggingModes;
-
- public DebuggableAttribute(bool isJITTrackingEnabled,
- bool isJITOptimizerDisabled)
- {
- m_debuggingModes = 0;
-
- if (isJITTrackingEnabled)
- {
- m_debuggingModes |= DebuggingModes.Default;
- }
-
- if (isJITOptimizerDisabled)
- {
- m_debuggingModes |= DebuggingModes.DisableOptimizations;
- }
- }
-
- public DebuggableAttribute(DebuggingModes modes)
- {
- m_debuggingModes = modes;
- }
-
- public bool IsJITTrackingEnabled
- {
- get { return ((m_debuggingModes & DebuggingModes.Default) != 0); }
- }
-
- public bool IsJITOptimizerDisabled
- {
- get { return ((m_debuggingModes & DebuggingModes.DisableOptimizations) != 0); }
- }
-
- public DebuggingModes DebuggingFlags
- {
- get { return m_debuggingModes; }
- }
- }
-
- // DebuggerBrowsableState states are defined as follows:
- // Never never show this element
- // Expanded expansion of the class is done, so that all visible internal members are shown
- // Collapsed expansion of the class is not performed. Internal visible members are hidden
- // RootHidden The target element itself should not be shown, but should instead be
- // automatically expanded to have its members displayed.
- // Default value is collapsed
-
- // Please also change the code which validates DebuggerBrowsableState variable (in this file)
- // if you change this enum.
- public enum DebuggerBrowsableState
- {
- Never = 0,
- //Expanded is not supported in this release
- //Expanded = 1,
- Collapsed = 2,
- RootHidden = 3
- }
-
-
- // the one currently supported with the csee.dat
- // (mcee.dat, autoexp.dat) file.
- [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
- public sealed class DebuggerBrowsableAttribute : Attribute
- {
- private DebuggerBrowsableState state;
- public DebuggerBrowsableAttribute(DebuggerBrowsableState state)
- {
- if (state < DebuggerBrowsableState.Never || state > DebuggerBrowsableState.RootHidden)
- throw new ArgumentOutOfRangeException(nameof(state));
-
- this.state = state;
- }
- public DebuggerBrowsableState State
- {
- get { return state; }
- }
- }
-
-
- // DebuggerTypeProxyAttribute
- [AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = true)]
- public sealed class DebuggerTypeProxyAttribute : Attribute
- {
- private string typeName;
- private string targetName;
- private Type target;
-
- public DebuggerTypeProxyAttribute(Type type)
- {
- if (type == null)
- {
- throw new ArgumentNullException(nameof(type));
- }
-
- typeName = type.AssemblyQualifiedName;
- }
-
- public DebuggerTypeProxyAttribute(string typeName)
- {
- this.typeName = typeName;
- }
- public string ProxyTypeName
- {
- get { return typeName; }
- }
-
- public Type Target
- {
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value));
- }
-
- targetName = value.AssemblyQualifiedName;
- target = value;
- }
-
- get { return target; }
- }
-
- public string TargetTypeName
- {
- get { return targetName; }
- set { targetName = value; }
- }
- }
-
- // This attribute is used to control what is displayed for the given class or field
- // in the data windows in the debugger. The single argument to this attribute is
- // the string that will be displayed in the value column for instances of the type.
- // This string can include text between { and } which can be either a field,
- // property or method (as will be documented in mscorlib). In the C# case,
- // a general expression will be allowed which only has implicit access to the this pointer
- // for the current instance of the target type. The expression will be limited,
- // however: there is no access to aliases, locals, or pointers.
- // In addition, attributes on properties referenced in the expression are not processed.
- [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Delegate | AttributeTargets.Enum | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Assembly, AllowMultiple = true)]
- public sealed class DebuggerDisplayAttribute : Attribute
- {
- private string name;
- private string value;
- private string type;
- private string targetName;
- private Type target;
-
- public DebuggerDisplayAttribute(string value)
- {
- if (value == null)
- {
- this.value = "";
- }
- else
- {
- this.value = value;
- }
- name = "";
- type = "";
- }
-
- public string Value
- {
- get { return value; }
- }
-
- public string Name
- {
- get { return name; }
- set { name = value; }
- }
-
- public string Type
- {
- get { return type; }
- set { type = value; }
- }
-
- public Type Target
- {
- set
- {
- if (value == null)
- {
- throw new ArgumentNullException(nameof(value));
- }
-
- targetName = value.AssemblyQualifiedName;
- target = value;
- }
- get { return target; }
- }
-
- public string TargetTypeName
- {
- get { return targetName; }
- set { targetName = value; }
- }
- }
-}
-
-
//
// This will produce an XML file, where each event is pretty-printed with all its arguments nicely parsed.
//
- [FriendAccessAllowed]
+ // [FriendAccessAllowed]
[EventSource(Guid = "8E9F5090-2D75-4d03-8A81-E5AFBF85DAF1", Name = "System.Diagnostics.Eventing.FrameworkEventSource")]
sealed internal class FrameworkEventSource : EventSource
{
}
/// <summary>ETW tasks that have start/stop events.</summary>
- [FriendAccessAllowed]
public static class Tasks // this name is important for EventSource
{
/// <summary>Begin / End - GetResponse.</summary>
public const EventTask ThreadTransfer = (EventTask)3;
}
- [FriendAccessAllowed]
public static class Opcodes
{
public const EventOpcode ReceiveHandled = (EventOpcode)11;
}
}
- [FriendAccessAllowed]
+ // [FriendAccessAllowed]
internal void AddExceptionDataForRestrictedErrorInfo(
string restrictedError,
string restrictedErrorReference,
return remoteStackTraceString + tempStackTraceString;
}
- [FriendAccessAllowed]
+ // [FriendAccessAllowed]
internal void SetErrorCode(int hr)
{
HResult = hr;
public virtual int PeekChar()
{
- if (_stream == null) __Error.FileNotOpen();
+ if (_stream == null) throw Error.GetFileNotOpen();
if (!_stream.CanSeek)
return -1;
{
if (_stream == null)
{
- __Error.FileNotOpen();
+ throw Error.GetFileNotOpen();
}
return InternalReadOneChar();
}
public virtual byte ReadByte()
{
// Inlined to avoid some method call overhead with FillBuffer.
- if (_stream == null) __Error.FileNotOpen();
+ if (_stream == null) throw Error.GetFileNotOpen();
int b = _stream.ReadByte();
if (b == -1)
- __Error.EndOfFile();
+ throw Error.GetEndOfFile();
return (byte)b;
}
int value = Read();
if (value == -1)
{
- __Error.EndOfFile();
+ throw Error.GetEndOfFile();
}
return (char)value;
}
{
if (_isMemoryStream)
{
- if (_stream == null) __Error.FileNotOpen();
+ if (_stream == null) throw Error.GetFileNotOpen();
// read directly from MemoryStream buffer
MemoryStream mStream = _stream as MemoryStream;
Debug.Assert(mStream != null, "_stream as MemoryStream != null");
public virtual String ReadString()
{
if (_stream == null)
- __Error.FileNotOpen();
+ throw Error.GetFileNotOpen();
int currPos = 0;
int n;
n = _stream.Read(_charBytes, 0, readLength);
if (n == 0)
{
- __Error.EndOfFile();
+ throw Error.GetEndOfFile();
}
charsRead = _decoder.GetChars(_charBytes, 0, n, _charBuffer, 0);
}
if (_stream == null)
- __Error.FileNotOpen();
+ throw Error.GetFileNotOpen();
// SafeCritical: index and count have already been verified to be a valid range for the buffer
return InternalReadChars(new Span<char>(buffer, index, count));
public virtual int Read(Span<char> buffer)
{
if (_stream == null)
- __Error.FileNotOpen();
+ throw Error.GetFileNotOpen();
return InternalReadChars(buffer);
}
}
if (_stream == null)
{
- __Error.FileNotOpen();
+ throw Error.GetFileNotOpen();
}
if (count == 0)
if (n != count)
{
char[] copy = new char[n];
- Buffer.InternalBlockCopy(chars, 0, copy, 0, 2 * n); // sizeof(char)
+ Buffer.BlockCopy(chars, 0, copy, 0, 2 * n); // sizeof(char)
chars = copy;
}
if (buffer.Length - index < count)
throw new ArgumentException(SR.Argument_InvalidOffLen);
- if (_stream == null) __Error.FileNotOpen();
+ if (_stream == null) throw Error.GetFileNotOpen();
return _stream.Read(buffer, index, count);
}
public virtual int Read(Span<byte> buffer)
{
if (_stream == null)
- __Error.FileNotOpen();
+ throw Error.GetFileNotOpen();
return _stream.Read(buffer);
}
public virtual byte[] ReadBytes(int count)
{
if (count < 0) throw new ArgumentOutOfRangeException(nameof(count), SR.ArgumentOutOfRange_NeedNonNegNum);
- if (_stream == null) __Error.FileNotOpen();
+ if (_stream == null) throw Error.GetFileNotOpen();
if (count == 0)
{
{
// Trim array. This should happen on EOF & possibly net streams.
byte[] copy = new byte[numRead];
- Buffer.InternalBlockCopy(result, 0, copy, 0, numRead);
+ Buffer.BlockCopy(result, 0, copy, 0, numRead);
result = copy;
}
int bytesRead = 0;
int n = 0;
- if (_stream == null) __Error.FileNotOpen();
+ if (_stream == null) throw Error.GetFileNotOpen();
// Need to find a good threshold for calling ReadByte() repeatedly
// vs. calling Read(byte[], int, int) for both buffered & unbuffered
{
n = _stream.ReadByte();
if (n == -1)
- __Error.EndOfFile();
+ throw Error.GetEndOfFile();
_buffer[0] = (byte)n;
return;
}
n = _stream.Read(_buffer, bytesRead, numBytes - bytesRead);
if (n == 0)
{
- __Error.EndOfFile();
+ throw Error.GetEndOfFile();
}
bytesRead += n;
} while (bytesRead < numBytes);
{
int n = fs.Read(bytes, index, count);
if (n == 0)
- __Error.EndOfFile();
+ throw Error.GetEndOfFile();
index += n;
count -= n;
}
byte[] buffer, int offset, int count, AsyncCallback callback, Object state,
bool serializeAsynchronously, bool apm)
{
- if (!CanRead) __Error.ReadNotSupported();
+ if (!CanRead) throw Error.GetReadNotSupported();
// To avoid a race with a stream's position pointer & generating race conditions
// with internal buffer indexes in our own streams that
byte[] buffer, int offset, int count, AsyncCallback callback, Object state,
bool serializeAsynchronously, bool apm)
{
- if (!CanWrite) __Error.WriteNotSupported();
+ if (!CanWrite) throw Error.GetWriteNotSupported();
// To avoid a race condition with a stream's position pointer & generating conditions
// with internal buffer indexes in our own streams that
public abstract void SetLength(long value);
- public abstract int Read([In, Out] byte[] buffer, int offset, int count);
+ public abstract int Read(byte[] buffer, int offset, int count);
public virtual int Read(Span<byte> destination)
{
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, Object state)
{
- if (!CanRead) __Error.ReadNotSupported();
+ if (!CanRead) throw Error.GetReadNotSupported();
return BlockingBeginRead(buffer, offset, count, callback, state);
}
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, Object state)
{
- if (!CanWrite) __Error.WriteNotSupported();
+ if (!CanWrite) throw Error.GetWriteNotSupported();
return BlockingBeginWrite(buffer, offset, count, callback, state);
}
BlockingEndWrite(asyncResult);
}
- public override int Read([In, Out] byte[] buffer, int offset, int count)
+ public override int Read(byte[] buffer, int offset, int count)
{
return 0;
}
{
SynchronousAsyncResult ar = asyncResult as SynchronousAsyncResult;
if (ar == null || ar._isWrite)
- __Error.WrongAsyncResult();
+ throw new ArgumentException(SR.Arg_WrongAsyncResult);
if (ar._endXxxCalled)
- __Error.EndReadCalledTwice();
+ throw new ArgumentException(SR.InvalidOperation_EndReadCalledMultiple);
ar._endXxxCalled = true;
{
SynchronousAsyncResult ar = asyncResult as SynchronousAsyncResult;
if (ar == null || !ar._isWrite)
- __Error.WrongAsyncResult();
+ throw new ArgumentException(SR.Arg_WrongAsyncResult);
if (ar._endXxxCalled)
- __Error.EndWriteCalledTwice();
+ throw new ArgumentException(SR.InvalidOperation_EndWriteCalledMultiple);
ar._endXxxCalled = true;
_stream.Flush();
}
- public override int Read([In, Out]byte[] bytes, int offset, int count)
+ public override int Read(byte[] bytes, int offset, int count)
{
lock (_stream)
return _stream.Read(bytes, offset, count);
public bool EndOfStream {
get {
if (stream == null)
- __Error.ReaderClosed();
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
CheckAsyncTaskInProgress();
public override int Peek() {
if (stream == null)
- __Error.ReaderClosed();
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
CheckAsyncTaskInProgress();
public override int Read() {
if (stream == null)
- __Error.ReaderClosed();
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
CheckAsyncTaskInProgress();
return result;
}
- public override int Read([In, Out] char[] buffer, int index, int count)
+ public override int Read(char[] buffer, int index, int count)
{
if (buffer==null)
throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
throw new ArgumentException(SR.Argument_InvalidOffLen);
if (stream == null)
- __Error.ReaderClosed();
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
CheckAsyncTaskInProgress();
if (n == 0) break; // We're at EOF
if (n > count) n = count;
if (!readToUserBuffer) {
- Buffer.InternalBlockCopy(charBuffer, charPos * 2, buffer, (index + charsRead) * 2, n*2);
+ Buffer.BlockCopy(charBuffer, charPos * 2, buffer, (index + charsRead) * 2, n*2);
charPos += n;
}
charsRead += n;
public override String ReadToEnd()
{
if (stream == null)
- __Error.ReaderClosed();
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
CheckAsyncTaskInProgress();
return GetStringAndReleaseSharedStringBuilder(sb);
}
- public override int ReadBlock([In, Out] char[] buffer, int index, int count)
+ public override int ReadBlock(char[] buffer, int index, int count)
{
if (buffer==null)
throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
throw new ArgumentException(SR.Argument_InvalidOffLen);
if (stream == null)
- __Error.ReaderClosed();
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
CheckAsyncTaskInProgress();
private void CompressBuffer(int n)
{
Debug.Assert(byteLen >= n, "CompressBuffer was called with a number of bytes greater than the current buffer length. Are two threads using this StreamReader at the same time?");
- Buffer.InternalBlockCopy(byteBuffer, n, byteBuffer, 0, byteLen - n);
+ Buffer.BlockCopy(byteBuffer, n, byteBuffer, 0, byteLen - n);
byteLen -= n;
}
public override String ReadLine()
{
if (stream == null)
- __Error.ReaderClosed();
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
CheckAsyncTaskInProgress();
return base.ReadLineAsync();
if (stream == null)
- __Error.ReaderClosed();
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
CheckAsyncTaskInProgress();
return base.ReadToEndAsync();
if (stream == null)
- __Error.ReaderClosed();
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
CheckAsyncTaskInProgress();
return base.ReadAsync(buffer, index, count);
if (stream == null)
- __Error.ReaderClosed();
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
CheckAsyncTaskInProgress();
if (!readToUserBuffer)
{
- Buffer.InternalBlockCopy(charBuffer, charPos * 2, buffer, (index + charsRead) * 2, n * 2);
+ Buffer.BlockCopy(charBuffer, charPos * 2, buffer, (index + charsRead) * 2, n * 2);
charPos += n;
}
return base.ReadBlockAsync(buffer, index, count);
if (stream == null)
- __Error.ReaderClosed();
+ throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
CheckAsyncTaskInProgress();
// buffer character array starting at position
// index. Returns the actual number of characters read.
//
- public virtual int Read([In, Out] char[] buffer, int index, int count)
+ public virtual int Read(char[] buffer, int index, int count)
{
if (buffer==null)
throw new ArgumentNullException(nameof(buffer), SR.ArgumentNull_Buffer);
// Blocking version of read. Returns only when count
// characters have been read or the end of the file was reached.
//
- public virtual int ReadBlock([In, Out] char[] buffer, int index, int count)
+ public virtual int ReadBlock(char[] buffer, int index, int count)
{
int i, n = 0;
do {
}
[MethodImplAttribute(MethodImplOptions.Synchronized)]
- public override int Read([In, Out] char[] buffer, int index, int count)
+ public override int Read(char[] buffer, int index, int count)
{
return _in.Read(buffer, index, count);
}
[MethodImplAttribute(MethodImplOptions.Synchronized)]
- public override int ReadBlock([In, Out] char[] buffer, int index, int count)
+ public override int ReadBlock(char[] buffer, int index, int count)
{
return _in.ReadBlock(buffer, index, count);
}
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*============================================================
-**
-**
-**
-**
-**
-** Purpose: Centralized error methods for the IO package.
-** Mostly useful for translating Win32 HRESULTs into meaningful
-** error strings & exceptions.
-**
-**
-===========================================================*/
-
-using System;
-using System.Runtime.InteropServices;
-using Win32Native = Microsoft.Win32.Win32Native;
-using System.Text;
-using System.Globalization;
-using System.Security;
-
-namespace System.IO
-{
- internal static class __Error
- {
- internal static void EndOfFile()
- {
- throw new EndOfStreamException(SR.IO_EOF_ReadBeyondEOF);
- }
-
- internal static void FileNotOpen()
- {
- throw new ObjectDisposedException(null, SR.ObjectDisposed_FileClosed);
- }
-
- internal static void StreamIsClosed()
- {
- throw new ObjectDisposedException(null, SR.ObjectDisposed_StreamClosed);
- }
-
- internal static void MemoryStreamNotExpandable()
- {
- throw new NotSupportedException(SR.NotSupported_MemStreamNotExpandable);
- }
-
- internal static void ReaderClosed()
- {
- throw new ObjectDisposedException(null, SR.ObjectDisposed_ReaderClosed);
- }
-
- internal static void ReadNotSupported()
- {
- throw new NotSupportedException(SR.NotSupported_UnreadableStream);
- }
-
- internal static void WrongAsyncResult()
- {
- throw new ArgumentException(SR.Arg_WrongAsyncResult);
- }
-
- internal static void EndReadCalledTwice()
- {
- // Should ideally be InvalidOperationExc but we can't maitain parity with Stream and FileStream without some work
- throw new ArgumentException(SR.InvalidOperation_EndReadCalledMultiple);
- }
-
- internal static void EndWriteCalledTwice()
- {
- // Should ideally be InvalidOperationExc but we can't maintain parity with Stream and FileStream without some work
- throw new ArgumentException(SR.InvalidOperation_EndWriteCalledMultiple);
- }
-
- internal static void WriteNotSupported()
- {
- throw new NotSupportedException(SR.NotSupported_UnwritableStream);
- }
- }
-}
// by the Parse methods if the NumberStyles.Any style is
// specified. Note, however, that the Parse methods do not accept
// NaNs or Infinities.
- [FriendAccessAllowed]
internal static partial class Number
{
[MethodImpl(MethodImplOptions.InternalCall)]
if (signature[i] == null)
throw new ArgumentException(SR.Arg_InvalidTypeInSignature);
m_parameterTypes[i] = signature[i].UnderlyingSystemType as RuntimeType;
- if (m_parameterTypes[i] == null || !(m_parameterTypes[i] is RuntimeType) || m_parameterTypes[i] == (RuntimeType)typeof(void))
+ if (m_parameterTypes[i] == null || m_parameterTypes[i] == (RuntimeType)typeof(void))
throw new ArgumentException(SR.Arg_InvalidTypeInSignature);
}
}
// check and store the return value
m_returnType = (returnType == null) ? (RuntimeType)typeof(void) : returnType.UnderlyingSystemType as RuntimeType;
- if ((m_returnType == null) || !(m_returnType is RuntimeType) || m_returnType.IsByRef)
+ if (m_returnType == null)
throw new NotSupportedException(SR.Arg_InvalidTypeInRetType);
if (transparentMethod)
// allowing us to ask for a WinRT-specific ResourceManager.
// It is important to have WindowsRuntimeResourceManagerBase as regular class with virtual methods and default implementations.
// Defining WindowsRuntimeResourceManagerBase as abstract class or interface will cause issues when adding more methods to it
- // because it�ll create dependency between mscorlib and System.Runtime.WindowsRuntime which will require always shipping both DLLs together.
- // Also using interface or abstract class will not play nice with FriendAccessAllowed.
+ // because it'll create dependency between mscorlib and System.Runtime.WindowsRuntime which will require always shipping both DLLs together.
//
- [FriendAccessAllowed]
- internal class WindowsRuntimeResourceManagerBase
+ // [FriendAccessAllowed]
+ internal abstract class WindowsRuntimeResourceManagerBase
{
- public virtual bool Initialize(string libpath, string reswFilename, out PRIExceptionInfo exceptionInfo) { exceptionInfo = null; return false; }
+ public abstract bool Initialize(string libpath, string reswFilename, out PRIExceptionInfo exceptionInfo);
- public virtual String GetString(String stringName, String startingCulture, String neutralResourcesCulture) { return null; }
+ public abstract String GetString(String stringName, String startingCulture, String neutralResourcesCulture);
- public virtual CultureInfo GlobalResourceContextBestFitCultureInfo
+ public abstract CultureInfo GlobalResourceContextBestFitCultureInfo
{
- get { return null; }
+ get;
}
- public virtual bool SetGlobalResourceContextDefaultCulture(CultureInfo ci) { return false; }
+ public abstract bool SetGlobalResourceContextDefaultCulture(CultureInfo ci);
}
- [FriendAccessAllowed]
+ // [FriendAccessAllowed]
internal class PRIExceptionInfo
{
public string _PackageSimpleName;
/// <returns>The initialized <see cref="AsyncVoidMethodBuilder"/>.</returns>
public static AsyncVoidMethodBuilder Create()
{
- SynchronizationContext sc = SynchronizationContext.CurrentNoFlow;
+ SynchronizationContext sc = SynchronizationContext.Current;
sc?.OperationStarted();
return new AsyncVoidMethodBuilder() { _synchronizationContext = sc };
}
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Runtime.CompilerServices
-{
- /// <summary>
- /// If AllInternalsVisible is not true for a friend assembly, the FriendAccessAllowed attribute
- /// indicates which internals are shared with that friend assembly.
- /// </summary>
- [AttributeUsage(AttributeTargets.Class |
- AttributeTargets.Constructor |
- AttributeTargets.Enum |
- AttributeTargets.Event |
- AttributeTargets.Field |
- AttributeTargets.Interface |
- AttributeTargets.Method |
- AttributeTargets.Property |
- AttributeTargets.Struct,
- AllowMultiple = false,
- Inherited = false)]
- [FriendAccessAllowed]
- internal sealed class FriendAccessAllowedAttribute : Attribute
- {
- }
-}
// post the continuation to it. However, treat the base type
// as if there wasn't a SynchronizationContext, since that's what it
// logically represents.
- var syncCtx = SynchronizationContext.CurrentNoFlow;
+ var syncCtx = SynchronizationContext.Current;
if (syncCtx != null && syncCtx.GetType() != typeof(SynchronizationContext))
{
syncCtx.Post(s_sendOrPostCallbackRunAction, continuation);
public byte m_arrayData;
}
- [FriendAccessAllowed]
internal static class JitHelpers
{
// The special dll name to be used for DllImport of QCalls
// implement the CLR's support for WinRT, so this type is internal as marking tdWindowsRuntime should
// generally be done via winmdexp for user code.
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Enum | AttributeTargets.Struct | AttributeTargets.Delegate, Inherited = false)]
- [System.Runtime.CompilerServices.FriendAccessAllowed]
+ // [System.Runtime.CompilerServices.FriendAccessAllowed]
internal sealed class WindowsRuntimeImportAttribute : Attribute
{
internal WindowsRuntimeImportAttribute()
// the get_Value property, allocate an appropriately-sized managed object, marshal the native object
// to the managed object, and free the native method. Also we want the return value boxed (aka normal value type boxing).
//
- // This method is called by VM. Mark the method with FriendAccessAllowed attribute to ensure that the unreferenced method
- // optimization skips it and the code will be saved into NGen image.
- [System.Runtime.CompilerServices.FriendAccessAllowed]
+ // This method is called by VM.
internal static Object UnboxHelper(Object wrapper)
{
Debug.Assert(wrapper != null);
// the get_Value property, allocate an appropriately-sized managed object, marshal the native object
// to the managed object, and free the native method.
//
- // This method is called by VM. Mark the method with FriendAccessAllowed attribute to ensure that the unreferenced method
- // optimization skips it and the code will be saved into NGen image.
- [System.Runtime.CompilerServices.FriendAccessAllowed]
+ // This method is called by VM.
internal static Object UnboxHelper(Object wrapper)
{
Debug.Assert(wrapper != null);
// Get the delegate associated with an event registration token if it exists. Additionally,
// remove the registration from the table at the same time. If the token is not registered,
// Extract returns null and does not modify the table.
- [System.Runtime.CompilerServices.FriendAccessAllowed]
+ // [System.Runtime.CompilerServices.FriendAccessAllowed]
internal T ExtractHandler(EventRegistrationToken token)
{
T handler = null;
namespace System.Runtime.InteropServices.WindowsRuntime
{
- [System.Runtime.CompilerServices.FriendAccessAllowed]
+ // [System.Runtime.CompilerServices.FriendAccessAllowed]
[ComImport]
[Guid("82BA7092-4C88-427D-A7BC-16DD93FEB67E")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Runtime.CompilerServices;
-using System.Runtime.ConstrainedExecution;
-using System.Runtime.Versioning;
-using System.Security;
-using System.Threading;
-
-
-namespace System.Runtime.InteropServices.WindowsRuntime
-{
- /// <summary>
- /// Exposes a helper method that allows <code>WindowsRuntimeBuffer : IBuffer, IBufferInternal</code> which is implemented in
- /// <code>System.Runtime.WindowsRuntime.dll</code> to call into the VM.
- /// </summary>
- [FriendAccessAllowed]
- internal static class WindowsRuntimeBufferHelper
- {
- [DllImport(JitHelpers.QCall)]
- private unsafe extern static void StoreOverlappedPtrInCCW(ObjectHandleOnStack windowsRuntimeBuffer, NativeOverlapped* overlapped);
-
-
- [FriendAccessAllowed]
- internal unsafe static void StoreOverlappedInCCW(Object windowsRuntimeBuffer, NativeOverlapped* overlapped)
- {
- StoreOverlappedPtrInCCW(JitHelpers.GetObjectHandleOnStack(ref windowsRuntimeBuffer), overlapped);
- }
- } // class WindowsRuntimeBufferHelper
-} // namespace
-
-// WindowsRuntimeBufferHelper.cs
/// for the application to be invoked to process the error.
/// </summary>
/// <returns>true if the error was reported, false if not (ie running on Win8)</returns>
- [FriendAccessAllowed]
+ // [FriendAccessAllowed]
internal static bool ReportUnhandledError(Exception e)
{
// Only report to the WinRT global exception handler in modern apps
} // class DateMarshaler
#if FEATURE_COMINTEROP
- [FriendAccessAllowed]
+ // [FriendAccessAllowed]
internal static class InterfaceMarshaler
{
[MethodImplAttribute(MethodImplOptions.InternalCall)]
[DllImport(JitHelpers.QCall)]
static internal extern void ClearNative(IntPtr pUnk);
- [FriendAccessAllowed]
+ // [FriendAccessAllowed]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
static internal extern object ConvertToManagedWithoutUnboxing(IntPtr pNative);
} // class InterfaceMarshaler
}
} // class InterfaceMarshaler
- [FriendAccessAllowed]
+ // [FriendAccessAllowed]
internal static class EventArgsMarshaler
{
- [FriendAccessAllowed]
+ // [FriendAccessAllowed]
static internal IntPtr CreateNativeNCCEventArgsInstance(int action, object newItems, object oldItems, int newIndex, int oldIndex)
{
IntPtr newItemsIP = IntPtr.Zero;
}
}
- [FriendAccessAllowed]
+ // [FriendAccessAllowed]
[DllImport(JitHelpers.QCall)]
static extern internal IntPtr CreateNativePCEventArgsInstance([MarshalAs(UnmanagedType.HString)]string name);
#if FEATURE_COMINTEROP && FEATURE_APPX
//
// This is implemented in System.Runtime.WindowsRuntime, allowing us to ask that assembly for a WinRT-specific SyncCtx.
- // I'd like this to be an interface, or at least an abstract class - but neither seems to play nice with FriendAccessAllowed.
//
- [FriendAccessAllowed]
- internal class WinRTSynchronizationContextFactoryBase
+ // [FriendAccessAllowed]
+ internal abstract class WinRTSynchronizationContextFactoryBase
{
- public virtual SynchronizationContext Create(object coreDispatcher) { return null; }
+ public abstract SynchronizationContext Create(object coreDispatcher);
}
#endif //FEATURE_COMINTEROP
}
}
- // Get the last SynchronizationContext that was set explicitly (not flowed via ExecutionContext.Capture/Run)
- internal static SynchronizationContext CurrentNoFlow
- {
- [FriendAccessAllowed]
- get
- {
- return Current; // SC never flows
- }
- }
-
#if FEATURE_APPX
private static SynchronizationContext GetWinRTContext()
{
namespace System.Threading.Tasks
{
- [FriendAccessAllowed]
+ // [FriendAccessAllowed]
internal enum CausalityTraceLevel
{
#if FEATURE_COMINTEROP
#endif
}
- [FriendAccessAllowed]
+ // [FriendAccessAllowed]
internal enum AsyncCausalityStatus
{
#if FEATURE_COMINTEROP
#endif
}
- [FriendAccessAllowed]
+ // [FriendAccessAllowed]
internal static class AsyncCausalityTracer
{
static internal void EnableToETW(bool enabled)
#endif
}
- [FriendAccessAllowed]
internal static bool LoggingOn
{
- [FriendAccessAllowed]
+ // [FriendAccessAllowed]
get
{
#if FEATURE_COMINTEROP
// The TraceXXX methods should be called only if LoggingOn property returned true
//
- [FriendAccessAllowed]
+ // [FriendAccessAllowed]
[MethodImplAttribute(MethodImplOptions.NoInlining)] // Tracking is slow path. Disable inlining for it.
internal static void TraceOperationCreation(CausalityTraceLevel traceLevel, int taskId, string operationName, ulong relatedContext)
{
#endif
}
- [FriendAccessAllowed]
+ // [FriendAccessAllowed]
[MethodImplAttribute(MethodImplOptions.NoInlining)]
internal static void TraceOperationCompletion(CausalityTraceLevel traceLevel, int taskId, AsyncCausalityStatus status)
{
// A private flag that would be set (only) by the debugger
// When true the Async Causality logging trace is enabled as well as a dictionary to relate operation ids with Tasks
- [FriendAccessAllowed]
+ // [FriendAccessAllowed]
internal static bool s_asyncDebuggingEnabled; //false by default
// This dictonary relates the task id, from an operation id located in the Async Causality log to the actual
// These methods are a way to access the dictionary both from this class and for other classes that also
// activate dummy tasks. Specifically the AsyncTaskMethodBuilder and AsyncTaskMethodBuilder<>
- [FriendAccessAllowed]
+ // [FriendAccessAllowed]
internal static bool AddToActiveTasks(Task task)
{
Debug.Assert(task != null, "Null Task objects can't be added to the ActiveTasks collection");
return true;
}
- [FriendAccessAllowed]
+ // [FriendAccessAllowed]
internal static void RemoveFromActiveTasks(int taskId)
{
lock (s_activeTasksLock)
// then ignore it. This helps with performance by avoiding unnecessary posts and queueing
// of work items, but more so it ensures that if code happens to publish the default context
// as current, it won't prevent usage of a current task scheduler if there is one.
- var syncCtx = SynchronizationContext.CurrentNoFlow;
+ var syncCtx = SynchronizationContext.Current;
if (syncCtx != null && syncCtx.GetType() != typeof(SynchronizationContext))
{
tc = new SynchronizationContextAwaitTaskContinuation(syncCtx, continuationAction, flowExecutionContext);
// fall back to using the state machine's delegate.
if (continueOnCapturedContext)
{
- SynchronizationContext syncCtx = SynchronizationContext.CurrentNoFlow;
+ SynchronizationContext syncCtx = SynchronizationContext.Current;
if (syncCtx != null && syncCtx.GetType() != typeof(SynchronizationContext))
{
var tc = new SynchronizationContextAwaitTaskContinuation(syncCtx, stateMachineBox.MoveNextAction, flowExecutionContext: false);
return task;
}
- /// <summary>Creates a <see cref="Task"/> that's completed due to cancellation with the specified token.</summary>
- /// <param name="cancellationToken">The token with which to complete the task.</param>
- /// <returns>The canceled task.</returns>
- [FriendAccessAllowed]
- internal static Task FromCancellation(CancellationToken cancellationToken)
- {
- return FromCanceled(cancellationToken);
- }
-
- /// <summary>Creates a <see cref="Task{TResult}"/> that's completed due to cancellation with the specified token.</summary>
- /// <typeparam name="TResult">The type of the result returned by the task.</typeparam>
- /// <param name="cancellationToken">The token with which to complete the task.</param>
- /// <returns>The canceled task.</returns>
- [FriendAccessAllowed]
- internal static Task<TResult> FromCancellation<TResult>(CancellationToken cancellationToken)
- {
- return FromCanceled<TResult>(cancellationToken);
- }
-
#endregion
#region Run methods
}
#endregion
- [FriendAccessAllowed]
internal static Task<TResult> CreateUnwrapPromise<TResult>(Task outerTask, bool lookForOce)
{
Debug.Assert(outerTask != null);
{
// If we're allowed to inline, run the action on this thread.
if (canInlineContinuationTask &&
- m_syncContext == SynchronizationContext.CurrentNoFlow)
+ m_syncContext == SynchronizationContext.Current)
{
RunCallback(GetInvokeActionCallback(), m_action, ref Task.t_currentTask);
}
{
// If there's a SynchronizationContext, we'll be conservative and say
// this is a bad location to inline.
- var ctx = SynchronizationContext.CurrentNoFlow;
+ var ctx = SynchronizationContext.Current;
if (ctx != null && ctx.GetType() != typeof(SynchronizationContext)) return false;
// Similarly, if there's a non-default TaskScheduler, we'll be conservative
{
int n = stream.Read(buffer, index, count);
if (n == 0)
- __Error.EndOfFile();
+ throw Error.GetEndOfFile();
int end = index + n;
for (; index < end; index++)
{
STANDARD_VM_CONTRACT;
- // Note that this ignores unrestricted friend access. This friend access allowed attribute can be used to
- // prevent methods from getting trimmed if necessary.
- if (pMD->GetMDImport()->GetCustomAttributeByName(pMD->GetMemberDef(), FRIEND_ACCESS_ALLOWED_ATTRIBUTE_TYPE, NULL, NULL) == S_OK)
- return true;
+ // Note that this ignores friend access.
switch (pMD->GetAttrs() & mdMemberAccessMask)
{
FCIMPLEND
-// InternalBlockCopy
-// This method from one primitive array to another based
-// upon an offset into each an a byte count.
-FCIMPL5(VOID, Buffer::InternalBlockCopy, ArrayBase *src, int srcOffset, ArrayBase *dst, int dstOffset, int count)
-{
- FCALL_CONTRACT;
-
- // @TODO: We should consider writing this in managed code. We probably
- // cannot easily do this though - how do we get at the array's data?
-
- // Unfortunately, we must do a check to make sure we're writing within
- // the bounds of the array. This will ensure that we don't overwrite
- // memory elsewhere in the system nor do we write out junk. This can
- // happen if multiple threads interact with our IO classes simultaneously
- // without being threadsafe. Throw here.
- // Unfortunately this even applies to setting our internal buffers to
- // null. We don't want to debug races between Close and Read or Write.
- if (src == NULL || dst == NULL)
- FCThrowResVoid(kIndexOutOfRangeException, W("IndexOutOfRange_IORaceCondition"));
-
- SIZE_T srcLen = src->GetNumComponents() * src->GetComponentSize();
- SIZE_T dstLen = srcLen;
- if (src != dst)
- dstLen = dst->GetNumComponents() * dst->GetComponentSize();
-
- if (srcOffset < 0 || dstOffset < 0 || count < 0)
- FCThrowResVoid(kIndexOutOfRangeException, W("IndexOutOfRange_IORaceCondition"));
-
- if (srcLen < (SIZE_T)srcOffset + (SIZE_T)count || dstLen < (SIZE_T)dstOffset + (SIZE_T)count)
- FCThrowResVoid(kIndexOutOfRangeException, W("IndexOutOfRange_IORaceCondition"));
-
- _ASSERTE(srcOffset >= 0);
- _ASSERTE((src->GetNumComponents() * src->GetComponentSize()) - (unsigned) srcOffset >= (unsigned) count);
- _ASSERTE((dst->GetNumComponents() * dst->GetComponentSize()) - (unsigned) dstOffset >= (unsigned) count);
- _ASSERTE(dstOffset >= 0);
- _ASSERTE(count >= 0);
-
- // Copy the data.
-#if defined(_AMD64_) && !defined(PLATFORM_UNIX)
- JIT_MemCpy(dst->GetDataPtr() + dstOffset, src->GetDataPtr() + srcOffset, count);
-#else
- memmove(dst->GetDataPtr() + dstOffset, src->GetDataPtr() + srcOffset, count);
-#endif
-
- FC_GC_POLL();
-}
-FCIMPLEND
-
void QCALLTYPE MemoryNative::Clear(void *dst, size_t length)
{
QCALL_CONTRACT;
// This method from one primitive array to another based
// upon an offset into each an a byte count.
static FCDECL5(VOID, BlockCopy, ArrayBase *src, int srcOffset, ArrayBase *dst, int dstOffset, int count);
- static FCDECL5(VOID, InternalBlockCopy, ArrayBase *src, int srcOffset, ArrayBase *dst, int dstOffset, int count);
static FCDECL2(FC_UINT8_RET, GetByte, ArrayBase *arrayUNSAFE, INT32 index);
static FCDECL3(VOID, SetByte, ArrayBase *arrayUNSAFE, INT32 index, UINT8 bData);
static FCDECL1(FC_BOOL_RET, IsPrimitiveTypeArray, ArrayBase *arrayUNSAFE);
FCFuncStart(gBufferFuncs)
FCFuncElement("BlockCopy", Buffer::BlockCopy)
- FCFuncElement("InternalBlockCopy", Buffer::InternalBlockCopy)
FCFuncElement("_GetByte", Buffer::GetByte)
FCFuncElement("_SetByte", Buffer::SetByte)
FCFuncElement("IsPrimitiveTypeArray", Buffer::IsPrimitiveTypeArray)
FCFuncEnd()
-#ifdef FEATURE_COMINTEROP
-FCFuncStart(gWindowsRuntimeBufferHelperFuncs)
- QCFuncElement("StoreOverlappedPtrInCCW", WindowsRuntimeBufferHelper::StoreOverlappedPtrInCCW)
- //QCFuncElement("ReleaseOverlapped", WindowsRuntimeBufferHelper::ReleaseOverlapped)
-FCFuncEnd()
-#endif // ifdef FEATURE_COMINTEROP
-
#if defined(FEATURE_EVENTSOURCE_XPLAT)
FCFuncStart(gEventLogger)
QCFuncElement("IsEventSourceLoggingEnabled", XplatEventSourceLogger::IsEventSourceLoggingEnabled)
FCClassElement("WinRTTypeNameConverter", "System.StubHelpers", gWinRTTypeNameConverterFuncs)
#endif // FEATURE_COMINTEROP
-#ifdef FEATURE_COMINTEROP
-FCClassElement("WindowsRuntimeBufferHelper", "System.Runtime.InteropServices.WindowsRuntime", gWindowsRuntimeBufferHelperFuncs)
-#endif
-
-
#if defined(FEATURE_EVENTSOURCE_XPLAT)
FCClassElement("XplatEventLogger", "System.Diagnostics.Tracing", gEventLogger)