aaubry / YamlDotNet

YamlDotNet is a .NET library for YAML

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Empty key is throwing an exception

zwcloud opened this issue · comments

Here is a meta file created by Unity for a managed dll:

fileFormatVersion: 2
guid: 29e75658b79a414a8525c35535b64f6c
PluginImporter:
  externalObjects: {}
  serializedVersion: 2
  iconMap: {}
  executionOrder: {}
  defineConstraints: []
  isPreloaded: 0
  isOverridable: 0
  isExplicitlyReferenced: 0
  validateReferences: 0
  platformData:
  - first:
      : Any
    second:
      enabled: 0
      settings:
        Exclude Android: 1
        Exclude Editor: 0
        Exclude Linux: 1
        Exclude Linux64: 1
        Exclude LinuxUniversal: 1
        Exclude OSXUniversal: 1
        Exclude Win: 1
        Exclude Win64: 1
  - first:
      Android: Android
    second:
      enabled: 0
      settings:
        CPU: ARMv7
  - first:
      Any: 
    second:
      enabled: 1
      settings: {}
  - first:
      Editor: Editor
    second:
      enabled: 1
      settings:
        CPU: AnyCPU
        DefaultValueInitialized: true
        OS: AnyOS
  - first:
      Facebook: Win
    second:
      enabled: 0
      settings:
        CPU: AnyCPU
  - first:
      Facebook: Win64
    second:
      enabled: 0
      settings:
        CPU: AnyCPU
  - first:
      Standalone: Linux
    second:
      enabled: 0
      settings:
        CPU: x86
  - first:
      Standalone: Linux64
    second:
      enabled: 0
      settings:
        CPU: None
  - first:
      Standalone: OSXUniversal
    second:
      enabled: 0
      settings:
        CPU: None
  - first:
      Standalone: Win
    second:
      enabled: 0
      settings:
        CPU: None
  - first:
      Standalone: Win64
    second:
      enabled: 0
      settings:
        CPU: None
  - first:
      Windows Store Apps: WindowsStoreApps
    second:
      enabled: 0
      settings:
        CPU: AnyCPU
  userData: 
  assetBundleName: 
  assetBundleVariant: 

Note this line : Any. It doesn't contain a valid key.

  platformData:
  - first:
      : Any
    second:

This is incorrect but Unity output this. So is it possible to safely ignore this line? Where is the code handling this? I'm willing to create a PR to support this.

BTW, this causes a ArgumentException here:

Issue with input parameters : System.ArgumentException: The current event is of an unsupported type. (Parameter 'parser')
   at YamlDotNet.RepresentationModel.YamlNode.ParseNode(IParser parser, DocumentLoadingState state)
   at YamlDotNet.RepresentationModel.YamlMappingNode.Load(IParser parser, DocumentLoadingState state)
   at YamlDotNet.RepresentationModel.YamlNode.ParseNode(IParser parser, DocumentLoadingState state)
   at YamlDotNet.RepresentationModel.YamlMappingNode.Load(IParser parser, DocumentLoadingState state)
   at YamlDotNet.RepresentationModel.YamlNode.ParseNode(IParser parser, DocumentLoadingState state)
   at YamlDotNet.RepresentationModel.YamlSequenceNode.Load(IParser parser, DocumentLoadingState state)
   at YamlDotNet.RepresentationModel.YamlNode.ParseNode(IParser parser, DocumentLoadingState state)
   at YamlDotNet.RepresentationModel.YamlMappingNode.Load(IParser parser, DocumentLoadingState state)
   at YamlDotNet.RepresentationModel.YamlNode.ParseNode(IParser parser, DocumentLoadingState state)
   at YamlDotNet.RepresentationModel.YamlMappingNode.Load(IParser parser, DocumentLoadingState state)
   at YamlDotNet.RepresentationModel.YamlNode.ParseNode(IParser parser, DocumentLoadingState state)
   at YamlDotNet.RepresentationModel.YamlDocument..ctor(IParser parser)
   at YamlDotNet.RepresentationModel.YamlStream.Load(IParser parser)

The issue may be in the scanner. Probably around here.

if (analyzer.Check(':') &&

It’s actually valid yaml. A key can be empty or null.

commented

I also have this issue