Skip to content

[dotnet-sdk-7.0.100-alpha.1.21568.2]Etymology App failed to launch with error that Header's referrer is missing  #63479

Closed

Description

@Junjun-zhao

Description

Etymology App failed to launch with error that Header's referrer is missing when run against .NET 7.0.

Reproduction Steps

Repro steps for the Problematic App:
This is 5.0 app, issue occurs when we run against .NET 7.0

1.Launch Etymology.Web.exe from Etymology.
2.Open Edge https://localhost:5001.

Minimal Repro steps:
1.Create a new web project.
2.Create a settings.json.

{
  "IndexPagePaths": [ "/", "/index.htm" ]
}

3.Create Settings.cs.

    public class Settings
    {
        public List<string> IndexPagePaths { get; } = new();
    }

4.Input the following code in startup.cs.

        public Startup()
        {
            IConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
            configurationBuilder.AddJsonFile(Path.Combine("settings.json"), optional: false, reloadOnChange: true);
            this.configuration = configurationBuilder.Build();
        }

        public static IServiceCollection AddSettings<TSettings>(this IServiceCollection services, IConfiguration configuration, out TSettings settings)
            where TSettings : class
        {
            settings = configuration.Get<TSettings>();
            return services.AddSingleton(settings);
        }

        public void ConfigureServices(IServiceCollection services)
        { 
            services.AddSettings(this.configuration, out Settings settings);
            if (settings.IndexPagePaths.Count == 0) 
            {
                Console.WriteLine("Can't get IndexPagePaths!");
            };
            services.AddRazorPages();
        }

5.When use default sdk 5.0, settings.IndexPagePaths.Count == 2.
When use sdk 7.0, settings.IndexPagePaths.Count == 0.

Expected behavior

Web page should load successfully.

Actual behavior

It shows an error: Header's referrer is missing.

Regression?

Yes

Verify Scenarios:
1). Windows rs5 x64 + dotnet-sdk-7.0.100-alpha.1.21568.2: Fail
2). Windows rs5 x64 + dotnet-sdk-5.0.404-win-x64:Pass
3). Windows rs5 x64 + dotnet-sdk-6.0.101:Pass

Known Workarounds

It will work after changing

public List<string> IndexPagePaths { get; } = new(); 

to

public List<string> IndexPagePaths { get; set;} = new();

Configuration

Application Name: Etymology
OS: Windows 10 RS5
CPU: X64
.NET Build Number: dotnet-sdk-7.0.100-alpha.1.21568.2

App Github Repo link: https://github.com/Dixin/Etymology

App, App Source and Minimal Repro Code checking at: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1458234

Other information

@dotnet-actwx-bot @dotnet/compat

Activity

  1. transferred this issue fromon Jan 6, 2022
  2. Repository owner unassigned on Jan 6, 2022
  3. mkArtakMSFT commented on Jan 6, 2022

    @mkArtakMSFT

    @adityamandaleeka not sure why this was transferred to us as it feels to be configuration options related, but moving over to your area path as you have more expertise in this area.

  4. ericstj commented on Jan 6, 2022

    @ericstj
    Member

    Agree with @mkArtakMSFT that this looks like the configuration binder. It looks like this was regressed by 97ef512

  5. transferred this issue fromdotnet/aspnetcoreon Jan 6, 2022
  6. ghost added
    untriaged
    on Jan 6, 2022
  7. added this to the 7.0.0 milestone on Jan 6, 2022
  8. ericstj commented on Jan 6, 2022

    @ericstj
    Member

    I was able to repro this with a simple console app. The first 7.0 build that repros is 7.0.0-alpha.1.21514.8 which corresponds to #60415 cc @safern @danielmpetrov

    That change broke the scenario where an object has a read-only property with a mutable collection.

    Here's a simple repro:
    config.zip

  9. safern commented on Jan 7, 2022

    @safern
    Member

    Interesting that we didn't have test coverage for that scenario. We should definitely fix this, I'm not longer on this area ownership, but shouldn't be a hard fix.

  10. ghost added
    in-pr
    on Jan 10, 2022
  11. ericstj commented on Jan 10, 2022

    @ericstj
    Member

    Reverting the regression for now. I'll add the detail to the other issue to address this scenario in the fix.

  12. ghost removed
    in-pr
    on Jan 10, 2022
  13. Junjun-zhao commented on Jan 18, 2022

    @Junjun-zhao
    MemberAuthor

    Verified and pass with dotnet-sdk-7.0.100-alpha.1.22065.3.

  14. ghost locked as resolved and limited conversation to collaborators on Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Extensions-Configurationregression-from-last-releaseuntriaged

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions