refit icon indicating copy to clipboard operation
refit copied to clipboard

Add ability to scan for types in assemblies

Open DenisBalan opened this issue 3 years ago • 0 comments

As per doc https://docs.microsoft.com/en-us/dotnet/api/system.type.gettype

And https://stackoverflow.com/questions/48279264/type-gettype-doesnt-find-dynamically-created-type

The assembly-qualified name of the type to get. See AssemblyQualifiedName. If the type is in the currently executing assembly or in mscorlib.dll/System.Private.CoreLib.dll, it is sufficient to supply the type name qualified by its namespace.

Small demo

    public interface myapi<Instance> : myapi
    {

    }

    [Headers("Authorization: Bearer")]
    public interface myapi
    {
    }

Where Instance is a generated type during runtime with AssemblyBuilder and ModuleBuilder.

So its required to be in a new assembly.

Doing so, Refit will not found the type, and throw an exception.

This PR is to address and fix that.

There is NO HARM at all doing this change.

If needed, i can make also PoC of this issue, and how this PR is solving that.

What kind of change does this PR introduce? Bug fix

What is the current behavior? described above

What is the new behavior? no bug

What might this PR break? nothing!

DenisBalan avatar Jun 13 '22 20:06 DenisBalan