Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Using taghelpers in razor views using a model type which is loaded runtime #4497

Closed
@DavidEmanuelsen

Description

@DavidEmanuelsen

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions