ARSoft.Tools.Net icon indicating copy to clipboard operation
ARSoft.Tools.Net copied to clipboard

How to set timeout or stop resolving ?

Open elberthughes5 opened this issue 6 years ago • 1 comments

I have a list of domain names i'm trying to get their SPF addresses using the ARSoft package, but some requests return a huge result because something went wrong with extracting those domains SPF addresses, what I want to do is skip those domains, but C# does not catch StackOverFlowException, here is my lines:

var resolver = new DnsStubResolver(new DnsClient(IPAddress.Parse("8.8.8.8"), 3000));
List<TxtRecord> records = new List<TxtRecord>();
try {
    records = resolver.Resolve<TxtRecord>(array[0].ToString(),  RecordType.Txt);
} catch(StackOverflowException ex) { 
    return;
} 

foreach (var record in records) { ... } 

the "return" doesn't get executed because the app is blocked and the VS window is brought to front with the exception, any ideas ?

elberthughes5 avatar Apr 19 '18 15:04 elberthughes5

Found out there's a ResolveAsync method with CancellationToken parameter, I believe it can solve my problem, how to use it ?

elberthughes5 avatar Apr 19 '18 17:04 elberthughes5

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 17 '22 04:12 stale[bot]