Xamarin Sqlite-pcl library problems - sqlite

I try to make a app and work with sqlite-pcl and got the following error when my app starts;
DllImport attempting to load: 'e_sqlite3'.
DllImport error loading library '/storage/emulated/0/Android/data/appTecnicos.appTecnicos/files/.__override__/libe_sqlite3': 'dlopen failed: library "/data/app/appTecnicos.appTecnicos-1/lib/x86//storage/emulated/0/Android/data/appTecnicos.appTecnicos/files/.__override__/libe_sqlite3" not found'.
DllImport error loading library '/storage/emulated/0/Android/data/appTecnicos.appTecnicos/files/.__override__/libe_sqlite3.so': 'dlopen failed: library "/data/app/appTecnicos.appTecnicos-1/lib/x86//storage/emulated/0/Android/data/appTecnicos.appTecnicos/files/.__override__/libe_sqlite3.so" not found'.
DllImport error loading library '/system/lib/libe_sqlite3': 'dlopen failed: library "/data/app/appTecnicos.appTecnicos-1/lib/x86//system/lib/libe_sqlite3" not found'.
DllImport error loading library '/system/lib/libe_sqlite3.so': 'dlopen failed: library "/data/app/appTecnicos.appTecnicos-1/lib/x86//system/lib/libe_sqlite3.so" not found'.
DllImport error loading library 'libe_sqlite3': 'dlopen failed: library "/data/app/appTecnicos.appTecnicos-1/lib/x86/libe_sqlite3" not found'.
DllImport loaded library 'libe_sqlite3.so'.
DllImport searching in: 'e_sqlite3' ('libe_sqlite3.so').
Searching for 'sqlite3_libversion_number'.
An unhandled exception occured.
I installed the nuget package in both solutions, portable and droid. I installed the Sqlite component in droid project.
I cleaned the build and recompiled but it returned the same error.
EDIT:
I found this on my Compiler debug;
Loaded assembly: /storage/emulated/0/Android/data/appTecnicos.appTecnicos/files/.__override__/SQLitePCLRaw.lib.e_sqlite3.dll
Its seems like the e_sqlite3.dll its already on the proyect.
Thanks in advance

The "DllImport error loading library '.../.override/libe_sqlite3'" message has been misleading to me as well. The debug output was just coinciding with the actual exception that froze my app.
For me, it was using a relative path in the new SQLiteConnection() -- which was working perfectly fine before with the UWP version. After I changed it to use an absolute path, it also worked on Android:
var dbpath = Path.Combine(System.Environment.GetFolderPath(
System.Environment.SpecialFolder.LocalApplicationData), "myData.sqlite");
db = new SQLiteConnection(dbpath, false);

I think that the package has not been correctly installed on your starting app. Remove sqlite-pcl, clean, rebuild & install it to your starting app and droid project. Also check your references to see if its really there.

I found my error. I got a class like;
public class StaticsValues
{
[...]
public static string FOLDERPATH;
public static string DBPATH;
public static BD.BDManager BDMANAGER = new BD.BDManager;
}
And the object BDManager start in the solution before my DROID project compiled. I change to:
public class StaticsValues
{
[...]
public static string FOLDERPATH;
public static string DBPATH;
public static BD.BDManager BDMANAGER ;
}
And start BD.Manager in App.cs and now works.

Related

system.missingmethodexception: 'method not found: void sqlite.sqliteconnection..ctor(string,sqlite.sqliteopenflags,bool,object)'

Added SQLite to my shared project on xamarin but it failed, when I run it on android I get the following error
system.missingmethodexception: 'method not found: void sqlite.sqliteconnection..ctor(string,sqlite.sqliteopenflags,bool,object)'
I tried to clean and delete bin obj folder with no success
Are you using an older/outdated reference for System.Data.SQLite;?

The type or namespace for SQLiteConnection could not be found

I am trying to build a Xamarin form and came across this error while coding
"the type or namespace for SQLiteConnection could not be found".
I installed sqllite-new-pcl for this project and can see it under references tab.
I have added the following in the code but it is throwing error:
using SQLite;

error: GenerateFeatureFileCodeBehindTask task could not be loaded from the assembly

We have ported our project from .NET to .NET Core in order to use an AWS pipeline with Docker containers which requires Linux.
The application builds successfully on our local computers (which run Windows) but in the AWS pipeline the build steps shows this error - GenerateFeatureFileCodeBehindTask ... task could not be loaded from the assembly ... SpecFlow.Tools.MsBuild.Generation.dll:
Full error:
/root/.nuget/packages/specflow.tools.msbuild.generation/3.0.225/build/SpecFlow.Tools.MsBuild.Generation.targets(78,5): error MSB4062: The "SpecFlow.Tools.MsBuild.Generation.GenerateFeatureFileCodeBehindTask" task could not be loaded from the assembly /root/.nuget/packages/specflow.tools.msbuild.generation/3.0.225/build/../tasks/netcoreapp2.0/SpecFlow.Tools.MsBuild.Generation.dll. Assembly with same name is already loaded Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements
Microsoft.Build.Framework.ITask. [/codebuild/output/src814/src/s3/00/ProjectFoo/ProjectFoo.csproj]
I have found 2 links mentioning this error but no solution - https://ci.appveyor.com/project/SpecFlow/specflow-kx1o3/build/build1119 and https://www.gitmemory.com/issue/techtalk/SpecFlow/1699/520196304.
I have checked and I have no <UsingTask> in my csproj files. Any idea what this SpecFlow task is, and why it is throwing this error?
The GenerateFeatureFileCodeBehindTask is contained in the SpecFlow.Tools.MSBuild.Generation package. It is used to generate the code-behind files of your feature files.
You don't find a <UsingTask> because it is done in the NuGet package.
The GitHub issue for this is: https://github.com/techtalk/SpecFlow/issues/1699/
Currently I have no idea why this error is thrown. But we are currently fixing our build/tests for Linux.

The realm dot net base example does not compile

I am having trouble at getting the example "QuickJournal" to compile on iOS. The code compiles OK, but fails during the Fody step.
Goals
Try out the example application for .NET through the following
- Pull the repository
- Open the solution in examples/QuickJournal
- Compile and test
Expected Results
Smooth compilation & testing experience
Actual Results
Fody out of memory exception
Steps to Reproduce
See the setup, follow steps
I am using the latest Xamarin/Visual Studio Mac/XCode
Code Sample
The regular realm source code
Version of Realm and Tooling
git clone https://github.com/realm/realm-dotnet.git
git checkout 8f5e36ffd91e06b9c60b91f9de3fb312b411a4a4
The exception I am getting is
Fody: Found debug symbols at '~/realm-dotnet/examples/QuickJournal/QuickJournal/obj/Debug/QuickJournal.pdb'.
MSBUILD : error : Fody: An unhandled exception occurred:
MSBUILD : error : Exception:
MSBUILD : error : Out of memory
MSBUILD : error : StackTrace:
MSBUILD : error : at (wrapper alloc) System.Object:AllocVector (intptr,intptr)
MSBUILD : error : at Microsoft.Cci.Pdb.MsfDirectory..ctor (Microsoft.Cci.Pdb.PdbReader reader,
See log file
RealmCompilelog.txt
Realm 1.2.1 addresses that by using an updated version of Fody.
Answer for older Realm versions:
This is caused by a Cecil bug with Mono 5.0. As Realm depends on Fody, which uses Cecil, compilation will fail for project referencing it. Until new Cecil and Fody versions are released, the workaround is to revert to Mono 4.8:

The type or namespace name 'ViewPage' does not exist in the namespace 'System.Web.Mvc'

I have a solution (VisualStudi0 2013) that worked perfectly well until couple of days ago. Suddenly after I had restarted my computer I started getting the following error locally everytime I run the debugger. There are no errors in the solution itself but only in the browser. I'm able to clean, build, rebuild and publish the solution without any problems. In fact the solution works well on-line but not locally on my computer.
Another fact is that the aspx files are debugged without any error. It's only the pages that are served with MVC that throws this error.
I searched for the ViewPage and it only exists in the web.config.
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXX"
I'm certain that the ViewPage is available in the solution references under the 'System.Web.Mvc' but why I'm getting this error in a file in the Temporary ASP.NET Files. I cleared the temp files but it didn't help.
Compiler Error Message: CS0234: The type or namespace name 'ViewPage' does not
exist in the namespace 'System.Web.Mvc' (are you missing an assembly reference?)
Source Error:
Line 136: public class views_home_index_aspx : global::System.Web.Mvc.ViewPage, System.Web.SessionState.IRequiresSessionState, System.Web.IHttpHandler {
Source File: c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\vs\6f597118\63e8eef9\App_Web_index.aspx.a8d08dba.6ujukvge.0.cs Line: 136
That was caused by a Security Update. I fixed it by setting CopyLocal to true on the System.Web.Mvc reference but you can get more details at http://blogs.msdn.com/b/webdev/archive/2014/10/16/microsoft-asp-net-mvc-security-update-broke-my-build.aspx

Resources