Something weird: in my class (which is implementing an interface which derives from IDependency) it seems that the constructor can't have any code that does database interaction. The following line (but this is just an example, I obviously tried it with
something sane :-)) causes a stack overflow (if debugging, gets hit infinitely):
var z = _orchardServices.ContentManager.Get(1);
The exception is actually thrown from (or rather marked on by Visual Studio) on line 21 (return _constructorFinder.FindConstructors(targetType);) of Orchard\Environment\AutofacUtil\DynamicProxy2\ConstructorFinderWrapper.cs
If I try
var z = _orchardServices.WorkContext.CurrentSite.As<MyConetentPart>();
the problem is the same, but now on line 139 of Orchard\ContentManagement\DefaultContentQuery.cs The message is slightly different: "An unhandled exception of type 'System.StackOverflowException' occurred in System.Data.SqlServerCe.dll" (as with
the first line of code the message referenced System.net.dll)
Is this a bug or feature? :-) Thanks in advance!
P.S.: Now if I run the first example, the exception is thrown on line 101 of Orchard\ContentManagement\DefaultContentManager.cs and the message is "An unhandled exception of type 'System.StackOverflowException' occurred in Orchard.Framework.DLL"