appcenter-sdk-dotnet
appcenter-sdk-dotnet copied to clipboard
AppCenter for VSTO in .NET Framework 4.8 not working
Description
sqlite3 is causing problems on a clean VSTO project with AppCenter.
Repro Steps
Please list the steps used to reproduce your issue.
- Create new VSTO project in .NET Framework 4.8
- Add AppCenter (4.4.0) references
Details
See sample solution on https://github.com/KoenJanssensPD/vstoappcenter
Errors:
2021-10-06 11:45:08.865 [AppCenter] DEBUG: No named identifier found in appSecret; using as-is
2021-10-06 11:45:08.908 [AppCenter] DEBUG: Enabled TLS 1.2 explicitly as it was disabled.
2021-10-06 11:45:09.085 [AppCenter] ERROR: Failed to initialize sqlite3 provider.
System.Exception: Library e_sqlite3 not found
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()
2021-10-06 11:45:09.088 [AppCenter] DEBUG: Creating database at: C:\Users\KoenJanssens\AppData\Local\Microsoft\AppCenter\f7b67e39-4843-4fae-9efd-65f6eaee471e\Logs.db
2021-10-06 11:45:09.115 [AppCenter] DEBUG: AddChannel(core)
2021-10-06 11:45:09.160 [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()
2021-10-06 11:45:09.165 [AppCenter] ERROR: The storage operation failed
Microsoft.AppCenter.Storage.StorageException: The database wasn't initialized.
at Microsoft.AppCenter.Storage.StorageAdapter.ExecuteSelectionSqlQuery(String query, IList`1 args)
at Microsoft.AppCenter.Storage.StorageAdapter.Count(String tableName, String columnName, Object value)
at Microsoft.AppCenter.Storage.Storage.<>c__DisplayClass32_0`1.<AddTaskToQueue>b__0()
2021-10-06 11:45:09.171 [AppCenter] INFO: App Center SDK configured successfully.
2021-10-06 11:45:09.176 [AppCenter] DEBUG: Set max storage size.
2021-10-06 11:45:09.201 [AppCenter] ERROR: The storage operation failed
Microsoft.AppCenter.Storage.StorageException: The storage operation failed ---> Microsoft.AppCenter.Storage.StorageException: The database wasn't initialized.
at Microsoft.AppCenter.Storage.StorageAdapter.SetMaxStorageSize(Int64 sizeInBytes)
at Microsoft.AppCenter.Storage.Storage.<>c__DisplayClass23_0.<SetMaxStorageSizeAsync>b__0()
--- End of inner exception stack trace ---
at Microsoft.AppCenter.Storage.Storage.<>c__DisplayClass23_0.<SetMaxStorageSizeAsync>b__0()
at Microsoft.AppCenter.Storage.Storage.<>c__DisplayClass32_0`1.<AddTaskToQueue>b__0()
2021-10-06 11:45:09.204 [AppCenter] DEBUG: AddChannel(analytics)
2021-10-06 11:45:09.205 [AppCenter] ERROR: The storage operation failed
Microsoft.AppCenter.Storage.StorageException: The database wasn't initialized.
at Microsoft.AppCenter.Storage.StorageAdapter.ExecuteSelectionSqlQuery(String query, IList`1 args)
at Microsoft.AppCenter.Storage.StorageAdapter.Count(String tableName, String columnName, Object value)
at Microsoft.AppCenter.Storage.Storage.<>c__DisplayClass32_0`1.<AddTaskToQueue>b__0()
2021-10-06 11:45:09.208 [AppCenterAnalytics] DEBUG: SessionTracker.Resume
2021-10-06 11:45:09.215 [AppCenter] DEBUG: Invoke EnqueuingLog event for channel 'analytics'
2021-10-06 11:45:09.223 [AppCenter] INFO: 'Analytics' service started.
2021-10-06 11:45:09.227 [AppCenter] DEBUG: AddChannel(crashes)
2021-10-06 11:45:09.229 [AppCenter] ERROR: The storage operation failed
Microsoft.AppCenter.Storage.StorageException: The database wasn't initialized.
at Microsoft.AppCenter.Storage.StorageAdapter.ExecuteSelectionSqlQuery(String query, IList`1 args)
at Microsoft.AppCenter.Storage.StorageAdapter.Count(String tableName, String columnName, Object value)
at Microsoft.AppCenter.Storage.Storage.<>c__DisplayClass32_0`1.<AddTaskToQueue>b__0()
2021-10-06 11:45:09.236 [AppCenter] INFO: 'Crashes' service started.
2021-10-06 11:45:09.242 [AppCenter] DEBUG: Invoke EnqueuingLog event for channel 'core'
2021-10-06 11:45:09.244 [AppCenter] DEBUG: CheckPendingLogs(core) pending log count: 0
2021-10-06 11:45:09.277 [AppCenter] DEBUG: CheckPendingLogs(analytics) pending log count: 0
2021-10-06 11:45:09.278 [AppCenter] DEBUG: CheckPendingLogs(crashes) pending log count: 0
2021-10-06 11:45:09.543 [AppCenter] DEBUG: Invoke FilteringLog event for channel 'analytics'
2021-10-06 11:45:09.567 [AppCenter] DEBUG: Invoke FilteringLog event for channel 'core'
2021-10-06 11:45:09.662 [AppCenter] ERROR: Could not get max storage size.
2021-10-06 11:45:09.667 [AppCenter] ERROR: Could not get max storage size.
2021-10-06 11:45:09.669 [AppCenter] ERROR: Error persisting log
Microsoft.AppCenter.Storage.StorageException: Failed to store a log to the database.
at Microsoft.AppCenter.Storage.Storage.<>c__DisplayClass31_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()
2021-10-06 11:45:09.691 [AppCenter] ERROR: Error persisting log
Microsoft.AppCenter.Storage.StorageException: Failed to store a log to the database.
at Microsoft.AppCenter.Storage.Storage.<>c__DisplayClass31_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()
Hello @KoenJanssensPD, thank you for getting in touch with us! We are looking into your issue, will update this conversation once get results.
@KoenJanssensPD, sorry for the delayed answer, we are still investigating your issue.
@AnatolyPristensky , thank you for the update!
Hi @KoenJanssensPD ,
We were able to reproduce this issue on an empty VSTO project. This looks like an issue in SQLitePCLRaw library. See https://github.com/dotnet/efcore/issues/19396, https://github.com/ericsink/SQLitePCL.raw/issues/389, https://github.com/ericsink/SQLitePCL.raw/issues/343.
I tried to update sqlitepcl lib to version 2.0.7-pre20210929171745
in SDK, but it didn't help.
I also tried workarounds suggested in the threads above, but nothing helped for me.
I would suggest you to report an issue to the SQLitePCL.raw repo. We will update the lib in SDK if they release a fix.
I'll keep this bug open for now. Let's see if anyone else encounters this issue.
@DmitriyKirakosyan , I created a new issue on SQLitePCL.raw
Any workaroud for this ? I created new .NET Framework 4.8 project with App Center 5.0.1 and it is not working.
2023-01-03 09:59:44.248 [AppCenter] ERROR: Failed to initialize sqlite3 provider. System.Exception: Library e_sqlite3 not found
Setting this
<PropertyGroup Condition="'$(TargetFramework)' == 'net480"> <UseCurrentRuntimeIdentifier>True</UseCurrentRuntimeIdentifier> </PropertyGroup>
or this, wont help.
<PropertyGroup> <PlatformTarget>x86</PlatformTarget> </PropertyGroup>
@Kalyxt As mentioned above, this is an error on the side of the sqlitepcl
library. We have opened an issue in which you can ask a question on this topic.
@Kalyxt Sorry for misunderstanding, actually it looks like a duplicate of https://github.com/microsoft/appcenter-sdk-dotnet/issues/1722/
I'm experiencing the same thing and I'm developing with .net core 6.
Hello @pulmuone , please tell us what version of AppCenter
you are using, VSTO
version, Verbose logs, it would be helpful to provide a small demo project on which this error is reproduced.
@MikhailSuendukov
I'm on 5.0.2 My language version is 8 my .net runtime is 4.8
out of order this is how all that is defined in the csproj
<LangVersion>8.0</LangVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<BootstrapperPackage Include="Microsoft.VSTORuntime.4.0">
<PackageReference Include="Microsoft.AppCenter">
<Version>5.0.2</Version>
</PackageReference>
<PackageReference Include="Microsoft.AppCenter.Analytics">
<Version>5.0.2</Version>
</PackageReference>
<PackageReference Include="Microsoft.AppCenter.Crashes">
<Version>5.0.2</Version>
</PackageReference>
All Im doing is
AppCenter.Start(kv.ConnectionString(),
typeof(Analytics), typeof(Crashes));
I can get this to work by copying the runtimes director from
C:\Users\username\.nuget\packages\sqlitepclraw.lib.e_sqlite3\2.1.0\runtimes
to
C:\Users\username\AppData\Local\assembly\dl3\GPDLTRHM.2DD\CW8H18OX.ZAX\f0a1aaf0\009d039e_e66ed801
Hi @farzonl and thank you for describing your workaround in detail. Unfortunately, the issue in the SQLitePCL.raw library has not yet been resolved.
@KoenJanssensPD
I know you filed your bug in 2021 and might not care about this problem anymore, but I have a fix if you still do https://github.com/ericsink/SQLitePCL.raw/pull/553
You also have to change up your csproj file: https://github.com/ericsink/SQLitePCL.raw/issues/552#issuecomment-1696044504
And since this isn't a package you need to build your own bundle_green https://github.com/ericsink/SQLitePCL.raw/issues/552#issuecomment-1702104645
I have a feeling that our two issues are dupes, but since your call stack is different than mine I'd need you to confirm.
@farzonl thanks for the update. We are currently not actively looking into this issue, but we still have some projects lying around that might benefit from your fix...
@MikhailSuendukov This issue has been resolved by https://github.com/ericsink/SQLitePCL.raw/pull/553
What is needed to roll the appcenter dotnet sdk to take this change in the next release?
@MikhailSuendukov This issue has been resolved by ericsink/SQLitePCL.raw#553
What is needed to role the appcenter dotnet sdk?
What do you mean with "to role"?
Awesome stuff, @farzonl! Got any idea when the new ericsink/SQLitePCL.raw will drop? Eager to get it into our SDK update. 👀
Fixed in https://github.com/microsoft/appcenter-sdk-dotnet/pull/1765
@DmitriyKirakosyan you would need to take 2.1.7 (https://github.com/ericsink/SQLitePCL.raw/issues/566) to get my fix, but that is only in preview on nuget (https://www.nuget.org/packages/SQLitePCLRaw.core/2.1.7-pre20231110210158).
@farzonl , any ideas when it will be a stable release?
@DmitriyKirakosyan 2.1.7 releases is out https://www.nuget.org/packages/SQLitePCLRaw.core/2.1.7
@AnatolyPristensky When is the next release planned? If it is really far out there any chance you all could roll out a 5.0.3.1 release so that we can resolve this ticket by putting #1768 in a release?
@farzonl , at the beginning of March.
@DmitriyKirakosyan it is now the beginning of April. Any news on the next release?
I realize that App Center is scheduled for retirement, but that is still about a year from now.