SMBLibrary icon indicating copy to clipboard operation
SMBLibrary copied to clipboard

Throw TimeoutException instead of returning null

Open jtirjan opened this issue 1 year ago • 4 comments

jtirjan avatar Nov 09 '23 17:11 jtirjan

Thanks, I'll have to think about it. Also note that it would be the first usage of String interpolation using $ in this project, currently I'm maintaining C# 2.0 compatibility due to historic reasons, it's probably not needed anymore though, but I will not break it over a small thing.

TalAloni avatar Nov 09 '23 18:11 TalAloni

Thanks, I'll have to think about it. Also note that it would be the first usage of String interpolation using $ in this project, currently I'm maintaining C# 2.0 compatibility due to historic reasons, it's probably not needed anymore though, but I will not break it over a small thing.

When are you going to ever use a version of the compiler before 2005? The latest compiler version are backwards compatible all the way to 1.0. There is no reason to target a language version earlier than the lowest target runtime which in this case is .NET framework 4.0. That means at a bare minimum you should be targeting 7.3 and even that isn't required because 99% of language features don't require runtime capabilities.

https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/configure-language-version#defaults

KieranDevvs avatar Jan 07 '24 00:01 KieranDevvs

Hi Kieran,

  1. VS2005 support was dropped last week, you can now use string interpolation using $.
  2. I'm still not sure if I prefer throwing an exception or returning NTStatus.STATUS_INVALID_SMB, I'm leaning towards throwing an exception though.

TalAloni avatar Jan 07 '24 18:01 TalAloni

In principle you are right, if the server fails to respond in time the exception should be TimeoutException. In practice however it makes the client sample code longer (and I have an issue when first establishing connection where it may seem like a timeout but it's actually not an SMB server). it's also a breaking change. So I'm not 100% there yet.

TalAloni avatar Mar 01 '24 09:03 TalAloni