Reflection Exceptions using mono and Raspberry Pi

We are trying to use Raspberry# DLLs to provide access to the Raspberry Pi's GPIO pins using Mono and C#. We have a Windows server application talking to a client that runs on mono on a Pi. We are using the different Raspberry.IO DLLs for various purposes, but especially to access pins for GPIO and I2C. We have several of our own projects, and only one of them (the Hardware assembly) needs the Raspberry DLLs, which we have in a folder of that project.

We use reflection to send and load the DLLs from the server to the client, and all of the assemblies load fine until we try to load our Hardware assembly, where we get a ReflectionTypeLoadException when we try to call Assembly.GetTypes() on our Hardware assembly which was sent over the network. It has a problem with the Raspberry.IO.GeneralPurpose and Raspberry.IO.InterIntegratedCircuitDLLs underneath I think, it also says file not found. If I catch and swallow the TypeLoad exception, I get a FileNotFoundException somewhere else, which says it cannot find the Hardware.dll file.

We are doing our debugging on Windows, which has worked in the past as long as we don't actually call any methods that require hardware to be present. We should be able to load the Hardware assembly even if we don't have the hardware. Also, all of the other assemblies load fine, so it is a specific problem with the Hardware assembly or its referenced assemblies. When run on Mono on a pi, it just sits and doesn't indicate anything, basically just locks up until it crashes eventually, with no indication of what happened. I think this is because the exception causes a thread to die, but other threads survive in Release mode, so it just sits. We have had that problem before, but this is why we debug on Windows.

Does anyone have any idea what we could do? Thanks for your help. Also, I posted on StackOverFlow to no help, but would anyone have any suggestions of a better place to look for help? Thanks!

by ms5991 via /r/csharp

Leave a Reply