Skip to content

Commit 469af6f

Browse files
authored
Several fixes throughout the code base (#74)
1 parent 263c3b1 commit 469af6f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+495
-9
lines changed

source/nanoFramework.CoreLibrary/System/AppDomain.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ public sealed class AppDomain : MarshalByRefObject
3131

3232
private AppDomain()
3333
{
34+
#pragma warning disable S112 // General exceptions should never be thrown
3435
throw new Exception();
36+
#pragma warning restore S112 // General exceptions should never be thrown
3537
}
3638

3739
/// <summary>
@@ -40,7 +42,9 @@ private AppDomain()
4042
/// <param name="friendlyName">The friendly name of the domain.</param>
4143
/// <returns>The newly created application domain.</returns>
4244
[MethodImpl(MethodImplOptions.InternalCall)]
45+
#pragma warning disable S4200 // Native methods should be wrapped
4346
public static extern AppDomain CreateDomain(String friendlyName);
47+
#pragma warning restore S4200 // Native methods should be wrapped
4448

4549
/// <summary>
4650
/// Creates a new instance of the specified type. Parameters specify the assembly where the type is defined, and the name of the type.
@@ -106,7 +110,9 @@ public Assembly Load(String assemblyString)
106110
/// </summary>
107111
/// <returns>An array of assemblies in this application domain.</returns>
108112
[MethodImpl(MethodImplOptions.InternalCall)]
113+
#pragma warning disable S4200 // Native methods should be wrapped
109114
public extern Assembly[] GetAssemblies();
115+
#pragma warning restore S4200 // Native methods should be wrapped
110116

111117
[MethodImpl(MethodImplOptions.InternalCall)]
112118
private extern Assembly LoadInternal(String assemblyString, bool fVersion, int maj, int min, int build, int rev);
@@ -116,7 +122,9 @@ public Assembly Load(String assemblyString)
116122
/// </summary>
117123
/// <param name="domain">An application domain to unload.</param>
118124
[MethodImpl(MethodImplOptions.InternalCall)]
125+
#pragma warning disable S4200 // Native methods should be wrapped
119126
public static extern void Unload(AppDomain domain);
127+
#pragma warning restore S4200 // Native methods should be wrapped
120128
}
121129
}
122130
#endif // #if (NANOCLR_APPDOMAINS)

source/nanoFramework.CoreLibrary/System/Array.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,19 @@ public abstract class Array : ICloneable, IList
2626
/// <para>Reference-type elements are initialized to nullNothingnullptrunit a null reference(Nothing in Visual Basic). Value-type elements are initialized to zero.</para>
2727
/// <para>This method is an O(n) operation, where n is length.</para></remarks>
2828
[MethodImpl(MethodImplOptions.InternalCall)]
29+
#pragma warning disable S4200 // Native methods should be wrapped
2930
public static extern Array CreateInstance(Type elementType, int length);
31+
#pragma warning restore S4200 // Native methods should be wrapped
3032

33+
#pragma warning disable S4200 // Native methods should be wrapped
3134
/// <summary>
3235
/// Copies a range of elements from an Array starting at the first element and pastes them into another Array starting at the first element. The length is specified as a 32-bit integer.
3336
/// </summary>
3437
/// <param name="sourceArray">The Array that contains the data to copy.</param>
3538
/// <param name="destinationArray">The Array that receives the data.</param>
3639
/// <param name="length">A 32-bit integer that represents the number of elements to copy.</param>
3740
public static void Copy(Array sourceArray, Array destinationArray, int length)
41+
#pragma warning restore S4200 // Native methods should be wrapped
3842
{
3943
Copy(sourceArray, 0, destinationArray, 0, length);
4044
}
@@ -48,7 +52,9 @@ public static void Copy(Array sourceArray, Array destinationArray, int length)
4852
/// <param name="destinationIndex">A 32-bit integer that represents the index in the destinationArray at which storing begins.</param>
4953
/// <param name="length">A 32-bit integer that represents the number of elements to copy.</param>
5054
[MethodImpl(MethodImplOptions.InternalCall)]
55+
#pragma warning disable S4200 // Native methods should be wrapped
5156
public static extern void Copy(Array sourceArray, int sourceIndex, Array destinationArray, int destinationIndex, int length);
57+
#pragma warning restore S4200 // Native methods should be wrapped
5258

5359
/// <summary>
5460
/// Sets a range of elements in the Array to zero, to false, or to null reference (Nothing in Visual Basic), depending on the element type.
@@ -57,7 +63,9 @@ public static void Copy(Array sourceArray, Array destinationArray, int length)
5763
/// <param name="index">The starting index of the range of elements to clear.</param>
5864
/// <param name="length">The number of elements to clear.</param>
5965
[MethodImpl(MethodImplOptions.InternalCall)]
66+
#pragma warning disable S4200 // Native methods should be wrapped
6067
public static extern void Clear(Array array, int index, int length);
68+
#pragma warning restore S4200 // Native methods should be wrapped
6169

6270
/// <summary>
6371
/// Gets the value at the specified position in the one-dimensional Array. The index is specified as a 32-bit integer.

source/nanoFramework.CoreLibrary/System/AttributeUsageAttribute.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,25 @@ public AttributeTargets ValidOn
3636
get { return _attributeTarget; }
3737
}
3838

39+
#pragma warning disable S2292 // Trivial properties should be auto-implemented
3940
/// <summary>
4041
/// Gets or sets a Boolean value indicating whether more than one instance of the indicated attribute can be specified for a single program element.
4142
/// </summary>
4243
/// <value>true if more than one instance is allowed to be specified; otherwise, false. The default is false.</value>
4344
public bool AllowMultiple
45+
#pragma warning restore S2292 // Trivial properties should be auto-implemented
4446
{
4547
get { return _allowMultipleAttributes; }
4648
set { _allowMultipleAttributes = value; }
4749
}
4850

51+
#pragma warning disable S2292 // Trivial properties should be auto-implemented
4952
/// <summary>
5053
/// Gets or sets a Boolean value that determines whether the indicated attribute is inherited by derived classes and overriding members.
5154
/// </summary>
5255
/// <value>true if the attribute can be inherited by derived classes and overriding members; otherwise, false. The default is true.</value>
5356
public bool Inherited
57+
#pragma warning restore S2292 // Trivial properties should be auto-implemented
5458
{
5559
get { return _iInheritedAttribute; }
5660
set { _iInheritedAttribute = value; }

0 commit comments

Comments
 (0)