none
Designer: Value does not fall within expected range RRS feed

  • Question

  • How do I find what component is causing the error?  The call stack is unhelpful:

    at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
    at Microsoft.VisualStudio.NativeMethods.ThrowOnFailure(Int32 hr, Int32[] expectedHRFailure)
    at Microsoft.VisualStudio.Shell.Design.Serialization.DesignerDocDataService.GetFileDocData(String fileName, FileAccess access, String createTemplate, Boolean addToHostList, Boolean nestedItem)
    at Microsoft.VisualStudio.Shell.Design.Serialization.DesignerDocDataService.GetChildDocData(String name, FileAccess access, String createTemplate)
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.GetResourceDocData(CultureInfo info, FileAccess access)
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.System.ComponentModel.Design.IResourceService.GetResourceReader(CultureInfo info)
    at System.ComponentModel.Design.Serialization.ResourceCodeDomSerializer.SerializationResourceManager.GetMetadata()
    at System.ComponentModel.Design.Serialization.ResourceCodeDomSerializer.SerializationResourceManager.GetMetadataEnumerator()
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializePropertiesFromResources(IDesignerSerializationManager manager, Object value, Attribute[] filter)
    at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
    at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
    at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host) 
      
    I was changing code in subroutines of Form1.vb, not working with the designer or with the properties box of components on the designer.  I have looked through Form1.Designer.vb, and don't see anything obvious.  But there are 1964 lines of code in the designer.  It would be nice to have an error that tells me what values it finds objectionable.  I do have a split container, but there are no minsize statements.  I do have a four-day old backup since this is not the first time components have disappeared, but I will have to compare the codes to find all the fixes that I made (things like holding some values in My.Settings so they don't have to be re-entered when the program is run again).  And it would be nice to be able to figure out what not to do when I re-design the form.

    If I ignore the error and continue, all components disappear, and the form reverts to the initial design time properties.

    And while I am at it, why is it that if I hide the tool bar at runtime and then show it, it re-appears above the menu strip instead of below it?

    Thanks.
    Friday, May 23, 2008 12:56 PM

Answers

  • Try building the project, then go to the error stack and look for errors/warnings in the designer.

     

    If this doesn't help and you still need to backup your 4-days-old code, i recommend using a software like "FreeDIFF" which accurately compares files for differences...

     

    good luck

    Friday, May 23, 2008 2:55 PM

All replies

  • Try building the project, then go to the error stack and look for errors/warnings in the designer.

     

    If this doesn't help and you still need to backup your 4-days-old code, i recommend using a software like "FreeDIFF" which accurately compares files for differences...

     

    good luck

    Friday, May 23, 2008 2:55 PM
  • I should mention that I'm using Visual Basic Express 2008.  The Error List window lists the error as a warning, with the File value blank, and both the line and column values listed as 0.

    Thanks.
    Friday, May 23, 2008 5:04 PM
  • The project build fine, and runs fine.  I just can't make any changes in the design window anymore, because I can't see anything.  There are no errors other than the one unhelpful warning.  I will look for the program that lists file differences, so I can try this again.  And I think I should back things up more often.  You would have thought I would have learned my lesson, with all of the lost data I've encountered over the years starting with Radio Shack's Model III computer (which I still have and which still works).

    Thanks.
    Friday, May 23, 2008 5:13 PM
  • I was able to use FreeDiff to easily spot the updates in my code, and to make the changes to the backup of my project (after I backed up the backup, of course).  The program runs fine, and the designer window is visible again.  It only took about three hours total to make all the changes I wanted.  Many thanks for the tip!

    Keith

    All those who believe in telekinesis, raise my hand.
    Saturday, May 24, 2008 11:25 PM
  • Did you ever find out what caused the error?  I am having exactly the same problem in a UserControl.  In fact I have 2 UserControls in the same project that are almost identical.  One displays, one does not.  I have not been able to determine what caused one to display and one to no.

    • Proposed as answer by davidinpa Saturday, February 16, 2019 1:37 PM
    • Unproposed as answer by davidinpa Saturday, February 16, 2019 1:37 PM
    Friday, April 10, 2009 5:47 PM
  • I got the same error, and the error description in the Error List is really useless:

    Value does not fall within the expected range.        Line: 0  Column: 0  
    

    Does anyone know how to disable the form validation in the Designer? I guess we rather shouldn't do this in order to get rid of all errors before displaying the form UI. But when you get errors like these, and the code compiles&runs perfectly, then you can't see any of the UI elements in your form by using Designer and have to use lot of time to really find out where the "error" is. 

    Edit:
    I found following exception in the Call Stack:

    at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
    at Microsoft.VisualStudio.NativeMethods.ThrowOnFailure(Int32 hr, Int32[] expectedHRFailure)
    at Microsoft.VisualStudio.Shell.Design.Serialization.DesignerDocDataService.GetFileDocData(String fileName, FileAccess access, String createTemplate, Boolean addToHostList, Boolean nestedItem)
    at Microsoft.VisualStudio.Shell.Design.Serialization.DesignerDocDataService.GetFileDocData(String fileName, FileAccess access, String createTemplate)
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomProvider.OnParseBegin(TextReader reader)
    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) 

    Sunday, April 12, 2009 3:11 PM
  • I just wanted to bump this back up, since I am having a problem identical to Ismar.  The program compiles and runs without a problem, producing a single warning, "Value does not fall within the expected range", no file name, line 0, column 0.

    Loading the designer gives the same error as the folks before me posted and the top-level call in the call stack is identical to what Ismar posted.  All I want to do is add another control to the form and it would be ridiculous to have to do it in code.
    Wednesday, June 10, 2009 10:42 PM
  • I had seen the same issue.
    Build and Run successful but when viewed as Design, the error appeared.
    I closed solution and restart IDE to resolve this problem.
    Thursday, July 2, 2009 4:05 AM
  • I made an account just for this thread because of this error.

    I almost well... crapped myself when i got this error! (I am using Visual Stuidos 2010 beta 2) I got this error after about an hours work or so, but i don't backup my project files (i upload to an open source hosting site (not going to name because idk rules for this site) but my last upload was a while ago, and ya... enough of my bickering!

    Khoaht's tip to restart the IDE helped me, and it should probably be everyone's first course of action when encountered with this error!
    Friday, January 15, 2010 5:31 AM
  • I have this problem as well.  I have seen absolutely no solutions that help.  Restarting the IDE didn't work.

    In a project's property pages, under the Settings Tab, it simply states "Value does not fall within the expected range."  The call stack gives a load of un-helpful detrius:

    "at Microsoft.VisualStudio.Editors.SettingsDesigner.DesignTimeSettings.Add(DesignTimeSettingInstance Instance, Boolean MakeNameUnique)
    at Microsoft.VisualStudio.Editors.SettingsDesigner.AppConfigSerializer.Deserialize(DesignTimeSettings Settings, SettingsTypeCache typeCache, SettingsValueCache valueCache, String SectionName, DocData AppConfigDocData, MergeValueMode mergeMode, IUIService UIService)
    at Microsoft.VisualStudio.Editors.SettingsGlobalObjects.SettingsFileGlobalObject.LoadSettings(String fileName)
    at Microsoft.VisualStudio.Editors.SettingsGlobalObjects.SettingsFileGlobalObject.BuildType()
    at Microsoft.VisualStudio.Editors.SettingsGlobalObjects.SettingsFileGlobalObject.GetObjectType()
    at Microsoft.VisualStudio.Shell.Design.GlobalType.get_ObjectType()
    at Microsoft.VisualStudio.Shell.Design.GlobalObject.GetHashCode()
    at Microsoft.VisualStudio.Shell.Design.GlobalObjectService.GlobalKey.GetHashCode()
    at System.Collections.Generic.ObjectEqualityComparer`1.GetHashCode(T obj)
    at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
    at Microsoft.VisualStudio.Shell.Design.GlobalObjectService.GetGlobalObjects(Type baseType)
    at Microsoft.VisualStudio.Shell.Design.GlobalObjectService.GetGlobalObjects()
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetTypeFromGlobalObjects(String name, Boolean throwOnError, Boolean ignoreCase)
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String name, Boolean throwOnError)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.GetType(ITypeResolutionService trs, String name, Dictionary`2 names)
    at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.FillStatementTable(IDesignerSerializationManager manager, IDictionary table, Dictionary`2 names, CodeStatementCollection statements, String className)
    at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
    at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
    at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
    at System.ComponentModel.Design.Serialization.BasicDesignerLoader.BeginLoad(IDesignerLoaderHost host) "

    If anyone could actually help, that'd be wonderful.  I'd like to hope that someone could.


    Jason the Mason
    Monday, April 5, 2010 3:56 PM
  • I deleted the "Settings.settings" file in the project, and this error went away.
    Jason the Mason
    Monday, April 5, 2010 6:04 PM
  • EDIT: Don't worry about losing your changes in your Forms, they are safe. It's just the designer having issues parsing a file.

    In my project, I have a file licenses.licx which is under source control and it was locked and was returning the same error except my stack trace was showing something about the Licenses and it seems it has to do with parsing the files. I checked out the file which was instantly modified by VS2010 RTM and then everything was happy-go-lucky again. Seems there is an error in their parsing of these "Property" files or something.

     

    • Proposed as answer by Jeremy Polen Friday, April 30, 2010 5:18 PM
    Friday, April 30, 2010 5:16 PM
  • I had seen the same issue.
    Build and Run successful but when viewed as Design, the error appeared.
    I closed solution and restart IDE to resolve this problem.


    Using VS 2008 and worked for me!

    I presume this is a bug?

    Wednesday, July 7, 2010 1:34 AM
  • I've had this sort of problem many times with VS 2008. If it compiles and runs then clean your solution, close VS, delete the .ncb file, restart VS and 9 times out of 10 the designer will start working again.

    If ever VS starts going funky on me, first thing I try is deleting the ncb.

    Sunday, April 17, 2011 3:42 PM
  • Great thanks,Jasonthemasonkcch!
    Friday, September 21, 2012 6:46 AM
  • Thanks Jasonthemasonkcch, your solution worked for me!
    Wednesday, June 19, 2013 9:59 PM
  • If I may add some info to this age-old thread: I just had the same problem (Visual Studio 2017, .NET 4.61) and was able to fix it by adding a whitespace to the [MyForm].Designer.cd file (and therefore checking it out from Git).
    Friday, January 18, 2019 2:04 PM
  • I also had this problem, and fixed it on my second attempt. These type things can be a nuisance, but I found a simple fix this time.

    1. First closed the Designer View and compiled the app with the debugger button, but still the Designer displayed this error.
    2. [this worked] Then did the same, but first closed all open files in Visual Studio. After "compiling the app with the debugger button" the error went away.

    • Edited by davidinpa Saturday, February 16, 2019 1:44 PM
    • Proposed as answer by davidinpa Saturday, February 16, 2019 1:44 PM
    Saturday, February 16, 2019 1:43 PM
  • I ran into this, and resolved it by deleting the .vs subdirectory of the directory in which my solution file lived.
    Saturday, November 23, 2019 10:22 PM