microsoft / vscode-dotnettools

This is a feedback repository to capture issues logged for the C# Dev Kit and related extensions from Visual Studio Code
Other
221 stars 10 forks source link

[pre-release 1.5.6] Crash on startup if VSCode data directories reside in junction'd folders (Windows) #1014

Closed mnmkay closed 4 months ago

mnmkay commented 6 months ago

Type: Bug

Title says it all. Steps to reproduce below. This didn't happen on the prior pre-release version I had before upgrading (sorry don't know the version).

Also important, it looks like potentially this pre-release version is ignoring the telemetry.telemetryLevel. This crash occurs regardless of that setting and looks related to it. If that's intended behavior to ignore, it' should probably be nociteably documented somewhere.


Extension version: 1.5.6 VS Code version: Code 1.87.2 (863d2581ecda6849923a2118d93a088b0745d9d6, 2024-03-08T15:20:17.278Z) OS version: Windows_NT x64 10.0.19043

Steps:

# in powershell
cd c:\
mkdir test
New-Item -Type Junction -Value C:\test -Path .\testlink
# C:\testlink is now a junction pont that points to C:\test
<PATH TO CODE.exe> --user-data-dir C:\testlink\data --extensions-dir C:\testlink\extensions
# 1. now install C# Dev Kit
# 2. open a C# folder
# 3. Dev Kit crashes on startup

Crash (C# Dev Kit, Output pane):

Error occurred in readTelemetryFileAsync: undefined
Starting Open a solution...
Starting Open a solution with environment service...
Starting Clear environment...
Starting Spawn .NET server...
Using local .NET runtime at "C:\testlink\data-dir\<USERNAME>\globalStorage\ms-dotnettools.vscode-dotnet-runtime\.dotnet\8.0.3~x64\dotnet.exe"
.NET server STDERR: Unhandled exception. 
.NET server STDERR: System.ArgumentException: filePath
 ---> System.UnauthorizedAccessException: Attempted to perform an unauthorized operation.
   at Microsoft.VisualStudio.Utilities.Internal.ReparsePointAware.PinAndRequireNoReparsePoints(String expectedPath, Boolean asDirectory)
   at Microsoft.VisualStudio.Utilities.Internal.ReparsePointAware.OpenFile(String path, FileMode mode, FileAccess access, FileShare share)
   at Microsoft.VisualStudio.Telemetry.CommonProperty.FileBasedKeyValuesLoader.GetData(TelemetrySession session, String filePath)
   --- End of inner exception stack trace ---
   at Microsoft.VisualStudio.Telemetry.CommonProperty.FileBasedKeyValuesLoader.GetData(TelemetrySession session, String filePath)
   at Microsoft.VisualStudio.Telemetry.CommonProperty.CommonPropertyParserFactory.GetCommonPropertyParser(TelemetrySessionInternalBase session)
   at Microsoft.VisualStudio.Telemetry.TelemetrySessionInternalBase.LoadCommonProperties()
   at Microsoft.VisualStudio.ManagedTelemetry.VSCodeTelemetry.CreateAndStartDefaultSession(String sessionSettings)
   at Microsoft.VisualStudio.ManagedTelemetry.VSCodeTelemetry.StartTelemetrySessionAndCollector(String vsCodeTelemetryLevel, String customSessionId)
   at Microsoft.VisualStudio.Server.ServiceBroker.Program.<>c.<<BuildCommandLine>b__7_1>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass18_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass13_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass20_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__19_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__6_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<CancelOnProcessTermination>b__1_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Invocation.InvocationPipeline.InvokeAsync(IConsole console)
   at System.CommandLine.Parsing.ParseResultExtensions.InvokeAsync(ParseResult parseResult, IConsole console)
   at System.CommandLine.Parsing.ParserExtensions.InvokeAsync(Parser parser, String[] args, IConsole console)
   at Microsoft.VisualStudio.Server.ServiceBroker.Program.Main(String[] args)
   at Microsoft.VisualStudio.Server.ServiceBroker.Program.<Main>(String[] args)

Error occurred in launchDotNetServer: Error: Stream terminated before required bytes were read.
Failed at 'Spawn .NET server' (11078ms) with error: Error: Stream terminated before required bytes were read.
Failed at 'Clear environment' (11081ms) with error: Error: Stream terminated before required bytes were read.
Failed at 'Open a solution with environment service' (11081ms) with error: Error: Stream terminated before required bytes were read.
Failed at 'Open a solution' (11089ms) with error: SolutionOpenError: Run into errors while opening the solution: Error: Stream terminated before required bytes were read.
Failed to open solution SolutionOpenError: Run into errors while opening the solution: Error: Stream terminated before required bytes were read.
.NET server exited with 3762504530
jonathanjyi commented 5 months ago

Thanks for reporting this. Thanks for listing the steps to reproduce. Will take a closer look.

jonathanjyi commented 5 months ago

Hi @mnmkay, to address your question regarding Telemetry. If you've set your Telemetry off, then no telemetry will be sent from the extension. What you're seeing are files that are used by C# Dev Kit for internal services.

arkalyanms commented 4 months ago

Removing the telemetry label since that aspect of it was fixed.

Michael-Eng commented 4 months ago

@jonathanjyi can this bug be resolved? @arkalyanms Is there something other than telemetry in this bug?

jonathanjyi commented 4 months ago

Hi @Michael-Eng, this is resolved, and shouldn't have any other componenets included. I'll remove the CPS tag.