Repository navigation
Description
Description
When running the 3rd party applications with dotnet-sdk-preview.7.25351.101, MVCBlog app register account failed with error "SocketException: No such host is known".
Reproduction Steps
App Repro steps:
Make sure the machine has localDB and dotnet-sdk-10.0.100-preview.7.25351.101 installed .
- Copy \***\BugRepro_Share\2521054\App\MVCBlog to local machine and change MVCBlog.Web.runtimeconfig as following to run the app with dotnet-sdk-10.0.100-preview.7.25351.101.
"frameworks": [ { "name": "Microsoft.NETCore.App", "version": "10.0.0-preview.7.25351.101" }, { "name": "Microsoft.AspNetCore.App", "version": "10.0.0-preview.7.25351.101" } ]
2.Open the Command Prompt.
3.Navigate to the project directory by entering: cd <- app folder path ->
4.Set the environment variable to Development: set ASPNETCORE_ENVIRONMENT=Development
5.Run the application: dotnet MVCBlog.Web.dll
6.Open http://localhost:5000 with Edge.
7.Click “Register” Button.
(The value in step8~step12 can be set freely)
8.Frist name Input “test”.
9.Last name Input “test.”
10.Input “test@163.com” In the Email.
11.Input “” in the “Password”.
12.Input “” in the “Confirm Password”.
13.Click ”Register” Button.
Expected behavior
Register successfully.
Actual behavior
Show error:
SocketException: No such host is known.
MailKit.Net.SocketUtils.ConnectAsync(string host, int port, IPEndPoint localEndPoint, CancellationToken cancellationToken)
MailKit.Net.SocketUtils.ConnectAsync(string host, int port, IPEndPoint localEndPoint, int timeout, CancellationToken cancellationToken)
MailKit.MailService.ConnectNetworkAsync(string host, int port, CancellationToken cancellationToken)
MailKit.Net.Smtp.SmtpClient.ConnectAsync(string host, int port, SecureSocketOptions options, CancellationToken cancellationToken)
MVCBlog.Business.Email.EmailNotificationService.SendNotificationAsync(Message message) in EmailNotificationService.cs
await client.ConnectAsync(this.mailSettings.MailHost, this.mailSettings.MailPort, this.mailSettings.UseSsl);
MVCBlog.Web.Infrastructure.Mvc.EmailSenderAdapter.SendEmailAsync(string email, string subject, string htmlMessage) in EmailSenderAdapter.cs
await this.notificationService.SendNotificationAsync(message);
MVCBlog.Web.Areas.Identity.Pages.Account.RegisterModel.OnPostAsync(string returnUrl) in Register.cshtml.cs
await _emailSender.SendEmailAsync(Input.Email, "Confirm your email",
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory+GenericTaskHandlerMethod.Convert<T>(object taskAsObject)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory+GenericTaskHandlerMethod.Execute(object receiver, object[] arguments)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync()
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync()
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Rethrow(PageHandlerExecutedContext context)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
MVCBlog.Web.Infrastructure.Mvc.SecurityHeaders.SecurityHeadersMiddleware.Invoke(HttpContext context) in SecurityHeadersMiddleware.cs
await this.next(context);
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
Regression?
Yes
Verify Scenarios:
- Windows 11 24H2 x64 + dotnet-sdk-9.0.104: Pass
- Windows 11 24H2 x64 + dotnet-sdk-10.0.100-preview.6.25326.107: Pass
- Windows 11 24H2 x64 + dotnet-sdk-10.0.100-preview.7.25351.101: Fail
Known Workarounds
No response
Configuration
Application Name: MVCBlog
OS: Windows 11 21H2
CPU: X64
.NET Build Number: 10.0.100-preview.7.25351.101
Shared App & App Source Location checking at: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2521054
Github Link:https://github.com/danielpalme/MVCBlog
Other information
Findings:
We found that the issue is that the value in appsettings.Development.json cannot be obtained correctly in development mode.
In appsettings.json, the value of the parameter "sendMails" is "true".
In appsettings.Development.json, the value of the parameter "sendMails" is "false".
When we debug the app in development mode with the latest version sdk dotnet-sdk-10.0.100-preview.7.25351.101,
the value of the parameter "sendMails" we can obtain is "false" at the beginning, but it will change to "true" after app.run().
@dotnet-actwx-bot @dotnet/compat

Activity
dotnet-policy-service commentedon Jul 4, 2025
Tagging subscribers to this area: @dotnet/area-extensions-configuration
See info in area-owners.md if you want to be subscribed.
tarekgh commentedon Jul 6, 2025
This looks aspnet issue who may need to investigate first.
Junjun-zhao commentedon Jul 8, 2025
This issue #117445 is same as this issue, both are caused by the value in appsettings.Development.json cannot be obtained correctly in development mode. Please refer to more details from Findings.
halter73 commentedon Jul 8, 2025
I can confirm that the IConfiguration indexer (e.g.
app.Configuration["MailSettings:SendMails"]) is correctly returning"False", butMailSettings.SendMailsgets settrueby the ConfigurationBinder. It looks like this was probably a regression introduced by #116677.halter73 commentedon Jul 8, 2025
I think the issue is that we need to reverse the providers in InternalConfigurationRootExtensions like we do in ConfigurationRootExtensions:
runtime/src/libraries/Microsoft.Extensions.Configuration/src/InternalConfigurationRootExtensions.cs
Line 45 in 2c426a1
runtime/src/libraries/Microsoft.Extensions.Configuration.Abstractions/src/ConfigurationRootExtensions.cs
Line 85 in 2c426a1
dotnet-policy-service commentedon Jul 8, 2025
Tagging subscribers to this area: @dotnet/area-extensions-configuration
See info in area-owners.md if you want to be subscribed.
ericstj commentedon Jul 9, 2025
Thanks for the investigation @halter73! So this regressed because we changed the method that the binder used to fetch (and aggregate) the providers' values and we missed that the existing method would iterate providers in reverse order. We should make sure we add a test for that and fix the order. Thank you for picking this up @tarekgh.
tarekgh commentedon Jul 9, 2025
#117445
Junjun-zhao commentedon Jul 15, 2025
Verified this issue with dotnet-sdk-10.0.100-preview.7.25362.103, it has been fixed.