Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Oct 03, 2017 @ 09:45
    Chriztian Steinmeier
    1

    How to debug a Models Builder issue(s)?

    Hi all,

    I've been using Models Builder out of the box on Umbraco Cloud for quite some time now, but yesterday & today I've hit a brick-wall that's probably going to drive me away from programming for a while... (not really, but drama! :-)

    It started when I created a new Document Type named Fakta (Sektion) - I gave it the alias FactsSection right away and added a simple Header property, accepting the default alias header.

    My views started acting up, saying that FactsSection didn't exist etc. and I went on a goose chase trying to see if I'd misstyped anything. Finally I restarted the website "just to be sure", and lo and behold, that worked.

    Then I went on and added another property to the doctype and the same thing happened again: The property didn't exist for the views, but using Kudu, I verified that the generated models (or to be exact: The files in the App_Data/Models directory) did in fact contain the new property. Restarting the site made it appear again.

    My problem is that whenever this happens, it surfaces as just another typo-error in the views, and I'm wasting a lot of time trying to figure out what went wrong. The ModelsBuilder tab in the Developer section doesn't show anything out of the ordinary and the Trace Logs have no indication of this either.

    I am a frontend developer working on a Mac, and there's no chance of me ever going to "just use Visual Studio on Windows" - so what are my options here?

    Does Umbraco and/or Models Builder have any chance of detecting when the in-memory models for some reason didn't succeed in (re-)building and thus being out of sync with the files? Right now, those files are my only source of truth, regarding what exists (that I know of).

    /Chriztian

  • Tim 1193 posts 2675 karma points MVP 3x c-trib
    Oct 03, 2017 @ 09:59
    Tim
    1

    If the in memory models don't build, it's usually logged in the Umbraco Tracelog file in App_Data/Logs.

    I've had it before and it usually happens when the DocType contains a reserved word. For example, try naming a property "Content" and see what happens ;)

    I don't think there's a list of words anywhere you should avoid though.......

  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 7x admin c-trib
    Oct 03, 2017 @ 10:02
    Chriztian Steinmeier
    0

    Thanks Tim - I haven't been able to find anything in the Trace Logs (which also weirds me out)...

    (log4net.config is set to "Info" level - don't know if that has any impact on what's logged from Models Builder?)

    /Chriztian

  • Kevin Jump 2310 posts 14695 karma points MVP 7x c-trib
    Oct 03, 2017 @ 11:51
    Kevin Jump
    2

    Hi

    I think app_data is not monitored for changes by IIS so when models builder writes the model files - the chnage is not being detected site is not being rebuilt?

    if you change the folder models go into with Umbraco.ModelsBuilder.ModelsDirectory in the web.config to something in app_code then this might help?

    see : https://blogs.msdn.microsoft.com/tmarq/2007/11/01/asp-net-file-change-notifications-exactly-which-files-and-directories-are-monitored/ ?

Please Sign in or register to post replies

Write your reply to:

Draft