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

A problem with AppCenter and VSTO #455

Open
KoenJanssensPD opened this issue Oct 12, 2021 · 10 comments
Open

A problem with AppCenter and VSTO #455

KoenJanssensPD opened this issue Oct 12, 2021 · 10 comments

Comments

@KoenJanssensPD
Copy link

see this issue on Appcenter SDK

as suggested in #451, #389, #343,... it did not help to upgrade to 2.0.7-pre20210929171745 did not solve the problem...

@bricelam
Copy link
Contributor

NuGet won't resolve the runtime assets for AnyCPU on .NET Framework. You can tell it to use the current .NET SDK's runtime instead like this:

<PropertyGroup Condition="'$(TargetFramework)' == 'net472'">
    <UseCurrentRuntimeIdentifier>True</UseCurrentRuntimeIdentifier>
</PropertyGroup>

If you're using classic (non-SDK) csproj files, you can just change the platform from AnyCPU:

<PropertyGroup>
  <PlatformTarget>x86</PlatformTarget>
</PropertyGroup>

@ericsink
Copy link
Owner

@bricelam My goodness these ".NET Framework with AnyCPU" issues just won't go away. I thought I had them resolved with the most recent changes. Is there yet another change I should make?

@bricelam
Copy link
Contributor

Oh, I don't think I actually tried the latest version. 🙂 After updating, it works for me

@ericsink
Copy link
Owner

@bricelam :

Eric.Sigh(Kind.Relief)

@KoenJanssensPD : Does the 2.0.7 release work as expected for you?

@KoenJanssensPD
Copy link
Author

@KoenJanssensPD : Does the 2.0.7 release work as expected for you?

@ericsink , I tried my best to update my test repo, but since I am quite unfamiliar with editing these kind of "meta" (packages, nuget, targetframework, csproj, ...) settings, I did not succeed... :(

Would somebody be able to check my test repo and try to solve it?

@viceice
Copy link

viceice commented Nov 18, 2021

2.0.7 thows an error with Microsoft.Data.Sqlite

System.TypeInitializationException: The type initializer for 'Microsoft.Data.Sqlite.SqliteConnection' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Data.Sqlite.Utilities.ApplicationDataHelper.GetFolderPath(String propertyName)
   at Microsoft.Data.Sqlite.Utilities.ApplicationDataHelper.get_LocalFolderPath()
   at Microsoft.Data.Sqlite.Utilities.BundleInitializer.Initialize()
   at Microsoft.Data.Sqlite.SqliteConnection..cctor()
   --- End of inner exception stack trace ---
   at Microsoft.Data.Sqlite.SqliteConnection..ctor()
   at Microsoft.Data.Sqlite.SqliteFactory.CreateConnection()

Also this also doesn't seem to work on all systems:

<PropertyGroup Condition="'$(TargetFramework)' == 'net472'">
    <UseCurrentRuntimeIdentifier>True</UseCurrentRuntimeIdentifier>
</PropertyGroup>

@ericsink ericsink changed the title Unable to load e_sqlite library in .NET Framework 4.8 A problem with AppCenter and VSTO Nov 18, 2021
@ericsink
Copy link
Owner

To avoid confusion, I'd like to confine this issue to the problem being seen by @KoenJanssensPD the OP. The problem looks specific to VSTO / AppCenter, so I have changed the title of the issue accordingly.

@viceice It looks like your comment above is a separate matter. Please log a separate issue and provide full details of your situation.

@ericsink
Copy link
Owner

@KoenJanssensPD I've grabbed your test repo and can build it, but I don't have Excel, so I can't actually run it.

One problem I do see is that the project has bundle_sqlite3, but AppCenter has a dep on bundle_green, which means there are two SQLitePCLRaw bundles in play, and that is a no-no. However, I'm not sure that will solve the problem.

The truth is that I've encountered one or two issues before involving SQLitePCLRaw and VSTO, and I don't remember if we ever had success with that case. Maybe we did and I just forgot. Perhaps we can get it figured out this time.

One thing to clarify: Has this ever worked? I think I initially mis-read this issue, thinking that you were saying that it was working and then it broke, but now I'm guessing that you haven't had this working at all.

@viceice
Copy link

viceice commented Nov 18, 2021

@ericsink My issue seems to be this: dotnet/efcore#26729

@KoenJanssensPD
Copy link
Author

KoenJanssensPD commented Nov 18, 2021

@KoenJanssensPD I've grabbed your test repo and can build it, but I don't have Excel, so I can't actually run it.

One problem I do see is that the project has bundle_sqlite3, but AppCenter has a dep on bundle_green, which means there are two SQLitePCLRaw bundles in play, and that is a no-no. However, I'm not sure that will solve the problem.

The truth is that I've encountered one or two issues before involving SQLitePCLRaw and VSTO, and I don't remember if we ever had success with that case. Maybe we did and I just forgot. Perhaps we can get it figured out this time.

One thing to clarify: Has this ever worked? I think I initially mis-read this issue, thinking that you were saying that it was working and then it broke, but now I'm guessing that you haven't had this working at all.

You are right that this is the first time we try to get AppCenter working with VSTO. We have other types of .net framework applications with AppCenter, so we wanted to get this working for our VSTO projects as well...
Probably I have messed up the bundle_green and bundle_sqlite dependencies myself when trying stuff... But even a clean VSTO project where only AppCenter is added gives the same problem...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants