I created console test application which crashes after variable number of 
iterations if running under 64 bit Debian in ISP virtual server.
If running under Mono 2.4 in Windows it runs OK.
I noticed that in Debian there is mono trunk version.
Can this caused by trunk ?
How to run DbLinq application in this server without crash ?

Andrus.

Test code:

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

[STAThread]

public static void Main() {

int i = 0;

try  {

for (; i < 5000; i++) {

using (var db = new Entity(new Npgsql.NpgsqlConnection(

"host=localhost;DATABASE=test;USER=test;PASSWORD=xxx;SSLMODE=Prefer;SSL=True"),

new DbLinq.PostgreSql.PgsqlVendor()))

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

if (i % 100 == 0)

Console.WriteLine(i.ToString() + " iterations");

}

}

catch (Exception ex) {

Console.WriteLine("Exception at attempt " + i.ToString() + ": " + 
ex.ToString());

}

Console.WriteLine(i.ToString() + " iterations passed");

return;

}



Result:

monot...@mono:~/www/htdocs/demo/bin$ mono ./Test.exe
0 iterations
Exception at attempt 47: 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]
47 iterations passed

monot...@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

monot...@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

  ----- Original Message ----- 
  From: Jonathan Pryor 
  To: [email protected] 
  Sent: Thursday, June 18, 2009 11:00 PM
  Subject: [dblinq] Re: Exception in DynamicInvoke() if called from Mono web 
service


  In general, if code runs under .NET, and the code uses types implemented in 
Mono, the code should run under Mono [0].

  Consequently, if a test passes under .NET and fails under Mono, chances are 
very high that it's a Mono bug.

  Consequently, what needs to be done is create minimal test cases for these 
bugs which work under .NET and fail under Mono, and them to Mono's bugzilla at:

      https://bugzilla.novell.com/index.cgi

  For your code below, "minimal" would mean "without references to [WebMethod]."

  I would appreciate any effort in creating minimal test cases and filing bugs 
regarding these.  I know that there are at least 5 tests in 
DbLinq.Sqlite_test_mono.dll that pass under .NET and fail under Mono, so I 
suspect that all of those are Mono bugs.

  - Jon

  [0] Exceptions include areas that are governed by a standard, and Mono and 
.NET have different interpretations of the standard.  The classic examples are 
XML and the C# compiler.  In this case, there's likely no "third party standard 
interpretation" to fallback on.

  On Thu, 2009-06-18 at 22:19 +0300, Andrus Moor wrote: 
    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