自从几天前我们从 .NET 7 切换到 .NET 8 以来,我们无法再在 Designer 中打开 WinForms 表单。这似乎与 VS 2022 版本无关,因为我的同事在使用旧版本时也遇到了同样的问题我的17.9.3。修复没有帮助。我们正在编译为“AnyCPU”。
Windows Defender 的以下排除也没有帮助。
Add-MpPreference -ExclusionProcess 'devenv.exe'
Add-MpPreference -ExclusionProcess 'DesignToolsServer.exe'
Switch.System.IO.UseLegacyPathHandling
未设置。
“Windows 窗体输出”显示以下内容:
[12:35:28.990802] warn: [NWWMain]: Encountered an additional TypeRoutingDefinition for 'Infragistics.Win.UltraWinGrid.GridControlCodeDomSerializer'
[12:35:28.999814] fail: [NWWMain]: Failed to launch design tools server process process
System.InvalidOperationException: Multiple instances of 'ICollectionEditorFactory' exported with the name 'SeriesCollectionEditor'.
at Microsoft.DotNet.DesignTools.Factories.ObjectFactoryManager`2.AddFactories(IEnumerable`1 factories, Boolean throwOnDuplicates)
at Microsoft.DotNet.DesignTools.Factories.ObjectFactoryManager`2..ctor(IEnumerable`1 factories)
at lambda_method1203(Closure, LifetimeContext, CompositionOperation)
at System.Composition.Hosting.Core.LifetimeContext.GetOrCreate(Int32 sharingId, CompositionOperation operation, CompositeActivator creator)
at System.Composition.TypedParts.ActivationFeatures.LifetimeFeature.<>c__DisplayClass1_0.<RewriteActivator>b__0(LifetimeContext c, CompositionOperation o)
at System.Composition.Hosting.Core.CompositionOperation.Run(LifetimeContext outermostLifetimeContext, CompositeActivator compositionRootActivator)
at System.Composition.Hosting.Core.LifetimeContext.TryGetExport(CompositionContract contract, Object& export)
at System.Composition.Hosting.CompositionHost.TryGetExport(CompositionContract contract, Object& export)
at System.Composition.CompositionContext.GetExport(CompositionContract contract)
at System.Composition.CompositionContext.GetExport(Type exportType, String contractName)
at System.Composition.CompositionContext.GetExport[TExport](String contractName)
at System.Composition.CompositionContext.GetExport[TExport]()
at Microsoft.WinForms.Utilities.Shared.Mef.CompositionHostExtensions.GetRequiredExport[TExport](CompositionHost compositionHost)
at Microsoft.DotNet.DesignTools.Server.DesignToolsServer.<StartUpAsync>g__AddMefServiceToContainer|48_0[T]()
at Microsoft.DotNet.DesignTools.Server.DesignToolsServer.StartUpAsync(Boolean testMode, CancellationToken cancellationToken)
at Microsoft.DotNet.DesignTools.Server.DesignToolsServer.StartListeningAsync(Stream stream, TraceListener traceListener)
at Microsoft.DotNet.DesignTools.Server.Program.<>c__DisplayClass2_0.<<Main>b__1>d.MoveNext()
For information on how to troubleshoot the designer refer to the guide at https://aka.ms/winforms/designer/troubleshooting.
[12:35:29.004803] fail: Microsoft.DotNet.DesignTools.Client.ServerException: Failed to launch the design tools server process.
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Threading.TplExtensions.<WithTimeout>d__5.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__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.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.
[12:35:29.023802] warn: Cannot update selection in server process as Session is not connected.
[12:35:59.643728] warn: Cannot update selection in server process as Session is not connected.
同样的问题!找到了一些与旧的 .NET 框架相关的帖子,但在当前情况下没有任何帮助我!
任何提示表示赞赏!