This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Common Language Runtime detected an invalid program

Hi i m using the following code taking from help

            Bitmap bitmap = new Bitmap(@"D:\NET Solutions\C#\WM\DiamantiLand\images\photos\2.jpg");

            //Resize to 80 pixels width 
            bitmap.Transforms.Resize(80, 0, InterpolationMode.MediumQuality);

            //Specify that we are going to save to JPEG
            JpegEncoderOptions encoderOptions = new JpegEncoderOptions();

            //Save image to response stream
            Response.Clear();

            Response.ContentType = "image/jpeg";

            bitmap.Save(Response.OutputStream, encoderOptions);

            Response.End();


and getting an exception

Exception Details: System.InvalidProgramException: Common Language Runtime detected an invalid program.

Source Error: 


Line 32: 
Line 33:             //Resize to 80 pixels width 
Line 34:             bitmap.Transforms.Resize(80, 0, InterpolationMode.MediumQuality);
Line 35: 
Line 36:             //Specify that we are going to save to JPEG
 

Source File: D:\NET Solutions\C#\WM\Manager.2\Manager\WebForm1.aspx.cs    Line: 34 

Stack Trace: 


[InvalidProgramException: Common Language Runtime detected an invalid program.]
   Aurigma.GraphicsMill.Thread.FireStoppedEvent(Object object, ErrorEventArgs args) +360
   Aurigma.GraphicsMill.Thread.TimerEventProcessor() +457
   Aurigma.GraphicsMill.Thread.ChangeActivityStatus(ActivityStatus status) +269
   Aurigma.GraphicsMill.Thread.EntryPoint() +640
   Aurigma.GraphicsMill.Thread.Start() +308
   Aurigma.GraphicsMill.Transforms.BitmapTransform.ApplyTransform(Bitmap bitmap) +564
   Aurigma.GraphicsMill.TransformsProvider._Resize(Int32 width, Int32 height, ResizeMode resizeMode, InterpolationMode interpolationMode) +567
   Aurigma.GraphicsMill.TransformsProvider.Resize(Int32 width, Int32 height, InterpolationMode interpolationMode) +356
   Manager.WebForm1.Page_Load(Object sender, EventArgs e) in D:\NET Solutions\C#\WM\Manager.2\Manager\WebForm1.aspx.cs:34
   System.Web.UI.Control.OnLoad(EventArgs e) +175
   System.Web.UI.Control.LoadRecursive() +137
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2096


ps:using latest donet demo version
Hello,

I have adapted your code to be compiled. It does not generate an InvalidProgramException. Could you create a complete,
compiling sample which produces the error? Could you also submit case with your source sample image?