Annotate collections.specialized to be native aot compatible (#71159)
authorLakshan Fernando <lakshanf@hotmail.com>
Tue, 28 Jun 2022 11:53:54 +0000 (04:53 -0700)
committerGitHub <noreply@github.com>
Tue, 28 Jun 2022 11:53:54 +0000 (04:53 -0700)
* annoate specialized to be native aot compatible

* FB

* Update src/libraries/System.Collections.Specialized/src/System/Collections/Specialized/NameObjectCollectionBase.cs

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
eng/pipelines/runtime-extra-platforms-other.yml
src/libraries/System.Collections.Specialized/src/System/Collections/Specialized/NameObjectCollectionBase.cs
src/libraries/tests.proj

index 53acaa8..e25d3c8 100644 (file)
@@ -84,6 +84,7 @@ jobs:
     platforms:
     - windows_x64
     - windows_arm64
+    - Linux_x64
     jobParameters:
       testGroup: innerloop
       isSingleFile: true
index 1e872ff..9c75a8e 100644 (file)
@@ -431,6 +431,8 @@ namespace System.Collections.Specialized
         ///    <para>Returns an array of the specified type containing
         ///       all the values in the <see cref='System.Collections.Specialized.NameObjectCollectionBase'/> instance.</para>
         /// </devdoc>
+        [UnconditionalSuppressMessage("AotAnalysis", "IL3050:RequiresDynamicCode",
+            Justification = "The API only works for reference type arguments and code for reference typed arrays is shareable.")]
         protected object?[] BaseGetAllValues(Type type)
         {
             ArgumentNullException.ThrowIfNull(type);
index 90da69d..7f747d1 100644 (file)
     <ProjectExclusions Include="$(MSBuildThisFileDirectory)System.IO.FileSystem\tests\System.IO.FileSystem.Tests.csproj" />
     <!--Needs work to get these tests to pass -->
     <!--These tests have failures-->
+    <ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Console\tests\System.Console.Tests.csproj" 
+                      Condition="'$(TargetOS)' == 'linux'" />
+    <ProjectExclusions Include="$(MSBuildThisFileDirectory)System.IO.Ports\tests\System.IO.Ports.Tests.csproj"
+                      Condition="'$(TargetOS)' == 'linux'" />
     <ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Numerics.Vectors\tests\System.Numerics.Vectors.Tests.csproj" />
     <ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Security.Cryptography.Xml\tests\System.Security.Cryptography.Xml.Tests.csproj" />
     <ProjectExclusions Include="$(MSBuildThisFileDirectory)Microsoft.Extensions.Logging.EventSource\tests\Microsoft.Extensions.Logging.EventSource.Tests.csproj" />
   <ItemGroup Condition="'$(TestNativeAot)' == 'true'">
     <SmokeTestProject Include="$(MSBuildThisFileDirectory)System.Collections\tests\System.Collections.Tests.csproj" />
     <!-- Remove the condition after fix, https://github.com/dotnet/runtime/issues/70010 -->
-    <SmokeTestProject Include="$(MSBuildThisFileDirectory)System.Reflection\tests\System.Reflection.Tests.csproj" 
+    <SmokeTestProject Include="$(MSBuildThisFileDirectory)System.Reflection\tests\System.Reflection.Tests.csproj"
                       Condition="'$(TargetOS)' == 'windows'" />
     <SmokeTestProject Include="$(MSBuildThisFileDirectory)System.Runtime\tests\System.Runtime.Tests.csproj" />
     <SmokeTestProject Include="$(MSBuildThisFileDirectory)System.IO.Compression\tests\System.IO.Compression.Tests.csproj" />