Skip to content

Test plan for "interceptors" #67421

@RikkiGibson

Description

@RikkiGibson

Spec: https://github.com/dotnet/roslyn/blob/features/interceptors/docs/features/interceptors.md (in-flight PRs may have more recent revisions)

  • <Features>InterceptorsPreview</Features> flag - FeatureFlag
  • Test intercepting a call with the same method which is already being called. - SelfInterception
  • Test with a large number of intercepted calls (to ensure perf is not quadratic) - EndToEndTests.Interceptors
  • Confirm the signature compatibility rules (are dynamic and object compatible, as they are in OHI?)
    • Yes. A warning is issued instead of an error when types differ in ways that are insignificant to the runtime. SignatureMismatch_06.
    • dynamic vs. object
    • Confirm the expected behavior for tuple name differences (SignatureMismatch_07 currently has no warnings)
    • test with nint vs. IntPtr difference - SignatureMismatch_08
  • params differences - ParamsMismatch_
  • Nullability warnings - SignatureMismatch_04 and SignatureMismatch_05
  • Obsolete - ObsoleteInterceptor
  • Caller attributes - CallerInfo
  • Default parameter values from interceptor do not affect the call-site - DefaultArguments_
  • #line directives ignored - LineDirective_
  • Path mapping -- test various combinations of the following conditions - PathMapping_ and PathNormalization_
    • Confirm /pathmap and #line design with team
    • Pathmap replacement is all forward slashes
    • Pathmap replacement is all backslashes
    • Pathmap replacement is a mix of forward and backslashes
    • SyntaxTree.FilePath is absolute
    • SyntaxTree.FilePath is relative
    • InterceptsLocationAttribute path is all forward slashes
    • InterceptsLocationAttribute path is all backslashes slashes
    • InterceptsLocationAttribute path is a mix of forward and backslashes
    • InterceptsLocationAttribute path is a suffix of some SyntaxTree.FilePath
    • InterceptsLocationAttribute path is a suffix of a mapped path
    • InterceptsLocationAttribute path exactly matches an unmapped path
  • InterceptsLocation line, character out of range - InterceptsLocationBadAttributeArguments_01, InterceptsLocationBadPosition_
  • InterceptsLocation line, character not in method name - InterceptsLocationBadPosition_
  • Test with argument names that differ from interceptor parameter names - ParameterNameDifference
  • Test reordered argument names at callsite - ArgumentLabels, ParameterNamesInDifferentOrder
  • Test InterceptsLocation in metadata (ignored) - InterceptsLocationFromMetadata
  • InterceptsLocation on lambda or local function - InterceptsLocation_BadMethodKind
  • GetEnumerator, Dispose, Deconstruct cannot be intercepted - InterceptGetEnumerator, InterceptDispose, InterceptDeconstruct
  • More calls that cannot be intercepted - GetAwaiter, GetResult, MoveNext, GetPinnableReference, Dispose, Slice, Select (in LINQ query)
  • Semantic model and IOperation
    • Test that the interceptor symbol for an intercepted call is not given by public APIs
  • EnC
    • Test that a call intercepted by a generator can move in source, and we can rerun the generator and successfully emit
    • Test that a hand-authored interception breaks when the call moves in source and we can't emit
    • Test that in a compilation with interceptors, an edit in a file which doesn't contain intercepted calls can be emitted
  • Should some special methods not be intercepted? (for example GetValueOrDefault is recognized specially in CodeGenerator)
  • Duplicates on same and distinct interceptors - DuplicateLocation_
  • Parameter names differ or appear in a different order - ParameterNameDifference, ParameterNamesInDifferentOrder
  • Intercept a generic method call - InterceptableGeneric_
  • Generic interceptor - InterceptorCannotBeGeneric_
  • Inaccessible interceptor
  • file local interceptor
  • Interceptable explicit interface implementation - InterceptableExplicitImplementation
  • Interceptable call is to a retargeting method
  • Scoped and [UnscopedRef] differences - ScopedMismatch_
  • Interceptor is an extern method - InterceptorExtern
  • Interceptor is an abstract method - InterceptorAbstract
  • Interceptor is an interface method - InterceptorInterface
  • Interceptor is a virtual method - InterceptorVirtual_
  • Interceptor is an override method - InterceptorOverride_
  • Intercept struct method with 'ref this' and 'this' extension methods - InterpolatedStringHandler_ and SignatureMismatch_03
  • Interpolated string handler attributes are ignored - InterpolatedStringHandler_
  • Intercept extension call in reduced form with a non-extension static method - InterceptableExtensionMethod_InterceptorStaticMethod
  • Intercept extension call in normal form with extension and non-extension static method - InterceptableExtensionMethod_InterceptorStaticMethod_NormalForm and InterceptableExtensionMethod_InterceptorExtensionMethod_NormalForm
  • Intercept extension call with instance method
  • Call to object.ReferenceEquals has special semantics - ReferenceEquals_
  • Differences in modopts and modreqs between interceptable and interceptor
  • Intercept nameof(X) as an operator (error) or a method call - InterceptableNameOf_
  • Update compiler test plan
  • Uses of invocation syntax which cannot be intercepted (dynamic, delegate, function pointer)? - InterceptableDelegateInvocation. TODO dynamic and function pointers.
  • __arglist, __makeref, __refvalue, __reftype - InterceptableDoubleUnderscoreReservedIdentifiers
  • Spec: should we require interceptors to be static methods?
  • Spec: The spec says "scoped modifiers and [UnscopedRef] must be equivalent.", but the implementation uses more subtle rules
  • Spec: add support for generics? - Add design for interceptors with nonzero arity #68218
  • Constructor initializers: public Widget() : base(), public Widget() : this(), public class Widget(int i) : Base(i) { }
  • Rename to <Features>InterceptorsPreview</Features>
  • Disallow UnmanagedCallersOnly on interceptor - InterceptorUnmanagedCallersOnly
  • Case-sensitive compare for paths - InterceptsLocationBadPath_04
  • InterceptsLocation from project reference - InterceptsLocationFromMetadata
  • PDB test for "debugging into interceptor"
  • Embed type from NoPIA assembly used as default value in:
    • intercepted method
    • intercepting method
  • Interceptor and original method differ by ref/out/in
  • Interceptor and original method differ by ref custom modifiers
  • Permit static non-extension interceptors to be called as though they are extension methods

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions