• Uncategorized

About linux : EF-Core-PlatformNotSupported-on-Linux

Question Detail

I’m trying to develop a small web application using .NET 6 + EF Core. So far I have been able to run the application but when trying to connect to my Azure DB database it fails dramatically throwing a Strings.PlatformNotSupported Exception, as shown in the following stack trace:

System.PlatformNotSupportedException: Strings.PlatformNotSupported_DataSqlClient
   at Microsoft.Data.SqlClient.SqlConnectionStringBuilder..ctor(String connectionString)
   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.<>c.<get_IsMultipleActiveResultSetsEnabled>b__7_0(String cs)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.get_IsMultipleActiveResultSetsEnabled()
   at Microsoft.EntityFrameworkCore.SqlServer.Query.Internal.SqlServerCompiledQueryCacheKeyGenerator.GenerateCacheKey(Expression query, Boolean async)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query)
   at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression)
   at System.Linq.Queryable.First[TSource](IQueryable`1 source)
   at Gepro.Seguimiento.Core.Controllers.UsuariosController.Index() in /home/barclow/Documents/Desarrollo/Gepro.Seguimiento.Core/Controllers/UsuariosController.cs:line 24
   at lambda_method18(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()

Is EF Core compatible with Linux? – I remember deploying this proof of concept to a linux docker in azure and it worked, but somehow, I can’t make it work on my manjaro linux. I understand this shouldn’t be an issue related to my installation of linux, since I’m able to run the web app perfectly.

Question Answer

This issue apparently is related to with SDK 6.0.100 version of .netCore, when upgrading to SDK 6.0.101 everything worked properly.

Also, I had AUR package for dotnet, so I had to remove it and then used the official script to upgrade by following this instructions.

curl -sSL https://dot.net/v1/dotnet-install.sh | sudo bash /dev/stdin -c LTS --install-dir /usr/share/dotnet
sudo ln -sf /usr/share/dotnet/dotnet /usr/bin/dotnet

dotnet --list-sdks
# 6.0.101 [/usr/share/dotnet/sdk]

dotnet --list-runtimes
# Microsoft.AspNetCore.App 6.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
# Microsoft.NETCore.App 6.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.