[Mono-list] DynamicInvoke calls causes exceptions

Andrus Moor kobruleht2 at hot.ee
Tue Jun 16 16:31:06 EDT 2009


Rodrigo,

>> DynamicInvoke() calls cause randomly TargetParameterCountException or in
>> fewer cases InvalidCastException. Stack traces are below.
>Can you come with a small test case the shows this problem?

I'm able to reproduce this error using code below. This code accesses data
using DbLinq.
It executes 3 queries in loop which make a lot of DynamicInvoke() calls.
No idea how to improve this testcase. DbLinq seems to require database
access.
Database() is DbLinq context which uses connection string and pgsql data
provider to access data.

Exception occurs after 10 ...30 iterations of this loop.

Andrus.

[WebService]
public sealed class StockService : WebService
{

class Entity<T>
{
public T Contents { get; set; }
}

[WebMethod]
public string Test()
{
int i = 0;
try
{
for (; i < 80; i++)
{

using (var db = new Database())
  db.ExecuteQuery<Entity<int>>("SELECT COUNT(*) as contents FROM
kasutaja").ToList();

string entityName = "Dok";

using (var db = new Database())
     db.Workflows.Where(x => x.Entityname == entityName &&
x.Isactive).Select(x => new { x.Script }).ToList();

using (var db = new Database())
    db.ExecuteQuery<Kasutaja>(@"SELECT field_dec as fieldDeC, field_Len AS
fieldLen,
         field_Name AS fieldName, field_Type AS fieldType, tabel
    FROM datadict").ToList();
  }
  }
catch (Exception ex)
{
return DateTime.Now.ToString() + " CCiter " + i.ToString() + " " +
ex.ToString();
}
return DateTime.Now.ToString() + " CCiter x80 delegate";
}
}
}

PS. Sometimes this testcase causes compiler to stop working with error

Compiler failed to produce the assembly. Output: ''

Stockservice.asmx file contains only line

<%@ WebService Language="C#" Class="MyApp.Service.StockService" %>

and refers to existing dll file. There are no cs files in web server.
No idea what and why Mono wants to compile to run this testcase.
How to create asmx web service which does not require runtime compilation in
mono server?

Stack trace is:

System.Exception: Compiler failed to produce the assembly. Output: ''
  at Mono.CSharp.CSharpCodeCompiler.CompileFromFileBatch
(System.CodeDom.Compiler.CompilerParameters options, System.String[]
fileNames) [0x0033e] in
/root/src/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs:308
  at Mono.CSharp.CSharpCodeCompiler.CompileAssemblyFromFileBatch
(System.CodeDom.Compiler.CompilerParameters options, System.String[]
fileNames) [0x00011] in
/root/src/mcs/class/System/Microsoft.CSharp/CSharpCodeCompiler.cs:156
  at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromFile
(System.CodeDom.Compiler.CompilerParameters options, System.String[]
fileNames) [0x00014] in
/root/src/mcs/class/System/System.CodeDom.Compiler/CodeDomProvider.cs:119
  at System.Web.Compilation.AssemblyBuilder.BuildAssembly
(System.Web.VirtualPath virtualPath,
System.CodeDom.Compiler.CompilerParameters options) [0x001db] in
/root/src/mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs:794
  at System.Web.Compilation.AssemblyBuilder.BuildAssembly
(System.Web.VirtualPath virtualPath) [0x00000] in
/root/src/mcs/class/System.Web/System.Web.Compilation/AssemblyBuilder.cs:730
  at System.Web.Compilation.BuildManager.GenerateAssembly
(System.Web.Compilation.AssemblyBuilder abuilder,
System.Web.Compilation.BuildProviderGroup group, System.Web.VirtualPath vp,
Boolean debug) [0x0023a] in
/root/src/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs:583
  at System.Web.Compilation.BuildManager.BuildInner (System.Web.VirtualPath
vp, Boolean debug) [0x0011c] in
/root/src/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs:380
  at System.Web.Compilation.BuildManager.Build (System.Web.VirtualPath vp)
[0x0004e] in
/root/src/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs:326
  at System.Web.Compilation.BuildManager.GetCompiledType (System.String
virtualPath) [0x00041] in
/root/src/mcs/class/System.Web/System.Web.Compilation/BuildManager.cs:749
  at System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler
(System.Web.HttpContext context, System.String verb, System.String url,
System.String filePath) [0x0002b] in
/root/src/mcs/class/System.Web.Services/System.Web.Services.Protocols/WebServiceHandlerFactory.cs:110
  at System.Web.Script.Services.ScriptHandlerFactory.GetHandler
(System.Web.HttpContext context, System.String requestType, System.String
url, System.String pathTranslated) [0x000a1] in
/root/src/mcs/class/System.Web.Extensions/System.Web.Script.Services/ScriptHandlerFactory.cs:63
  at System.Web.HttpApplication.GetHandler (System.Web.HttpContext context,
System.String url, Boolean ignoreContextHandler) [0x00055] in
/root/src/mcs/class/System.Web/System.Web/HttpApplication.cs:1641
  at System.Web.HttpApplication.GetHandler (System.Web.HttpContext context,
System.String url) [0x00000] in
/root/src/mcs/class/System.Web/System.Web/HttpApplication.cs:1622
  at System.Web.HttpApplication+<Pipeline>c__Iterator2.MoveNext () [0x0075f]
in /root/src/mcs/class/System.Web/System.Web/HttpApplication.cs:1256



More information about the Mono-list mailing list