Closed dooferorg closed 8 months ago
Sounds like you need to update xamarin forms along with essentials.
No, this still occurs even with everything else updated.
The issue is this project has made 'Platform.init()' protected.
Make sure that you updated both Xamarin.Forms and Xamarin.Essentials on all of your projects, the shared project, iOS, Android and that all the versions align. I don't see any reason why this should break. It seems to work fine in the sample app.
Make sure that you updated both Xamarin.Forms and Xamarin.Essentials on all of your projects, the shared project, iOS, Android and that all the versions align. I don't see any reason why this should break. It seems to work fine in the sample app.
You mean the sample Android app MainActivity.cs that calls Platform.Init() that I expressly stated is now a protected method when updating to version 1.8.0 when all 1.7.x versions work fine?
Still public from what I can see. The sample project is still a separate project and is bound to the same rules as your application, so if it was protected, it shouldn't be able to call it just like you.
Yes, I realized I mispoke about the Init() method (really thought that was the issue when I made the bug report) .. seems it was picking up the System 'Platform' object incorrectly and then whining about it, after my upgrade to 1.8.0.
What 1.8.0 DOES seem to break is the where the 'Platform' object even is.
I took some screenshots through my process. When I changed to explicit namespacing for the call to Platform.Init just like the sample application does, the proper error is apparent - it's not finding 'Platform' any more under the 1.8.0 nuget package.
Removing the call to 'Platform.Init()' breaks the version tracking.
Maybe the sample project needs to be updated since obviously something is different now. Maybe another package needs to be installed but it's not apparent to me what it is.
But that's the thing. 1.8.0 did not bring any breaking change in that regard. You can also see in the sample that the MainActivity
hasn't been touched in 3 years. If there was a breaking change in this area, that would've needed an update as well, but it didn't.
I have the feeling that there might be some weird issue with different versions between projects for you or some caching of older versions. If you throw out the bin/obj folders for the projects and rebuild, does that help?
If you create a new project and add Essentials to that and try to do the same, does that produce the same result?
That's fair enough. I just don't understand it. I tried making a new Xamarin project and I was able to upgrade it to 1.8.0 and it kept working.
However, even removing all dependencies to make the nuget package list the exact same as my updated example app, my original app had this error. I had closed the project and cleared the bin/obj folders both times on both projects to see if there was any caching going on. I just cannot get it to work with 1.8.0 on my original app.
I do thank you for helping me work through this. It does appear that it's not a bug on this project so I'm going to close it off. I'll just stick with 1.7.7 and move on with life at this point! lol.
Edit: I made a mistake with the report as to the Platform.Init() call.. it's not inaccessible, it's just not found under 1.8.0 with the namespacing and projects before. So I could well be missing something.
Description
I get this error since updating nuget packages on a CSharp Xamarin project:
Xamarin.Essentials.NotImplementedInReferenceAssemblyException: 'This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.'
I have installed Xamarin.Essentials and it is referenced like here: https://learn.microsoft.com/en-us/xamarin/essentials/version-tracking
I also found that 'Platform.Init()' was no longer able to be called since it's been made inaccessible? Had to remove that to get it to compile but that seems it breaks everything.
So what's the fix for this?
Steps to Reproduce
If you have Platform.Init() then it won't compile anyway because you've changed it to a protected method.
Expected Behavior
Same functionality as before in 1.7.3 to actually work.
Actual Behavior
Exception. Unuseable
Basic Information
1.8.0 it fails.. 1.7.x was good.
Edit:
I wrongly attributed the bug to a protected Init() method - this is not the case. It appears I am missing the whole 'Platform' object under the Xamarin.Essentials namespace and attributed the error incorrectly.