Appcenter-sdk-dotnet: No data since updating to 3.0.0

Created on 28 Feb 2020  路  21Comments  路  Source: microsoft/appcenter-sdk-dotnet

Updated to 3.0.0 on Feb 21st. Been wondering why I'm not seeing users accurate. Forgot about it.

Details

2020-02-28 16:45:39.371 [AppCenter] ERROR: Failed to initialize sqlite3 provider.
System.ArgumentException: The path is not of a legal form.
   at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.InternalGetDirectoryName(String path)
   at SQLitePCL.NativeLibrary.MakePossibilitiesFor(String basename, Assembly assy, Int32 flags, LibSuffix suffix)
   at SQLitePCL.NativeLibrary.MyLoad(String basename, Assembly assy, Int32 flags, Action`1 log)
   at SQLitePCL.NativeLibrary.Load(String libraryName, Assembly assy, Int32 flags)
   at SQLitePCL.Batteries_V2.MakeDynamic(String name, Int32 flags)
   at SQLitePCL.Batteries_V2.DoDynamic_cdecl(String name, Int32 flags)
   at Microsoft.AppCenter.Storage.StorageAdapter..cctor()
2020-02-28 16:45:39.374 [AppCenter] DEBUG: AddChannel(core)
2020-02-28 16:45:39.378 [AppCenter] ERROR: An error occurred while initializing storage
System.NullReferenceException: Object reference not set to an instance of an object.
   at SQLitePCL.raw.sqlite3_open(String filename, sqlite3& db)
   at Microsoft.AppCenter.Storage.StorageAdapter.Initialize(String databasePath)
   at Microsoft.AppCenter.Storage.Storage.InitializeDatabase()
2020-02-28 16:45:39.385 [AppCenter] INFO: App Center SDK configured successfully.
2020-02-28 16:45:39.388 [AppCenter] DEBUG: AddChannel(analytics)
2020-02-28 16:45:39.392 [AppCenterAnalytics] DEBUG: SessionTracker.Resume
2020-02-28 16:45:39.397 [AppCenter] DEBUG: Invoke EnqueuingLog event for channel 'analytics'
2020-02-28 16:45:39.403 [AppCenter] INFO: 'Analytics' service started.
2020-02-28 16:45:39.405 [AppCenter] DEBUG: AddChannel(crashes)
2020-02-28 16:45:39.408 [AppCenter] INFO: 'Crashes' service started.
2020-02-28 16:45:39.409 [AppCenter] DEBUG: Invoke EnqueuingLog event for channel 'core'
'acars.exe' (CLR v4.0.30319: acars.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Deployment\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Deployment.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
2020-02-28 16:45:39.512 [AppCenter] DEBUG: Invoke FilteringLog event for channel 'core'
2020-02-28 16:45:39.513 [AppCenter] DEBUG: Invoke FilteringLog event for channel 'analytics'
2020-02-28 16:45:39.627 [AppCenter] ERROR: Error persisting log
Microsoft.AppCenter.Storage.StorageException: The database wasn't initialized.
   at Microsoft.AppCenter.Storage.Storage.<>c__DisplayClass29_0.<AddTaskToQueue>b__0()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AppCenter.Channel.Channel.<PersistLogAsync>d__40.MoveNext()
2020-02-28 16:45:39.630 [AppCenter] ERROR: Error persisting log
Microsoft.AppCenter.Storage.StorageException: The database wasn't initialized.
   at Microsoft.AppCenter.Storage.Storage.<>c__DisplayClass29_0.<AddTaskToQueue>b__0()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AppCenter.Channel.Channel.<PersistLogAsync>d__40.MoveNext()
The program '[18540] acars.exe' has exited with code -1 (0xffffffff).

App is on .net 4.8. Looking at the req deps, showing SQLitePCLRaw.bundle_green (>= 2.0.2), The version I have installed of that is 2.0.2

support

Most helpful comment

Sorry for the delay, I got this working - root issue with Fody/Costura. Had to update to the latest but the config above is working now. Thanks for your help!

All 21 comments

I've downgrade to 2.6.4 and downloaded the SQLite libraries to 1.1.14 and it's working now.

Hey, @nabeelio, that looks like dependency conflict with SQLite libraries.
What are the other nugets you are using?

Hi @Jamminroot. SQLitePCLRaw.bundle_green was 2.0.2. and matched the versions listed in the requirements. I wasn't seeing other versions

<PackageReference Include="sqlite-net-pcl">
    <Version>1.6.292</Version>
</PackageReference>
<PackageReference Include="SQLitePCLRaw.bundle_green">
    <Version>2.0.2</Version>
</PackageReference>
<PackageReference Include="SQLitePCLRaw.core">
    <Version>2.0.2</Version>
</PackageReference>
<PackageReference Include="SQLitePCLRaw.lib.e_sqlite3.linux">
    <Version>1.1.14</Version>
</PackageReference>
<PackageReference Include="SQLitePCLRaw.lib.e_sqlite3.osx">
    <Version>1.1.14</Version>
</PackageReference>
<PackageReference Include="SQLitePCLRaw.lib.e_sqlite3.v110_xp">
    <Version>1.1.14</Version>
</PackageReference>
<PackageReference Include="SQLitePCLRaw.provider.e_sqlite3.net45">
    <Version>1.1.14</Version>
</PackageReference>

Hi, @nabeelio!
Thanks for your response, our SDK since version 3.0.0 switched to sqlite version 2. Based on your dependencies, your libraries reference version 1, what can create a conflict. SQLitePCLRaw.core is the dependency of SQLitePCLRaw.bundle_green and can be removed. sqlite-net-pcl 1.7.302-beta uses version 2 with recursive dependencies, can you upgrade to it? Or can you downgrade sdk to 2.6.4, which can work with sqlite v1?

I can try, there might be a conflict with GMap.NET. I think 1.1.4 is the only version I was seeing in NuGet. Can you guys update the package dependencies listed in NuGET for 3.0? Because all I see is what's below. It's hard to tell what else someone needs to do (unless I'm missing something somewhere)

NETFramework 4.6.1
Newtonsoft.Json (>= 12.0.2)
SQLitePCLRaw.bundle_green (>= 2.0.2)

So that's what I've been going by. The GMap page isn't very clear either.

I'll try updating them and get back.

@nabeelio NuGet page already contains the right list. You don't need to list dependencies of dependencies in your .csproj file.

@MatkovIvan ok... so should I just remove all of the sqlite dependencies I have and then just install sqlite-net-pcl 1.7.302-beta, which should give me all of the deps?

You should install sqlite-net-pcl only if you directly use it. App Center SDK doesn't depend on it anymore. To include App Center SDK you should install only App Center NuGet, the system will take care about the dependencies of it.

Ok, I'll remove all sqlite related packages and just install AppCenter. Hopefully GMap works too. Thanks for your help, I'll update here once I do it

So I removed all of the sqlite packages and added only AppCenter. Here's what I'm getting:

2020-03-07 12:12:52.705 [AppCenter] ERROR: Error persisting log
Microsoft.AppCenter.Storage.StorageException: The database wasn't initialized.
   at Microsoft.AppCenter.Storage.Storage.<>c__DisplayClass29_0.<AddTaskToQueue>b__0()
   at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AppCenter.Channel.Channel.<PersistLogAsync>d__40.MoveNext()

I cleaned the solution, deleted the bin/obj folders too

Can you share a sample app with sources where you reproduces that issue?

@nabeelio Do you weave appcenter and sqlite libs with Fody/Costura by any chance? It looks like I have the same issue, but only if I weave appcenter+dependencies into the main assembly.

@rolikoff Yes, I do. Interesting... I'll try tonight to exclude the appcenter DLLs and see if that works. I already have the SQLite ones excluded:

<?xml version="1.0" encoding="utf-8"?>
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
  <Costura DisableCompression="false">
    <DisableFody Condition="'$(Configuration)' == 'Debug'">true</DisableFody>
    <Unmanaged32Assemblies>
      System.Data.SQLite
    </Unmanaged32Assemblies>
    <Unmanaged64Assemblies>
      System.Data.SQLite
    </Unmanaged64Assemblies>
  </Costura>
</Weavers>

But maybe I don't have all of the right sqlite ones excluded

Also exclude all SQLite*.dll, that worked for me.

@nabeelio This is how my FodyWeavers.xml looks like:

<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
  <Costura IncludeDebugSymbols="false" DisableCleanup="false" DisableCompression="true">
    <ExcludeAssemblies>
      SQLite*
      Microsoft.AppCenter*
    </ExcludeAssemblies>
    </Costura>
</Weavers>

@rolikoff Thank you, I will give that a try. What version are you on? I'm a few major versions behind on Fody/Costura and haven't updated yet.

@nabeelio The most recent ones, Fody 6.1.1 and Costura is, I believe 4.1.0

Sorry for the delay, I got this working - root issue with Fody/Costura. Had to update to the latest but the config above is working now. Thanks for your help!

I'm having the same issue where upgrading to 3.0 doesn't work. I've narrowed it down to one of the SQLite dependencies not supporting a custom domain assembly resolve. I put my dll's in a subfolder named data/lib. Once I upgraded to 3.0 all of my telemetry stopped working because something could not load e_sqlite3, even though it was in the same place as all of hte other dlls. I copied that next to my exe, and it got further along (complaining about other missing dlls). Been spending like 2 hours trying to downgrade cause visual studio keeps deciding to call it quits... Please just get rid of sqlite if you can. This is such a pain to deal with.

Hi, @Mgamerz ! We already have the same feature request. You can track it here.

This thread was very helpful but in my case the problem was slightly different. Because the sqlite package adds a "runtimes" folder with all the different runtime DLLs in it to the build output without those files being referenced in the project itself my clickonce publish wasn't seeing those files and copying them to the installer manifest.

By adding an explicit reference to those files the installer now includes them in the package.

Was this page helpful?
0 / 5 - 0 ratings