diff --git a/Data_Eval/Data_Eval/Compilation/Compiler.cs b/Data_Eval/Data_Eval/Compilation/Compiler.cs
index dafe3ba..e862877 100644
--- a/Data_Eval/Data_Eval/Compilation/Compiler.cs
+++ b/Data_Eval/Data_Eval/Compilation/Compiler.cs
@@ -79,8 +79,12 @@ public Type Compile(
foreach (var error in emitResult.Diagnostics
.Where(e => e.Severity == DiagnosticSeverity.Error || e.IsWarningAsError)
.OrderBy(e => e.Location.GetLineSpan().StartLinePosition.Line))
- {
- exceptionMessage += "\n\tLine " + error.Location.GetLineSpan().StartLinePosition.Line.ToString() + ": " + error.GetMessage();
+ {
+ exceptionMessage += "\n\tError: " + error.GetMessage();
+
+ string code = classText.Replace("\r\n", "\n").Split('\r', '\n')[error.Location.GetLineSpan().StartLinePosition.Line].Trim().TrimEnd(';');
+
+ exceptionMessage += "\n\tOn Line " + error.Location.GetLineSpan().StartLinePosition.Line.ToString() + ": " + code;
}
throw new CompilationException(exceptionMessage)
diff --git a/Data_Eval/Data_Eval/Data_Eval.csproj b/Data_Eval/Data_Eval/Data_Eval.csproj
index 0efc75c..72e8624 100644
--- a/Data_Eval/Data_Eval/Data_Eval.csproj
+++ b/Data_Eval/Data_Eval/Data_Eval.csproj
@@ -7,7 +7,9 @@
true
false
Data_Eval.snk
- 2.6.0
+ 2.6.1
+ false
+
diff --git a/Data_Eval/Data_Eval/Data_Eval.nuspec b/Data_Eval/Data_Eval/Data_Eval.nuspec
index 43b2d8e..1622bed 100644
--- a/Data_Eval/Data_Eval/Data_Eval.nuspec
+++ b/Data_Eval/Data_Eval/Data_Eval.nuspec
@@ -2,7 +2,7 @@
Data.Eval
- 2.6.0
+ 2.6.1
Data.Eval
Bruce Dunwiddie
shriop
@@ -10,8 +10,8 @@
https://github.com/bruce-dunwiddie/data-eval
false
.Net Library for Evaluating Expressions at Runtime
- Cache compilation exceptions to speed up looped exception creation.
- Copyright © 2023
+ Added line content to compilation exception message.
+ Copyright © 2025
eval expression evaluator compile
diff --git a/Data_Eval/Data_Eval/Pack.bat b/Data_Eval/Data_Eval/Pack.bat
index 8792a1a..7a26528 100644
--- a/Data_Eval/Data_Eval/Pack.bat
+++ b/Data_Eval/Data_Eval/Pack.bat
@@ -1,3 +1,3 @@
nuget pack Data_Eval.nuspec -Symbols -SymbolPackageFormat snupkg
-nuget push Data.Eval.2.6.0.nupkg -Source https://api.nuget.org/v3/index.json -apikey %NUGET_KEY%
+nuget push Data.Eval.2.6.1.nupkg -Source https://api.nuget.org/v3/index.json -apikey %NUGET_KEY%
pause
\ No newline at end of file
diff --git a/Data_Eval/Tests/Compilation/CompilerTests.cs b/Data_Eval/Tests/Compilation/CompilerTests.cs
index c0cdc36..7179d95 100644
--- a/Data_Eval/Tests/Compilation/CompilerTests.cs
+++ b/Data_Eval/Tests/Compilation/CompilerTests.cs
@@ -78,7 +78,7 @@ public object Eval(){
"CustomEvaluator");
});
- Assert.AreEqual("Class failed to compile.\n\tLine 6: ; expected", ex.Message);
+ Assert.AreEqual("Class failed to compile.\n\tError: ; expected\n\tOn Line 6: return intValue + 1", ex.Message);
Assert.AreEqual(codeToCompile, ex.GeneratedClassCode);
}
}