There has been more than one occasion where I have mistakenly left a debugger keyword in a javascript file, and rather than finding these (or not) in code reviews, I'd quite like the Visual Studio build process to warn me about this so I remember to remove them - especially in a Release Mode build.
Likewise, maybe some warnings about console.log type of code.
How can I generate an MSBuild warning/error for this?
MSBuild compiler warning for javascript debugger statement
Just like as mentioned in the previously deleted answer, this issue should be more related to the Visual Studio extension rather than MSBuild.
You can use the Visual Studio extensions:
JSLint for Visual Studio
JSHint for Visual Studio
I'm currently using the JSLint from the link above and it works great.
Here are some screen shots of the settings / and my code with an
error. It won't prevent you from checking in, there would likely need
to be a check-in policy on the TFS server, but it will notify you of
the error when you build and save.
Here is the initial page where you can specify how to display the
JSLint validation messages. All of the options across the top you can
set to your liking. You can cancel the build and run the lint process
during save and / or build.
These are all of the specific JSLint rules that you can turn on or
off. I have highlighted the debugger rule that you asked about in your
question.
Certificate: Don't let check in with “debugger” in Visual Studio 2012
Hope this helps.
Related
While doing pair-programming on an React project with Visual Studio Professional 2017, my partner was working on my machine and disabled some debugger option to see less warnings. I want to undo what he did, but he is not available any more, so that's why I am asking here. I remember faintly that he said something about disabling "some breaking".
I am sure it must be somewhere in the options window which appears after Debug > Options and on that popup somewhere under the entry Debugging. I attached a screenshot of Debugging > General. I already tried the toggling the 3rd check-box, but that did not do the trick.
The interesting thing is that in the sub-window Output I used to see all those exceptions logged, but I do not see them anymore.
References
How to turn off warnings while debugging in VS Code?
Enable a single warning in Visual Studio
How to re-enable breaking on unhandled exception in Visual Studio 2012 Express for Web?
I am working on creating a customized VSTS/TFS Check-In Policy. I followed the guidance given from this answer on how to create the check-in policy. Basically, I downloaded the source code from Colin's ALM Policy and made a few modifications to see if I can get it to work.
When I build the installer (vsix) and install the extension, this works just fine (tested against VSTS). However, I want to be able to debug the policy so that I can make modifications and bug fixes more quickly.
The answers given to a similar question seem to work for Visual Studio 2015, however this does not work for Visual Studio 2017; if I set the debug start action to launch Visual Studio 2017 devenv.exe, the check-in policy does not show up. The same check-in policy shows up with Visual Studio 2015 though.
I'm looking for any guidance on how I can debug this check-in policy utilizing Visual Studio 2017.
There is test project (ColinsALMCheckinPolicies.UnitTests) that you can debug. So just need to add breakpoints to the source file, then debug the test method (right click a test method > Debug test)
I hate answering my own question, however I feel it is necessary since this answer helped me out; I found the answer from the MSDN documentation :The Experimental Instance.
Basically, under the VSIX Installer project properties, simply setup the Debug start action and command line arguments using the /rootsuffix Exp argument:
If you do this, it launches the Visual Studio Experimental Instance with the VSIX already installed, and it attaches the process to your development environment too, which allows you to debug your extension.
Also, I agree with the other answer to this question, https://stackoverflow.com/a/43672469/347172, suggesting that a unit testing project will be highly beneficial. It definitely will help to ensure that your code is properly unit tested and working too.
This problem is making me mad.
We have a set of projects that rely on T4 templates to generate code for a bunch of DSLs.
Every time I try to transform one of these T4 templates in Visual Studio 2015 I get this window, the security warning:
I have set the "Do not show this message again".
I have set the VS option "Text Templating | Show Security Message" to false.
Every time I restart Visual Studio 2015 and transform the first template the message pops up again.
This does not happen in Visual Studio 2013.
Some hints that may have something to do with this:
The actual text template that is called is published by a VS extension that is installed in the admin extensions directory ($ProgramFiles$\Microsoft Visual Studio 12.0\Common7\IDE\Extensions).
We are using our own custom code generator (that derives from TemplatedCodeGenerator).
Any ideas?
I have found the solution to this one a little by chance.
The problem was that the assembly containing the custom code generator was referencing Microsoft.VisualStudio.TextTemplating.VSHost.12.0 instead of version 14.0 as for Visual Studio 2015.
Oddly enough the transformation did not complain about the problem with the reference but completely ignored the VS option to stop showing the security dialog (may be because it was reading it from the wrong place?).
After correcting the reference, the problem never happened again.
ReSharper TypeScript seems to be not working at all in my VS 2015 installation. Despite of the correctly placed TypeScript definitions ReSharper does not recognize the defined types, gives zillion red underlines, and of course intellisense does not work on the variables.
The error message is for example: Could not find symbol 'JQuery'
Some more diagnostics:
Compiling the project in VS 2015 compiles with no error. Making an intentional error in the source then build generates one correct error message
Intentionally making a spell in the type definition file paths, it underlined with red correctly. When correcting the path, underline diasppears
Opening the very same project in VS 2013 all works like a charm, ReSharper is working correctly
Originally used ReSharper 9.1.2 this issue was there. Now upgraded to the latest 9.1.3 and the issue remained.
Any ideas?
If you see this kind of behaviour - lots of red, but clean compile, especially after an upgrade - you should try to clean the caches. Go to ReSharper → Options → General → Clean caches, then restart Visual Studio.
Since the problem occurs in more than one version including latest as of writing, you also have the option to switch off TypeScript support in ReSharper. After all, if a feature is broken, why use it?
How to switch it off according to their web site:
If necessary, you can disable/enable ReSharper features in TypeScript
files by clearing the corresponding check box on the Environment |
Products & Feature page of ReSharper options.
Source: JetBrains help page for ReSharper (retrieved 29 March 2018)
After this change you may have to restart Visual Studio for the new settings to take effect.
I have found that sometimes, the Visual Studio Project file is corrupted, containing multiple references to .ts files. This can cause a different, but related error, where ReSharper thinks there are multiple declarations of a symbol.
To resolve, if you are using version control, it is simple.
Make a commit
Delete the folder containing the duplicated files
Revert changes to the repository
Add the folder back to Visual Studio
Save the project file
As I mentioned, this doesn't solve the original problem, but can help in situations where ReSharper reports duplicate symbols.
I was looking around the net for a NUnit custom MSBuild task that would run on every build and also nicely play with Visual Studio UI (2008 is my version). I found MSBuild.Community.Tasks project that was great, but failed in Visual Studio integration part.
What I actually wanted to have is get failed tests displayed as warnings/errors in VS's error list window (and also FAILED project build when tests are not successful). So I wrote my own custom MSBuild task that does the job exactly how I wanted it to be.
BUT.
The only problem that I have is that normal VS UI error list behaviour is that when you click on an error it jumps to appropriate source file and highlights the problematic code. I was able to relate file and line number with failed test however I wasn't able in any way to persuade Visual Studio to HIGHLIGHT problematic code for me (when I double click the error). All I get is cursor in the right spot.
I tried all kinds of combinations of line, endLine, column, endColumn method parameters (Log.LogError()), but to no avail. And based on error output by compiler errors it looks like it also provides just line and column (no end values).
Anybody ran against this oddity and solved it?
Update 13 May 2009
You can get this project for free (without method selection) at
http://code.google.com/p/nunitmsbuildvsintegrated/
For this feature, you must create Visual Studio Integrated Package that display custom panel in Visual Studio. This custom panel will be called when your project is built.
Visual Studio Extensibility Developer Center
I have no solution to your exact problem, but have some thoughts.
Are you sure you want to run a full suite of unit tests at the end of each and every build? I personally find it to be a productivity killer. Rather, while working with code I tend to run a small subset tests which cover only the code in question, and this is where tools like ReSharper or TestDriven.NET come into play.
(source: jetbrains.com)