VS 2019: Error occurred trying to load Windows Form: Value cannot be null Parameter propertyName

1.3k Views Asked by At

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.

1

There are 1 best solutions below

0
C.Callanan On

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.