Using taghelpers in razor views using a model type which is loaded runtime #4497
Description
Hi,
I have created an application which uses a custom fileprovider for loading razor views from disk / database, and these views uses models coming from an assembly which is loaded runtime. I've used the RazorViewEngineOptions.CompilationCallback to load this assembly and the compilation of the views works - except for when using asp-for
etc. (The compilation callback was implemented as per the example given in #4423)
The model object is created using Activator.CreateInstance where the type is coming from the external assembly.
The errors I'm getting when using taghelpers are:
Type expected
Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type
These errors don't contain much detail, but I'm assuming the problem is related to the model type which is loaded runtime. Any suggestions on how I can get this to work is greatly appreciated.