Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Windows Form "Value does not fall within the expected range."

In Visual Studio Enterprise 2017 when I create a Windows Form in my solution I get the following error page right away (instead of the designer page):

The stack trace is:

at Microsoft.VisualStudio.LanguageServices.CSharp.CodeModel.CSharpCodeModelService.GetTypeSymbolFromFullName(String fullName, Compilation compilation)
at Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.RootCodeModel.DotNetNameFromLanguageSpecific(String languageName)
at EnvDTE80.CodeModel2.DotNetNameFromLanguageSpecific(String LanguageName)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.CodeTypeDeclarationFromCodeClass(CodeClass vsClass)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.OnNamespacePopulateTypes(Object sender, EventArgs e)
at System.CodeDom.CodeNamespace.get_Types()
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.Parse(TextReader codeStream)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.MergedCodeDomParser.System.CodeDom.Compiler.ICodeParser.Parse(TextReader stream)
at System.CodeDom.Compiler.CodeDomProvider.Parse(TextReader codeStream)
at Microsoft.VisualStudio.Shell.Design.Serialization.CodeDom.CodeDomDocDataAdapter.get_CompileUnit()
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)

The provided links on the page do not help since they only link to generic documentation/help pages. How can this error be fixed?

like image 986
BullyWiiPlaza Avatar asked Aug 26 '26 01:08

BullyWiiPlaza


1 Answers

I got this in Visual Studio 2019 in a Windows Forms app. I'd been working on it for a few days, opening and closing the solution with no issue. I applied a VS upgrade and when I went to open the app, I got this error message.

When nothing else worked, I unloaded and reloaded the project from the solution, and that fixed it.

I hope it's as simple as that for you.

like image 62
Toolsmythe Avatar answered Aug 28 '26 15:08

Toolsmythe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!