1

I have an old .Net console application that is running as a job on a sever. One part of it is that it uploads / creates files on another server via System.Net.WebClient. Sometimes I need to run this console manually on my machine. This consolse applicatin was always working fine for me and it still runs fine on the server and also runs fine for all of my coworkers. However, it stopped working for me yesterday:

enter image description here

English translation for the error message is "This property is not supported by this class." Unfortunately there is no inner exception. So this is the only information I get from the debugger.

So I'm sure I did not change anything in the code (I also rolled back from source controll to make sure). I know that it is working for my coworkers. So there must be something wrong with my computer I assume. I can still access the ftp target directory manually, so access problems are not the problem. However the only change that I made yesterday was installing PowerShell 6 via the existing PowerShell:

iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"

But honestly: I'm not sure if this is the culprit (One of my coworkers also has installed PowerShell 6) Uninstalling PowerShell 6 temporarily also did not help. I already searched the internet for this problem, but it seems as if I'm the only one and I'm running out of ideas what I can do to fix this.

Does anyone of you have an idea what else could be done?

Ralf
  • 293
  • 5
  • 15
  • What is the exception callstack? Can you isolate the `WebRequestMethods.Ftp.UploadFile` to identify if the exception is caused by that of by the `UploadString`? – Martin Prikryl Dec 05 '19 at 09:34
  • Which runtime do you have on the machine where it fails? – fredrik Dec 05 '19 at 09:42
  • Did you check if you have same version of the `System.Net.WebClient` its `System.dll`? – rjs123431 Dec 05 '19 at 09:44
  • Exception callstack is quite short: at System.Net.FtpWebRequest.get_ContentType() That's all. – Ralf Dec 05 '19 at 10:09
  • Runtime ist .Net 4.7.2, but it was that already before... – Ralf Dec 05 '19 at 10:10
  • In the project's references the System.dll is stating that it is runtime version v4.0.30319, but it directly contains System.Net so I do not see how there could be a version problem with that. – Ralf Dec 05 '19 at 10:18
  • I suggest that you can use [FtpWebRequest Class](https://learn.microsoft.com/en-us/dotnet/api/system.net.ftpwebrequest?view=netframework-4.8) to do some opreations on FTP. – Jack J Jun Dec 06 '19 at 07:20
  • @JackJJun-MSFT `WebClient` uses `(Ftp)WebRequest` internally. So it is pretty probable that it will suffer the same problem. Actually, the exception callstack confirms that. – Martin Prikryl Dec 06 '19 at 07:33
  • Furthermode I do not think changing the code is the right way here. As stated earlier the code only does not work on my computer so I assume the problem is there. – Ralf Dec 06 '19 at 10:45
  • I suggest that unchecking 'Break when this exception type is thrown'. Please try it and see if it works for you. – Jack J Jun Dec 09 '19 at 06:50

0 Answers0