TransactionScope nested incorrectly. in media Context

Topics: Troubleshooting
Jul 28, 2011 at 10:01 AM

When I go in the dashboard > Media and i click on a folder (or try to create one) I got the following error : TransactionScope nested incorrectly

I've an hard link on the media folder to make the upload and the retrieval of files working on my webfarm. 

It was working great when i was in the last version but now in 1.2.41 , it show me this error

or an

500 - Internal server error.

 

Here the stack Trace:

TransactionScope nested incorrectly.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: TransactionScope nested incorrectly.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace: 

[InvalidOperationException: TransactionScope nested incorrectly.]
   System.Transactions.TransactionScope.Dispose() +205875
   Orchard.Data.TransactionManager.System.IDisposable.Dispose() in C:\Projects\WebSite\src\Orchard\Data\TransactionManager.cs:47
   Autofac.Core.Disposer.Dispose(Boolean disposing) +82
   Autofac.Util.Disposable.Dispose() +43
   Autofac.Core.Lifetime.LifetimeScope.Dispose(Boolean disposing) +31
   Autofac.Util.Disposable.Dispose() +43
   Orchard.Environment.<>c__DisplayClass2.<.ctor>b__0() in C:\Projects\WebSite\src\Orchard\Environment\WorkContextAccessor.cs:75
   Orchard.Environment.HttpContextScopeImplementation.System.IDisposable.Dispose() in C:\Projects\WebSite\src\Orchard\Environment\WorkContextAccessor.cs:80
   Orchard.Mvc.Routes.HttpAsyncHandler.EndProcessRequest(IAsyncResult result) in C:\Projects\WebSite\src\Orchard\Mvc\Routes\ShellRoute.cs:151
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +453
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +371

 

Coordinator
Jul 29, 2011 at 12:38 AM

Can you try without the hard link? If it works without it, that may be worth filing in the issue tracker.

Jul 29, 2011 at 3:10 PM
Edited Jul 29, 2011 at 3:52 PM

Even without the media module or without the hardlink, i cant create a folder and i get the error on the production server

At the same time, it work in preproduction ...

the production serveur configuration:

IIS 7 / Windows server 2008

 

 

on another server : IIS6

(without hard link)

2011-07-29 16:45:11,729 [4684] Orchard.ContentManagement.Drivers.Coordinators.ContentPartDriverCoordinator - ArgumentNullException thrown from IContentPartDriver by Szmyd.Orchard.Modules.Menu.Drivers.BreadcrumbsPartDriver
System.ArgumentNullException: Value cannot be null.
Parameter name: source
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Szmyd.Orchard.Modules.Menu.Drivers.BreadcrumbsPartDriver.Display(BreadcrumbsPart part, String displayType, Object shapeHelper) in d:\Servers\WebSite (Beta)\Modules\Szmyd.Orchard.Modules.Menu\Drivers\BreadcrumbsPartDriver.cs:line 59
   at System.Dynamic.UpdateDelegates.UpdateAndExecute4[T0,T1,T2,T3,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3)
   at Orchard.ContentManagement.Drivers.ContentPartDriver`1.Orchard.ContentManagement.Drivers.IContentPartDriver.BuildDisplay(BuildDisplayContext context) in C:\Projects\WebSite\src\Orchard\ContentManagement\Drivers\ContentPartDriver.cs:line 20
   at Orchard.ContentManagement.Drivers.Coordinators.ContentPartDriverCoordinator.<>c__DisplayClassa.<BuildDisplay>b__9(IContentPartDriver driver) in C:\Projects\WebSite\src\Orchard\ContentManagement\Drivers\Coordinators\ContentPartDriverCoordinator.cs:line 43
   at Orchard.InvokeExtensions.Invoke[TEvents](IEnumerable`1 events, Action`1 dispatch, ILogger logger) in C:\Projects\WebSite\src\Orchard\InvokeExtensions.cs:line 19
2011-07-29 16:46:20,120 [4684] Orchard.ContentManagement.Drivers.Coordinators.ContentPartDriverCoordinator - ArgumentNullException thrown from IContentPartDriver by Szmyd.Orchard.Modules.Menu.Drivers.BreadcrumbsPartDriver
System.ArgumentNullException: Value cannot be null.
Parameter name: source
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Szmyd.Orchard.Modules.Menu.Drivers.BreadcrumbsPartDriver.Display(BreadcrumbsPart part, String displayType, Object shapeHelper) in d:\Servers\WebSite (Beta)\Modules\Szmyd.Orchard.Modules.Menu\Drivers\BreadcrumbsPartDriver.cs:line 59
   at Orchard.ContentManagement.Drivers.ContentPartDriver`1.Orchard.ContentManagement.Drivers.IContentPartDriver.BuildDisplay(BuildDisplayContext context) in C:\Projects\WebSite\src\Orchard\ContentManagement\Drivers\ContentPartDriver.cs:line 20
   at Orchard.ContentManagement.Drivers.Coordinators.ContentPartDriverCoordinator.<>c__DisplayClassa.<BuildDisplay>b__9(IContentPartDriver driver) in C:\Projects\WebSite\src\Orchard\ContentManagement\Drivers\Coordinators\ContentPartDriverCoordinator.cs:line 43
   at Orchard.InvokeExtensions.Invoke[TEvents](IEnumerable`1 events, Action`1 dispatch, ILogger logger) in C:\Projects\WebSite\src\Orchard\InvokeExtensions.cs:line 19
2011-07-29 16:46:45,167 [4650] Orchard.Exceptions.DefaultExceptionPolicy - Method not found: 'Void Orchard.UI.Notify.INotifier.Error(Orchard.Localization.LocalizedString)'.
2011-07-29 16:47:43,729 [5328] Orchard.Exceptions.DefaultExceptionPolicy - Method not found: 'Void Orchard.UI.Notify.INotifier.Error(Orchard.Localization.LocalizedString)'.
2011-07-29 16:48:08,307 [5328] Orchard.Exceptions.DefaultExceptionPolicy - Method not found: 'Void Orchard.UI.Notify.INotifier.Error(Orchard.Localization.LocalizedString)'.
2011-07-29 16:48:13,151 [4650] Orchard.Exceptions.DefaultExceptionPolicy - Method not found: 'Void Orchard.UI.Notify.INotifier.Error(Orchard.Localization.LocalizedString)'.
2011-07-29 16:48:25,354 [4678] Orchard.Exceptions.DefaultExceptionPolicy - Method not found: 'Void Orchard.UI.Notify.INotifier.Error(Orchard.Localization.LocalizedString)'.

Coordinator
Jul 29, 2011 at 8:00 PM

This seems to come from the Advanced Menu module. Can you try to contact Piotr here: http://orchardproject.net/gallery/Package/ContactOwners/Orchard.Module.Szmyd.Orchard.Modules.Menu ?

Developer
Jul 31, 2011 at 1:14 PM

It looks like there's a problem in this line in BreadcrumbsPartDriver:

path = MenuItemsUtility.SetSelectedPath(menu, request.RequestContext.RouteData, request.Path, _httpContextAccessor.Current()).ToList();

The path returned by SetSelectedPath method is null, so it throws an exception. This can happen in three scenarios -

  • menu used to build breadcrumbs is empty,
  • none of the items from the menu used to build breadcrumbs matches (in full or partially) the currently selected URL
  • menu used to build breadcrumbs does not exist

Please check if any of those applies to your scenario. It would be great if you could elaborate a bit more on your specific case.

BTW - I'll post a fix with the next release - this method should return empty stack instead of null in such cases, I guess.

 

Jul 31, 2011 at 3:37 PM

In my case I think the can come from this two scenarios

  • menu used to build breadcrumbs is empty,
  • none of the items from the menu used to build breadcrumbs matches (in full or partially) the currently selected URL

I think it's the first , but can't be more explicit

 

Have you a date for this path cause i really need to make it work as soon as posible

 

Sincerely

Developer
Aug 1, 2011 at 3:20 PM
Edited Aug 1, 2011 at 3:21 PM

Olin, could you just add a single simple item with the root url "/" to that menu and see if that helps? It would match everything and the menu won't be empty, so the exceptions won't be thrown.

I have a bunch of new features to test yet (item permissions, binding items to specific menus, some UI tweaks and so on) and am leaving for short holidays in 4 days so it possibly wouldn't land in the Gallery before August, 14.

Cheers

Aug 2, 2011 at 8:47 AM

I've created a "/" url item in my menu

It remove the exception but the error still here

TransactionScope nested incorrectly.

And then the error 500.

 


Aug 4, 2011 at 9:59 AM

I'm still looking for a solution

today i've deleted advanced menu, and the error still occur ...

so it come from something else.

here the log when i start the application, go to the dashboard, then Media, the my Document folder

transacaction scope nedted incorrectly or  error 500 and in log :

2011-08-04 10:50:03,495 [36] Orchard.Exceptions.DefaultExceptionPolicy - Method not found: 'Void Orchard.UI.Notify.INotifier.Error(Orchard.Localization.LocalizedString)'.

i'm currently using an hardlink and the media folder module

 

if i delete the default folder and go to media in dashboard , a new folder is created

if i try to create a test folder : transacaction scope nedted incorrectly or  error 500 and in log :

2011-08-04 10:54:39,569 [15] Orchard.Exceptions.DefaultExceptionPolicy - Method not found: 'Void Orchard.UI.Notify.INotifier.Information(Orchard.Localization.LocalizedString)'.

even if i give all rights to my the user used by orchard (and iis pool) the error appear when i try to open an manually created folder .

 

have you some idear because I have to fix it as soon as possible !

Developer
Aug 4, 2011 at 10:18 AM

There is some sort of a problem with localized strings. As far as I remember there were some method signature changes involving localized strings (and notifications also) between Orchard 1.0/1.1 or 1.1/1.2 and it caused some issues. My guess is that you are using some module that is using the old syntax somewhere.

You can try two things:

  1. Run application in debug mode (or set up some breakpoints inside Orchard.Exception.DefaultExceptionPolicy class if you are working from VS), so more detailed info about an exception would be available.
  2. Turn off custom modules and see which one causes the error - then try digging deeper.

HTH

 

Aug 4, 2011 at 11:43 AM
Edited Aug 4, 2011 at 11:47 AM

i've disable all my custom modules and the error still appears...

 

I think the problem is more deeper because on local and on the preproduction server it work

but on production server , the error always appears ...

 

and in localhost (it work fine) the only error i get when debugging is {"'.', hexadecimal value 0x00, is an invalid character. Line 1, position 1."} from orchard.indexing

Aug 7, 2011 at 6:57 PM

Have you some idear or solutions ?

I really need to fix the site .....