Why ISourceGenerator is not async? #49157
Answered
by
CyrusNajmabadi
dominikjeske
asked this question in
Q&A
-
I'm wonder why methods in ISourceGenerator are not async but still GeneratorExecutionContext have CancellationToken? |
Beta Was this translation helpful? Give feedback.
Answered by
CyrusNajmabadi
Nov 5, 2020
Replies: 1 comment
-
They are called synchronously, but in contexts where they may be canceled. For example, in the IDE this work will get kicked off. It's synchronous because we don't want the overhead of async calls in code that we don't want to virally become async. But it cancelable because if we don't need the results anymore, we want to cancel it to free up resources for other work we'r edoing. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
dominikjeske
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
They are called synchronously, but in contexts where they may be canceled. For example, in the IDE this work will get kicked off. It's synchronous because we don't want the overhead of async calls in code that we don't want to virally become async. But it cancelable because if we don't need the results anymore, we want to cancel it to free up resources for other work we'r edoing.