ASP.NET Core via Visual Studio on Mac throws DI error RE VirtualContextRequestPrincipalRetriever

Dean Lynn asked on April 11, 2022 13:49

We have a Kentico Xperience 13 solution running version v13.0.52.

The website element is built using ASP.NET Core and is targeting .NET 6.0.

The solution runs well on Windows based machines.

We are attempting to run the ASP.NET Core website element of the solution via Visual Studio 2022 for Mac.

The project compiles without issue, however, we are seeing an error when attempting to run the website.

We are running the website via the built in Visual Studio debugger.

I Have copied the error below.

I have found the following question raised which suggests a similar issue, albeit it not running on Mac:

https://devnet.kentico.com/questions/k13-medioclinic-exception-resolution-of-cms-base-isiteservice-failed

While I look through that question and the replies for clues, I was hoping to find additional support in the community for our specific scenario.

Has anyone successfully run an ASP.NET Core Kentico Xperience 13 website via Visual Studio on Mac?

Has anyone else seen this issue?

I would be grateful for any help you can provide.

Thanks!

An unhandled exception occurred while processing the request.

NullReferenceException: Object reference not set to an instance of an object.

CMS.Membership.Internal.VirtualContextAuthenticationConfiguration.get_Audience()

DependencyResolutionException: An exception was thrown while invoking the constructor 'Void.ctor()' on type 'VirtualContextRequestPrincipalRetriever'.

Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()

DependencyResolutionException: An exception was thrown while activating λ:Kentico.Web.Mvc.Internal.IRequestPrincipalRetriever[] -> Kentico.Content.Web.Mvc.VirtualContextRequestPrincipalRetriever.

Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action<ResolveRequestContext> next)

Recent Answers


Eugene Paden answered on April 12, 2022 21:46

Can you please share your Startup.cs?

Have you tried running it from the terminal and see if you are still getting the error?

Also, you might want to upgrade your libraries to at least 13.0.65

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.