progaudi/progaudi.tarantool

Failure on Linux

pgulutzan opened this issue · 2 comments

I'm aware that you clearly say dotnet-core is
not stable on Linux and Mac
https://github.com/progaudi/tarantool-csharp
but you also say
"it should work on Windows, Mac, Linux"
https://groups.google.com/forum/#!topic/tarantool/khoj-ZauD_U
Since I don't have Windows, I downloaded mono
and a few other things, trying to make it run
on my Ubuntu 16.04 computer.

I managed to build and publish and make a
sample program that tries to connect to Tarantool,
but the program collapses when it tries to connect.

For what it's worth -- perhaps not much -- these are
my notes on the matter.

Re tarantool-csharp
from Roman Kozachenko (roman-kozachenko) and
Anatoly Popov (aensidhe), downloaded from
https://github.com/progaudi/tarantool-csharp
initially downloaded on 2016-11-03, downloaded
again on 2016-11-21, to my computer with Ubuntu 16.04.

Installing mono:
Installation with the regular Ubuntu-distro mono is
no good, it is too old, and eventually I could not
get around the "dotnet publish" bug described in
https://github.com/dotnet/cli/issues/3658
Therefore one must follow the instructions at
mono-project.com/download
followed by
sudo apt-get install mono-complete
sudo apt-get update
so that
mono --version
says "Mono JIT compiler version 4.6.1" etc.
This version seems okay.

Installing additional mono-related packages:
I also installed mono-xsp4 and monodevelop, but believe now
that they are not necessary, in fact monodevelop
gave me some trouble, I never persuaded it to work.

Installing dotnet:
I failed with xbuild, missing import files, due to a known problem
http://stackoverflow.com/questions/40249511/net-standard-on-linux
but saw suggestions that Microsoft's dotnet preview
would work. So I downloaded dotnet preview from
https://www.microsoft.com/net/core#ubuntu
By the way, sudo apt-get causes a message to appear
"
This software may collect information about you and your use of
the software, and send that to Microsoft.
Please visit http://aka.ms/dotnet-cli-eula for more information.
"
so eventually any documentation should suggest
export DOTNET_CLI_TELEMETRY_OUTPUT=1

Installing tarantool-csharp:
The makers recommend nuget; however, my attempts
to install nuget failed (time wasted here was due
partly to the horribleness of the advice page
http://www.monodevelop.com/documentation/creating-a-simple-solution/),
and in any case I read that nuget has issues on non-Windows machines
https://docs.nuget.org/ndocs/policies/nuget-faq
so I downloaded from github and built from source, thus:
...
cd ~
mkdir mono
cd mono
git clone https://github.com/progaudi/tarantool-csharp tarantool-csharp
cd ~/tarantool-csharp
dotnet restore
cd ~tarantool-csharp/src/tarantool.client
rm -r bin/*
dotnet build

The "dotnet build" step actually puts .dll files in
multiple directories. They are all bad, except the
ones in
~/tarantool-csharp/src/tarantool.client/bin/Debug/net461
so I went to that directory with cd, and made a file
test.cs ...

using System;
using System.Linq;
using System.Threading.Tasks;
using ProGaudi.Tarantool.Client;
public class HelloWorld
{
static public void Main ()
{
Test().Wait();
}
static async Task Test()
{
await Box.Connect("127.0.0.1:3301");
}
}

and compiled it ...
mcs -r:Tarantool.CSharp.dll test.cs
and ran it ...
mono test.exe
and got the error "System.InvalidOperationException;
this operation is only valid on generic types".

If anyone suggests I should have tried
Client.Box.Connect, that wouldn't even have passed
the mcs stage ("The name 'Client' does not exist in
the current context"), and I used many variations.

Hello, @pgulutzan.
Tarantool-csharp library working under .Net Core, not under mono.
You can try to run tests for example. To do that you need execute the following commands:

git clone https://github.com/progaudi/tarantool-csharp tarantool-csharp
cd tarantool-csharp
docker-compose up -d
dotnet restore
dotnet test -f dotnetcoreapp1.0 tests/tarantool.client.tests/

Or, please take a look inside samples/docker-compose/dotnet, there is a simple ASP.net core app.

Yes, if I build with dotnet rather than with mono, the error does not occur. Thank you.