Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
f77c0b6
Interceptors (#67432)
RikkiGibson Apr 12, 2023
7f743e6
Merge remote-tracking branch 'upstream/main' into merges/main-to-feat…
RikkiGibson Apr 12, 2023
1826d84
Merge pull request #67782 from dotnet/merges/main-to-features/interce…
RikkiGibson Apr 13, 2023
09095a8
Interceptors: handle duplicates, additional signature validation, etc…
RikkiGibson Apr 25, 2023
b943411
Merge pull request #67966 from RikkiGibson/ic-update-main-2
RikkiGibson Apr 26, 2023
6dac560
Add open questions to interceptors feature doc (#67970)
RikkiGibson Apr 27, 2023
303412c
Interceptors: address duplicate interceptions feedback, handle nameof…
RikkiGibson Apr 29, 2023
d875dd1
Merge remote-tracking branch 'upstream/main' into interceptors-update…
RikkiGibson May 12, 2023
9e251f6
Resolve merge conflicts in LocalRewriter_Call.cs
RikkiGibson May 12, 2023
f130bb4
Merge pull request #68182 from RikkiGibson/interceptors-update-main
RikkiGibson May 15, 2023
c3465be
Remove InterceptableAttribute (#68213)
RikkiGibson May 17, 2023
3869477
Add interceptors feature flag (#68241)
RikkiGibson May 19, 2023
234000b
Rename interceptors feature flag to InterceptorsPreview (#68430)
RikkiGibson Jun 5, 2023
d9a4149
Expect mapped paths in InterceptsLocationAttribute (#68242)
RikkiGibson Jun 9, 2023
0386fd6
Add assertions for shape of possibly intercepted call (#68447)
RikkiGibson Jun 9, 2023
fbb07ae
Merge pull request #68521 from dotnet/merges/main-to-features/interce…
RikkiGibson Jun 9, 2023
168b475
Add more interceptors tests (#68462)
RikkiGibson Jun 12, 2023
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
Prev Previous commit
Add more interceptors tests (#68462)
  • Loading branch information
RikkiGibson authored Jun 12, 2023
commit 168b47534fcf8bec0e28b21a924a04dabaa207b1
3 changes: 3 additions & 0 deletions src/Compilers/CSharp/Portable/CSharpResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -7592,4 +7592,7 @@ To remove the warning, you can use /reference instead (set the Embed Interop Typ
<data name="ERR_InterceptorCannotInterceptNameof" xml:space="preserve">
<value>A nameof operator cannot be intercepted.</value>
</data>
<data name="ERR_InterceptorCannotUseUnmanagedCallersOnly" xml:space="preserve">
<value>An interceptor cannot be marked with 'UnmanagedCallersOnlyAttribute'.</value>
</data>
</root>
50 changes: 25 additions & 25 deletions src/Compilers/CSharp/Portable/Errors/ErrorCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2192,31 +2192,31 @@ internal enum ErrorCode
ERR_ConstantValueOfTypeExpected = 9135,
ERR_UnsupportedPrimaryConstructorParameterCapturingRefAny = 9136,

// PROTOTYPE(ic): pack errors
ERR_InterceptorsFeatureNotEnabled = 27000,
ERR_InterceptorCannotBeGeneric = 27001,
ERR_InterceptorPathNotInCompilation = 27002,
ERR_InterceptorPathNotInCompilationWithCandidate = 27003,
ERR_InterceptorPositionBadToken = 27004,
ERR_InterceptorLineOutOfRange = 27005,
ERR_InterceptorCharacterOutOfRange = 27006,
ERR_InterceptorSignatureMismatch = 27007,
ERR_InterceptorPathNotInCompilationWithUnmappedCandidate = 27008,
ERR_InterceptorMethodMustBeOrdinary = 27009,
ERR_InterceptorMustReferToStartOfTokenPosition = 27010,
ERR_InterceptorMustHaveMatchingThisParameter = 27011,
ERR_InterceptorMustNotHaveThisParameter = 27012,
ERR_InterceptorFilePathCannotBeNull = 27013,
ERR_InterceptorNameNotInvoked = 27014,
ERR_InterceptorNonUniquePath = 27015,
ERR_DuplicateInterceptor = 27016,
WRN_InterceptorSignatureMismatch = 27017,
ERR_InterceptorNotAccessible = 27018,
ERR_InterceptorScopedMismatch = 27019,
ERR_InterceptorLineCharacterMustBePositive = 27020,
WRN_NullabilityMismatchInReturnTypeOnInterceptor = 27021,
WRN_NullabilityMismatchInParameterTypeOnInterceptor = 27022,
ERR_InterceptorCannotInterceptNameof = 27023,
ERR_InterceptorsFeatureNotEnabled = 9137,
ERR_InterceptorCannotBeGeneric = 9138,
ERR_InterceptorPathNotInCompilation = 9139,
ERR_InterceptorPathNotInCompilationWithCandidate = 9140,
ERR_InterceptorPositionBadToken = 9141,
ERR_InterceptorLineOutOfRange = 9142,
ERR_InterceptorCharacterOutOfRange = 9143,
ERR_InterceptorSignatureMismatch = 9144,
ERR_InterceptorPathNotInCompilationWithUnmappedCandidate = 9145,
ERR_InterceptorMethodMustBeOrdinary = 9146,
ERR_InterceptorMustReferToStartOfTokenPosition = 9147,
ERR_InterceptorMustHaveMatchingThisParameter = 9148,
ERR_InterceptorMustNotHaveThisParameter = 9149,
ERR_InterceptorFilePathCannotBeNull = 9150,
ERR_InterceptorNameNotInvoked = 9151,
ERR_InterceptorNonUniquePath = 9152,
ERR_DuplicateInterceptor = 9153,
WRN_InterceptorSignatureMismatch = 9154,
ERR_InterceptorNotAccessible = 9155,
ERR_InterceptorScopedMismatch = 9156,
ERR_InterceptorLineCharacterMustBePositive = 9157,
WRN_NullabilityMismatchInReturnTypeOnInterceptor = 9158,
WRN_NullabilityMismatchInParameterTypeOnInterceptor = 9159,
ERR_InterceptorCannotInterceptNameof = 9160,
ERR_InterceptorCannotUseUnmanagedCallersOnly = 9161,

#endregion

Expand Down
1 change: 1 addition & 0 deletions src/Compilers/CSharp/Portable/Errors/ErrorFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2340,6 +2340,7 @@ internal static bool IsBuildOnlyDiagnostic(ErrorCode code)
case ErrorCode.ERR_InterceptorLineCharacterMustBePositive:
case ErrorCode.ERR_ConstantValueOfTypeExpected:
case ErrorCode.ERR_UnsupportedPrimaryConstructorParameterCapturingRefAny:
case ErrorCode.ERR_InterceptorCannotUseUnmanagedCallersOnly:
return false;
default:
// NOTE: All error codes must be explicitly handled in this switch statement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ private void InterceptCallAndAdjustArguments(
{
case (not null, null):
case (not null, not null) when !methodThisParameter.Type.Equals(interceptorThisParameterForCompare.Type, TypeCompareKind.ObliviousNullableModifierMatchesAny)
|| methodThisParameter.RefKind != interceptorThisParameterForCompare.RefKind: // PROTOTYPE(ic): and ref custom modifiers are equal?
|| methodThisParameter.RefKind != interceptorThisParameterForCompare.RefKind:
this._diagnostics.Add(ErrorCode.ERR_InterceptorMustHaveMatchingThisParameter, attributeLocation, methodThisParameter, method);
return;
case (null, not null):
Expand All @@ -214,8 +214,6 @@ private void InterceptCallAndAdjustArguments(
{
// Special case when intercepting an extension method call in reduced form with a non-extension.
this._diagnostics.Add(ErrorCode.ERR_InterceptorMustHaveMatchingThisParameter, attributeLocation, method.Parameters[0], method);
// PROTOTYPE(ic): use a symbol display format which includes the 'this' modifier?
//this._diagnostics.Add(ErrorCode.ERR_InterceptorMustHaveMatchingThisParameter, attributeLocation, new FormattedSymbol(method.Parameters[0], SymbolDisplayFormat.CSharpErrorMessageFormat), method);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ internal sealed class MemberSignatureComparer : IEqualityComparer<Symbol>
considerCallingConvention: false,
considerRefKindDifferences: true,
considerArity: false,
typeComparison: TypeCompareKind.AllNullableIgnoreOptions | TypeCompareKind.IgnoreTupleNames);
typeComparison: TypeCompareKind.AllNullableIgnoreOptions);

/// <summary>
/// This instance is used to check whether one member overrides another, according to the C# definition.
Expand Down Expand Up @@ -384,7 +384,7 @@ private MemberSignatureComparer(
bool considerTypeConstraints,
bool considerCallingConvention,
bool considerRefKindDifferences,
bool considerArity = true, // PROTOTYPE(ic): remove default value?
bool considerArity = true,
TypeCompareKind typeComparison = TypeCompareKind.IgnoreDynamic | TypeCompareKind.IgnoreNativeIntegers)
{
Debug.Assert(!considerExplicitlyImplementedInterfaces || considerName, "Doesn't make sense to consider interfaces separately from name.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,14 @@ private void DecodeInterceptsLocationAttribute(DecodeWellKnownAttributeArguments
return;
}

Debug.Assert(_lazyCustomAttributesBag.IsEarlyDecodedWellKnownAttributeDataComputed);
var unmanagedCallersOnly = this.GetUnmanagedCallersOnlyAttributeData(forceComplete: false);
if (unmanagedCallersOnly != null)
{
diagnostics.Add(ErrorCode.ERR_InterceptorCannotUseUnmanagedCallersOnly, attributeLocation);
return;
}

var syntaxTrees = DeclaringCompilation.SyntaxTrees;
var matchingTrees = DeclaringCompilation.GetSyntaxTreesByMappedPath(attributeFilePath);
if (matchingTrees.Count == 0)
Expand Down
5 changes: 5 additions & 0 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.cs.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.de.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.es.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.fr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.it.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.ja.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.ko.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.pl.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.pt-BR.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.ru.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/Compilers/CSharp/Portable/xlf/CSharpResources.tr.xlf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading