Skip to content

Test plan for "Unsafe Evolution" #81207

@jjonescz

Description

@jjonescz

Speclet: https://github.com/dotnet/csharplang/blob/main/proposals/unsafe-evolution.md
Proposal issue: dotnet/csharplang#9704
Feature branch: https://github.com/dotnet/roslyn/tree/features/UnsafeEvolution

  • MemorySafetyRules attribute
    • opt-in (via compilation options)
    • MemorySafetyRulesAttribute synthesized if missing (see Extern_*)
    • Disallow MemorySafetyRulesAttribute on source modules (see RulesAttribute_ReferencedInSource)
    • LangVer (need test like RulesAttribute_Synthesized but with LangVer)
      • LangVer and extern (see Extern_Method)
    • loaded from metadata
  • Operations:
    • pointer indirection (see Pointer_Dereference_*)
    • pointer member access (see Pointer_MemberAccess_*)
    • pointer element access (see Pointer_ElementAccess_*)
    • function pointer invocation (see Member_FunctionPointer) and conversion (see Member_Method_ConvertToFunctionPointer)
    • access on fixed-sized buffer (see FixedSizeBuffer_*)
    • stackalloc conversion (see StackAlloc_*)
    • property and method usage:
      • extensions
      • operator, extension operator (see Member_Operator_*)
      • attribute (see Member_Property_Attribute)
      • function types (missing?)
      • object initializers, with expressions
      • nameof (see Member_Method_NameOf)
      • ...
    • indirect usages:
      • variations of Current in foreach (see Member_Current_*),
      • variations of Dispose in using (see Member_Dispose_*),
      • Deconstruct in deconstructino (see Member_Deconstruct),
      • various member in lock (see Member_LockObject),
      • interpolation handlers (see Member_InterpolatedStringHandler)
      • interceptors (see Member_Interceptor, we only check intercepted)
      • patterns
      • ...
    • constructor usage:
      • object creation
      • this/base (see Member_Constructor_This)
      • attribute (see Member_Constructor_Attribute)
  • [RequiresUnsafe]
    • round-trip "caller unsafe" flag using RequiresUnsafeAttribute
    • disallowed on lambda (see Member_Lambda), static constructors and finalizers (see RequiresUnsafeAttribute_ReferencedInSource)
    • warn in legacy mode (see RequiresUnsafeAttribute_ReferencedInSource)
    • partial (missing tests?)
    • on extern (see Extern_Method_Explicit)
    • LangVer
  • OHI (see *_Override, *_Implementation, *_Hiding, Extern_Method_Override)
  • unsafe
    • alias directives (missing warning, see *_UsingAlias_*)
    • using static directives (missing tests?)
  • mark public APIS a [Experimental]
  • update compiler test plan
  • Ping F# and C++/CLI team as FYI
  • Add attributes to BCL
    • MemorySafetyRulesAttribute
    • RequiresUnsafeAttribute
  • how should the compiler deal with well-known members that are unexpectedly marked as caller-unsafe? (some are ok, such as UnsafeHelpers for inline arrays, but what about others?)
  • PROTOTYPE comments
  • spec open issues
  • breaking changes?
  • LangVer tests should include C#Next
  • Should reflection APIs be requires-unsafe? Or should there be a runtime check (must use special flag or API to access unsafe APIs)?[/-]
  • Should Activator.CreateInstance<T>() be requires-unsafe?[/-]
  • Should dynamic be marked as requires-unsafe?

Sub-issues

Metadata

Metadata

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions