Suddenly I am getting this error «Value does not fall within the expected range» whenever I try to add a reference to any project. This also happens with a new blank project. It can list the current references fine.
I rebooted the computer. I am not sure if the recent Update 2 caused this. This is my first add reference since the update. I am using Visual Studio 2013 on Windows 7 64bit.
Any ideas?

![]()
Aristos
65.9k16 gold badges113 silver badges150 bronze badges
asked May 28, 2014 at 1:32
Tony_HenrichTony_Henrich
42k74 gold badges234 silver badges371 bronze badges
1
I did a ‘devenv /setup’ and that fixed it.
Detail
- Exit Visual Studio
- Click
Start - Type
cmd, right clickCommand Promptand selectRun as administrator -
Navigate to the appropriate Visual Studio folder
VS2012:pushd %programfiles(x86)%Microsoft Visual Studio 12.0Common7IDE
VS2015:pushd %programfiles(x86)%Microsoft Visual Studio 14.0Common7IDE
VS2017:pushd %programfiles(x86)%Microsoft Visual Studio2017<Edition>Common7IDE
VS2019:pushd %programfiles(x86)%Microsoft Visual Studio2019<Edition>Common7IDE -
Type
devenv /setupand press enter - When the command prompt returns, you’re done. Close the command window, reopen Visual Studio, and test to see if the error’s resolved.
More Information
https://msdn.microsoft.com/en-us/library/ex6a2fad.aspx
answered May 28, 2014 at 1:40
Tony_HenrichTony_Henrich
42k74 gold badges234 silver badges371 bronze badges
14
In my case deleting .suo file in .vs[solutionName] folder fixed the problem in Visual Studio 2022
answered Aug 9, 2022 at 5:43
![]()
Elvin MammadovElvin Mammadov
24.8k11 gold badges40 silver badges82 bronze badges
5
In my case, project was set to use local IIS (when the project set up to use local IIS but the app does not deployed there, it cannot load project but states clearly in the error message. However this time I was keep getting Value does not fall within the expected range with any other info.
Only «solution» worked for me was:
- Edit csproj file
- Set
<UseIISExpress>totrue - Set
<UseIIS>tofalse - Then reload the project.
(after that you can set your local IIS again)
answered Feb 21, 2020 at 14:31
![]()
0
Some projects (e.g. some web services) require that Visual Studio be run as an administrator. After a Visual Studio upgrade, I hadn’t noticed that it was no longer being started with elevated privileges automatically. When I corrected this, all the projects in the solution loaded.
answered Oct 10, 2019 at 11:21
![]()
Graham LaightGraham Laight
4,6703 gold badges29 silver badges28 bronze badges
1
I have tried to delete the .vs hidden folder placed in the same solution directly and it works for me try this it’s straightforward to fix this issue.
thanks.
answered Aug 26, 2022 at 6:46
3
In my case, this was because I needed a specific version of the .NET Core SDK installed.
Once I got it downloaded and installed, the projects loaded fine. Unfortunately there was no additional information in the Output tab hinting at this.
answered Oct 9, 2019 at 21:39
emraginsemragins
4,5372 gold badges33 silver badges48 bronze badges
1
In my case the file name inside the Solution .sln was wrong (not exist on disk).
I open the solution file MyFullsolution.sln using a text editor and check the Project load files and found that the project ProjectFile.csproj that fails to load was typed wrong.
How that happens ? Because I rename it from the solution some day, but I use the same ProjectFile.csproj again on a different solution! and I rename it in one solution, but the other just didn’t know it… and get the same message (that actual not help at all).
So was my mistake the file rename from the other solution.
answered Sep 20, 2020 at 19:49
![]()
AristosAristos
65.9k16 gold badges113 silver badges150 bronze badges
Kind of a dumb oversight on my part.. but depending on the action that had caused it, you may want to check your console output as well. In my case it was a project that would not load. While there were no explicit errors, the consol window indicated that a file was missing based on a directive from the csproj.
ECommerceProdEcommerceUtilityECommerceCommandsECommerceCommands.csproj
: error : The imported project «C:Program Files
(x86)MSBuildExtensionPack4.0MSBuild.ExtensionPack.tasks» was not
found.Confirm that the expression in the Import declaration «C:Program
Files (x86)MSBuildExtensionPack4.0MSBuild.ExtensionPack.tasks» is
correct, and that the file exists on disk.
answered Feb 23, 2021 at 17:05
Bonez024Bonez024
1,3681 gold badge13 silver badges21 bronze badges
In my case it was simple, if the file is open and then I run it, it will run. If the file is closed and then I run it by right clicking from the «Solution Explorer», then it throws the error you mentioned.
So, simple steps:
In the Solution Explorer,
- Double click on the file and open it
- Right click on the file and select «Start with Debugging» or «Start without Debugging»
answered Jul 18, 2019 at 13:59
calvincalvin
1531 silver badge10 bronze badges
I also got the same error with «web» tab missing from project properties, for those having this issue can try changing the target framework of the project.When I changed target framework from 4.6.2 to 4.7.2, the web tab appeared again.
answered Aug 19, 2019 at 5:08
![]()
I have seen this box in VS-2019 16.5.4 in a Winforms/4.8 app with Std classlibs, on attempting to close one of the Winforms/4.8 source file tabs. The message came up, the tab refused to close.
Solved it by closing an re-opening the Solution.
answered Jun 15, 2020 at 12:03
GoodiesGoodies
1,94121 silver badges26 bronze badges
I just had the same, it was only one file which casing this issue, When I read the solution above I was worried to fix all visual studio because one .cs file so I tried to right click on the (TAB header) beside the (X) button which closes this and click on (Close All documents)…
it worked : )
answered Jun 25, 2020 at 11:06
![]()
Khaleel HmozKhaleel Hmoz
9672 gold badges13 silver badges24 bronze badges
I tried the solution described by Tony_Henrich, as it seemed helpful.
However in my case, I’m building off a USB drive which is encrypted with BitLocker.
I find that the *.c module I want to look at throws this error if I try to force open it with the C++ editor in VS2019 (I’m updating to 16.10.2, so whatever was just before that rev).
Visual Studio was not opening a *.c module in the editor but popping it up in Notepad. If I FORCED it to use Visual Studio C++ editor I got the «Value does not fall» message.
The file is part of a build tree in a repo I’m not responsible for, and it’s not building, so at the moment I suspect Bitlocker/USB disk corruption is somehow giving Visual Studio some fits.
Tortoise-GIT Blame tool shows different/valid source code and Notepad shows a chunk missing.
My fix was to delete the file from the workspace and try seeing if GIT could restore a valid copy from the repository, and this worked. Now clicking on the *.c module in Windows Explorer and requesting to open it, no longer brings up Notepad, the file opens in Visual Studio.
answered Jun 21, 2021 at 15:38
![]()
Ross YoungbloodRoss Youngblood
5031 gold badge3 silver badges16 bronze badges
Setting up the dev environment for an existing project on a new server: Windows Server 2022, Visual Studio 2022, IPv6 enabled, IIS6 compatibility features installed, public IP address, domain name, web server certificate. The web application does not load. Creating the web application by hand in IIS Manager doesn’t help.
Message box:
Value does not fall within the expected range
Output from: Solution:
error: The Web Application Project webapp is configured to
use IIS. The Web server ‘http://localhost/webapp’ could not be found.
The webapp.csproj file contains:
<IISUrl>http://localhost/webapp</IISUrl>
The project loaded after changing the protocol and the name of the server to match the certificate:
<IISUrl>https://my.domain.com/webapp</IISUrl>
answered Mar 22, 2022 at 2:39
Tom AndraszekTom Andraszek
1,7631 gold badge23 silver badges30 bronze badges
In my case, the issue was caused because the project required the older version of the .NET SDK.
So, what I did was to open the «Visual Studio Installer» and, in the «Individual Components» section, chose the previous version of .NET SDK (although they were out of support in my case).
answered Mar 2 at 9:22
![]()
In my case I deleted .vs folder and restarted the application then it started to work!
But I have to add that I wrote code and used hot reload instead of whole application restart, so when I restarted the application it self maybe this helped if no then .vs folder deletion helped.
answered May 23 at 9:17
![]()
- Remove From My Forums
-
Question
-
I’m using VS 2008 SP1 for a Winforms project targeting .NET Framework 3.5. A particular form will compile and run just fine. However, if you try to open it in the design view, you get the cryptic error: «Value does not fall within the expected range.» When I click to view the call stack, I get the even more cryptic:
«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)»I look at the Settings tab in the project’s property page, and it only has a repeat stating «Value does not fall within the expected range.» The few «solutions» I’ve found don’t help at all. Restarting the IDE doesn’t work. Rebuilding the project doesn’t work. Deleting the bin and obj directories doesn’t help. Does anyone have a valid idea of how to fix this? It’s rather hard to develop a Windows form when you can’t view it.
Jason the Mason
Answers
-
Seeing that nobody «official» actually seemed to look, or care about this particular problem, I thought I’d post the solution I found. It seems that the settings file had become «corrupted» (for lack of a better word). I deleted the «Settings.settings» file from the project, and the error dissapeared.
Jason the Mason
-
Marked as answer by
Monday, April 5, 2010 6:02 PM
-
Marked as answer by
This evening, we kept receiving the Error «Value does not fall within the expected range» when trying to configure a custom identify for an IIS Application Pool. In this case, it was IIS 8 on Server 2012 R2 but we’ve also seen issues posted for Version 7.
For those who don’t want or have time to follow my journey, head on down to the end to «The Answer».
We knew the issue wasn’t something we entered: a bad credential rendered an error, and a bad username did the same. So at runtime, everything was great. It was something to do with trying to save the setting.
Event logs, ho!
To figure out how to resolve this, we went into the event viewer. There was nothing in the Application log, so we headed down to Applications and Services Logs => Microsoft => Windows => IIS-Configuration. The logs in here are disabled by default, so they have
to be enabled. (To do so, right-click the log, and choose Enable Log.) Once enabled, re-run the attempt to set the identity, and refresh the view (Actions pane or F5), and now we have some more information on the error. In the results were two Errors (event
ID 42 and 43).
ID 42: Failed to initialize the ‘IISWASOnlyAesProvider’ encryption provider in ‘\?C:windowssystem32inetsrvconfigapplicationHost.config’. Please check your configuration.
ID 43: Failed to encrypt attribute ‘Microsoft.ApplicationHost.AesProtectedConfigurationProvider’.
Now we know the issue identified with ID 42 was the cause of the issue identified in 43. The IISWASOnlyAesProvider encryption provider’s inability to load was the root cause of the inability to encrypt. Since it mentioned the
applicationHost.config file, let’s take a look at it.
We tried renaming [Note: Rename, not delete] the config file, and restarting IIS, but that didn’t work:
C:>net stop was /y
The following services are dependent on the Windows Process Activation Service s
ervice.
Stopping the Windows Process Activation Service service will also stop these ser
vices.
World Wide Web Publishing Service
The World Wide Web Publishing Service service is stopping.
The World Wide Web Publishing Service service was stopped successfully.
The Windows Process Activation Service service is stopping.
The Windows Process Activation Service service was stopped successfully.
C:>net start w3svc
System error
1068 has occurred.
The dependency service or group failed to start.
The Answer
Luckily, we were able to obtain a clean configuration file. We replace the applicationHost.config file (C:windowssystem32inetsrvconfigapplicationHost.config), and restarted services again:
net stop was /y
net start w3svc
After that, we were able to successfully make the changes.
We have tried to find the offending setting, but so far have not had any luck. Hopefully knowing that you can swap out the applicationHost.config file will help you out.
Lessons Learned
- Always keep a clean copy of this file on hand
- Ensure the file is always backed up
I am getting similar error, maybe this stacktrace is of help.
ArgumentException
在 Microsoft.Web.WebView2.Core.Raw.ICoreWebView2Controller.MoveFocus(COREWEBVIEW2_MOVE_FOCUS_REASON reason)
在 Microsoft.Web.WebView2.Core.CoreWebView2Controller.MoveFocus(CoreWebView2MoveFocusReason reason)
在 System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
在 System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
在 System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
在 System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
在 System.Windows.Input.InputManager.ProcessStagingArea()
在 System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
在 System.Windows.Input.KeyboardDevice.ChangeFocus(DependencyObject focus, Int32 timestamp)
在 System.Windows.Input.KeyboardDevice.TryChangeFocus(DependencyObject newFocus, IKeyboardInputProvider keyboardInputProvider, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
在 System.Windows.Input.KeyboardDevice.Focus(DependencyObject focus, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
在 System.Windows.Input.KeyboardDevice.Focus(IInputElement element)
在 System.Windows.UIElement.Focus()
在 System.Windows.FrameworkElement.OnPreviewGotKeyboardFocus(Object sender, KeyboardFocusChangedEventArgs e)
在 System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
在 System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
在 System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
在 System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
在 System.Windows.Input.InputManager.ProcessStagingArea()
在 System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
在 System.Windows.Input.KeyboardDevice.TryChangeFocus(DependencyObject newFocus, IKeyboardInputProvider keyboardInputProvider, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
在 System.Windows.Input.KeyboardDevice.Focus(DependencyObject focus, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
在 System.Windows.Input.KeyboardDevice.Focus(IInputElement element)
在 System.Windows.Interop.HwndKeyboardInputProvider.OnSetFocus(IntPtr hwnd)
在 System.Windows.Interop.HwndKeyboardInputProvider.FilterMessage(IntPtr hwnd, WindowMessage message, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
IIS applications run on application pools. Application pools receive requests and process them based on the settings defined. One of the settings is application pool identity. This is the account that runs application pool and perform required tasks. You may come across to this error message while trying to set a custom account as application pool identity: “Value does not fall within the expected range.“
This error occurs only if you are specifying a custom account and not using any predefined accounts such as ApplicationPoolIdentity or NetworkService.
The exact error message:
There was an error while performing this operation. Details: Value does not fall within the expected range.

The username and password fields of the custom application pool identity window in IIS Manager has only basic validations such as empty field check, password match check, local user check (no check for domain users). Therefore, “Value does not fall within the expected range” issue is not always a good clue to lead to the solution.
It is likely that there is something simple but easy to miss (a formatting issue in the config files etc.) is causing this issue. I would recommend taking the actions below first:
- Check the application pool identities in the
applicationHost.configfile (C:WindowsSystem32inetsrvConfig) for any syntax issues - Try to obtain a clean copy of
applicationHost.configand replace it with the current one - Restart Windows Process Activation Service (Reference)
- Close and reopen IIS Manager
net stop was /y
net start w3svc
If this doesn’t work:
- Create a new application pool and try set its application pool identity
- Try to open IIS Manager as a local or domain administrator if you are not already
- Check Event Viewer for more details of the error message
If you see Event ID 5021, 5057 or 5059, check out this post for possible solutions: HTTP 503 Service Unavailable (Application pool has been disabled)
