SQLProvider icon indicating copy to clipboard operation
SQLProvider copied to clipboard

Release build error with npgsql on Android project

Open MicaelMor opened this issue 5 years ago • 0 comments
trafficstars

Description

When creating an Android project (in this case using https://github.com/fsprojects/Fabulous ) and using SQLProvider with npgsql (PostgreSql database), an error occurs that only happens in the release build but not in the debug build, while the debug build is able to create the database context without any issue what so ever, the release build fails to do so with the following exception:

https://i.imgur.com/OGaUlg2.png

Unable to resolve assemblies. One of Npgsql.dll must exist in the paths: "C:\Users\Username\Documents\Visual Studio 2019\Projects\ReleaseErrorTest\ReleaseErrorTest / Details: resolutionPath directory doesn't exist:C:\Users\Micael\Documents\Visual Studio 2019\Projects\ReleaseErrorTest\ReleaseErrorTest

Repro steps

Please provide the steps required to reproduce the problem

Have created a stripped out project to replicate the issue:

  1. Download project https://github.com/MicaelMor/ReleaseErrorTest

  2. Create an Android 9.0 API 28 emulator (also works on an android 10 physical device) to run the build.

  3. Run the project in Debug, and Release modes to see the differences when the button getcontext is pressed.

Expected behavior

Both versions should be able to create the database context.

Actual behavior

Release version is completely unable to create the database context because it says there should be a npgsql.dll on the project folder, despite ofc the project running on an android device.

Known workarounds

Don't know any, but if there is a way to not reference the .dll with resPath, but instead to reference the ones that are going to end up in the final project, this would likely fix the issue.

Related information

  • Postgresql, have tried with version 12 and 11, the project contains a public empty database ready to be consumed for the project, so no database needs to be created to debug this.
  • Built on windows 10, showing the error on Android 9.0 emulator and Android 10.0 device (Nokia 7 plus)
  • SQLProvider 1.86 and have also tried with previous version, much like npgsql which was initially version 3.2.5 which is the version I have used in elmish.wpf projects successfully, but have since upgraded to 4.0.10.
  • .Net Standard 2.0 for the F# project that invokes get context, and no idea for the android project.

~~Know this might be a Fabulous specific issue, even if it only occurs with SQLProvider, but figure someone might have an idea on how to solve it, since referencing the npgsql.dll and its related libraries seem to be a somewhat prevalent problem.~~

Have since found this is almost certainly a difference in the build process from wpf F# .core projects and xamarin f# standard projects, more specifically it is about how the resPath where the npgsql and others are located gets translated by the build process.

Is there any way to not directly reference the .dll and instead just nuget them?

Thank you.

MicaelMor avatar May 10 '20 13:05 MicaelMor