Skip to content

Commit

Permalink
Switch SYSLIB0003 suppression to pragma rather than project-level
Browse files Browse the repository at this point in the history
  • Loading branch information
Jevonius committed Apr 30, 2022
1 parent 2de4707 commit 9da21a7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 15 deletions.
7 changes: 0 additions & 7 deletions src/Castle.Core.Tests/Castle.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@

<PropertyGroup>
<TargetFrameworks>net462;netcoreapp2.1;netcoreapp3.1;net6.0</TargetFrameworks>

<NoWarn>$(NoWarn);SYSLIB0003</NoWarn>
<!--
Code Access Security is not available in Core, and obsolete in net5.0+
This stops warnings about SYSLIB0003 (https://docs.microsoft.com/en-us/dotnet/fundamentals/syslib-diagnostics/syslib0003)
Depending on how these are deprecated in a future dotnet release, may need to wrap relevant code with "#if NET462_OR_GREATER" or similar at some point.
-->
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public class AttributedClass_Inheritable
{
}

#pragma warning disable SYSLIB0003
[Test]
public void SecurityPermissionAttribute_should_not_be_replicated_as_it_is_part_of_cas()
{
Expand All @@ -90,6 +91,7 @@ public void ReflectionPermissionAttribute_should_not_be_replicated_as_it_is_part
public class AttributedClass_ReflectionPermission
{
}
#pragma warning restore SYSLIB0003

private int AttributeCount<TAttribute>(object proxy)
where TAttribute : Attribute
Expand Down
8 changes: 0 additions & 8 deletions src/Castle.Core/Castle.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@

<PropertyGroup>
<TargetFrameworks>net462;netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>

<NoWarn>$(NoWarn);SYSLIB0003</NoWarn>
<!--
Code Access Security is not available in Core, and obsolete in net5.0+
This stops warnings about SYSLIB0003 (https://docs.microsoft.com/en-us/dotnet/fundamentals/syslib-diagnostics/syslib0003)
Depending on how these are deprecated in a future dotnet release, may need to wrap relevant code with "#if NET462_OR_GREATER" or similar instead.
-->

</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ static AttributesToAvoidReplicating()
typeof(System.Runtime.InteropServices.ComImportAttribute),
typeof(System.Runtime.InteropServices.MarshalAsAttribute),
typeof(System.Runtime.InteropServices.TypeIdentifierAttribute),
#pragma warning disable SYSLIB0003
typeof(System.Security.Permissions.SecurityAttribute),
#pragma warning restore SYSLIB0003
};
}

Expand Down

0 comments on commit 9da21a7

Please sign in to comment.