1

I have several VB program written in Visual Studio 2017 When my program loads it checks the host name and IP address of the computer for security logging. This worked fine up until the last week when the programs will no longer run on Windows 10 Systems. They still work on Windows 7.

Here is the code that gets the info:

Dim strHostName As String = System.Net.Dns.GetHostName()
Dim iphe As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(strHostName)
Dim strIPAddress As String

   .
   .
   .

   For Each ipheal As System.Net.IPAddress In iphe.AddressList
        If ipheal.AddressFamily = System.Net.Sockets.AddressFamily.InterNetwork Then strIPAddress = ipheal.ToString()
   Next

This is the error from windows event viewer:

 Description: The process was terminated due to an unhandled exception.
Exception Info: System.Net.Sockets.SocketException
at System.Net.Dns.GetAddrInfo(System.String)
at System.Net.Dns.InternalGetHostByName(System.String, Boolean)
at System.Net.Dns.GetHostEntry(System.String)
at Program.Form1..ctor()

. . . Faulting module name: KERNELBASE.dll, version: 10.0.17134.1, time stamp: 0x701ca188 Exception code: 0xe0434352

Any ideas what could be causing this and how to implement a workaround?

Thanks in advance.

Dantom
  • 71
  • 1
  • 4
  • 1
    The first lesson is not do things like this that are outside your control and not provide error handling. As for the issue, if the code was working before but not now and you haven't changed the code then the machines must have changed somehow. You need to find out what changed. – jmcilhinney Jun 12 '18 at 08:46
  • Wrap your code in a `Try/Catch` statement and log the exception to get more detailed information. – Visual Vincent Jun 12 '18 at 09:59
  • Examine the value of the [SocketException.ErrorCode Property](https://msdn.microsoft.com/en-us/library/system.net.sockets.socketexception.errorcode.aspx). – Andrew Morton Jun 12 '18 at 10:28
  • 1803 strikes again? – Mary Jun 12 '18 at 20:38
  • See [KERNELBASE.dll Exception 0xe0434352](https://stackoverflow.com/questions/23292547/kernelbase-dll-exception-0xe0434352-offset-0x000000000000a49d) and the duplicate question. I suggest to use [System.Net.NetworkInformation](https://msdn.microsoft.com/en-us/library/system.net.networkinformation(v=vs.110).aspx) to get details on a machine IpAddresses. – Jimi Jun 12 '18 at 22:41

0 Answers0