dotnet / winforms

Windows Forms is a .NET UI framework for building Windows desktop applications.
MIT License
4.41k stars 980 forks source link

Form designer does not display #8209

Closed pedautreppe closed 1 week ago

pedautreppe commented 1 year ago

Environment

Version 17.4.1

.NET version

Has been reproed in

Did this work in a previous version of Visual Studio and/or previous .NET release?

No response

Issue description

When creating a new winform project (whatever the .net version - .NET5+), Visual Studio cannot open the Form Designer. The log (see diags below for full log) displays an error "Illegal characters in path".

I have checked :

I have tried :

Steps to reproduce

Diagnostics

[22:16:48.043750] info: Creating VsDesignerLoader
[22:16:49.227075] info: [Thread 1] Creating design-time ITypeResolutionService.
[22:16:50.626294] info: Start processing enqueued assemblies
[22:16:50.628291] trce: Loaded Microsoft.WinForms.DesignTools.Protocol in 00:00:00.0000525 [thread 97]
[22:16:51.888562] trce: Processed 'Microsoft.WinForms.DesignTools.Protocol' in 00:00:01.2603981
[22:16:51.940532] info: Added 'Microsoft.WinForms.DesignTools.Protocol'
[22:16:51.943529] trce: Loaded Microsoft.WinForms.DesignTools.Client in 00:00:00.0000619 [thread 26]
[22:16:52.297326] trce: Processed 'Microsoft.WinForms.DesignTools.Client' in 00:00:00.3534021
[22:16:52.331309] info: Added 'Microsoft.WinForms.DesignTools.Client'
[22:16:55.474517] info: Visual Studio culture: en-US (0x0409)
[22:16:55.474517] info: [Thread 62] Launching server...
[22:16:55.584469] info: Is processor architecture ARM64: False
[22:16:57.164555] trce: Processed 'System.Windows.Forms' in 00:00:00.0411825
[22:16:57.377433] info: Added 'System.Windows.Forms'
[22:16:57.377433] trce: Loaded System in 00:00:00.0000748 [thread 65]
[22:16:57.387437] trce: Processed 'System' in 00:00:00.0099693
[22:16:57.627303] info: Added 'System'
[22:16:57.627303] trce: Loaded System.Drawing in 00:00:00.0000568 [thread 95]
[22:16:57.628291] trce: Processed 'System.Drawing' in 00:00:00.0011485
[22:16:57.654284] info: Added 'System.Drawing'
[22:16:57.654284] trce: Loaded System.Design in 00:00:00.0001140 [thread 95]
[22:16:59.223385] trce: Processed 'System.Design' in 00:00:01.5679662
[22:16:59.368300] info: Added 'System.Design'
[22:16:59.368300] trce: Loaded System.Drawing.Design in 00:00:00.0001933 [thread 84]
[22:16:59.369309] trce: Processed 'System.Drawing.Design' in 00:00:00.0010410
[22:16:59.374309] info: Added 'System.Drawing.Design'
[22:17:10.032227] info: Shadow cache base directory: C:\Users\pierr\AppData\Local\Microsoft\VisualStudio\17.0_c8ea3289\WinFormsDesigner
[22:17:10.363043] fail: System.ArgumentException: Illegal characters in path.
                           at System.Security.Permissions.FileIOPermission.EmulateFileIOPermissionChecks(String fullPath)
                           at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
                           at Microsoft.WinForms.Utilities.Shared.ShadowCacheFolder..ctor(String shadowCacheBaseDirectory, Boolean isNetCoreProject)
                           at Microsoft.DotNet.DesignTools.Client.Host.ServerLayout.<CreateAsync>d__8.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.<CreateAsync>d__21.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__8.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__29.MoveNext()

                        For information on how to troubleshoot the designer refer to the guide at https://aka.ms/winforms/designer/troubleshooting.
[22:17:13.147454] warn: Cannot update selection in server process as Session is not connected.
merriemcgaw commented 1 year ago

I am not able to reproduce this on my local, just updated, install of VS 17.4. Would you be so kind as to provide a detailed path that you're trying to use? Are there any other steps you're following?

I assume you followed the instructions to run the troubleshooting instructions?

RussKie commented 1 year ago

Looks like for some reason VS can't access C:\Users\pierr\AppData\Local\Microsoft\VisualStudio\17.0_c8ea3289\WinFormsDesigner path. May worth double checking in Process Monitor (or a similar tool) whether there's something else in play.

pedautreppe commented 1 year ago

Indeed ! I have activated the verbose logging, increasing timeout, adding defender exceptions and checked system path override.

Yesterday, I have used Process Monitor, but I have not seen anything special, and by the way, I was not seeing anything related to the path "C:\Users\pierr\AppData\Local\Microsoft\VisualStudio\17.0_c8ea3289\WinFormsDesigner". I have also tried to do a full repair of Visual Studio, but I still get the same issue

My laptop is quite old and has seen migration from VS2015, 2019 and 2022. Maybe there some config remaining in some places that is the cause of this behavior.

dreddy-work commented 1 year ago

This issue must be specific to this machine. @pedautreppe , are you still facing this issue?

pedautreppe commented 1 year ago

I also think it must be related to something specific on this machine, and yes I am still facing this issue. "Hopefully" for me, my laptop has just had a motherboard issue and thus I will receive a new one next week. I will do a fresh clean install and will inform you if I encounter any issue on the new one.

merriemcgaw commented 1 week ago

Given this was specific to a certain machine, and we're not having any issues with this in 9 I am closing.