1
我正在使用Mono.CSharp.Evaluator的一個實例來編譯一些代碼並返回一個函數。在我使用goto之前它一直沒有問題。我正在用VS2012構建.NET 4.5。我正在通過Evaluator.Evaluate下面的代碼,並在對象存儲,以便以後執行:Mono CSharp Compiler Error with Gotos
Func<Dictionary<string, object>, dynamic, LogWrapperMethod, LogWrapperMethod, LogWrapperMethod, LogWrapperMethod, ExcWrapperMethod, AddResultWrapperMethod, int> a = new Func<Dictionary<string, object>, dynamic, LogWrapperMethod, LogWrapperMethod, LogWrapperMethod, LogWrapperMethod, ExcWrapperMethod, AddResultWrapperMethod, int>((parameters, self, debug, log, warn, error, exception, addResult) =>
{
Console.WriteLine("beforegoto");
goto Ben;
Ben:
Console.WriteLine("gotoResult");
return 0;
});
我越來越InternalErrorException((1,1):) 的的InnerException是
壞標籤在的ILGenerator
at System.Reflection.Emit.ILGenerator.GetLabelPos(Label lbl)
at System.Reflection.Emit.ILGenerator.BakeByteArray()
at System.Reflection.Emit.MethodBuilder.CreateMethodBodyHelper(ILGenerator il)
at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock()
at System.Reflection.Emit.TypeBuilder.CreateType()
at Mono.CSharp.TypeDefinition.CloseContainer()
我這樣
_settings = new CompilerSettings
{
EnhancedWarnings = true,
Stacktrace = true,
ShowFullPaths = true,
Timestamps = true,
Optimize = true,
AssemblyReferences = new List<string>
{
"Microsoft.CSharp.dll"
},
};
_ctx = new CompilerContext(_settings, new Reporter());
_e = new Evaluator(_ctx);
_e.Run("using System;");
_e.Run("using System.Collections.Generic;");
_e.Run("using System.Dynamic;");
_e.Run("using System.Linq;");
_e.Run("using System.Text.RegularExpressions;");
0設立評估程序(_E)含量
有沒有人有任何想法如何解決這個問題?
感謝, 本
您的匿名功能之外是否有另一個名爲'Ben'的標籤? –
我已經加倍檢查過了,而且我不需要 – user2849000
[報告錯誤](https://bugzilla.xamarin.com/enter_bug.cgi?classification=__all)最有可能讓您更好。他們非常敏感。 –