tags:

views:

68

answers:

2

Anybody seen this exception before, Google doesn't have a single post regarding the exception. The code that raises the error is a simple add.

Items.Add(item);


System.TypeLoadException: Bad flags on delegate constructor.
   at System.Windows.Forms.ListView.Sort()
   at System.Windows.Forms.ListView.InsertItems(Int32 displayIndex, ListViewItem[] items, Boolean checkHosting)
   at System.Windows.Forms.ListView.ListViewNativeItemCollection.Add(ListViewItem value)
   at System.Windows.Forms.ListView.ListViewItemCollection.Add(ListViewItem value)
A: 

I can give you general advice on how to solve internal exceptions. Take tool called Reflector (google it) and get into the method System.Windows.Forms.ListView.Sort() and try to understand what conditions lead to exception. this helped me many times.

Andrey
public void Sort(){ if (this.VirtualMode) { throw new InvalidOperationException(SR.GetString("ListViewSortNotAllowedInVirtualListView")); } this.ApplyUpdateCachedItems(); if (base.IsHandleCreated UnsafeNativeMethods.SendMessage(new HandleRef(this, base.Handle), 0x1030, IntPtr.Zero, pfnCompare); }}Been there done that, can u see the problem? :)
Marcus
A: 

I think that it's a case of searching on the error number 80131506. I've found a few references:

If your application has been written using NET 2 and maybe ASP.NET, but more importantly runs under a user profile then look here:

Microsoft hotfix

I've also come across someone whereby SQL Developer on the server machine was causing issues: SQL DEvloper issues

There is also talk of this problem occuring on 64 bit machines shown here. Typically involving access to memory addresses beyond 4Gb.

ChrisBD