You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deserializing YAML throws InvalidOperationException with message 'Cannot read the Value of an empty anchor'
Hello,
Here is my code:
MyClass? ParseYaml(ArgumentResult _, TextReader reader)
{
var yamlStream = new YamlStream();
yamlStream.Load(reader);
var doc = yamlStream.Documents[0].ToJsonDocument();
return doc.Deserialize<MyClass>();
}
But from the last line, it throws an InvalidOperationException exception (see below) with the message 'Cannot read the Value of an empty anchor'. Am I missing something in my YAML (see below)?
Thank you
Val
System.InvalidOperationException
HResult=0x80131509
Message=Cannot read the Value of an empty anchor
Source=YamlDotNet
StackTrace:
at YamlDotNet.Core.AnchorName.get_Value()
at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer) in /_/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonPropertyInfoOfT.cs:line 229
at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state) in /_/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Converters/Object/ObjectDefaultConverter.cs:line 340
at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state) in /_/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonConverterOfT.cs:line 430
...
[Call Stack Truncated]
This exception was originally thrown at this call stack:
YamlDotNet.Core.AnchorName.Value.get()
System.Text.Json.Serialization.Metadata.JsonPropertyInfo<T>.GetMemberAndWriteJson(object, ref System.Text.Json.WriteStack, System.Text.Json.Utf8JsonWriter) in JsonPropertyInfoOfT.cs
System.Text.Json.Serialization.Converters.ObjectDefaultConverter<T>.OnTryWrite(System.Text.Json.Utf8JsonWriter, T, System.Text.Json.JsonSerializerOptions, ref System.Text.Json.WriteStack) in ObjectDefaultConverter.cs
...
[Call Stack Truncated]
Here is the YAML:
description: Test CLI deployment
workload:
serviceNamespace: Pool
name: TestWorkload
description: Example CLI workload
version: 0.0.0
packageFilename: TBD
selectors:
os: windows
dotnet-framework: net6.0
tolerations:
- key: os
value: windows
effect: NoExecute
operator: Equal
environmentVariables:
Logging__LogLevel__Default: Information
Logging__LogLevel__Microsoft: Warning
entryPoint: Delinea.EnginePool.TestWorkload.Console.exe
arguments: arg1 arg2
settingTemplates:
- key: ID
name: Unique identifier
valueType: uuid
description: Some unique identifier
- key: dns
name: DNS server address
valueType: string
description: Address of the DNS server
secretTemplates:
- key: secret-key1
name: Secret Key No1
description: This is the secret 1
- key: secret-key2
name: Secret Key No2
description: This is the secret 2
deprecated: false
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Deserializing YAML throws InvalidOperationException with message 'Cannot read the Value of an empty anchor'
Hello,
Here is my code:
But from the last line, it throws an
InvalidOperationException
exception (see below) with the message 'Cannot read the Value of an empty anchor'. Am I missing something in my YAML (see below)?Thank you
Val
Here is the YAML:
Code of Conduct
The text was updated successfully, but these errors were encountered: