I am trying to use Grapevine to implement a simple C# REST server. I am using Xamarin Studio on OSX. I pulled Grapevine 4.0.0.195 as a package.
However, when I try to run the example given on https://sukona.github.io/Grapevine/, I get this error:
System.TypeLoadException: Could not load type 'Grapevine.Interfaces.Server.HttpListener' from assembly 'Grapevine, Version=4.0.0.195, Culture=neutral, PublicKeyToken=null'. at Grapevine.Server.RestServer..ctor () [0x00006] in <5da3c1fcf3364795b3df98bfc8b714aa>:0 at TestServer.MainClass.Main (System.String[] args) [0x0000b] in /Users/blah/Projects/Test/TestServer/Program.cs:12
I inspected the Grapevine assembly and found that HttpListener
is indeed present.
Here is my Program.cs
:
using System;
using Grapevine.Server;
namespace TestServer
{
public sealed class MainClass
{
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
using (var server = new RestServer())
{
server.Start();
Console.ReadLine();
server.Stop();
}
}
}
}
I also ran into the same issue and and discovered the same response as Scott Offen (thank you for your awesome work btw!) mentioned about ExtendedProtectionSelector.
So I went back to his previous version and I was able to make grapevine work in xamarin using grapevine version 3.1.0
It wont work right out of the box either( I was building for ios, idk if you would run into the same issues for android). It will give you some errors about logging so I did Ctrl+F everywhere in his code about logging and changed it. I pretty much commented out everything in EventLogger.cs
Then in RESTServer, wherever there was a EventLogger to report the error, i simply changed it to Console.Writeline to describe the error when debugging.
Good luck!