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

Opening VS solution leads to error #8075

Closed
KerstinKeller opened this issue Nov 20, 2024 · 2 comments
Closed

Opening VS solution leads to error #8075

KerstinKeller opened this issue Nov 20, 2024 · 2 comments
Assignees

Comments

@KerstinKeller
Copy link

Describe the bug
I get the below error message when loading a bigger solution file, that contains both C++ and Python projects.
It's a CMake based project and all project files are generated from within CMake.
When I closed the project the other night, everything was working ok

Expected behavior
Opening VS without exception / error, being able to debug the Python project.

Additional context and screenshots

[Window Title]
devenv.exe

[Main Instruction]
An unexpected error occurred

[Content]
Please press Ctrl+C to copy the contents of this dialog and report this error to our issue tracker.

[^] Hide details  [Schließen]

[Expanded Information]
Build: 16.11.21196.2

System.ArgumentException: Falscher Parameter. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
   at EnvDTE.ConfigurationManager.get_ActiveConfiguration()
   at Microsoft.PythonTools.Project.PythonProjectNode.SetCurrentConfiguration()
   at Microsoft.VisualStudioTools.Project.ProjectNode.GetMsBuildProperty(String propertyName, Boolean resetCache)
   at Microsoft.VisualStudioTools.Project.ProjectNode.GetProjectProperty(String propertyName, Boolean resetCache)
   at Microsoft.PythonTools.Project.CondaEnvCreateProjectInfoBar.<CheckAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.PythonTools.Project.PythonProjectNode.<TriggerInfoBarsAsync>d__107.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.PythonTools.Infrastructure.VSTaskExtensions.<HandleAllExceptions>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

Error on Debug

Image

Configuration information (If you are providing a diagnostics file (see below), skip this section)
VS Version: Version 16.11.41
PTVS version: 16.11.21196.2
Python version: 3.12.0
Debugger Type (if applicable): [New debugger or legacy debugger?]

Diagnostics file
I was not able to locate a diagnostics file in the Temp Directory

One last note:
To me, there is no apparent reason as to when I am able to debug when launching a pyproj. Sometimes it works, sometimes it doesn't. Sometimes I need to restart Visual Studio.
It would be very helpful if the the displayed dialog contained more information on why launching is not possible.

@KerstinKeller
Copy link
Author

It also seems to be related to the pyproj Files themselves. Take the following:

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == 'RelWithDebInfo' ">
    </Configuration>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>ed257ab2-033d-3b6e-9c0e-9ee5d38d9d8c</ProjectGuid>
    <ProjectHome>.</ProjectHome>
    <StartupFile>D:/github/project/lang/python/samples/core/service/file.py</StartupFile>
    <SearchPath>..\..\..\..\bin\RelWithDebInfo\python</SearchPath>
    <WorkingDirectory>.</WorkingDirectory>
    <OutputPath>.</OutputPath>
    <Name>py_minimal_service_client</Name>
    <RootNamespace>py_minimal_service_client</RootNamespace>
    <InterpreterId>MSBuild|debugging-env|$(MSBuildProjectFullPath)</InterpreterId>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'RelWithDebInfo' ">
    <DebugSymbols>true</DebugSymbols>
    <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugSymbols>true</DebugSymbols>
    <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
  </PropertyGroup>
  <ItemGroup>
    <Compile Include="D:/github/project/lang/python/samples/core/service/file.py" />
  </ItemGroup>
  <ItemGroup>
    <Interpreter Include="C:/Users/xxx/AppData/Local/Programs/Python/Python312">
      <Id>debugging-env</Id>
      <Version>0.0</Version>
      <Description>Debugging Environment (Python 3.12.0 )</Description>
      <InterpreterPath>C:/Users/xxx/AppData/Local/Programs/Python/Python312/python.exe</InterpreterPath>
      <WindowsInterpreterPath>C:/Users/xxx/AppData/Local/Programs/Python/Python312/python.exe</WindowsInterpreterPath>
      <PathEnvironmentVariable>PYTHONPATH</PathEnvironmentVariable>
      <Architecture>X64</Architecture>
    </Interpreter>
  </ItemGroup>
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" />
  <!-- Uncomment the CoreCompile target to enable the Build command in
       Visual Studio and specify your pre- and post-build commands in
       the BeforeBuild and AfterBuild targets below. -->
  <!--<Target Name="CoreCompile" />-->
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
</Project>

The files are generated like this, because I want to be able to debug the RelWithDebInfo builds, for C++ extensions which are build with nanobind.
Especially the first property group seems to cause problems sometimes, when I change

    <Configuration Condition=" '$(Configuration)' == 'RelWithDebInfo' ">

to

    <Configuration Condition=" '$(Configuration)' == 'Release' ">

there is a higher chance that I can actually use the debugger.

@StellaHuang95
Copy link
Contributor

The problem is corruption in the .vs folder. Could you please delete the .vs folder in your project folder and see if the problem disappears?

When you delete the .vs folder, VS will rebuild it automatically when VS is restarted.

Please see #8027 for more details.

If this does not work, please reopen the issue. Thanks for raising this issue.

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

No branches or pull requests

3 participants