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
Currently, it's hard to see if multiple Scope references point to the same scope, or to different instances. It would, therefore, be useful, for debugging purposes to see a unique instance number, just like Container instances already have an unique internal id. For instance something like:
privatereadonlylongid;publicoverrideToString(){if(this.ParentScopeisnull&&this.Containerisnull){return"Scope #"+this.id;}if(this.ParentScopeisnull){return"Scope #"+this.id+" for Container #"+this.Container.Id;}return"Scope #"+this.id+" for Parent #"+this.ParentScope.Id+" for Container #"+this.Container.Id;}
The text was updated successfully, but these errors were encountered:
I like this, but you may want to reserve overriding .ToString() for something that is an actual string representation of the object (although I am having trouble imagining what that would be.) A slightly more formal way of providing this kind of debug time information is to use a DebuggerDisplay attribute.
As a matter of fact, Simple Injector already uses [DebuggerDisplay] extensively. But I do agree with you, that a DebuggerDisplayAttribute would be a better fit here.
Currently, it's hard to see if multiple
Scope
references point to the same scope, or to different instances. It would, therefore, be useful, for debugging purposes to see a unique instance number, just likeContainer
instances already have an unique internal id. For instance something like:The text was updated successfully, but these errors were encountered: