Skip to content

"Package did not load correctly" on direct loading some solutions/projects #45

Description

@AHollowedHunter

I'm having issues with the extension failing to load when launching certain Solutions/Projects directly from the .sln or .csproj files, but not all solutions exhibit this behaviour.

If I open VS directly and select a solution to open once VS is already running, I don't encounter this issue, so is a workaround for now.

  • After further testing, I found that I need to wait for the extension to start and my 'Activity' in discord to show 'No active [solution/project]' before I open a problematic solution. If I open a solution quickly before the extension has had time to fully start, the same issue occurs again.

I cannot pinpoint for certain anything specific about the solutions to cause this issue, yesterday I had this problem on a bunch of different solutions and project, and I ended up reinstalling the extension after first clearing my config folder. After a fresh install of the extension, everything was working again on any solution. I updated my settings and continued working fine.

Upon launching a solution today, the same error occurs. Weirdly, other solutions that this issue would happen before I reinstalled won't cause this issue; hence I find it hard to pinpoint if there is something specific about any solutions to trigger this. But...

Windows targets - related or redhearing?

The solution I had the issue with today contains a WinUI 3 project, targetting net6.0-windows. I was looking through issues and in #39 saw they reinstalled the Windows SDK and the problem was gone. I found another solution I had on hand that this error occurs with, and it turns out that has a project targetting net7.0-windows; if someone wants to try and reproduce it was ValveResourceFormat, or possible try creating a new project that builds a Windows application. This might be coincidence though, as I was getting this error before with other project targets.


Windows 11 Pro, 22621.2428
Visual Studio 17.8.0 Preview 5, Community 2022
VisualStudioDiscordRPC 1.6.1

Error Extract:

  <entry>
    <record>385</record>
    <time>2023/10/28 12:11:24.200</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Begin package load [VisualStudioDiscordRPCPackage]</description>
    <guid>{5CD3D640-3D33-45EA-8C5B-6DE981FF9900}</guid>
  </entry>
  <entry>
    <record>386</record>
    <time>2023/10/28 12:11:24.217</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>Begin package load [Microsoft.VisualStudio.Shell.Connected.ConnectedUser.ConnectedUserPackage]</description>
    <guid>{7F679D93-2EB6-47C9-85EB-F6AD16902662}</guid>
  </entry>
  <entry>
    <record>387</record>
    <time>2023/10/28 12:11:24.285</time>
    <type>Information</type>
    <source>VisualStudio</source>
    <description>End package load [Microsoft.VisualStudio.Shell.Connected.ConnectedUser.ConnectedUserPackage]</description>
    <guid>{7F679D93-2EB6-47C9-85EB-F6AD16902662}</guid>
  </entry>
  <entry>
    <record>388</record>
    <time>2023/10/28 12:11:24.286</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>SetSite failed for package [VisualStudioDiscordRPCPackage]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 EnvDTE80.DTE2.get_ActiveDocument()&#x000D;&#x000A;   at VisualStudioDiscordRPC.Shared.Variables.FileNameVariable..ctor(VsObserver vsObserver)&#x000D;&#x000A;   at VisualStudioDiscordRPC.Shared.Services.VariableService..ctor(VsObserver vsObserver)&#x000D;&#x000A;   at VisualStudioDiscordRPC.Shared.PackageController.RegisterServices()&#x000D;&#x000A;   at VisualStudioDiscordRPC.Shared.PackageController.Init()&#x000D;&#x000A;   at VisualStudioDiscordRPC.Shared.VisualStudioDiscordRPCPackage.&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__DisplayClass21_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.Services.VsTask.RethrowException(AggregateException e)&#x000D;&#x000A;   at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck)</description>
    <guid>{5CD3D640-3D33-45EA-8C5B-6DE981FF9900}</guid>
    <hr>0x80070057 - E_INVALIDARG</hr>
    <errorinfo></errorinfo>
  </entry>
<!-- NO MORE ENTRIES AFTER THIS -->

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions