SaaS CMS has officially launched! Learn more now.

Removing IClientResourceRegistrator from class breaks Episerver


I had a block controller which implemented the IClientResourceRegistrator interface. After removing the interface from the controller class, Episerver breaks on restart with an exception like:

Specified argument was out of the range of valid values.
Parameter name: instance 'MyControllerType' with ReturnType MyControllerType cannot be cast to EPiServer.Framework.Web.Resources.IClientResourceRegistrator

The exception stems from StructureMap, and I'm guessing it's because something has been persisted to the database.

Any ideas on how to solve this without having to keep the interface implementation with an empty RegisterResources method?

Oct 13, 2020 12:51

I guess I could probably rename the (controller) type after removing the interface to avoid the casting error, but I would still like to know the root cause of the problem. :)

Oct 14, 2020 6:51

I can't recall any callsite which might involve persistance of the client resource providers to the database.. You sure that this is not some weird cache / rebuild issue?

Oct 14, 2020 19:33
* 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.