Yura Babiy
Yura Babiy

Reputation: 525

NullPointerException when using effects with Xamarin

I decided to add underline Effect for Label, and did step by step from here, but for some reason whenever I have Label with this Effect, my app crashes on both Android and iOS. With diagnostic logs, there is still no messages, that could say me where is the problem. Actually, it just starts to render my View with this Label, and after that my app become not active, phone opens its main screen, and in VS, debugging stops immediately. In Android Device logs I found this:

enter image description here In iOS Device logs:

enter image description here

The code is similar to the code from the above link. I have already tried to find some cause, and actually, I don't have one. I tried to hardcore names. Also, no one of breakpoints in class or platform specific classes were reached. If I, for example, comment ResolutionGroupName attribute, the app will work and Label will be displayed, but sure without an underline.

UPDATE

Sorry, maybe iOS screenshot with an error was not related to the current issue. But I have one that probably is:

enter image description here

Upvotes: 1

Views: 349

Answers (1)

Dilmah
Dilmah

Reputation: 1127

If you're using the same code from the blog, then make sure that the Platform specific effects definition are written properly.

Ex in android :

[assembly: ResolutionGroupName(NameSpace.SharedEffectName.EffectNamespace)]
[assembly: ExportEffect(typeof(NameSpace.Droid.UnderlineEffect), nameof(Namespace.UnderlineEffect))] 

this should fix the error.

Upvotes: 5

Related Questions