Closed TobiasBuchholz closed 6 years ago
Hello,
That is unexpected. Since you cannot send the project, could you send your register.h and .m so we can see what the problem is. It might be the case that some headers are missing in the sim or something similar.
Sure, here you go: registrar.zip
It looks like we're not detecting MetalKit usage properly, and thus not adding the proper include directive in the generated registrar code.
@TobiasBuchholz can you try manually using a MetalKit type in your project, by adding something like this as the last line of your Main method:
Console.WriteLine (typeof (MetalKit.MTKView));
hopefully this will make us detect that MetalKit is used, and thus add the corresponding include directive in the generated code.
Hi, I've put that line as last line into my Application.Main(string[] args) method, but that didn't seem to change anything unfortunately.
Actually this looks like we're skipping MetalKit on purpose for simulator builds, because at first Apple didn't ship the MetalKit framework for the simulator (it would only work for device builds).
I'll have a look to see if this is still the case, but you may be able to work around it by enabling the linker (in the iOS Build options, change Linker Behavior for simulator builds to match the value for device builds). This might link away all the code that references MetalKit, and thus hopefully the generated registrar code won't need it anymore.
If that doesn't work, the last solution would be to add a conditional compilation symbol for simulator builds, and use it to conditionally exclude all MetalKit related code (you seem to have a MTKViewDelegateRx
class: I'd start here)
Unfortunately changing the linker behavior doesn't work either.
But thanks to your hint I was able to pin down the problem to the package ReactiveUI.Events. It's an optional part of the MVVM framework ReactiveUI, which looks at all the EventHandlers for a platform and generates Observable.FromEventPattern extension methods, so this is why MetalKit gets included but it's also why I can't apply your conditional compilation symbol trick.
So I guess I'll either have to remove this package (which would be a shame, because it's quite useful) or I'll have to create an issue on their github page, right?
Thanks anyways :)
So I guess I'll either have to remove this package
You could still conditionally exclude all the code that uses that assembly/package from simulator builds.
Assemblies that are not needed at all are not added to the app.
I'll have to create an issue on their github page, right?
I don't think this is their bug, at least until we've confirmed if we can fix this on our side or not.
Steps to Reproduce
--registrar:static
to my native iOS xamarin project but it results in the build errors from below. I would like to add the argument because it solves another build error after I've added the Xamarin.Firebase.iOS.Analytics nuget package to the project. The build is only failing for the simulator, builds for devices are fine.Expected Behavior
The build succeeds without any problems.
Actual Behavior
The build fails with errors like
Environment
Build Logs
Build Logs Gist
Example Project (If Possible)
Since the project is for work I can't share it unfortunately. I've tried to create a sample project with the same packages but for this project the build succeeds without any problems.