Comments (13)
Looking into this, but the right way to do what you're doing is:
var sb = await BlobCache.LocalMachine.LoadImageFromUrl(source);
image.SetSource(sb.ToNative());
from splat.
Yo @dsplaisted, why do WPA81 apps care about versioning like this? Neither Splat nor Akavache are strong named, so it should load any version of the assembly that matches the simple name, right?
from splat.
@factormystic This should be fixed, update both Akavache and Splat
from splat.
Sweet, thanks
from splat.
@paulcbetts just calling image.SetSource(sb.ToNative());
doesn't directly work, due to cannot convert from 'Windows.UI.Xaml.Media.Imaging.BitmapSource' to 'Windows.Storage.Streams.IRandomAccessStream'
.
Do I need to be using
something to give me an extension method to make that happen, perhaps?
...
In any case, I have updated both akavache and splat, and get another TypeInitializationException for this same code:
{System.TypeInitializationException: The type initializer for 'Akavache.Sqlite3.Internal.SQLiteConnection' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'SQLitePCL.raw, Version=0.4.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
at Akavache.Sqlite3.Internal.SQLiteConnection..cctor()
--- End of inner exception stack trace ---
at Akavache.Sqlite3.Internal.SQLiteConnection..ctor(String databasePath, Boolean storeDateTimeAsTicks)
at Akavache.Sqlite3.SQLitePersistentBlobCache..ctor(String databaseFile, IScheduler scheduler)
at Akavache.Sqlite3.Registrations.<>c__DisplayClass6.<Register>b__0()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at System.Lazy`1.get_Value()
at Akavache.Sqlite3.Registrations.<>c__DisplayClass6.<Register>b__1()
at Splat.ModernDependencyResolver.GetService(Type serviceType, String contract)
at Splat.DependencyResolverMixins.GetService[T](IDependencyResolver This, String contract)
at Akavache.BlobCache.get_LocalMachine()
at (my program here)
I found a SQLitePCL.raw.dll
in packages\SQLitePCL.raw_basic.0.5.0\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid+MonoTouch
and added a reference to it in my project. That blew up at runtime as follows:
Something went wrong in the build configuration. This is the bait assembly, which is for referencing by portable libraries, and should never end up part of the app. Reference the appropriate platform assembly instead.
so I removed that reference and tried the ones in packages\SQLitePCL.raw_basic.0.5.0\build\wpa81\cppinterop_sqlite3_dynamic\arm
and \x86
instead. They also blew up before compiling, with:
There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture, "x86" (or "arm" for when I tried that one),
So I'm still stuck.
I even tried uninstalling, deleting the all the akavache & related packages from that folder, and reinstalling, but at this point I'm just cargo-culting because I don't know how to actually fix this.
from splat.
Oh, should this go back to the Akavache issue? I had already forgotten there were two issues and that was even from this morning...
from splat.
In your compiler warnings, it tells you that you can't use "AnyCPU", you have to choose either "x86" or "ARM", because SQLite3 is a native DLL. You also need on WPA81 to reference the MSVCRT Runtime for Windows Phone or else it won't work either:
Sorry that Windows Phone sucks
from splat.
Alright, it seems to be working now, thanks. I think it would be a good idea to write down all of the extra manual steps to get it working, perhaps in the readme, so it's obvious for the next person.
from splat.
@factormystic Send a PR to Akavache?
from splat.
Good idea.
FYI this is suuuuper awkward to manage when writing a real app, because you constantly have to change the build target between x86 and arm when deploying to a vm vs an actual device. Awkward enough to not really be wanting to use this library at all, in fact. If there was a non-sqlite mode, even with reduced performance, but that worked for Any CPU, that would be preferable.
from splat.
TL;DR make sure you have the build configuration set correctly.
from splat.
Hi, I experience the same issue. I'm working on NET45, installed Akavache 4.1.1 and Splat 1.6.2 but I still have this 'System.TypeInitializationException'
from splat.
Hi, I spent 24 hours on this and came with the result, that it is working in RELEASE mode only with following conditions:
- Microsoft C++ 2013 referenced (Add reference, win 8.1, Microsoft C++ 2013 Runtime...)
- Install support for SQLITE (Tools - Extensions and Updates)
- In project options do not check "Enable optimizations"
- If running on simulator, set Target processor to x86
- If running on device, set Target processor to ARM
Note: I found no way to make it working in DEBUG mode
from splat.
Related Issues (20)
- [BUG] Splat.Microsoft.Extensions.DependencyInjection causes System.InvalidOperationException: Call from invalid thread HOT 16
- [Bug]: Router randomly stops showing views on navigation HOT 9
- WPF, .net 8.0 and Splat latest version: IBitmap.ToNative, FromNative, SplatColor.ToNativeBrush and SplatColor.FromNativeColor not found by compiler. HOT 3
- Change the DI Microsoft to use KeyedServiceProvider insted of ContractDictionary HOT 1
- Dependency Dashboard
- Action Required: Fix Renovate Configuration HOT 1
- Housekeeping: Change MS MicrosoftDependencyResolver to require IKeyedServiceProvider in ctor HOT 2
- [BUG] Splat.Microsoft.Extensions.DependencyInjection never disposes the service locator HOT 1
- [BUG] Project targeting net5.0 won't build with Splat.Drawing installed HOT 3
- PlatformModeDetector.InDesignMode() not working in WPF designer for nested UserControls
- Drop net 5 support HOT 2
- How to Use Splat.DI.SourceGenerator HOT 7
- Update Splat.Autofac README HOT 2
- [BUG] DryIoc resolves Views upon registration HOT 8
- [BUG] Getting dependency from DryIoC container creates dependency object twice HOT 8
- [BUG] RegisterPlatformBitmapLoader doesnt register with framework net6.0-windows HOT 1
- [BUG] Registered Func cant be resolved
- [BUG] System.MissingFieldException HOT 3
- Default Test and Run mode HOT 8
- Optimise DefaultPlatformModeDetector on csproj sdk platforms
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from splat.