chenwp#32903
When I use PsdReader to read psd fild,I foreach frames and use GetBitmap method .I meet a error:
An unhandled exception of type 'System.AccessViolationException' occurred in Unknown Module. Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
This error stopped my development environment from running.I try to capture this error. But I can not. C# code ' try{}catch(Exception e){} ' doesn't work at all.
My code is :
An unhandled exception of type 'System.AccessViolationException' occurred in Unknown Module. Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
This error stopped my development environment from running.I try to capture this error. But I can not. C# code ' try{}catch(Exception e){} ' doesn't work at all.
My code is :
var image = new PsdReader(sourceFileName);
for (int i = 1; i < image.Frames.Count; i++)
{
try
{
var layer = image.Frames[i];
if (layer.Type == FrameType.Group)
{
continue;
}
using (var bitmap = layer.GetBitmap()) //There's going to be a mistake.
{
var ms = new MemoryStream();
bitmap.Save(ms, new PngSettings());
var image2 = Image.FromStream(ms);
image2.Save(dataDir + "testimg\\" + i + ".png");
}
}
catch (Exception e)
{
continue;
}
}