You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The interceptors feature can only intercept methods, which would mean it wouldn't be possible to intercept a reserved keyword call like lock. However, lock is transformed by the compiler into a pair of Monitor.Enter and Monitor.Exit calls on a try/finally block.
Would it then be possible to intercept these underlying transformed calls using interceptors?
For context, I'd like to add telemetry information every time a lock is acquired or exited, and interceptors would allow me to do that without touching the original code to replace it with a custom wrapper lock class.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The interceptors feature can only intercept methods, which would mean it wouldn't be possible to intercept a reserved keyword call like
lock
. However,lock
is transformed by the compiler into a pair ofMonitor.Enter
andMonitor.Exit
calls on atry/finally
block.Would it then be possible to intercept these underlying transformed calls using interceptors?
For context, I'd like to add telemetry information every time a lock is acquired or exited, and interceptors would allow me to do that without touching the original code to replace it with a custom wrapper lock class.
Related:
Beta Was this translation helpful? Give feedback.
All reactions