String conversion error: Illegal byte sequence encounted in the input.

I need assembly Monogame.Framework.dll for .net framework 4.0 but on site only assembly for .net 4.5 framework is available. I try to build from source code for net framework 4.0. Then I try to run application and get this fatal error:

System.ExecutionEngineException: String conversion error: Illegal byte sequence encounted in the input.
at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal:PtrToStringAnsi (intptr)
at Microsoft.Xna.Framework.Audio.Microphone.PopulateCaptureDevices () [0x0008c] in /media/destructor/Documents/Projects/Вспомогательные/Monogame3.6/MonoGame.Framework/Audio/Microphone.OpenAL.cs:70
at Microsoft.Xna.Framework.Audio.OpenALSoundController…ctor () [0x00040] in /media/destructor/Documents/Projects/Вспомогательные/Monogame3.6/MonoGame.Framework/Audio/OpenALSoundController.cs:122
at Microsoft.Xna.Framework.Audio.OpenALSoundController.get_GetInstance () [0x0000d] in /media/destructor/Documents/Projects/Вспомогательные/Monogame3.6/MonoGame.Framework/Audio/OpenALSoundController.cs:291
at Microsoft.Xna.Framework.SdlGamePlatform…ctor (Microsoft.Xna.Framework.Game game) [0x000f3] in /media/destructor/Documents/Projects/Вспомогательные/Monogame3.6/MonoGame.Framework/SDL/SDLGamePlatform.cs:73
at Microsoft.Xna.Framework.GamePlatform.PlatformCreate (Microsoft.Xna.Framework.Game game) [0x00001] in /media/destructor/Documents/Projects/Вспомогательные/Monogame3.6/MonoGame.Framework/GamePlatform.Desktop.cs:18
at Microsoft.Xna.Framework.Game…ctor () [0x00225] in /media/destructor/Documents/Projects/Вспомогательные/Monogame3.6/MonoGame.Framework/Game.cs:70
at Terminal.Payment.UI.MyGame…ctor () [0x00000] in /media/destructor/Documents/Projects/Terminal_Crossplatform/GUI/Standard/TerminalUI/MyGame.cs:39
at Terminal.Payment.UI.Program.Main (System.String[] args) [0x0011c] in /media/destructor/Documents/Projects/Terminal_Crossplatform/GUI/Standard/TerminalUI/Program.cs:47

You can’t load assemblies meant for .NET Framework 4.5 in 4.0.

If you want to use MG with .NET Framework 4.0 you are gonna have to compile it from source and set it to target .NET Framewrok 4.0 (and of course fix any errors that may arise).

So Harry you are wrong. Imagine that I can load monogame.framework.dll assembly from 4.0 framework executable assembly. Moreover monodevelop 5.10 builds solution successfully and application works good. It’s a paradox. But visual studio does not build solution, it writes error that frameworks is mismatched. Therefore I’ve set a targeted framework 4.0 for monogame project and that exception is thrown after building for 4.0 framework.

So I set 4.0 framework on both projects but problem slill stay. Maybe it is problem last mono?