-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed Issue #13 Attempting to terminate infinite loop
fixed Issue #14 Null reference exception may be thrown if debug is not enabled
- Loading branch information
Showing
11 changed files
with
202 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
source/ChakraCore.NET.DebugAdapter.VSCode/Properties/PublishProfiles/FolderProfile.pubxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
https://go.microsoft.com/fwlink/?LinkID=208121. | ||
--> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<PublishProtocol>FileSystem</PublishProtocol> | ||
<Configuration>Release</Configuration> | ||
<TargetFramework>netstandard1.4</TargetFramework> | ||
<PublishDir>..\..\NugetPackages</PublishDir> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.27428.2015 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PauseEngine", "PauseEngine\PauseEngine.csproj", "{E94F4ACE-E74E-4508-B744-834C9A20C9C9}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{E94F4ACE-E74E-4508-B744-834C9A20C9C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{E94F4ACE-E74E-4508-B744-834C9A20C9C9}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{E94F4ACE-E74E-4508-B744-834C9A20C9C9}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{E94F4ACE-E74E-4508-B744-834C9A20C9C9}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {8210E508-804A-40F9-AD25-488AF5CAF9FF} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace PauseEngine | ||
{ | ||
class EchoFunctionProvider : ChakraCore.NET.Plugin.Common.IEchoFunctionProvider | ||
{ | ||
public void Echo(string message) | ||
{ | ||
Console.WriteLine(message); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using ChakraCore.NET; | ||
using ChakraCore.NET.API; | ||
|
||
namespace PauseEngine | ||
{ | ||
class InterruptableHost:ChakraCore.NET.Hosting.JavaScriptHosting | ||
{ | ||
protected override ChakraRuntime createRuntime() | ||
{ | ||
return ChakraRuntime.Create(JavaScriptRuntimeAttributes.AllowScriptInterrupt); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>netcoreapp2.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\ChakraCore.NET.Hosting\ChakraCore.NET.Hosting.csproj" /> | ||
<ProjectReference Include="..\..\ChakraCore.NET\ChakraCore.NET.csproj" /> | ||
<ProjectReference Include="..\..\Plugins\ChakraCore.NET.Plugin.Common\ChakraCore.NET.Plugin.Common.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="Scripts\app.js"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using ChakraCore.NET; | ||
using ChakraCore.NET.Hosting; | ||
using ChakraCore.NET.Plugin.Common; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace PauseEngine | ||
{ | ||
class Program | ||
{ | ||
static EchoProvider echo = new EchoProvider(new EchoFunctionProvider()); | ||
static void Main(string[] args) | ||
{ | ||
JavaScriptHostingConfig config = new JavaScriptHostingConfig(); | ||
config.AddModuleFolder("Scripts"); | ||
config.AddPlugin(echo); | ||
|
||
InterruptableHost host = new InterruptableHost(); | ||
var app=host.GetModuleClass("app", "app", config); | ||
var runtimeService = app.ServiceNode.GetService<IRuntimeService>(); | ||
StopEngine(runtimeService); | ||
var switchService = app.ServiceNode.GetService<IContextSwitchService>(); | ||
try | ||
{ | ||
app.CallMethod("loop"); | ||
} | ||
catch (Exception ex) when( ex.Message== "Script was terminated.") | ||
{ | ||
//switchService.Leave(); | ||
Console.WriteLine("Script terminated"); | ||
runtimeService.Disabled = false; | ||
Console.WriteLine("Engine Enabled"); | ||
|
||
} | ||
catch(Exception) | ||
{ | ||
throw; | ||
} | ||
//GC.KeepAlive(host); | ||
Console.Read(); | ||
|
||
} | ||
private static async void StopEngine(IRuntimeService service) | ||
{ | ||
await Task.Delay(3000); | ||
Console.WriteLine("Trying to stop engine"); | ||
service.Disabled = true; | ||
Console.WriteLine("Engine Disabled"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { echo } from 'sdk@Echo'; | ||
export class app { | ||
loop() { | ||
let count = 1; | ||
while (true) { | ||
|
||
delay(1000); | ||
echo("hello " + count); | ||
count++; | ||
} | ||
} | ||
} | ||
function delay(ms) { | ||
let last = (new Date()).getTime(); | ||
while (true) { | ||
let now = (new Date()).getTime(); | ||
if (now-last>=ms) { | ||
return; | ||
} | ||
} | ||
} |