Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@albertli90/coreclr-host
Advanced tools
Readme
This is a very early release of this package, do not suggest using it in production till latter stable version
Add the CoreclrNodeHost reference to the csproj config
<PackageReference Include="CoreclrNodeHost" Version="0.0.1" />
create an example c# entry class
namespace BasicExample
{
using System;
using FluentAssertions;
using System.Threading.Tasks;
using CoreclrNodeHost;
using CoreclrNodeHost.InProcess;
public class Program
{
private static readonly TaskCompletionSource<int> MainTaskCompletionSource = new TaskCompletionSource<int>();
public static JsDynamicObject setMainTcs(JsValue[] args)
{
Console.WriteLine($"Basic example setMainTcs invoked w/o {args.Length} arguments");
var host = NodeHost.Instance;
args.Length.Should().Be(4);
host.TryGetObject(args[0], typeof(bool), out var oneBool);
oneBool.Should().Be(true);
host.TryGetObject(args[1], typeof(double), out var oneNumber);
oneNumber.Should().Be(1e3);
host.TryGetObject(args[2], typeof(string), out var oneString);
oneString.Should().Be("oneString");
host.TryGetObject(args[3], typeof(Object), out dynamic oneObj);
// oneObj.Should().BeOfType(typeof(JsDynamicObject));
((string) oneObj.message).Should().Be("oneMessageStringInObj");
var result = host.New();
host.SetMember(result, "argCount", DotNetValue.FromInt(args.Length));
host.SetMember(result, "message", DotNetValue.FromString("oneMessageStringInResultObj"));
MainTaskCompletionSource.SetResult(0);
return result;
}
public static Task<int> Main(string[] args)
{
Console.WriteLine($"Basic example entry invoked {args[0]}");
return MainTaskCompletionSource.Task;
}
}
}
then invoke the static method from javascript
const assert = require('assert');
const path = require('path');
const coreclrhost = require('@albertli90/coreclr-host');
const result = coreclrhost.runCoreApp(
path.join(__dirname, 'bin', 'Debug', 'netcoreapp3.1', 'BasicExample.dll'),
"AdditionalArgument"
);
const setMainTcsResult = coreclrhost.callManagedFunction(
"BasicExample.Program",
"setMainTcs",
true,
1e3,
"oneString",
{
message: "oneMessageStringInObj"
}
)
assert.strictEqual(typeof setMainTcsResult, "object");
assert.strictEqual(setMainTcsResult.argCount, 4);
assert.strictEqual(setMainTcsResult.message, "oneMessageStringInResultObj");
(async ()=>{
assert.strictEqual(await result, 0);
})()
FAQs
A node addon hosts core clr
The npm package @albertli90/coreclr-host receives a total of 3 weekly downloads. As such, @albertli90/coreclr-host popularity was classified as not popular.
We found that @albertli90/coreclr-host demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.