Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Type.GetType with assembly resolver and null type resolver can throw nullreferenceexception #21616

@khaledmousa

Description

@khaledmousa

Steps to Reproduce

  1. Create a new Xamarin.Forms project targeting Android (used Xamarin.Forms 5.0.0.2196)
  2. Execute the following statement: var t = Type.GetType(typeof(string).Name, (a) => null, null, false); at the beginning of the MainActivity.OnCreate method
  3. Run the project

Current Behavior

Statement throws a NullReferenceException

Expected Behavior

No exception is thrown, and the call to Type.GetType returns null (this behavior is confirmed on .Net 4.7.2)

Stacktrace

Exception looks to be caused by a missing null check on asm in TypeSpec.cs

Contrast this with the dotnet/runtime version

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions