Try our conversational search powered by Generative AI!

Sceduled job page not loading due to missing assembly

Vote:
 

When we go into our CMS 12 admin interface and open up the scheduled jobs page, nothing shows on the page. Looking at the logs we see an exception saying it could not load file or assembly EPiServer.Forms.UI, which makes sense because we haven't used Forms in the past two years or so. But apparently, its scheduled jobs are still in the database somewhere. 

I have tried deleting these misbehaving by running the following code:

var baddies = _scheduledJobRepository.List().Where(x => x.AssemblyName.Contains("Forms", StringComparison.OrdinalIgnoreCase));

foreach (var scheduledJob in baddies)
{
    _scheduledJobRepository.Delete(scheduledJob.ID);
}

In the first run it matched two jobs to be deleted. Rerunning it will result in no matches. However, the error stubbornly remains the same.  I have restarted the app in case of caching.

While scouring this forum, I came across the thread (Cannot load content types or schedules jobs after upgrade to CSM) that describes something very similar. The content types page loads just fine for us. We have tried the mentioned SQL delete statements, but that also had no effect.

We have all packages up to date (12.7.0). Any help with this would be greatly appreciated. 

The exception we're getting:

fail: Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HMI9AHD36N2B", Request id "0HMI9AHD36N2B:00000009": An unhandled exception was thrown by the application.
      System.IO.FileNotFoundException: Could not load file or assembly 'EPiServer.Forms.UI, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
      File name: 'EPiServer.Forms.UI, Culture=neutral, PublicKeyToken=null'
         at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, StackCrawlMarkHandle stackMark, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack type, ObjectHandleOnStack keepalive)
         at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext)
         at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark& stackMark)
         at System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase)
         at EPiServer.PlugIn.PlugInDescriptor.get_PlugInType()
         at EPiServer.PlugIn.PlugInDescriptorRepositoryExtensions.<>c__DisplayClass1_0.<Load>b__0(PlugInDescriptor d)
         at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
         at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
         at EPiServer.PlugIn.PlugInDescriptorRepositoryExtensions.Load(IPlugInDescriptorRepository plugInDescriptorRepository, Type type)
         at EPiServer.Cms.UI.Admin.ScheduledJobs.Internal.ScheduledJobsController.<List>b__8_0(ScheduledJob x)
         at System.Linq.Enumerable.SelectListIterator`2.MoveNext()
         at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
         at System.Text.Json.Serialization.Converters.IEnumerableDefaultConverter`2.OnWriteResume(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryWrite(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.Serialization.JsonConverter`1.WriteCoreAsObject(Utf8JsonWriter writer, Object value, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.JsonSerializer.WriteCore[TValue](JsonConverter jsonConverter, Utf8JsonWriter writer, TValue& value, JsonSerializerOptions options, WriteStack& state)
         at System.Text.Json.JsonSerializer.WriteStreamAsync[TValue](Stream utf8Json, TValue value, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken)
         at System.Text.Json.JsonSerializer.WriteStreamAsync[TValue](Stream utf8Json, TValue value, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken)
         at System.Text.Json.JsonSerializer.WriteStreamAsync[TValue](Stream utf8Json, TValue value, JsonTypeInfo jsonTypeInfo, CancellationToken cancellationToken)
         at Microsoft.AspNetCore.Mvc.Formatters.SystemTextJsonOutputFormatter.WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)
         at EPiServer.Formatters.Internal.ExtendedSystemTextJsonOutputFormatter.WriteAsync(OutputFormatterWriteContext context, ResponseDecorator responseDecorator)
         at EPiServer.Shell.Web.Mvc.JsonDataResult.ExecuteResultAsync(ActionContext context)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeResultAsync>g__Logged|22_0(ResourceInvoker invoker, IActionResult result)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|30_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
      --- End of stack trace from previous location ---
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
      --- End of stack trace from previous location ---
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
         at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
         at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
         at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
         at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
         at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
         at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
         at SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext httpContext, Boolean retry)
         at Geta.NotFoundHandler.Infrastructure.Initialization.NotFoundHandlerMiddleware.InvokeAsync(HttpContext context, RequestHandler requestHandler)
         at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
         at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
         at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
         at EPiServer.Middleware.InitializeOnFirstRequestMiddleware.InvokeAsync(HttpContext httpContext)
         at EPiServer.Framework.DependencyInjection.Internal.VisitorGroupMiddleware.Invoke(HttpContext httpContext)
         at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
#281541
Edited, Jun 08, 2022 15:16
Vote:
 

When is your code run? 

Try runing your code on an earlier stage. ex at the same stage as you run Geta.NotFoundHandler.Infrastructure.Initialization.NotFoundHandlerMiddleware. Or use a Migrationstep.

#281591
Jun 09, 2022 11:52
Vote:
 

I would start with checking the database. Is there any rows in tblScheduledItem matching that Forms assembly?

If so, first delete all rows matching that jobs ID from tblScheduledItemLog and then finally delete the job from tblScheduledItem.

#281641
Edited, Jun 10, 2022 18:15
Vote:
 

There are no rows in either tblScheduledItem or in tblScheduledItemLog containing Forms. I did just found a sole record in tblPlugin for the Forms assembly, deleting that resolved the problem! At least locally it did. What's the best way to remove this record on our DXP environments, where we (at least me, a power user) don't have direct access to the databases?

#281642
Jun 10, 2022 20:11
Vote:
 

You can contact support@optimizely.com and provide them with the SQL query you want executed on the production environment.

#281643
Jun 10, 2022 20:32
Vote:
 

The reason you are still seeing the errors was because the Forms scheduled jobs were registered by PlugIn attributes, you will need to delete those as well. Look into tblPlugin table to see those, and use PlugInDB to delete them based on their id(s)

#281752
Jun 13, 2022 8:57
Vote:
 

We contacted support to have these SQL statements executed against all our environments.  After this we've had no more errors.

-- Remove Episerver Forms plugin records
DELETE FROM tblPlugin
WHERE AssemblyName = 'EPiServer.Forms.UI'

-- Remove Episerver Forms scheduled jobs logs
DELETE FROM tblScheduledItemLog
WHERE fkScheduledItemId IN (SELECT pkid FROM tblScheduledItem WHERE AssemblyName = 'EPiServer.Forms.UI')

-- Remove Episerver Forms scheduled jobs
DELETE FROM tblScheduledItem
WHERE AssemblyName = 'EPiServer.Forms.UI'

-- Remove ancient and empty XForm data table
DROP TABLE tblXFormData

-- Remove unused property definition types from Episerver Forms, XForms, and three custom ones
DELETE FROM tblPropertyDefinitionType
WHERE  AssemblyName IN ('EPiServer.XForms', 'EPiServer.Forms.UI')

#282561
Jun 27, 2022 19:48
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.