Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty key is throwing an exception #776

Open
zwcloud opened this issue Feb 7, 2023 · 5 comments
Open

Empty key is throwing an exception #776

zwcloud opened this issue Feb 7, 2023 · 5 comments
Labels

Comments

@zwcloud
Copy link

zwcloud commented Feb 7, 2023

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)
@EdwardCooke
Copy link
Collaborator

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

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

@EdwardCooke
Copy link
Collaborator

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

@EdwardCooke EdwardCooke changed the title Is it possible to support or ignore an empty key? Empty key is throwing an exception Feb 10, 2023
@rgbav
Copy link

rgbav commented Mar 8, 2023

I also have this issue

@EdwardCooke
Copy link
Collaborator

Is this still an issue in the latest version?

@EdwardCooke
Copy link
Collaborator

In the deserializer there's nothing we can do since the .NET dictionary class doesn't allow null keys. However, it looks like the scanner isn't reading it correctly so the yamlstream doesn't pick it up. It sees the empty scalar, but after the colon it doesn't pick up the next scalar. I'm still researching it and will try and get a fix in before I put out the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants