summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Adams <thundercat@illyriad.co.uk>2019-01-06 01:34:25 +0100
committerJan Kotas <jkotas@microsoft.com>2019-01-05 16:34:25 -0800
commitdcf9f36c21022b8fce374559ec5fea8d11a0852b (patch)
treef2afbcad1954ebd096da8dc5b763c9a43e610cbb /src
parentb188e9d354e37e512c5b95bec38f0f06efb4161e (diff)
downloadcoreclr-dcf9f36c21022b8fce374559ec5fea8d11a0852b.tar.gz
coreclr-dcf9f36c21022b8fce374559ec5fea8d11a0852b.tar.bz2
coreclr-dcf9f36c21022b8fce374559ec5fea8d11a0852b.zip
Remove redundant unsafe contexts (#21826)
Diffstat (limited to 'src')
-rw-r--r--src/System.Private.CoreLib/shared/System/Text/DecoderNLS.cs4
-rw-r--r--src/System.Private.CoreLib/shared/System/Text/Encoding.cs24
-rw-r--r--src/System.Private.CoreLib/shared/System/Text/ValueStringBuilder.cs2
-rw-r--r--src/System.Private.CoreLib/shared/System/UIntPtr.cs4
-rw-r--r--src/System.Private.CoreLib/src/Microsoft/Win32/UnsafeNativeMethods.cs6
-rw-r--r--src/System.Private.CoreLib/src/System/Delegate.cs4
-rw-r--r--src/System.Private.CoreLib/src/System/Diagnostics/Eventing/EventPipeMetadataGenerator.cs6
-rw-r--r--src/System.Private.CoreLib/src/System/Diagnostics/Eventing/FrameworkEventSource.cs8
-rw-r--r--src/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs4
-rw-r--r--src/System.Private.CoreLib/src/System/Reflection/Associates.cs4
-rw-r--r--src/System.Private.CoreLib/src/System/Reflection/CustomAttribute.cs8
-rw-r--r--src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicILGenerator.cs6
-rw-r--r--src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicMethod.cs4
-rw-r--r--src/System.Private.CoreLib/src/System/Reflection/MdFieldInfo.cs6
-rw-r--r--src/System.Private.CoreLib/src/System/Reflection/MdImport.cs16
-rw-r--r--src/System.Private.CoreLib/src/System/Reflection/RuntimeFieldInfo.cs2
-rw-r--r--src/System.Private.CoreLib/src/System/RtType.cs34
-rw-r--r--src/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs2
-rw-r--r--src/System.Private.CoreLib/src/System/RuntimeHandles.cs12
-rw-r--r--src/System.Private.CoreLib/src/System/StubHelpers.cs12
-rw-r--r--src/System.Private.CoreLib/src/System/Threading/ClrThreadPoolPreAllocatedOverlapped.cs4
-rw-r--r--src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs2
-rw-r--r--src/System.Private.CoreLib/src/System/Threading/Thread.cs2
23 files changed, 88 insertions, 88 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Text/DecoderNLS.cs b/src/System.Private.CoreLib/shared/System/Text/DecoderNLS.cs
index ee88c22f9d..8af4dc3a55 100644
--- a/src/System.Private.CoreLib/shared/System/Text/DecoderNLS.cs
+++ b/src/System.Private.CoreLib/shared/System/Text/DecoderNLS.cs
@@ -47,7 +47,7 @@ namespace System.Text
_fallbackBuffer?.Reset();
}
- public override unsafe int GetCharCount(byte[] bytes, int index, int count)
+ public override int GetCharCount(byte[] bytes, int index, int count)
{
return GetCharCount(bytes, index, count, false);
}
@@ -91,7 +91,7 @@ namespace System.Text
return _encoding.GetCharCount(bytes, count, this);
}
- public override unsafe int GetChars(byte[] bytes, int byteIndex, int byteCount,
+ public override int GetChars(byte[] bytes, int byteIndex, int byteCount,
char[] chars, int charIndex)
{
return GetChars(bytes, byteIndex, byteCount, chars, charIndex, false);
diff --git a/src/System.Private.CoreLib/shared/System/Text/Encoding.cs b/src/System.Private.CoreLib/shared/System/Text/Encoding.cs
index ec8c9c33ff..c1b64961f7 100644
--- a/src/System.Private.CoreLib/shared/System/Text/Encoding.cs
+++ b/src/System.Private.CoreLib/shared/System/Text/Encoding.cs
@@ -1459,7 +1459,7 @@ namespace System.Text
return true;
}
- internal unsafe bool AddChar(char ch)
+ internal bool AddChar(char ch)
{
return AddChar(ch, 1);
}
@@ -1515,7 +1515,7 @@ namespace System.Text
}
}
- internal unsafe bool Fallback(byte fallbackByte)
+ internal bool Fallback(byte fallbackByte)
{
// Build our buffer
byte[] byteBuffer = new byte[] { fallbackByte };
@@ -1524,7 +1524,7 @@ namespace System.Text
return Fallback(byteBuffer);
}
- internal unsafe bool Fallback(byte byte1, byte byte2)
+ internal bool Fallback(byte byte1, byte byte2)
{
// Build our buffer
byte[] byteBuffer = new byte[] { byte1, byte2 };
@@ -1533,7 +1533,7 @@ namespace System.Text
return Fallback(byteBuffer);
}
- internal unsafe bool Fallback(byte byte1, byte byte2, byte byte3, byte byte4)
+ internal bool Fallback(byte byte1, byte byte2, byte byte3, byte byte4)
{
// Build our buffer
byte[] byteBuffer = new byte[] { byte1, byte2, byte3, byte4 };
@@ -1566,7 +1566,7 @@ namespace System.Text
return true;
}
- internal unsafe int Count
+ internal int Count
{
get
{
@@ -1634,34 +1634,34 @@ namespace System.Text
return true;
}
- internal unsafe bool AddByte(byte b1)
+ internal bool AddByte(byte b1)
{
return (AddByte(b1, 0));
}
- internal unsafe bool AddByte(byte b1, byte b2)
+ internal bool AddByte(byte b1, byte b2)
{
return (AddByte(b1, b2, 0));
}
- internal unsafe bool AddByte(byte b1, byte b2, int moreBytesExpected)
+ internal bool AddByte(byte b1, byte b2, int moreBytesExpected)
{
return (AddByte(b1, 1 + moreBytesExpected) && AddByte(b2, moreBytesExpected));
}
- internal unsafe bool AddByte(byte b1, byte b2, byte b3)
+ internal bool AddByte(byte b1, byte b2, byte b3)
{
return AddByte(b1, b2, b3, (int)0);
}
- internal unsafe bool AddByte(byte b1, byte b2, byte b3, int moreBytesExpected)
+ internal bool AddByte(byte b1, byte b2, byte b3, int moreBytesExpected)
{
return (AddByte(b1, 2 + moreBytesExpected) &&
AddByte(b2, 1 + moreBytesExpected) &&
AddByte(b3, moreBytesExpected));
}
- internal unsafe bool AddByte(byte b1, byte b2, byte b3, byte b4)
+ internal bool AddByte(byte b1, byte b2, byte b3, byte b4)
{
return (AddByte(b1, 3) &&
AddByte(b2, 2) &&
@@ -1724,7 +1724,7 @@ namespace System.Text
}
}
- internal unsafe int Count
+ internal int Count
{
get
{
diff --git a/src/System.Private.CoreLib/shared/System/Text/ValueStringBuilder.cs b/src/System.Private.CoreLib/shared/System/Text/ValueStringBuilder.cs
index 30c94cb817..963e45825c 100644
--- a/src/System.Private.CoreLib/shared/System/Text/ValueStringBuilder.cs
+++ b/src/System.Private.CoreLib/shared/System/Text/ValueStringBuilder.cs
@@ -227,7 +227,7 @@ namespace System.Text
_pos += length;
}
- public unsafe void Append(ReadOnlySpan<char> value)
+ public void Append(ReadOnlySpan<char> value)
{
int pos = _pos;
if (pos > _chars.Length - value.Length)
diff --git a/src/System.Private.CoreLib/shared/System/UIntPtr.cs b/src/System.Private.CoreLib/shared/System/UIntPtr.cs
index c57dd86a76..9197792e2a 100644
--- a/src/System.Private.CoreLib/shared/System/UIntPtr.cs
+++ b/src/System.Private.CoreLib/shared/System/UIntPtr.cs
@@ -60,7 +60,7 @@ namespace System
_value = (void*)l;
}
- unsafe void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
+ void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
throw new ArgumentNullException(nameof(info));
@@ -196,7 +196,7 @@ namespace System
return new UIntPtr((nuint)pointer._value - (nuint)offset);
}
- public static unsafe int Size
+ public static int Size
{
[Intrinsic]
[NonVersionable]
diff --git a/src/System.Private.CoreLib/src/Microsoft/Win32/UnsafeNativeMethods.cs b/src/System.Private.CoreLib/src/Microsoft/Win32/UnsafeNativeMethods.cs
index 2f904e2e20..4ddf56663e 100644
--- a/src/System.Private.CoreLib/src/Microsoft/Win32/UnsafeNativeMethods.cs
+++ b/src/System.Private.CoreLib/src/Microsoft/Win32/UnsafeNativeMethods.cs
@@ -43,7 +43,7 @@ namespace Microsoft.Win32
//
// Callback
//
- internal unsafe delegate void EtwEnableCallback(
+ internal delegate void EtwEnableCallback(
[In] ref Guid sourceId,
[In] int isEnabled,
[In] byte level,
@@ -69,7 +69,7 @@ namespace Microsoft.Win32
internal static extern uint EventUnregister([In] long registrationHandle);
[DllImport(Win32Native.ADVAPI32, ExactSpelling = true, EntryPoint = "EventWriteString", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
- internal static extern unsafe int EventWriteString(
+ internal static extern int EventWriteString(
[In] long registrationHandle,
[In] byte level,
[In] long keyword,
@@ -77,7 +77,7 @@ namespace Microsoft.Win32
);
[StructLayout(LayoutKind.Sequential)]
- internal unsafe struct EVENT_FILTER_DESCRIPTOR
+ internal struct EVENT_FILTER_DESCRIPTOR
{
public long Ptr;
public int Size;
diff --git a/src/System.Private.CoreLib/src/System/Delegate.cs b/src/System.Private.CoreLib/src/System/Delegate.cs
index 270211a32d..df9bac4766 100644
--- a/src/System.Private.CoreLib/src/System/Delegate.cs
+++ b/src/System.Private.CoreLib/src/System/Delegate.cs
@@ -56,7 +56,7 @@ namespace System
// This constructor is called from a class to generate a
// delegate based upon a static method name and the Type object
// for the class defining the method.
- protected unsafe Delegate(Type target, string method)
+ protected Delegate(Type target, string method)
{
if (target == null)
throw new ArgumentNullException(nameof(target));
@@ -548,7 +548,7 @@ namespace System
// V2 internal API.
// This is Critical because it skips the security check when creating the delegate.
- internal static unsafe Delegate CreateDelegateNoSecurityCheck(Type type, object target, RuntimeMethodHandle method)
+ internal static Delegate CreateDelegateNoSecurityCheck(Type type, object target, RuntimeMethodHandle method)
{
// Validate the parameters.
if (type == null)
diff --git a/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/EventPipeMetadataGenerator.cs b/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/EventPipeMetadataGenerator.cs
index a5cc756ae6..06aa854207 100644
--- a/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/EventPipeMetadataGenerator.cs
+++ b/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/EventPipeMetadataGenerator.cs
@@ -15,7 +15,7 @@ namespace System.Diagnostics.Tracing
private EventPipeMetadataGenerator() { }
- public unsafe byte[] GenerateEventMetadata(EventMetadata eventMetadata)
+ public byte[] GenerateEventMetadata(EventMetadata eventMetadata)
{
ParameterInfo[] parameters = eventMetadata.Parameters;
EventParameterInfo[] eventParams = new EventParameterInfo[parameters.Length];
@@ -33,7 +33,7 @@ namespace System.Diagnostics.Tracing
eventParams);
}
- public unsafe byte[] GenerateEventMetadata(
+ public byte[] GenerateEventMetadata(
int eventId,
string eventName,
EventKeywords keywords,
@@ -292,7 +292,7 @@ namespace System.Diagnostics.Tracing
}
- internal unsafe uint GetMetadataLength()
+ internal uint GetMetadataLength()
{
uint ret = 0;
diff --git a/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/FrameworkEventSource.cs b/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/FrameworkEventSource.cs
index 323cae2ac9..8e4b20376f 100644
--- a/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/FrameworkEventSource.cs
+++ b/src/System.Private.CoreLib/src/System/Diagnostics/Eventing/FrameworkEventSource.cs
@@ -628,7 +628,7 @@ namespace System.Diagnostics.Tracing
#if !CORECLR
[System.Security.SecuritySafeCritical]
#endif // !CORECLR
- public unsafe void BeginGetResponse(object id, string uri, bool success, bool synchronous)
+ public void BeginGetResponse(object id, string uri, bool success, bool synchronous)
{
if (IsEnabled())
GetResponseStart(IdForObject(id), uri, success, synchronous);
@@ -638,7 +638,7 @@ namespace System.Diagnostics.Tracing
#if !CORECLR
[System.Security.SecuritySafeCritical]
#endif // !CORECLR
- public unsafe void EndGetResponse(object id, bool success, bool synchronous, int statusCode)
+ public void EndGetResponse(object id, bool success, bool synchronous, int statusCode)
{
if (IsEnabled())
GetResponseStop(IdForObject(id), success, synchronous, statusCode);
@@ -648,7 +648,7 @@ namespace System.Diagnostics.Tracing
#if !CORECLR
[System.Security.SecuritySafeCritical]
#endif // !CORECLR
- public unsafe void BeginGetRequestStream(object id, string uri, bool success, bool synchronous)
+ public void BeginGetRequestStream(object id, string uri, bool success, bool synchronous)
{
if (IsEnabled())
GetRequestStreamStart(IdForObject(id), uri, success, synchronous);
@@ -658,7 +658,7 @@ namespace System.Diagnostics.Tracing
#if !CORECLR
[System.Security.SecuritySafeCritical]
#endif // !CORECLR
- public unsafe void EndGetRequestStream(object id, bool success, bool synchronous)
+ public void EndGetRequestStream(object id, bool success, bool synchronous)
{
if (IsEnabled())
GetRequestStreamStop(IdForObject(id), success, synchronous);
diff --git a/src/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs b/src/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs
index 7479a36036..e804799035 100644
--- a/src/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs
+++ b/src/System.Private.CoreLib/src/System/Reflection/AssemblyName.cs
@@ -576,7 +576,7 @@ namespace System.Reflection
+ 10)));
}
- private static unsafe bool IsReservedUnreservedOrHash(char c)
+ private static bool IsReservedUnreservedOrHash(char c)
{
if (IsUnreserved(c))
{
@@ -585,7 +585,7 @@ namespace System.Reflection
return (RFC3986ReservedMarks.Contains(c));
}
- internal static unsafe bool IsUnreserved(char c)
+ internal static bool IsUnreserved(char c)
{
if (IsAsciiLetterOrDigit(c))
{
diff --git a/src/System.Private.CoreLib/src/System/Reflection/Associates.cs b/src/System.Private.CoreLib/src/System/Reflection/Associates.cs
index 381146bf5e..c5d97ac5ed 100644
--- a/src/System.Private.CoreLib/src/System/Reflection/Associates.cs
+++ b/src/System.Private.CoreLib/src/System/Reflection/Associates.cs
@@ -35,7 +35,7 @@ namespace System.Reflection
return false;
}
- private static unsafe RuntimeMethodInfo AssignAssociates(
+ private static RuntimeMethodInfo AssignAssociates(
int tkMethod,
RuntimeType declaredType,
RuntimeType reflectedType)
@@ -108,7 +108,7 @@ namespace System.Reflection
return associateMethod;
}
- internal static unsafe void AssignAssociates(
+ internal static void AssignAssociates(
MetadataImport scope,
int mdPropEvent,
RuntimeType declaringType,
diff --git a/src/System.Private.CoreLib/src/System/Reflection/CustomAttribute.cs b/src/System.Private.CoreLib/src/System/Reflection/CustomAttribute.cs
index a11d92365d..ae748c0d53 100644
--- a/src/System.Private.CoreLib/src/System/Reflection/CustomAttribute.cs
+++ b/src/System.Private.CoreLib/src/System/Reflection/CustomAttribute.cs
@@ -251,7 +251,7 @@ namespace System.Reflection
#endregion
#region Internal Static Members
- internal static unsafe CustomAttributeRecord[] GetCustomAttributeRecords(RuntimeModule module, int targetToken)
+ internal static CustomAttributeRecord[] GetCustomAttributeRecords(RuntimeModule module, int targetToken)
{
MetadataImport scope = module.MetadataImport;
@@ -1416,7 +1416,7 @@ namespace System.Reflection
return false;
}
- private static unsafe object[] GetCustomAttributes(
+ private static object[] GetCustomAttributes(
RuntimeModule decoratedModule, int decoratedMetadataToken, int pcaCount, RuntimeType attributeFilterType)
{
RuntimeType.ListBuilder<object> attributes = new RuntimeType.ListBuilder<object>();
@@ -1435,7 +1435,7 @@ namespace System.Reflection
return result;
}
- private static unsafe void AddCustomAttributes(
+ private static void AddCustomAttributes(
ref RuntimeType.ListBuilder<object> attributes,
RuntimeModule decoratedModule, int decoratedMetadataToken,
RuntimeType attributeFilterType, bool mustBeInheritable, ref RuntimeType.ListBuilder<object> derivedAttributes)
@@ -1570,7 +1570,7 @@ namespace System.Reflection
}
}
- private static unsafe bool FilterCustomAttributeRecord(
+ private static bool FilterCustomAttributeRecord(
CustomAttributeRecord caRecord,
MetadataImport scope,
RuntimeModule decoratedModule,
diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicILGenerator.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicILGenerator.cs
index 3315daf173..ec1a51064e 100644
--- a/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicILGenerator.cs
+++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicILGenerator.cs
@@ -23,7 +23,7 @@ namespace System.Reflection.Emit
internal DynamicScope m_scope;
private int m_methodSigToken;
- internal unsafe DynamicILGenerator(DynamicMethod method, byte[] methodSignature, int size)
+ internal DynamicILGenerator(DynamicMethod method, byte[] methodSignature, int size)
: base(method, size)
{
m_scope = new DynamicScope();
@@ -753,7 +753,7 @@ namespace System.Reflection.Emit
return m_localSignature;
}
- internal override unsafe byte[] GetRawEHInfo()
+ internal override byte[] GetRawEHInfo()
{
return m_exceptionHeader;
}
@@ -916,7 +916,7 @@ namespace System.Reflection.Emit
#endregion
#region Constructor
- internal unsafe DynamicScope()
+ internal DynamicScope()
{
m_tokens = new List<object>();
m_tokens.Add(null);
diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicMethod.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicMethod.cs
index a8c09d50e9..af3f5ebfdf 100644
--- a/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicMethod.cs
+++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/DynamicMethod.cs
@@ -251,7 +251,7 @@ namespace System.Reflection.Emit
return s_anonymouslyHostedDynamicMethodsModule;
}
- private unsafe void Init(string name,
+ private void Init(string name,
MethodAttributes attributes,
CallingConventions callingConvention,
Type returnType,
@@ -369,7 +369,7 @@ namespace System.Reflection.Emit
}
// This is guaranteed to return a valid handle
- internal unsafe RuntimeMethodHandle GetMethodDescriptor()
+ internal RuntimeMethodHandle GetMethodDescriptor()
{
if (m_methodHandle == null)
{
diff --git a/src/System.Private.CoreLib/src/System/Reflection/MdFieldInfo.cs b/src/System.Private.CoreLib/src/System/Reflection/MdFieldInfo.cs
index 517b2285c5..e795922d4e 100644
--- a/src/System.Private.CoreLib/src/System/Reflection/MdFieldInfo.cs
+++ b/src/System.Private.CoreLib/src/System/Reflection/MdFieldInfo.cs
@@ -82,14 +82,14 @@ namespace System.Reflection
[DebuggerStepThroughAttribute]
[Diagnostics.DebuggerHidden]
- public unsafe override object GetValue(object obj)
+ public override object GetValue(object obj)
{
return GetValue(false);
}
- public unsafe override object GetRawConstantValue() { return GetValue(true); }
+ public override object GetRawConstantValue() { return GetValue(true); }
- private unsafe object GetValue(bool raw)
+ private object GetValue(bool raw)
{
// Cannot cache these because they could be user defined non-agile enumerations
diff --git a/src/System.Private.CoreLib/src/System/Reflection/MdImport.cs b/src/System.Private.CoreLib/src/System/Reflection/MdImport.cs
index dffc8fafb2..40766d0631 100644
--- a/src/System.Private.CoreLib/src/System/Reflection/MdImport.cs
+++ b/src/System.Private.CoreLib/src/System/Reflection/MdImport.cs
@@ -338,39 +338,39 @@ namespace System.Reflection
#region FCalls
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static extern unsafe void _Enum(IntPtr scope, int type, int parent, out MetadataEnumResult result);
+ private static extern void _Enum(IntPtr scope, int type, int parent, out MetadataEnumResult result);
- public unsafe void Enum(MetadataTokenType type, int parent, out MetadataEnumResult result)
+ public void Enum(MetadataTokenType type, int parent, out MetadataEnumResult result)
{
_Enum(m_metadataImport2, (int)type, parent, out result);
}
- public unsafe void EnumNestedTypes(int mdTypeDef, out MetadataEnumResult result)
+ public void EnumNestedTypes(int mdTypeDef, out MetadataEnumResult result)
{
Enum(MetadataTokenType.TypeDef, mdTypeDef, out result);
}
- public unsafe void EnumCustomAttributes(int mdToken, out MetadataEnumResult result)
+ public void EnumCustomAttributes(int mdToken, out MetadataEnumResult result)
{
Enum(MetadataTokenType.CustomAttribute, mdToken, out result);
}
- public unsafe void EnumParams(int mdMethodDef, out MetadataEnumResult result)
+ public void EnumParams(int mdMethodDef, out MetadataEnumResult result)
{
Enum(MetadataTokenType.ParamDef, mdMethodDef, out result);
}
- public unsafe void EnumFields(int mdTypeDef, out MetadataEnumResult result)
+ public void EnumFields(int mdTypeDef, out MetadataEnumResult result)
{
Enum(MetadataTokenType.FieldDef, mdTypeDef, out result);
}
- public unsafe void EnumProperties(int mdTypeDef, out MetadataEnumResult result)
+ public void EnumProperties(int mdTypeDef, out MetadataEnumResult result)
{
Enum(MetadataTokenType.Property, mdTypeDef, out result);
}
- public unsafe void EnumEvents(int mdTypeDef, out MetadataEnumResult result)
+ public void EnumEvents(int mdTypeDef, out MetadataEnumResult result)
{
Enum(MetadataTokenType.Event, mdTypeDef, out result);
}
diff --git a/src/System.Private.CoreLib/src/System/Reflection/RuntimeFieldInfo.cs b/src/System.Private.CoreLib/src/System/Reflection/RuntimeFieldInfo.cs
index c90d72ccb2..6071e0aa9b 100644
--- a/src/System.Private.CoreLib/src/System/Reflection/RuntimeFieldInfo.cs
+++ b/src/System.Private.CoreLib/src/System/Reflection/RuntimeFieldInfo.cs
@@ -72,7 +72,7 @@ namespace System.Reflection
#endregion
#region Object Overrides
- public unsafe override string ToString()
+ public override string ToString()
{
return FieldType.FormatTypeName() + " " + Name;
}
diff --git a/src/System.Private.CoreLib/src/System/RtType.cs b/src/System.Private.CoreLib/src/System/RtType.cs
index dd30ea404c..7327c469c6 100644
--- a/src/System.Private.CoreLib/src/System/RtType.cs
+++ b/src/System.Private.CoreLib/src/System/RtType.cs
@@ -749,7 +749,7 @@ namespace System
return list.ToArray();
}
- private unsafe RuntimeFieldInfo[] PopulateFields(Filter filter)
+ private RuntimeFieldInfo[] PopulateFields(Filter filter)
{
ListBuilder<RuntimeFieldInfo> list = new ListBuilder<RuntimeFieldInfo>();
@@ -872,7 +872,7 @@ namespace System
}
}
- private unsafe void PopulateLiteralFields(Filter filter, RuntimeType declaringType, ref ListBuilder<RuntimeFieldInfo> list)
+ private void PopulateLiteralFields(Filter filter, RuntimeType declaringType, ref ListBuilder<RuntimeFieldInfo> list)
{
Debug.Assert(declaringType != null);
Debug.Assert(ReflectedType != null);
@@ -1041,7 +1041,7 @@ namespace System
return list.ToArray();
}
- private unsafe RuntimeType[] PopulateNestedClasses(Filter filter)
+ private RuntimeType[] PopulateNestedClasses(Filter filter)
{
RuntimeType declaringType = ReflectedType;
@@ -1091,7 +1091,7 @@ namespace System
return list.ToArray();
}
- private unsafe RuntimeEventInfo[] PopulateEvents(Filter filter)
+ private RuntimeEventInfo[] PopulateEvents(Filter filter)
{
Debug.Assert(ReflectedType != null);
@@ -1123,7 +1123,7 @@ namespace System
return list.ToArray();
}
- private unsafe void PopulateEvents(
+ private void PopulateEvents(
Filter filter, RuntimeType declaringType, Dictionary<string, RuntimeEventInfo> csEventInfos, ref ListBuilder<RuntimeEventInfo> list)
{
int tkDeclaringType = RuntimeTypeHandle.GetToken(declaringType);
@@ -1183,7 +1183,7 @@ namespace System
}
}
- private unsafe RuntimePropertyInfo[] PopulateProperties(Filter filter)
+ private RuntimePropertyInfo[] PopulateProperties(Filter filter)
{
Debug.Assert(ReflectedType != null);
@@ -1223,7 +1223,7 @@ namespace System
return list.ToArray();
}
- private unsafe void PopulateProperties(
+ private void PopulateProperties(
Filter filter,
RuntimeType declaringType,
Dictionary<string, List<RuntimePropertyInfo>> csPropertyInfos,
@@ -1513,7 +1513,7 @@ namespace System
}
}
- internal unsafe string GetNameSpace()
+ internal string GetNameSpace()
{
// @Optimization - Use ConstructName to populate m_namespace
if (m_namespace == null)
@@ -1536,7 +1536,7 @@ namespace System
set => m_typeCode = value;
}
- internal unsafe RuntimeType GetEnclosingType()
+ internal RuntimeType GetEnclosingType()
{
if (m_enclosingType == null)
{
@@ -1733,7 +1733,7 @@ namespace System
return retval;
}
- internal static unsafe MethodBase GetMethodBase(RuntimeType reflectedType, RuntimeMethodHandleInternal methodHandle)
+ internal static MethodBase GetMethodBase(RuntimeType reflectedType, RuntimeMethodHandleInternal methodHandle)
{
Debug.Assert(!methodHandle.IsNullHandle());
@@ -1875,12 +1875,12 @@ namespace System
set => Cache.DomainInitialized = value;
}
- internal static unsafe FieldInfo GetFieldInfo(IRuntimeFieldInfo fieldHandle)
+ internal static FieldInfo GetFieldInfo(IRuntimeFieldInfo fieldHandle)
{
return GetFieldInfo(RuntimeFieldHandle.GetApproxDeclaringType(fieldHandle), fieldHandle);
}
- internal static unsafe FieldInfo GetFieldInfo(RuntimeType reflectedType, IRuntimeFieldInfo field)
+ internal static FieldInfo GetFieldInfo(RuntimeType reflectedType, IRuntimeFieldInfo field)
{
RuntimeFieldHandleInternal fieldHandle = field.Value;
@@ -1911,7 +1911,7 @@ namespace System
}
// Called internally
- private static unsafe PropertyInfo GetPropertyInfo(RuntimeType reflectedType, int tkProperty)
+ private static PropertyInfo GetPropertyInfo(RuntimeType reflectedType, int tkProperty)
{
RuntimePropertyInfo property = null;
RuntimePropertyInfo[] candidates =
@@ -3698,7 +3698,7 @@ namespace System
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern object AllocateValueType(RuntimeType type, object value, bool fForceTypeChange);
- internal unsafe object CheckValue(object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
+ internal object CheckValue(object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
{
// this method is used by invocation in reflection to check whether a value can be assigned to type.
if (IsInstanceOfType(value))
@@ -4856,7 +4856,7 @@ namespace System
// Very common called version of the Equals pair
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal unsafe bool Equals(MdUtf8String s)
+ internal bool Equals(MdUtf8String s)
{
if (s.m_StringHeapByteLength != m_StringHeapByteLength)
{
@@ -4868,7 +4868,7 @@ namespace System
}
}
- internal unsafe bool EqualsCaseInsensitive(MdUtf8String s)
+ internal bool EqualsCaseInsensitive(MdUtf8String s)
{
if (s.m_StringHeapByteLength != m_StringHeapByteLength)
{
@@ -4880,7 +4880,7 @@ namespace System
}
}
- internal unsafe uint HashCaseInsensitive()
+ internal uint HashCaseInsensitive()
{
return HashCaseInsensitive(m_pStringHeap, m_StringHeapByteLength);
}
diff --git a/src/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs b/src/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs
index 9ac9150725..7ce8c53f22 100644
--- a/src/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs
+++ b/src/System.Private.CoreLib/src/System/Runtime/RuntimeImports.cs
@@ -35,6 +35,6 @@ namespace System.Runtime
private static extern unsafe void RhZeroMemory(void* b, nuint byteLength);
[MethodImpl(MethodImplOptions.InternalCall)]
- internal static extern unsafe void RhBulkMoveWithWriteBarrier(ref byte destination, ref byte source, nuint byteCount);
+ internal static extern void RhBulkMoveWithWriteBarrier(ref byte destination, ref byte source, nuint byteCount);
}
}
diff --git a/src/System.Private.CoreLib/src/System/RuntimeHandles.cs b/src/System.Private.CoreLib/src/System/RuntimeHandles.cs
index 0d215ef08a..1325aa831f 100644
--- a/src/System.Private.CoreLib/src/System/RuntimeHandles.cs
+++ b/src/System.Private.CoreLib/src/System/RuntimeHandles.cs
@@ -36,7 +36,7 @@ namespace System
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern bool IsInstanceOfType(RuntimeType type, object o);
- internal static unsafe Type GetTypeHelper(Type typeStart, Type[] genericArgs, IntPtr pModifiers, int cModifiers)
+ internal static Type GetTypeHelper(Type typeStart, Type[] genericArgs, IntPtr pModifiers, int cModifiers)
{
Type type = typeStart;
@@ -1098,7 +1098,7 @@ namespace System
return handle.Value == Value;
}
- public unsafe bool Equals(RuntimeFieldHandle handle)
+ public bool Equals(RuntimeFieldHandle handle)
{
return handle.Value == Value;
}
@@ -1119,7 +1119,7 @@ namespace System
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern unsafe void* _GetUtf8Name(RuntimeFieldHandleInternal field);
- internal static unsafe MdUtf8String GetUtf8Name(RuntimeFieldHandleInternal field) { return new MdUtf8String(_GetUtf8Name(field)); }
+ internal static MdUtf8String GetUtf8Name(RuntimeFieldHandleInternal field) { return new MdUtf8String(_GetUtf8Name(field)); }
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal static extern bool MatchesNameHash(RuntimeFieldHandleInternal handle, uint hash);
@@ -1172,7 +1172,7 @@ namespace System
public static readonly ModuleHandle EmptyHandle = GetEmptyMH();
#endregion
- unsafe private static ModuleHandle GetEmptyMH()
+ private static ModuleHandle GetEmptyMH()
{
return new ModuleHandle();
}
@@ -1210,7 +1210,7 @@ namespace System
return handle.m_ptr == m_ptr;
}
- public unsafe bool Equals(ModuleHandle handle)
+ public bool Equals(ModuleHandle handle)
{
return handle.m_ptr == m_ptr;
}
@@ -1519,7 +1519,7 @@ namespace System
internal abstract byte[] GetCodeInfo(ref int stackSize, ref int initLocals, ref int EHCount);
internal abstract byte[] GetLocalsSignature();
internal abstract unsafe void GetEHInfo(int EHNumber, void* exception);
- internal abstract unsafe byte[] GetRawEHInfo();
+ internal abstract byte[] GetRawEHInfo();
// token resolution
internal abstract string GetStringLiteral(int token);
internal abstract void ResolveToken(int token, out IntPtr typeHandle, out IntPtr methodHandle, out IntPtr fieldHandle);
diff --git a/src/System.Private.CoreLib/src/System/StubHelpers.cs b/src/System.Private.CoreLib/src/System/StubHelpers.cs
index e7b8096d28..3464d5a3ed 100644
--- a/src/System.Private.CoreLib/src/System/StubHelpers.cs
+++ b/src/System.Private.CoreLib/src/System/StubHelpers.cs
@@ -381,7 +381,7 @@ namespace System.StubHelpers
return new string((sbyte*)pNative, 0, cch);
}
- internal static unsafe void ClearNative(IntPtr pNative)
+ internal static void ClearNative(IntPtr pNative)
{
if (IntPtr.Zero != pNative)
{
@@ -392,7 +392,7 @@ namespace System.StubHelpers
internal static class AnsiBSTRMarshaler
{
- internal static unsafe IntPtr ConvertToNative(int flags, string strManaged)
+ internal static IntPtr ConvertToNative(int flags, string strManaged)
{
if (null == strManaged)
{
@@ -425,7 +425,7 @@ namespace System.StubHelpers
}
}
- internal static unsafe void ClearNative(IntPtr pNative)
+ internal static void ClearNative(IntPtr pNative)
{
if (IntPtr.Zero != pNative)
{
@@ -442,7 +442,7 @@ namespace System.StubHelpers
return IntPtr.Zero;
}
- internal static unsafe string ConvertToManaged(IntPtr bstr)
+ internal static string ConvertToManaged(IntPtr bstr)
{
Debug.Fail("NYI");
return null;
@@ -1376,7 +1376,7 @@ namespace System.StubHelpers
// For converting WinRT's Windows.Foundation.HResult into System.Exception and vice versa.
internal static class HResultExceptionMarshaler
{
- internal static unsafe int ConvertToNative(Exception ex)
+ internal static int ConvertToNative(Exception ex)
{
if (!Environment.IsWinRTSupported)
{
@@ -1389,7 +1389,7 @@ namespace System.StubHelpers
return ex._HResult;
}
- internal static unsafe Exception ConvertToManaged(int hr)
+ internal static Exception ConvertToManaged(int hr)
{
if (!Environment.IsWinRTSupported)
{
diff --git a/src/System.Private.CoreLib/src/System/Threading/ClrThreadPoolPreAllocatedOverlapped.cs b/src/System.Private.CoreLib/src/System/Threading/ClrThreadPoolPreAllocatedOverlapped.cs
index 27ea8a4926..64c7219135 100644
--- a/src/System.Private.CoreLib/src/System/Threading/ClrThreadPoolPreAllocatedOverlapped.cs
+++ b/src/System.Private.CoreLib/src/System/Threading/ClrThreadPoolPreAllocatedOverlapped.cs
@@ -48,7 +48,7 @@ namespace System.Threading
/// This method was called after the <see cref="ThreadPoolBoundHandle"/> was disposed.
/// </exception>
[CLSCompliant(false)]
- public unsafe PreAllocatedOverlapped(IOCompletionCallback callback, object state, object pinData)
+ public PreAllocatedOverlapped(IOCompletionCallback callback, object state, object pinData)
{
if (callback == null)
throw new ArgumentNullException(nameof(callback));
@@ -69,7 +69,7 @@ namespace System.Threading
/// <summary>
/// Frees the resources associated with this <see cref="PreAllocatedOverlapped"/> instance.
/// </summary>
- public unsafe void Dispose()
+ public void Dispose()
{
_lifetime.Dispose(this);
GC.SuppressFinalize(this);
diff --git a/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs b/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs
index 1061c8b1a2..d4ff9b1ef5 100644
--- a/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs
+++ b/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs
@@ -6466,7 +6466,7 @@ namespace System.Threading.Tasks
if (m_inliningDepth < 0) m_inliningDepth = 0;
}
- private unsafe bool CheckForSufficientStack()
+ private bool CheckForSufficientStack()
{
return RuntimeHelpers.TryEnsureSufficientExecutionStack();
}
diff --git a/src/System.Private.CoreLib/src/System/Threading/Thread.cs b/src/System.Private.CoreLib/src/System/Threading/Thread.cs
index 241b279040..45c7f9c6df 100644
--- a/src/System.Private.CoreLib/src/System/Threading/Thread.cs
+++ b/src/System.Private.CoreLib/src/System/Threading/Thread.cs
@@ -194,7 +194,7 @@ namespace System.Threading
}
// Returns handle for interop with EE. The handle is guaranteed to be non-null.
- internal unsafe ThreadHandle GetNativeHandle()
+ internal ThreadHandle GetNativeHandle()
{
IntPtr thread = DONT_USE_InternalThread;