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

UWP: CB.Lite.NET does not work on RS1 X86 mobile emulator #865

Closed
Mohsens22 opened this issue May 26, 2017 · 16 comments
Closed

UWP: CB.Lite.NET does not work on RS1 X86 mobile emulator #865

Mohsens22 opened this issue May 26, 2017 · 16 comments
Labels
Milestone

Comments

@Mohsens22
Copy link

Hey,
I'm working with CB.Lite.NET in UWP with DB8 prerelease and I saw some abnormal bugs.
in the ARM ticket you noted that it doesn't work in ARM devices. But now I tested a debug X86 build on a RS1 (B14393) mobile emulator and surprisingly it did NOT work. More interesting thing is that it works in RS2 (B15063) just FINE.
The error I get :
image

_System.TypeInitializationException occurred
HResult=0x80131534
Message=The type initializer for 'Couchbase.Lite.Database' threw an exception.
Source=
StackTrace:
at Couchbase.Lite.Database..ctor(String name, DatabaseOptions options)
at Core.Models.DBH.CreateDB() in C:\Users\Mohsen\Source\Repos\Denna\Denna\Core\Models\DBH.cs:line 23
at Core.Models.DBH.QueryW() in C:\Users\Mohsen\Source\Repos\Denna\Denna\Core\Models\DBH.cs:line 40
at Core.Models.TasksModel.Tasks() in C:\Users\Mohsen\Source\Repos\Denna\Denna\Core\Models\TasksModel.cs:line 38
at Denna.ViewModels.TimeLineViewModel..ctor() in C:\Users\Mohsen\Source\Repos\Denna\Denna\Denna\ViewModels\TimeLineViewModel.cs:line 17
at Denna.Denna_XamlTypeInfo.XamlTypeInfoProvider.Activate_121_TimeLineViewModel() in C:\Users\Mohsen\Source\Repos\Denna\Denna\Denna\obj\x86\Debug\XamlTypeInfo.g.cs:line 537
at Denna.Denna_XamlTypeInfo.XamlUserType.ActivateInstance() in C:\Users\Mohsen\Source\Repos\Denna\Denna\Denna\obj\x86\Debug\XamlTypeInfo.g.cs:line 4631

Inner Exception 1:
DllNotFoundException: Unable to load DLL 'LiteCore': The specified module could not be found. (Exception from HRESULT: 0x8007007E)_

Stack trace:
image

@Mohsens22
Copy link
Author

And here is emulators side by side. Right one (RS2) woks just fine but the left one (RS1) crashes at the very beginning.
image

@borrrden
Copy link
Member

I'm unfamiliar with these emulators. Are these the devices you are using? The build you have includes ARM native code so it should run in the same way on the device (and maybe fail in the same way...).

@borrrden
Copy link
Member

borrrden commented May 26, 2017

Oh I realize you are talking about versions of Windows now! I guess it's time to install those emulators and try them.

@Mohsens22
Copy link
Author

It does NOT work on ARM. At least I tested in TH2(B10586) and RS1(14393) and it crashed!!!

@borrrden
Copy link
Member

The exception in those instances are the same as the one you posted above? If so then it's probably the same problem.

@Mohsens22
Copy link
Author

In the Mobile I don't remember the issue. But will test and inform you :)
Having crash in earlier versions of windows and other types of devices (phone, HoloLens, Hub, Xbox, IoT etc) is not good... But I'll test more in different devices and tell you more...

@Mohsens22
Copy link
Author

Mohsens22 commented May 26, 2017

Yes. It seems that they have the same error
EDIT:
I explained it more in ARM ticket

@borrrden
Copy link
Member

I agree it's not good. I don't think that this should take long to sort out though (but that's a pure guess). The error indicates it couldn't find the library (i.e. the file was not there). If it was there and failed to load the exception would be different. The emulator failed to install for me though so I need to figure out why first...

@borrrden
Copy link
Member

Ok I finally got the emulator running and I see the same thing. I take back what I said about the error above; that logic is only for desktop. DllNotFoundException in this case either means not found or not usable. I imagine it is the latter, and I need to investigate why. It might be an invalid "min version" in the native compile.

@borrrden
Copy link
Member

borrrden commented May 27, 2017

I finally tracked down the problem due to luck and some obscure documentation references. Apparently, referencing kernel32.dll (and ole32.lib) is not allowed on Windows Phone (but for some reason in RS2 it became allowed because a "forwarding dll" exists for kernel32.dll while on previous versions it was simply not there and replaced by kernelbase.dll and kernel32_legacy.dll). I didn't reference this DLL anywhere directly, but it is one of the references that gets added by default when compiling a C++ lib. So I had to add the /NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:ole32.lib to the linker flags and after I did things started working on RS1 and RS2.

@borrrden
Copy link
Member

borrrden commented May 27, 2017

Phew I got everything packaged in the nick of time for DB8, which is frozen today. It will be pushed out as soon as I get the go-ahead (keep in mind that Monday is a U.S. and U.K. holiday, so most people won't be in...but I'm not in the U.S. or U.K. so I will be :p)

@borrrden borrrden added the bug label May 27, 2017
@borrrden borrrden added this to the 2.0 DB8 milestone May 27, 2017
@Mohsens22
Copy link
Author

Mohsens22 commented May 27, 2017

@borrrden So send the build here :D Then I can test and feedback more.

@borrrden
Copy link
Member

DB8 was pushed out yesterday

@Mohsens22
Copy link
Author

image

Seems that it's working!

@borrrden
Copy link
Member

borrrden commented Jun 1, 2017

Cool. I will add an item to my checklist to run on an older emulator before making a DB in the future.

@borrrden borrrden closed this as completed Jun 1, 2017
@Mohsens22
Copy link
Author

@borrrden Then check it in build 10240(Which is end of support) and build 10586.
Good job :)

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

No branches or pull requests

2 participants