[Mono-bugs] [Bug 522748] New: InvalidCastException in DynamicInvoke call

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Jul 16 11:42:41 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=522748

User kobruleht2 at hot.ee added comment
http://bugzilla.novell.com/show_bug.cgi?id=522748#c3

           Summary: InvalidCastException in DynamicInvoke call
    Classification: Mono
           Product: Mono: Runtime
           Version: SVN
          Platform: x86-64
        OS/Version: Debian Potato
            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: ---


Description of Problem:

Sometimes InvalidException occurs in DynamicInvoke() call

Steps to reproduce the problem:

1. Run code below 

Actual Results:

5000 iterations, 77 exceptions


Expected Results:

5000 iterations, 0 exceptions


How often does this happen? 


Always.

Code to reproduce:

public static class AppMainEntry
{
class TestEntity
{
public int contents { get; set; }
}

[STAThread]
public static void Main()
{
int i = 0, exceptions = 0;
for (; i < 5000; i++)
{
using (var db = new Entity(new Npgsql.NpgsqlConnection(
"host=localhost;DATABASE=test;USER=test;PASSWORD=xxxxx;SSLMODE=Prefer;SSL=True"),
new DbLinq.PostgreSql.PgsqlVendor()))

try
{
db.ExecuteQuery<TestEntity>("SELECT 1 as contents").ToList();
}

catch (Exception ex)
{
exceptions++;
}
}
Console.WriteLine(i.ToString() + " iterations, " + exceptions.ToString() + " 
exceptions");
}


Additional information:

Exceptions occur in DynamicInvoke():

System.InvalidCastException: Cannot cast from source type to destination 
type.
  at System.Delegate.get_Method () [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 
DbLinq.Data.Linq.Sugar.Implementation.QueryRunner+<EnumerateResult>d__b.MoveNext 
() [0x00000]
  at 
DbLinq.Data.Linq.Sugar.Implementation.QueryRunner+<ExecuteSelect>d__0.MoveNext 
() [0x00000]
  at 
DbLinq.Data.Linq.DataContext+<CreateExecuteQueryEnumerable>d__d`1[MyApp.UI.AppMainEntry+TestEntity].MoveNext 
() [0x00000]
  at 
System.Collections.Generic.List`1[Myapp.UI.AppMainEntry+TestEntity].AddEnumerable 
(IEnumerable`1 enumerable) [0x00000]
  at 
System.Collections.Generic.List`1[Myapp.UI.AppMainEntry+TestEntity]..ctor 
(IEnumerable`1 collection) [0x00000]
  at System.Linq.Enumerable.ToList[TestEntity] (IEnumerable`1 source) 
[0x00000]
  at Myapp.UI.AppMainEntry.Main () [0x00000]

monotest at mono:~/www/htdocs/demo/bin$ mono --version
Mono JIT compiler version 2.5 (/trunk/mono r135592 Sat Jun  6 15:56:42 EEST 
2009)
Copyright (C) 2002-2008 Novell, Inc and Contributors. www.mono-project.com
        TLS:           __thread
        GC:            Included Boehm (with typed GC and Parallel Mark)
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none

monotest at mono:~/www/htdocs/demo/bin$ uname -a
Linux mono.test.xxxxx.com 2.6.18.8-xenU #3 SMP Fri Apr 24 13:30:30 EEST 2009 
x86_64 GNU/Linux

-- 
Configure bugmail: http://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