prjseal/Clean-Starter-Kit-for-Umbraco-v9

ImportPackageXmlMigration uses an obsolete constructor when using Umbraco 10

Opened this issue · 2 comments

When attempting to create my own starter kit I received a compiler warning:

ImportPackageXmlMigration.cs(25,13): warning CS0618: 'PackageMigration
Base.PackageMigrationBase(IPackagingService, IMediaService, MediaFileManager, MediaUrlGeneratorCollection, IShortString
Helper, IContentTypeBaseServiceProvider, IMigrationContext)' is obsolete: 'Use ctor with all params' [C:\code\SomeProject.csproj]

The missing parameter is:

IOptions packageMigrationsSettings

New constructor:

public ImportPackageXmlMigration(
IPackagingService packagingService,
IMediaService mediaService,
MediaFileManager mediaFileManager,
MediaUrlGeneratorCollection mediaUrlGenerators,
IShortStringHelper shortStringHelper,
IContentTypeBaseServiceProvider contentTypeBaseServiceProvider,
IMigrationContext context,
IOptions packageMigrationsSettings)
: base(packagingService,
mediaService,
mediaFileManager,
mediaUrlGenerators,
shortStringHelper,
contentTypeBaseServiceProvider,
context, packageMigrationsSettings)
{
}

reference: https://github.com/umbraco/Umbraco-CMS/blob/e626fca2432582f052cb13654eedd9e60ef8723f/src/Umbraco.Infrastructure/Packaging/PackageMigrationBase.cs

This breaks in v11 as the constructor is now removed.

{"type":"Error","title":"Boot failed: Umbraco cannot run. See Umbraco's log file for more details.\n\n-> Umbraco.Cms.Core.Exceptions.BootFailedException: Method not found: 'Void Umbraco.Cms.Infrastructure.Packaging.PackageMigrationBase..ctor(Umbraco.Cms.Core.Services.IPackagingService, Umbraco.Cms.Core.Services.IMediaService, Umbraco.Cms.Core.IO.MediaFileManager, Umbraco.Cms.Core.PropertyEditors.MediaUrlGeneratorCollection, Umbraco.Cms.Core.Strings.IShortStringHelper, Umbraco.Cms.Core.Services.IContentTypeBaseServiceProvider, Umbraco.Cms.Infrastructure.Migrations.IMigrationContext)'.\n\n-> System.MissingMethodException: Method not found: 'Void Umbraco.Cms.Infrastructure.Packaging.PackageMigrationBase..ctor(Umbraco.Cms.Core.Services.IPackagingService, Umbraco.Cms.Core.Services.IMediaService, Umbraco.Cms.Core.IO.MediaFileManager, Umbraco.Cms.Core.PropertyEditors.MediaUrlGeneratorCollection, Umbraco.Cms.Core.Strings.IShortStringHelper, Umbraco.Cms.Core.Services.IContentTypeBaseServiceProvider, Umbraco.Cms.Infrastructure.Migrations.IMigrationContext)'.\n at Clean.Migrations.ImportPackageXmlMigration..ctor(IPackagingService packagingService, IMediaService mediaService, MediaFileManager mediaFileManager, MediaUrlGeneratorCollection mediaUrlGenerators, IShortStringHelper shortStringHelper, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, IMigrationContext context)\r\n at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)\r\n at System.Reflection.ConstructorInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)\r\n at System.Reflection.RuntimeConstructorInfo.InvokeWithManyArguments(RuntimeConstructorInfo ci, Int32 argCount, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\r\n at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)\r\n at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)\r\n at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)\r\n at Umbraco.Extensions.ServiceProviderExtensions.CreateInstance(IServiceProvider serviceProvider, Type type, Object[] args) in C:\\Dev\\Personal\\umbraco-contrib\\src\\Umbraco.Core\\DependencyInjection\\ServiceProviderExtensions.cs:line 43\r\n at Umbraco.Cms.Infrastructure.Migrations.MigrationBuilder.Build(Type migrationType, IMigrationContext context) in C:\\Dev\\Personal\\umbraco-contrib\\src\\Umbraco.Infrastructure\\Migrations\\MigrationBuilder.cs:line 12\r\n at Umbraco.Cms.Infrastructure.Migrations.MigrationPlanExecutor.Execute(MigrationPlan plan, String fromState) in C:\\Dev\\Personal\\umbraco-contrib\\src\\Umbraco.Infrastructure\\Migrations\\MigrationPlanExecutor.cs:line 70\r\n at Umbraco.Cms.Infrastructure.Migrations.Upgrade.Upgrader.Execute(IMigrationPlanExecutor migrationPlanExecutor, ICoreScopeProvider scopeProvider, IKeyValueService keyValueService) in C:\\Dev\\Personal\\umbraco-contrib\\src\\Umbraco.Infrastructure\\Migrations\\Upgrade\\Upgrader.cs:line 73\r\n at Umbraco.Cms.Infrastructure.Install.PackageMigrationRunner.RunPackagePlans(IEnumerable`1 plansToRun) in C:\\Dev\\Personal\\umbraco-contrib\\src\\Umbraco.Infrastructure\\Install\\PackageMigrationRunner.cs:line 96\r\n at Umbraco.Cms.Infrastructure.Install.UnattendedUpgrader.HandleAsync(RuntimeUnattendedUpgradeNotification notification, CancellationToken cancellationToken) in C:\\Dev\\Personal\\umbraco-contrib\\src\\Umbraco.Infrastructure\\Install\\UnattendedUpgrader.cs:line 88","status":500,"detail":" at Umbraco.Cms.Core.Exceptions.BootFailedException.Rethrow(BootFailedException bootFailedException) in C:\\Dev\\Personal\\umbraco-contrib\\src\\Umbraco.Core\\Exceptions\\BootFailedException.cs:line 94\r\n at Umbraco.Cms.Web.Common.Middleware.BootFailedMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) in C:\\Dev\\Personal\\umbraco-contrib\\src\\Umbraco.Web.Common\\Middleware\\BootFailedMiddleware.cs:line 47\r\n at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()\r\n--- End of stack trace from previous location ---\r\n at SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext httpContext, Boolean retry)\r\n at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|8_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)","instance":"BootFailedException"}

Ooh thanks for the heads up mate.