Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ public class NullabilityInfoContextTests
private static readonly NullabilityInfoContext nullabilityContext = new NullabilityInfoContext();
private static readonly Type testType = typeof(TypeWithNotNullContext);
private static readonly Type genericType = typeof(GenericTest<TypeWithNotNullContext>);
private static readonly Type stringType = typeof(string);
private static readonly BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;
private const BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;

public static IEnumerable<object[]> FieldTestData()
{
Expand Down Expand Up @@ -705,7 +704,7 @@ public static IEnumerable<object[]> StringTypeTestData()
[MemberData(nameof(StringTypeTestData))]
public void NullablePublicOnlyStringTypeTest(string methodName, NullabilityState param1State, NullabilityState param2State, NullabilityState param3State, Type[] types)
{
ParameterInfo[] parameters = stringType.GetMethod(methodName, flags, types)!.GetParameters();
ParameterInfo[] parameters = typeof(string).GetMethod(methodName, flags, types)!.GetParameters();
NullabilityInfo param1 = nullabilityContext.Create(parameters[0]);
NullabilityInfo param2 = nullabilityContext.Create(parameters[1]);
NullabilityInfo param3 = nullabilityContext.Create(parameters[2]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Buffers;
using System.Diagnostics.CodeAnalysis;
using System.Numerics;
using System.Reflection;
using System.Runtime.InteropServices;
Expand Down Expand Up @@ -427,9 +428,10 @@ private static int CallWidenAsciiToUtf16(ReadOnlySpan<byte> ascii, Span<char> ut
}
}

[return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)]
private static Type GetAsciiUtilityType()
{
return typeof(object).Assembly.GetType("System.Text.ASCIIUtility");
return Type.GetType("System.Text.ASCIIUtility, System.Private.CoreLib");
}

private sealed class UnsafeLazyDelegate<TDelegate> where TDelegate : Delegate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Buffers;
using System.Diagnostics.CodeAnalysis;
using System.Numerics;
using System.Reflection;
using System.Runtime.InteropServices;
Expand Down Expand Up @@ -325,9 +326,10 @@ private static void CallWidenLatin1ToUtf16(ReadOnlySpan<byte> latin1, Span<char>
}
}

[return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)]
private static Type GetLatin1UtilityType()
{
return typeof(object).Assembly.GetType("System.Text.Latin1Utility");
return Type.GetType("System.Text.Latin1Utility, System.Private.CoreLib");
}

private sealed class UnsafeLazyDelegate<TDelegate> where TDelegate : class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private static Lazy<GetPointerToFirstInvalidCharDel> CreateGetPointerToFirstInva
{
return new Lazy<GetPointerToFirstInvalidCharDel>(() =>
{
Type utf16UtilityType = typeof(Utf8).Assembly.GetType("System.Text.Unicode.Utf16Utility");
Type utf16UtilityType = Type.GetType("System.Text.Unicode.Utf16Utility, System.Private.CoreLib");

if (utf16UtilityType is null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ private static Lazy<GetPointerToFirstInvalidByteDel> CreateGetPointerToFirstInva
{
return new Lazy<GetPointerToFirstInvalidByteDel>(() =>
{
Type utf8UtilityType = typeof(Utf8).Assembly.GetType("System.Text.Unicode.Utf8Utility");
Type utf8UtilityType = Type.GetType("System.Text.Unicode.Utf8Utility, System.Private.CoreLib");

if (utf8UtilityType is null)
{
Expand Down