[Mono-bugs] [Bug 456825] New: Assertion failure on generic class constructor

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Dec 5 12:05:06 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=456825


           Summary: Assertion failure on generic class constructor
           Product: Mono: Runtime
           Version: 2.2.x
          Platform: x86
        OS/Version: Windows Vista
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: generics
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: kobruleht2 at hot.ee
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


To reproduce, compile appl in VS2008SP1 for 3.5 profile and run under Vista.

Observed:

** ERROR **: file method-to-ir.c: line 7306 (mono_method_to_ir2): assertion
failed: (!callvirt_this_arg)
aborting...


using System;
using System.ComponentModel;
using System.Windows.Forms;

static class Program
{
    static void Main()
    {
        DocumentToolsStripMenuItemClick<DokG, RidG>(null, "", ' ', ' ');
    }

    internal static void DocumentToolsStripMenuItemClick<TDoc, TRow>(object
sender, string formSource,
                                            char formType, char subtype)
        where TDoc : DokBase, IDok, INotifyPropertyChanged, new()
        where TRow : EntityBase, IRid, new()
    {
        Type docType = typeof(TDoc);
        Type rowType = typeof(TRow);
        Type list = typeof(Dok);
        Type gt = typeof(DocumentForm<,,>).MakeGenericType(list, docType,
rowType);
        var ctor = gt.GetConstructor(Type.EmptyTypes);
        BrowseForm browseForm;
        browseForm = (BrowseForm)(ctor.Invoke(new object[] { }));
        browseForm.FormName = "";
        browseForm.FormID = "";
        //** ERROR **: file method-to-ir.c: line 7306 (mono_method_to_ir2):
assertion failed: (!callvirt_this_arg)
        //aborting...
        browseForm.DoInit(formSource, formType, subtype);
    }
}

partial class RidG : Rid
{
}

partial class RidG : IRid
{
}

public partial class Rid : EntityBase, INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;

    protected virtual void OnPropertyChanged(string propertyName)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}

public class DokG : Dok
{
}

public partial class Dok : DokBase, INotifyPropertyChanged
{

    public event PropertyChangedEventHandler PropertyChanged;

    protected virtual void OnPropertyChanged(string propertyName)
    {
    }

}

public abstract class DokBase : EntityBase, IDok
{
}

public interface IRid
{
}

public abstract class EntityBase
{
}

public interface IDok
{
}

abstract partial class BrowseForm : BaseForm, IPickListForm
{
    internal virtual void DoInit(string formSource, char formType, char
formSubtype) { }

}

interface IPickListForm
{
}

partial class BaseForm : Form
{
    public string FormName;
    public string FormID;
}

sealed class DocumentForm<TList, TDoc, TRow> : BrowseForm, IGridHostForm
    where TList : class
    where TDoc : DokBase, IDok, INotifyPropertyChanged, new()
    where TRow : EntityBase, IRid, new()
{
    internal override void DoInit(string formSource, char formType, char
formSubtype)
    {
        var g = new Grid1<TDoc>();
    }
}


sealed public partial class Grid1<TEntity> : BaseGrid1
where TEntity : EntityBase, new()
{
}

public partial class BaseGrid1 : DataGridView
{
}

interface IGridHostForm
{
}


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list