OrchardCMS / Orchard

Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
https://orchardproject.net
BSD 3-Clause "New" or "Revised" License
2.37k stars 1.12k forks source link

Enabling a module with invalid NHibernate associations takes Orchard down permanently #1588

Open orchardbot opened 13 years ago

orchardbot commented 13 years ago

hosamaly created: https://orchard.codeplex.com/workitem/17759

If a module that has an invalid NHibernate association is enabled, Orchard enters a non-recoverable state. If loading a module fails, it should be disabled so that Orchard can continue normally.

To reproduce this issue, create this sample module:

public class SamplePartRecord : ContentPartRecord { public virtual MalformedRecord Other { get; set; } }

public class MalformedRecord { public string Name { get; set; } // "forgot" to make it virtual }

public class Migrations : DataMigrationImpl { public int Create() { SchemaBuilder.CreateTable("MalformedRecord", table => table.Column("Name")); SchemaBuilder.CreateTable("SamplePartRecord", table => table.ContentPartRecord().Column("MalformedRecord_Id")); return 1; } }

orchardbot commented 13 years ago

@bleroy commented:

Workaround is to rename the module.txt file to disable the module. We are considering a safe mode sometime in the future.