Windows forms: Designer error "Value cannot be null. (Parameter 'propertyName') "
See original GitHub issue.NET Version: 5.0 VS2019 and VS2022 TargetFramework for all projects I tested is net5.0-windows.
- Have you experienced this same bug with .NET Framework?: No
Problem description:
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 for any of our Windows forms. This happens for all forms in one quite large project which is a startup project in our solution (we have 20 different forms).
If I try to add a new form to this project it has the same issue, if I try to add a new form to some other project in the same solution it works propertly.
I went back to VS 16.8.0 and SDK 5.0.100 and it works well, I can open the form in designer mode. but for VS 16.9.4 is still broken.
The output is as follows in 16.9.4:
Here is part of the Output log when I run a form in the designer:
[10:43:20.6132894] [SanXpert]: info: Microsoft.DotNet.DesignTools.Services.TypeResolutionService[0]
[10:43:20.6132894] [SanXpert]: Processed 'ICSharpCode.SharpZipLib' in 00:00:00.0055407
[10:43:20.6142871] [SanXpert]: info: Microsoft.DotNet.DesignTools.Services.TypeResolutionService[0]
[10:43:20.6142871] [SanXpert]: Added 'ICSharpCode.SharpZipLib'
[10:43:20.6152839] [SanXpert]: info: Microsoft.DotNet.DesignTools.Services.TypeResolutionService[0]
[10:43:20.6152839] [SanXpert]: Loaded Microsoft.WindowsAPICodePack in 00:00:00.0013430 [thread 10]
[10:43:20.6192736] [SanXpert]: info: Microsoft.DotNet.DesignTools.Services.TypeResolutionService[0]
[10:43:20.6192736] [SanXpert]: Processed 'Microsoft.WindowsAPICodePack' in 00:00:00.0041457
[10:43:20.6202707] [SanXpert]: info: Microsoft.DotNet.DesignTools.Services.TypeResolutionService[0]
[10:43:20.6202707] [SanXpert]: Added 'Microsoft.WindowsAPICodePack'
[10:43:20.6222659] [SanXpert]: info: Microsoft.DotNet.DesignTools.Services.TypeResolutionService[0]
[10:43:20.6222659] [SanXpert]: Loaded Microsoft.WindowsAPICodePack.Shell in 00:00:00.0017161 [thread 10]
[10:43:20.6611620] StreamJsonRpc.RemoteInvocationException: Value cannot be null. (Parameter 'propertyName')
at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>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.<InitializeAsync>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.<CreateClientAsync>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)
[10:43:20.6791137] [SanXpert]: info: Microsoft.DotNet.DesignTools.Services.TypeResolutionService[0]
[10:43:20.6791137] [SanXpert]: Processed 'Microsoft.WindowsAPICodePack.Shell' in 00:00:00.0574316
[10:43:20.6831026] [SanXpert]: info: Microsoft.DotNet.DesignTools.Services.TypeResolutionService[0]
[10:43:20.6831026] [SanXpert]: Added 'Microsoft.WindowsAPICodePack.Shell'
[10:43:20.6831026] [SanXpert]: info: Microsoft.DotNet.DesignTools.Services.TypeResolutionService[0]
[10:43:20.6831026] [SanXpert]: Loaded Accessibility in 00:00:00.0003100 [thread 10]
Expected behavior: When I click on the xxxDlg.cs file associated with a Windows form, I should see the form designer.
Minimal repro: It should be possible to repro this issue by loading a large project, designed in an older version of Visual Studio, and double clicking on one of the .cs files which usually loads the form designer view. The form designer view does not work in the new VS versions.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (7 by maintainers)
Top GitHub Comments
The fix will go out in 17.2 Preview3
I spent some time tinkering with MSBuild, and I think the following workaround should assign correct dependencies to all loc’ed resources with non-standard locale names: