2

When i make that call from iPhone Simulator (iOS 6)

var request = System.Net.HttpWebRequest.Create(url);

I have following error

An exception was thrown by the type initializer for System.Net.WebRequest
Error Initializing the configuration system.
Unrecognized configuration section <system.runtime.remoting> 
 /Developer/MonoTouch/SDKs/MonoTouch.iphonesimulator.sdk/usr/etc/mono/2.0/machine.config

Stacktrace

  at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x00000] in <filename unknown>:0 
  at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] in <filename unknown>:0 
  at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0 
  at System.Net.WebRequest..cctor () [0x00000] in <filename unknown>:0 

I doesn't undestand what i must do..

UPDATE

My project have a CORE where are referenced that libraries:

  • Newtnsoft.Json.dll System.Net.dll (from /Library/Frameworks/Mono.framework/Libraries/mono/4.5/)
  • System.Core.dll (from /Library/Frameworks/Mono.framework/Libraries/mono/4.5/)
  • System.Core.dll (from /Library/Frameworks/Mono.framework/Libraries/mono/4.5/)
  • System.Data.Linq.dll (from /Library/Frameworks/Mono.framework/Libraries/mono/4.5/) System.dll (from /Library/Frameworks/Mono.framework/Libraries/mono/4.5/)
  • mscorlib.dll (from /Library/Frameworks/Mono.framework/Libraries/mono/4.5/) Cirrious.MvvmCross.dll (vnext version)

My iOS Project link CORE Project and have that references:

  • monotouch
  • Cirrious.MvvmCross.dll (vnext version)
  • Cirrious.MvvmCross.Binding.dll (vnext version)
  • Cirrious.MvvmCross.Binding.Touch.dll (vnext version)
  • Newtnsoft.Json.dll
  • Cirrious.MvvmCross.Dialog.Touch.dll (vnext version)
  • Cirrious.MvvmCross.Plugin.DownloadCache.Touch.dll (vnext version)
  • Cirrious.MvvmCross.Plugin.File.Touch.dll (vnext version)
  • Cirrious.MvvmCross.Plugin.Location.Touch.dll (vnext version)
  • Cirrious.MvvmCross.Plugin.ThreadUtils.Touch.dll (vnext version)
  • CrossUI.Touch.dll (vnext version)
  • System.dll (from /Library/Frameworks/Mono.framework/Libraries/mono/4.5/)
  • System.Windows.dll (from /Library/Frameworks/Mono.framework/Libraries/mono/4.5/)
Luigi Saggese
  • 5,299
  • 3
  • 43
  • 94

1 Answers1

4

System.Configuration is not part (neither as an assembly or namespace) of the BCL shipped with Xamarin.iOS.

If you get this error it's because you (somehow) got another System.dll (v2.0 from Mono or MS?) into the simulator and this won't work properly.

Make sure you're referencing only the BCL assemblies from Xamarin.iOS and the problem will go away.

poupou
  • 43,413
  • 6
  • 77
  • 174
  • i have made an UPDATE with my project references. That must help you to help me :-) – Luigi Saggese Oct 17 '13 at 21:24
  • 1
    Your iOS application should not be building against anything in `/Library/Frameworks/Mono.framework/Libraries/mono/4.5/`. It should be building against `/Developer/MonoTouch/usr/lib/mono/2.1/` (either the real assemblies or the facade assemblies). In fact I'm pretty sure your **core** project should be building against PCL assemblies too (not 4.5) and that might be the fix you need. – poupou Oct 17 '13 at 23:11
  • 1
    Now when i link libraries from `Developer/MonoTouch/usr/lib/mono/2.1/` i have following problem `Error CS0012: The type System.ComponentModel.INotifyPropertyChanged is defined in an assembly that is not referenced. Consider adding a reference to assembly System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' (CS0012)` – Luigi Saggese Oct 18 '13 at 06:57
  • 1
    That sounds like you have other binaires (likely the MvvmCross) that are linked to another profile (PCL likely). If you use the PCL route then you need to follow it all the way. – poupou Oct 18 '13 at 21:34
  • Are you right! There is MvvmCross library that is linking /Library/Frameworks/Mono.framework/Libraries/mono/4.5/ now i have solved my problem! Really thanks @poupou you open my mind! :-) – Luigi Saggese Oct 18 '13 at 21:39