Support for C# and UWP

239 views
Skip to first unread message

Chad

unread,
Mar 29, 2017, 3:09:18 PM3/29/17
to Lightweight Communications and Marshalling
We've been using LCM for communications between a robot and it's C# user interface.  The system has been working well in this environment, supporting large amounts of data very well.  We are adding an additional user interface component that runs on a Microsoft HoloLens.  The problem I am running into is that the LCM dll does not compile compatible for the Universal Windows Platform (UWP) and so does not run on the HoloLens or other windows phone based platforms.  Has anybody developed a UWP port of LCM?  Are there any know reasons why such a port would be difficult or not work?

Thanks for any advice!

Matthew Tesch

unread,
Mar 29, 2017, 3:39:24 PM3/29/17
to lcm-...@googlegroups.com
I have not developed a UWP port of LCM, but I have ported a couple networking-based libraries for use in UWP applications, and so might be able to provide some perspective.  Overall, I don't see any fundamental reason why you would not be able to get LCM working for UWP, but it is unfortunately not a trivial process.

Basically, UWP applications cannot directly consume DLL files compiled for non-UWP applications, as they are based on a different .NET framework and libraries.  The only way I've gotten this to work in the past is to actually set up a UWP dll project in visual studio, import the code I need to compile, and build the dll from there.  This can then be referenced from a wrapper C# class that references that "managed" DLL.  To make this work, I needed to make some manual modifications to the project files here.

An additional challenge is that some of the APIs differ slightly between UWP and non-UWP .NET frameworks.  You will potentially have to make some slight changes to the LCM source code if you take the above approach.

One more caveat is that I have not been able to get networked communication to occur using the loopback address with UWP apps.  In general, this isn't possible for applications published to the Windows store for "security reasons"; I've come across a developer setting that is said to enable this for testing of communication between UWP apps on the same PC, but did not have success with this.

I apologize I do not have more reference links right now -- if this port is something you want to move forward with, I can try to put together some more useful links and samples.  I believe I could get you a small project with the basic setup of C#/interop/C++ code.  Depending on your experience level with C++, UWP compilation and project modifications, and writing code from C# to call into C++ dlls, I'd guess this would probably take a week or two (assuming roughly full time) to get LCM added and working reasonably.

Hope this helps a bit -- I wish I had the time right now to put together this as an open source project to help out more.
 

On Wed, Mar 29, 2017 at 3:09 PM Chad <cza...@gmail.com> wrote:
We've been using LCM for communications between a robot and it's C# user interface.  The system has been working well in this environment, supporting large amounts of data very well.  We are adding an additional user interface component that runs on a Microsoft HoloLens.  The problem I am running into is that the LCM dll does not compile compatible for the Universal Windows Platform (UWP) and so does not run on the HoloLens or other windows phone based platforms.  Has anybody developed a UWP port of LCM?  Are there any know reasons why such a port would be difficult or not work?

Thanks for any advice!

--
You received this message because you are subscribed to the Google Groups "Lightweight Communications and Marshalling" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lcm-users+...@googlegroups.com.
To post to this group, send email to lcm-...@googlegroups.com.
Visit this group at https://groups.google.com/group/lcm-users.
For more options, visit https://groups.google.com/d/optout.

Chad

unread,
Mar 29, 2017, 3:59:01 PM3/29/17
to Lightweight Communications and Marshalling, matthe...@gmail.com
Thanks for the quick reply.  It's along the lines I have been going down, but I was hoping for a shortcut!  I'm running into differences int the Thread and Socket interfaces that I'm not familiar with, but don't seem insurmountable. We aren't using loopback for this use case because our data source is not on the target device.  If all goes according to plan, I'll ask my employer if I can provide the port back to the project.

Thanks again!

Matthew Tesch

unread,
Mar 29, 2017, 4:42:00 PM3/29/17
to Lightweight Communications and Marshalling
I wish I could have had better news; I keep hoping I missed something, but I've done a fair bit of searching and trial and error and haven't come up with anything else in the past.  Best of luck!  Again, I'm happy to help if I can be of use; C# UWP + external C++ code is a focused enough area that I didn't find a ton online to go from.

You're probably aware of this, but if (when!) you get this worked out, NuGet is a great source for publishing the project for other users of C#, both in UWP and non-UWP projects.  In the next month or two I'm actually trying to work out how to package an C# interface to some closed-source C++ code, and want it usable for UWP and non-UWP projects.  If you end up going this route, I'd be happy to share anything I've learned towards this goal.

Best,
Matt
Reply all
Reply to author
Forward
0 new messages