Skip to content
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

Added an Option for errors and messages, which use MessageBox to write to Output Window #284

Merged
merged 3 commits into from
Dec 9, 2013

Conversation

maxwowpow
Copy link
Contributor

WE has various cases of showing MessageBox for Information purposes (not YesNo boxes).

Sometimes, when user re-saves bundles too quick, the File System has file in lock and bad things will happen, causing MessageBox to show up. That's not necessarily a bug, as writing some save-queue would require not appropriate to the problem time.

Still being on version 1.4.1 I have been experiencing the file not found errors for the js and css in bundles. I assume, that under normal conditions, when paths are specified fully and the Sharepoint Mapped Folders are not the case, everything will work as expected.
The bundle errors "path not found" appear sporadically, I was not able to debug the exact reason, as it is being used on a production project, however they are ALL FALSE POSITIVE.
Having N bundles with relative Sharepoint mapped paths causes each bundle to fail (first or last file not found error) causing in turn N MessageBoxes which in turn frustrate a programmer (he have to click his way through all of them), assuming the bundles are being recompiled every time onBuild and onSave.

So as an acceptable alternative we just implement an option to route MessageBox.Show to Output Window, so no user interaction would be necessary.

The option is defaulted to FALSE and has no affect on existing configuration until toggled.
When user toggles the options, he understands, that errors will go to the output and he have to check it periodically, so no harm in not showing a MB.

Regards,
Max

…rect output to Output Window with Logger.Log
@am11
Copy link
Contributor

am11 commented Dec 5, 2013

@gr9zev, great idea. Even if the value is true, I think we need to club all the messages together and show in one large aggregated message box!

@SLaks
Copy link
Collaborator

SLaks commented Dec 5, 2013

Don't duplicate this code everywhere.

Instead, make a reusable Logger.ShowMessage() function that takes two parameters, and call that instead.

@maxwowpow
Copy link
Contributor Author

@SLaks valid point, my bad, will update tomorrow. thanks.
@am11 aggregation would require start and end of 'message-capturing', this could lead to chaos, timers are bad, and I don't know the code that well to say whether there is an entry point and we get fully synchroneous run every time, so it's easy to implement such accumulation of messages.

@am11
Copy link
Contributor

am11 commented Dec 5, 2013

@SLaks, do you think its possible to aggregate the compile error messages in one box, instead of multiple dialog boxes?

@SLaks
Copy link
Collaborator

SLaks commented Dec 5, 2013

That depends on exactly which messages you want to aggregate.

We can create an aggregator IDisposable that manages a static stack in Logger.
That would be used like this:

using (Logger.AggregateMessages()) {
    Logger.ShowMessage(...);
    await SomeOperationThatLogsMessages();
}

madskristensen added a commit that referenced this pull request Dec 9, 2013
Added an Option for errors and messages, which use MessageBox to write to Output Window
@madskristensen madskristensen merged commit d7cfd9b into madskristensen:master Dec 9, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants