Inhalte aufrufen

Profilbild

Program.cs Problems


  • Bitte melden Sie sich an, um eine Antwort zu verfassen.
1 Antwort zu diesem Thema

#1 Fred Jie

Fred Jie

    Newbie

  • Members
  • Punkt
  • 8 Beiträge

Geschrieben: 21 January 2023 - 07:40

Hello,
 
I am developing module using an external package. While the module was working successfully in version 5.0.1, we switched to 5.0.2 as a result of the upgrade. But when I activate the plugin, I get the error in the image below.
 
What is the reason of this?

 

Image: https://prnt.sc/Fv9zlr7FxWnB

Package: Wangkanai.Detection (6.11.3)

 

It's my startup.cs folder;

internal class Startup : StarterBase
    {
        public override void ConfigureServices(IServiceCollection services, IApplicationContext appContext)
        {
            services.AddTransient<IDbContextConfigurationSource<SmartDbContext>, SmartDbContextConfigurer>();

            // Add detection services container and device resolver service.
            services.AddDetection();

        }

        class SmartDbContextConfigurer : IDbContextConfigurationSource<SmartDbContext>
        {
            public void Configure(IServiceProvider services, DbContextOptionsBuilder builder)
            {
                builder.UseDbFactory(b =>
                {
                    b.AddModelAssembly(this.GetType().Assembly);
                });
            }
        }

        public override void ConfigureMvc(IMvcBuilder mvcBuilder, IServiceCollection services, IApplicationContext appContext)
        {
            mvcBuilder.AddOData();
        }

        public override void BuildPipeline(RequestPipelineBuilder builder)
        {
            builder.Configure(StarterOrdering.BeforeRoutingMiddleware, app =>
            {
                app.UseDetection();
            });
        }

        public override void ConfigureContainer(ContainerBuilder builder, IApplicationContext appContext)
        { 
        }
    }


#2 Marcus Gesing

Marcus Gesing

    SmartStore AG

  • Administrators
  • 3801 Beiträge

Geschrieben: 23 January 2023 - 16:10

Doesn't the debugger tell you which object is null? Please try the following change in line 243 of Program.cs:
old: && e.GetPropertyValue<string>("RequestPath").StartsWithNoCase("/odata/")
new: && e.GetPropertyValue<string>("RequestPath").EmptyNull().StartsWithNoCase("/odata/")

  • stefanmueller gefällt das

Marcus Gesing

Smartstore AG