NullReferenceException in out-of-process designer if resource contains data of type System.Resources.ResXNullRef
- Dominant language
- C#
- Stars
- 4.9k
- Forks
- 1.1k
- Avg merge
- 20h 23m
- Merged PRs (30d)
- 103
Description
### Environment
Microsoft Visual Studio Professional 2022
Version 17.13.6
VisualStudio.17.Release/17.13.6+35931.197
Microsoft .NET Framework
Version 4.8.09032
### .NET version
.NET 9.0
### Did this work in a previous version of Visual Studio and/or previous .NET release?
_No response_
### Issue description
If a resource file within a project contains data of type System.Resources.ResXNullRef the desginer just shows this message:

### Steps to reproduce
Open and build the sample project, then open Form1.
[project.zip](https://github.com/user-attachments/files/20161884/project.zip)
### Diagnostics
```text
[15:01:38.274771] fail: StreamJsonRpc.RemoteInvocationException: Object reference not set to an instance of an object.
at StreamJsonRpc.JsonRpc.d__156`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__16.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__29.MoveNext()
RPC server exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.DotNet.DesignTools.Server.GlobalObjects.CodeDomBuilder.StronglyTypedResourceBuilder.Create(Dictionary`2 resourceList, String baseName, String generatedCodeNamespace, String resourcesNamespace, CodeDomProvider codeProvider, Boolean internalClass, String[]& unmatchable)
at Microsoft.DotNet.DesignTools.Server.GlobalObjects.CodeDomBuilder.StronglyTypedResourceBuilder.Create(Dictionary`2 resourceList, String baseName, String generatedCodeNamespace, CodeDomProvider codeProvider, Boolean internalClass, String[]& unmatchable)
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)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
```
Contributor guide
Assessment
This issue has not been assessed yet.