Skip to content

Use await using with CreateAsyncScope in async generated methods - #166

Merged
jeremydmiller merged 1 commit into
mainfrom
claude/naughty-hodgkin
Mar 16, 2026
Merged

jeremydmiller merged 1 commit into
mainfrom
claude/naughty-hodgkin

Conversation

@jeremydmiller

Copy link
Copy Markdown
Member

Summary

  • When ScopedContainerCreation generates code inside an async method, it now emits await using with CreateAsyncScope() instead of using with CreateScope()
  • This ensures proper async disposal via DisposeAsync() rather than synchronous Dispose() when IAsyncDisposable is available
  • Non-async methods continue to use the synchronous using + CreateScope() pattern

Test plan

  • CodegenTests pass (including BruteForceTests.can_actually_create for all service types)

🤖 Generated with Claude Code

When the generated method is async, ScopedContainerCreation now emits
`await using` with `CreateAsyncScope()` to ensure proper async disposal
via `DisposeAsync()` instead of synchronous `Dispose()`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jeremydmiller
jeremydmiller merged commit 69f0a79 into main Mar 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant