DiagnosticObserver does not use null connection#845
DiagnosticObserver does not use null connection#845yang-xiaodong merged 2 commits intodotnetcore:masterfrom
Conversation
|
Do we consider removing the subscription key start with |
|
I agree listening to a more focused subset of events sounds like the better way to go, but I'm not so familiar with this code nor how to test it. It appears that the subscription is setup in |
|
Inserting some debug output shows only the following DiagnosticListeners are registered:
It appears I still think guarding against a null cast has value in environments where different components use different libraries. In a truly heterogenous environment, you might have both kinds of connections. |
|
@flipdoubt Do you know what scenarios the Connection property will be null? It sounds like an impossible thing in the transaction commit process |
@yang-xiaodong, you are correct that the underlying connection is never null, but using Another work around would be to duplicate this code for |
DiagnosticObserver returns rather than using a possible null SqlConnection that may come from another component.