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

CustomAtribute TypeSignature nested generic type parse error #222

Closed
JPaja opened this issue Nov 27, 2021 · 1 comment
Closed

CustomAtribute TypeSignature nested generic type parse error #222

JPaja opened this issue Nov 27, 2021 · 1 comment
Labels
bug dotnet Issues related to AsmResolver.DotNet
Milestone

Comments

@JPaja
Copy link
Contributor

JPaja commented Nov 27, 2021

Describe the bug

On custom argument

 [TypeConverter(typeof(StringBasedTypeConverter<Transform, Transform.Parser>))]

on its serialized string representation

PaintDotNet.Markup.StringBasedTypeConverter`2[PaintDotNet.UI.Media.Transform,PaintDotNet.UI.Media.Transform+Parser], PaintDotNet.Base, Version=4.302.7947.34042, Culture=neutral, PublicKeyToken=null

it breaks when it gets to + character since its expecting closed bracket or comma.

From my observation + character should handle nested types

To Reproduce

var asm = AssemblyDefinition.FromFile(@"PaintDotNet.Framework.dll");
var type = (TypeDefinition)asm.ManifestModule.LookupMember(0x0200008B); //PaintDotNet.UI.Media.Transform
var customAttribute = type.CustomAttributes[0];
Console.WriteLine(customAttribute.Signature);

Expected behavior

To print to standard output

Platform

  • OS: [Windows 10]
  • AsmResolver Version: [e.g. 4.8-dev]

Files

PaintDotNet.Framework.dll from Paint.Net project
https://www.getpaint.net/download.html

@JPaja JPaja added the bug label Nov 27, 2021
@JPaja
Copy link
Contributor Author

JPaja commented Nov 27, 2021

After some investigation I found out that when starting to parse first generic argument PaintDotNet.UI.Media.Transform
with ParseTypeSpec(), and since next character will be comma
ParseTypeSpec gets confused and thinks after comma is version info
image
where ParseAssemblyNameSpec will eat up next 2 tokens ( , and PaintDotNet.UI.Media.Transform ) up to +.

Solution would be to stop ParseAssemblyNameSpec() from eating those 2 tokens if its invalid version info

@Washi1337 Washi1337 added the dotnet Issues related to AsmResolver.DotNet label Nov 28, 2021
@Washi1337 Washi1337 added this to the 4.8.0 milestone Nov 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug dotnet Issues related to AsmResolver.DotNet
Projects
None yet
Development

No branches or pull requests

2 participants