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

JSHint config bug crashes VS 2013 #386

Closed
JimF42 opened this issue Dec 31, 2013 · 28 comments · Fixed by #390
Closed

JSHint config bug crashes VS 2013 #386

JimF42 opened this issue Dec 31, 2013 · 28 comments · Fixed by #390

Comments

@JimF42
Copy link

JimF42 commented Dec 31, 2013

The short version:

I went into VS Options/Web Essentials/JSHint and added a new file to ignore and now VS 2013 crashes everytime I open the project. Luckly, I can just open VS 2013 and remove the option before opening the project. I changed "Ignore Files" from kendo.*; globalize.* to kendo.*; globalize.*;*bundle.js

The longer version (background):

I am working on a project that has multiple JavaScript files and those files include inline comment based JSHint options to remove certain messages. In my case, I am using /*global varName*/ and /*exported varName*/. This all is working as expected. Next, I decided I wanted to try a using Web Essentials JavaScript Bundle. Again, works as expected except I was getting JSHint errors because JSHint was also running against the bundled file and the JSHint options copied to the bundle were "confusing" the situation. So I looked for an option to tell JSHint not to run against bundled files (didn't find one). So, I decided I would end all of my bundles with "...Bundle.js" (like myAppBundle.js) and so I tried to add it as an ignored file. After that, everything went south.

I am using VS 2013 Ultimate on Win 7 64-bit. I have about 16 extensions (including yours) installed, so let me know if you need a list of those or whatever else you need to know.

@SLaks
Copy link
Collaborator

SLaks commented Dec 31, 2013

We should exclude bundled files by default.

@SLaks
Copy link
Collaborator

SLaks commented Dec 31, 2013

Your specific problem is that that field is parsed as a series of regexes.
Change it to ;.*bundle.js.

We should add better error handling.

@JimF42
Copy link
Author

JimF42 commented Dec 31, 2013

@SLaks Well, it appears that I can't even do that now. Now it is crashing when I try and create the bundle (even though my custom Ignore Files" is not there any longer). It asks for the bundle name and I press OK. It then creates the custom bundle file and then creates the combined JavaScript file, and then crashes before it is done and updates the csproj file. In this case it is fortunate that the csproj file did not get updated yet because I can at least reopen the project easily. Then, I can delete the bundle files.

@SLaks
Copy link
Collaborator

SLaks commented Dec 31, 2013

Do you have a Node.js project in your solution?

@JimF42
Copy link
Author

JimF42 commented Dec 31, 2013

No, I don't have Node.js. Further, I just realized that I no longer have access to JSHint via the right-click context menu. It's there, but it is grayed out. The only options I have available at this point when I right-click on a .js file are

  • Minify JavaScript file(s)
  • Create solution settings
  • Create color pallette

Everything else is disabled. Any ideas on how I get it back? Uninstall and reinstall WE?

@SLaks
Copy link
Collaborator

SLaks commented Dec 31, 2013

What's in your ignore list?
This would happen if everything in selection is ignored.

@JimF42
Copy link
Author

JimF42 commented Dec 31, 2013

At this point, just the defaults of kendo.*; globalize.*.

@SLaks
Copy link
Collaborator

SLaks commented Dec 31, 2013

Try deleting (or renaming) the WE settings file (from your solution directory or C:\Users\you\WebEssentials) & restarting VS.

@JimF42
Copy link
Author

JimF42 commented Dec 31, 2013

OK. I renamed my settings file in my C:\Users\...\WebEssentials folder (I still have it if it would be of any use to someone researching this issue). Now I have JSHint back on my right-click context menu. But, VS is still crashing when I try and create a new JavaScript bundle. I don't really need to create a bundle, I was just experimenting at this point, but I will in the future.

So, this is really a sidebar question and hate to open a ticket just to ask, but on http://vswebessentials.com/features/html it says "Markdown: See the compiled markdown in a preview window inside Visual Studio..." How?! I can't figure this one out.

@JimF42
Copy link
Author

JimF42 commented Dec 31, 2013

Strange... the only differences I see with the two WE2013-settnigs.xml files (the one you asked me to remove and the newly recreated one) are that I set laxbreak and laxcomma to false (defaults to true). The other difference is that my old <ignoreFiles ends in "; " and the default one does not. Not sure why that would effect the right-click menu...

...
    <JsHint_ignoreFiles>kendo.*; globalize.*; </JsHint_ignoreFiles>
...
    <JsHint_laxbreak>false</JsHint_laxbreak>
    <JsHint_laxcomma>false</JsHint_laxcomma>
...

Either way, it still crashes now when trying to create a bundle.

@SLaks
Copy link
Collaborator

SLaks commented Jan 1, 2014

I suspect the problem is the trailing semicolon.

@JimF42
Copy link
Author

JimF42 commented Jan 1, 2014

Perhaps... But that is what the value was. Now that I have reset the settings file it is back to the default value of <JsHint_ignoreFiles>kendo.*; globalize.*</JsHint_ignoreFiles>

VS still crashes if I try and create a JavaScript bundle...

@JimF42 JimF42 closed this as completed Jan 1, 2014
@JimF42 JimF42 reopened this Jan 1, 2014
@JimF42
Copy link
Author

JimF42 commented Jan 1, 2014

sorry hit the wrong button... Didn't mean to close the issue...

@SLaks
Copy link
Collaborator

SLaks commented Jan 1, 2014

I can't reproduce that.

Can you attach another copy of VS and see what the exception is?

@JimF42
Copy link
Author

JimF42 commented Jan 1, 2014

When you say you can't repro the issue, did you do the entire repro? That is, add the additional ignoreFile to skip processing the bundled JavaScript? I say this because I was able to first create the bundle, but once I added the extra ignoreFile that's when I could no longer create a bundle (even after restoring the ignoreFile value back).

Now, as far as "attach another copy of VS and see what the exception is", do you have something I can read up on how to attach VS to VS? I have not done that before and I am unaware. Also, when it does crash, I get the Windows dialog that asks if I want to send an error report to Microsoft--I am not getting the one that asks if I want to debug the application. So whatever is going on, it's crashing hard.

I will probably be offline for the rest of the evening, but if you leave further details, I may have some time tomorrow.

@SLaks
Copy link
Collaborator

SLaks commented Jan 1, 2014

Open a second copy of VS, click Debug, Attach to Process and select devenv.exe, then make it crash.

@SLaks
Copy link
Collaborator

SLaks commented Jan 1, 2014

BTW, to answer your other question, check the Markdown section of WE options.

@JimF42
Copy link
Author

JimF42 commented Jan 1, 2014

I saw the update that was made and I applied it and restarted my Visual Studio. Next I tried to create a bundle, but it still crashes. This time I have a stack trace (per @SLaks instructions).

System.ArgumentException was unhandled
Message: An unhandled exception of type 'System.ArgumentException' occurred in WindowsBase.dll
Additional information: String cannot be of zero length.

Not much to go on... Is there any place else that I can reset some settings so I can at least get back to the point where I can create a bundle? Will doing an uninstall/reinstall do that?

@SLaks
Copy link
Collaborator

SLaks commented Jan 1, 2014

That's the exception message.
What's the stack trace/call stack?
Where is it happening?

@JimF42
Copy link
Author

JimF42 commented Jan 1, 2014

The exception message is in my prior post (System.ArgumentException)--that's it... Sorry--I guess I misspoke, I was not given a stack trace, just an exception message when the Exception dialog comes up. I'm just used to calling it a stack trace because there's always a stack trace in it.

Anyway, I uninstalled and reinstalled WE2013 (with the required restarts in between) and it still crashes trying to create a bundle. This time I looked at Call Stack window in the debugging copy of VS and all it says is [External Code]--That's the full stack.

@am11
Copy link
Contributor

am11 commented Jan 1, 2014

@JimF42, uncheck: Tools > Options > Debugging > General > Enable Just My Code and retry.

@JimF42
Copy link
Author

JimF42 commented Jan 1, 2014

I can now get a bundle created without crashing, so this may be a clue for you. When I first created a bundle, I seem to remember, maybe, that I completely renamed the bundle. The WE dialog that comes up to ask for the name prompts with "Specify the name of the bundle" and defaults to "bundle1". To get the bundle to crash, I simply said myApp.bundle (yes, I specified the extension). If I say myAppBundle the bundle builds. Hope that helps (and hopefully you can repro it).

Now I am back to my original issue of crashing VS2013 when I specify my extra filter (but I can't get it to repro 100% of the time--I will work on it and let you know if I figure out how). But, regardless, I disabled "Just My Code" per am11's suggestion and either between that or just because I thought about looking in the Output window, when it does crash with the following exception, I can find a more useful stacktrace in the Output window. The filter here was when I was trying to use bundle as my naming convention and filter.

System.ArgumentException was unhandled
Message: An unhandled exception of type 'System.ArgumentException' occurred in WindowsBase.dll
Additional information: parsing "*.bundle.js" - Quantifier {x,y} following nothing.

A first chance exception of type 'System.ArgumentException' occurred in System.dll
A first chance exception of type 'System.ArgumentException' occurred in WindowsBase.dll
System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical"><TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier><Description>Unhandled exception</Description><AppDomain>DefaultDomain</AppDomain><Exception><ExceptionType>System.ArgumentException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType><Message>parsing "*.bundle.js" - Quantifier {x,y} following nothing.</Message><StackTrace>   at System.Text.RegularExpressions.RegexParser.ScanRegex()
   at System.Text.RegularExpressions.RegexParser.Parse(String re, RegexOptions op)
   at System.Text.RegularExpressions.Regex..ctor(String pattern, RegexOptions options, TimeSpan matchTimeout, Boolean useCache)
   at System.Text.RegularExpressions.Regex.IsMatch(String input, String pattern, RegexOptions options)
   at MadsKristensen.EditorExtensions.JsHintRunner.&amp;lt;&amp;gt;c__DisplayClass6.&amp;lt;MustIgnore&amp;gt;b__5(String c)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at MadsKristensen.EditorExtensions.JsHintRunner.MustIgnore(String name)
   at MadsKristensen.EditorExtensions.JsHintRunner.ShouldIgnore(String file)
   at MadsKristensen.EditorExtensions.JsHintRunner.RunCompiler()
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp;amp; handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp;amp; handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)</StackTrace><ExceptionString>System.ArgumentException: parsing "*.bundle.js" - Quantifier {x,y} following nothing.
   at System.Text.RegularExpressions.RegexParser.ScanRegex()
   at System.Text.RegularExpressions.RegexParser.Parse(String re, RegexOptions op)
   at System.Text.RegularExpressions.Regex..ctor(String pattern, RegexOptions options, TimeSpan matchTimeout, Boolean useCache)
   at System.Text.RegularExpressions.Regex.IsMatch(String input, String pattern, RegexOptions options)
   at MadsKristensen.EditorExtensions.JsHintRunner.&amp;lt;&amp;gt;c__DisplayClass6.&amp;lt;MustIgnore&amp;gt;b__5(String c)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at MadsKristensen.EditorExtensions.JsHintRunner.MustIgnore(String name)
   at MadsKristensen.EditorExtensions.JsHintRunner.ShouldIgnore(String file)
   at MadsKristensen.EditorExtensions.JsHintRunner.RunCompiler()
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp;amp; handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp;amp; handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)</ExceptionString><DataItems><Data></Data></DataItems></Exception></TraceRecord>

@JimF42
Copy link
Author

JimF42 commented Jan 1, 2014

Actually, it is consistent. What I didn't realize is that the filter I added was being removed from the WE2013-settings.xml file. Perhaps because I have two copies of VS2013 running (one attached to the other). As soon as I re-add the filer (I appended ; *Bundle.js this time) and touch one of the files included in the bundle to force the bundle to rebuild, it crashes. FYI: I am putting a space between the semicolon and my filter name because that is how the two existing filters are being delimited.

The stack trace is the same as the one above except for how I changed the filter name this time. (System.ArgumentException: parsing "*bundle.js" - Quantifier {x,y} following nothing.)

@SLaks
Copy link
Collaborator

SLaks commented Jan 1, 2014

I already fixed that exception in 66f602c

@SLaks
Copy link
Collaborator

SLaks commented Jan 1, 2014

It crashes when you specify x.bundle in the name because it expects the name to end in .js.bundle, but mistakenly doesn't add that if you end in .bundle.

I'll fix that.

@JimF42
Copy link
Author

JimF42 commented Jan 1, 2014

I already fixed that exception in 66f602c

So how do I tell which version I have then? My VS2013 prompted me this morning that a new version of WE2013 was available and I applied it. Later, I also went in to Extensions and Updates and removed it and then re-added it. All I am told in Extensions and Updates is that it is version 1.5.

Is there a place on your website to download hotfixes?

@SLaks
Copy link
Collaborator

SLaks commented Jan 1, 2014

That has not been released yet.

If you want it now, you can clone this repository & build it yourself.

@JimF42
Copy link
Author

JimF42 commented Jan 1, 2014

No, that's OK--I don't need it that badly that I can't wait for a release. I was more just trying to work through the bug I found so that it would be fixed. I just assumed that the version that was released today was because of the bug fix.

Now, in regards to my Markdown question, you replied

BTW, to answer your other question, check the Markdown section of WE options.

but that did tell me how to use it, just how to configure it. I finally tracked down one of your blog posts and found the information I needed in a screenshot. http://blog.slaks.net/2013-12-10/syntax-highlighted-markdown-code-blocks-web-essentials/. I need to have a file that has an extension of .md. My problem is that nowhere on the WE2013 web pages does it say what the required extension is (nor, actually, in the aforementioned blog post--I found it in a screenshot that included an error message in the blog posting :-) Other tools use other extensions and those did not work (.mkd, html_md, etc.)

Thanks for you help on this!

SLaks added a commit to SLaks/WebEssentials2013 that referenced this issue Jan 1, 2014
Handle nested extensions properly.

Fixes madskristensen#386
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 a pull request may close this issue.

3 participants