-
Notifications
You must be signed in to change notification settings - Fork 126
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
instantiating a DB instance fails for 3.2+ #1679
Comments
I suppose this is because WPF creates "unpackaged" apps right? I've only ever tested WinUI with packaged apps. I can probably change the evaluation to be lazy but it won't fix the underlying problem for most people. I wonder if there is a way to detect packaged vs unpackaged or if I should just try and catch the exception.... |
Opened CBL-6481 to address this. |
Yup. WPF by default runs as unpackaged, though it can be packaged as well. Lazy eval would atleast bypass this exception when a default is already provided. I was unable to test out if anything else would break after since I couldn't get past DB init. |
There is one thing that you can try doing to get unblocked. Since the default directory resolver is a public interface you could register your own implementation of |
Library Version
3.2.1
.NET Runtime
.Net 8
Operating System / Device Details
Windows 11 24H2
Details
I have a .net WPF project that uses couchbase and was attempting to upgrade it from 3.1.9 to 3.2.1 but creating the database object fails. The target framework for it is net8.0-windows10.0.19041.0.
Expected behavior
call to new Couchbase.Lite.Database("dbname") should succeed
Actual behavior
throws exception
System.InvalidOperationException: 'Operation is not valid due to the current state of the object.'
Callstack
[Exception] WinRT.Runtime.dll!WinRT.ExceptionHelpers.ThrowExceptionForHR.__Throw|38_0(int hr) Unknown
[Exception] WinRT.Runtime.dll!WinRT.ExceptionHelpers.ThrowExceptionForHR(int hr) Unknown
[Exception] Microsoft.Windows.SDK.NET.dll!ABI.Windows.Storage.IApplicationDataStaticsMethods.get_Current(WinRT.IObjectReference _obj) Unknown
[Exception] Microsoft.Windows.SDK.NET.dll!Windows.Storage.ApplicationData.Current.get() Unknown
[Exception] Couchbase.Lite.dll!Couchbase.Lite.Support.DefaultDirectoryResolver.DefaultDirectory() Unknown
[Exception] Couchbase.Lite.dll!Couchbase.Lite.DatabaseConfiguration.DatabaseConfiguration() Unknown
I don't see the error if the targetframework is just 'net8.0-windows'
In my case, I know what the directory I want to specify, so I init the DB using something like this
new Couchbase.Lite.Database(dbName, new Couchbase.Lite.DatabaseConfiguration() { Directory = directory });
_directory in DatabaseConfiguration could be made into a lazy eval to skip the logic completely unless a default is not provided.
Steps To Reproduce
WpfApp1.zip
The text was updated successfully, but these errors were encountered: