title: Exception when deserializing yaml file to property of abstract class using YamlDotNet
body: <p>Using YamlDotNet, I'm trying to deserialize a yaml file with a nested object graph into a set of custom .net types. This works if I set the tree property to a simple PopulationBasicNode, but when I use the PopulationAndNode as shown in the example, a YamlException is thrown:</p>
  <blockquote>
  <p>No node deserializer was able to deserialize the node into type PopulationTreeNode</p>
  </blockquote>
  <p>I thought that using the following extension method of the deserializer builder would make the deserializer being able to resolve the type.</p>
  <pre><code>WithTagMapping(&quot;!and&quot;, typeof(PopulationAndNode))
  </code></pre>
  <p>I also tried registering a INodeTypeResolver, but I still get the same expeption.</p>
  <pre><code>WithNodeTypeResolver(new PopulationNodeResolver())
  </code></pre>
  <pre><code>public class PopulationNodeResolver : INodeTypeResolver
      {
          public bool Resolve(NodeEvent nodeEvent, ref Type currentType)
          {
              if (nodeEvent.Tag == &quot;!and&quot;)
              {
                  currentType = typeof(PopulationAndNode);
                  return true;
              }
  
              return false;
          }
      }
  </code></pre>
  <pre><code># a population
  - id: some-id
    tree:
      !and
        - !basic
          someProperty: hello
        - !basic
          someProperty: world
  </code></pre>
  <pre class="lang-c# prettyprint-override"><code>public class Population
  {
      public string Id { get; set; }
      public PopulationTreeNode Tree { get; set; }
  }
  </code></pre>
  <pre class="lang-c# prettyprint-override"><code>public abstract class PopulationTreeNode
  {
      public string Id { get; set; }
  }
  </code></pre>
  <pre class="lang-c# prettyprint-override"><code>public class PopulationAndNode : PopulationTreeNode
  {
      public IEnumerable&lt;PopulationTreeNode&gt; Children { get; set; }
  }
  </code></pre>
  <pre class="lang-c# prettyprint-override"><code>public class PopulationBasicNode : PopulationTreeNode
  {
      public string SomeProperty { get; set; }
  }
  </code></pre>
  <pre class="lang-c# prettyprint-override"><code>var resourcePath = assembly.GetManifestResourceNames().Single(str =&gt; str.EndsWith(fileName));
  
  using Stream stream = assembly.GetManifestResourceStream(resourcePath);
  using StreamReader streamReader = new StreamReader(stream);
  var fileContent = streamReader.ReadToEnd();
  
  var deserializer = new DeserializerBuilder()
                  .WithNamingConvention(CamelCaseNamingConvention.Instance)
                  .WithTagMapping(&quot;!and&quot;, typeof(PopulationAndNode))
                  .WithTagMapping(&quot;!basic&quot;, typeof(PopulationBasicNode))
                  .Build();
  
  var populations = deserializer.Deserialize&lt;List&lt;Population&gt;&gt;(fileContent);
  </code></pre>
  <pre><code>YamlDotNet.Core.YamlException
    HResult=0x80131500
    Message=(Line: 34, Col: 9, Idx: 1055) - (Line: 35, Col: 7, Idx: 1066): No node deserializer was able to deserialize the node into type _.PopulationTreeNode, _, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
    Source=YamlDotNet
    StackTrace:
     at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
     at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
     at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.&lt;&gt;c__DisplayClass3_0.&lt;DeserializeValue&gt;b__0(IParser r, Type t)
     at YamlDotNet.Serialization.NodeDeserializers.ObjectNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func`3 nestedObjectDeserializer, Object&amp; value)
     at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
     at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
     at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.&lt;&gt;c__DisplayClass3_0.&lt;DeserializeValue&gt;b__0(IParser r, Type t)
     at YamlDotNet.Serialization.NodeDeserializers.CollectionNodeDeserializer.DeserializeHelper(Type tItem, IParser parser, Func`3 nestedObjectDeserializer, IList result, Boolean canUpdate)
     at YamlDotNet.Serialization.NodeDeserializers.CollectionNodeDeserializer.YamlDotNet.Serialization.INodeDeserializer.Deserialize(IParser parser, Type expectedType, Func`3 nestedObjectDeserializer, Object&amp; value)
     at YamlDotNet.Serialization.ValueDeserializers.NodeValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
     at YamlDotNet.Serialization.ValueDeserializers.AliasValueDeserializer.DeserializeValue(IParser parser, Type expectedType, SerializerState state, IValueDeserializer nestedObjectDeserializer)
     at YamlDotNet.Serialization.Deserializer.Deserialize(IParser parser, Type type)
     at YamlDotNet.Serialization.Deserializer.Deserialize[T](IParser parser)
     at YamlDotNet.Serialization.Deserializer.Deserialize[T](TextReader input)
     at YamlDotNet.Serialization.Deserializer.Deserialize[T](String input)
     at _() in _
  </code></pre>