Note that there are some explanatory texts on larger screens.

plurals
  1. POMono CSharp Evaluator : creating two Action<object> via two distinct Run() crashes
    primarykey
    data
    text
    <p>I'm trying to embed mono in a c++ executable, and mono crashes on the second evaluator.Run(..) as below. Any idea of what I missed ?</p> <p>Using mono 3.0.3. </p> <p>EmbeddedMonoTest.cpp </p> <pre><code>// EmbeddedMonoTest.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include &lt;mono/metadata/debug-helpers.h&gt; #include &lt;mono/metadata/exception.h&gt; #include &lt;mono/jit/jit.h&gt; #include &lt;mono/metadata/assembly.h&gt; int _tmain(int argc, _TCHAR* argv[]) { MonoDomain* domain = mono_jit_init_version ("ClassLibrary1", "v4.0.30319"); MonoAssembly* assembly = mono_domain_assembly_open (domain, "ClassLibrary1.dll"); mono_assembly_get_image(mono_domain_assembly_open (domain, "Mono.CSharp.dll")); MonoImage* image = mono_assembly_get_image (assembly); MonoClass* klass = mono_class_from_name(image, "ClassLibrary1", "Class1"); MonoMethod* test = mono_class_get_method_from_name(klass, "Test", 0); mono_runtime_invoke(test, NULL, NULL, NULL); return 0; } </code></pre> <p>Class1.cs </p> <pre><code>using System; using System.Reflection; using Mono.CSharp; namespace ClassLibrary1 { public class Class1 { public static void Test() { var assembly = Assembly.GetAssembly(typeof(Class1)); CompilerSettings settings = new CompilerSettings(); ReportPrinter printer = new ConsoleReportPrinter(); CompilerContext context = new CompilerContext(settings, printer); Evaluator evaluator = new Evaluator(context); evaluator.ReferenceAssembly(assembly); evaluator.Run("using System; using ClassLibrary1;"); evaluator.Run("Action&lt;object&gt; action = args =&gt; {{ 'x'.ToString(); }}; "); evaluator.Run("Action&lt;object&gt; b = args =&gt; {{ 'x'.ToString(); }}; "); } } } </code></pre> <p>The error : </p> <pre><code>Unhandled exception at 0x0274b00d in EmbeddedMonoTest.exe: 0xC0000005: Access violation reading location 0x00000000. </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload