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

Timed out while connecting to named pipe: DesignToolsServer #6420

Closed
nathan130200 opened this issue Dec 25, 2021 · 19 comments · Fixed by #6712
Closed

Timed out while connecting to named pipe: DesignToolsServer #6420

nathan130200 opened this issue Dec 25, 2021 · 19 comments · Fixed by #6712
Assignees
Labels
area-VSDesigner Windows Forms out-of-proc designer related issues

Comments

@nathan130200
Copy link

nathan130200 commented Dec 25, 2021

  • .NET Core Version:
    .NET 6.0.100

  • .NET Info Command

SDK do .NET (refletindo qualquer global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

Ambiente de runtime:
 OS Name:     Windows
 OS Version:  10.0.19042
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   c:\program files\dotnet\sdk\6.0.100\

Host (useful for support):
  Version: 6.0.0
  Commit:  4822e3c3aa

.NET SDKs installed:
  5.0.207 [c:\program files\dotnet\sdk]
  6.0.100 [c:\program files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.10 [c:\program files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.0 [c:\program files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.10 [c:\program files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0 [c:\program files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 5.0.10 [c:\program files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.0 [c:\program files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
  • Have you experienced this same bug with .NET Framework?:
    No

Problem description:
Attemt to open winforms designer on NET6 fail everytime.

If i both add <TargetPlatforms>net472;net6.0-windows</TargetPlatforms> for both net6.0-windows and net472, the designer open, but open old .NET Framework designet (that works too for .net 6), but i must be forced to reference net framework in csproj.

Since .net core/net 6 desktop support, the designer NEVER WORKED.

Stuck on this:
image

Expected behavior:
Open winform designer.

Minimal repro:
Create empty winform project on VS2022 and try open Form1 designer.

Output from VS2022:

[16:30:43.1921519] Creating VSCodeDomDesignerLoader
[16:30:45.1771483] Processed 'System.Design' in 00:00:04.1270162
[16:30:45.2051489] Added 'System.Design'
[16:30:45.2051489] Loaded System.Drawing.Design in 00:00:00.0000212 [thread 10]
[16:30:45.2091460] Processed 'System.Drawing.Design' in 00:00:00.0042542
[16:30:45.2101469] Added 'System.Drawing.Design'
[16:30:45.3011495] Start processing enqueued assemblies
[16:30:45.3021480] Loaded Microsoft.WinForms.DesignTools.Protocol in 00:00:00.0000206 [thread 10]
[16:30:45.4881486] Processed 'Microsoft.WinForms.DesignTools.Protocol' in 00:00:00.1868933
[16:30:45.4941472] Added 'Microsoft.WinForms.DesignTools.Protocol'
[16:30:45.4951483] Loaded Microsoft.WinForms.DesignTools.Client in 00:00:00.0000363 [thread 87]
[16:30:45.7031461] Processed 'Microsoft.WinForms.DesignTools.Client' in 00:00:00.2081947
[16:30:45.7081489] Added 'Microsoft.WinForms.DesignTools.Client'
[16:30:54.2412176] [CraftMonitor]: Preparing shadow cache folder
[16:30:54.2442114] [CraftMonitor]: Copying design tools server common files from: 'c:\program files\microsoft visual studio\2022\preview\common7\ide\commonextensions\microsoft\windows.forms\DesignToolsServer\Common'
[16:31:03.1555740] [CraftMonitor]: Copying design tool server platform-specific files from: 'c:\program files\microsoft visual studio\2022\preview\common7\ide\commonextensions\microsoft\windows.forms\DesignToolsServer\x64'
[16:31:03.3375745] [CraftMonitor]: Copying 'C:\Users\natha\source\repos\CraftMonitor\CraftMonitor\obj\Debug\net6.0-windows\CraftMonitor.designer.deps.json' to 'DesignToolsServer.deps.json'
[16:31:03.3495751] [CraftMonitor]: Copying 'C:\Users\natha\source\repos\CraftMonitor\CraftMonitor\obj\Debug\net6.0-windows\CraftMonitor.designer.runtimeconfig.json' to 'DesignToolsServer.runtimeconfig.json'
[16:31:03.6065745] [CraftMonitor]: Launching design tools server process...
[16:31:14.6486408] [CraftMonitor]: Timed out while connecting to named pipe: DesignToolsServer.f02e0df7-a9d3-43a5-952b-8d79b383c9b1
[16:31:14.9206458] Microsoft.DotNet.DesignTools.Client.ServerException: Timed out while connecting to named pipe.
                      at Microsoft.DotNet.DesignTools.Client.Host.ServerProcess.<ConnectToStreamAsync>d__30.MoveNext()
                   --- 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.DotNet.DesignTools.Client.Host.ServerProcess.<LaunchAsync>d__25.MoveNext()
                   --- 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.DotNet.DesignTools.Client.Host.ServerHostFactory.<CreateHostAsync>d__7.MoveNext()
                   --- 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.DotNet.DesignTools.Client.DesignToolsClientLoader.<CreateClientAsync>d__35.MoveNext()
                   --- End of stack trace from previous location where exception was thrown ---
                      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
                      at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

Sometimes in Output window only display first line:

[16:30:43.1921519] Creating VSCodeDomDesignerLoader

  • CSProj file created by dotnet new command targeting windows desktop:
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net6.0-windows</TargetFramework>
    <Nullable>enable</Nullable>
    <UseWindowsForms>true</UseWindowsForms>
    <ImplicitUsings>enable</ImplicitUsings>
  </PropertyGroup>

</Project>

Steps i tried:

  • Reinstall VS and .NET SDK
  • Open both regular version or preview from VS2022
  • Reopen file

None of these worked.

3jRwY9y3qk.mp4
@dreddy-work
Copy link
Member

@Shyam-Gupta / @RussKie can you guys take a look here and map it to the issue in designer repo?

@nathan130200
Copy link
Author

Hello, someone?

@dreddy-work
Copy link
Member

Linking the similar bugs together #6492. I am guessing they both have same root cause.

@Shyam-Gupta
Copy link
Member

@nathan130200 Could you please share Windows EventVwr logs for DesignToolsServer.exe when this issue occur.

@foller
Copy link

foller commented Jan 14, 2022

I had the same problem today.
By taking a good look at the errors and things I messed with before the error started happening. I verified that it is looking for the file from the temp folder. One of my projects has a reference to a project with a higher version and that caused an error when loading the logger. I tested it by deleting the contents of the Temp folder and creating a new project. That solved the problem. I went back in the project and removed the references to packages with a higher version. I deleted the data from the temp folder and ran it again. Worked perfectly.
Before that I had tried reinstalling windows, installed VS 2022, went back pc updates and nothing worked.

The solution was to upgrade the project's version from .net 5 to .net 6 or remove the reference project with the highest version and delete the contents of the temp folder.

@Bajotumn
Copy link

I was able to successfully work around this issue for myself and my team in a 110 project solution.

We added the DesignToolsServer.exe to Windows Defender exceptions so that it is not slowed down by the system call hooks Defender uses to provide real-time protection. The issue has not gone away completely but is now only a minor inconvenience since once the server has started it persists for the lifetime of the Visual Studio run.

Add-MpPreference -ExclusionProcess 'DesignToolsServer.exe'

@nathan130200
Copy link
Author

nathan130200 commented Jan 14, 2022

@Shyam-Gupta i had same issue, first time show exception "Timeout while connecting remote pipe", next time i try open form, don't show up any logs, neither on Windows Event Viewer also:

sigWZTKt8g.mp4

Its a fresh winforms project.

@nathan130200
Copy link
Author

nathan130200 commented Jan 14, 2022

Also in taskmgr don't show up, DesigntToolsServer trying to start

6jAXTGIfZs.mp4

Once its crash first time, design tools server don't attempt to start again even if i open any form/control.

@Shyam-Gupta
Copy link
Member

@nathan130200 Thank you so much for sharing the videos. The error regarding DesignerRuntimeImplementationProjectOutputGroup is different. Due to this error, WinForms designer will not try to launch DesignToolsServer process. Also it tries to launch process for the first time designer is opened. Subsequent closing and reopening of designer will not trigger DesignToolsServer process launch.

I created a new Windows 10 virtual machine and installed Visual Studio 2022, 17.0.5 version. I created both net5.0-windows and net6.0-windows projects but couldn't repro the issue. Hence I think there is something in the environment I am missing.

Please let me know if you have other Visual Studio versions installed side by side on the same machine. You mentioned that the error reproes even for new WinForms projects. Let me know if you are using Visual Studio new project creation wizard or dotnet.exe command line tool to create the project.

Do you see any error if you create a 6.0 WinForms project, build it and then try to launch the project exe directly from its bin\debug directory ? If it fail then check EventVwr for errors.

In mean time, I will try to add more diagnostic logs in the product and get back.

Thanks again for working with me to get to the root cause of this problem.

FYI: @merriemcgaw

@nathan130200
Copy link
Author

nathan130200 commented Jan 16, 2022

I just have VS2022 preview installed, also i did some tests, if i close and reopen project DesignToolsServer was able to start. But its a bit confused. I think isn't supposed to i be forced to close/reopen project, specially some big projects that take some times to load.

Also building and running directly from .exe or debugging inside VS works fine, just designer don't start at once.

@Shyam-Gupta
Copy link
Member

@nathan130200 Earlier designer was copying all the files present in project output directory to a temp folder from where DesignToolsServer process gets launched. But in 17.1 Preview 2 we have made improvements in this scenario and only a small subset of files, which are essential for the designer, will get copied. It will reduce the overall time taken to launch the designer especially for large projects\solutions.

Hence I request you to try the scenario in 17.1 Preview 2 or newer versions and share your feedback.

@merriemcgaw merriemcgaw assigned RussKie and unassigned Shyam-Gupta Jan 19, 2022
@merriemcgaw merriemcgaw added this to the .NET 7.0 milestone Jan 19, 2022
@RussKie RussKie added the area-VSDesigner Windows Forms out-of-proc designer related issues label Jan 19, 2022
@RussKie RussKie modified the milestones: .NET 7.0, VS release Jan 19, 2022
@violarulan
Copy link

violarulan commented Jan 22, 2022

Happened in Current(stable) sersion visual studio 2022 with a C#(net6.0-windows) project and I believe it is the same issue.
In current: open solution, open designer, looks fine but some attributes drag down menu shows nothing (imgur), then after some seconds VS crashes.

After switching to Preview(17.1.0 Preview 3), it shows

at Microsoft.DotNet.DesignTools.Client.Host.ServerProcess.d__30.MoveNext()
--- 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.DotNet.DesignTools.Client.Host.ServerProcess.d__25.MoveNext()
--- 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.DotNet.DesignTools.Client.Host.ServerHostFactory.d__7.MoveNext()
--- 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.DotNet.DesignTools.Client.DesignToolsClientLoader.d__28.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.DotNet.DesignTools.Client.DesignToolsClientLoader.d__28.MoveNext()
--- 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.DotNet.DesignTools.Client.DesignToolsClientLoader.<>c__DisplayClass24_1.<<-ctor>b__1>d.MoveNext()
--- 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.DotNet.DesignTools.Client.DesignToolsClientLoader.d__26.MoveNext() 
C:\Users\masah>"c:\Program Files\dotnet\dotnet.exe" --list-runtimes
Microsoft.AspNetCore.App 6.0.1 [c:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.13 [c:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.1 [c:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 5.0.13 [c:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.1 [c:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

@danelec-hpm
Copy link

danelec-hpm commented Jan 26, 2022

I solved this by removing this section from the csproj file:

  <ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>

@nathan130200
Copy link
Author

In my situation, i just type dotnet new winforms and used default csproj created, nothing different packages, and still same problem.

An workaround is close and reopen entire solution to make designer works, but isn't correct specially for big projects.

@merriemcgaw
Copy link
Member

@nathan130200 I wasn't able to repro on my machine - dotnet new winforms works perfectly and the project loads just how I'd expect. That said, we are increasing the timeout before DesignToolsServer gives up. Hopefully that will help your situation, and it will be out in the next Preview or 2. We're also spinning up some investments around diagnostics and helping both our users and us collect the information we need to troubleshoot problems. Keep checking out each new Preview and things will improve.

@nathan130200
Copy link
Author

nathan130200 commented Jan 27, 2022

The problem, is VS don't launch design tools server for the first time, idk what cause this. But at second time (after unload/reload entire solution), vs was able to copy design tools server and start.

The first time, VS attempt to connect to design tools server pipe, without begin started, so this cause "Timeout connecting to named pipe" because VS is waiting for connection to IPC, but since IPC never was requested to start for first time then cause exception.

Like i've said this happened since they release winforms for .net core, i was unable to start any project that uses winforms and new winforms designer (that i think is DesignToolsServer).

I will try record again to show.

I will wait for next preview and test if was solved, seems to be internal problem on visual studio not proper launching design tools server

@merriemcgaw
Copy link
Member

Thanks for the update. Given that this isn't happening to everyone I'm very curious about why it is happening on your installs. We will be adding more logging coverage and other diagnostic services so that we can better figure out what is impacting our customers. We'll let you know when that work is in a Preview so we can test it out together.

@RussKie
Copy link
Member

RussKie commented Feb 3, 2022

As an update.
As a tactical fix we have increase the connection timeout from 10 seconds to 2 minutes. This fix is expected to land in 17.1p5. The team is also working on a more strategic solution, that includes better error reporting and diagnostics, and perf improvements.

@RussKie RussKie closed this as completed Feb 3, 2022
@ghost ghost removed this from the VS release milestone Feb 3, 2022
@dotnet dotnet deleted a comment Feb 18, 2022
RussKie added a commit to RussKie/winforms that referenced this issue Feb 18, 2022
RussKie added a commit to RussKie/winforms that referenced this issue Feb 18, 2022
RussKie added a commit to RussKie/winforms that referenced this issue Feb 18, 2022
RussKie added a commit to RussKie/winforms that referenced this issue Feb 18, 2022
RussKie added a commit to RussKie/winforms that referenced this issue Feb 18, 2022
@ghost ghost added the 🚧 work in progress Work that is current in progress label Feb 18, 2022
@ghost
Copy link

ghost commented Feb 19, 2022

Hi @nathan130200, it looks like you just commented on a closed issue. The team will most probably miss it.
If you have a question - consider opening a new discussion thread. Alternatively, you'd like to bring something important up to their attention, consider filing a new issue and add enough details to build context.

@ghost ghost removed the 🚧 work in progress Work that is current in progress label Feb 21, 2022
@dotnet dotnet locked as resolved and limited conversation to collaborators Mar 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-VSDesigner Windows Forms out-of-proc designer related issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants