Replace deprecated Uri.DnsSafeHost with Uri.IdnHost#3256
Merged
Conversation
|
|
Co-authored-by: marcschier <[email protected]>
Copilot
AI
changed the title
[WIP] Update deprecated DnsSafeHost to use IdnHost
Replace deprecated Uri.DnsSafeHost with Uri.IdnHost
Oct 12, 2025
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3256 +/- ##
==========================================
- Coverage 57.74% 57.72% -0.03%
==========================================
Files 365 365
Lines 79419 79419
Branches 13865 13865
==========================================
- Hits 45862 45842 -20
- Misses 29310 29321 +11
- Partials 4247 4256 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
marcschier
approved these changes
Oct 14, 2025
…dard into copilot/update-dns-safe-host-usage
marcschier
marked this pull request as ready for review
October 14, 2025 12:23
romanett
approved these changes
Oct 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR replaces all instances of the deprecated
Uri.DnsSafeHostproperty with the recommendedUri.IdnHostproperty across the codebase, addressing issue #2782.Background
According to Microsoft documentation,
Uri.DnsSafeHostis deprecated because it depends on app.config settings that cannot be changed by Windows Store applications.Uri.IdnHostis provided as the preferred alternative because it is guaranteed to always be DNS safe, regardless of the current app.config settings.Changes
This PR updates 25 instances of
DnsSafeHostacross 13 files:Core Stack:
Stack/Opc.Ua.Core/Types/Utils/Utils.cs- Domain comparison and localhost replacement logicStack/Opc.Ua.Core/Stack/Configuration/ConfiguredEndpoints.cs- Endpoint URL matchingStack/Opc.Ua.Core/Stack/Configuration/ApplicationConfiguration.cs- Domain name extractionStack/Opc.Ua.Core/Stack/Server/ServerBase.cs- Endpoint address resolutionStack/Opc.Ua.Core/Stack/Client/DiscoveryClient.cs- Discovery endpoint URL buildingStack/Opc.Ua.Core/Stack/Tcp/TcpMessageSocket.cs- TCP endpoint creationStack/Opc.Ua.Core/Security/Certificates/CertificateValidator.cs- Certificate hostname validationStack/Opc.Ua.Core/Security/Certificates/X509Utils.cs- Certificate domain name verificationLibraries:
Libraries/Opc.Ua.Client/CoreClientUtils.cs- Client endpoint URL construction (specifically mentioned in [Client] Read large dictionaries #2782)Libraries/Opc.Ua.Gds.Client.Common/RegisteredApplicationExtensions.cs- HTTPS domain name resolutionLibraries/Opc.Ua.Gds.Server.Common/ApplicationsNodeManager.cs- Application domain name managementTests:
Tests/Opc.Ua.Core.Tests/Stack/Client/ClientTests.cs- URI builder testsTests/Opc.Ua.Core.Tests/Stack/Server/ServerBaseTests.cs- Endpoint normalization testsTesting
All existing tests pass with the new property:
The changes are functionally equivalent as
IdnHostprovides the same DNS-safe hostname asDnsSafeHostbut with better cross-platform compatibility.Impact
This is a low-risk enhancement that:
Closes #2782
Original prompt
Fixes #2467
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.