jfrog / jfrog-visual-studio-extension

Apache License 2.0
13 stars 12 forks source link

JFrog Extension (v2.0.0) is timing out when generating the NuGet dependency tree in Visual Studio (2022) #31

Closed davigravi closed 2 months ago

davigravi commented 1 year ago

Xray: v3.82.10 JFrog Extension: v2.0.0 Visual Studio 2022

When using the JFrog Extension (v2.0.0) to scan .NET projects in Visual Studio 2022, the scan will timeout when generating the NuGet dependency tree. The scan will complete successfully for smaller projects despite taking several minutes. When scanning a large project, it will timeout. Additionally, latency is experienced in the Visual Studio UI after having initiated a scan.

Are there timeout settings we may tune for the JFrog Extension or changes we can make to enhance performance?

iamhuwjones commented 11 months ago

Exactly the same symptoms for me running: Visual Studio 2022 17.8.0 with JFrog V2 extension version 2.0.0 connecting the JFrog Cloud platform. Smaller solutions will produce scan results, but does freeze the UI for around 10 seconds. Larger solution scans cause the VS 2022 IDE to crash with this stack trace Application: devenv.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.ObjectDisposedException at System.Runtime.InteropServices.SafeHandle.DangerousAddRef(Boolean ByRef) at System.StubHelpers.StubHelpers.SafeHandleAddRef(System.Runtime.InteropServices.SafeHandle, Boolean ByRef) at Microsoft.Win32.Win32Native.SetEvent(Microsoft.Win32.SafeHandles.SafeWaitHandle) at System.Threading.EventWaitHandle.Set() at JFrogVSExtension.Utils.Util+<>c__DisplayClass6_1.b__0(System.Object, System.Diagnostics.DataReceivedEventArgs) at System.Diagnostics.Process.OutputReadNotifyUser(System.String) at System.Diagnostics.AsyncStreamReader.FlushMessageQueue() at System.Diagnostics.AsyncStreamReader.ReadBuffer(System.IAsyncResult) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.IO.Stream+ReadWriteTask.System.Threading.Tasks.ITaskCompletionAction.Invoke(System.Threading.Tasks.Task) at System.Threading.Tasks.Task.FinishContinuations() at System.Threading.Tasks.Task.Finish(Boolean)

indicating an issue at https://github.com/jfrog/jfrog-visual-studio-extension/blob/59cba5e8f4980da6b52b11787394c2f139731cc0/JFrogVSExtension/Utils/Util.cs#L110C57-L110C57

Or-Geva commented 11 months ago

Thank you, @iamhuwjones and @davigravi, for providing your reports. We appreciate the time you've taken to open this issue. After reviewing your outputs, it appears that we've set a timeout in this section of the code (referenced at https://github.com/jfrog/jfrog-visual-studio-extension/blob/59cba5e8f4980da6b52b11787394c2f139731cc0/JFrogVSExtension/Utils/Util.cs#L175).

For some unknown reason, this operation is taking longer than our expected duration. Could you kindly install the JFrog CLI and execute the command jf rt nuget-deps-tree, then share the duration it takes to complete on your end? This information will help us determine whether we need to adjust the timeout duration or consider removing it altogether. Your assistance in this matter will be highly valuable.

iamhuwjones commented 11 months ago

Thanks for the quick follow-up. For my first smaller solution the jf command running from Powershell took 43 seconds to complete. The jfrog Xray scan completes successfully, albeit slowly, in Visual Studio 2022.

For my second larger solution it took 2 minutes 10 seconds from Powershell. When using this solution in Visual Studio 2022, the scan will cause the IDE to crash after a period of time.

Either way it does tend to freeze the IDE for a while.

Hopefully this helps.

Or-Geva commented 11 months ago

Thanks, @iamhuwjones! Would you be able to share a project that reproduces the IDE crashing after a certain period of time?

iamhuwjones commented 11 months ago

Unfortunately, I am unable to do that as it is a company proprietary application.

RobinDink commented 7 months ago

I am having the same issue including Visual Studio crashing. jf rt nuget-deps-tree via Powershell took 114,8182939 seconds.

And no, I can't share our source code.

hadarshjfrog commented 2 months ago

Timeout issue resolved in https://github.com/jfrog/jfrog-visual-studio-extension/releases/tag/vs22-2.0.1