-
-
Save arhughes/8b15d7ee88da250cc4492814cac6db52 to your computer and use it in GitHub Desktop.
Microsoft.Data.SqlClient crash in Mono
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.7' | |
services: | |
mssql: | |
image: microsoft/mssql-server-linux:2017-latest | |
environment: | |
- ACCEPT_EULA=Y | |
- SA_PASSWORD=Password1! | |
app: | |
image: mono:6.6 | |
volumes: | |
- .:/app | |
working_dir: /app | |
command: bash -c "msbuild /t:\"restore;rebuild\" && mono bin/Debug/net471/Test.exe" | |
depends_on: | |
- mssql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Microsoft.Data.SqlClient; | |
namespace Test | |
{ | |
class MainClass | |
{ | |
public static void Main(string[] args) | |
{ | |
try | |
{ | |
using (var connection = new SqlConnection("Server=mssql;User Id=sa;Password=Password1!")) | |
{ | |
connection.Open(); | |
Console.WriteLine("Connection opened successfully."); | |
} | |
} | |
catch (Exception ex) | |
{ | |
Console.WriteLine(ex.ToString()); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>net471</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> | |
<Reference Include="System" /> | |
</ItemGroup> | |
<ItemGroup> | |
<PackageReference Include="Microsoft.Data.SqlClient" Version="2.1.2" /> | |
</ItemGroup> | |
</Project> |
Author
arhughes
commented
May 25, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment