A generic error occurred in GDI+, JPEG Image to MemoryStream

前端 未结 30 1255
再見小時候
再見小時候 2020-11-22 06:47

This seems to be a bit of an infamous error all over the web. So much so that I have been unable to find an answer to my problem as my scenario doesn\'t fit. An exception ge

30条回答
  •  南笙
    南笙 (楼主)
    2020-11-22 06:59

    I found that if one of the parent folders where I was saving the file had a trailing space then GDI+ would throw the generic exception.

    In other words, if I tried to save to "C:\Documents and Settings\myusername\Local Settings\Temp\ABC DEF M1 Trended Values \Images\picture.png" then it threw the generic exception.

    My folder name was being generated from a file name that happened to have a trailing space so it was easy to .Trim() that and move on.

提交回复
热议问题