0

There are lot of close related questions with this bug/problem.

I have searched these:

Upgraded to .NET 4.5, now "value does not fall within the expected range"

Visual Studio 2019 Value does not fall within the expected range when reloading web project

There are other questions outside of SO about problems with the same message, but the situation they appear are not the same as mine, like this one.

So, here is my problem: I got a client who has a really big solution, with projects using overral, v4.6.2 of the SDK. In this solution, there are WCF projects, WebApi, UnitTest, Class Library and Console projects. All under the same solution. It's kinda of a mess.

When I open it originally, some projects fail to load. When I try to reload the project, it shows the error in case.

What I've tried so far:

  1. Clearing the solution
  2. Deleting all bin and obj folders, closing VS and opening again;
  3. Doing the same above, but running as Admin;
  4. Uninstalling all other SDK versions, and installing only the specified version;
  5. Updating VS;
  6. Executing step 1, 2 and 3 after the update;
  7. Uninstalling VS, build tools, removing the folder, reinstalling everything as admin, with the sdk's included. And I installed mostly ALL the options, just to be extra sure.
  8. Executing step 1, 2 and 3 after the reinstall and a restart.

Finally, I did try what is in this question's answer:

"Value does not fall within the expected range" when trying to add a reference in a project

To no avail. devenv executes successfully, but the error persists. There is no output throw in the output window. I did not find any relevants logs of the error.

To add more details, 6 projects won't load. Other 14 loads up just fine.

Malavos
  • 429
  • 3
  • 12
  • 27
  • I had this error once with a malformed sln or csproj file - can't remember exactly. I would try to unload all projects and re-enabling them one by one until you find the one that throws the error. I don't think this is an issue with the system, I would guess that somewhere either in the csprojs or sln is a wrong value set, or something like an invisible control character that snuck into either of these files. – Lennart Nov 29 '19 at 16:02
  • Many of them throw errors. Many of them do not. I did that too! I just did not comment that because I thought it was clear that some projects loaded fine. – Malavos Nov 29 '19 at 16:31
  • 1
    have you copied their solution into a new pc? there might be some references missed in the new computer. check "references" under each project and make sure they are all exists. – Nima Habibollahi Nov 29 '19 at 19:36
  • 2
    Maybe some kind of file encoding issue? Something like UTF-8 with or without BOM? Or someone touched these files on a Unix system and switched the line endings to LF? – Lennart Nov 30 '19 at 17:27
  • @nimahabibollahi that was a good suggestion. I just tried that too to a notebook. No success either. Same message. – Malavos Dec 01 '19 at 01:33
  • @Lennart that is something I can dig into. If that is the case, how could I approach on fixing this? – Malavos Dec 01 '19 at 01:34
  • @Malavos Both can be checked with Notepad++. The encoding can be viewed and switched via the menu of the same name. Line endings can be switched on in the view menu. To fix them both you'd have to look up some scripting solutions, unless you want to manually fix it one-by-one in Notepad++ – Lennart Dec 01 '19 at 09:10
  • So if you try to load one of those 6 projects that won't load into Visual Studio on its own (no solution, just the CSPROJ), do you get the same error? Is there any additional information in the **Output** tab or **Errors** list? – robbpriestley Dec 01 '19 at 20:01
  • @robbpriestley nope, nothing at all. Same error is show, and no output at all. That was a older question, the developer ended cleaning up the repository, uploading everything again and it worked. We are theorizing that it's a problem with encoding, as Lennart stated. – Malavos Dec 30 '19 at 17:19

1 Answers1

1

In my case Stash Files caused the problem, dropped all the changes and project loaded without problem

Jahuso
  • 29
  • 6
  • Woah, that's different. The project did not have any stashes, but that's helpful for those who see the same error. It's very generic. – Malavos Apr 27 '20 at 13:36