Skip to content

Add ExcludeFromStubs attribute #220

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

Merged
merged 4 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
<Compile Include="..\nanoFramework.CoreLibrary\System\RuntimeType.cs" Link="System\RuntimeType.cs" />
<Compile Include="..\nanoFramework.CoreLibrary\System\RuntimeTypeHandle.cs" Link="System\RuntimeTypeHandle.cs" />
<Compile Include="..\nanoFramework.CoreLibrary\System\Runtime\CompilerServices\AccessedThroughPropertyAttribute.cs" Link="System\Runtime\CompilerServices\AccessedThroughPropertyAttribute.cs" />
<Compile Include="..\nanoFramework.CoreLibrary\System\Runtime\CompilerServices\ExcludeFromStubsAttribute.cs" Link="System\Runtime\CompilerServices\ExcludeFromStubsAttribute.cs" />
<Compile Include="..\nanoFramework.CoreLibrary\System\Runtime\CompilerServices\ExtensionAttribute.cs" Link="System\Runtime\CompilerServices\ExtensionAttribute.cs" />
<Compile Include="..\nanoFramework.CoreLibrary\System\Runtime\CompilerServices\IndexerNameAttribute.cs" Link="System\CompilerServices\IndexerNameAttribute.cs" />
<Compile Include="..\nanoFramework.CoreLibrary\System\Runtime\CompilerServices\InternalsVisibleToAttribute.cs" Link="System\CompilerServices\InternalsVisibleToAttribute.cs" />
Expand Down
1 change: 1 addition & 0 deletions nanoFramework.CoreLibrary/CoreLibrary.nfproj
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
<Compile Include="System\RuntimeType.cs" />
<Compile Include="System\RuntimeTypeHandle.cs" />
<Compile Include="System\Runtime\CompilerServices\AccessedThroughPropertyAttribute.cs" />
<Compile Include="System\Runtime\CompilerServices\ExcludeFromStubsAttribute.cs" />
<Compile Include="System\Runtime\CompilerServices\ExtensionAttribute.cs" />
<Compile Include="System\Runtime\CompilerServices\IndexerNameAttribute.cs" />
<Compile Include="System\Runtime\CompilerServices\InternalsVisibleToAttribute.cs" />
Expand Down
6 changes: 5 additions & 1 deletion nanoFramework.CoreLibrary/System/AttributeTargets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
// See LICENSE file in the project root for full license information.
//

using System.Runtime.CompilerServices;

namespace System
{
/// <summary>
/// Specifies the application elements on which it is valid to apply an attribute.
/// </summary>
[Flags, Serializable]
[ExcludeFromStubs]
[Flags]
[Serializable]
public enum AttributeTargets
{
/// <summary>
Expand Down
6 changes: 5 additions & 1 deletion nanoFramework.CoreLibrary/System/AttributeUsageAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
// See LICENSE file in the project root for full license information.
//

using System.Runtime.CompilerServices;

namespace System
{
/// <summary>
/// Specifies the usage of another attribute class. This class cannot be inherited.
/// </summary>
[AttributeUsage(AttributeTargets.Class), Serializable]
[AttributeUsage(AttributeTargets.Class)]
[ExcludeFromStubs]
[Serializable]
public sealed class AttributeUsageAttribute : Attribute
{
internal AttributeTargets _attributeTarget;
Expand Down
6 changes: 5 additions & 1 deletion nanoFramework.CoreLibrary/System/CLSCompliantAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
// See LICENSE file in the project root for full license information.
//

using System.Runtime.CompilerServices;

namespace System
{
/// <summary>
/// Indicates whether a program element is compliant with the Common Language Specification (CLS). This class cannot be inherited.
/// </summary>
[AttributeUsage(AttributeTargets.All), Serializable]
[AttributeUsage(AttributeTargets.All)]
[ExcludeFromStubs]
[Serializable]
public sealed class CLSCompliantAttribute : Attribute
{
private bool _compliant;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
// Portions Copyright (c) Microsoft Corporation. All rights reserved.
// See LICENSE file in the project root for full license information.
//

using System.Runtime.CompilerServices;

namespace System.ComponentModel
{
using System;
Expand Down Expand Up @@ -30,6 +33,7 @@ public enum EditorBrowsableState
/// Specifies that a property or method is viewable in an editor. This class cannot be inherited.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate)]
[ExcludeFromStubs]
#pragma warning disable CS0659 // Type overrides Object.Equals(object o) but does not override Object.GetHashCode()
///////////////////////////////////////////////////////////////////////////////////////////////////////
// GetHashCode() implementation is provided by general native function CLR_RT_HeapBlock::GetHashCode //
Expand Down
6 changes: 5 additions & 1 deletion nanoFramework.CoreLibrary/System/DBNull.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
// See LICENSE file in the project root for full license information.
//

using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace System
{
/// <summary>
/// Represents a nonexistent value. This class cannot be inherited.
/// </summary>
[ComponentModel.EditorBrowsableAttribute(ComponentModel.EditorBrowsableState.Never)]
[EditorBrowsable(EditorBrowsableState.Never)]
[ExcludeFromStubs]
public sealed class DBNull
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
// See LICENSE file in the project root for full license information.
//

using System.Runtime.CompilerServices;

namespace System.Diagnostics
{
/// <summary>
/// Indicates to compilers that a method call or attribute should be ignored unless a specified conditional compilation symbol is defined.
/// </summary>
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true), Serializable]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
[ExcludeFromStubs]
[Serializable]
public sealed class ConditionalAttribute : Attribute
{
private readonly String _conditionString;
Expand Down
20 changes: 16 additions & 4 deletions nanoFramework.CoreLibrary/System/Diagnostics/DebuggerAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
// See LICENSE file in the project root for full license information.
//

using System.Runtime.CompilerServices;

namespace System.Diagnostics
{
using System;
Expand All @@ -15,7 +17,9 @@ namespace System.Diagnostics
/// Designer provided types and members that are not part of the code specifically created by the user can complicate the debugging experience. This attribute suppresses the display of these adjunct types and members in the debugger window and automatically steps through, rather than into, designer provided code. When the debugger encounters this attribute when stepping through user code, the user experience is to not see the designer provided code and to step to the next user-supplied code statement.
/// The debugger behaviour when the <see cref="DebuggerNonUserCodeAttribute"/> is present is similar to using a combination of the <see cref="DebuggerHiddenAttribute"/> attribute, which hides the code from the debugger, and the <see cref="DebuggerStepThroughAttribute"/> attribute, which tells the debugger to step through, rather than into, the code it is applied to.
/// </remarks>
[Serializable, AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Constructor, Inherited = false)]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Constructor, Inherited = false)]
[ExcludeFromStubs]
[Serializable]
public sealed class DebuggerStepThroughAttribute : Attribute
{
/// <summary>
Expand All @@ -30,7 +34,9 @@ public DebuggerStepThroughAttribute() { }
/// <remarks>
/// The <see cref="DebuggerStepperBoundaryAttribute"/> attribute is used as an escape from the effect of a <see cref="DebuggerNonUserCodeAttribute"/>. When executing within the boundaries of the <see cref="DebuggerNonUserCodeAttribute"/>, designer-provided code is executed as a step-through until the next user supplied code is encountered. When context switches are made on a thread, the next user-supplied code module stepped into may not relate to the code that was in the process of being debugged. To avoid this debugging experience, use the <see cref="DebuggerStepperBoundaryAttribute"/> to escape from stepping through code to running code. For example, in Visual Studio 2005, encountering a <see cref="DebuggerStepperBoundaryAttribute"/> while stepping through code using the F10 key (or Step Over command) has the same effect as pressing the F5 key or using the Start Debugging command.
/// </remarks>
[Serializable, AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor, Inherited = false)]
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor, Inherited = false)]
[ExcludeFromStubs]
[Serializable]
public sealed class DebuggerStepperBoundaryAttribute : Attribute
{
/// <summary>
Expand All @@ -45,7 +51,9 @@ public DebuggerStepperBoundaryAttribute() { }
/// <remarks>
/// The common language runtime attaches no semantics to this attribute. It is provided for use by source code debuggers. For example, the Visual Studio 2005 debugger does not stop in a method marked with this attribute and does not allow a breakpoint to be set in the method. Other debugger attributes recognized by the Visual Studio 2005 debugger are the <see cref="DebuggerNonUserCodeAttribute"/> and the <see cref="DebuggerStepThroughAttribute"/>.
/// </remarks>
[Serializable, AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Constructor, Inherited = false)]
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Constructor, Inherited = false)]
[ExcludeFromStubs]
[Serializable]
public sealed class DebuggerHiddenAttribute : Attribute
{
/// <summary>
Expand All @@ -61,7 +69,9 @@ public DebuggerHiddenAttribute() { }
/// Designer provided types and members that are not part of the code specifically created by the user can complicate the debugging experience. This attribute suppresses the display of these adjunct types and members in the debugger window and automatically steps through, rather than into, designer provided code. When the debugger encounters this attribute when stepping through user code, the user experience is to not see the designer provided code and to step to the next user-supplied code statement.
/// The debugger behaviour when the <see cref="DebuggerNonUserCodeAttribute"/> is present is similar to using a combination of the <see cref="DebuggerHiddenAttribute"/> attribute, which hides the code from the debugger, and the <see cref="DebuggerStepThroughAttribute"/> attribute, which tells the debugger to step through, rather than into, the code it is applied to.
/// </remarks>
[Serializable, AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Constructor | AttributeTargets.Struct, Inherited = false)]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Constructor | AttributeTargets.Struct, Inherited = false)]
[ExcludeFromStubs]
[Serializable]
public sealed class DebuggerNonUserCodeAttribute : Attribute
{
/// <summary>
Expand Down Expand Up @@ -233,6 +243,7 @@ public DebuggerBrowsableState State
/// </summary>
/// <remarks>Available only in mscorlib build with support for System.Reflection.</remarks>
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = true)]
[ExcludeFromStubs]
public sealed class DebuggerTypeProxyAttribute : Attribute
{
private readonly string _typeName;
Expand Down Expand Up @@ -318,6 +329,7 @@ public string TargetTypeName
/// Determines how a class or field is displayed in the debugger variable windows.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Delegate | AttributeTargets.Enum | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Assembly, AllowMultiple = true)]
[ExcludeFromStubs]
public sealed class DebuggerDisplayAttribute : Attribute
{
private string _name;
Expand Down
7 changes: 6 additions & 1 deletion nanoFramework.CoreLibrary/System/FlagsAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
// Portions Copyright (c) Microsoft Corporation. All rights reserved.
// See LICENSE file in the project root for full license information.
//

using System.Runtime.CompilerServices;

namespace System
{
/// <summary>
/// Indicates that an enumeration can be treated as a bit field; that is, a set of flags.
/// </summary>
[AttributeUsage(AttributeTargets.Enum), Serializable]
[AttributeUsage(AttributeTargets.Enum)]
[ExcludeFromStubs]
[Serializable]
public class FlagsAttribute : Attribute
{
}
Expand Down
3 changes: 3 additions & 0 deletions nanoFramework.CoreLibrary/System/NonSerializedAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
// See LICENSE file in the project root for full license information.
//

using System.Runtime.CompilerServices;

namespace System
{

/// <summary>
/// Indicates that a field of a serializable class should not be serialized. This class cannot be inherited.
/// </summary>
[AttributeUsage(AttributeTargets.Field)]
[ExcludeFromStubs]
public sealed class NonSerializedAttribute : Attribute
{

Expand Down
8 changes: 5 additions & 3 deletions nanoFramework.CoreLibrary/System/ObsoleteAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
// See LICENSE file in the project root for full license information.
//

using System.Runtime.CompilerServices;

namespace System
{
/// <summary>
/// Marks the program elements that are no longer in use. This class cannot be inherited.
/// </summary>
[Serializable, AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum |
AttributeTargets.Interface | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Delegate
, Inherited = false)]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Constructor | AttributeTargets.Delegate | AttributeTargets.Enum | AttributeTargets.Event |AttributeTargets.Field | AttributeTargets.Interface | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Struct, Inherited = false)]
[ExcludeFromStubs]
[Serializable]
public sealed class ObsoleteAttribute : Attribute
{
private readonly String _message;
Expand Down
3 changes: 3 additions & 0 deletions nanoFramework.CoreLibrary/System/ParamArrayAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
// See LICENSE file in the project root for full license information.
//

using System.Runtime.CompilerServices;

namespace System
{
/// <summary>
/// Indicates that a method will allow a variable number of arguments in its invocation. This class cannot be inherited.
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
[ExcludeFromStubs]
public sealed class ParamArrayAttribute : Attribute
{
/// <summary>
Expand Down
10 changes: 10 additions & 0 deletions nanoFramework.CoreLibrary/System/Reflection/AssemblyAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
// See LICENSE file in the project root for full license information.
//

using System.Runtime.CompilerServices;

namespace System.Reflection
{
using System;
Expand All @@ -12,6 +14,7 @@ namespace System.Reflection
/// Specifies which culture the assembly supports.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly)]
[ExcludeFromStubs]
public sealed class AssemblyCultureAttribute : Attribute
{
private readonly String _culture;
Expand Down Expand Up @@ -41,6 +44,7 @@ public String Culture
/// Specifies the version of the assembly being attributed.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly)]
[ExcludeFromStubs]
public sealed class AssemblyVersionAttribute : Attribute
{
private readonly String _version;
Expand Down Expand Up @@ -70,6 +74,7 @@ public String Version
/// Specifies the name of a file containing the key pair used to generate a strong name.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly)]
[ExcludeFromStubs]
public sealed class AssemblyKeyFileAttribute : Attribute
{
private readonly String _keyFile;
Expand Down Expand Up @@ -99,6 +104,7 @@ public String KeyFile
/// Specifies the name of a key container within the CSP containing the key pair used to generate a strong name.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly)]
[ExcludeFromStubs]
public sealed class AssemblyKeyNameAttribute : Attribute
{
private readonly String _keyName;
Expand Down Expand Up @@ -128,6 +134,7 @@ public String KeyName
/// Specifies that the assembly is not fully signed when created.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly)]
[ExcludeFromStubs]
public sealed class AssemblyDelaySignAttribute : Attribute
{
private readonly bool _delaySign;
Expand Down Expand Up @@ -160,6 +167,7 @@ public bool DelaySign
/// </summary>
/// <remarks>Available only in mscorlib build with support for System.Reflection.</remarks>
[AttributeUsage(AttributeTargets.Assembly)]
[ExcludeFromStubs]
public sealed class AssemblyFlagsAttribute : Attribute
{
private readonly AssemblyNameFlags _flags;
Expand Down Expand Up @@ -203,6 +211,7 @@ public AssemblyFlagsAttribute(AssemblyNameFlags assemblyFlags)
/// Instructs a compiler to use a specific version number for the Win32 file version resource. The Win32 file version is not required to be the same as the assembly's version number.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly)]
[ExcludeFromStubs]
public sealed class AssemblyFileVersionAttribute : Attribute
{
private readonly String _version;
Expand Down Expand Up @@ -238,6 +247,7 @@ public String Version
/// This attribute is specific of nanoFramework.
/// </remarks>
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, Inherited = false)]
[ExcludeFromStubs]
public sealed class AssemblyNativeVersionAttribute : Attribute
{
private readonly String _nativeVersion;
Expand Down
Loading
Loading