Copied to clipboard

Flag this post as spam?

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


  • Frederik Lundbeck Jørgensen 4 posts 74 karma points
    Apr 04, 2022 @ 09:25
    Frederik Lundbeck Jørgensen
    0

    Modelsbuilder stopped working

    Since upgrading from 9.3.1 to 9.4.1 our modelsbuilder has stopped working. When we make a change in the settings tab it doesn't display the 'Out-of-date' flag any longer. It even says that 'Tracking of out-of-date models is not enabled.', even though our 'ModelsBuilder' section in the appsettings.json configuration is as follows:

    "ModelsBuilder": {
        "ModelsMode": "SourceCodeManual",
        "ModelsNamespace": "Folketeatret.Models",
        "ModelsDirectory": "~/../Folketeatret.Models/Generated",
        "AcceptUnsafeModelsDirectory": true,
        "FlagOutOfDateModels": true
      }
    

    I also suspect this error may be causing other weird problems such as some generated models not being populated with data correctly. An example of this is a 'Cta' generated model that has a 'UrlPicker' property that for some reason is always null, even though we've set the link in the content tree.

    Would love to hear from somebody who's experienced this or knows how to fix it.

  • Corné Hoskam 80 posts 587 karma points MVP 2x c-trib
    Apr 04, 2022 @ 09:40
    Corné Hoskam
    0

    Hi Frederik,

    Perhaps a helpful starting point would be to add an additional key-value pair to your appsettings.json for 'ModelsBuilder.DebugLevel', with an int value greater than zero to enable detailed logging on the ModelsBuilder. Maybe that will shed a light on what's going wrong with the ModelsBuilder!

    If nothing shows up, we'll have to continue looking for other solutions to found out what's going wrong!

    Kind regards,

    Corné Hoskam

  • Frederik Lundbeck Jørgensen 4 posts 74 karma points
    Apr 04, 2022 @ 10:57
    Frederik Lundbeck Jørgensen
    0

    Hi Corné,

    Thanks for the quick response. I tried adding the ModelsBuilder.DebugLevel with 1 as the value to the appsettings. Do you know where the supposed logging/debugging will be shown, I can't seem to find any logging happening?

  • Chester Campbell 98 posts 209 karma points
    May 05, 2022 @ 14:28
    Chester Campbell
    0

    I am experiencing this issue as well. I'm developing a site using Umbraco CMS v9.4.3 and my models builder configuration is:

    "ModelsBuilder": {
        "ModelsMode": "SourceCodeManual",
        "ModelsNamespace": "MyProject.Models.PublishedContent",
        "ModelsDirectory": "~/Models/PublishedContent/Generated",
        "FlagOutOfDateModels": true,
        "DebugLevel": 1
      }
    

    In the CMS --> Settings --> Models Builder tab I'm seeing this:

    Models Builder
    Version: 9.4.3+192eb2699ba4131addbb08236f60eb031707f751
    
    ModelsBuilder is enabled, with the following configuration:
    
    The models mode is 'SourceCodeManual'. Strongly typed models are generated on demand. Recompilation is necessary and models are available to all CSharp code.
    Models namespace is MyProject.Models.PublishedContent.
    Tracking of out-of-date models is not enabled.
    

    I have not noticed any problems with the content of the generated models (so far), but the interface clearly doesn't represent my configuration properly.

    I looked for logging in the Log Viewer but there's nothing there related to models builder.

  • Rob Schall 3 posts 72 karma points
    Jun 03, 2022 @ 02:10
    Rob Schall
    0

    Has there been any movement on this issue? I'm seeing the same issue on the latest version of Umbraco (9.5.1) and have been seeing it for several versions now.

    Version: 9.5.1+406576ddfa7f3577d959a32ec2296bd9f730786e
    
    ModelsBuilder is enabled, with the following configuration:
    
    The models mode is 'SourceCodeManual'. Strongly typed models are generated on demand. Recompilation is necessary and models are available to all CSharp code.
    Models namespace is Umbraco.Cms.Web.Common.PublishedModels.
    Tracking of out-of-date models is not enabled.
    

    And here's the appsettings:

      "ModelsBuilder": {
        "ModelsMode": "SourceCodeManual",
        "FlagOutOfDateModels": true,
        "Enable": true,
        "DebugLevel": 1
      },
    

    We are using uSync which I know flags changes as well to models. Could it be possible that could be involved here? Is anyone else having this issue also utilizing uSync?

  • Lotte Pitcher 49 posts 242 karma points MVP 7x c-trib
    Jun 07, 2022 @ 20:25
    Lotte Pitcher
    0

    Have encountered this problem myself, in that ood.flag is not being created when in SourceCodeManual mode.

    It was mentioned in a meetup tonight (https://www.meetup.com/umbracalong/) and a pull request has been raised as a potential fix for the problem... Suggest you follow: https://github.com/umbraco/Umbraco-CMS/pull/12548

  • Tim 66 posts 89 karma points
    Feb 07, 2023 @ 21:33
    Tim
    0

    Hi I'm also getting an error. It's driving me crazy as I can't figure out why this is happening. I'm using Umbraco version 11.1.0

    Models Builder Version: 11.1.0+bad9148

    ModelsBuilder is enabled, with the following configuration:
    
    The models mode is 'SourceCodeAuto'. Strong typed models are generated on demand and anytime schema changes (i.e. Content Type) are made. Recompilation is necessary and models are available to all CSharp code.
    Models namespace is Clo.ModelsGenerated.
    Tracking of out-of-date models is not enabled.
    

    Generate models Last generation failed with the following error:

    Failed to build models.
    Object reference not set to an instance of an object.
    
    at Umbraco.Cms.Core.Models.PublishedContent.ModelType.MapToName(Type type, Dictionary`2 map, Boolean dictionaryIsInvariant)
    at Umbraco.Cms.Core.Models.PublishedContent.ModelType.MapToName(Type type, Dictionary`2 map)
    at Umbraco.Cms.Infrastructure.ModelsBuilder.Building.TypeModel.MapModelTypes(IList`1 typeModels, String ns)
    at Umbraco.Cms.Infrastructure.ModelsBuilder.Building.Builder.Prepare()
    at Umbraco.Cms.Infrastructure.ModelsBuilder.Building.Builder..ctor(ModelsBuilderSettings config, IList`1 typeModels)
    at Umbraco.Cms.Infrastructure.ModelsBuilder.Building.TextBuilder..ctor(ModelsBuilderSettings config, IList`1 typeModels)
    at Umbraco.Cms.Infrastructure.ModelsBuilder.Building.ModelsGenerator.GenerateModels()
    at Umbraco.Cms.Web.BackOffice.ModelsBuilder.ModelsBuilderDashboardController.BuildModels()
    

    Here's my appsettings:

      "ModelsBuilder": {
        "ModelsMode": "SourceCodeAuto",
        "ModelsNamespace": "Clo.ModelsGenerated",
        "FlagOutOfDateModels": true,
        "ModelsDirectory": "~/../Clo.ModelsGenerated/Generated",
        "AcceptUnsafeModelsDirectory": true,
        "DebugLevel": 1
      }
    

    Here's what the logs say:

     Timestamp  2023-02-07T21:19:02.942863+00:00
    @MessageTemplate    Failed to generate models.
    SourceContext   Umbraco.Cms.Infrastructure.ModelsBuilder.AutoModelsNotificationHandler 
    RequestId   4000007a-0004-ea00-b63f-84710c7967bb
    RequestPath /umbraco/backoffice/umbracoapi/contenttype/PostSave
    ProcessId   19028
    ProcessName iisexpress
    ThreadId    33
    ApplicationId   bd148e2a10f91e11c7e83522b77dffcc762e7adb
    MachineName LAPTOP-IMG4TNQN 
    Log4NetLevel    ERROR
    HttpRequestId   1fe15cc9-54a8-40d4-8853-432883665346
    HttpRequestNumber   3 
    HttpSessionId   0
    
  • Martin Carlsén 5 posts 75 karma points
    Apr 05, 2023 @ 21:56
    Martin Carlsén
    0

    Hi, I´m also experiencing an error using ModelsBuilder on Umbraco 11.2.0.

    My appsettings as follow:

    
    "ModelsBuilder": {
      "ModelsMode": "SourceCodeManual",
      "ModelsDirectory": "~/../MySite.Web.PublishedContentModels/Generated",
      "ModelsNamespace": "MySite.Web.PublishedContentModels.Generated",
      "AcceptUnsafeModelsDirectory": true,
      "FlagOutOfDateModels": true,
      "DebugLevel": 1
    }
    

    In Umbraco the ModelsBuilder dashboard is empty and no error in log either.

    But in browser developer console there´s an error in angular.js saying

    
    No url found for api name modelsBuilderBaseUrl <div ng-include="property.view" class="ng-scope">
    
  • Martin Carlsén 5 posts 75 karma points
    Apr 11, 2023 @ 11:58
    Martin Carlsén
    0

    I can answer my own question: Services for the Umbraco front-end website was needed. So had to add: .AddWebsite() in Startup. Thought the AddBackOffice should add everything needed here.

Please Sign in or register to post replies

Write your reply to:

Draft