Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception in Visual Studio 2022 (version 17.2.0) when opening a solution that uses AnhSvn #49

Open
BrightLight opened this issue May 13, 2022 · 10 comments

Comments

@BrightLight
Copy link

I've successfully used AnkhSVN version 2.9.87 with Visual Studio 2022 (internal version < 17.2). Now I've updated to VS2022 version 17.2. When I now open a solution file that uses AnkhSvn I get this exception:

System.InvalidCastException: Unable to cast object of type 'Microsoft.VisualStudio.CommonIDE.Solutions.SolutionPropertyBag' to type 'Ankh.Scc.Native.ICOMPropertyBag'.
   at Ankh.VSPackage.AnkhSvnPackage.ReadSolutionProps(IVsHierarchy pHierarchy, String pszProjectName, String pszProjectMk, String pszKey, Int32 fPreLoad, IPropertyBag pPropBag)

Afterwards Visual Studio freezes.

@arsjones
Copy link

I am receiving the same error, but I'm able to continue working and even Ankh seems to be working ok.

@hgbutte
Copy link

hgbutte commented May 17, 2022

Additionally i get a message that "One or more project in the solution were not loaded correctly".
But I cannot an unloaded project though.
In the output window from "Solution" i get the message: "Some of the properties associated with the solution could not be read."

I am not sure if this is related to AnkhSVN.

@mxtmra
Copy link

mxtmra commented May 17, 2022

I rebuilt the package with latest Microsoft.VisualStudio.OLE.Interop package and that seem to solve the issue.

@RincewindTVD
Copy link

This appears to be the same issue as #44

@BrightLight
Copy link
Author

After reading #44 I tried the vsix from the MSBuild 121 action and can confirm that I no longer get the exception.

@Julimuz
Copy link

Julimuz commented May 19, 2022

Yes, after #44 now is working, thanks

@agausachs
Copy link

MSBuild 121 action has expired so there's not a solution in this moment.
Please, update the VSIX on the Marketplace if possible. Thanks!

@eliaocchiuzzi
Copy link

Hi, I have the same problem with VS2022, please fix it.

image
image
image

@ibs-ts
Copy link

ibs-ts commented Jan 26, 2023

The problem seems to be the (as the error hints) the propertybag within the solution file

So a work around of this issue:

  • You have a "solution.sln" created with VS 2019 or earlier
  • In that solution you may have the following entry (may be something at the end):
    GlobalSection(SubversionScc) = preSolution Svn-Managed = True Manager = AnkhSVN2019 - Subversion Support for Visual Studio EndGlobalSection
  • As the VS2022 doesn't support 2019 an AnkhSvn2019-class couldn't be found by VS2022 (assumption)
  • After removing the whole GlobalSection, the solution can be opened without popups.

Further:
If you've installed both but want the right for the visual studio version, I suggest making the following:

  • "solution.vs2019.sln" with GlobalSection(SubversionScc) ect and the VisualStudioVersion = ... at the top of the file set to VS2019 version (16.x)
  • "solution.vs2022.sln" without GlobalSection(SubversionScc) ect and the VisualStudioVersion = ... at the top of the file set to VS2019 version (17.x)

That way the visual studio versions selector opens the right file with the right version.

As said workaround, try it as your own risk.

@cyrilwallace
Copy link

Thanks for the workaround ibs-ts but having to modify all my solution files doesn;t sit right with me..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants