Skip to content

Commit e823a08

Browse files
jkotasfilipnavara
andauthored
Fix native aot test failures (#76114)
* Fix native aot test failures * Fix test failure on NativeAOT with non-English locale * Delete duplicate and dead files Fixes #75699 Co-authored-by: Filip Navara <filip.navara@gmail.com>
1 parent 985eedd commit e823a08

File tree

22 files changed

+38
-465
lines changed

22 files changed

+38
-465
lines changed

src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CertCreateCertificateContext.cs

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

src/libraries/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<EnablePreviewFeatures>true</EnablePreviewFeatures>
1010
<!-- the res/xml/network_security_config.xml file comes from the System.Net.TestData package -->
1111
<IncludeNetworkSecurityConfig Condition="'$(TargetOS)' == 'Android'">true</IncludeNetworkSecurityConfig>
12+
<EventSourceSupport Condition="'$(TestNativeAot)' == 'true'">true</EventSourceSupport>
1213
</PropertyGroup>
1314

1415
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->

src/libraries/System.Net.NameResolution/tests/FunctionalTests/System.Net.NameResolution.Functional.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent)-Browser</TargetFrameworks>
44
<IncludeRemoteExecutor>true</IncludeRemoteExecutor>
55
<IgnoreForCI Condition="'$(TargetOS)' == 'Browser'">true</IgnoreForCI>
6+
<EventSourceSupport Condition="'$(TestNativeAot)' == 'true'">true</EventSourceSupport>
67
</PropertyGroup>
78
<ItemGroup>
89
<Compile Include="AssemblyInfo.cs" />

src/libraries/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<!-- the res/xml/network_security_config.xml file comes from the System.Net.TestData package -->
99
<IncludeNetworkSecurityConfig Condition="'$(TargetOS)' == 'Android'">true</IncludeNetworkSecurityConfig>
1010
<EnablePreviewFeatures>true</EnablePreviewFeatures>
11+
<EventSourceSupport Condition="'$(TestNativeAot)' == 'true'">true</EventSourceSupport>
1112
</PropertyGroup>
1213
<ItemGroup>
1314
<Compile Include="AssemblyInfo.cs" />

src/libraries/System.Private.Xml/src/Utils/System.Xml.Utils.txt

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

src/libraries/System.Private.Xml/src/Utils/native.rc

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
using System.Text.RegularExpressions;
1111
using Xunit.Abstractions;
1212

13-
namespace System.Xml.XmlSchemaValidatorApiTests
13+
namespace System.Xml.Tests
1414
{
1515
public class LineInfo
1616
{
@@ -134,13 +134,18 @@ public ExceptionVerifier(string assemblyName, ExceptionVerificationFlags flags,
134134
{
135135
_output.WriteLine(e2.ToString());
136136
}
137+
catch (PlatformNotSupportedException e3)
138+
{
139+
// NativeAOT doesn't support assembly loading
140+
_output.WriteLine(e3.ToString());
141+
}
137142
}
138143
}
139144
catch (Exception e)
140145
{
141146
_output.WriteLine("Exception: " + e.Message);
142147
_output.WriteLine("Stack: " + e.StackTrace);
143-
throw new VerifyException("Error while loading assembly");
148+
throw new VerifyException("Error while loading assembly", e);
144149
}
145150

146151
string[] resArray;
@@ -175,7 +180,6 @@ public ExceptionVerifier(string assemblyName, ExceptionVerificationFlags flags,
175180
}
176181
resReader.Dispose();
177182
}
178-
//break;
179183
}
180184
}
181185

@@ -209,8 +213,7 @@ private void ExceptionInfoOutput()
209213
"\n===== Original Exception Message =====\n" + _ex.Message +
210214
"\n===== Resource Id =====\n" + fInfo.GetValue(_ex) +
211215
"\n===== HelpLink =====\n" + _ex.HelpLink +
212-
"\n===== Source =====\n" + _ex.Source /*+
213-
"\n===== TargetSite =====\n" + ex.TargetSite + "\n"*/);
216+
"\n===== Source =====\n" + _ex.Source);
214217

215218
_output.WriteLine(
216219
"\n===== InnerException =====\n" + _ex.InnerException +
@@ -395,5 +398,9 @@ public class VerifyException : Exception
395398
public VerifyException(string msg)
396399
: base(msg)
397400
{ }
401+
402+
public VerifyException(string msg, Exception innerException)
403+
: base(msg, innerException)
404+
{ }
398405
}
399406
}

src/libraries/System.Private.Xml/tests/System.Private.Xml.Tests.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
<ItemGroup>
1919
<Compile Include="AllowDefaultResolverContext.cs" />
20+
<Compile Include="ExceptionVerifier.cs" />
2021
<Compile Include="$(CommonTestPath)\TestUtilities\System\DisableParallelizationPerAssembly.cs" Link="Common\TestUtilities\System\DisableParallelizationPerAssembly.cs" />
2122
</ItemGroup>
2223

@@ -401,7 +402,6 @@
401402
<ItemGroup>
402403
<Compile Include="XmlSchema\XmlSchemaValidatorApi\Constructor_AddSchema.cs" />
403404
<Compile Include="XmlSchema\XmlSchemaValidatorApi\CustomImplementations.cs" />
404-
<Compile Include="XmlSchema\XmlSchemaValidatorApi\ExceptionVerifier.cs" />
405405
<Compile Include="XmlSchema\XmlSchemaValidatorApi\GetExpectedAttributes.cs" />
406406
<Compile Include="XmlSchema\XmlSchemaValidatorApi\GetExpectedParticles.cs" />
407407
<Compile Include="XmlSchema\XmlSchemaValidatorApi\Initialize_EndValidation.cs" />
@@ -641,7 +641,6 @@
641641
<Compile Include="Xslt\XslTransformApi\CThreads.cs" />
642642
<Compile Include="Xslt\XslTransformApi\CXmlCache.cs" />
643643
<Compile Include="Xslt\XslTransformApi\DataHelper.cs" />
644-
<Compile Include="Xslt\XslTransformApi\ExceptionVerifier.cs" />
645644
<Compile Include="Xslt\XslTransformApi\MyNavigator.cs" />
646645
<Compile Include="Xslt\XslTransformApi\ReaderType.cs" />
647646
<Compile Include="Xslt\XslTransformApi\ThreadFunc.cs" />

src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/Initialize_EndValidation.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System.IO;
55
using System.Xml.Schema;
6+
using System.Xml.Tests;
67
using Xunit;
78
using Xunit.Abstractions;
89

src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/PropertiesTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Collections;
55
using System.IO;
66
using System.Xml.Schema;
7+
using System.Xml.Tests;
78
using Xunit;
89
using Xunit.Abstractions;
910

0 commit comments

Comments
 (0)