portable-class-library

HttpClient failing

我怕爱的太早我们不能终老 提交于 2019-12-13 06:50:31
问题 When I run my app on the emulator for iOS it works fine. When I run it on a device the first call to HttpClient fails. My class containing the HttpClient calls is in a PCL. It looks like an instance of this bug. However, the documented workarounds of adding the following to your iOS project app.config does not work for me (the system.net.http addition); <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> ...... <dependentAssembly> <assemblyIdentity name=

Unable to generate Fakes for an assembly referencing a portable class library

谁说我不能喝 提交于 2019-12-12 21:14:36
问题 I am unable to generate the Microsoft Fakes assembly for a class library (.NET 4.5) when said class library references a PCL (Portable Class Library) targetting .Net 4.5 and Silverlight 5 under Visual Studio 2013. This only occurs if the class library (.NET 4.5): Declares a type deriving from a type which can both be found in System.dll v4.0.0.0 and v2.0.5.0 Declares another type deriving from one declared in the PCL library, which in turn derives from a type declared in System.dll v.2.0.5.0

Splat [0.3.4] on Xamarin.iOS: issues with RectangleF and PointF

耗尽温柔 提交于 2019-12-12 14:28:01
问题 I'm trying to embrace the new PCL fun on a Xamarin.iOS project in Xamarin Studio. I created a PCL "Core" library for my project and added Splat (v0.3.4) via NuGet. Then, in a consuming iOS project, I reference my core library. Once I do that, a couple compile errors show up. One of these: Error CS0012: The type `System.Drawing.PointF' is defined in an assembly that is not referenced. Consider adding a reference to assembly `Splat.Portable, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null

Xamarin Forms and EntityFramework Attributes compatibility

南楼画角 提交于 2019-12-12 12:07:19
问题 I have a client/server solution using C# , WPF , ASP.NET WebAPI and Entity Framework . Client and server clases share the model among his projects. Now I am trying to create a new client, using Xamarin Forms and sharing the model to, but Entity Framework attributes ( MaxLength , Index , NotMapped , etc), are not compatible in a PCL . So this are the things that I've tried: Import Microsoft.EntityFrameworkCore to the PCL Model As described here, you should be able to use entity framework with

Equivalent for System.Diagnostics.Trace in PCL library

我是研究僧i 提交于 2019-12-12 10:46:59
问题 I was surprised to learn that System.Diagnostics.Trace is not included in the Portable Class Library profiles. System.Diagnostics.Debug is available though. I'm porting a library to a PCL and have typically used Trace statements to provide additional troubleshooting to consumers. For performance reasons, I want the assembly optimized so I only ship Release versions of the assembly in my NuGet package. My understanding is that the methods for System.Diagnostics.Debug are conditionally compiled

PCLStorage in Windows Phone 8

为君一笑 提交于 2019-12-12 10:12:46
问题 I'm using PCLStorage for a Win8/Wp8 project I'm working on. I'm using it within a PCL itself, and have it referenced in my Win8, Wp8 and PCL projects. Everything is working great in Win8. In Wp8 however, once I hit my PCL for storage which uses PCLStorage, I'm getting a NotImpmlementedException when I call FileSystem.Current; "This functionality is not implemented in the portable version of this assembly. You should reference the PCLStorage NuGet package from your main application project in

Xamarin Forms PCL - clean and easy way for a webrequest?

最后都变了- 提交于 2019-12-12 09:46:53
问题 I am building an Android/iOS xamarin forms app with a portable class library. I am looking for the best way to do this example inside the PCL project: https://msdn.microsoft.com/en-us/library/456dfw4f(v=vs.110).aspx using System; using System.IO; using System.Net; using System.Text; namespace Examples.System.Net { public class WebRequestGetExample { public static void Main () { // Create a request for the URL. WebRequest request = WebRequest.Create ( "http://www.contoso.com/default.html"); //

Xamrin.Forms Entry Cell How to change font size for Placeholder

為{幸葍}努か 提交于 2019-12-12 09:10:54
问题 I am thinking if i can change font size for placeholder on EntryCell without change fontSize for Text on EntryCell ? Is There away to change font size for Placeholder without change font size for Text Code = new EntryCell { Label = "Code:*", Text = "", Keyboard = Keyboard.Default, Placeholder = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }; 回答1: Here is a custom renderer for android. Here I'm modifying the HintTextColor(placeholder). You can modify the font in a similar way. using System; using

Produce a .NET 4.0 library from a PCL Project where code is identical

人走茶凉 提交于 2019-12-12 08:58:59
问题 It's quite frustrating, I have a Portable Class Library (PCL) library that had to drop .NET 4.0 in the profile to have access to the right API's "in PCL land". However, these API's do exist in .NET 4.0, such that if the exact same code is in a .NET 4.0 project it compiles just fine. I want a minimal ongoing maintenance way to recompile the code in this PCL project to .net 4.0 so I can include it in a Nuget package. 回答1: With minimal conditional adjustments to the .csproj , an msbuild project

How to preserve headers in the Flurl HttpClient

自古美人都是妖i 提交于 2019-12-12 04:56:52
问题 I'm using the Furl.Http wrapper over the .NET Http Client. With each request my API requires a User-Agent and an Authorization header to be sent. I would like to set that up once, rather than having to state that every time. What I thought I would be able to do is create an instance of the FlurlClient and set the headers on it, then ResetToRoot before each request, as illustrated in this sample piece of code: var fc = new FlurlClient(); fc.WithHeader("User-Agent", "Keep/1.0"); var tokenModel