Skip to content

Commit b464ce2

Browse files
committed
Removed unnecessary attributes, improved codegen
1 parent 4aca259 commit b464ce2

File tree

10 files changed

+0
-34
lines changed

10 files changed

+0
-34
lines changed

Microsoft.Toolkit.HighPerformance/Box{T}.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ public override int GetHashCode()
180180
/// <summary>
181181
/// Throws an <see cref="InvalidCastException"/> when a cast from an invalid <see cref="object"/> is attempted.
182182
/// </summary>
183-
[MethodImpl(MethodImplOptions.NoInlining)]
184183
private static void ThrowInvalidCastExceptionForGetFrom()
185184
{
186185
throw new InvalidCastException($"Can't cast the input object to the type Box<{typeof(T)}>");

Microsoft.Toolkit.HighPerformance/Buffers/ArrayPoolBufferWriter{T}.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,6 @@ public override string ToString()
289289
/// <summary>
290290
/// Throws an <see cref="ArgumentOutOfRangeException"/> when the initial capacity is invalid.
291291
/// </summary>
292-
[MethodImpl(MethodImplOptions.NoInlining)]
293292
private static void ThrowArgumentOutOfRangeExceptionForInitialCapacity()
294293
{
295294
throw new ArgumentOutOfRangeException("initialCapacity", "The initial capacity must be a positive value");
@@ -298,7 +297,6 @@ private static void ThrowArgumentOutOfRangeExceptionForInitialCapacity()
298297
/// <summary>
299298
/// Throws an <see cref="ArgumentOutOfRangeException"/> when the requested count is negative.
300299
/// </summary>
301-
[MethodImpl(MethodImplOptions.NoInlining)]
302300
private static void ThrowArgumentOutOfRangeExceptionForNegativeCount()
303301
{
304302
throw new ArgumentOutOfRangeException("count", "The count can't be a negative value");
@@ -307,7 +305,6 @@ private static void ThrowArgumentOutOfRangeExceptionForNegativeCount()
307305
/// <summary>
308306
/// Throws an <see cref="ArgumentOutOfRangeException"/> when the size hint is negative.
309307
/// </summary>
310-
[MethodImpl(MethodImplOptions.NoInlining)]
311308
private static void ThrowArgumentOutOfRangeExceptionForNegativeSizeHint()
312309
{
313310
throw new ArgumentOutOfRangeException("sizeHint", "The size hint can't be a negative value");
@@ -316,7 +313,6 @@ private static void ThrowArgumentOutOfRangeExceptionForNegativeSizeHint()
316313
/// <summary>
317314
/// Throws an <see cref="ArgumentOutOfRangeException"/> when the requested count is negative.
318315
/// </summary>
319-
[MethodImpl(MethodImplOptions.NoInlining)]
320316
private static void ThrowArgumentExceptionForAdvancedTooFar()
321317
{
322318
throw new ArgumentException("The buffer writer has advanced too far");
@@ -325,7 +321,6 @@ private static void ThrowArgumentExceptionForAdvancedTooFar()
325321
/// <summary>
326322
/// Throws an <see cref="ObjectDisposedException"/> when <see cref="array"/> is <see langword="null"/>.
327323
/// </summary>
328-
[MethodImpl(MethodImplOptions.NoInlining)]
329324
private static void ThrowObjectDisposedException()
330325
{
331326
throw new ObjectDisposedException("The current buffer has already been disposed");

Microsoft.Toolkit.HighPerformance/Buffers/MemoryBufferWriter{T}.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ public override string ToString()
159159
/// <summary>
160160
/// Throws an <see cref="ArgumentOutOfRangeException"/> when the requested count is negative.
161161
/// </summary>
162-
[MethodImpl(MethodImplOptions.NoInlining)]
163162
private static void ThrowArgumentOutOfRangeExceptionForNegativeCount()
164163
{
165164
throw new ArgumentOutOfRangeException("count", "The count can't be a negative value");
@@ -168,7 +167,6 @@ private static void ThrowArgumentOutOfRangeExceptionForNegativeCount()
168167
/// <summary>
169168
/// Throws an <see cref="ArgumentOutOfRangeException"/> when the size hint is negative.
170169
/// </summary>
171-
[MethodImpl(MethodImplOptions.NoInlining)]
172170
private static void ThrowArgumentOutOfRangeExceptionForNegativeSizeHint()
173171
{
174172
throw new ArgumentOutOfRangeException("sizeHint", "The size hint can't be a negative value");
@@ -177,7 +175,6 @@ private static void ThrowArgumentOutOfRangeExceptionForNegativeSizeHint()
177175
/// <summary>
178176
/// Throws an <see cref="ArgumentOutOfRangeException"/> when the requested count is negative.
179177
/// </summary>
180-
[MethodImpl(MethodImplOptions.NoInlining)]
181178
private static void ThrowArgumentExceptionForAdvancedTooFar()
182179
{
183180
throw new ArgumentException("The buffer writer has advanced too far");
@@ -186,7 +183,6 @@ private static void ThrowArgumentExceptionForAdvancedTooFar()
186183
/// <summary>
187184
/// Throws an <see cref="ArgumentException"/> when the requested size exceeds the capacity.
188185
/// </summary>
189-
[MethodImpl(MethodImplOptions.NoInlining)]
190186
private static void ThrowArgumentExceptionForCapacityExceeded()
191187
{
192188
throw new ArgumentException("The buffer writer doesn't have enough capacity left");

Microsoft.Toolkit.HighPerformance/Buffers/MemoryOwner{T}.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ public override string ToString()
251251
/// <summary>
252252
/// Throws an <see cref="ObjectDisposedException"/> when <see cref="array"/> is <see langword="null"/>.
253253
/// </summary>
254-
[MethodImpl(MethodImplOptions.NoInlining)]
255254
private static void ThrowObjectDisposedException()
256255
{
257256
throw new ObjectDisposedException(nameof(MemoryOwner<T>), "The current buffer has already been disposed");
@@ -260,7 +259,6 @@ private static void ThrowObjectDisposedException()
260259
/// <summary>
261260
/// Throws an <see cref="ArgumentOutOfRangeException"/> when the <see cref="start"/> is invalid.
262261
/// </summary>
263-
[MethodImpl(MethodImplOptions.NoInlining)]
264262
private static void ThrowInvalidOffsetException()
265263
{
266264
throw new ArgumentOutOfRangeException(nameof(start), "The input start parameter was not valid");
@@ -269,7 +267,6 @@ private static void ThrowInvalidOffsetException()
269267
/// <summary>
270268
/// Throws an <see cref="ArgumentOutOfRangeException"/> when the <see cref="length"/> is invalid.
271269
/// </summary>
272-
[MethodImpl(MethodImplOptions.NoInlining)]
273270
private static void ThrowInvalidLengthException()
274271
{
275272
throw new ArgumentOutOfRangeException(nameof(length), "The input length parameter was not valid");

Microsoft.Toolkit.HighPerformance/Enumerables/Array2DColumnEnumerable{T}.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ public ref T Current
205205
/// <summary>
206206
/// Throws an <see cref="ArgumentOutOfRangeException"/> when the <see cref="column"/> is invalid.
207207
/// </summary>
208-
[MethodImpl(MethodImplOptions.NoInlining)]
209208
private static void ThrowArgumentOutOfRangeExceptionForInvalidColumn()
210209
{
211210
throw new ArgumentOutOfRangeException(nameof(column), "The target column parameter was not valid");

Microsoft.Toolkit.HighPerformance/Enumerables/Array2DRowEnumerable{T}.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ public ref T Current
160160
/// <summary>
161161
/// Throws an <see cref="ArgumentOutOfRangeException"/> when the <see cref="row"/> is invalid.
162162
/// </summary>
163-
[MethodImpl(MethodImplOptions.NoInlining)]
164163
private static void ThrowArgumentOutOfRangeExceptionForInvalidRow()
165164
{
166165
throw new ArgumentOutOfRangeException(nameof(row), "The target row parameter was not valid");

Microsoft.Toolkit.HighPerformance/Helpers/ParallelHelper.ThrowExceptions.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System;
6-
using System.Runtime.CompilerServices;
76

87
namespace Microsoft.Toolkit.HighPerformance.Helpers
98
{
@@ -15,7 +14,6 @@ public static partial class ParallelHelper
1514
/// <summary>
1615
/// Throws an <see cref="ArgumentOutOfRangeException"/> when an invalid parameter is specified for the minimum actions per thread.
1716
/// </summary>
18-
[MethodImpl(MethodImplOptions.NoInlining)]
1917
private static void ThrowArgumentOutOfRangeExceptionForInvalidMinimumActionsPerThread()
2018
{
2119
// Having the argument name here manually typed is
@@ -30,7 +28,6 @@ private static void ThrowArgumentOutOfRangeExceptionForInvalidMinimumActionsPerT
3028
/// <summary>
3129
/// Throws an <see cref="ArgumentOutOfRangeException"/> when an invalid start parameter is specified for 1D loops.
3230
/// </summary>
33-
[MethodImpl(MethodImplOptions.NoInlining)]
3431
private static void ThrowArgumentOutOfRangeExceptionForStartGreaterThanEnd()
3532
{
3633
throw new ArgumentOutOfRangeException("start", "The start parameter must be less than or equal to end");
@@ -39,7 +36,6 @@ private static void ThrowArgumentOutOfRangeExceptionForStartGreaterThanEnd()
3936
/// <summary>
4037
/// Throws an <see cref="ArgumentException"/> when a range has an index starting from an end.
4138
/// </summary>
42-
[MethodImpl(MethodImplOptions.NoInlining)]
4339
private static void ThrowArgumentExceptionForRangeIndexFromEnd(string name)
4440
{
4541
throw new ArgumentException("The bounds of the range can't start from an end", name);
@@ -48,7 +44,6 @@ private static void ThrowArgumentExceptionForRangeIndexFromEnd(string name)
4844
/// <summary>
4945
/// Throws an <see cref="ArgumentOutOfRangeException"/> when an invalid top parameter is specified for 2D loops.
5046
/// </summary>
51-
[MethodImpl(MethodImplOptions.NoInlining)]
5247
private static void ThrowArgumentOutOfRangeExceptionForTopGreaterThanBottom()
5348
{
5449
throw new ArgumentOutOfRangeException("top", "The top parameter must be less than or equal to bottom");
@@ -57,7 +52,6 @@ private static void ThrowArgumentOutOfRangeExceptionForTopGreaterThanBottom()
5752
/// <summary>
5853
/// Throws an <see cref="ArgumentOutOfRangeException"/> when an invalid left parameter is specified for 2D loops.
5954
/// </summary>
60-
[MethodImpl(MethodImplOptions.NoInlining)]
6155
private static void ThrowArgumentOutOfRangeExceptionForLeftGreaterThanRight()
6256
{
6357
throw new ArgumentOutOfRangeException("left", "The left parameter must be less than or equal to right");

Microsoft.Toolkit.HighPerformance/NullableReadOnlyRef{T}.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ public static explicit operator T(NullableReadOnlyRef<T> reference)
129129
/// <summary>
130130
/// Throws a <see cref="InvalidOperationException"/> when trying to access <see cref="Value"/> for a default instance.
131131
/// </summary>
132-
[MethodImpl(MethodImplOptions.NoInlining)]
133132
private static void ThrowInvalidOperationException()
134133
{
135134
throw new InvalidOperationException("The current instance doesn't have a value that can be accessed");

Microsoft.Toolkit.HighPerformance/NullableRef{T}.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ public static explicit operator T(NullableRef<T> reference)
113113
/// <summary>
114114
/// Throws a <see cref="InvalidOperationException"/> when trying to access <see cref="Value"/> for a default instance.
115115
/// </summary>
116-
[MethodImpl(MethodImplOptions.NoInlining)]
117116
private static void ThrowInvalidOperationException()
118117
{
119118
throw new InvalidOperationException("The current instance doesn't have a value that can be accessed");

Microsoft.Toolkit.HighPerformance/Streams/MemoryStream.ThrowExceptions.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
using System;
66
using System.IO;
7-
using System.Runtime.CompilerServices;
87

98
namespace Microsoft.Toolkit.HighPerformance.Streams
109
{
@@ -16,7 +15,6 @@ internal partial class MemoryStream
1615
/// <summary>
1716
/// Throws an <see cref="ArgumentOutOfRangeException"/> when setting the <see cref="Stream.Position"/> property.
1817
/// </summary>
19-
[MethodImpl(MethodImplOptions.NoInlining)]
2018
private static void ThrowArgumentOutOfRangeExceptionForPosition()
2119
{
2220
throw new ArgumentOutOfRangeException(nameof(Position), "The value for the property was not in the valid range.");
@@ -25,7 +23,6 @@ private static void ThrowArgumentOutOfRangeExceptionForPosition()
2523
/// <summary>
2624
/// Throws an <see cref="ArgumentNullException"/> when an input buffer is <see langword="null"/>.
2725
/// </summary>
28-
[MethodImpl(MethodImplOptions.NoInlining)]
2926
private static void ThrowArgumentNullExceptionForBuffer()
3027
{
3128
throw new ArgumentNullException("buffer", "The buffer is null.");
@@ -34,7 +31,6 @@ private static void ThrowArgumentNullExceptionForBuffer()
3431
/// <summary>
3532
/// Throws an <see cref="ArgumentOutOfRangeException"/> when the input count is negative.
3633
/// </summary>
37-
[MethodImpl(MethodImplOptions.NoInlining)]
3834
private static void ThrowArgumentOutOfRangeExceptionForOffset()
3935
{
4036
throw new ArgumentOutOfRangeException("offset", "Offset can't be negative.");
@@ -43,7 +39,6 @@ private static void ThrowArgumentOutOfRangeExceptionForOffset()
4339
/// <summary>
4440
/// Throws an <see cref="ArgumentOutOfRangeException"/> when the input count is negative.
4541
/// </summary>
46-
[MethodImpl(MethodImplOptions.NoInlining)]
4742
private static void ThrowArgumentOutOfRangeExceptionForCount()
4843
{
4944
throw new ArgumentOutOfRangeException("count", "Count can't be negative.");
@@ -52,7 +47,6 @@ private static void ThrowArgumentOutOfRangeExceptionForCount()
5247
/// <summary>
5348
/// Throws an <see cref="ArgumentException"/> when the sum of offset and count exceeds the length of the target buffer.
5449
/// </summary>
55-
[MethodImpl(MethodImplOptions.NoInlining)]
5650
private static void ThrowArgumentExceptionForLength()
5751
{
5852
throw new ArgumentException("The sum of offset and count can't be larger than the buffer length.", "buffer");
@@ -61,7 +55,6 @@ private static void ThrowArgumentExceptionForLength()
6155
/// <summary>
6256
/// Throws a <see cref="NotSupportedException"/> when trying to write on a readonly stream.
6357
/// </summary>
64-
[MethodImpl(MethodImplOptions.NoInlining)]
6558
private static void ThrowNotSupportedExceptionForCanWrite()
6659
{
6760
throw new NotSupportedException("The current stream doesn't support writing.");
@@ -70,7 +63,6 @@ private static void ThrowNotSupportedExceptionForCanWrite()
7063
/// <summary>
7164
/// Throws an <see cref="ArgumentException"/> when trying to write too many bytes to the target stream.
7265
/// </summary>
73-
[MethodImpl(MethodImplOptions.NoInlining)]
7466
private static void ThrowArgumentExceptionForEndOfStreamOnWrite()
7567
{
7668
throw new ArgumentException("The current stream can't contain the requested input data.");
@@ -79,7 +71,6 @@ private static void ThrowArgumentExceptionForEndOfStreamOnWrite()
7971
/// <summary>
8072
/// Throws a <see cref="NotSupportedException"/> when trying to set the length of the stream.
8173
/// </summary>
82-
[MethodImpl(MethodImplOptions.NoInlining)]
8374
private static void ThrowNotSupportedExceptionForSetLength()
8475
{
8576
throw new NotSupportedException("Setting the length is not supported for this stream.");
@@ -89,7 +80,6 @@ private static void ThrowNotSupportedExceptionForSetLength()
8980
/// Throws an <see cref="ArgumentException"/> when using an invalid seek mode.
9081
/// </summary>
9182
/// <returns>Nothing, as this method throws unconditionally.</returns>
92-
[MethodImpl(MethodImplOptions.NoInlining)]
9383
private static long ThrowArgumentExceptionForSeekOrigin()
9484
{
9585
throw new ArgumentException("The input seek mode is not valid.", "origin");
@@ -98,7 +88,6 @@ private static long ThrowArgumentExceptionForSeekOrigin()
9888
/// <summary>
9989
/// Throws an <see cref="ObjectDisposedException"/> when using a disposed <see cref="Stream"/> instance.
10090
/// </summary>
101-
[MethodImpl(MethodImplOptions.NoInlining)]
10291
private static void ThrowObjectDisposedException()
10392
{
10493
throw new ObjectDisposedException(nameof(memory), "The current stream has already been disposed");

0 commit comments

Comments
 (0)