Closed simohr closed 4 years ago
Welcome back @simohr!
The issue is caused by this bug in Xamarin. You can work around it by changing the "Linker behavior" setting in the "iOS Build" page of your project's Properties dialog to either "Don't Link" or "Link SDK assemblies only".
When the Xamarin linker links an assembly, it strips assembly attributes from it. This causes this code, that initializes the WebServer.Signature
static property, to fail.
The linker has been my nemesis from the start. I have got our project to run it to work barely with the Link All option with having to write around 100 lines of code to preserve our classes, otherwise I get linker errors. So far I thought it didn't touch nugets but it seems it has its' hands in everything.
For anyone with the same issue, in your Xamarin.iOS project Right Click -> Options -> iOS Build -> Additional mtouch arguments type this line:
--linkskip=EmbedIO
This way you are telling the mtouch tool that builds your iOS app from .net code to exclude the EmbedIO library when linking, thus no longer stripping any assembly attributes.
Thanks to xamarin/xamarin-macios#6049 there seems to be an alternative to disabling linking of EmbedIO: tell the linker to preserve assembly-level custom attributes.
In your Xamarin.iOS project, right click -> Options -> iOS Build -> Additional mtouch arguments:
--optimize=-custom-attributes-removal
@simohr can you try this and tell us whether it works for you, and the impact on the size of your app?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Describe the bug When starting a web server on iOS I get an exception:
The same code was working for iOS in 3.3.3. We start the web server with "http://*:8080". And this setup runs on android without problems on 3.4.3.
To Reproduce Steps to reproduce the behavior:
Expected behavior A running web server.
Smartphone (please complete the following information):