U4-4182 - Exception during plugins loading

Created by Dima Stefantsov 05 Feb 2014, 03:08:33 Updated by Devin Bost 24 Mar 2014, 10:38:14

Relates to: U4-4462

Relates to: U4-4355

Using 7.0.3. Having following lines appear in my log:

2014-02-05 06:52:23,707 [11] INFO Umbraco.Web.Search.ExamineEvents - [Thread 1] Initializing Examine and binding to business logic events 2014-02-05 06:52:23,708 [11] INFO Umbraco.Web.Search.ExamineEvents - [Thread 1] Adding examine event handlers for index providers: 3 2014-02-05 06:52:36,984 [11] INFO umbraco.content - [Thread 8] Loading content from disk cache... 2014-02-05 06:52:37,036 [11] INFO Umbraco.Core.PluginManager - [Thread 8] Starting resolution types of Umbraco.Core.Persistence.Mappers.BaseMapper 2014-02-05 06:52:37,040 [11] INFO Umbraco.Core.PluginManager - [Thread 8] Completed resolution of types of Umbraco.Core.Persistence.Mappers.BaseMapper, found 20 (took 3ms) 2014-02-05 06:52:37,202 [11] ERROR Umbraco.Core.PluginManager - [Thread 8] Error creating type Umbraco.Core.Models.PublishedContent.PublishedPropertyType+CompatConverter System.MissingMethodException: No parameterless constructor defined for this object. at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecur at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.Activator.CreateInstance(Type type) at Umbraco.Core.PluginManager.CreateInstances[T](IEnumerable`1 types, Boolean throwException) in d:\temp\UmbracoV7Branch\src\Umbraco.Core\PluginManager.cs:line 628 2014-02-05 06:52:37,212 [11] INFO Umbraco.Core.PluginManager - [Thread 8] Starting resolution types of Umbraco.Core.PropertyEditors.IParameterEditor 2014-02-05 06:52:37,222 [11] INFO Umbraco.Core.PluginManager - [Thread 8] Completed resolution of types of Umbraco.Core.PropertyEditors.IParameterEditor, found 42 (took 10ms)

I've checked source code, and there's indeed no parameterless constructor for class CompatConverter, and changelogs show there never were one. That's strange. Should this exception happen every time?

P.S.: it was mentioned in U4-4144 , haven't got any attention it seems.

Comments

Shannon Deminick 11 Mar 2014, 05:57:51

This was caused because the CompatConverter get's found by the TypeFinder and since it is a property value converter the plugin manager tries to instantiate it. Because we are running in full trust now, non-public classes are found by the finder so we need to be more careful about creating plugin based classes that are meant to only be used internally.

What I've done to fix this is:

  • Ensure the TypeFinder does not resolve any nested private classes
  • Created a new attribute: HideFromTypeFinderAttribute which if applied to a class will always be ignored by the TypeFinder
  • Ensured that the CompatConverter class is marked explicitly as "private" which makes it become a nested private class which will automatically be ignored.

The other work-around is to ensure we ignore specific internal classes in the boot process when initializing the resolvers.

Have mentioned @zpqrtbnk on this as we need to be careful about these things.


Devin Bost 18 Mar 2014, 09:43:22

Is there an estimate for when this fix will be rolled out? This bug is breaking my Contour forms.


Shannon Deminick 18 Mar 2014, 09:46:33

It is flagged for 7.1 release which is soon: http://our.umbraco.org/contribute/releases/710


Priority: Normal

Type: Bug

State: Fixed

Assignee: Shannon Deminick

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 7.0.3

Due in version: 7.1.0

Sprint:

Story Points:

Cycle: