Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS is referencing System.ServiceModel #27

Closed
bonnojold opened this issue Nov 24, 2014 · 23 comments
Closed

iOS is referencing System.ServiceModel #27

bonnojold opened this issue Nov 24, 2014 · 23 comments

Comments

@bonnojold
Copy link

I have an issue which seems to be mostly related to Xamarin, but I wonder what's causing it. Mapsui is referencing System.ServiceModel assembly, but only on iOS. The System.ServiceModel is part of Windows Communication Foundation (WCF) which requires higher licenses on Xamarin. I've tried to backtrack the origin of the reference but couldn't find anything. It suprises me that iOS requires this while Android builds fine without the reference.

Other projects came across the same issue (mvvmcross, xlabs) and resolved it by removing the reference or changing PCL profile.

https://github.com/XLabs/Xamarin-Forms-Labs/issues/336
MvvmCross/MvvmCross#394

When looking through the System.ServiceModel namespace (http://msdn.microsoft.com/en-us/library/system.servicemodel.aspx) I don't see anything that seems required in Mapsui. Any idea what's causing this reference?

@pauldendulk
Copy link
Member

Searching for 'System.ServiceModel' in all *.csproj files returns no result, so there is no explicit reference to System.ServiceModel in the Mapsui projects. When building Android (did not test iOS) I can see System.ServiceModel dlls generated by the obj folder.

Perhaps it is caused by the PCL profile. I could experiment with this. How could this be tested? Where do you see the System.ServiceModel references?

@pauldendulk
Copy link
Member

When I start a new Android project and add BruTile, which is just a single PCL with Profile336 I see, System.ServiceModel.dll generated in the \obj\Debug\assemblies folder. I don' see those without BruTile.

So I think this is either a Xamarin bug or they consider PCL Profile336 as not supported by Indy.

Perhaps you could report this to Xamarin.

@pauldendulk
Copy link
Member

hmm, creating a new empty Profile336 PCL and adding it to a new Android project does not generate the System.ServiceModel assembly. Narrowing it down could take some time.

@bonnojold
Copy link
Author

Android did not give me any messages concerning the System.ServiceModel assembly, it seems to be iOS only. This is the part that strikes me the most, what's different in iOS that could cause this? Unfortunately I can't get any specific error from Xamarin, the license message shows up when I try to build (using NuGet). I can try to build mapsui from source to find out more tomorrow.

@pauldendulk
Copy link
Member

Perhaps you can reproduce it with only BruTile. It is simpler
https://github.com/BruTile/BruTile
Or maybe even with a empty PCL with Profile336.

@bonnojold
Copy link
Author

I'm able to open and run the samples of BruTile. I've opened the full repository of mapsui and I'm able to run the android samples/tests but not the iOS samples due to the same assembly reference.

In the application output window I've found which assemblies are loaded, which results in this list. It looks like the reference is caused by mono or am I mistaken?

Launching application
Application launched. PID = 2398
Press enter to terminate the application
Loaded assembly: /Library/Frameworks/Xamarin.iOS.framework/Versions/8.4.0.43/lib/mono/2.1/monotouch.dll [External]
Loaded assembly: /Library/Frameworks/Xamarin.iOS.framework/Versions/8.4.0.43/lib/mono/2.1/System.Core.dll [External]
Loaded assembly: /Library/Frameworks/Xamarin.iOS.framework/Versions/8.4.0.43/lib/mono/2.1/System.dll [External]
Thread started:  #2
Loaded assembly: /Users/Downloads/Mapsui-master 3/Samples/Mapsui.Samples.iOS/bin/iPhoneSimulator/Debug/MapsuiSamplesiOS.exe
Loaded assembly: /Users/Downloads/Mapsui-master 3/Mapsui.UI.iOS/bin/iPhone/Debug/Mapsui.UI.iOS.dll
Loaded assembly: /Library/Frameworks/Xamarin.iOS.framework/Versions/8.4.0.43/lib/mono/2.1/OpenTK-1.0.dll [External]
Loaded assembly: /Users/Downloads/Mapsui-master 3/Mapsui.Rendering.OpenTK-iOS/bin/iPhone/Debug/Mapsui.Rendering.OpenTK.dll
Loaded assembly: /Users/Downloads/Mapsui-master 3/Mapsui/bin/Debug/Mapsui.dll
Loaded assembly: /Library/Frameworks/Xamarin.iOS.framework/Versions/8.4.0.43/lib/mono/2.1/System.Xml.dll [External]
Loaded assembly: /Library/Frameworks/Xamarin.iOS.framework/Versions/8.4.0.43/lib/mono/2.1/Mono.Dynamic.Interpreter.dll [External]
Loaded assembly: /Users/Downloads/Mapsui-master 3/Samples/Mapsui.Samples.iOS/bin/iPhoneSimulator/Debug/Mapsui.Rendering.iOS.dll
Loaded assembly: /Users/Downloads/Mapsui-master 3/packages/BruTile.0.10.1/lib/portable-net403+sl5+wp8+wpa+win8+MonoAndroid+MonoTouch/BruTile.dll [External]
Loaded assembly: /Library/Frameworks/Xamarin.iOS.framework/Versions/8.4.0.43/lib/mono/2.1/System.Net.dll [External]
Loaded assembly: /Library/Frameworks/Xamarin.iOS.framework/Versions/8.4.0.43/lib/mono/2.1/System.Xml.Linq.dll [External]
Loaded assembly: /Library/Frameworks/Xamarin.iOS.framework/Versions/8.4.0.43/lib/mono/2.1/System.Xml.Serialization.dll [External]
Loaded assembly: /Library/Frameworks/Xamarin.iOS.framework/Versions/8.4.0.43/lib/mono/2.1/System.ServiceModel.dll [External]
Loaded assembly: /Library/Frameworks/Xamarin.iOS.framework/Versions/8.4.0.43/lib/mono/2.1/System.Runtime.Serialization.dll [External]
Loaded assembly: /Library/Frameworks/Xamarin.iOS.framework/Versions/8.4.0.43/lib/mono/2.1/System.ServiceModel.Web.dll [External]
Loaded assembly: /Users/Downloads/Mapsui-master 3/Samples/Mapsui.Samples.iOS/bin/iPhoneSimulator/Debug/Newtonsoft.Json.dll [External]

@pauldendulk
Copy link
Member

So you can run the iOS BruTile samples but can't run the iOS Mapsui Samples?

Is the error where running or while building?

I used dotpeek to inspect MapsuiSamplesiOS.exe and I see that Mapsui references System.ServiceModel.Web and I don't see why. It is not Profile336 in itself because BruTile does not have this dependency and has the same profile.

@bonnojold
Copy link
Author

I've tested with different licenses. The error is shown while building and the build gets cancelled, Xamarin comes with a window to register a business account and no additional information is shown. With the business license I can build normally (as I'm allowed to refer ServiceModel.Web) which gave me above launch output.

There are no samples/tests for iOS on BruTile, I just tried to build it which was succesful. I have also tried a profile336 pcl project which did not seem to give any issues.

Interesting note: I can't build Mapsui.Samples.iOS but I can build the following projects:

Mapsui
Mapsui.Rendering.iOS
Mapsui.Rendering.OpenTK-iOS
Mapsui.UI.iOS
Mapsui.Rendering.OpenTK.iOS.Tests

@pauldendulk
Copy link
Member

It is hard for me to investigate this. If anyone finds out more please let me know.

@pauldendulk
Copy link
Member

I am closing this issue. We have since release two Mapsui iOS apps and did not come across this problem. This could easily have been one of the (many) bugs that Xamarin fixes quickly.

@pauldendulk
Copy link
Member

Reopened because this was reported again https://github.com/pauldendulk/Mapsui/issues/43

@pauldendulk
Copy link
Member

I just did some further tests. If I remove RequestHelper.cs from BruTile the assemblies folder is not generated (so no assemblies folder at all). Perhaps this solves the issue for Xamarin.Indy developers.

RequestHelper is not used from BruTile itself but it offered as a kind of utilities class. It does add some value but perhaps it could be removed and be presented as a sample.

@pauldendulk
Copy link
Member

To Xamarin.Indy developers. You could test this:

  • Clone BruTile
  • Add a new Android app
  • Add BruTile core as reference
  • Confirm the reported problem exists
  • Remove RequestHelper.cs from BruTile
  • Confirm the reported problem does not exist

If this solves the problem we will consider removing RequestHelper.cs. If it is removed we will have to release a new BruTile package and Mapsui package.

@kochizufan
Copy link

Can I get a RequestHelper.cs-removed-BruTile.dll?
I try to make it, but if I remove RequestHelper.cs, HttpTileProvider.cs throws compile error, so I can't remove RequestHelper.cs.
I can't compile RequestHelper.cs-removed-BruTile, without error.

@pauldendulk
Copy link
Member

Forgot about that one. You can just remove RequestHelper there and only assign the argument.

Your app will probably not run though. It is just to test Indy.

@pauldendulk
Copy link
Member

It would also be interesting to see what happens if you compile RequestHelper.cs as part of the Android app itself.

@kochizufan
Copy link

Itried:

  • I made solution named "BruTileErrorTest".
  • I made projects named "BruTileErrorTest.iOS" and "BruTileErrorTest.Droid" under the solution.
  • I add BruTile project to the solution, and refer it from iOS and Android project.
  • I add dummy code
var web = new BruTile.Web.HttpTileSource (new BruTile.TileSchema (), new BruTile.Web.OsmRequest ());

to iOS project's AppDelegate#FinishedLaunching and Android project's MainActivity#OnCreate.

  • Compiled them. iOS project shows "Need Business edition" error, Android not.
  • In BruTile project, I change RequestHelper.cs's compile option to "None", and HttpTileProvider.cs's code to
    _fetchTile = fetchTile;// ?? (RequestHelper.FetchImage);
  • Compiled iOS and Android projects again. Result is same before. iOS project shows same error, Android not.

If I tested bad way or what you don't wanted, please tell me.

Regards,

@pauldendulk
Copy link
Member

Thanks for your clear report. We should conclude this does not solve the problem. The fact that iOS needs business and Android not is weird, and indicates it is a bug. We could try to randomly cut parts out of BruTile (maybe anything using system.net) and see if it fixes the problem. But maybe we should first try to ask Xamarin.

@kochizufan
Copy link

Reported.

https://bugzilla.xamarin.com/show_bug.cgi?id=30621

Thank you for helping us!

@pauldendulk
Copy link
Member

Thanks a lot!

@kochizufan
Copy link

Xamarin reported it will fix in Xam.iOS 8.10.3
(If I didn't misunderstand written in English...)
https://bugzilla.xamarin.com/show_bug.cgi?id=30621#c9

@pauldendulk
Copy link
Member

Ah great! Thanks for taking care of this.

@pauldendulk
Copy link
Member

Closing. I assume this is fixed although not tested. Reopen when seen again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants