-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
needs-area-labeluntriagedThe team needs to look at this issue in the next triageThe team needs to look at this issue in the next triage
Description
Root cause
.NET version
8.0.23
Did it work in .NET Framework?
Yes
Did it work in any of the earlier releases of .NET Core or .NET 5+?
7.0.20
Issue description
The CodeDomSerializerBase.GetTypeNameFromCodeTypeReference method returns an incorrect type name for the generic type, e.g. for the nullable int type it returns [[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] instead of System.Nullable`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]. The subsequent call to the manager.GetType method fails to resolve the string to a type.
Steps to reproduce
Run the following code:
class Program {
static void Main(string[] args) {
var serializer = new CodeDomSerializer();
var expr = new CodeTypeOfExpression(new CodeTypeReference(typeof(long?)));
var manager = new Manager();
var result = serializer.Deserialize(manager, expr);
}
}
class Manager : IDesignerSerializationManager {
//...
public object GetService(Type serviceType) {
if(serviceType == typeof(System.ComponentModel.Design.TypeDescriptionProviderService))
return null;
throw new NotImplementedException();
}
public Type GetType(string typeName) {
if(typeName == "System.Int64")
return typeof(long);
string expectedTypeName = $"System.Nullable`1[[{typeof(long).AssemblyQualifiedName}]]";
if(typeName != expectedTypeName)
throw new Exception("Type name is incorrect");
else
return typeof(long?);
}
//...
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
needs-area-labeluntriagedThe team needs to look at this issue in the next triageThe team needs to look at this issue in the next triage