Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppCenter for VSTO in .NET Framework 4.8 not working #1583

Closed
KoenJanssensPD opened this issue Oct 6, 2021 · 25 comments
Closed

AppCenter for VSTO in .NET Framework 4.8 not working #1583

KoenJanssensPD opened this issue Oct 6, 2021 · 25 comments
Labels
next-release Will be included in the upcoming release not sdk issue support

Comments

@KoenJanssensPD
Copy link

Description

sqlite3 is causing problems on a clean VSTO project with AppCenter.

Repro Steps

Please list the steps used to reproduce your issue.

  1. Create new VSTO project in .NET Framework 4.8
  2. 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()
@AnatolyPristensky
Copy link
Contributor

Hello @KoenJanssensPD, thank you for getting in touch with us!
We are looking into your issue, will update this conversation once get results.

@AnatolyPristensky
Copy link
Contributor

@KoenJanssensPD, sorry for the delayed answer, we are still investigating your issue.

@KoenJanssensPD
Copy link
Author

@AnatolyPristensky , thank you for the update!

@DmitriyKirakosyan
Copy link
Contributor

Hi @KoenJanssensPD ,

We were able to reproduce this issue on an empty VSTO project.
This looks like an issue in SQLitePCLRaw library. See dotnet/efcore#19396, ericsink/SQLitePCL.raw#389, ericsink/SQLitePCL.raw#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.

@KoenJanssensPD
Copy link
Author

@DmitriyKirakosyan , I created a new issue on SQLitePCL.raw

@Kalyxt
Copy link

Kalyxt commented Jan 3, 2023

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>

@MikhailSuendukov
Copy link
Contributor

@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.

@MikhailSuendukov
Copy link
Contributor

@Kalyxt Sorry for misunderstanding, actually it looks like a duplicate of #1722

@pulmuone
Copy link

pulmuone commented Mar 3, 2023

I'm experiencing the same thing and I'm developing with .net core 6.

@MikhailSuendukov
Copy link
Contributor

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.

@farzonl
Copy link

farzonl commented Aug 25, 2023

@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

@MikhailSuendukov
Copy link
Contributor

Hi @farzonl and thank you for describing your workaround in detail. Unfortunately, the issue in the SQLitePCL.raw library has not yet been resolved.

@farzonl
Copy link

farzonl commented Sep 1, 2023

@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 ericsink/SQLitePCL.raw#553

You also have to change up your csproj file:
ericsink/SQLitePCL.raw#552 (comment)

And since this isn't a package you need to build your own bundle_green
ericsink/SQLitePCL.raw#552 (comment)

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.

@KoenJanssensPD
Copy link
Author

@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...

@farzonl
Copy link

farzonl commented Nov 7, 2023

@MikhailSuendukov This issue has been resolved by ericsink/SQLitePCL.raw#553

What is needed to roll the appcenter dotnet sdk to take this change in the next release?

@KoenJanssensPD
Copy link
Author

@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"?

@DmitriyKirakosyan
Copy link
Contributor

Awesome stuff, @farzonl! Got any idea when the new ericsink/SQLitePCL.raw will drop? Eager to get it into our SDK update. 👀

@DmitriyKirakosyan DmitriyKirakosyan added the next-release Will be included in the upcoming release label Nov 20, 2023
@DmitriyKirakosyan
Copy link
Contributor

Fixed in #1765

@farzonl
Copy link

farzonl commented Nov 20, 2023

@DmitriyKirakosyan you would need to take 2.1.7 (ericsink/SQLitePCL.raw#566) to get my fix, but that is only in preview on nuget (https://www.nuget.org/packages/SQLitePCLRaw.core/2.1.7-pre20231110210158).

@DmitriyKirakosyan
Copy link
Contributor

@farzonl , any ideas when it will be a stable release?

@farzonl
Copy link

farzonl commented Nov 22, 2023

@DmitriyKirakosyan 2.1.7 releases is out https://www.nuget.org/packages/SQLitePCLRaw.core/2.1.7

@farzonl
Copy link

farzonl commented Feb 2, 2024

@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?

@DmitriyKirakosyan
Copy link
Contributor

@farzonl , at the beginning of March.

@jizc
Copy link
Contributor

jizc commented Apr 8, 2024

@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.

@MikhailSuendukov
Copy link
Contributor

Hello, the AppCenter .NET SDK v5.0.4 has been released, including a fix for this issue. Therefore, I am closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next-release Will be included in the upcoming release not sdk issue support
Projects
None yet
Development

No branches or pull requests

9 participants