What i'm trying to do: Resize white pixels but keep original image Width & Height
Error: newImage=error CS0103: The name 'newImage' does not exist in the current context

void Resize() is called under a Task
this[layerIndex].Image; // Creates a new Image
Parallel Loop is executed once, every image instance are new objects created inside the loop (Not shared with other iterations)
Only line "newImage.Mutate(o => o.DrawImage(image, location, 1f));" can trigger the error, Resize operation always pass.
Collection is from 500 to 1000 images but i also tried with just one, same behaviour
This error don't always happens, if i keep redoing same operation sometimes it finish ok without error, others dont.
If i turn Parallel for into a normal for loop problem seens to never happen but of course way slower than using parallel which is what make me use Parallel instead.
@sn4k3 how is the compilation error CS0103 related to the rest of the issue?
Any chance you can create a self-contained console app repro? A lot may depend on image sizes, position of x,y and other contextual factors.
Repo here: https://github.com/sn4k3/PrusaSL1Viewer
How to reproduce: Execute Main app -> Menu -> Open -> sl1 file from zip. Go to Menu -> Mutators -> Resize -> Pick any value diferent from 100 -> Click ok -> Error happen here
Note the error doesn't always trigger but most of the times will
Void Resize(): https://github.com/sn4k3/PrusaSL1Viewer/blob/master/PrusaSL1Reader/FileFormat.cs#L636
Called at: https://github.com/sn4k3/PrusaSL1Viewer/blob/master/PrusaSL1Viewer/FrmMain.cs#L1893
I think this might be related to #1230 @sn4k3 if you can provide a stack trace that would be really useful.
System.NullReferenceException
HResult=0x80004003
Message=A refer锚ncia de objecto n茫o foi definida como uma inst芒ncia de um objecto.
Source=mscorlib
StackTrace:
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at SixLabors.ImageSharp.GraphicOptionsDefaultsExtensions.GetGraphicsOptions(Configuration configuration)
at SixLabors.ImageSharp.GraphicOptionsDefaultsExtensions.GetGraphicsOptions(IImageProcessingContext context)
at SixLabors.ImageSharp.Processing.DrawImageExtensions.DrawImage(IImageProcessingContext source, Image image, Point location, Single opacity)
at UVtools.Parser.FileFormat.<>c__DisplayClass124_1.b__2(IImageProcessingContext o) in D:\Tiago\Dropbox\Programming\C#\UVtools\UVtools.Parser\FileFormat.cs:line 687
@sn4k3 Perfect. Yep, definitely the same issue. I've got #1234 waiting for review to fix this.
Most helpful comment
@sn4k3 Perfect. Yep, definitely the same issue. I've got #1234 waiting for review to fix this.