Skip to content

FieldViewResolver.GetFieldView uses File.Exists #69

Open
@ronaldbarendse

Description

@ronaldbarendse

Umbraco Forms checks whether a view exists by doing a File.Exists lookup, instead of using ViewEngines.Engines.FindView(). This behavior is incompatible with the normal MVC view location logic and breaks custom view engines (e.g. RazorGenerator). It's also a performance issue, because it requires disk I/O on every check, while the built-in view locator caches the lookups.

Connected to: https://issues.umbraco.org/issue/CON-1565

Reproduction

Bug summary

I installed RazorGenerator, so I can use new C# syntax in my views, see compile errors on build and get blazing fast startup times. Because all views are compiled into the assembly, the view files itself aren't deployed (and would actually generate compile errors on startup, because the default compiler doesn't understand the new syntax).

Umbraco can find the correct (compiled) views using @Html.Partial() etc., but Umbraco Forms doesn't return the correct view when using FieldViewResolver.GetFieldView(). It seems it can't find the themed view and always returns the default...

I also tried installing Microsoft.CodeDom.Providers.DotNetCompilerPlatform to get support for the new C# syntax in the views (so the files exists and can be compiled), but then I got an error on startup from the compiler (csc.exe) with error code -532462766.

Specifics

Tested on the latest versions going from:

  • Umbraco 7.11+
  • Umbraco Forms 7.0.3+

This item has been added to our backlog AB#11978

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions