-
Notifications
You must be signed in to change notification settings - Fork 80
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
Removed usage of InternalsVisibleTo in all components #446
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Diagnostics.CodeAnalysis; | ||
using System.Runtime.CompilerServices; | ||
|
||
namespace System; | ||
|
||
/// <summary> | ||
/// Throw helper extensions for <see cref="ArgumentNullException"/>. | ||
/// </summary> | ||
internal static class ArgumentNullExceptionExtensions | ||
{ | ||
/// <summary> | ||
/// Throws an <see cref="ArgumentNullException"/> for a given parameter name. | ||
/// </summary> | ||
/// <param name="_">Dummy value to invoke the extension upon (always pass <see langword="null"/>.</param> | ||
/// <param name="parameterName">The name of the parameter to report in the exception.</param> | ||
/// <exception cref="ArgumentNullException">Thrown with <paramref name="parameterName"/>.</exception> | ||
[DoesNotReturn] | ||
public static void Throw(this ArgumentNullException? _, string? parameterName) | ||
{ | ||
throw new ArgumentNullException(parameterName); | ||
} | ||
|
||
/// <summary> | ||
/// Throws an <see cref="ArgumentNullException"/> if <paramref name="argument"/> is <see langword="null"/>. | ||
/// </summary> | ||
/// <param name="_">Dummy value to invoke the extension upon (always pass <see langword="null"/>.</param> | ||
/// <param name="argument">The reference type argument to validate as non-<see langword="null"/>.</param> | ||
/// <param name="parameterName">The name of the parameter with which <paramref name="argument"/> corresponds.</param> | ||
/// <exception cref="ArgumentNullException">Thrown if <paramref name="argument"/> is <see langword="null"/>.</exception> | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public static void ThrowIfNull(this ArgumentNullException? _, [NotNull] object? argument, [CallerArgumentExpression(nameof(argument))] string? parameterName = null) | ||
{ | ||
if (argument is null) | ||
{ | ||
Throw(parameterName); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Throws an <see cref="ArgumentNullException"/> if <paramref name="argument"/> is <see langword="null"/>. | ||
/// </summary> | ||
/// <param name="_">Dummy value to invoke the extension upon (always pass <see langword="null"/>.</param> | ||
/// <param name="argument">The pointer argument to validate as non-<see langword="null"/>.</param> | ||
/// <param name="parameterName">The name of the parameter with which <paramref name="argument"/> corresponds.</param> | ||
/// <exception cref="ArgumentNullException">Thrown if <paramref name="argument"/> is <see langword="null"/>.</exception> | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public static unsafe void ThrowIfNull(this ArgumentNullException? _, [NotNull] void* argument, [CallerArgumentExpression(nameof(argument))] string? parameterName = null) | ||
{ | ||
if (argument is null) | ||
{ | ||
Throw(parameterName); | ||
} | ||
} | ||
|
||
/// <inheritdoc cref="Throw(ArgumentNullException?, string?)"/> | ||
[DoesNotReturn] | ||
private static void Throw(string? parameterName) | ||
{ | ||
throw new ArgumentNullException(parameterName); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,7 +57,7 @@ public sealed class AnimationSet : DependencyObjectCollection | |
/// <summary> | ||
/// Gets or sets the weak reference to the parent that owns the current animation collection. | ||
/// </summary> | ||
internal WeakReference<UIElement>? ParentReference { get; set; } | ||
public WeakReference<UIElement>? ParentReference { get; set; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These seems like a case where Wish we could easily see references from PRs on GitHub and what's using this... 😋 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
You can do this from the general file browser on github, just select the right branch and file. Works from the "Files Changed" tabs in PRs, too. |
||
|
||
/// <inheritdoc cref="AnimationBuilder.Start(UIElement)"/> | ||
/// <exception cref="InvalidOperationException">Thrown when there is no attached <see cref="UIElement"/> instance.</exception> | ||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -31,7 +31,7 @@ public sealed class AttachedDropShadow : AttachedShadowBase | |||
#endif | ||||
|
||||
/// <inheritdoc/> | ||||
protected internal override bool SupportsOnSizeChangedEvent => true; | ||||
public override bool SupportsOnSizeChangedEvent => true; | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious for all these There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For this
Which doesn't derive |
||||
|
||||
private static readonly TypedResourceKey<CompositionRoundedRectangleGeometry> RoundedRectangleGeometryResourceKey = "RoundedGeometry"; | ||||
private static readonly TypedResourceKey<CompositionSpriteShape> ShapeResourceKey = "Shape"; | ||||
|
@@ -350,7 +350,7 @@ private void CustomMaskedElement_Loaded(object sender, RoutedEventArgs e) | |||
} | ||||
|
||||
/// <inheritdoc/> | ||||
protected internal override void OnSizeChanged(AttachedShadowElementContext context, Size newSize, Size previousSize) | ||||
public override void OnSizeChanged(AttachedShadowElementContext context, Size newSize, Size previousSize) | ||||
{ | ||||
if (context.SpriteVisual != null) | ||||
{ | ||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Diagnostics.CodeAnalysis; | ||
using System.Runtime.CompilerServices; | ||
|
||
namespace System; | ||
|
||
/// <summary> | ||
/// Throw helper extensions for <see cref="ArgumentNullException"/>. | ||
/// </summary> | ||
internal static class ArgumentNullExceptionExtensions | ||
{ | ||
/// <summary> | ||
/// Throws an <see cref="ArgumentNullException"/> for a given parameter name. | ||
/// </summary> | ||
/// <param name="_">Dummy value to invoke the extension upon (always pass <see langword="null"/>.</param> | ||
/// <param name="parameterName">The name of the parameter to report in the exception.</param> | ||
/// <exception cref="ArgumentNullException">Thrown with <paramref name="parameterName"/>.</exception> | ||
[DoesNotReturn] | ||
public static void Throw(this ArgumentNullException? _, string? parameterName) | ||
{ | ||
throw new ArgumentNullException(parameterName); | ||
} | ||
|
||
/// <summary> | ||
/// Throws an <see cref="ArgumentNullException"/> if <paramref name="argument"/> is <see langword="null"/>. | ||
/// </summary> | ||
/// <param name="_">Dummy value to invoke the extension upon (always pass <see langword="null"/>.</param> | ||
/// <param name="argument">The reference type argument to validate as non-<see langword="null"/>.</param> | ||
/// <param name="parameterName">The name of the parameter with which <paramref name="argument"/> corresponds.</param> | ||
/// <exception cref="ArgumentNullException">Thrown if <paramref name="argument"/> is <see langword="null"/>.</exception> | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public static void ThrowIfNull(this ArgumentNullException? _, [NotNull] object? argument, [CallerArgumentExpression(nameof(argument))] string? parameterName = null) | ||
{ | ||
if (argument is null) | ||
{ | ||
Throw(parameterName); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Throws an <see cref="ArgumentNullException"/> if <paramref name="argument"/> is <see langword="null"/>. | ||
/// </summary> | ||
/// <param name="_">Dummy value to invoke the extension upon (always pass <see langword="null"/>.</param> | ||
/// <param name="argument">The pointer argument to validate as non-<see langword="null"/>.</param> | ||
/// <param name="parameterName">The name of the parameter with which <paramref name="argument"/> corresponds.</param> | ||
/// <exception cref="ArgumentNullException">Thrown if <paramref name="argument"/> is <see langword="null"/>.</exception> | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
public static unsafe void ThrowIfNull(this ArgumentNullException? _, [NotNull] void* argument, [CallerArgumentExpression(nameof(argument))] string? parameterName = null) | ||
{ | ||
if (argument is null) | ||
{ | ||
Throw(parameterName); | ||
} | ||
} | ||
|
||
/// <inheritdoc cref="Throw(ArgumentNullException?, string?)"/> | ||
[DoesNotReturn] | ||
private static void Throw(string? parameterName) | ||
{ | ||
throw new ArgumentNullException(parameterName); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: There's a note on L27 about better support in .NET for this method, so we could do a conditional here so it's better for WinUI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think we're able to address this now, though we should do it as an improvement from a new Issue/PR.