1

I'm using entity framework for a xamarin project. When the app is minimised on iOS and then opened again it throws connection problems (See error below): SNIX_Execute (provider: SNI_PN7, error: 35 - SNI_ERROR_35)

Error Code

The only way I've found to solve this is to set pooling to false in the connection string.

I want to clear the connection pool manually in the OnSleep() method in xamarin. Is there anyway to clear Entity Framework's connection pool?

Ryan Gaudion
  • 461
  • 4
  • 18
  • EF Core has limitations to their support in Xamarin and there are some unique challenges on Xamarin.iOS since it requires .NET to work with AOT compilation (whereas the .NET CLR usually compiles JIT). – Lucas Zhang Nov 11 '19 at 12:48
  • We’d recommend using the **Don’t Link** option when compiling on iOS since the Xamarin linker will remove some EF Core features when deployed to a device. You can configure this by right-clicking on your Xamarin.iOS project and choosing the properties: – Lucas Zhang Nov 11 '19 at 12:49
  • 1
    @RyanGaudion Maybe [this response](https://stackoverflow.com/a/3653392/8208808) helps you – MihaiBC Nov 11 '19 at 13:59

1 Answers1

1

Update - Just found out how to do it. On the resume method in add:

SqlConnection.ClearAllPools();
Ryan Gaudion
  • 461
  • 4
  • 18