Richard
asked on
Problems using ConnectAsync in c# DLL used by a VB6 program
I have a small C# DLL which uses the ConnectAsync method from System.Net.Sockets.TcpClient. This DLL is used by a VB6 program. The DLL was developed on a Windows 10 system using VS2017. On the same Windows 10 system I have the VB6 development environment and created a small VB6 program to test the DLL. Everything works fine - no errors, DLL performs as expected. My main program is a large VB6 program which is being developed on a Windows XP system. My problem is that on the Windows XP system, I get an error: Method not found:
"System.Threading.Tasks.task System.Net.Sockets.TcpClient.ConnectAsync"
when running the main program. If I take the main program to my Windows 10 system it runs fine. This makes it hard to develop!
The error is coming from the DLL when the initialization method is called where the ConnectAsync method is called.
I have Dot NET version 4 along with lower versions running on both the Windows 10 system and Windows XP system
"System.Threading.Tasks.task System.Net.Sockets.TcpClient.ConnectAsync"
when running the main program. If I take the main program to my Windows 10 system it runs fine. This makes it hard to develop!
The error is coming from the DLL when the initialization method is called where the ConnectAsync method is called.
I have Dot NET version 4 along with lower versions running on both the Windows 10 system and Windows XP system
ASKER
Hi Martin,
Actually the VB6 can handle the DLL. The VB6 program with the C# DLL runs fine on my Windows 10 system - running in the Windows 10 environment (not in a virtual machine of any sort). The problem is that all my VB6 development is done on a Windows XP (native not virtual) system (on another machine).. The reason I do this is because I use some components which won't install into the VB6 development environment under Windows 10, but work fine outside the development environment. I discovered this about 4 - 5 years ago when I first started switching my systems to Windows 10. I know that there is some dot net thing which is missing on my Windows XP machine, but can't find it. Like I said, I have the same levels of dot Net on both the Windows 10 and Windows XP machines. Also, just as an FYI, I have developed 2 other C# DLLs which I use in the VB6 program and they work fine.
Actually the VB6 can handle the DLL. The VB6 program with the C# DLL runs fine on my Windows 10 system - running in the Windows 10 environment (not in a virtual machine of any sort). The problem is that all my VB6 development is done on a Windows XP (native not virtual) system (on another machine).. The reason I do this is because I use some components which won't install into the VB6 development environment under Windows 10, but work fine outside the development environment. I discovered this about 4 - 5 years ago when I first started switching my systems to Windows 10. I know that there is some dot net thing which is missing on my Windows XP machine, but can't find it. Like I said, I have the same levels of dot Net on both the Windows 10 and Windows XP machines. Also, just as an FYI, I have developed 2 other C# DLLs which I use in the VB6 program and they work fine.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi John,
I have dot net ver 4.0xx on both systems. After digging, I ran across something (not sure where) which implied that ConnectAsync wouldn't run in Windows-XP. So now I'm working on getting my development environment up on a Windows 10 system. Anyway, thanks for the response.
Martin,
I see you dropped your "Older than dirt" line. I'm like you- it also makes me sad that VB6 has died. If I start a new project it will be with C#, VB.Net, or some other similar language. But this one is in use and my customer couldn't afford to have me re-write the whole thing. So I try to patch it where possible.
I have dot net ver 4.0xx on both systems. After digging, I ran across something (not sure where) which implied that ConnectAsync wouldn't run in Windows-XP. So now I'm working on getting my development environment up on a Windows 10 system. Anyway, thanks for the response.
Martin,
I see you dropped your "Older than dirt" line. I'm like you- it also makes me sad that VB6 has died. If I start a new project it will be with C#, VB.Net, or some other similar language. But this one is in use and my customer couldn't afford to have me re-write the whole thing. So I try to patch it where possible.
Probably the best solution to this is to rewrite the app in VB.Net or some other modern language because the odds are that the next windows update will likely completely kill VB6.