3

[EDIT: It is a memory issue. The memory on my computer goes from 42% used to 91% in a few seconds just before this error. The error message about the compiler supporting up to 2012 is just a red-herring. That message is always output from the compiler. ]

I just converted a visual basic application from VS2005 to VS2017.

I get this error when I try to start it:

Server Error in '/' Application.

Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: The compiler failed with error code -2147024888.

Show Detailed Compiler Output:

C:\Program Files (x86)\IIS Express> Microsoft (R) Visual Basic Compiler version 14.7.2556 for Visual Basic 2012 Copyright (c) Microsoft Corporation. All rights reserved.

This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to Visual Basic 2012, which is no longer the latest version. For compilers that support newer versions of the Visual Basic programming language, see http://go.microsoft.com/fwlink/?LinkID=533241

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.2556.0

Here is what I tried:

  1. Followed the fwlink and it actually redirects to github that appears to be some open source version of the compiler that will support my old code. I have no interest in doing that.
  2. Reading the answers to this question: Compilation Error when change .Net framework from 4.5.2 to 4.5 in VS 2015 Community edition

I tried to follow the instructions, but those instructions seem to be for a MVC project and my project is a Web project [Note: I am new to Visual Studio so I probably have that wrong] but what I am sure of is:

a. I don't have a project file.

b. I see a globe icon on my project.

c. When I right click on the project (globe icon thing in solution explorer) I do NOT get a Properties menu item.

So, how do I get past this error where my preference is to update my code to current techniques rather than patch together libraries to get it to run.

[EDIT] This problem just occurred on a different project/solution that actually does have a project file. This was converted from VS2005 to VS2017 a couple of months ago and has been working fine. I suspect some configuration change in VS2017 that is affecting all solutions.

[EDIT] The comment about out of memory seems promising except it fails in exactly same spot every time. A reboot did not help. This is an i7 with 16GB and 500GB SSD with 400GB free. If it is running out of memory it might be some config in VS that artificially limits memory of that particular process. I am going to deeper into this lead.

[EDIT] I have IIS Express 10.0.1740 installed.

[EDIT] I tried installing the Roslyn compiler using nuget. The error message did not change, but it could be I need to do some additional config to get it to be the compiler used for this solution/project. The problem is happening while the application is running so presumably iisexpress is doing the compiling.

[EDIT] This is also happening on a different project that does have a .vbproj file. I suspect some update that is causing the issue.

[EDIT] I am now testing in a project that has a .vbproj file. To change target framework I do Project -> XXX Properties -> Application -> Target Framework 4.6.1. The problem still happens. Note the warning in the message that it may require additional hand edits. I did not know what to edit, so I did not make other changes.

enter image description here

[EDIT] Note that the compiler version is 14.7.2556 And it is complaining about being for VB2012. This seems to conflict with https://en.wikipedia.org/wiki/Visual_Basic_.NET that says that vb compiler 14.0 came out in 2015.

[EDIT] I did not have a section in web.config, so there is nothing to remove.

[EDIT] I do not have a compilerOptions= tag in web.config, so there is nothing to change.

Be Kind To New Users
  • 9,672
  • 13
  • 78
  • 125
  • If you don't have a project file then you don't have a project. What you have is presumably a web site rather than a web application. I can't solve your problem but knowing that fact may make it easier to find relevant information. Looking at the VS 2017 'New Project' dialogue, there's a 'Visual Basic > Web > Web Site' node. Maybe you should create a new web site that way and either compare the two to see where the difference is or maybe import existing code files into the new site. – jmcilhinney Jan 22 '18 at 00:36
  • Based on the error information, it seems like maybe your version of IIS Express is old and doesn't support the latest version of VB. Check your IIS Version and see if it can be updated. If you have a web site rather than a web application then compilation will happen at run time and an old version of IIS may not be able to do that if the site is marked as being a VB version that was released afterwards. – jmcilhinney Jan 22 '18 at 00:39
  • @jmcilhinney I did the create new project and then cut and paste code into the new project thing. It was tedious, but it worked well and I felt I had a pretty clean base of code and understood all the changes to config to get it to work. I will try that again on this project. – Be Kind To New Users Jan 22 '18 at 21:16
  • @jmcilhinney I read the error message the other way... that my version was too new and no longer supported the old crap I was moving in. – Be Kind To New Users Jan 22 '18 at 21:18
  • You said that you converted the project from 2005 to 2017 but the compiler says that it is for 2012 and only supports UP to 2012. Each version generally supports older but not newer versions so a 2012 compiler supporting up to 2012 mans supporting 2012 and earlier but not later. The error message even says "for compilers that support NEWER versions", which means that the version of your web site is too new for the compiler that IIS is using. That's how it looks to me, anyway. I'm just not sure why you didn't get the latest version of IIS Express with VS 2017 but you appear not to have. – jmcilhinney Jan 23 '18 at 01:03
  • 1
    -2147024888 = 0x80070008 = ERROR_NOT_ENOUGH_MEMORY, "Not enough storage is available to process this command". Time for a reboot. If that doesn't help then surely a disk reformat will fix it. – Hans Passant Jan 25 '18 at 23:37
  • @HansPassant - how did you get the OS Header Hexadecimal from -2147024888? Thank you in advance. – Jeremy Thompson Feb 02 '18 at 00:14
  • I wish this question answered the actual question title rather than you tangential memory error – Shodan Jul 27 '23 at 00:28

2 Answers2

1

With a an i7 with 16GB and 500GB SSD with 400GB free I doubt this is a memory issue, I'm guessing the ERROR_NOT_ENOUGH_MEMORY is a symptom of the root cause:

This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to Visual Basic 2012,

In other words the compiler only works with projects upto 2012, so lets just change what commpiler we use by targeting an up-to-date version of the .Net Framework (right click on Project > Property Pages):

enter image description here

You also can safely remove the CodeDom that's used for Dynamic Compilation in the web.config:

<system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>
    </compilers>
</system.codedom>

Or you could change the compilerOptions="/langversion:6 compiler version.

If this doesn't work, make a cut down https://stackoverflow.com/help/mcve in VS2005 that we can reproduce the problem with and upload the solution somewhere we can download it.

Jeremy Thompson
  • 61,933
  • 36
  • 195
  • 321
1

@jmcilhinney you were on the right track. I worked with @Michael Potter and found that, on the local machine, IIS is having trouble doing the just-in-time compile a "Website" requires. I've no deeper knowledge than that (and not sure I want any) but the issue was fixed (in this case) by switching to HTML pages (it is mostly a SPA site).

Had we more code-behind than we do, I would simply switch to a "Web Application".

Rodney
  • 179
  • 7