Skip to content

ILVerify.ILVerifyTypeSystemContext.VerifyModuleName throws NullReferenceException if missing DLL #62711

@carlos-quintero

Description

@carlos-quintero

Description

When you run ilverify to verify a DLL that has dependencies, if some dependency dll is missing ilverify throws:

NullReferenceException at ILVerify.ILVerifyTypeSystemContext.VerifyModuleName(String simpleName, EcmaModule module)

instead of a more helpful exception (such as FileNotFound with the name of the missing file).

That makes incredibly frustrating to verify DLLs with lots of dependencies in several folders (such as Visual Studio extensions) if you miss some folder.

Reproduction Steps

  • Using Visual Studio 2022 create a solution with two .NET 6.0 Class Library projects (ClassLibrary1 and ClassLibrary2), with ClassLibrary2 referencing ClassLibrary1.
  • In the referenced library (ClassLibrary1), create a static class with a static method.
  • In the referencing library (ClassLibrary2), create a class with a method that calls the method in the other library
  • Build the solution
  • Open a command prompt and change to the output folder of ClassLibrary2 (ClassLibrary2\bin\Debug\net6.0)
  • Run the following command:

ilverify ClassLibrary2.dll -r "C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.0*.dll"

(notice that we have omitted -r ".*.dll" so that ClassLibrary1.dll will not be found)

Expected behavior

Something like:

"ClassLibrary1.dll not found"

Actual behavior

Error: System.NullReferenceException: Object reference not set to an instance of an object.
at ILVerify.ILVerifyTypeSystemContext.VerifyModuleName(String simpleName, EcmaModule module)
...

Regression?

No response

Known Workarounds

No response

Configuration

.NET 6.0
Windows 10
AnyCPU

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Tools-ILVerificationIssues related to ilverify tool and IL verification in generalhelp wanted[up-for-grabs] Good issue for external contributorsuntriagedNew issue has not been triaged by the area owner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions