kgiszewski/G42.UmbracoGrease

Umbraco.Core.Persistence.Transaction() arguments changed in updated PetaPoco.cs

Closed this issue · 3 comments

I am getting the following errors installing G42.UmbracoGrease on Umbraco v7.5.4:

Method not found: 'Void Umbraco.Core.Persistence.Transaction..ctor(Umbraco.Core.Persistence.Database)'.

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.MissingMethodException: Method not found: 'Void Umbraco.Core.Persistence.Transaction..ctor(Umbraco.Core.Persistence.Database)'.

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: 


[MissingMethodException: Method not found: 'Void Umbraco.Core.Persistence.Transaction..ctor(Umbraco.Core.Persistence.Database)'.]
   G42.UmbracoGrease.Core.PetaPocoUnitOfWork..ctor(String connectionString) +0
   G42.UmbracoGrease.G42404Helper.Services.G42404Service.Create404DomainPathsTable() +102
   G42.UmbracoGrease.Events.PackageActions.ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) +392
   Umbraco.Core.ApplicationEventHandler.OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) +50
   Umbraco.Core.CoreBootManager.<Complete>b__a(IApplicationEventHandler x) +434
   Umbraco.Core.EnumerableExtensions.ForEach(IEnumerable`1 items, Action`1 action) +167
   Umbraco.Core.CoreBootManager.Complete(Action`1 afterComplete) +467
   Umbraco.Web.WebBootManager.Complete(Action`1 afterComplete) +167
   Umbraco.Core.UmbracoApplicationBase.StartApplication(Object sender, EventArgs e) +445

[HttpException (0x80004005): Method not found: 'Void Umbraco.Core.Persistence.Transaction..ctor(Umbraco.Core.Persistence.Database)'.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +540
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +186
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +402
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +343

[HttpException (0x80004005): Method not found: 'Void Umbraco.Core.Persistence.Transaction..ctor(Umbraco.Core.Persistence.Database)'.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +539
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +125
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +731

Looking at PetaPoco.cs in the Umbraco.Core, the Transaction Method takes two arguments:

	// Transaction object helps maintain transaction depth counts
	public class Transaction : IDisposable
	{
        public Transaction(Database db, IsolationLevel isolationLevel)
        {
            _db = db;
            _db.BeginTransaction(isolationLevel);
        }

		public virtual void Complete()
		{
			_db.CompleteTransaction();
			_db = null;
		}

		public void Dispose()
		{
			if (_db != null)
				_db.AbortTransaction();
		}

		Database _db;
	}

This change happened at the following commit in Umbraco-CMS: umbraco/Umbraco-CMS@a6a6edb

You may need to fork this repo and change the args based on the new version of Umbraco. You'll likely want to upgrade the version of Umbraco that Grease depends on so you can get the errors at compile time.

Specifically Grease Depends on v7.2.4 of the Umbraco core.

https://github.com/kgiszewski/G42.UmbracoGrease/blob/master/src/G42.UmbracoGrease/packages.config#L24

Upgrade Grease to use Core v7.5.4 in your custom fork, build and it update your solution to use this new version of Grease.

I'm releasing a new version today of Grease. It depends on core 7.6.3 (which you're probably not on yet). I'm closing this for now and thank you for your reporting :)