Embeddinator-4000
Embeddinator-4000 copied to clipboard
Using System.DateTime/System.Decimal as a property in class with export attribute embeddination fails for Android
Steps to Reproduce
- By using System.DateTime as a property with export attribute in Android class library project.
- Run embedination command listed below to reproduce.
Expected Behavior
Embedination should not fail.
Actual Behavior
Embedination fails.
Environment
MacOS,
mono ../../../../Native/Android/Tools/Embeddinator-4000/build/lib/release/Embeddinator-4000.exe bin/Debug/TestEmbedination.dll --gen=Java --platform=Android --outdir=../../../../Native/Android/EmbedinatedFramework -c --verbose
Build Logs
Failed to create JavaTypeInfo for class: Testembedination.TEmbeded due to System.NullReferenceException: Object reference not set to an instance of an object
Example Project (If Possible)
This bug is caused by an external generator from Xamarin.Android that we call for objects that inherit from Java.Lang.Object
.
The task code is here: https://github.com/xamarin/xamarin-android/blob/e5b1c92c192612d1a292a0ce35ea77a72f38eb48/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs#L134
Other related files are here: https://github.com/xamarin/xamarin-android/blob/24f2aec113857b5c583e14959b9af08ad45b22b1/src/Xamarin.Android.Build.Tasks/Generator/Generator.cs
And the generator itself: https://github.com/xamarin/java.interop/blob/429dc2a68579c9a820f03a7f09f35da3db9cd54a/src/Java.Interop.Tools.JavaCallableWrappers/Java.Interop.Tools.JavaCallableWrappers/JavaCallableWrapperGenerator.cs#L22
@tritao At the moment, I am using a workaround by converting the DateTime to long (Ticks) and recalculating the Date on native side. Also, for Decimal I am multiplying the decimal with 100 and converting it into int and on native side dividing the int with 100 and converting it into decimal.
Also, can you please open an issue on Mono.Android github page since you have more knowledge of the problem. Or I should do that ?
Please feel free to open it.
@tritao Yes sure I can do that, can you tag any responsible person here, having knowledge about this part of error? I will be needing him/her if any in depth question raised on Xamarin.Android issues section.
I am not sure who would be best to look at this one.
@jonathanpeppers any idea?