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
You're trying to deserialize a mapping into a string which isn't going to work. If instead you did this in your while loop:
vardoc= yamlDeserializer.Deserialize<List<object>>(parser);
Console.WriteLine("## Document");foreach(Dictionary<object,object> item in doc){foreach(var kvp in item){
Console.WriteLine("{0}: {1}", kvp.Key, kvp.Value);}
Console.WriteLine("======");}
It will result in:
## Document
name: Install certbot
tags: setup
community.general.snap: System.Collections.Generic.Dictionary`2[System.Object,System.Object]
======
name: Create symlink for Certbot binary
tags: setup
ansible.builtin.file: System.Collections.Generic.Dictionary`2[System.Object,System.Object]
become: true
======
name: Check if the certificate was already generated
tags: generate_cert
ansible.builtin.stat: System.Collections.Generic.Dictionary`2[System.Object,System.Object]
register: cert_fullchain_file
======
name: Generate certificate manually
tags: generate_cert
ansible.builtin.command: System.Collections.Generic.Dictionary`2[System.Object,System.Object]
when: not cert_fullchain_file.stat.exists
======
Since you're not specifying a class you'll need to reference everything as the expected datatype in the yaml, either string, List<object> or Dictionary<object, object>. Where object will generally be one of string, List<object>, or Dictionary<object, object>.
Describe the bug
I'm encountering an issue while trying to load an Ansible task file, where I receive an exception related to deserialization.
When attempting to load the Ansible task file, the following exception arises:
To Reproduce
Here is the specific C# code I am executing:
The YAML file that I am trying to parse includes the following:
Any assistance in troubleshooting this issue would be greatly appreciated.
The text was updated successfully, but these errors were encountered: