Error using .NET c# code utilizing image save function

Advertisement

falsalarm
Joined:
Posts:
2
Location:
Canada

Error using .NET c# code utilizing image save function

Hi,

I'm not sure exactly what is going wrong with my code or why it doesn't work but I'm hoping someone can help me figure it out. Here is my pastebin of the function that has gone terribly wrong.

<invalid hyperlink removed by admin>

I receive an unahndled exception on this line here

image.Save(fileName);

The value of fileName that visual studio reports to me, is the following string.

"C:\\Users\\suppo\\source\\repos\\Ricks Scraper Version 3\\bin\\Debug\\smartphones\\images\\AIEK-E1-Single-SIM-65mm-Thickness-Card-Mobile-Phone-Support-Bluetooth-TF-Card-UUU(Black)\\AIEK-E1-Single-SIM-65mm-Thickness-Card-Mobile-Phone-Support-Bluetooth-TF-Card-UUU(Black).png"

I don't really know precisely what I'm doing half the time when it comes to programming in c# but I think the problem with that filename is that it is too long for the Save function.

$exception {"A generic error occurred in GDI+."} System.Runtime.InteropServices.ExternalException

That message is what it says when I click on View Details(in visual studio)

But, what I really would like to know is how to fix?

pls and thx,

Note: I had to modify the filename above for this post because GS-M is a word that is not allowed. I replaced it with UUU in the above filename. I also just put a dash in the GS-M so you remove it and you get the real banned word which is GS-M without this dash(-).

Reply with quote

Advertisement

falsalarm
Joined:
Posts:
2
Location:
Canada

I thought I'd post some facts about my problem. It's not a permissions issue as I'm running the visual studio app with administrator priveledges.

When I run the application, it scrapes data from the target website and does 1600 other phones without any issues but this one phone contains periods in the filename. Precisely at where it says 65mm, it should read as 6.5mm but I wrote that little diddy in there that removes the period as you can see but it still gives off that same exception. I'm not sure if it's a winscp issue or not really.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,605
Location:
Prague, Czechia

Re: Error using .NET c# code utilizing image save function

But you call image.Save before any WinSCP code it involved. So this does not look like WinSCP question. Please ask at some generic programming forum, like Stack Overflow.

Reply with quote

Advertisement

You can post new topics in this forum