Basically, I'm writing an android application and an iOS Phone/Tablet application using Xamarin and I want to have all common code out in a PCL library. All was going fine until I got the following exception:
System.InvalidOperationException: Unable to set the CookieContainer. Please make sure the binding contains an HttpCookieContainerBindingElement.
On trying to add this HttpCookieContainerBindingElement to the binding, I discover that the class does not even exist. My PCL targets Xamarin.iOS, Xamarin.Android, .Net 4.5, and Silverlight 5.
This is a complete and total blocker for me now. Can any of you guys shed some light on this for me and show me a way forward?
I don't have a solution, but there's a long thread on this topic on the Xamarin forums:
http://forums.xamarin.com/discussion/2369/cookiecontainer-missing-in-6-2-1
Related
I am generating a WCF proxy using add web referance in Xamarin Studio
yet genrated proxy create the following error:
The type or namespace name IExtensibleDataObject' does not exist in the namespaceSystem.Runtime.Serialization'. Are you missing an assembly reference? (CS0234) (infra)
I am using mono4.0.5
Can anybody help me solve this problem that gave me many sleepless nights.
PS: I tried to skip proxy generation to using slsvcutil.exe code generation
but the same error keeps happening
Right click on you project and select Edit references. Look for System.Runtime.Serialization and select it.
If you already set the reference of System.Runtime.Serailization and error is still persist then try following regular steps..
clean solution and rebuild solution
restart visual studio
I found a solution for your problem. The problem is Xamarin Portable Targets. The targets must not contain any Windows targets selected. After changing this as in the image below it will not give you any compile time errors for System.Runtime.Serialization.
I found that after reading this https://developer.xamarin.com/guides/android/under_the_hood/assemblies/
The System.Runtime.Serialization.dll is for the Silverlight package and when selecting windows targets it might be removing these dlls/code not supported in windows platform from the portable libraries.
I've created a Xamarin project which added the following projects to the solution:
Xamarin.UI(Portable)
Xamarin.UI.Droid
Xamarin.UI.iOS
Xamarin.UI.UWP
Xamarin.UI.Windows (Windows 8.1)
Xamarin.UI.WindowsPhone (Windows Phone 8.1)
I am having problems creating a client which can consume my WCF service.
1) Firstly the current Xamarin project template doesn't reference System.ServiceModel assembly in the PCL therefore I cannot right click the PCL and Add Service Reference to my project. When I manually add a reference to System.ServiceModel from this location - C:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5 the menu item for create service reference pops up. When I click Go in the Add Service Reference dialog I get the following error:
"This service cannot be consumed by the current project. Please check if the project target framework supports this service type."
The PCL targets are as follows:
.NET Framework 4.5
ASP.NET Core 1.0
Windows 8
Windows Phone 8.1
Xamarin.Android
Xamarin.iOS
Xamarin.iOS
I don't know how to get this working ?
2) Secondly the work around I use is to create the client with SlSvcUtil.exe
Add the generated code to my PCL along with a reference to System.ServiceModel and everything builds ok. The problem is that when I run the code it flags up type reference errors ! Should I be manually adding the reference to System.ServiceModel anyway? What am I doing wrong in this scenario? Am I missing some steps?
I've checked the Xamarin docs but it seems that I can't find detailed instructions on this.
Please help me out ! Thanks:)
PCL and WCF should be supported. Alternatively, you could get this to work manually with HttpClient, etc. But maybe if you can use the shared project instead of PCL, that would be easier. Otherwise you'd have to also use DependencyService, create interfaces, etc. for each platform.
I get "Unable to add reference" when I try to add my PCL as reference. The projects are in the same solution. The error message doesn't say anything more.
When I try to add the .dll via Browse... I get the an error telling me that I can not add a PCL targeted at .NET Framework to a project targeting .NETCore.
What's wrong?
It sounds like the library you think is a PCL is not actually a Portable Class Library. It's just a .NET Framework library.
Try creating a new PCL and referencing that. See this MSDN page for information on how to create a PCL.
The error is that your PCL is targeted at .NET Framework and not .NETCore. .NETCore does only contain a subset of .NET Framework.
To solve this, replace your PCL project with a Class Library (Portable for Universal Apps).
for some reason I am getting an error "cannot read config file" when trying to set the SetExpressCheckout, I have copied across the web config settings, but for some reason I cannot read them, the error isn't very helpful other than what I have mentioned.
I am using mvc4, and to be honest I have had a problem reading the web.config in the past..
any suggestions would be much appreciated.
Just looked at this... thought it might help someone. Looked at the Inner Exception, saw it was looking for the Log4Net dll... so I gave it to the app and hey ho. It worked.
I had a similar problem and ended up getting both the core and merchant sdk source from GitHub. Change the SpecificVersion=True to False for the log4net reference in the core sdk and re-build it. I also re-targeted both for .net 4.0 so I re-built the merchant sdk with a reference to the new core sdk. Import both of these new dll's to your main project and you should be good to go. I had to change the config in 1 place for the section handler.
<section name="paypal" type="PayPal.Manager.SDKConfigHandler, PayPalCoreSDK"/>
since the Assembly name does not have the underscores if built from source (vs downloaded or added via NuGet).
A bit of explanation:
I was already using log4net version 1.11 before adding the sdk. The sdk was looking specifically for version 1.10. these 2 versions have a different public key, so 'simple' binding redirection won't work. If you have a reference to a different version of log4net (for example using ninject logging extensions requires min version 2.11 so these 2 ninject and the paypal sdk, are incompatible off the shelf).
so the root of the problem was actually caused by the dll version issues but manifested as a Configuration exception. check the inner exceptions and see what you get.
ok, just a quick update, I think it must be something to do with MVC, I have created a new empty asp project, copied the sdk config details across, created the same function call as I have in my mvc code, and called it from a simple asp button... and it works ??
does anyone have any ideas why I am getting an error in an mvc4 project, and not in a simple asp project ??
any help or ideas would be much appreciated.
If anyone starts developing Windows 8 metro applications using MVVM Light please help me to create a Windows 8 (WinRT) project template. I get bored by using Microsoft ‘s Layoutaware page(Base class). I just need to structure the class with the help of MVVM Light. If any one did this please help me or provide some links to start developing Windows 8 Metro application using MVVM Light.
The major areas where i am facing issues are:
Navigation (Forward and Backward)
State Handling (Tombstoning in windows 8)
Navigation after the app launches form termination state etc.
Handling WebService [ Post using http client ]
There is an (older) example of using MVVM Light with windows 8 found here. There are also templates and Samples as part of the MVVM Light source found here.
Edit:
Here is an msdn example using MVVM Light.
What about this
But I did not try it. I'm using Portable class library (with targets Windows 8.1 and .NET x.xx) and this library is referenced to WinRT project. MvvmLight for PCL you can find on this link
Problem is, that you can't access Local files and Local settings but you can inject it from Presentation project to Portable class library at the start.
This solution has a lot of advantages and one of the is : easiest unit testing.
For more info look this stack overflow thread