Skip to content

Commit 5cdb322

Browse files
[NativeAot] Start running 8 more libs tests (#73283)
1 parent bf56a7c commit 5cdb322

File tree

21 files changed

+95
-54
lines changed

21 files changed

+95
-54
lines changed

src/coreclr/nativeaot/System.Private.CoreLib/src/Internal/Reflection/Extensions/NonPortable/CustomAttributeInheritanceRules.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,16 @@ public sealed override ParameterInfo GetParent(ParameterInfo e)
233233
MethodInfo? methodParent = new MethodCustomAttributeSearcher().GetParent(method);
234234
if (methodParent == null)
235235
return null;
236-
return methodParent.GetParametersNoCopy()[e.Position];
236+
237+
if (e.Position >= 0)
238+
{
239+
return methodParent.GetParametersNoCopy()[e.Position];
240+
}
241+
else
242+
{
243+
Debug.Assert(e.Position == -1);
244+
return methodParent.ReturnParameter;
245+
}
237246
}
238247

239248
public static readonly ParameterCustomAttributeSearcher Default = new ParameterCustomAttributeSearcher();

src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/TypeInfos/RuntimeTypeInfo.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -187,38 +187,38 @@ public sealed override MemberInfo[] GetDefaultMembers()
187187
return defaultMemberName != null ? GetMember(defaultMemberName) : Array.Empty<MemberInfo>();
188188
}
189189

190-
public sealed override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType)
190+
public sealed override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type ifaceType)
191191
{
192192
// restrictions and known limitations compared to CoreCLR:
193193
// - only interface.GetMethods() reflection visible interface methods are returned
194194
// - all visible members of the interface must be reflection invokeable
195-
// - this type and interfaceType must not be an open generic type
195+
// - this type and ifaceType must not be an open generic type
196196
// - if this type and the method implementing the interface method are abstract, an exception is thrown
197197

198198
if (IsGenericParameter)
199199
throw new InvalidOperationException(SR.Arg_GenericParameter);
200200

201-
if (interfaceType is null)
202-
throw new ArgumentNullException(nameof(interfaceType));
201+
if (ifaceType is null)
202+
throw new ArgumentNullException(nameof(ifaceType));
203203

204-
if (!(interfaceType is RuntimeTypeInfo))
205-
throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(interfaceType));
204+
if (!(ifaceType is RuntimeTypeInfo))
205+
throw new ArgumentException(SR.Argument_MustBeRuntimeType, nameof(ifaceType));
206206

207-
RuntimeTypeHandle interfaceTypeHandle = interfaceType.TypeHandle;
207+
RuntimeTypeHandle interfaceTypeHandle = ifaceType.TypeHandle;
208208

209209
ReflectionCoreExecution.ExecutionEnvironment.VerifyInterfaceIsImplemented(TypeHandle, interfaceTypeHandle);
210-
Debug.Assert(interfaceType.IsInterface);
210+
Debug.Assert(ifaceType.IsInterface);
211211
Debug.Assert(!IsInterface);
212212

213213
// SZArrays implement the methods on IList`1, IEnumerable`1, and ICollection`1 with
214214
// runtime magic. We don't have accurate interface maps for them.
215-
if (IsSZArray && interfaceType.IsGenericType)
215+
if (IsSZArray && ifaceType.IsGenericType)
216216
throw new ArgumentException(SR.Argument_ArrayGetInterfaceMap);
217217

218-
ReflectionCoreExecution.ExecutionEnvironment.GetInterfaceMap(this, interfaceType, out MethodInfo[] interfaceMethods, out MethodInfo[] targetMethods);
218+
ReflectionCoreExecution.ExecutionEnvironment.GetInterfaceMap(this, ifaceType, out MethodInfo[] interfaceMethods, out MethodInfo[] targetMethods);
219219

220220
InterfaceMapping im;
221-
im.InterfaceType = interfaceType;
221+
im.InterfaceType = ifaceType;
222222
im.TargetType = this;
223223
im.InterfaceMethods = interfaceMethods;
224224
im.TargetMethods = targetMethods;

src/coreclr/tools/Common/TypeSystem/IL/Stubs/ValueTypeGetFieldHelperMethodOverride.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,19 +142,21 @@ public override bool IsVirtual
142142
}
143143
}
144144

145+
internal const string MetadataName = "__GetFieldHelper";
146+
145147
public override string Name
146148
{
147149
get
148150
{
149-
return "__GetFieldHelper";
151+
return MetadataName;
150152
}
151153
}
152154

153155
public override string DiagnosticName
154156
{
155157
get
156158
{
157-
return "__GetFieldHelper";
159+
return MetadataName;
158160
}
159161
}
160162
}

src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/NoMetadataBlockingPolicy.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ public override bool IsBlocked(MethodDesc method)
5151
if (ecmaMethod.OwningType == GetArrayOfTType(ecmaMethod))
5252
return true;
5353

54+
// Also don't expose the ValueType.__GetFieldOverride method.
55+
if (ecmaMethod.Name == Internal.IL.Stubs.ValueTypeGetFieldHelperMethodOverride.MetadataName
56+
&& ecmaMethod.OwningType.IsWellKnownType(WellKnownType.ValueType))
57+
return true;
58+
5459
return false;
5560
}
5661

src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Proxy.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -499,14 +499,15 @@ public async Task MultiProxy_PAC_Failover_Succeeds()
499499
string proxyConfigString = $"{failingEndPoint.Address}:{failingEndPoint.Port} {succeedingProxyServer.Uri.Host}:{succeedingProxyServer.Uri.Port}";
500500

501501
// Create a WinInetProxyHelper and override its values with our own.
502-
object winInetProxyHelper = Activator.CreateInstance(typeof(HttpClient).Assembly.GetType("System.Net.Http.WinInetProxyHelper", true), true);
503-
winInetProxyHelper.GetType().GetField("_autoConfigUrl", Reflection.BindingFlags.Instance | Reflection.BindingFlags.NonPublic).SetValue(winInetProxyHelper, null);
504-
winInetProxyHelper.GetType().GetField("_autoDetect", Reflection.BindingFlags.Instance | Reflection.BindingFlags.NonPublic).SetValue(winInetProxyHelper, false);
505-
winInetProxyHelper.GetType().GetField("_proxy", Reflection.BindingFlags.Instance | Reflection.BindingFlags.NonPublic).SetValue(winInetProxyHelper, proxyConfigString);
506-
winInetProxyHelper.GetType().GetField("_proxyBypass", Reflection.BindingFlags.Instance | Reflection.BindingFlags.NonPublic).SetValue(winInetProxyHelper, null);
502+
Type winInetProxyHelperType = Type.GetType("System.Net.Http.WinInetProxyHelper, System.Net.Http", true);
503+
object winInetProxyHelper = Activator.CreateInstance(winInetProxyHelperType, true);
504+
winInetProxyHelperType.GetField("_autoConfigUrl", Reflection.BindingFlags.Instance | Reflection.BindingFlags.NonPublic).SetValue(winInetProxyHelper, null);
505+
winInetProxyHelperType.GetField("_autoDetect", Reflection.BindingFlags.Instance | Reflection.BindingFlags.NonPublic).SetValue(winInetProxyHelper, false);
506+
winInetProxyHelperType.GetField("_proxy", Reflection.BindingFlags.Instance | Reflection.BindingFlags.NonPublic).SetValue(winInetProxyHelper, proxyConfigString);
507+
winInetProxyHelperType.GetField("_proxyBypass", Reflection.BindingFlags.Instance | Reflection.BindingFlags.NonPublic).SetValue(winInetProxyHelper, null);
507508

508509
// Create a HttpWindowsProxy with our custom WinInetProxyHelper.
509-
IWebProxy httpWindowsProxy = (IWebProxy)Activator.CreateInstance(typeof(HttpClient).Assembly.GetType("System.Net.Http.HttpWindowsProxy", true), Reflection.BindingFlags.NonPublic | Reflection.BindingFlags.Instance, null, new[] { winInetProxyHelper, null }, null);
510+
IWebProxy httpWindowsProxy = (IWebProxy)Activator.CreateInstance(Type.GetType("System.Net.Http.HttpWindowsProxy, System.Net.Http", true), Reflection.BindingFlags.NonPublic | Reflection.BindingFlags.Instance, null, new[] { winInetProxyHelper, null }, null);
510511

511512
Task<bool> nextFailedConnection = null;
512513

src/libraries/Microsoft.NETCore.Platforms/tests/GenerateRuntimeGraphTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
namespace Microsoft.NETCore.Platforms.BuildTasks.Tests
1616
{
17+
// MSBuild engine is not compatible with single file
18+
[ConditionalClass(typeof(PlatformDetection), nameof(PlatformDetection.HasAssemblyFiles))]
1719
public class GenerateRuntimeGraphTests
1820
{
1921
private Log _log;

src/libraries/Microsoft.Win32.SystemEvents/tests/SystemEvents.InvokeOnEventsThread.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ public void InvokeOnEventsThreadRunsOnSameThreadAsOtherEvents()
5252
}
5353
}
5454

55-
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotWindowsNanoNorServerCore))]
55+
public static bool NotNanoNorServerCoreAndRemoteExecutorSupported => PlatformDetection.IsNotWindowsNanoNorServerCore && RemoteExecutor.IsSupported;
56+
57+
[ConditionalFact(nameof(NotNanoNorServerCoreAndRemoteExecutorSupported))]
5658
[SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)]
5759
[ActiveIssue("https://github.com/dotnet/runtime/issues/34360", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
5860
public void RegisterFromSTAThreadThatGoesAway_MessageStillDelivered()

src/libraries/System.Globalization.Calendars/tests/CalendarTestWithConfigSwitch/System.Globalization.CalendarsWithConfigSwitch.Tests.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@
66
<ItemGroup>
77
<Compile Include="CalendarTests.cs" />
88
</ItemGroup>
9+
<ItemGroup>
10+
<RuntimeHostConfigurationOption Include="Switch.System.Globalization.EnforceJapaneseEraYearRanges" Value="true" />
11+
</ItemGroup>
912
</Project>

src/libraries/System.Globalization.Calendars/tests/CalendarTestWithConfigSwitch/runtimeconfig.template.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/libraries/System.Globalization/tests/NlsTests/System.Globalization.Nls.Tests.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
<TargetFramework>$(NetCoreAppCurrent)-windows</TargetFramework>
88
<UnicodeUcdVersion>14.0</UnicodeUcdVersion>
99
</PropertyGroup>
10+
<ItemGroup>
11+
<RdXmlFile Include="..\default.rd.xml" />
12+
</ItemGroup>
1013
<ItemGroup>
1114
<!-- Include tests from System.Globalization.Tests -->
1215
<Compile Include="NlsSwitchTests.cs" />
@@ -222,6 +225,9 @@
222225
<Compile Include="$(CommonTestPath)System\RandomDataGenerator.cs"
223226
Link="Common\System\RandomDataGenerator.cs" />
224227
</ItemGroup>
228+
<ItemGroup>
229+
<RuntimeHostConfigurationOption Include="System.Globalization.UseNls" Value="true" />
230+
</ItemGroup>
225231
<ItemGroup>
226232
<PackageReference Include="System.Private.Runtime.UnicodeData" Version="$(SystemPrivateRuntimeUnicodeDataVersion)" ExcludeAssets="contentFiles" GeneratePathProperty="true" />
227233
<EmbeddedResource Include="$(PkgSystem_Private_Runtime_UnicodeData)\contentFiles\any\any\$(UnicodeUcdVersion).0\ucd\UnicodeData.txt">

0 commit comments

Comments
 (0)