Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Conversation

@benaadams
Copy link
Member

@benaadams benaadams commented Apr 20, 2017

Allows the opportunity to benefit from Finally Cloning by the Jit.

I didn't quite understand the comment and whether there was some mechanism I wasn't picking up on (e.g. a first chance exception "filter") but not sure what it refers to.

It was from the original open sourcing, so maybe something was different at that time. Exception from the undo for example? (only seems to be a catch -> Environment.FailFast in the undo path)

I checked Reference Source for 4.7 to see if there was more clarity around this comment and it uses finally for undoing the ec in ExecutionContext.RunInternal and not catch+throw.

/cc @jkotas @AndyAyersMS @stephentoub

@benaadams
Copy link
Member Author

benaadams commented Apr 20, 2017

Ah is from the ExecutionContextSwitcher SetExecutionContext in full framework where it use catch+UndoNoThrow+throw if setting the context (restore is used in coreclr) causes an exception.

Don't think its relevant for coreclr as its Undo on both sides (in catch or not in catch)

@AndyAyersMS
Copy link
Member

This change alters the ordering between the undo and the invocation of caller filters. Most filters won't be sensitive to this reordering, but user-defined filters in caller frames might be able to tell the difference.

Reference source has this same sort of catch { undo(); throw; } pattern in SetExecutionContext (with no explanatory comment).

@benaadams
Copy link
Member Author

But that's only handling for the SetExecutionContext where Restore is used in coreclr. So in coreclr where the EC is more svelte it would be exceptions from the user defined call backs of OnValueChanged that would cause this path?

i.e. not saying this change is correct; however the current pattern would only need to be handled for AsyncLocal callback changes?

@benaadams
Copy link
Member Author

benaadams commented Apr 20, 2017

Maybe add an earlier "if both same/default" check to determine path? (as restore does anyway)

@benaadams
Copy link
Member Author

Think have a better way

@benaadams benaadams closed this Apr 20, 2017
@karelz karelz modified the milestone: 2.0.0 Aug 28, 2017
@benaadams benaadams deleted the executioncontext.run branch March 27, 2018 05:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants