Skip to content

Commit

Permalink
Merge pull request #746 from skadefro/master
Browse files Browse the repository at this point in the history
Throw original exception in Invoke Code
  • Loading branch information
skadefro authored Dec 14, 2022
2 parents 1303317 + e580901 commit cb0fd7a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
20 changes: 15 additions & 5 deletions OpenRPA.Script/Activities/InvokeCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using System.Collections;
using System.Collections.ObjectModel;
using Python.Runtime;
using NLog.Targets;

namespace OpenRPA.Script.Activities
{
Expand Down Expand Up @@ -471,17 +472,26 @@ public void CompileAndRun(string language, string code, string[] references, Dic

if (methInfo != null)
{
ExceptionDispatchInfo exceptionDispatchInfo = null;
try
{
methInfo.Invoke(null, new object[] { });
}
catch (Exception ex)
catch (TargetInvocationException ex)
{
exceptionDispatchInfo = ExceptionDispatchInfo.Capture(ex);
if(ex.InnerException != null) throw ex.InnerException;
throw ex;
}

if (exceptionDispatchInfo != null) exceptionDispatchInfo.Throw();
//ExceptionDispatchInfo exceptionDispatchInfo = null;
//try
//{
// methInfo.Invoke(null, new object[] { });
//}
//catch (Exception ex)
//{
// exceptionDispatchInfo = ExceptionDispatchInfo.Capture(ex);
//}

//if (exceptionDispatchInfo != null) exceptionDispatchInfo.Throw();

var vars = context.DataContext.GetProperties();
foreach (dynamic v in vars)
Expand Down
2 changes: 1 addition & 1 deletion PatchVSCode/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ private static async Task MainAsync()
await DownloadAndCopyFramework4_0();
await DownloadAndCopyFramework4_5();
await DownloadAndCopyFramework4_6();
await DownloadAndCopyFramework4_62();
//await DownloadAndCopyFramework4_62();
}

public static async Task DownloadAndCopyFramework4_62()
Expand Down

0 comments on commit cb0fd7a

Please sign in to comment.