Comments (5)
Yes, my class MyCustomObject
already has a parameterless constructor.
I made a couple of more tests and it looks the type of the property Origin is not registered at all. This should be why I can not assign a new object to the property, even if I create another object type, it's not the same as the property and that throws the exception.
So far, I need to fix a namespaces error, to register succesfully the Origin Type.
This is a shared project between a big team, that's why I'm trying to fix this kind of programming errors.
Thanks for your help, you made me understand the issue.
from clearscript.
Please reopen this issue if you have additional questions or comments about this topic. Thank you!
from clearscript.
Hi @sergioamm17,
We're assuming that IM
is a host object. If that's correct, how are the Reference
and Origin
properties defined in managed code?
Also, what is Namespace.MyObject
? If that's a host object or type, how are you exposing it to the script engine?
Thanks!
from clearscript.
Yes, the IM is a host object.
This is the Origin
property
private MyCustomObject _origin; public MyCustomObject Origin { get { return _origin; } set { _origin = value; } }
And the Reference
property
public string Reference { get { return Convert.ToString(Entity.iProperties[MemberName.Reference]); } set { Entity.iProperties[MemberName.Reference] = value; } }
Reference is working as expected, however, the Origin is not working at all. I think the reason is because is an complex type (my custom object)
Namespace.MyObject
is the namespace and name of my custom class, for example MyCustomObject
according to the shared example. I already registered my custom type using Engine.AddHostType("MyTypes", typeof(Namespace.MyCustomObject));
I want to set the new value for the Origin property from the script.
from clearscript.
Hello @sergioamm17,
I already registered my custom type using
Engine.AddHostType("MyTypes", typeof(Namespace.MyCustomObject));
I want to set the new value for the Origin property from the script.
Given that AddHostType
call, the JavaScript expression new MyTypes()
should create a MyCustomObject
instance (assuming that MyCustomObject
has a parameterless constructor).
Can you verify that?
from clearscript.
Related Issues (20)
- microsoft.clearscript.v8 in use promise but return this {[undefined]} or {Microsoft.ClearScript.V8.V8ScriptItem.V8ScriptObject} HOT 3
- How to use Linq in microsoft.clearscript.v8 HOT 5
- How to use Linq in jsondata in microsoft.clearscript.v8 HOT 4
- Extension method for primitives types HOT 4
- async Task HOT 2
- Need Strategies to Prevent ClearScript V8 Crashes Due to Large Memory Allocation in Scripts HOT 1
- Unable to initalize script engine due to pending script exception HOT 2
- I can't add memory.dll to visual studio 2019?
- Streams API? HOT 1
- ClearScriptV8.linux-x64.so not found in the Docker HOT 2
- ClearScriptV8.win-x86.dll and ClearScriptV8.win-x64.dll missing on Publish HOT 2
- Question: ScriptEngine.HostData HOT 4
- Question: try pattern from script HOT 2
- Behavior of the `MaxRuntimeHeapSize` property of `V8ScriptEngine` class has changed HOT 2
- Debugging ClearScript with Visual Studio Code HOT 1
- Control of the ClearScript Engine HOT 4
- "RangeError: Array buffer allocation failed" when Executing "new Uint8Array()" HOT 2
- Allow configuration to limit the number of max statements to be executed HOT 12
- How to change the local timezone used by the engine's date functions HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clearscript.