microsoft / PTVS

Python Tools for Visual Studio
https://aka.ms/PTVS
Apache License 2.0
2.52k stars 673 forks source link

Received "An unexpected error occurred" while attempting to type in the Debug Interactive panel #7857

Closed a-j-albert closed 2 months ago

a-j-albert commented 3 months ago

Describe the bug I had a python program running under the debugger in Visual Studio under Windows 11. I had the Debug Interactive panel open. I had been using Chrome to look some things up. When I returned to VS and tried to type something in to the panel, I received the "An unexpected error occurred" message.

Steps to Reproduce 1. 2. 3.

Expected behavior I should have been able to just type my command

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 [Close]

[Expanded Information]

Build: 17.0.23262.1

System.Runtime.InteropServices.COMException (0x800401D0): OpenClipboard Failed (Exception from HRESULT: 0x800401D0 (CLIPBRD_E_CANT_OPEN))
   at System.Runtime.InteropServices.ComTypes.IDataObject.GetData(FORMATETC& format, STGMEDIUM& medium)
   at System.Windows.DataObject.OleConverter.GetDataInner(FORMATETC& formatetc, STGMEDIUM& medium)
   at System.Windows.DataObject.OleConverter.GetDataFromOleHGLOBAL(String format, DVASPECT aspect, Int32 index)
   at System.Windows.DataObject.OleConverter.GetDataFromBoundOleDataObject(String format, DVASPECT aspect, Int32 index)
   at System.Windows.DataObject.OleConverter.GetData(String format, Boolean autoConvert, DVASPECT aspect, Int32 index)
   at System.Windows.DataObject.OleConverter.GetData(String format, Boolean autoConvert)
   at System.Windows.Clipboard.GetText(TextDataFormat format)
   at Microsoft.PythonTools.Repl.PythonCommonInteractiveEvaluator.FormatClipboard(IServiceProvider serviceProvider, IInteractiveWindow interactiveWindow)
   at Microsoft.PythonTools.Repl.ReplEditFilter.ExecWorker(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
   at Microsoft.PythonTools.Repl.ReplEditFilter.Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)

Sample Code

XXX

Configuration information (If you are providing a diagnostics file (see below), skip this section) VS Version: Microsoft Visual Studio Enterprise 2022 Version 17.8.7 VisualStudio.17.Release/17.8.7+34601.278 Microsoft .NET Framework Version 4.8.09032

Installed Version: Enterprise

Visual C++ 2022 00482-10000-00261-AA064 Microsoft Visual C++ 2022

ASP.NET and Web Tools 17.8.358.6298 ASP.NET and Web Tools

Azure App Service Tools v3.0.0 17.8.358.6298 Azure App Service Tools v3.0.0

C# Tools 4.8.0-7.23572.1+7b75981cf3bd520b86ec4ed00ec156c8bc48e4eb C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Cookiecutter 17.0.23262.1 Provides tools for finding, instantiating and customizing templates in cookiecutter format.

GitHub Copilot 1.137.0.0 (v1.137.0.0@2f127d06d) GitHub Copilot is an AI pair programmer that helps you write code faster and with less work.

GitHub Copilot Agent 1.137.0

Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

NuGet Package Manager 6.8.1 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Python - Profiling support 17.0.23262.1 Profiling support for Python projects.

Python with Pylance 17.0.23262.1 Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.

Test Adapter for Boost.Test 1.0 Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.

Test Adapter for Google Test 1.0 Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.

TypeScript Tools 17.0.20920.2001 TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 4.8.0-7.23572.1+7b75981cf3bd520b86ec4ed00ec156c8bc48e4eb Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 17.8.0-beta.23475.2+10f956e631a1efc0f7f5e49c626c494cd32b1f50 Microsoft Visual F# Tools

Visual Studio IntelliCode 2.2 AI-assisted development for Visual Studio.

PTVS version: Python with Pylance 17.0.23262.1 Python version: 3.10.4 Debugger Type (if applicable): [New debugger or legacy debugger?]

Diagnostics file PythonToolsDiagnostics_*.log don't exist

The diagnostics file contains information such as the Python version, environments, loaded assemblies, configuration options, etc. This file makes it easier for us to reproduce and fix bugs, so we would really appreciate it if you could provide it to us. To locate the logs, you can can follow these steps:

  1. Open the File Explorer on your computer.
  2. In the address bar at the top of the window, type %TEMP% and press Enter.
  3. The %TEMP% folder should open, look for file named PythonToolsDiagnostics_.log, where represents a series of numbers.

This file contain the diagnostic information that can help us diagnose and resolve the issue you're experiencing. Please note that the %TEMP% folder is a hidden system folder, so you may need to enable the display of hidden files and folders in File Explorer to see it. To do this, click on the "View" tab in File Explorer, then check the "Hidden items" box in the "Show/hide" section. You can attach the file to this issue or email it to us at ptvshelp@microsoft.com. If you email it, please add a link to this issue.

XXX
StellaHuang95 commented 3 months ago

Can you provide detailed repro steps and sample code for us to further investigate? Thanks.

github-actions[bot] commented 2 months ago

This issue was closed because it has been stalled for 30 days with no activity. If the issue still persists, please reopen with the information requested. Thanks.