Forum

Error trying to use Grapevine nuget (REST API)

hei all,

Trying to build an app exposing a REST API with gamma 2019.2 0169 using the Grapevine nuget. As VL does not handle attributes for now, I know such code could not be implemented, but that’s not the issue now (I was planning to wrap that in a dll to use it in VL) :

[RestResource]
public class TestResource
{
    [RestRoute]
    public IHttpContext HelloWorld(IHttpContext context)
    {
        context.Response.SendResponse("Hello, world.");
        return context;
    }
}

So, when I load the nuget to do something simple as this :

image

The console displays this error message :

System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

Naively tried adding it as a dependency (either by downloading and referencing the System.Runtime.Loader nuget, and also adding a ref to mscorlib), but the error is the same in both cases.

Now, I copied the System.Runtime.Loader v4.0.0 dll next to Grapevine.dll and the error changed to

System.TypeLoadException: Could not load type 'System.Runtime.Loader.AssemblyLoadContext' from assembly 'System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

Looking at MSDN, it seems that AssemblyLoadContext only exists in .NET Core. Does this mean that VL won’t be able to pick it up for now ?

Also, before that, I also tried copying the last version of System.Runtime.Loader (4.3.0), and gamma threw this exception on startup ( System.InvalidCastException: Unable to cast object of type 'DummyConcreteTypeSymbol' to type 'VL.Lang.Platforms.Roslyn.ImportedConcreteTypeSymbol'.).

Any hint on what’s going on there ?

Thanks !

Yes that one is only .net core - you’ll have to wait a little bit until we get there.

Noted, thanks !

It’s interesting though that the nuget claims it runs on .net framework also. Did you ever try a simple C# example targeting .net framework?

nope, only stardard for now. will check that later today :)

edit: starting an http server in a .net framework console app works here!