Package: mono-gmcs
Version: 2.0.1-5
Tags: fixed-upstream

The following test case yields unverifiable code when compiled by gmcs 
2.0.1-5:

using System;
using System.Windows.Forms;

internal class TestForm : Form
{
        private int testInt = 0;

        public static void Main()
        {
                Form f = new TestForm();
                Application.Run(f);
        }

        public TestForm()
        {
                this.Load += TestForm_Load;
        }

        private void TestForm_Load(object sender, EventArgs e)
        {
                string g = string.Empty;
                this.Invoke((MethodInvoker)delegate { int i = testInt; });
                this.Invoke((MethodInvoker)delegate { int i = testInt; 
string s = g; });
        }
}

Expected results: Blank form displayed, no exception raised

Actual results:
When running with --security=verifiable:
Unhandled Exception: System.Security.VerificationException: This object 
not compatible with function pointer for delegate creation at 0x0020
  at System.Windows.Forms.Form.OnLoad (System.EventArgs e) [0x00000]
  at System.Windows.Forms.Form.OnLoadInternal (System.EventArgs e) 
[0x00000]
  at System.Windows.Forms.Form.OnCreateControl () [0x00000]
  at System.Windows.Forms.Control.CreateControl () [0x00000]
  at System.Windows.Forms.Control.WmShowWindow 
(System.Windows.Forms.Message& m) [0x00000]
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& 
m) [0x00000]
  at System.Windows.Forms.ScrollableControl.WndProc 
(System.Windows.Forms.Message& m) [0x00000]
  at System.Windows.Forms.ContainerControl.WndProc 
(System.Windows.Forms.Message& m) [0x00000]
  at System.Windows.Forms.Form.WndProc (System.Windows.Forms.Message& m) 
[0x00000]
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage 
(System.Windows.Forms.Message& m) [0x00000]
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc 
(System.Windows.Forms.Message& m) [0x00000]
  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, 
IntPtr wParam, IntPtr lParam) [0x00000]
  at System.Windows.Forms.XplatUIX11.SendMessage (IntPtr hwnd, Msg 
message, IntPtr wParam, IntPtr lParam) [0x00000]
  at System.Windows.Forms.XplatUIX11.MapWindow (System.Windows.Forms.Hwnd 
hwnd, WindowType windows) [0x00000]
  at System.Windows.Forms.XplatUIX11.CreateWindow 
(System.Windows.Forms.CreateParams cp) [0x00000]
  at System.Windows.Forms.XplatUI.CreateWindow 
(System.Windows.Forms.CreateParams cp) [0x00000]
  at System.Windows.Forms.NativeWindow.CreateHandle 
(System.Windows.Forms.CreateParams cp) [0x00000]
  at System.Windows.Forms.Control.CreateHandle () [0x00000]
  at System.Windows.Forms.Form.CreateHandle () [0x00000]
  at System.Windows.Forms.Control.CreateControl () [0x00000]
  at System.Windows.Forms.Control.SetVisibleCore (Boolean value) [0x00000]
  at System.Windows.Forms.Form.SetVisibleCore (Boolean value) [0x00000]
  at System.Windows.Forms.Control.set_Visible (Boolean value) [0x00000]
  at (wrapper remoting-invoke-with-check) 
System.Windows.Forms.Control:set_Visible (bool)
  at System.Windows.Forms.Application.RunLoop (Boolean Modal, 
System.Windows.Forms.ApplicationContext context) [0x00000]
  at System.Windows.Forms.Application.Run 
(System.Windows.Forms.ApplicationContext context) [0x00000]
  at System.Windows.Forms.Application.Run (System.Windows.Forms.Form 
mainForm) [0x00000]
  at TestForm.Main () [0x00000]

When run without --security=verifiable:
Unhandled Exception: System.Reflection.TargetException: Object does not 
match target type.
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags 
invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, 
System.Globalization.CultureInfo culture) [0x00000]
  at System.Reflection.MethodBase.Invoke (System.Object obj, 
System.Object[] parameters) [0x00000]
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x00000]
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) 
[0x00000]
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000]
  at System.Windows.Forms.Control.Invoke (System.Delegate method, 
System.Object[] args) [0x00000]
  at (wrapper remoting-invoke-with-check) 
System.Windows.Forms.Control:Invoke (System.Delegate,object[])
  at System.Windows.Forms.Control.Invoke (System.Delegate method) 
[0x00000]
  at TestForm.TestForm_Load (System.Object sender, System.EventArgs e) 
[0x00000]
etc.

This used to work in Debian.  I'm not sure exactly when the regression 
was, but I can compile this test case with 1.2.6 and the resulting 
executable runs on both 1.2.6 and 2.0.1-5 (and is verifiable).  I've also 
tried SVN and confirmed that it works so the issue has been resolved 
upstream.

 - Sharif



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to