Browse Source

debugger work in progress

Xanathar 11 years ago
parent
commit
fd36356570

+ 17 - 6
src/MoonSharp.Debugger/MainForm.cs

@@ -93,14 +93,15 @@ namespace MoonSharp.Debugger
 			m_Debugger.Start();
 		}
 
-		void IDebugger.SetSourceCode(ByteCode byteCode, string[] code)
+
+
+		public void SetSourceCode(SourceCode sourceCode)
 		{
-			string[] source = new string[byteCode.Code.Count];
+		}
 
-			for (int i = 0; i < byteCode.Code.Count; i++)
-			{
-				source[i] = string.Format("{0:X8}  {1}", i, byteCode.Code[i]);
-			}
+		void IDebugger.SetByteCode(string[]  byteCode)
+		{
+			string[] source = byteCode.Select((s, i) => string.Format("{0:X8}  {1}", i, s)).ToArray();
 
 			m_Ctx.Send(o =>
 				{
@@ -405,5 +406,15 @@ namespace MoonSharp.Debugger
 
 
 
+
+		void IDebugger.SetSourceCode(SourceCode sourceCode)
+		{
+			
+		}
+
+		bool IDebugger.IsPauseRequested()
+		{
+			return false;
+		}
 	}
 }

+ 21 - 0
src/MoonSharp.Interpreter/DataTypes/Closure.cs

@@ -85,5 +85,26 @@ namespace MoonSharp.Interpreter
 		}
 
 
+		/// <summary>
+		/// Gets a delegate wrapping calls to this scripted function
+		/// </summary>
+		/// <returns></returns>
+		public ScriptFunctionDelegate GetDelegate()
+		{
+			return args => this.Call(args).ToObject();
+		}
+
+		/// <summary>
+		/// Gets a delegate wrapping calls to this scripted function
+		/// </summary>
+		/// <typeparam name="T">The type of return value of the delegate.</typeparam>
+		/// <returns></returns>
+		public ScriptFunctionDelegate<T> GetDelegate<T>()
+		{
+			return args => this.Call(args).ToObject<T>();
+		}
+
+
+
 	}
 }

+ 0 - 3
src/MoonSharp.Interpreter/DataTypes/Coroutine.cs

@@ -79,8 +79,5 @@ namespace MoonSharp.Interpreter
 					return m_Processor.State;
 			}
 		}
-
-
-
 	}
 }

+ 10 - 0
src/MoonSharp.Interpreter/DataTypes/ScriptFunctionDelegate.cs

@@ -0,0 +1,10 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace MoonSharp.Interpreter
+{
+	public delegate object ScriptFunctionDelegate(params object[] args);
+	public delegate T ScriptFunctionDelegate<T>(params object[] args);
+}

+ 3 - 1
src/MoonSharp.Interpreter/Debugging/IDebugger.cs

@@ -8,7 +8,9 @@ namespace MoonSharp.Interpreter.Debugging
 {
 	public interface IDebugger
 	{
-		void SetSourceCode(ByteCode byteCode, string[] code);
+		void SetSourceCode(SourceCode sourceCode);
+		void SetByteCode(string[] byteCode);
+		bool IsPauseRequested();
 		DebuggerAction GetAction(int ip, SourceRef sourceref);
 		void Update(WatchType watchType, List<WatchItem> items);
 		List<string> GetWatchItems();

+ 1 - 1
src/MoonSharp.Interpreter/Execution/ScriptExecutionContext.cs

@@ -112,7 +112,7 @@ namespace MoonSharp.Interpreter.Execution
 		/// <param name="func">The function; it must be a Function or ClrFunction or have a call metamethod defined.</param>
 		/// <param name="args">The arguments.</param>
 		/// <returns></returns>
-		/// <exception cref="System.ScriptRuntimeException">If the function yields, returns a tail call request with continuations/handlers or, of course, if it encounters errors.</exception>
+		/// <exception cref="ScriptRuntimeException">If the function yields, returns a tail call request with continuations/handlers or, of course, if it encounters errors.</exception>
 		public DynValue Call(DynValue func, params DynValue[] args)
 		{
 			if (func.Type == DataType.Function)

+ 1 - 1
src/MoonSharp.Interpreter/Execution/VM/ByteCode.cs

@@ -12,7 +12,7 @@ using MoonSharp.Interpreter.Debugging;
 
 namespace MoonSharp.Interpreter.Execution.VM
 {
-	public class ByteCode : ITrackableReference
+	internal class ByteCode : ITrackableReference
 	{
 		public List<Instruction> Code = new List<Instruction>();
 		private List<SourceRef> m_SourceRefStack = new List<SourceRef>();

+ 0 - 14
src/MoonSharp.Interpreter/Execution/VM/Chunk.cs

@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using MoonSharp.Interpreter.Debugging;
-
-namespace MoonSharp.Interpreter.Execution.VM
-{
-	public class Chunk
-	{
-		public SourceCode SourceCode { get; private set; }
-		public ByteCode ByteCode { get; private set; }
-	}
-}

+ 1 - 1
src/MoonSharp.Interpreter/Execution/VM/Instruction.cs

@@ -6,7 +6,7 @@ using MoonSharp.Interpreter.Debugging;
 
 namespace MoonSharp.Interpreter.Execution.VM
 {
-	public class Instruction
+	internal class Instruction
 	{
 		public OpCode OpCode;
 		public SymbolRef Symbol;

+ 1 - 1
src/MoonSharp.Interpreter/Execution/VM/OpCode.cs

@@ -6,7 +6,7 @@ using System.Text;
 namespace MoonSharp.Interpreter.Execution.VM
 {
 
-	public enum OpCode
+	internal enum OpCode
 	{
 		// Meta-opcodes
 		Nop,		// Does not perform any operation.

+ 6 - 5
src/MoonSharp.Interpreter/Execution/VM/Processor/Processor_Debugger.cs

@@ -25,11 +25,12 @@ namespace MoonSharp.Interpreter.Execution.VM
 				m_Debug.DebuggerCurrentActionTarget = -1;
 			}
 
-			if (m_Debug.DebuggerCurrentAction == DebuggerAction.ActionType.Run)
-				return;
-
-			if (m_Debug.DebuggerCurrentAction == DebuggerAction.ActionType.StepOver && m_Debug.DebuggerCurrentActionTarget != instructionPtr)
-				return;
+			if ((m_Debug.DebuggerCurrentAction == DebuggerAction.ActionType.Run)
+				|| (m_Debug.DebuggerCurrentAction == DebuggerAction.ActionType.StepOver && m_Debug.DebuggerCurrentActionTarget != instructionPtr))
+			{
+				if (!m_Debug.DebuggerAttached.IsPauseRequested())
+					return;
+			}
 
 			RefreshDebugger();
 

+ 4 - 1
src/MoonSharp.Interpreter/Interop/LuaStateInterop/Tools.cs

@@ -172,7 +172,10 @@ namespace MoonSharp.Interpreter.Interop.LuaStateInterop
 		/// type.
 		/// </summary>
 		/// <param name="Value">The value.</param>
-		/// <returns>A boxed numeric object whos type is an integer type.</returns>
+		/// <param name="Round">if set to <c>true</c> [round].</param>
+		/// <returns>
+		/// A boxed numeric object whos type is an integer type.
+		/// </returns>
 		public static object ToInteger(object Value, bool Round)
 		{
 			switch (Type.GetTypeCode(Value.GetType()))

+ 1 - 1
src/MoonSharp.Interpreter/MoonSharp.Interpreter.csproj

@@ -90,6 +90,7 @@
       <SubType>Code</SubType>
     </Compile>
     <Compile Include="CoreLib\StringLib\KopiLua_StrLib.cs" />
+    <Compile Include="DataTypes\ScriptFunctionDelegate.cs" />
     <Compile Include="DataTypes\TypeValidationFlags.cs" />
     <Compile Include="Interop\LuaStateInterop\CharPtr.cs" />
     <Compile Include="Interop\LuaStateInterop\LuaBase.cs" />
@@ -152,7 +153,6 @@
       <SubType>Code</SubType>
     </Compile>
     <Compile Include="Debugging\SourceCode.cs" />
-    <Compile Include="Execution\VM\Chunk.cs" />
     <Compile Include="Execution\VM\CoroutineState.cs" />
     <Compile Include="Execution\VM\ExecutionState.cs" />
     <Compile Include="Execution\VM\Processor\DebugContext.cs" />

+ 25 - 6
src/MoonSharp.Interpreter/Script.cs

@@ -112,12 +112,27 @@ namespace MoonSharp.Interpreter
 
 			m_Sources.Add(source);
 
-			if (m_Debugger != null)
-				m_Debugger.SetSourceCode(m_ByteCode, null);
-
+			SignalSourceCodeChange(source);
+			SignalByteCodeChange();
+		
 			return MakeClosure(address);
 		}
 
+		private void SignalByteCodeChange()
+		{
+			if (m_Debugger != null)
+			{
+				m_Debugger.SetByteCode(m_ByteCode.Code.Select(s => s.ToString()).ToArray());
+			}
+		}
+
+		private void SignalSourceCodeChange(SourceCode source)
+		{
+			if (m_Debugger != null)
+			{
+				m_Debugger.SetSourceCode(source);
+			}
+		}
 
 
 		/// <summary>
@@ -142,8 +157,8 @@ namespace MoonSharp.Interpreter
 
 			m_Sources.Add(source);
 
-			if (m_Debugger != null)
-				m_Debugger.SetSourceCode(m_ByteCode, null);
+			SignalSourceCodeChange(source);
+			SignalByteCodeChange();
 
 			return MakeClosure(address);
 		}
@@ -365,7 +380,11 @@ namespace MoonSharp.Interpreter
 		{
 			m_Debugger = debugger;
 			m_MainProcessor.AttachDebugger(debugger);
-			m_Debugger.SetSourceCode(m_ByteCode, null);
+
+			foreach (SourceCode src in m_Sources)
+				SignalSourceCodeChange(src);
+
+			SignalByteCodeChange();
 		}
 
 		/// <summary>

+ 150 - 0
src/MoonSharp.RemoteDebugger/DebugServer.cs

@@ -0,0 +1,150 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Xml;
+using MoonSharp.Interpreter.Debugging;
+using MoonSharp.RemoteDebugger.Network;
+using MoonSharp.RemoteDebugger.Threading;
+
+namespace MoonSharp.RemoteDebugger
+{
+	public class DebugServer : IDebugger
+	{
+		List<string> m_Watches = new List<string>();
+		Utf8TcpServer m_Server;
+
+
+		public DebugServer(int port, bool localOnly)
+		{
+			m_Server = new Utf8TcpServer(port, 1 << 20, '\0', localOnly ? Utf8TcpServerOptions.LocalHostOnly : Utf8TcpServerOptions.Default);
+			m_Server.Start();
+			m_Server.DataReceived += m_Server_DataReceived;
+		}
+
+		#region Writes
+
+
+		public void SetSourceCode(SourceCode sourceCode)
+		{
+			Send(xw =>
+			{
+				using (xw.Element("source-code"))
+				{
+					xw.Attribute("id", sourceCode.SourceID)
+						.Attribute("name", sourceCode.Name);
+
+					foreach (string line in sourceCode.Lines)
+						xw.Element("l", line);
+				}
+			});
+		}
+
+
+		private void Send(Action<XmlWriter> a)
+		{
+			XmlWriterSettings xs = new XmlWriterSettings()
+			{
+				CheckCharacters = true,
+				CloseOutput = true,
+				ConformanceLevel = ConformanceLevel.Fragment,
+				Encoding = Encoding.UTF8,
+				Indent = false,
+			};
+
+			StringBuilder sb = new StringBuilder();
+			XmlWriter xw = XmlWriter.Create(sb, xs);
+
+			a(xw);
+
+			string xml = sb.ToString();
+			m_Server.BroadcastMessage(xml);
+			Console.WriteLine(xml);
+		}
+
+
+		public void Update(WatchType watchType, List<WatchItem> items)
+		{
+			Send(xw =>
+			{
+				using (xw.Element("watches"))
+				{
+					xw.Attribute("type", watchType);
+
+					foreach (WatchItem wi in items)
+					{
+						using (xw.Element("watch"))
+						{
+							xw.Attribute("name", wi.Name);
+							xw.Attribute("value", wi.Value);
+							xw.Attribute("address", wi.Address);
+							xw.Attribute("baseptr", wi.BasePtr);
+							xw.Attribute("lvalue", wi.LValue);
+							xw.Attribute("retaddress", wi.RetAddress);
+						}
+					}
+				}
+			});
+		}
+
+		public void SetByteCode(string[] byteCode)
+		{
+			Send(xw =>
+				{
+					using (xw.Element("bytecode"))
+					{
+						foreach (string line in byteCode)
+							xw.Element("l", line);
+					}
+				});
+		}
+
+		#endregion
+
+		BlockingQueue<DebuggerAction> m_QueuedActions = new BlockingQueue<DebuggerAction>();
+		SourceRef m_LastSentSourceRef = null;
+
+		public void QueueAction(DebuggerAction action)
+		{
+			m_QueuedActions.Enqueue(action);
+		}
+
+		public DebuggerAction GetAction(int ip, SourceRef sourceref)
+		{
+			if (sourceref != m_LastSentSourceRef)
+			{
+				Send(xw =>
+					{
+						using (xw.Element("source-loc"))
+						{
+							xw.Attribute("srcid", sourceref.SourceIdx)
+								.Attribute("cf", sourceref.FromChar)
+								.Attribute("ct", sourceref.ToChar)
+								.Attribute("lf", sourceref.FromLine)
+								.Attribute("lt", sourceref.ToLine);
+						}
+					});
+			}
+
+			return m_QueuedActions.Dequeue();
+		}
+
+		void m_Server_DataReceived(object sender, Utf8TcpPeerEventArgs e)
+		{
+			throw new NotImplementedException();
+		}
+
+
+		public List<string> GetWatchItems()
+		{
+			return m_Watches;
+		}
+
+
+		public bool IsPauseRequested()
+		{
+			return true;
+		}
+	}
+}

+ 3 - 0
src/MoonSharp.RemoteDebugger/MoonSharp.RemoteDebugger.csproj

@@ -38,14 +38,17 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="DebugServer.cs" />
     <Compile Include="Network\HttpResource.cs" />
     <Compile Include="Network\HttpResourceType.cs" />
     <Compile Include="Network\HttpServer.cs" />
     <Compile Include="Network\Utf8TcpPeerEventArgs.cs" />
     <Compile Include="Network\Utf8TcpServerOptions.cs" />
+    <Compile Include="Network\XmlWriter_Extensions.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Network\Utf8TcpPeer.cs" />
     <Compile Include="Network\Utf8TcpServer.cs" />
+    <Compile Include="Threading\BlockingQueue.cs" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\MoonSharp.Interpreter\MoonSharp.Interpreter.csproj">

+ 38 - 35
src/MoonSharp.RemoteDebugger/Network/HttpServer.cs

@@ -9,9 +9,9 @@ using MoonSharp.Interpreter;
 namespace MoonSharp.RemoteDebugger.Network
 {
 	/// <summary>
-	/// This is a very very simplified and light http server. It exists to run on platforms where 
-	/// more standard methods offered by .NET BCL are not available and/or they require special priviledges
-	/// on the machine. 
+	/// This is a very very (very!) simplified and light http server. It exists to run on platforms where 
+	/// more standard methods offered by .NET BCL are not available and/or if priviledges cannot be 
+	/// excalated. This just uses a TcpListener and a Socket.
 	/// This supports only GET method and basic (or no) authentication.
 	/// </summary>
 	public class HttpServer
@@ -19,9 +19,15 @@ namespace MoonSharp.RemoteDebugger.Network
 		Utf8TcpServer m_Server;
 		Dictionary<string, List<string>> m_HttpData = new Dictionary<string, List<string>>();
 		Dictionary<string, HttpResource> m_Resources = new Dictionary<string, HttpResource>();
-
 		object m_Lock = new object();
 
+		const string ERROR_TEMPLATE = "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\"><html><head><title>{0}</title></head><body><h1>{0}</h1>{1}<hr><address>MoonSharp Remote Debugger / {2}</address></body></html><!-- This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. This padding is added to bring the error message over 512 bytes to avoid some browsers custom errors. -->";
+
+		static readonly string VERSION = Assembly.GetExecutingAssembly().GetName().Version.ToString();
+		readonly string ERROR_401 = string.Format(ERROR_TEMPLATE, "401 Unauthorized", "Please login.", VERSION);
+		readonly string ERROR_404 = string.Format(ERROR_TEMPLATE, "404 Not Found", "The specified resource cannot be found.", VERSION);
+		readonly string ERROR_500 = string.Format(ERROR_TEMPLATE, "500 Internal Server Error", "An internal server error occurred.", VERSION);
+
 		public HttpServer(int port, Utf8TcpServerOptions options)
 		{
 			m_Server = new Utf8TcpServer(port, 100 << 10, '\n', options);
@@ -62,6 +68,29 @@ namespace MoonSharp.RemoteDebugger.Network
 			}
 		}
 
+		private void SendHttp(Utf8TcpPeer peer, string responseCode, string contentType, string data, params string[] extraHeaders)
+		{
+			SendHttp(peer, responseCode, contentType, Encoding.UTF8.GetBytes(data), extraHeaders);
+		}
+
+
+		private void SendHttp(Utf8TcpPeer peer, string responseCode, string contentType, byte[] data, params string[] extraHeaders)
+		{
+			peer.Send("HTTP/1.0 {0}", responseCode);
+			peer.Send("Server: moonsharp-remote-debugger/{0}", VERSION);
+			peer.Send("Content-Type: {0}", contentType);
+			peer.Send("Content-Length: {0}", data.Length);
+			peer.Send("Connection: close");
+			peer.Send("Cache-Control: max-age=0, no-cache");
+
+			foreach (string h in extraHeaders)
+				peer.Send(h);
+
+			peer.Send("");
+			peer.SendBinary(data);
+		}
+
+
 		private void ExecHttpRequest(Utf8TcpPeer peer, List<string> httpdata)
 		{
 			try
@@ -80,14 +109,7 @@ namespace MoonSharp.RemoteDebugger.Network
 
 					if (!authorized)
 					{
-						peer.Send("HTTP/1.0 401 Not Authorized");
-						peer.Send("Server: moonsharp-remote-debugger/{0}", Assembly.GetExecutingAssembly().GetName().Version.ToString());
-						peer.Send("Content-Type: text; charset=utf-8");
-						peer.Send("Content-Length: 0");
-						peer.Send("Connection: close");
-						peer.Send("WWW-Authenticate: Basic realm=\"moonsharp-remote-debugger\"");
-						peer.Send("Cache-Control: max-age=0, no-cache");
-						peer.Send("");
+						SendHttp(peer, "401 Not Authorized", "text/html", ERROR_401, "WWW-Authenticate: Basic realm=\"moonsharp-remote-debugger\"");
 						return;
 					}
 				}
@@ -96,24 +118,11 @@ namespace MoonSharp.RemoteDebugger.Network
 
 				if (res == null)
 				{
-					peer.Send("HTTP/1.0 404 Not Found");
-					peer.Send("Server: moonsharp-remote-debugger/{0}", Assembly.GetExecutingAssembly().GetName().Version.ToString());
-					peer.Send("Content-Type: text; charset=utf-8");
-					peer.Send("Content-Length: 0");
-					peer.Send("Connection: close");
-					peer.Send("Cache-Control: max-age=0, no-cache");
-					peer.Send("");
+					SendHttp(peer, "404 Not Found", "text/html", ERROR_404);
 				}
 				else
 				{
-					peer.Send("HTTP/1.0 200 OK");
-					peer.Send("Server: moonsharp-remote-debugger/{0}", Assembly.GetExecutingAssembly().GetName().Version.ToString());
-					peer.Send("Content-Type: {0}", res.GetContentTypeString());
-					peer.Send("Content-Length: {0}", res.Data.Length);
-					peer.Send("Connection: close");
-					peer.Send("Cache-Control: max-age=0, no-cache");
-					peer.Send("");
-					peer.SendBinary(res.Data);
+					SendHttp(peer, "200 OK", res.GetContentTypeString(), res.Data);
 				}
 			}
 			catch (Exception ex)
@@ -122,13 +131,7 @@ namespace MoonSharp.RemoteDebugger.Network
 
 				try
 				{
-					peer.Send("HTTP/1.0 500 Internal Server Error");
-					peer.Send("Server: moonsharp-remote-debugger/{0}", Assembly.GetExecutingAssembly().GetName().Version.ToString());
-					peer.Send("Content-Type: text; charset=utf-8");
-					peer.Send("Content-Length: 0");
-					peer.Send("Connection: close");
-					peer.Send("Cache-Control: max-age=0, no-cache");
-					peer.Send("");
+					SendHttp(peer, "500 Internal Server Error", "text/html", ERROR_500);
 				}
 				catch (Exception ex2)
 				{
@@ -222,7 +225,7 @@ namespace MoonSharp.RemoteDebugger.Network
 					return ret;
 				}
 			}
-		
+
 			return null;
 		}
 

+ 1 - 1
src/MoonSharp.RemoteDebugger/Network/Utf8TcpServer.cs

@@ -131,7 +131,7 @@ namespace MoonSharp.RemoteDebugger.Network
             }
         }
 
-        public void BroadcastMessage(string message, bool flush)
+        public void BroadcastMessage(string message)
         {
             lock (m_PeerListLock)
             {

+ 1 - 1
src/MoonSharp.RemoteDebugger/Properties/AssemblyInfo.cs

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // You can specify all the values or you can default the Build and Revision Numbers 
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyVersion("0.7.0.0")]
 [assembly: AssemblyFileVersion("1.0.0.0")]

+ 9 - 2
src/MoonSharp/Program.cs

@@ -6,6 +6,7 @@ using System.Reflection;
 using System.Text;
 using MoonSharp.Interpreter;
 using MoonSharp.Interpreter.Execution;
+using MoonSharp.RemoteDebugger;
 using MoonSharp.RemoteDebugger.Network;
 
 namespace MoonSharp
@@ -67,7 +68,7 @@ namespace MoonSharp
 
 					if (s.StartsWith("!"))
 					{
-						ParseCommand(s.Substring(1));
+						ParseCommand(script, s.Substring(1));
 						continue;
 					}
 
@@ -114,8 +115,9 @@ namespace MoonSharp
 
 		static Utf8TcpServer m_Server;
 		static HttpServer m_Http;
+		static DebugServer m_DbgS;
 
-		private static void ParseCommand(string p)
+		private static void ParseCommand(Script S, string p)
 		{
 			if (p == "net")
 			{
@@ -131,6 +133,11 @@ namespace MoonSharp
 				m_Http.Authenticator = (usr, pwd) => usr == pwd;
 				m_Http.Start();
 			}
+			if (p == "dbg")
+			{
+				m_DbgS = new DebugServer(20001, false);
+				S.AttachDebugger(m_DbgS);
+			}
 		}
 
 		static void m_Server_DataReceivedAny(object sender, Utf8TcpPeerEventArgs e)

+ 4 - 0
src/MoonSharpTests/MoonSharpTests.csproj

@@ -24,6 +24,8 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <Prefer32Bit>false</Prefer32Bit>
+    <NoWarn>
+    </NoWarn>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
@@ -34,6 +36,8 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
     <Prefer32Bit>false</Prefer32Bit>
+    <NoWarn>
+    </NoWarn>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
     <DebugSymbols>true</DebugSymbols>

+ 4 - 1
src/MoonSharpTests/Program.cs

@@ -1,4 +1,7 @@
-using System;
+// Disable warning 429 (Unreachable code) because of the RESTRICT_TEST condition below.
+#pragma warning disable 429
+
+using System;
 using System.Collections.Generic;
 using MoonSharp.Interpreter.Diagnostics;
 using System.Linq;

+ 6 - 1
src/PerformanceComparison/Program.cs

@@ -1,4 +1,9 @@
-//#define PROFILER
+// This code is a workbench code - it gets commented on the fly, changed, etc.
+// Disable warnings for "assigned but value never used" and "unreachable code".
+#pragma warning disable 414
+#pragma warning disable 429
+
+//#define PROFILER
 
 using System;
 using System.Collections.Generic;