Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breaking changes? #91

Closed
ghost opened this issue Oct 21, 2020 · 3 comments
Closed

breaking changes? #91

ghost opened this issue Oct 21, 2020 · 3 comments

Comments

@ghost
Copy link

ghost commented Oct 21, 2020

Exception thrown: 'DnsClient.DnsResponseException' in mscorlib.dll
System.IO.FileLoadException' in DnsClient.dll

so I am having this weird issue where the code works fine in untouched builds but once building in debug or sometimes release mode i get system IO File load exception and DNSClient reponse exception with no real clear definition of what the hell is going on

this is the code
private async void StartTrace()
{
DisplayStatusMessage = true;
Console.WriteLine("starting trace");
IsTraceRunning = true;

        TraceResults.Clear();

        // Change the tab title (not nice, but it works)
        var window = System.Windows.Application.Current.Windows.OfType<Window>().FirstOrDefault(x => x.IsActive);

        if (window != null)
        {
            foreach (var tabablzControl in VisualTreeHelper.FindVisualChildren<TabablzControl>(window))
            {
                tabablzControl.Items.OfType<DragablzTabItem>().First(x => x.Id == TabId).Header = Host;
            }
        }

        _cancellationTokenSource = new CancellationTokenSource();

        // Try to parse the string into an IP-Address
        if (!IPAddress.TryParse(Host, out var ipAddress))
            Console.WriteLine("Trying parse the string into an ip address");
        {
            ipAddress = await DnsLookupHelper.ResolveIPAddress(Host);
            Console.WriteLine("Attempting resolve IP Address");

        }

        if (ipAddress == null) 
            
        {                
            TracerouteFinished();

            StatusMessage = string.Format(Localization.Resources.Strings.CouldNotResolveIPAddressFor, Host);
            DisplayStatusMessage = true;
             
            Console.WriteLine("failed to get IP Address");

            return;
        }

        try
        {
            var traceroute = new Traceroute
            {
                Timeout = SettingsManager.Current.Traceroute_Timeout,
                Buffer = new byte[SettingsManager.Current.Traceroute_Buffer],
                MaximumHops = SettingsManager.Current.Traceroute_MaximumHops,
                DontFragement = true,
                ResolveHostname = SettingsManager.Current.Traceroute_ResolveHostname

            };
            Console.WriteLine("Sucessfully resolved string into IP Address");
            traceroute.HopReceived += Traceroute_HopReceived;
            traceroute.TraceComplete += Traceroute_TraceComplete;
            traceroute.MaximumHopsReached += Traceroute_MaximumHopsReached;
            traceroute.UserHasCanceled += Traceroute_UserHasCanceled;

            traceroute.TraceAsync(ipAddress, _cancellationTokenSource.Token);

            // Add the host to history
            AddHostToHistory(Host);
        }
        catch (Exception ex) // This will catch any exception
        {
            TracerouteFinished();

            StatusMessage = ex.Message;
            DisplayStatusMessage = true;
        }
    }

I wasn't having this issue yesterday and I haven't messed with this file for months now? what can be the deal?

@ghost
Copy link
Author

ghost commented Oct 22, 2020

after loading it up in jetbrains rider, i think i found the main issue why its giving me that message, DnsClient.DnsResponseException: Unhandled exception ---> System.TypeInitializationException: The type initializer for 'DnsClient.Internal.PooledBytes' threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at DnsClient.Internal.PooledBytes..cctor() --- End of inner exception stack trace --- at DnsClient.Internal.PooledBytes..ctor(Int32 length) at DnsClient.DnsDatagramWriter..ctor() at DnsClient.DnsUdpMessageHandler.<QueryAsync>d__7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
at System.Threading.Tasks.TaskExtensions.d__01.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
at DnsClient.LookupClient.d__77.MoveNext()
--- End of inner exception stack trace ---
at DnsClient.LookupClient.d__77.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() at DnsClient.DnsQueryExtensions.<GetHostEntryFromNameAsync>d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at NETworkManager.Utilities.DnsLookupHelper.d__2.MoveNext() in C:\Users\Specter FXX-K\Documents\NETworkManager\Source\NETworkManager.Utilities\DnsLookupHelper.cs:line 65`

@ghost
Copy link
Author

ghost commented Oct 22, 2020

update: for people having issues with system.buffers
grab the 1.2.0 source code version , change the targeting framework to 4.7.2 or higher
im using 4.6.2,
update system.buffers in dns client csproj
build in release mode
reference it in your project (dnsclient and system.buffers), and compile your project, the errors should disappear

@MichaCo
Copy link
Owner

MichaCo commented Oct 22, 2020

#59

@MichaCo MichaCo closed this as completed Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant