Predefined type “System.Void” is not defined or imported – Visual Studio builds fine but screws up everything in text editors

Hitting the phenomen

Recently I went to a different machine. My company allowed for newer faster machines. Perfect to set up everything again and clean up. I needed to open an older project that I had been working on two months before. This is an asp.net core 1.1.2 solution that works on .net framework 4.6.1. I was pretty confused when I saw the message “Predefined type ‘System.Void’ is not defined or imported”:

mystic-error-message

I’d never seen this kind of error message. Mh, anything missing here?

dependencies-missing

Trying to solve the issue

Let’s say, everything is missing. But I recently built it? Things I tried:

  • Cleaned solution and rebuilt it
  • Unloaded the project and reloaded it
  • Closed Visual Studio and reopened it
  • Restarted my machine and reopened the solution
  • Rebooted earth and tried it again

Actually the build went fine. But the user interface stayed like this. Nothing helped. As I went to a different machine, I was then thinking I may be miss some sdk or whatsoever. I tried to install the exactly asp.net core sdk that this project used. No success.

When opening the output window it showed this:

indication-in-output-window

Not too much indication. But anyway a hint. Really confusing is, that this all happens while everything seems to work fine. I can build, start, debug. “Only” text editors are screwed up. Than I remembered a collegue of mine hit some weeks before. He actually took some procedure over that I am used to for a pretty long time. There is some special character in my folder name.

Getting closer

special-characters-in-folder-names

Why did I do this? Certainly because all folders on a single harddisk laptop/ machines are quite well sorted. Why did I use the @ sign? Because it reads nicely. I didn’t do any harm for pretty much 15 years. This now has changed. I copied over my project to a path that starts with “C:\dev”, leaving out the @ in the name.

The solution

Removing the special character “@” in my folder name just solved it. Other characters like space shall also lead to the same issues.

Have a lock onto these entries, lots of side effect and issues come up due this “new behavior”, I just added the one that I raised some time before and another:

Special Character Service Fabric issue

Visual Studio freezes when click add reference

The problem should be fixed with Visual Studio 15.6.0.

To that time I am writing this entry, my IT department doesn’t allow for installing it as it still is a prelease (4). Guess after that, I can happily use this single special character in my folder name again. I may should double check if I find another procedure to sort the folders on that drive. Hitting this kind of issues is time consuming and superfluous.

Update

I just installed Visual Studio 15.6.1 and the issue is solved! Have a look on the github issue here:

Special Character Service Fabric git hub issue