Skip to content

Test plan for "Lock object" feature #71888

@jjonescz

Description

@jjonescz

Proposal: dotnet/csharplang#7104
Speclet: https://github.com/dotnet/csharplang/blob/main/proposals/csharp-13.0/lock-object.md
Runtime API proposal: dotnet/runtime#34812

  • -langversion check
  • lock (expr)
    • calls EnterLockScope
    • finally block calls Scope.Dispose
  • Monitor APIs used for converted Lock expression
  • warning for conversions
    • implicit/explicit conversion to base class
    • implicit/explicit conversion to derived class (add warning)
    • implicit/explicit conversion to interface
    • implicit/explicit conversion to dynamic
    • explicit conversion to Lock
    • implicit/explicit user-defined conversion (no warning)
    • implicit conversion from as
    • implicit conversion from best common type
  • use as argument to parameter of generic type (no warning)
  • Obsolete (no diagnostics)
  • async
    • with await in lock body
    • with no await in lock body
    • async local function
    • async lambda
  • iterators
    • with yield in lock body
    • with no yield in lock body
  • async iterator that returns IAsyncEnumerable
  • unexpected and missing members
    • Lock defined as struct
    • Lock defined as ref struct
    • Lock defined as interface
    • Scope defined as class
    • Scope defined as struct
    • EnterLockScope missing
    • Scope missing
    • Scope.Dispose missing
    • Lock inaccessible
    • Scope inaccessible
    • EnterLockScope inaccessible
    • Scope.Dispose inaccessible
    • Lock generic
    • Scope generic
    • EnterLockScope generic
    • Scope.Dispose generic
    • Scope not a member of Lock
    • EnterLockScope with parameters
    • EnterLockScope with optional or params parameters
    • EnterLockScope returns void
    • EnterLockScope returns type other than Scope
    • Scope.Dispose with parameters
    • Scope.Dispose with optional or params parameters
    • Scope.Dispose returns type
    • EnterLockScope is static
    • Scope.Dispose is static
    • EnterLockScope overloads
    • Scope.Dispose overloads
    • EnterLockScope defined on base class
    • Scope defined on base class
    • EnterLockScope as virtual, override, hidden
    • Scope.Dispose as virtual, override, hidden
    • EnterLockScope as explicit implementation
    • Scope.Dispose as explicit implementation
    • EnterLockScope use-site errors
    • Scope use-site errors
    • Scope.Dispose use-site errors
  • nullable analysis: within lock (expr) { } body, expr is treated as not null (not specific to Lock)
  • IOperation
  • ControlFlowGraph
    • with Lock members
    • missing Lock members
    • VB: with Lock members
    • VB: missing Lock members
  • SemanticModel: confirm SemanticModel does not expose specific locking APIs used
  • VB: error for use in SyncLock
  • VB: warning for conversions
    • implicit/explicit conversion to base class
    • implicit/explicit conversion to interface
    • explicit conversion to Lock
  • add to Compiler Test plan.md
  • EnC: verify Dispose() is invoked after editing lock body
  • Add VB test with Enter/Exit and Try/Finally when net9 is available. See Handle Lock type in VB #71927 (comment).
  • Check what the final API shape is (EnterLockScope name in particular) and rename if necessary.

Productivity

  • minbar (done)
  • fixer

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions