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
[BUG] System.Reflection.TargetInvocationException on BitmapLoader.Current #330
Comments
What version of Android are you using? |
currently testing on android 7.0 and using visual studio for mac with xamarin.android Version: 9.2.3.0 |
Ah that's be likely why. Our minimum is Android 81 |
Devices with Android 9 and 8 are also not working |
I'm talking about in your target framework not so much the devices. |
Target is 8.1 |
I will have a look at it tomorrow my time for you. See what I can find. |
We have similar crashes for users with on Android 8.0 devices according to Fabric... |
After some debug, there is a weird thing happening:
An interesting thing is this assembly is dynamic, so only line of code fixes the issue: var assemblies = System.AppDomain.CurrentDomain.GetAssemblies ()
.Where (x => !x.IsDynamic)
.SelectMany (x => x.GetTypes ())
... |
potential fix in #337 but is there a better way than to skip all dynamic assemblies if they could have a genuine use case for generating drawable resources via reflection? (not sure they do, merely posing the question) @IamTobi unfortunately this won't be an immediate help to you if you are blocked on akavache 5\splat 3. |
Any idea oh how to use a local method for assembly loading? So far the only workaround I see is to keep the original NuGet reference but replace the DLL reference in the project to the custom one (that built from the source code using fixed assembly loading). Is there any better solution to try? |
just to clarify - do you mean having a custom splat v3? what's blocking you getting onto v7? moving forward we can probably do something to allow service locator registration of platformbitmap loader |
We have a bit outdated production that uses Splat 2.0.0 and development that uses the latest 7.2.1. I've tried to follow the next approach:
Usually that helps, but in the current case the problem happens before splat/src/Splat/Bitmaps/BitmapLoader.cs Line 18 in 48fabe2
Also, the latest Splat NuGet package still has the issue and we need the fix now. |
I don't see you contributing to the project nor your employer? We don't commit to any sort of timeline since everyone here is basically volunteering their time. https://www.youtube.com/watch?v=Mm_RuObpeGo for some ideas why sometimes open source developers are jerks. Essentially @dpvreony when his life permits will get that fix out there in the wild, and if we have per our open collective policy https://opencollective.com/reactiveui a sponsor we are happy to give those issues priority. Thanks.
|
@glennawatson I'm sorry for being impolite. I didn't have attention to insult or force to fix an issue. I just wanted to point out that I understand that the fix won't be available immediately, and we just looking for a local workaround while the new version is released. Hoped to get your thoughts, if you see any better solution then described. |
I will see how far away @dpvreony is coming from the fix. That is a fairly standard reply if people start requesting changes immediately and stuff. There is definitely a problem where sometimes clients of open source products tend to expect guaranteed support levels and stuff so no offense intended and none taken. |
the challenge is splat v3 can't use an assembly rebind to v7.x because of the amount of breaking changes that have happened. exceptions in static constructors basically mean the type is never available in the appdomain. the way the platformbitmap is set up makes it a bit difficult to retrospectively interact with. I touched on us changing the initialisation to allow injecting like you can do with the DI locator. but again that's future and won't solve your problem. can you confirm you are using vs2017 or vs2019? other issues rearing their head recently are down to a change in vs2019 and xamarin. so if that's the case you could build with vs2017. if you need a v2/v3 capable library you may to take a fork of v3 and copy the fix https://github.com/mono/mono/blob/22887567e1663b101c37fa29ec1613175337f944/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs#L820 is where the issue is occuring. I need to build a unit test and run it on the android test runner. I removed part of a fix on checking the dynamic type yesterday as I thought the try \ catch should handle it, but having looked at mono i'm not convinced.
|
Was this fixed in v8 for you guys? |
Describe the bug
I am using akavache and LoadImageFromUrl(key,url,fetchalways,...) method. As I can see this calls the BitmapLoader.Current.Load() method this throws an exception. Possible the Reflection of the PlatformBitmapLoader fails when BitmapLoader.Current is called
Expected behavior
An image is loaded 😁
Environment(please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: