-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add a flag AutoMeasurement.Initialized #35
Comments
Before calling any method of AutoMeasurement, you _always_ have to declare an instance first. i.e. @damieng This issue can be closed. |
I have done a log4net Appender which sends errors to GA by |
Wouldn't code like Edit: Upon checking the above proposed code, I realized that it throws an exception. |
The problem with this is it means now every single call to AutoMeasurement has to be wrapped in the null check. The intent was you could just call it and it would do it when it is finished initializing like a queue. (although obviously there are some race conditions right now) |
The other way around is to encapsulate the null check of the Instance in a try/catch and use a self flag as @xmedeko might do. |
@damieng Yep, this log4net appender has wrap every call to the initialized check. But it is a special pieace fo code. The rest of the application does not check for initialized before Another solution instead of public static BaseAutoMeasurement InstanceOrNull { get { return _instance; } } Which is a hint to developer that |
I am using
AutoMeasurement
class from a non-gui library and it need to know, if theAutoMeasurement
is initialized or not. (AutoMeasurement.Instance
throws an exception.) Some flag likeThe text was updated successfully, but these errors were encountered: