Add host type collection #273
Replies: 3 comments 1 reply
-
Hi @OuterHeaven07, Can you post the exception stack trace? Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hi @ClearScriptLib, here is the stack trace of the exception: bei System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) |
Beta Was this translation helpful? Give feedback.
-
Hi @ClearScriptLib , This was exactly what I was looking for |
Beta Was this translation helpful? Give feedback.
-
Hi
I have a question regarding the embedding of whole type collections.
The examples show how to insert these "standard" collections:
using Microsoft.ClearScript;
var typeCollection = new HostTypeCollection("mscorlib", "System", "System.Core");
engine.AddHostObject("clr", typeCollection);
Now I include in my application an external library with various dll's (EXT1.dll, EXT2.dll ....) as references.
Within these external dll's many types are provided, which I want to access in the JS.
But when I want to add these collections, it throws an exception:
(- $exception {"The length must not be less than 0 (zero).\r\nParametername: length"} System.ArgumentOutOfRangeException)
var typeCollection = new HostTypeCollection("mscorlib", "System", "System.Core", "EXT1","EXT2");
engine.AddHostObject("clr", typeCollection);
I can't find any other examples on the subject either. Is there any possibility at all to include these types or do they have to be defined individually per
engine.AddHostType("....", typeof(<T>));
Thank you
Beta Was this translation helpful? Give feedback.
All reactions