SteveSandersonMS / DotNetIsolator

A library for running isolated .NET runtimes inside .NET
MIT License
604 stars 40 forks source link

Interface instead of individual methods #13

Open gilliganc opened 1 year ago

gilliganc commented 1 year ago

I noticed both with calls in and the calls back to the host you always need to provide the method names and Params by hand. I was wondering if maybe you could use generics and interfaces instead to make it strongly typed and less error prone and get compile time checks. As well as maybe a runtime check method you could call to check the wsam implements the interface as well so you could error nicely.

Now you have call backs to the host I plan to start using your lib so this is from someone that has only looked at the examples so sorry if someone like it already exists. If it is not possible I can always just put add a class as a custom wrapper but built in would be better.

IS4Code commented 1 year ago

I've done some experiments in IS4Code/DotNetIsolator@8a7a82aa31a02cf42350a0043fc8cccd37dd949a through DispatchProxy. Specifically I have been able to use an object implementing IEnumerable through that interface, delegating all calls to the isolated runtime. Generics are not supported yet though, since there is not a fully functional mechanism for passing all method references yet.