I’m really at a loss here.
I’m working on a .Net Maui Application for Android and iOS for work. When I open a specific page I sometimes (like, maybe 1 out of 6-10 times) get an Error with this message: “System.ArgumentException: ‘An item with the same key has already been added. Key: Microsoft.Maui.Controls.BindableProperty'”. No further information… The call stack in VS shows nothing except [External Code] when Debugging (gee, very helpful…). I’ve tried it both on my physical device and with the Standard Pixel 5 – API 34 Emulator.
I’ve wrapped every bit of code, that I suspect of being the culprit in try/catch statements. None of them seem to catch the exception. I’ve also tried to see if I can isolate the problem by observing the parallel stacks. Nothing gives me any usable information, where or what triggers the problem.
Does anyone have any idea what I could do or a tip how to proceed?
Now before anyone critizices the lack of further information: I know, I’m being very vague. But that’s mainly because VS itself is extremely vague! I don’t even know which part of my xaml or my code behind triggers the exception (if it even is my code that is the problem). I can’t really post the code for all the custom views/converters/extensions I use on the page in question because it’s a really big page and posting everything would totally break the scope and would take forever for me to rewrite it in a “anonymized” way.
I don’t expect concrete solutions to my problem (although that would be awesome) but maybe someone can at least tell me how I could debug this more efficiently.
Freddy V is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.