VS 2019:尝试加载 Windows 窗体时发生错误:值不能为 null 参数 propertyName

发布于 2025-01-12 04:19:02 字数 3097 浏览 3 评论 0原文

由于以下错误,我的团队当前无法加载 Visual Studio 项目中的任何 Windows 窗体:值不能为空。 (参数“propertyName”)

当我们双击与任何 Windows 窗体关联的 [Dialog]Dlg.cs 文件时,就会发生此错误。

编辑:安装 VS 2022 后,会出现同样的问题,但现在至少我们得到了堆栈跟踪: StreamJsonRpc.RemoteInitationException:值不能为空。 (参数“属性名称”) 在 StreamJsonRpc.JsonRpc.d__143`1.MoveNext() --- 从先前抛出异常的位置开始的堆栈跟踪结束 --- 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在 Microsoft.DotNet.DesignTools.Client.Host.ServerHost.d__15.MoveNext() --- 从先前抛出异常的位置开始的堆栈跟踪结束 --- 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在 Microsoft.DotNet.DesignTools.Client.DesignToolsClientLoader.d__28.MoveNext() --- 从先前抛出异常的位置开始的堆栈跟踪结束 --- 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在 Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(异常异常对象) RPC服务器异常: System.ArgumentNullException:值不能为空。 (参数“属性名称”) 在 Microsoft.DotNet.DesignTools.Server.GlobalObjects.ResXGlobalObject.ResourceGlobalObject..ctor(ResXGlobalObject globalObject、ResXDataNode 节点、类型资源类型、字符串资源名称、字符串属性名称、字符串组合名称) 在 Microsoft.DotNet.DesignTools.Server.GlobalObjects.ResXGlobalObject.BuildType() 在 Microsoft.DotNet.DesignTools.Server.GlobalObjects.ResXGlobalObject.GetObjectType() 在 Microsoft.DotNet.DesignTools.Server.GlobalObjects.GlobalObject.get_ObjectType() 在 Microsoft.DotNet.DesignTools.Server.GlobalObjects.ResXGlobalObject.get_Children() 在 Microsoft.DotNet.DesignTools.Server.GlobalObjects.ProjectResXGlobalObjectProvider.AddResourcesToGlobalCollection(字符串标识符,GlobalResourceFileData globalResource) 在 Microsoft.DotNet.DesignTools.Server.GlobalObjects.ProjectResXGlobalObjectProvider.UpdateGlobalObjectCollectionStoreForSource(字符串标识符) 在 Microsoft.DotNet.DesignTools.Server.GlobalObjects.GlobalObjectProvider.InitializeOrUpdateProjectResources(GlobalResourceFileData[] 资源) 在 Microsoft.DotNet.DesignTools.Server.GlobalObjects.GlobalObjectService.InitializeOrUpdateGlobalResources(GlobalResourceFileData[] globalResources) 在 Microsoft.DotNet.DesignTools.Server.DesignToolsServer.InitializeAsync(ServerInitializationOptions options)

弹出:

在此处输入图像描述

我们正在使用 VS 2019 并定位.NET 5.0 我们还更新了 VS。当前版本为 VS Professional 2019 v16.11.10 (4.8.04084)。

我到处搜索但找不到这个特定问题的任何例子。几乎尝试了所有方法,包括关于“值不能为空”的类似问题的一些建议,例如编辑 AssemblyInfo.cs 和更改 ComVisible 等。

我们检查了 VS ActivityLog.xml,但此错误不会显示在日志中我们试图找到调试它的方法,但到目前为止,这些方法都对我们不起作用。我们很难修复“propertyName”,因为 VS 没有为我们提供一些关于它是什么的想法。

任何提示都值得赞赏,因为我们目前唯一的其他选择似乎是

2022 年 3 月 9 日更新 2: 16.8.0->单击我们的 cs 文件可以正确加载 Winform。 16.9.4(及更新版本)->它在 16.8 上被破坏

,如下所示:

在此处输入图像描述

更新 3,2022 年 3 月 14 日 请参阅 stacktrace - 感谢 MS,我们找到了一种获得更详细跟踪的方法,正如您现在在上面看到的那样。

My team are currently unable to load any of the Windows forms in our Visual Studio project due to this error: Value cannot be null. (Parameter 'propertyName')

This error occurs when we double click on the [Dialog]Dlg.cs file associated with any of our Windows forms.

Edit:After installing VS 2022, the same issue occurs but now at least we are given a stacktrace: StreamJsonRpc.RemoteInvocationException: Value cannot be null. (Parameter 'propertyName')
at StreamJsonRpc.JsonRpc.d__143`1.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.ServerHost.d__15.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.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
RPC server exception:
System.ArgumentNullException: Value cannot be null. (Parameter 'propertyName')
at Microsoft.DotNet.DesignTools.Server.GlobalObjects.ResXGlobalObject.ResourceGlobalObject..ctor(ResXGlobalObject globalObject, ResXDataNode node, Type resourceType, String resourceName, String propertyName, String combinedName)
at Microsoft.DotNet.DesignTools.Server.GlobalObjects.ResXGlobalObject.BuildType()
at Microsoft.DotNet.DesignTools.Server.GlobalObjects.ResXGlobalObject.GetObjectType()
at Microsoft.DotNet.DesignTools.Server.GlobalObjects.GlobalObject.get_ObjectType()
at Microsoft.DotNet.DesignTools.Server.GlobalObjects.ResXGlobalObject.get_Children()
at Microsoft.DotNet.DesignTools.Server.GlobalObjects.ProjectResXGlobalObjectProvider.AddResourcesToGlobalCollection(String identifier, GlobalResourceFileData globalResource)
at Microsoft.DotNet.DesignTools.Server.GlobalObjects.ProjectResXGlobalObjectProvider.UpdateGlobalObjectCollectionStoreForSource(String identifier)
at Microsoft.DotNet.DesignTools.Server.GlobalObjects.GlobalObjectProvider.InitializeOrUpdateProjectResources(GlobalResourceFileData[] resources)
at Microsoft.DotNet.DesignTools.Server.GlobalObjects.GlobalObjectService.InitializeOrUpdateGlobalResources(GlobalResourceFileData[] globalResources)
at Microsoft.DotNet.DesignTools.Server.DesignToolsServer.InitializeAsync(ServerInitializationOptions options)

Pop up :

enter image description here

We are using VS 2019 and targeting .NET 5.0
We've also updated VS. Currently on VS Professional 2019 v16.11.10 (4.8.04084).

I've searched everywhere but can't find any examples of this particular issue. Have tried almost everything, including some advice on similar issues with "Value cannot be null" such as editing the AssemblyInfo.cs and changing ComVisible, etc.

We have checked the VS ActivityLog.xml but this error doesn't show up in the log and we've tried to find ways to debug it but so far none of those methods have worked for us. It's hard for us to fix the "propertyName" is VS doesn't provide us with some ideas on what that is.

Any tips appreciated as our only other option at the moment seems to be to

Update 2, 9th March 2022:
16.8.0 -> Clicking on our cs file loads the Winform correctly.
16.9.4 (and newer) -> It is broken

On 16.8 it looks as follows:

enter image description here

Update 3, 14th March 2022
See stacktrace - thanks to MS we found a way to get a more detailed trace as you now see above.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鹿港巷口少年归 2025-01-19 04:19:02

显然这是一个错误,现在正在解决:
https://github.com/dotnet/winforms/issues/6849

请参阅上面的 git 线程可以为那些需要尽快启动的人查看当前的解决方法。

So apparently this is a bug, and it is now being worked on:
https://github.com/dotnet/winforms/issues/6849

Please see the above git thread to see the current workaround for those who need to get it going asap.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文