0

I am maintaining some legacy code which I did not write, and which currently generates a lot of warnings. I am trying to fix warnings in the files I touch, but they are not all reported: I get 101 per project, and then the message in the title of this question.

As a test, I created a brand new VB.Net Windows Forms application targeting .NET 4.5.1, and inserted 150 unused local variables into Form_Load.

Only the first 101 of them trigger warnings, and then I get "Maximum number of warnings has been exceeded":

screenshot

According to the answer to this question, there should not be a warning limit any more since Visual Studio 2012 / VB 11.

I'm using Visual Studio 2013 and the CoreCompile line in my build log indicates that it's calling vbc.exe from MSBuild version 12:

C:\Program Files (x86)\MSBuild\12.0\bin\Vbc.exe /noconfig /imports:Microsoft.VisualBasic,System,System.Collections,System.Collections.Generic,System.Data,System.Drawing,System.Diagnostics,System.Windows.Forms,System.Linq,System.Xml.Linq,System.Threading.Tasks /optioncompare:Binary /optionexplicit- /optionstrict+ /nowarn:42016,41999,42017,42018,42019,42032,42036,42020,42021,42022 /optioninfer+ /nostdlib /platform:anycpu32bitpreferred /rootnamespace:WindowsApplication3 /sdkpath:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1" /highentropyva+ /doc:obj\Debug\WindowsApplication3.xml /define:"CONFIG=\"Debug\",DEBUG=-1,TRACE=-1,_MyType=\"WindowsForms\",PLATFORM=\"AnyCPU\"" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.Core.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.Data.DataSetExtensions.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.Data.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.Deployment.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.Drawing.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.Windows.Forms.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.Xml.dll","C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.Xml.Linq.dll" /main:WindowsApplication3.My.MyApplication /debug+ /debug:full /filealign:512 /out:obj\Debug\WindowsApplication3.exe /subsystemversion:6.00 /resource:obj\Debug\WindowsApplication3.Form1.resources /resource:obj\Debug\WindowsApplication3.Resources.resources /target:winexe Form1.vb Form1.Designer.vb "My Project\AssemblyInfo.vb" "My Project\Application.Designer.vb" "My Project\Resources.Designer.vb" "My Project\Settings.Designer.vb" "C:\Users\blorgbeard\AppData\Local\Temp\.NETFramework,Version=v4.5.1.AssemblyAttributes.vb"

Edit: I tried running the above manually (i.e. invoking vbc.exe from the command-line), but still only received 101 warnings.

I also can't find any recent references to this error message on google.

This makes me suspect I have something wrong with my local configuration.

How can I get a list of all my VB compiler warnings?

Community
  • 1
  • 1
Blorgbeard
  • 101,031
  • 48
  • 228
  • 272

2 Answers2

2

Limitless (Command-line) Errors! This is actually a good thing, let me explain. For performance reasons, the Visual Basic IDE maxes out at 101 errors (with error #102 being “Maximum number of errors exceeded.”) This can make it difficult to estimate the amount of work remaining in certain situations, particularly in upgrade scenarios. We have removed this limit from the command-line compiler in this release, though it still there in the IDE. What this means is if you want to know exactly how many errors there are for a project, just invoke the compiler through msbuild.exe or vbc.exe and you’ll get your answer.

From: http://blogs.msdn.com/b/vbteam/archive/2012/02/28/visual-basic-11-beta-available-for-download.aspx

Bottom line: you still have a limit from the IDE. Manually run vbc.exe to get it w/o limit.

Note: The latest msbuild and vbc (version 12 - distributed with Visual Studio) appears to be limited to 101 warnings again. You must use the previous version of the build tools (version 11 - distributed with the .Net framework).

Blorgbeard
  • 101,031
  • 48
  • 228
  • 272
Andrew Clear
  • 7,910
  • 5
  • 27
  • 35
  • 1
    I tried running vbc.exe manually, and unfortunately, received the same output :( – Blorgbeard Nov 20 '14 at 00:48
  • 1
    I figured out that the problem has come back in the latest vbc. Using the version distributed with the .Net framework 4 reports all warnings. Rather than post that info in my own answer, I have just added a note to yours. Hope that's ok! – Blorgbeard Nov 20 '14 at 04:22
0

I am happy to report that in Visual Studio 2015 (both command-line tools and in-IDE), the limit is gone (or at least much larger):

screenshot of visual studio 2015 showing 250 warnings

Blorgbeard
  • 101,031
  • 48
  • 228
  • 272