Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

After Windows 10 update 1803 my program can't open a socket when running from network share

I am running some self written Winforms .net 3.5 applications from a shared folder in Windows 10.

Everything worked correctly, but after the last big update (1803) the application doesn't start any more.

It seems that the program is crashing in the moment it is trying to open a socket. The first problem was when accessing the database it got the following exception:

2018-05-03 14:36:32,314 [1] ERROR NHibernate.Transaction.AdoTransaction [(null)] - Begin transaction failed
MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts. ---> System.Net.Sockets.SocketException: invalid argument
   at System.Net.Sockets.Socket..ctor(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
   at MySql.Data.Common.MyNetworkStream.CreateSocketStream(MySqlConnectionStringBuilder settings, IPAddress ip, Boolean unix)
   at MySql.Data.Common.MyNetworkStream.CreateStream(MySqlConnectionStringBuilder settings, Boolean unix)
   at MySql.Data.Common.StreamCreator.GetStream(MySqlConnectionStringBuilder settings)
   at MySql.Data.MySqlClient.NativeDriver.Open()

I've tried to work around this issue, but even accessing a SSH server didn't work when the program is started from the network share:

2018-05-03 14:30:30,654 [1] ERROR WinForms.SpringApplication [(null)] - Main Handler
Tamir.SharpSsh.jsch.JSchException: System.Net.Sockets.SocketException: invalid argument
   at System.Net.Sockets.Socket..ctor(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
   at Tamir.SharpSsh.java.net.Socket..ctor(String host, Int32 port)
   at Tamir.SharpSsh.jsch.Util.createSocket(String host, Int32 port, Int32 timeout)
   bei Tamir.SharpSsh.jsch.Session.connect(Int32 connectTimeout)
   bei Tamir.SharpSsh.SshBase.ConnectSession(Int32 tcpPort)
   bei Tamir.SharpSsh.SshBase.Connect(Int32 tcpPort)
   bei Tamir.SharpSsh.SshBase.Connect()

When I copy the directory locally the program works fine.

Any ideas why it seems that Windows is blocking access to sockets when I'm starting this program from a network share ?

I know about trusting .net code, so it can be run from a network share, but I've renewed the full trust and it still crashes (and normally it crashes much earlier if I didn't do a full trust).

like image 235
bernhardrusch Avatar asked May 03 '18 12:05

bernhardrusch


People also ask

Are there any problem with Windows 10 version 21H1?

Some Windows devices might have no audio after installing updates released August 9, 2022. On devices with more than one language installed, the Input Indicator and Language Bar might not show as expected. DSC resources in environments which require the PSCredential property might fail.

What is KB5015811?

Cumulative update KB5015811 was released by Microsoft on July 12, 2022 for Windows 10 Enterprise 2019 LTSC as well as Windows Server 2019 LTSC. The patch addressed security vulnerabilities and fixed a PowerShell issue.

What is Windows 10 version 21H1 for x64 based systems KB5014666?

Windows 10 KB5014666 is a new optional update for Windows 10 version 21H2 and version 21H1, and Windows 10 Server 20H2. Now, you can follow this MiniTool post to learn some related information about the new features, changes, and bug fixes in this new update.

What is KB5016623?

KB5016623 August 9, 2022It addresses an issue that might cause the Local Security Authority Server Service (lsass.exe) to leak tokens. This issue affects devices that have installed Windows updates dated June 14, 2022 and later.


2 Answers

We have some information about this issue:

Windows 10 update 1803 does not open network connections on executables files on SMBv1 share (as Windows Server 2003)

You can try to move your program to a SMBv2 or SMBv3 compatible server to check it.

like image 200
Israel T Avatar answered Sep 21 '22 22:09

Israel T


Microsoft fixed this on June 26, 2018 in the 2018-06 Cumulative Update for Windows 10 Version 1803 for x64-based Systems (KB4284848) (OS Build 17134.137).

One of the fixes is relevant:

Addresses an issue where some users may receive an error when accessing files or running programs from a shared folder using the SMBv1 protocol. The error is "An invalid argument was supplied".

This and other workarounds are discussed in:

https://blog.mertech.com/windows-10-version-1803-breaks-some-shared-folder-applications

like image 23
flxkid Avatar answered Sep 20 '22 22:09

flxkid