I was wondering if it's possible to add/inject other dlls. Lets say I would like to do a "workbook" on 3rd party dll
Yes, in addition to nuget packages, you can reference any assembly on your file system using #r "path/to/assembly.dll".
However, in 0.8.0 we broke this a bit. It will be fixed in the next release, but for now you can save your workbook somewhere, put the assembly you want to reference in the same directory as the workbook, and then reference using #r assembly.dll.
If you are saving the workbook for the first time, you'll need to close and reopen it for the workbook to know how to find the assembly.
Hi, I figured that much out for WPF workbooks, but am trying the same for Android, and while it "appears" to work, in that I get intellisense for the Assembly, I suspect it isn't actually prepping that dll in the patch it applies to the running android app, because as soon as I try to touch one of the types in the loaded assembly, bad stuff happens.
Correct, this is not supported yet for Android, or for iOS on Windows.
Specifically, if I try to construct a type from that assembly, the REPL loop just hangs. And if I try to do something along the lines of
var type = typeof(SomeTypeFromTheAssembly).Name;
I get an interesting stack trace:
FileNotFoundException: Could not load file or assembly '/Users/myusername/Documents/MyDll.dll' or one of its dependencies
at (wrapper managed-to-native) Sbject System.Reflection.Assembly.LoadFrom (bool)
at Assembly System.Reflection.Assembly.LoadFrom (string assemblyFile)
at Assembly Xamarin.Interactive.Scripting.ScriptAssemblyContext.HandleAssemblyResolve (object sender, ResolveEventArgs args)
at Assembly System.AppDomain.DoAssemblyResolve (string name, Assembly requestingAssembly, bool refonly)
at void System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<<>d__0> (ref <>d__0 stateMachine)
at Task . ()
at Task . (object submissionArray)
at void Xamarin.Interactive.Scripting.ScriptExecutionContext.c__async0.MoveNext ()
I'm not sure if that code is running in the context of the REPL client?
Darn, any work around in the short term? Or is this just a wait and see?
No, but it's coming very soon.
Thanks, I'll satisfy myself with messing around with the WPF in the short term
BTW, on the subject of getting the dlls via nuget packages, it would be nice if it supported a local nuget repository?
Good idea, we should add support for custom and local repos.
@SandyArmstrong Any news about custom and local repos?
@AndreasKlapperich none yet! We are working on some nuget improvements though, so I'll keep it in mind.
Xamarin Inc., as a wholly-owned Microsoft subsidiary acting as a separate legal entity, adheres to the Microsoft Privacy Statement: Privacy & cookies