Skip to content

Audit Log Exception - Error querying domain check in Swedish locale - Exception Parsing Question for Audit Log. #227

@IainS1986

Description

@IainS1986

We've noticed an issue when doing a domain check on a device (were using it in a .net8 application running .net-ios on an iphone or .net-android on Android devices) when the phones locale is set to Swedish.

We do a query as the following...

await _dnsLookupClient.QueryAsync(domain, QueryType.MX, cancellationToken: cancellationToken);

With just as an example, the domain as hotmail.com (obviously a fine domain)

This throws the following exception...

Query 28105 => hotmail.com IN MX on 8.8.8.8:53 failed with an error.
   at DnsClient.LookupClient.ResolveQueryAsync(IReadOnlyList`1 servers, DnsQuerySettings settings, DnsMessageHandler handler, DnsRequestMessage request, LookupClientAudit audit, CancellationToken cancellationToken)
   at DnsClient.LookupClient.QueryInternalAsync(DnsQuestion question, DnsQuerySettings queryOptions, IReadOnlyCollection`1 servers, CancellationToken cancellationToken)

With inner stack trace

Input string was not in a correct format. Failure to parse near offset 3. Expected an ASCII digit.
   at System.Text.ValueStringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ReadOnlySpan`1 args)
   at System.String.FormatHelper(IFormatProvider provider, String format, ReadOnlySpan`1 args)
   at System.String.Format(String format, Object[] args)
   at DnsClient.DnsQuestion.ToString(Int32 offset)
   at DnsClient.LookupClientAudit.AuditEnd(IDnsQueryResponse queryResponse, NameServer nameServer)
   at DnsClient.LookupClient.ResolveQueryAsync(IReadOnlyList`1 servers, DnsQuerySettings settings, DnsMessageHandler handler, DnsRequestMessage request, LookupClientAudit audit, CancellationToken cancellationToken)

Any ideas on whats going on or if theres something were missing? Seems quite odd being Swedish locale specific and the domain is a plain english string of 'hotmail.com' (no non ascii chars)

This is our setup

_dnsLookupOptions = new LookupClientOptions(_dnsServers)
{
    AutoResolveNameServers = false, //Android (Update - and now iOS) does not have support for AutoResolve, will throw can't find 'etc/resolve.conf' file
    EnableAuditTrail = true,
    ThrowDnsErrors = false,
    Retries = 0,
    Timeout = TimeSpan.FromSeconds(7.5),
    ContinueOnDnsError = true,
   ContinueOnEmptyResponse = true,
    UseCache = true
};
_dnsLookupClient = new LookupClient(_dnsLookupOptions);

And these are the DNS servers we currently use

// List of internationally available public DNS servers:
var listDnsServers = new List<IPAddress>()
{
    new IPAddress(new byte[] { 8, 8, 8, 8 }),               // Google DNS
    new IPAddress(new byte[] { 8, 8, 4, 4 }),               // Google DNS
    new IPAddress(new byte[] { 9, 9, 9, 9 }),               // Quad-9 DNS
    new IPAddress(new byte[] { 149, 112, 112, 112 }),       // Quad-9 DNS
    new IPAddress(new byte[] { 208, 67, 222, 123 }),        // OpenDNS
};

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions