diff --git a/NeoLua/Exceptions.cs b/NeoLua/Exceptions.cs
index 137ebf2..403df16 100644
--- a/NeoLua/Exceptions.cs
+++ b/NeoLua/Exceptions.cs
@@ -309,7 +309,7 @@ private string GetChunkName()
{
var chunkName = info.ChunkName;
var methodName = Method.Name;
-
+
return methodName.StartsWith(chunkName)
? chunkName
: chunkName + "#" + methodName;
@@ -330,19 +330,19 @@ public LuaStackFrameType Type
} // func Type
///
- public string MethodName { get { return info == null ? Method.Name : GetChunkName(); } }
+ public string MethodName => info == null ? Method.Name : GetChunkName();
///
- public MethodBase Method { get { return frame.GetMethod(); } }
+ public MethodBase Method => frame.GetMethod();
///
- public int ILOffset { get { return frame.GetILOffset(); } }
+ public int ILOffset => frame.GetILOffset();
///
- public int NativeOffset { get { return frame.GetNativeOffset(); } }
+ public int NativeOffset => frame.GetNativeOffset();
///
- public string FileName { get { return info == null ? frame.GetFileName() : info.FileName; } }
+ public string FileName => info?.FileName ?? frame.GetFileName();
///
- public int ColumnNumber { get { return info == null ? frame.GetFileColumnNumber() : info.Column; } }
+ public int ColumnNumber => info?.Column ?? frame.GetFileColumnNumber();
///
- public int LineNumber { get { return info == null ? frame.GetFileLineNumber() : info.Line; } }
+ public int LineNumber => info == null ? frame.GetFileLineNumber() : info.Line;
string ILuaDebugInfo.ChunkName => MethodName;
int ILuaDebugInfo.Line => LineNumber;
@@ -392,7 +392,7 @@ public void UpdateStackTrace(LuaStackFrame[] newStackTrace)
public IEnumerator GetEnumerator()
{
var length = Count;
- for (int i = 0; i < length; i++)
+ for (var i = 0; i < length; i++)
yield return stackTrace[i];
} // func GetEnumerator
@@ -562,7 +562,7 @@ public static void UnwindException(Exception ex, Func createDebug
// add trace point
luaFrames.Add(new LuaStackFrame(trace.GetFrame(trace.FrameCount - 1), createDebugInfo()));
-
+
currentData.UpdateStackTrace(luaFrames.ToArray());
} // func UnwindException
} // class LuaExceptionData
diff --git a/NeoLua/Lua.cs b/NeoLua/Lua.cs
index f5bc0f2..25f12b5 100644
--- a/NeoLua/Lua.cs
+++ b/NeoLua/Lua.cs
@@ -470,7 +470,7 @@ public static LuaChunk GetChunkFromMethodName(string name)
///
///
public static LuaChunk GetChunkFromMethodInfo(MethodBase mi)
- => GetChunkFromMethodName(mi.Name);
+ => mi != null ? GetChunkFromMethodName(mi.Name) : null;
#endregion
diff --git a/NeoLua/LuaDebug.cs b/NeoLua/LuaDebug.cs
index 11f41ba..a7b4da4 100644
--- a/NeoLua/LuaDebug.cs
+++ b/NeoLua/LuaDebug.cs
@@ -124,7 +124,7 @@ public Expression GetLineInfoExpression(DebugInfoExpression exprDebugInfo)
var oldFileName = FileNameConstant.Value as string;
var newFileName = exprDebugInfo.Document?.FileName;
if (oldFileName != newFileName)
- FileNameConstant = Expression.Constant(newFileName);
+ FileNameConstant = Expression.Constant(newFileName, typeof(string));
if (exprDebugInfo.StartLine == 16707566)
{