Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WindowsIdentity.RunImpersonated errors #84

Open
mriehm opened this issue Jan 24, 2022 · 1 comment
Open

WindowsIdentity.RunImpersonated errors #84

mriehm opened this issue Jan 24, 2022 · 1 comment

Comments

@mriehm
Copy link

mriehm commented Jan 24, 2022

Reading the WindowsIdentity.RunImpersonated examples in the AsyncGuidance, there appear to be two errors:

  1. Each of the delegates are defined as taking a context parameter. However, RunImpersonated does not take any delegate with parameters. It only takes Action or Func<T> (Func<Task> or Func<Task<T>> for RunImpersonatedAsync), so why is this context parameter in the examples?
  2. The first BAD example appears to be incorrect. It states: "This example tries to execute the query asynchronously, and then wait for it outside of the call to RunImpersonated. This will throw because the query might be executing outside of the impersonation context." However, that example code doesn't actually have any functional problem. In fact, it is semantically equivalent to the first GOOD example, which we can confirm by seeing that the supposedly BAD example matches the runtime implementation of the RunImpersonated method that is used in the first GOOD example.
@davidfowl
Copy link
Owner

Thanks, send a PR please

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

No branches or pull requests

2 participants