Open TehWardy opened 7 years ago
What makes an assembly usable here ... kind of hard to tell?
I think this is a problem with your IReferenceResolver
implementation. You need to check if the assembly is a dynamic assembly before accessing the Location
property.
See this filter we have here: https://github.com/Antaris/RazorEngine/blob/master/src/source/RazorEngine.Core/Compilation/ReferenceResolver/UseCurrentAssembliesReferenceResolver.cs#L25
None of the assemblies returned by my type helper are dynamic it returns a core set of referenced assemblies ... I have since solved the problem by telling my type helper to not only resolve them but also ensure that they are loaded.
As the type helper call is made during app load it means I could remove the reference resolver here and allow it to fall back to the default one.
In short ... I just use what's in the app domain.
But it still won't use extension methods for some reason.
So this can be closed?
Yeh I guess but the rules around what can and can't be used in a custom reference resolver probably need better docs.
I have a workable solution to my issue though by basically having my helper force the right stuff to be in the loaded stuff in the app domain then calling the default one
I can get the razor engine to work when I use only the default static instance of it but as soon as I start wrapping it up and working on a "custom instance" provided by my IoC container things start to go pear shaped ...
IoC rules ...
Wrapper ...
My custom reference resolvier appears to be the problem with the exception being raised ...