smartstore / Smartstore

A modular, scalable and ultra-fast open-source all-in-one eCommerce platform built on ASP.NET Core 7
http://www.smartstore.com/
GNU Affero General Public License v3.0
1.2k stars 447 forks source link

cannot run source code version of smartstore #502

Open giannik opened 2 years ago

giannik commented 2 years ago

Hello, After cloning and build project when I run the project from source code I get the following error :

Unhandled exception. Autofac.Core.DependencyResolutionException: An exception was thrown while activating Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionEndpointDataSourceFactory -> Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider

mrajalko commented 2 years ago

I am also facing same error

LucaGabi commented 2 years ago

Any solution ?

muratcakir commented 2 years ago

Could anyone please post the full stack trace.?

LucaGabi commented 2 years ago

@muratcakir

Unhandled exception. Autofac.Core.DependencyResolutionException: An exception was thrown while activating Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionEndpointDataSourceFactory -> Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider -> ?:Microsoft.AspNetCore.Mvc.Abstractions.IActionDescriptorProvider[] -> Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionDescriptorProvider.
 ---> Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(System.Collections.Generic.IEnumerable`1[Microsoft.AspNetCore.Mvc.ApplicationModels.IPageRouteModelProvider], Microsoft.Extensions.Options.IOptions`1[Microsoft.AspNetCore.Mvc.MvcOptions], Microsoft.Extensions.Options.IOptions`1[Microsoft.AspNetCore.Mvc.RazorPages.RazorPagesOptions])' on type 'PageActionDescriptorProvider'.
 ---> System.ArgumentNullException: Value cannot be null. (Parameter 'source')
   at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
   at System.Linq.Enumerable.OfType[TResult](IEnumerable source)
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionDescriptorProvider..ctor(IEnumerable`1 pageRouteModelProviders, IOptions`1 mvcOptionsAccessor, IOptions`1 pagesOptionsAccessor)
   at lambda_method344(Closure , Object[] )
   at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
   --- End of inner exception stack trace ---
   at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
   at Autofac.Core.Activators.Reflection.ReflectionActivator.<>c__DisplayClass12_0.<UseSingleConstructorActivation>b__0(ResolveRequestContext ctxt, Action`1 next)
   at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next)   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   --- End of inner exception stack trace ---
   at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.RegistrationPipelineInvokeMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.SharingMiddleware.<>c__DisplayClass5_0.<Execute>b__0()
   at Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid id, Func`1 creator)
   at Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid primaryId, Nullable`1 qualifyingId, Func`1 creator)
   at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request)
   at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request)
   at Autofac.Core.Resolving.ResolveOperation.Execute(ResolveRequest request)
   at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest request)
   at Autofac.Core.Container.ResolveComponent(ResolveRequest request)
   at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
   at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType)
   at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   at Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.GetOrCreateDataSource(IEndpointRouteBuilder endpoints)
   at Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.MapControllerRoute(IEndpointRouteBuilder endpoints, String name, String pattern, Object defaults, Object constraints, Object dataTokens)
   at Smartstore.Web.MvcStarter.<>c.<MapRoutes>b__5_0(IEndpointRouteBuilder routes) in C:\Work\opp\oss\Smartstore\src\Smartstore.Web.Common\MvcStarter.cs:line 233
   at Smartstore.Engine.Builders.EndpointRoutingBuilder.Build(IEndpointRouteBuilder builder) in C:\Work\opp\oss\Smartstore\src\Smartstore\Engine\Builders\EndpointRoutingBuilder.cs:line 35
   at Smartstore.Engine.SmartEngine.EngineStarter.<>c__DisplayClass4_0.<ConfigureApplication>b__0(IEndpointRouteBuilder endpoints) in C:\Work\opp\oss\Smartstore\src\Smartstore\Engine\SmartEngine.cs:line 167
   at Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions.UseEndpoints(IApplicationBuilder builder, Action`1 configure)
   at Smartstore.Engine.SmartEngine.EngineStarter.ConfigureApplication(IApplicationBuilder app) in C:\Work\opp\oss\Smartstore\src\Smartstore\Engine\SmartEngine.cs:line 160
   at Program.<Main>$(String[] args) in C:\Work\opp\oss\Smartstore\src\Smartstore.Web\Program.cs:line 120
muratcakir commented 2 years ago

This is really strange. The strack trace indicates that there is a problem with the environment. We have not been able to reproduce this yet. The exception is thrown by an ASP.NET core dependency, not a Smartstore one. Analyzing affected code parts with dotPeek does not give us any hint.

Did you throw in any custom code?

LucaGabi commented 2 years ago

@muratcakir first, thanks for the response. All I did is clone the repo from main branch and after nuget restore and successful (build) compilation I tried to start the SmartStore.Web project in debug mode from VS2022 IDE. Also my env var ASPNET_ENVIRONVENT is set to "development".

What would the right steps be to start the app for development in debug mode ?

muratcakir commented 2 years ago

What would the right steps be to start the app for development in debug mode?

Nothing more than you did. How is your launch profile configured? IIS Express, IIS?

LucaGabi commented 2 years ago

launch profile configured? IIS Express, IIS?

No .. just start SmartStore.Web

LucaGabi commented 2 years ago

image

LucaGabi commented 2 years ago

image

LucaGabi commented 2 years ago

2022-09-11 16 38 19 localhost b172a221056f

muratcakir commented 2 years ago

At the bottom of your screenshot it says: ...NET 6.0.2 Hosting. Smartstore currently requires AspNetCore Core 6.0.7. It also indicates that you use IIS, not IIS Express. That's what I asked for in my post above.

Please update the hosting runtime for IIS, OR, use IIS Express, which is a much better choice for debugging purposes.

LucaGabi commented 2 years ago

Thanks I'll give it a try.

MahamatTech commented 2 years ago

Hi, it's my first day in this project, let me know if you need help LucaGabi.