Mono C # doesn't recognize list and dictionary?

I am trying to use mono to create a C # application for Linux. But it seems that Dictionary <> and List <> are not available? I cannot find a solution to this problem, and I find it rather strange, because these two are pretty basic in my opinion ...

this is test code

using System.Collections.Generic;

namespace Test { class Program { static void Main(string[] args) { Console.WriteLine("TESTTEST"); List<string> s = new List<string>(); Console.Read(); } } } 

And this is the result on the console screen:

WARNING: the supported version of the application is not available for this application. Using default runtime: v1.1.4322

** (Test.exe: 3152): WARNING **: class System.Collections.Generic.List`1 coul d does not load, used in mscorlib, Version = 4.0.0.0, Culture = neutral, PublicKeyTo ken = b77a5c561934e089

Unhandled exception: System.TypeLoadException: failed load type 'System.Colle ctions.Generic.List`1' from assembly 'mscorlib, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089. Druk op een toets om door te gaan.,.

+6
source share
2 answers

This is the problem:

Using default runtime: v1.1.4322

You want to use runtime 2.0 or higher.

I assume you are compiling using mcs - use gmcs or dmcs . gmcs goals 2.0 and dmcs goals 4.0. See this documentation for more details.

EDIT: Ah, this seems to be a run-time problem, not a compile-time problem. What version of Mono are you using? I suspect that he is trying to find 4.0, but fails ... Are you really using the code that you already created on Windows?

Try installing the latest version of Mono; if this still fails, see if you can determine which installations were installed.

If this does not help, provide more detailed information (for example, which version of Mono you installed).

+8
source

Upgrade to Mono 2.10. It provides class class libraries 4.0 and no longer submits legacy profile 1.1.

0
source

Source: https://habr.com/ru/post/891034/


All Articles