When todays SVN code is used from Mono 2.4 web service in Linux, 
InvalidCastException
occurs after number of some DynamicInvoke() calls.

For multiple tests, attempt number (24) where exception occurs changes.
Exception occurs in DbLinq at line which calls DynamicInvoke().

Maybe Dblinq changes delegates in a way which causes exceptions in Mono.

Any idea how to fix or debug this ?
>From Visual Studio test is running OK.

Andrus.

Test code:

using System;
using System.Linq;
using System.Threading;
using System.Web.Services;

namespace Test.Service
{

[WebService]
public sealed class StockService : WebService
 {
  class TestEntity
  {
   public int contents { get; set; }
  }

[WebMethod]
public string Test()
  {
   int i = 0;
   try
   {
    for (; i < 950; i++)
    {
     using (var db = new Northwind(new Npgsql.NpgsqlConnection(
 
"host=localhost;DATABASE=Northwind;USER=LinqUser;PASSWORD=linq2;SSLMODE=Prefer;SSL=True"),
 new DbLinq.PostgreSql.PgsqlVendor()))  
 
     db.ExecuteQuery<TestEntity>("SELECT 1 as contents").ToList();
 }
 }
 catch (Exception ex)  {  
    return "Exception at attempt " + i.ToString() + ": " + ex.ToString();  
    } 
 return i.ToString() + "iterations passed";  
  }
  }
}

Result:
  
Exception at attempt 24: System.InvalidCastException: Cannot cast fromsource 
type to destinationtype.

at System.Delegate.get_Method ()[0x00027] in 
/root/src/mcs/class/corlib/System/Delegate.cs:107

at System.Delegate.DynamicInvokeImpl (System.Object[] 
args)[0x00000]in/root/src/mcs/class/corlib/System/Delegate.cs:420

at System.MulticastDelegate.DynamicInvokeImpl (System.Object[]args)[0x00018] 
in/root/src/mcs/class/corlib/System/MulticastDelegate.cs:71

at System.Delegate.DynamicInvoke (System.Object[] args)[0x00000]in 
/root/src/mcs/class/corlib/System/Delegate.cs:415

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[Test.Service.StockService+TestEntity].MoveNext
 ()[0x00000]

at 
System.Collections.Generic.List`1[Test.Service.StockService+TestEntity].AddEnumerable
 (IEnumerable`1 enumerable)[0x00000]

at 
System.Collections.Generic.List`1[Test.Service.StockService+TestEntity]..ctor 
(IEnumerable`1 collection) [0x00000]atSystem.Linq.Enumerable.ToList[TestEntity] 
(IEnumerable`1 source)[0x00000]

at Test.Service.StockService.Test () [0x00000]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DbLinq" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/dblinq?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to