Skip to content

Add ability to customise Winforms Designer Shadow Cache behaviour  #11242

@IrisPeter

Description

@IrisPeter

Environment

Microsoft Visual Studio Professional 2022
Version 17.10.0 Preview 4.0
VisualStudio.17.Preview/17.10.0-pre.4.0+34814.14
Microsoft .NET Framework
Version 4.8.09037

Installed Version: Professional

Visual C++ 2022 00476-80000-00000-AA711
Microsoft Visual C++ 2022

ASP.NET and Web Tools 17.10.319.52870
ASP.NET and Web Tools

C# Tools 4.10.0-3.24211.4+e482b6e281d7db727fcb086ebbfae44dcba82c6d
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

.NET version

.Net 4.8

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

Visual Studio 2019

Issue description

We have an assembly that contains a number of Winforms in Visual Studio 2019 if we opened any of these forms they would appear in the designer.

Ever since upgrading to VS2022 with the new out of process designer if we open a form from this assembly then we see a blank form and some loading progress and eventually the designer times out.

Before the designer times out we see a messagebox that comes from one of the other components in our build which indicates that it has attempted to log on to our configured database.

Upon investigation I've found that the Winforms Cache contains many of the files and folders that exist in our Release folder however it is missing an .ini file and 3 xml files that describe how to connect to the database

Winforms Cache Location:
C:\Users\LoggedIn.User\AppData\Local\Microsoft\VisualStudio\17.0_4ef73b8c\WinFormsDesigner\vfsezbfw.g4p

Please provide a method to allow configuring cache to satisfy any special requirements.

If I copy the 3 missing files to the cache folder then the Form loads properly

Steps to reproduce

  1. Open Visual Studio
  2. Open Solution containing our Forms assembly
  3. Editor times out

Diagnostics

[13:12:45.504945] fail: [Forms]: System.BadImageFormatException: Could not load file or assembly 'file:///C:\Users\LoggedIn.User\AppData\Local\Microsoft\VisualStudio\17.0_4ef73b8c\WinFormsDesigner\qn420yt1.bzk\UserAppData\x64\SQLite.Interop.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
                        File name: 'file:///C:\Users\LoggedIn.User\AppData\Local\Microsoft\VisualStudio\17.0_4ef73b8c\WinFormsDesigner\qn420yt1.bzk\UserAppData\x64\SQLite.Interop.dll'
                           at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
                           at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
                           at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
                           at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
                           at System.Reflection.Assembly.LoadFrom(String assemblyFile)
                           at Microsoft.DotNet.DesignTools.Services.TypeResolutionService.SafeLoadFromAssembly(String assemblyPath)
                        
                        Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
                        Running under executable  C:\Users\LoggedIn.User\AppData\Local\Microsoft\VisualStudio\17.0_4ef73b8c\WinFormsDesigner\qn420yt1.bzk\FxDesignToolsServer.exe
                        --- A detailed error log follows. 

                        === Pre-bind state information ===
                        LOG: Where-ref bind. Location = C:\Users\LoggedIn.User\AppData\Local\Microsoft\VisualStudio\17.0_4ef73b8c\WinFormsDesigner\qn420yt1.bzk\UserAppData\x64\SQLite.Interop.dll
                        LOG: Appbase = file:///C:/Users/LoggedIn.User/AppData/Local/Microsoft/VisualStudio/17.0_4ef73b8c/WinFormsDesigner/qn420yt1.bzk/
                        LOG: Initial PrivatePath = NULL
                        Calling assembly : (Unknown).
                        ===
                        LOG: This bind starts in LoadFrom load context.
                        WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
                        LOG: Using application configuration file: C:\Users\LoggedIn.User\AppData\Local\Microsoft\VisualStudio\17.0_4ef73b8c\WinFormsDesigner\qn420yt1.bzk\FxDesignToolsServer.exe.Config
                        LOG: Using host configuration file: 
                        LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
                        LOG: Attempting download of new URL file:///C:/Users/LoggedIn.User/AppData/Local/Microsoft/VisualStudio/17.0_4ef73b8c/WinFormsDesigner/qn420yt1.bzk/UserAppData/x64/SQLite.Interop.dll.
                        ERR: Failed to complete setup of assembly (hr = 0x80131018). Probing terminated.
                        

                        For information on how to troubleshoot the designer refer to the guide at https://aka.ms/winforms/designer/troubleshooting.
[13:12:45.506872] fail: [Forms]: System.BadImageFormatException: Could not load file or assembly 'file:///C:\Users\LoggedIn.User\AppData\Local\Microsoft\VisualStudio\17.0_4ef73b8c\WinFormsDesigner\qn420yt1.bzk\UserAppData\x86\SQLite.Interop.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
                        File name: 'file:///C:\Users\LoggedIn.User\AppData\Local\Microsoft\VisualStudio\17.0_4ef73b8c\WinFormsDesigner\qn420yt1.bzk\UserAppData\x86\SQLite.Interop.dll'
                           at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
                           at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
                           at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
                           at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
                           at System.Reflection.Assembly.LoadFrom(String assemblyFile)
                           at Microsoft.DotNet.DesignTools.Services.TypeResolutionService.SafeLoadFromAssembly(String assemblyPath)
                        
                        Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
                        Running under executable  C:\Users\LoggedIn.User\AppData\Local\Microsoft\VisualStudio\17.0_4ef73b8c\WinFormsDesigner\qn420yt1.bzk\FxDesignToolsServer.exe
                        --- A detailed error log follows. 

                        === Pre-bind state information ===
                        LOG: Where-ref bind. Location = C:\Users\LoggedIn.User\AppData\Local\Microsoft\VisualStudio\17.0_4ef73b8c\WinFormsDesigner\qn420yt1.bzk\UserAppData\x86\SQLite.Interop.dll
                        LOG: Appbase = file:///C:/Users/LoggedIn.User/AppData/Local/Microsoft/VisualStudio/17.0_4ef73b8c/WinFormsDesigner/qn420yt1.bzk/
                        LOG: Initial PrivatePath = NULL
                        Calling assembly : (Unknown).
                        ===
                        LOG: This bind starts in LoadFrom load context.
                        WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
                        LOG: Using application configuration file: C:\Users\LoggedIn.User\AppData\Local\Microsoft\VisualStudio\17.0_4ef73b8c\WinFormsDesigner\qn420yt1.bzk\FxDesignToolsServer.exe.Config
                        LOG: Using host configuration file: 
                        LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
                        LOG: Attempting download of new URL file:///C:/Users/LoggedIn.User/AppData/Local/Microsoft/VisualStudio/17.0_4ef73b8c/WinFormsDesigner/qn420yt1.bzk/UserAppData/x86/SQLite.Interop.dll.
                        ERR: Failed to complete setup of assembly (hr = 0x80131018). Probing terminated.
                        
                        For information on how to troubleshoot the designer refer to the guide at https://aka.ms/winforms/designer/troubleshooting.
[13:12:46.045539] fail: [Forms]: System.BadImageFormatException: Could not load file or assembly 'file:///C:\Users\LoggedIn.User\AppData\Local\Microsoft\VisualStudio\17.0_4ef73b8c\WinFormsDesigner\qn420yt1.bzk\UserAppData\chrome_elf.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
                        File name: 'file:///C:\Users\LoggedIn.User\AppData\Local\Microsoft\VisualStudio\17.0_4ef73b8c\WinFormsDesigner\qn420yt1.bzk\UserAppData\chrome_elf.dll'
                           at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
                           at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
                           at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
                           at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
                           at System.Reflection.Assembly.LoadFrom(String assemblyFile)
                           at Microsoft.DotNet.DesignTools.Services.TypeResolutionService.SafeLoadFromAssembly(String assemblyPath)
                        
                        Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
                        Running under executable  C:\Users\LoggedIn.User\AppData\Local\Microsoft\VisualStudio\17.0_4ef73b8c\WinFormsDesigner\qn420yt1.bzk\FxDesignToolsServer.exe
                        --- A detailed error log follows. 

                        === Pre-bind state information ===
                        LOG: Where-ref bind. Location = C:\Users\LoggedIn.User\AppData\Local\Microsoft\VisualStudio\17.0_4ef73b8c\WinFormsDesigner\qn420yt1.bzk\UserAppData\chrome_elf.dll
                        LOG: Appbase = file:///C:/Users/LoggedIn.User/AppData/Local/Microsoft/VisualStudio/17.0_4ef73b8c/WinFormsDesigner/qn420yt1.bzk/
                        LOG: Initial PrivatePath = NULL
                        Calling assembly : (Unknown).
                        ===
                        LOG: This bind starts in LoadFrom load context.
                        WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
                        LOG: Using application configuration file: C:\Users\LoggedIn.User\AppData\Local\Microsoft\VisualStudio\17.0_4ef73b8c\WinFormsDesigner\qn420yt1.bzk\FxDesignToolsServer.exe.Config
                        LOG: Using host configuration file: 
                        LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
                        LOG: Attempting download of new URL file:///C:/Users/LoggedIn.User/AppData/Local/Microsoft/VisualStudio/17.0_4ef73b8c/WinFormsDesigner/qn420yt1.bzk/UserAppData/chrome_elf.dll.
                        ERR: Failed to complete setup of assembly (hr = 0x80131018). Probing terminated.
                        
                        For information on how to troubleshoot the designer refer to the guide at https://aka.ms/winforms/designer/troubleshooting.
[13:12:46.393740] fail: [Forms]: System.BadImageFormatException: Could not load file or assembly 'file:///C:\Users\LoggedIn.User\AppData\Local\Microsoft\VisualStudio\17.0_4ef73b8c\WinFormsDesigner\qn420yt1.bzk\UserAppData\d3dcompiler_47.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
                        File name: 'file:///C:\Users\LoggedIn.User\AppData\Local\Microsoft\VisualStudio\17.0_4ef73b8c\WinFormsDesigner\qn420yt1.bzk\UserAppData\d3dcompiler_47.dll'
                           at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
                           at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
                           at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
                           at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
                           at System.Reflection.Assembly.LoadFrom(String assemblyFile)
                           at Microsoft.DotNet.DesignTools.Services.TypeResolutionService.SafeLoadFromAssembly(String assemblyPath)
                        
                        Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
                        Running under executable  C:\Users\LoggedIn.User\AppData\Local\Microsoft\VisualStudio\17.0_4ef73b8c\WinFormsDesigner\qn420yt1.bzk\FxDesignToolsServer.exe
                        --- A detailed error log follows. 

                        === Pre-bind state information ===
                        LOG: Where-ref bind. Location = C:\Users\LoggedIn.User\AppData\Local\Microsoft\VisualStudio\17.0_4ef73b8c\WinFormsDesigner\qn420yt1.bzk\UserAppData\d3dcompiler_47.dll
                        LOG: Appbase = file:///C:/Users/LoggedIn.User/AppData/Local/Microsoft/VisualStudio/17.0_4ef73b8c/WinFormsDesigner/qn420yt1.bzk/
                        LOG: Initial PrivatePath = NULL
                        Calling assembly : (Unknown).
                        ===
                        LOG: This bind starts in LoadFrom load context.
                        WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
                        LOG: Using application configuration file: C:\Users\LoggedIn.User\AppData\Local\Microsoft\VisualStudio\17.0_4ef73b8c\WinFormsDesigner\qn420yt1.bzk\FxDesignToolsServer.exe.Config
                        LOG: Using host configuration file: 
                        LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
                        LOG: Attempting download of new URL file:///C:/Users/LoggedIn.User/AppData/Local/Microsoft/VisualStudio/17.0_4ef73b8c/WinFormsDesigner/qn420yt1.bzk/UserAppData/d3dcompiler_47.dll.
                        ERR: Failed to complete setup of assembly (hr = 0x80131018). Probing terminated.
                        [start]                        

                        For information on how to troubleshoot the designer refer to the guide at https://aka.ms/winforms/designer/troubleshooting.
[13:12:48.154248] fail: [Forms]: System.IO.FileLoadException: Could not load file or assembly 'fvar-dd, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Attempt to load an unverifiable executable with fixups (IAT with more than 2 sections or a TLS section.) (Exception from HRESULT: 0x80131019)
                        File name: 'fvar-dd, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' ---> System.IO.FileLoadException: Attempt to load an unverifiable executable with fixups (IAT with more than 2 sections or a TLS section.) (Exception from HRESULT: 0x80131019)
                           at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
                           at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
                           at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
                           at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
                           at System.Reflection.Assembly.LoadFrom(String assemblyFile)
                           at Microsoft.DotNet.DesignTools.Services.TypeResolutionService.SafeLoadFromAssembly(String assemblyPath)
                        
                        

                        For information on how to troubleshoot the designer refer to the guide at https://aka.ms/winforms/designer/troubleshooting.
[13:12:48.165403] fail: [Forms]: System.IO.FileLoadException: Could not load file or assembly 'fvar-se, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Attempt to load an unverifiable executable with fixups (IAT with more than 2 sections or a TLS section.) (Exception from HRESULT: 0x80131019)
                        File name: 'fvar-se, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' ---> System.IO.FileLoadException: Attempt to load an unverifiable executable with fixups (IAT with more than 2 sections or a TLS section.) (Exception from HRESULT: 0x80131019)
                           at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
                           at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
                           at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
                           at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
                           at System.Reflection.Assembly.LoadFrom(String assemblyFile)
                           at Microsoft.DotNet.DesignTools.Services.TypeResolutionService.SafeLoadFromAssembly(String assemblyPath)

Metadata

Metadata

Assignees

Labels

area-VSDesignerWindows Forms out-of-proc designer related issues

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions