[Mono-list] Not all subscribers to event are being called...
Andrus Moor
kobruleht2 at hot.ee
Wed Jul 8 11:14:40 EDT 2009
> Yes, as a matter of fact there is. Both the class that is has the event
> (and is calling the event) and the class that is subscribing are based
> on generics. I have a base generic class that takes one type parameter:
>
> abstract public class BasicClass<TKey> { ... }
I tried test below in 64 bit virtual Debian several times and got output
5000 iterations, 77 exceptions
5000 iterations, 57 exceptions
5000 iterations, 46 exceptions
5000 iterations, 115 exceptions
5000 iterations, 68 exceptions
5000 iterations, 78 exceptions
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");
}
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[Eeva.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
How to fix this ?
Andrus.
More information about the Mono-list
mailing list