diff --git a/src/coreclr/tools/cdac-build-tool/DataDescriptorModel.cs b/src/coreclr/tools/cdac-build-tool/DataDescriptorModel.cs index 3abeb5c56e83c..d9d802d359978 100644 --- a/src/coreclr/tools/cdac-build-tool/DataDescriptorModel.cs +++ b/src/coreclr/tools/cdac-build-tool/DataDescriptorModel.cs @@ -185,10 +185,6 @@ public DataDescriptorModel Build() var globals = new Dictionary(); foreach (var (globalName, globalBuilder) in _globals) { - if (globalBuilder.Type == string.Empty) - { - throw new InvalidOperationException($"Type must be set for global {globalName}"); - } GlobalValue? v = globalBuilder.Value; if (v == null) { diff --git a/src/coreclr/tools/cdac-build-tool/JsonConverter/FieldModelJsonConverter.cs b/src/coreclr/tools/cdac-build-tool/JsonConverter/FieldModelJsonConverter.cs index 5b6631af52a0e..e86d76c18d23f 100644 --- a/src/coreclr/tools/cdac-build-tool/JsonConverter/FieldModelJsonConverter.cs +++ b/src/coreclr/tools/cdac-build-tool/JsonConverter/FieldModelJsonConverter.cs @@ -20,7 +20,7 @@ public override DataDescriptorModel.FieldModel Read(ref Utf8JsonReader reader, T public override void Write(Utf8JsonWriter writer, DataDescriptorModel.FieldModel value, JsonSerializerOptions options) { - if (value.Type is null) + if (string.IsNullOrEmpty(value.Type)) { writer.WriteNumberValue(value.Offset); } diff --git a/src/coreclr/tools/cdac-build-tool/JsonConverter/GlobalModelJsonConverter.cs b/src/coreclr/tools/cdac-build-tool/JsonConverter/GlobalModelJsonConverter.cs index cae54edb6ff10..310d02730e1ad 100644 --- a/src/coreclr/tools/cdac-build-tool/JsonConverter/GlobalModelJsonConverter.cs +++ b/src/coreclr/tools/cdac-build-tool/JsonConverter/GlobalModelJsonConverter.cs @@ -15,7 +15,7 @@ public override DataDescriptorModel.GlobalModel Read(ref Utf8JsonReader reader, public override void Write(Utf8JsonWriter writer, DataDescriptorModel.GlobalModel value, JsonSerializerOptions options) { - if (value.Type is null) + if (string.IsNullOrEmpty(value.Type)) { // no type: just write 'value' or '[value]' JsonSerializer.Serialize(writer, value.Value, options);