-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Support for RequiresAttributeMismatch testing #72496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
fe20630
0f4bb88
d34d8cb
8d4a5eb
1407ccb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -206,6 +206,14 @@ void CheckAndWarnOnReflectionAccess(in MessageOrigin origin, TypeSystemEntity en | |
| } | ||
| } | ||
|
|
||
| var diagnosticContext = new DiagnosticContext( | ||
| origin, | ||
| _logger.ShouldSuppressAnalysisWarningsForRequires(origin.MemberDefinition, DiagnosticUtilities.RequiresUnreferencedCodeAttribute), | ||
| _logger.ShouldSuppressAnalysisWarningsForRequires(origin.MemberDefinition, DiagnosticUtilities.RequiresDynamicCodeAttribute), | ||
| _logger.ShouldSuppressAnalysisWarningsForRequires(origin.MemberDefinition, DiagnosticUtilities.RequiresAssemblyFilesAttribute), | ||
| _logger); | ||
| ReflectionMethodBodyScanner.CheckAndReportRequires(diagnosticContext, entity, DiagnosticUtilities.RequiresUnreferencedCodeAttribute); | ||
|
||
|
|
||
| if (!Annotations.ShouldWarnWhenAccessedForReflection(entity)) | ||
| return; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| // Copyright (c) .NET Foundation and contributors. All rights reserved. | ||
| // Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Diagnostics.CodeAnalysis; | ||
| using System.Linq; | ||
| using System.Text; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace Mono.Linker.Tests.Cases.RequiresCapability.Dependencies | ||
| { | ||
| public class ReferenceInterfaces | ||
| { | ||
| public interface IBaseWithRequiresInReference | ||
| { | ||
| [RequiresUnreferencedCode ("Message")] | ||
| [RequiresAssemblyFiles ("Message")] | ||
| [RequiresDynamicCode ("Message")] | ||
| public void Method (); | ||
|
|
||
| public string PropertyAnnotationInAccesor { | ||
| [RequiresUnreferencedCode ("Message")] | ||
| [RequiresAssemblyFiles ("Message")] | ||
| [RequiresDynamicCode ("Message")] | ||
| get; | ||
| set; | ||
| } | ||
|
|
||
| [RequiresAssemblyFiles ("Message")] | ||
| public string PropertyAnnotationInProperty { get; set; } | ||
| } | ||
|
|
||
| public interface IBaseWithoutRequiresInReference | ||
| { | ||
| public void Method (); | ||
|
|
||
| public string PropertyAnnotationInAccesor { | ||
| get; | ||
| set; | ||
| } | ||
|
|
||
| public string PropertyAnnotationInProperty { get; set; } | ||
| } | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.