Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Crash after uninstalling package (ptvs) #576

@huguesv

Description

@huguesv
Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.IO.FileNotFoundException: Could not find file 'C:\Users\huvalo\source\repos\OpenFolderMixed\env\Lib\site-packages\cookies.py'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Microsoft.PythonTools.Interpreter.Ast.PythonModuleLoader.FromFile(IPythonInterpreter interpreter, String sourceFile, PythonLanguageVersion langVersion, String moduleFullName) in E:\A\_work\512\s\src\Analysis\Engine\Impl\Interpreter\Ast\PythonModuleLoader.cs:line 39
   at Microsoft.PythonTools.Interpreter.Ast.AstModuleResolution.ImportFromSearchPaths(String name, PathResolverSnapshot pathResolver) in E:\A\_work\512\s\src\Analysis\Engine\Impl\Interpreter\Ast\AstModuleResolution.cs:line 320
   at Microsoft.PythonTools.Interpreter.Ast.AstModuleResolution.<TryImportModuleAsync>d__17.MoveNext() in E:\A\_work\512\s\src\Analysis\Engine\Impl\Interpreter\Ast\AstModuleResolution.cs:line 204
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.PythonTools.Interpreter.Ast.AstPythonInterpreter.<ImportModuleAsync>d__33.MoveNext() in E:\A\_work\512\s\src\Analysis\Engine\Impl\Interpreter\Ast\AstPythonInterpreter.cs:line 135
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Microsoft.PythonTools.Interpreter.Ast.AstPythonInterpreter.ImportModule(String name) in E:\A\_work\512\s\src\Analysis\Engine\Impl\Interpreter\Ast\AstPythonInterpreter.cs:line 167
   at Microsoft.PythonTools.Analysis.ModuleTable.Reload() in E:\A\_work\512\s\src\Analysis\Engine\Impl\ModuleTable.cs:line 131
   at Microsoft.Python.LanguageServer.Implementation.Server.Interpreter_ModuleNamesChanged(Object sender, EventArgs e) in E:\A\_work\512\s\src\LanguageServer\Core\Impl\Implementation\Server.cs:line 402
   at Microsoft.PythonTools.Analysis.PythonAnalyzer.<ReloadModulesAsync>d__26.MoveNext() in E:\A\_work\512\s\src\Analysis\Engine\Impl\PythonAnalyzer.cs:line 151
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Python.LanguageServer.Implementation.Server.ReloadModulesQueueItem.Analyze(CancellationToken cancel) in E:\A\_work\512\s\src\LanguageServer\Core\Impl\Implementation\Server.cs:line 58
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Python.LanguageServer.Implementation.Server.<ReloadModulesAsync>d__50.MoveNext() in E:\A\_work\512\s\src\LanguageServer\Core\Impl\Implementation\Server.cs:line 272
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
}

Here's a simple repro:

Create new bottle application
Click Create when prompted to create a virtual env
Make sure you have app.py open, where there's an import bottle
Wait for virtual env creation/installation to complete
Click on Manage Packages on the python toolbar, click X to uninstall bottle.

Result: analyzer process crashes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions