diff options
author | Tlakaelel Axayakatl Ceja <tlakaelel.ceja@microsoft.com> | 2022-04-08 20:16:31 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-08 20:16:31 +0300 |
commit | 3292e23c9011c9822ab3d9b28a1e8f5bc570047e (patch) | |
tree | 45a85901f56038d2848f81bb45acf9e0897db277 /test/Mono.Linker.Tests.Cases | |
parent | bacafd1df813b04c5f5758ba0d65b26ee423b150 (diff) |
Avoid analyzing cref for generic parameters (#2732)
Add check for cref in generic parameter dataflow to avoid failing with a nullreference exception
Refactor code to reuse the while loop for both INamedType and Method symbols
Add tests
Fixes #2724
Diffstat (limited to 'test/Mono.Linker.Tests.Cases')
-rw-r--r-- | test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs | 10 | ||||
-rw-r--r-- | test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs index fefa4584f..e30b6f1d2 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs @@ -165,6 +165,11 @@ namespace Mono.Linker.Tests.Cases.DataFlow new DerivedTypeWithOpenGenericOnBaseWithRequirements<TestType> (); } + /// <summary> + /// Adding a comment to verify that analyzer doesn't null ref when trying to analyze + /// generic parameter in cref comments on a class + /// <see cref="GenericBaseTypeWithRequirements{T}"/> + /// </summary> class GenericBaseTypeWithRequirements<[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicFields)] T> { public GenericBaseTypeWithRequirements () @@ -452,6 +457,11 @@ namespace Mono.Linker.Tests.Cases.DataFlow MethodRequiresNothingPassThrough<TestType> (); } + /// <summary> + /// Adding a comment to verify that analyzer doesn't null ref when trying to analyze + /// generic parameter comments on a method + /// <see cref="MethodRequiresPublicFields{T}"/> + /// </summary> [ExpectedWarning ("IL2087", nameof (DataFlowTypeExtensions.RequiresPublicMethods))] static void MethodRequiresPublicFields< [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicFields)] T> () diff --git a/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj b/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj index 29cde9ab6..7d1c6de28 100644 --- a/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj +++ b/test/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj @@ -6,6 +6,7 @@ <AnalysisLevel>0</AnalysisLevel> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> + <GenerateDocumentationFile>true</GenerateDocumentationFile> </PropertyGroup> <ItemGroup> |