Forum Cross Platform with Xamarin

Xamarin.IoT Problem trying to run a simple app on a raspberry pi 3 model b

bgaprogrammerbgaprogrammer COMember ✭✭
edited February 2018 in Cross Platform with Xamarin

Hello guys,

I just created a simple app using Visual Studio for MAC (Alpha Channel) and the template for Xamarin IoT Console Application, my demo tries to blink a led using the library "IoTSharp.Components.Raspbian" from nuget.

The raspberry has installed the latest version of raspbian at this time, I tried to run the app from VS to the raspberry but I got the following error:

System.TypeInitializationException: The type initializer for 'Unosquare.RaspberryIO.Pi' threw an exception.

And the InnerException contains:

System.IO.FileNotFoundException: Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies.

I'm pretty new to this so my first guessing was the error was caused by some kind of missing package so I just ran sudo apt-get install mono-complete but the result was exactly the same.

My code looks something like this

using System;
using System.Threading;
using IoTSharp.Components;

namespace PlantGrowHelper_Raspberry
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = new IoTPin(Connectors.GPIO6);
            x.SetDirection(IoTPinDirection.DirectionOutInitiallyLow);

            Thread.Sleep(5000);

            x.Value = true;

            Thread.Sleep(5000);

            x.Value = false;
        }
    }
}

What I'm missing? I cant find much info about Xamarin.IoT on the net.

I'll appreciate your help

Tagged:

Posts

  • bgaprogrammerbgaprogrammer COMember ✭✭

    Answering my question, I had the opportunity to talk with some people from Xamarin and they looked at it and basically is caused because the current VS IoT Add-In in VS for MAC has a version mismatch on the version of mono it's trying to run, so the fix is to wait for newer versions (updates) in the Alpha Channel.

Sign In or Register to comment.