Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJackson Schuster <jschuster@microsoft.com>2021-12-02 20:33:04 +0300
committerJackson Schuster <jschuster@microsoft.com>2021-12-10 01:37:53 +0300
commitb0f04f14a791fc463129e0d463be58cfbb1748f4 (patch)
tree3211e7c1e0284a1185543eff1661e2cda7b2f201 /test
parent387564e6563cfc859100c738dabd5bea4fe348ac (diff)
Check containing symbol for RequiresUnreferencedCode to silence IL2050
The ComAnalyzer now checks the containing symbol to see if it has the RequiresUnreferencedCode attribute, and doesn't emit IL2050 if it does.
Diffstat (limited to 'test')
-rw-r--r--test/Mono.Linker.Tests.Cases/Interop/PInvoke/Warnings/ComPInvokeWarning.cs13
1 files changed, 9 insertions, 4 deletions
diff --git a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Warnings/ComPInvokeWarning.cs b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Warnings/ComPInvokeWarning.cs
index c652f26fd..a92e86945 100644
--- a/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Warnings/ComPInvokeWarning.cs
+++ b/test/Mono.Linker.Tests.Cases/Interop/PInvoke/Warnings/ComPInvokeWarning.cs
@@ -30,6 +30,7 @@ namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Warnings
Call_CanSuppressWarningOnParameter ();
Call_CanSuppressWarningOnReturnType ();
Call_CanSuppressWithRequiresUnreferencedCode ();
+ Call_CanSuppressWithRequiresUnreferencedCodeInLambda ();
Call_CanSuppressPInvokeWithRequiresUnreferencedCode ();
Call_PInvokeWithRequiresUnreferencedCode ();
}
@@ -156,8 +157,6 @@ namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Warnings
static extern IFoo CanSuppressWarningOnReturnType ();
[RequiresUnreferencedCode ("test")]
- // Bug https://github.com/dotnet/linker/issues/2378
- [ExpectedWarning ("IL2050", ProducedBy = ProducedBy.Analyzer)]
static void Call_CanSuppressWithRequiresUnreferencedCode ()
{
CanSuppressWithRequiresUnreferencedCode (null);
@@ -167,8 +166,6 @@ namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Warnings
static extern void CanSuppressWithRequiresUnreferencedCode (IFoo foo);
[RequiresUnreferencedCode ("test")]
- // Bug https://github.com/dotnet/linker/issues/2378
- [ExpectedWarning ("IL2050", ProducedBy = ProducedBy.Analyzer)]
static void Call_CanSuppressPInvokeWithRequiresUnreferencedCode ()
{
CanSuppressPInvokeWithRequiresUnreferencedCode (null);
@@ -178,6 +175,14 @@ namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Warnings
[DllImport ("Foo")]
static extern void CanSuppressPInvokeWithRequiresUnreferencedCode (IFoo foo);
+ [RequiresUnreferencedCode ("test")]
+ static void Call_CanSuppressWithRequiresUnreferencedCodeInLambda ()
+ {
+ var lambda = () => CanSuppressWithRequiresUnreferencedCode (null);
+ lambda ();
+ }
+
+
[ExpectedWarning ("IL2050")]
[ExpectedWarning ("IL2026")]
static void Call_PInvokeWithRequiresUnreferencedCode ()