1

After upgrading vs2019, and then also after installing vs2020 I can't open C# projects. Whenever I try to open I get first error boxes notifying that VS is not able to load the RoselynPackage and the CSharpPackage, and after that in output I get error message like this project 'Assembly-CSharp' could not be opened because the Visual C# 2022 language service could not be created. Value does not fall within the expected range.

Tried suggested method to delete \AppData\Local\Microsoft\VisualStudio\17.0_064520ec\ComponentModelCache and cleaning nuget etc (How can I fix the Microsoft Visual Studio error: "package did not load correctly"?) cache but nothing seems to help.

Also tried what is suggested here Error HRESULT E_FAIL has been returned from a call to a COM component VS2012 when debugging

Tried to repair. Tried to clean visual studio and reinstall, did not help either.

Found that if I create a new account on Windows and open visual studio from there, it works fine. Only in my account does it not work. Registry issue?

This is what I get in activity log.

  <entry>
    <record>395</record>
    <time>2022/01/17 10:48:34.049</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Begin package load [RoslynPackage]</description>
    <guid>{6CF2E545-6109-4730-8883-CF43D7AEC3E1}</guid>
  </entry>
  <entry>
    <record>396</record>
    <time>2022/01/17 10:48:34.058</time>
    <type>Error</type>
    <source>Microsoft.VisualStudio.LanguageServices.Setup.RoslynPackage</source>
    <description>Exception occurred while loading solution options: System.Runtime.InteropServices.COMException (0x80030002):  could not be found. (Exception from HRESULT: 0x80030002 (STG_E_FILENOTFOUND))&#x000D;&#x000A;   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)&#x000D;&#x000A;   at Microsoft.VisualStudio.Shell.Package.Initialize()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()&#x000D;&#x000A;   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)</description>
  </entry>
  <entry>
    <record>397</record>
    <time>2022/01/17 10:48:34.371</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Begin package load [ErrorListPackage]</description>
    <guid>{4A9B7E50-AA16-11D0-A8C5-00A0C921A4D2}</guid>
  </entry>
  <entry>
    <record>398</record>
    <time>2022/01/17 10:48:34.395</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>SetSite failed for package [RoslynPackage]Source: &apos;mscorlib&apos; Description: Illegal characters in path.&#x000D;&#x000A;System.ArgumentException: Illegal characters in path.&#x000D;&#x000A;   at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)&#x000D;&#x000A;   at System.IO.Path.Combine(String path1, String path2, String path3, String path4)&#x000D;&#x000A;   at Microsoft.CodeAnalysis.Internal.Log.FileLogger..ctor(IGlobalOptionService optionService)&#x000D;&#x000A;   at Microsoft.VisualStudio.LanguageServices.Telemetry.VisualStudioWorkspaceTelemetryService.CreateLogger(TelemetrySession telemetrySession)&#x000D;&#x000A;   at Microsoft.VisualStudio.LanguageServices.Telemetry.AbstractWorkspaceTelemetryService.InitializeTelemetrySession(TelemetrySession telemetrySession)&#x000D;&#x000A;   at Microsoft.VisualStudio.LanguageServices.Setup.RoslynPackage.&lt;InitializeAsync&gt;d__19.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.VisualStudio.Shell.AsyncPackage.&lt;&gt;c__DisplayClass20_0.&lt;&lt;Microsoft-VisualStudio-Shell-Interop-IAsyncLoadablePackageInitialize-Initialize&gt;b__1&gt;d.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.VisualStudio.Threading.JoinableTask.&lt;JoinAsync&gt;d__76.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()&#x000D;&#x000A;   at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e)&#x000D;&#x000A;   at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck)</description>
    <guid>{6CF2E545-6109-4730-8883-CF43D7AEC3E1}</guid>
    <hr>80070057 - E_INVALIDARG</hr>
    <errorinfo></errorinfo>
  </entry>
  <entry>
    <record>399</record>
    <time>2022/01/17 10:48:34.416</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>End package load [RoslynPackage]</description>
    <guid>{6CF2E545-6109-4730-8883-CF43D7AEC3E1}</guid>
    <hr>80070057 - E_INVALIDARG</hr>
    <errorinfo></errorinfo>
  </entry>
  <entry>
    <record>400</record>
    <time>2022/01/17 10:48:34.505</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>End package load [Microsoft.VisualStudio.PlatformUI.UIContextRules.ContextRuleMonitorPackage]</description>
    <guid>{8AA75F1E-7410-4EFE-82AA-0FEA79A0A042}</guid>
  </entry>
  <entry>
    <record>401</record>
    <time>2022/01/17 10:48:34.525</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>End package load [ErrorListPackage]</description>
    <guid>{4A9B7E50-AA16-11D0-A8C5-00A0C921A4D2}</guid>
  </entry>
  <entry>
    <record>402</record>
    <time>2022/01/17 10:48:34.612</time>
    <type>Warning</type>
    <source>GlobalBrokeredServiceContainer</source>
    <description>Request for &quot;Microsoft.VisualStudio.Shell.Internal.SettingsManager (1.0)&quot; from Process denied because the service is only exposed RemoteExclusiveClient, LiveShareGuest.</description>
  </entry>
  <entry>
    <record>403</record>
    <time>2022/01/17 10:48:34.612</time>
    <type>Warning</type>
    <source>GlobalBrokeredServiceContainer</source>
    <description>Request for proxy to &quot;Microsoft.VisualStudio.Shell.Internal.SettingsManager (1.0)&quot; is declined: ServiceAudienceMismatch.</description>
  </entry>
  <entry>
    <record>404</record>
    <time>2022/01/17 10:48:34.618</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Begin package load [Microsoft.VisualStudio.Editor.Implementation.EditorPackage]</description>
    <guid>{E269B994-EF71-4CE0-8BCD-581C217372E8}</guid>
  </entry>
  <entry>
    <record>405</record>
    <time>2022/01/17 10:48:34.619</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Begin package load [Global Hub Client Package]</description>
    <guid>{11AD60FC-6D87-4674-8F88-9ABE79176CBE}</guid>
  </entry>
  <entry>
    <record>406</record>
    <time>2022/01/17 10:48:34.688</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Begin package load [Text Management Package]</description>
    <guid>{F5E7E720-1401-11D1-883B-0000F87579D2}</guid>
  </entry>
  <entry>
    <record>407</record>
    <time>2022/01/17 10:48:34.693</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>End package load [Text Management Package]</description>
    <guid>{F5E7E720-1401-11D1-883B-0000F87579D2}</guid>
  </entry>
  <entry>
    <record>408</record>
    <time>2022/01/17 10:48:34.811</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>End package load [Microsoft.VisualStudio.Editor.Implementation.EditorPackage]</description>
    <guid>{E269B994-EF71-4CE0-8BCD-581C217372E8}</guid>
  </entry>
  <entry>
    <record>409</record>
    <time>2022/01/17 10:48:34.876</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>End package load [Global Hub Client Package]</description>
    <guid>{11AD60FC-6D87-4674-8F88-9ABE79176CBE}</guid>
  </entry>
  <entry>
    <record>410</record>
    <time>2022/01/17 10:48:35.397</time>
    <type>Information</type>
    <source>Extension Manager</source>
    <description>IncompatibilityList - Call Servicehub for downloading compatibility list file.</description>
  </entry>
  <entry>
    <record>411</record>
    <time>2022/01/17 10:48:35.844</time>
    <type>Information</type>
    <source>Extension Manager</source>
    <description>IncompatibilityList - Look for incompatible extensions.Configuration or the user compatibility list file changed</description>
  </entry>
  <entry>
    <record>412</record>
    <time>2022/01/17 10:48:41.362</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Begin package load [Microsoft.VisualStudio.Services.ToastNotifications.ToastNotificationsPackage]</description>
    <guid>{C931D979-CA1A-41E8-8A23-E86B85E3141B}</guid>
  </entry>
  <entry>
    <record>413</record>
    <time>2022/01/17 10:48:41.365</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>End package load [Microsoft.VisualStudio.Services.ToastNotifications.ToastNotificationsPackage]</description>
    <guid>{C931D979-CA1A-41E8-8A23-E86B85E3141B}</guid>
  </entry>
  <entry>
    <record>414</record>
    <time>2022/01/17 10:48:43.821</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>SetSite failed for package [CSharpPackage]Source: &apos;Microsoft.VisualStudio.Interop&apos; Description: Value does not fall within the expected range.&#x000D;&#x000A;System.ArgumentException: Value does not fall within the expected range.&#x000D;&#x000A;   at Microsoft.VisualStudio.Shell.Interop.IVsTaskBody.DoWork(IVsTask pTask, UInt32 dwCount, IVsTask[] pParentTasks, Object&amp; pResult)&#x000D;&#x000A;   at Microsoft.VisualStudio.Services.VsTask.&lt;&gt;c__DisplayClass86_0.&lt;GetCallbackForMultipleParent&gt;b__0(Task`1[] _)&#x000D;&#x000A;   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()&#x000D;&#x000A;   at System.Threading.Tasks.Task.Execute()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()&#x000D;&#x000A;   at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e)&#x000D;&#x000A;   at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck)&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()&#x000D;&#x000A;   at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e)&#x000D;&#x000A;   at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck)&#x000D;&#x000A;   at Microsoft.VisualStudio.LanguageServices.Implementation.LanguageService.AbstractPackage`2.&lt;InitializeAsync&gt;d__5.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.VisualStudio.LanguageServices.CSharp.LanguageService.CSharpPackage.&lt;InitializeAsync&gt;d__2.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()&#x000D;&#x000A;   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)&#x000D;&#x000A;   at Microsoft.VisualStudio.Shell.AsyncPackage.&lt;&gt;c__DisplayClass20_0.&lt;&lt;Microsoft-VisualStudio-Shell-Interop-IAsyncLoadablePackageInitialize-Initialize&gt;b__1&gt;d.MoveNext()&#x000D;&#x000A;--- End of stack trace from previous location where exception was thrown ---&#x000D;&#x000A;   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()&#x000D;&#x000A;   at Microsoft.VisualStudio.Shell.UIThreadReentrancyScope.WaitOnTaskCompleteInternal(Task task, CancellationToken cancel, Int32 ms)&#x000D;&#x000A;   at Microsoft.VisualStudio.Services.VsTask.&lt;&gt;c__DisplayClass68_1.&lt;InternalGetResult&gt;b__1()&#x000D;&#x000A;   at Microsoft.VisualStudio.Services.VsTask.IgnoreObjectDisposedException(Action action)&#x000D;&#x000A;   at Microsoft.VisualStudio.Services.VsTask.&lt;&gt;c__DisplayClass68_0.&lt;InternalGetResult&gt;b__0()&#x000D;&#x000A;   at Microsoft.VisualStudio.Services.VsTask.&lt;&gt;c__DisplayClass76_0.&lt;InvokeWithWaitDialog&gt;b__0()&#x000D;&#x000A;   at Microsoft.VisualStudio.Services.VsTask.InvokeWithWaitDialog[T](Func`1 function)&#x000D;&#x000A;   at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck)</description>
    <guid>{13C3BBB4-F18F-4111-9F54-A0FB010D9194}</guid>
    <hr>80070057 - E_INVALIDARG</hr>
    <errorinfo></errorinfo>
  </entry>
  <entry>
    <record>415</record>
    <time>2022/01/17 10:48:43.832</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>End package load [CSharpPackage]</description>
    <guid>{13C3BBB4-F18F-4111-9F54-A0FB010D9194}</guid>
    <hr>80070057 - E_INVALIDARG</hr>
    <errorinfo></errorinfo>
  </entry>## Heading ##
Nathan Rona
  • 101
  • 9
  • Does it affect newly created projects from respective VS version or only older projects from previous versions? – grek40 Jan 17 '22 at 14:10
  • Both new and old. I happens when opening existing project or when trying to create new project. – Nathan Rona Jan 17 '22 at 14:35
  • Found that if I create a new account on Windows and open visual studio from there, it works fine. Only in my account does it not work. Registry issue? – Nathan Rona Jan 17 '22 at 17:26
  • Maybe... but I would rather expect issues in %appdata% or in some temp files. – grek40 Jan 18 '22 at 06:57
  • Deleted all the all vs directories in appdata, both in in local and in roaming, did not help. Also cleaned vs data from registry for current use, didn't help either. Perhaps I just settle for using VS in the new windows account. – Nathan Rona Jan 18 '22 at 10:39
  • 1
    I have the same issue, how did you solved this? – ramdev Oct 23 '22 at 23:37
  • Nathan - did you find a solution for this? I have this after a VS2022 upgrade. I tried repair, uninstall/reinstall, clear vs cache, etc. My projects are OK, I can open them on another machine that did not have the recent upgrade. – Greg May 22 '23 at 21:23

0 Answers0