1 #region Copyright notice and license 2 // Protocol Buffers - Google's data interchange format 3 // Copyright 2015 Google Inc. All rights reserved. 4 // 5 // Use of this source code is governed by a BSD-style 6 // license that can be found in the LICENSE file or at 7 // https://developers.google.com/open-source/licenses/bsd 8 #endregion 9 10 #if !NET5_0_OR_GREATER 11 // Copied with permission from https://github.com/dotnet/runtime/tree/8fbf206d0e518b45ca855832e8bfb391afa85972/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis 12 namespace System.Diagnostics.CodeAnalysis 13 { 14 /// <summary> 15 /// Indicates that the specified method requires dynamic access to code that is not referenced 16 /// statically, for example through <see cref="System.Reflection"/>. 17 /// </summary> 18 /// <remarks> 19 /// This allows tools to understand which methods are unsafe to call when removing unreferenced 20 /// code from an application. 21 /// </remarks> 22 [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class, Inherited = false)] 23 internal sealed class RequiresUnreferencedCodeAttribute : Attribute 24 { 25 /// <summary> 26 /// Initializes a new instance of the <see cref="RequiresUnreferencedCodeAttribute"/> class 27 /// with the specified message. 28 /// </summary> 29 /// <param name="message"> 30 /// A message that contains information about the usage of unreferenced code. 31 /// </param> RequiresUnreferencedCodeAttribute(string message)32 public RequiresUnreferencedCodeAttribute(string message) 33 { 34 Message = message; 35 } 36 37 /// <summary> 38 /// Gets a message that contains information about the usage of unreferenced code. 39 /// </summary> 40 public string Message { get; } 41 42 /// <summary> 43 /// Gets or sets an optional URL that contains more information about the method, 44 /// why it requires unreferenced code, and what options a consumer has to deal with it. 45 /// </summary> 46 public string Url { get; set; } 47 } 48 } 49 #endif 50