How to determine cause of VS2013 error in editor extension - visual-studio-2013

When I attach the debugger to a web page, as soon as a the first breakpoint is hit I get an error dialog saying "An exception has been encountered. This may be caused by an extension.".
In ActivityLog.xml I find this:
type: Error
source: Editor or Editor Extension
description:
System.ArgumentNullException: Value cannot be null.
Parameter name: sp
at Microsoft.VisualStudio.Shell.ServiceProvider..ctor(IServiceProvider sp, Boolean defaultServices)
at Microsoft.VisualStudio.Web.HTML.Implementation.ContainedLanguage.ContainedLanguageHostAdapter.Microsoft.Web.Editor.ContainedLanguage.IContainedLanguageHost.get_BufferGraph()
at Microsoft.CSS.Editor.SyntaxCheck.CssErrorTag..ctor(ITextBuffer textBuffer, ICssError error)
at Microsoft.CSS.Editor.SyntaxCheck.CssErrorTagger.CollectTags(SnapshotSpan span, CssErrorList errors, SortedRangeList`1 tagSpans)
at Microsoft.CSS.Editor.SyntaxCheck.CssErrorTagger.GetTags(NormalizedSnapshotSpanCollection spans)
at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator`1.<GetTagsForBuffer>d__5.MoveNext()
None of which points to anything I am familiar with.

This solved it for me:
Apparently inline images don't paste...
in tools>options>editor>all languages>scroll bars
turned off "show annotations".

Related

How to go to error-line of missing event handler in XAML?

Question edited after being corrected by comments. The problem is only with one type of error. So it's not such a big deal. But since the question is up already...
When I click on an error in the error list - the cursor goes to the erroneous line in code or XAML. Not so if the error is of the type 'MainPage' does not contain a definition for 'button_Click' ... in XAML, though the error list does have the error line number.
Is there a way to get that in too? If not automatically - is there some button that can be clicked to go to the error?

Show an exception message from a resharper plugin

In the course of the development of a Resharper plugin, I'd like to show an error message to a user when they incorrectly use a context action. Is there a way to pop up a window in Visual Studio to communicate the Resharper exception message to the user? I'm developing a plugin with Resharper 8 and VS 2012
You can always use MessageBox - ReSharper also provides a MessageBox static class that provides a number of helper methods to make it easy to display what you want. It also allows for adding "message box handlers" so that you don't actually display a message box during testing.
Alternatively, if you're creating a context action, and you're (indirectly) deriving from BulbActionBase, your ExecutePsiTransaction method (which should do all the work) can return an Action<ITextControl>. This allows you to return an action that will execute after the quick fix/context action has completed, which can be anything from positioning the caret, changing the selection, executing a template or showing a tooltip as an error.
You can return something like this:
return tc => myLocks.QueueReadLock("MyContextAction", () => {
myTooltipManager.Show("Something went wrong!",
lifetime => new TextControlPopupWindowContext(lifetime, tc, myLocks, myActionManager);
});
This is using a number of fields: IShellLocks myLocks, ITooltipManager myTooltipManager and IActionManager myActionManager. These can be injected into a component's constructor by ReSharper's component model, or you can get them with solution.GetComponent<IShellLocks>, etc.
What's happening is that you're returning an action that takes in an ITextControl, and which immediately queues up another action to run, on the UI thread, with the read lock taken. This second action tells the tooltip manager to show an error message as a tooltip, and provides a factory method for creating a popup window context (the lifetime parameter is created and disposed by the call to Show, and allows for cleanup of the context).
You could also look at the ShowAtCaret extension method to ITooltipManager - I can't remember offhand where Show will place the tooltip.

jQuery error - Uncaught Error: can't load XRegExp twice in the same frame

I have a button, onclick of which I'm doing an AJAX call to one of my pages (which contains jqplot elements).
Now, the AJAX req/res works fine for the first click of the button.
When I click my button for the second time, I get an exception saying,
Uncaught Error: can't load XRegExp twice in the same frame
And it points to the jQuery-min file. Any idea on how I can solve this issue?
I have tried this solution and it does not work.
I think the handler is getting "attached" before the DOM element in question actually exists.
Try using jquery.on().

jqGrid error message from server side exception

I've added the following code for my jqgrid:
changeTextFormat = function (data) {
return "Activity or one from the same price group already used";
};
jQuery.extend(jQuery.jgrid.edit, {errorTextFormat: changeTextFormat })
It works great for insert and I get the error message appearing in the top of the dialog.
However for edits it's not working so well. Instead a massive dialog is appearing with the error message.
I'm currently thinking that it's because I'm using inline editing so it has to pop up a whole new dialog. Is there a way to format this dialog better. I'm pretty sure that for the inline edits it's not even running through changeTextFormat after an exception.
It's correct. By changing of jQuery.jgrid.edit you set errorTextFormat only for the form editing. In case of the usage inline editing you have to use errorfunc parameter of the editRow.
You can easy see the difference between errorTextFormat and errorfunc parameter. If in the errorTextFormat you should return the error message which will be used in the error message, the callback function errorfunc should display the corresponding error message itself. If you want to have the same look of the error dialog you can use $.jgrid.info_dialog method. In the answer you could find the corresponding code fragment. See additionally the code fragment of the jqGrid source code.

FireFox nsFormAutoComplete.js Where are the "settings" stored for getBoolPref()?

When I type text into various text boxes on pages using FireFox (3.6.3), I get the following error:
Error: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIPrefBranch.getBoolPref]" nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)" location: "JS frame :: file:///C:/Program%20Files/Mozilla%20Firefox/components/nsFormAutoComplete.js :: anonymous :: line 97" data: no]
Source File: file:///C:/Program%20Files/Mozilla%20Firefox/components/nsFormAutoComplete.js
Line: 97
Seems to happen for a page I've developed as well as even typing text into the Google search bar.
When I look at nsFormAutoComplete.js, I see this:
init : function() {
// Preferences. Add observer so we get notified of changes.
this._prefBranch = Cc["#mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefService).getBranch("browser.formfill.");
this._prefBranch.QueryInterface(Ci.nsIPrefBranch2);
this._prefBranch.addObserver("", this.observer, false);
this.observer._self = this;
this._debug = this._prefBranch.getBoolPref("debug");
this._enabled = this._prefBranch.getBoolPref("enable");
this._agedWeight = this._prefBranch.getIntPref("agedWeight");
this._bucketSize = this._prefBranch.getIntPref("bucketSize");
this._maxTimeGroupings = this._prefBranch.getIntPref("maxTimeGroupings");
this._timeGroupingSize = this._prefBranch.getIntPref("timeGroupingSize") * 1000 * 1000;
this._expireDays = this._getFormExpiryDays();
this._dbStmts = [];
this._observerService.addObserver(this.observer, "xpcom-shutdown", false);
},
The problem appears to be occurring on this line:
this._debug = this._prefBranch.getBoolPref("debug");
Right now, my best guess is that the preference "debug" doesn't exist from wherever FireFox reads its preferences.
I don't know much about FireFox, and searching the web has not resulted in much information.
Question: Where does FireFox store/retrieve these preferences?
I figure if I place a "debug" preference into this location, I should eliminate the error. However, I'm open to other suggestions/more information.
Thanks!
---Dan---
Okay. I figured it out. Maybe this will help someone else. In the nsFormAutoComplete.js, there is that listing of preferences.
The prefs.js file is the key and it's located in C:\Documents and Settings\\application data\firefox\profiles\\prefs.js.
You don't want to edit this file directly. Instead, type about:config in the address bar of FireFox and add the preferences this way. The preferences will be as follows:
browser.formfill. and type.
so for the debug one, it's browswer.formfill.debug as a bool. I set it to false. After that, it failed on the next preference which was .agedWeight.
After adding all of the preferences found in nsFormAutoComplete.js, I found the errors disappeared.

Resources