Skip to content

Commit

Permalink
decomission Pollyfill nuget
Browse files Browse the repository at this point in the history
  • Loading branch information
eduard-dumitru committed Aug 6, 2024
1 parent 3506106 commit aec93bf
Show file tree
Hide file tree
Showing 12 changed files with 359 additions and 48 deletions.
2 changes: 1 addition & 1 deletion src/UiPath.CoreIpc/Client/ServiceClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected ServiceClient(Type interfaceType)

public T GetProxy<T>() where T : class
{
if (!_interfaceType.IsAssignableTo(typeof(T)))
if (!typeof(T).IsAssignableFrom(_interfaceType))
{
throw new ArgumentOutOfRangeException($"The provided generic argument T is not assignable to the proxy type. T is {typeof(T).Name}. The proxy type is {_interfaceType.Name}.");
}
Expand Down
36 changes: 36 additions & 0 deletions src/UiPath.CoreIpc/Polyfills/CallerArgumentExpressionAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma warning disable

#if !NET5_0_OR_GREATER

namespace System.Runtime.CompilerServices;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

//
// Summary:
// Allows capturing of the expressions passed to a method.
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
internal sealed class CallerArgumentExpressionAttribute : Attribute
{
//
// Summary:
// Initializes a new instance of the System.Runtime.CompilerServices.CallerArgumentExpressionAttribute
// class.
//
// Parameters:
// parameterName:
// The name of the targeted parameter.
public CallerArgumentExpressionAttribute(string parameterName) => ParameterName = parameterName;

//
// Summary:
// Gets the target parameter name of the CallerArgumentExpression.
//
// Returns:
// The name of the targeted parameter of the CallerArgumentExpression.
public string ParameterName { get; }
}


#endif
56 changes: 56 additions & 0 deletions src/UiPath.CoreIpc/Polyfills/CompilerFeatureRequiredAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// <auto-generated />
#pragma warning disable

#if !NET7_0_OR_GREATER

namespace System.Runtime.CompilerServices;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using Link = System.ComponentModel.DescriptionAttribute;

/// <summary>
/// Indicates that compiler support for a particular feature is required for the location where this attribute is applied.
/// </summary>
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
[AttributeUsage(
validOn: AttributeTargets.All,
AllowMultiple = true,
Inherited = false)]
[Link("https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.compilerfeaturerequiredattribute")]
#if PolyPublic
public
#endif
sealed class CompilerFeatureRequiredAttribute :
Attribute
{
/// <summary>
/// Initialize a new instance of <see cref="CompilerFeatureRequiredAttribute"/>
/// </summary>
/// <param name="featureName">The name of the required compiler feature.</param>
public CompilerFeatureRequiredAttribute(string featureName) =>
FeatureName = featureName;

/// <summary>
/// The name of the compiler feature.
/// </summary>
public string FeatureName { get; }

/// <summary>
/// If true, the compiler can choose to allow access to the location where this attribute is applied if it does not understand <see cref="FeatureName"/>.
/// </summary>
public bool IsOptional { get; init; }

/// <summary>
/// The <see cref="FeatureName"/> used for the ref structs C# feature.
/// </summary>
public const string RefStructs = nameof(RefStructs);

/// <summary>
/// The <see cref="FeatureName"/> used for the required members C# feature.
/// </summary>
public const string RequiredMembers = nameof(RequiredMembers);
}

#endif
19 changes: 19 additions & 0 deletions src/UiPath.CoreIpc/Polyfills/IsExternalInit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma warning disable

#if !NET5_0_OR_GREATER

namespace System.Runtime.CompilerServices;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

/// <summary>
/// Reserved to be used by the compiler for tracking metadata. This class should not be used by developers in source code.
/// </summary>
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
internal static class IsExternalInit
{
}

#endif
71 changes: 71 additions & 0 deletions src/UiPath.CoreIpc/Polyfills/MemberNotNullWhenAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// <auto-generated />
#pragma warning disable

#if NETSTANDARD || NETFRAMEWORK || NETCOREAPPX

namespace System.Diagnostics.CodeAnalysis;

using Targets = AttributeTargets;

/// <summary>
/// Specifies that the method or property will ensure that the listed field and property members have
/// non-<see langword="null"/> values when returning with the specified return value condition.
/// </summary>
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
[AttributeUsage(
validOn: Targets.Method |
Targets.Property,
Inherited = false,
AllowMultiple = true)]
#if PolyPublic
public
#endif
sealed class MemberNotNullWhenAttribute :
Attribute
{
/// <summary>
/// Gets the return value condition.
/// </summary>
public bool ReturnValue { get; }

/// <summary>
/// Gets field or property member names.
/// </summary>
public string[] Members { get; }

/// <summary>
/// Initializes the attribute with the specified return value condition and a field or property member.
/// </summary>
/// <param name="returnValue">
/// The return value condition. If the method returns this value,
/// the associated parameter will not be <see langword="null"/>.
/// </param>
/// <param name="member">
/// The field or property member that is promised to be not-<see langword="null"/>.
/// </param>
public MemberNotNullWhenAttribute(bool returnValue, string member)
{
ReturnValue = returnValue;
Members = [member];
}

/// <summary>
/// Initializes the attribute with the specified return value condition and list
/// of field and property members.
/// </summary>
/// <param name="returnValue">
/// The return value condition. If the method returns this value,
/// the associated parameter will not be <see langword="null"/>.
/// </param>
/// <param name="members">
/// The list of field and property members that are promised to be not-null.
/// </param>
public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
{
ReturnValue = returnValue;
Members = members;
}
}

#endif
41 changes: 41 additions & 0 deletions src/UiPath.CoreIpc/Polyfills/NotNullIfNotNullAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// <auto-generated />
#pragma warning disable

#if NETSTANDARD2_0 || NETFRAMEWORK || NETCOREAPP2X

namespace System.Diagnostics.CodeAnalysis;

using Targets = AttributeTargets;

[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
[AttributeUsage(
validOn: Targets.Parameter |
Targets.Property |
Targets.ReturnValue,
AllowMultiple = true)]
#if PolyPublic
public
#endif
sealed class NotNullIfNotNullAttribute :
Attribute
{
/// <summary>
/// Gets the associated parameter name.
/// The output will be non-<see langword="null"/> if the argument to the
/// parameter specified is non-<see langword="null"/>.
/// </summary>
public string ParameterName { get; }

/// <summary>
/// Initializes the attribute with the associated parameter name.
/// </summary>
/// <param name="parameterName">
/// The associated parameter name.
/// The output will be non-<see langword="null"/> if the argument to the
/// parameter specified is non-<see langword="null"/>.
/// </param>
public NotNullIfNotNullAttribute(string parameterName) =>
ParameterName = parameterName;
}
#endif
38 changes: 38 additions & 0 deletions src/UiPath.CoreIpc/Polyfills/NotNullWhenAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// <auto-generated />
#pragma warning disable

#if NETSTANDARD2_0 || NETFRAMEWORK || NETCOREAPP2X

namespace System.Diagnostics.CodeAnalysis;

/// <summary>
/// Specifies that when a method returns <see cref="ReturnValue"/>,
/// the parameter will not be <see langword="null"/> even if the corresponding type allows it.
/// </summary>
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
[AttributeUsage(AttributeTargets.Parameter)]
#if PolyPublic
public
#endif
sealed class NotNullWhenAttribute :
Attribute
{
/// <summary>
/// Gets the return value condition.
/// If the method returns this value, the associated parameter will not be <see langword="null"/>.
/// </summary>
public bool ReturnValue { get; }

/// <summary>
/// Initializes the attribute with the specified return value condition.
/// </summary>
/// <param name="returnValue">
/// The return value condition.
/// If the method returns this value, the associated parameter will not be <see langword="null"/>.
/// </param>
public NotNullWhenAttribute(bool returnValue) =>
ReturnValue = returnValue;
}

#endif
29 changes: 29 additions & 0 deletions src/UiPath.CoreIpc/Polyfills/RequiredMemberAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// <auto-generated />
#pragma warning disable

#if !NET7_0_OR_GREATER

namespace System.Runtime.CompilerServices;

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

using Targets = AttributeTargets;

/// <summary>
/// Specifies that a type has required members or that a member is required.
/// </summary>
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
[AttributeUsage(
validOn: Targets.Class |
Targets.Struct |
Targets.Field |
Targets.Property,
Inherited = false)]
#if PolyPublic
public
#endif
sealed class RequiredMemberAttribute :
Attribute;
#endif
20 changes: 20 additions & 0 deletions src/UiPath.CoreIpc/Polyfills/SetsRequiredMembersAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// <auto-generated />
#pragma warning disable

#if !NET7_0_OR_GREATER

namespace System.Diagnostics.CodeAnalysis;

/// <summary>
/// Specifies that this constructor sets all required members for the current type, and callers
/// do not need to set any required members themselves.
/// </summary>
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
[AttributeUsage(AttributeTargets.Constructor)]
#if PolyPublic
public
#endif
sealed class SetsRequiredMembersAttribute :
Attribute;
#endif
Loading

0 comments on commit aec93bf

Please sign in to comment.