portable-class-library

I'm getting 403 with HttpClient on Portable Class Library

爷,独闯天下 提交于 2019-12-01 04:57:05
I have a PCL, WP and WinStore projects. In the PCL project I have a class with this method: private async Task<string> GetIpAddress() { const string url = "http://www.ip-adress.com/"; const string buscar = "<h3>Your IP address is:"; var client = new HttpClient(); var data = await client.GetStringAsync(url); if (data.IndexOf(buscar, StringComparison.Ordinal) <= -1) return; var IpAddress = data.Remove(0, data.IndexOf(buscar, StringComparison.Ordinal) + buscar.Length + 1); IpAddress = IpAddress.Remove(IpAddress.IndexOf("</h3>", StringComparison.Ordinal)); return IpAddress; } When I invoke the

MissingMethodException with Newtonsoft.Json when using TypeNameAssemblyFormat with PCLs

删除回忆录丶 提交于 2019-12-01 03:25:54
Is there a problem with using the TypeNameAssemblyFormat with PCLs? I have no problems using any other settings with Newtonsoft.Json except when I use this serialization setting. Here is my Json-related code: var settings = new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.Objects, Formatting = Formatting.Indented, TypeNameAssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Full }; var json = JsonConvert.SerializeObject(obj, settings); var jsonBytes = Encoding.UTF8.GetBytes(json); return jsonBytes; When I make the call within the same library where

Exception while loading assemblies Xamarin.Android.Support.v4

痞子三分冷 提交于 2019-12-01 03:07:47
I am working on visual studio with Xamarin.Forms , I get the following Error: Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'Xamarin.Android.Support.v4, Version=1.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile? File name: 'Xamarin.Android.Support.v4.dll' at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters) at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection`1 assemblies, AssemblyDefinition assembly,

Generate SHA1 Hash in Portable Class Library

蓝咒 提交于 2019-12-01 02:36:59
I'm trying to build a portable class library that generates OAuth urls for other classes/applications to use. This class library using OAuth has to be a portable class library so it can work with different versions of a DropBox API I'm building. Part of this class needs to generate an SHA1 hash to generate the oauth_signature with. I'm aware that portable class library doesn't support System.Security.Cryptography, so is there anyway that this class can generate an SHA1 hash without that class? Mono provides a managed implementation of SHA1 for it's own mscorlib.dll (but it's not located in

Could not install package MvvmCross.PortableSupport 3.2.1 at Visual Studio 2013 for PCL Profile 158

限于喜欢 提交于 2019-12-01 02:06:10
问题 I have the following setup and still couldn't add mvmcross libraries to my project: VS2013 Update 3 Nuget Package Manager 2.8.50313.46 PCL Profile 158 (I also tried other like 78, etc) Install log is below: Attempting to resolve dependency 'MvvmCross.HotTuna.StarterPack (≥ 3.2.1)'. Attempting to resolve dependency 'MvvmCross.HotTuna.MvvmCrossLibraries (≥ 3.2.1)'. Attempting to resolve dependency 'MvvmCross.HotTuna.CrossCore (≥ 3.2.1)'. Attempting to resolve dependency 'MvvmCross

I'm getting 403 with HttpClient on Portable Class Library

▼魔方 西西 提交于 2019-12-01 01:14:20
问题 I have a PCL, WP and WinStore projects. In the PCL project I have a class with this method: private async Task<string> GetIpAddress() { const string url = "http://www.ip-adress.com/"; const string buscar = "<h3>Your IP address is:"; var client = new HttpClient(); var data = await client.GetStringAsync(url); if (data.IndexOf(buscar, StringComparison.Ordinal) <= -1) return; var IpAddress = data.Remove(0, data.IndexOf(buscar, StringComparison.Ordinal) + buscar.Length + 1); IpAddress = IpAddress

Cannot use await in Portable Class Library for Win 8 and Win Phone 8

喜欢而已 提交于 2019-12-01 00:35:16
问题 I'm attempting to create a Portable Class Library in Visual Studio 2012 to be used for a Windows 8 Store app and a Windows Phone 8 app. I'm getting the following error: 'await' requires that the type 'Windows.Foundation.IAsyncOperation' have a suitable GetAwaiter method. Are you missing a using directive for 'System'? At this line of code: StorageFolder guidesInstallFolder = await Package.Current.InstalledLocation.GetFolderAsync(guidesFolder); My Portable Class Library is targeted at .NET

Portable Class Library ICommand compilation error in WPF — Not sure how to resolve this appropriately?

北城余情 提交于 2019-11-30 21:29:38
Some background information: I am using VS 2013 I created a Portable Class Library (Targets: .NET 4.5/Silverlight 5/Win Phone 8/Win Store 8) I implemented the ICommand interface in my class named MyCommand . MyCommand.cs: public class MyCommand : ICommand { public bool CanExecute(object parameter) { throw new NotImplementedException(); } public void Execute(object parameter) { throw new NotImplementedException(); } public event EventHandler CanExecuteChanged; } I found that when I attempted to reference use the MyCommand class in a WPF 4.5 application, I get the following error: The type

Task.WaitAll not waiting on other async methods

♀尐吖头ヾ 提交于 2019-11-30 18:19:13
问题 I'm asynchronously retrieving some rss articles with my Portable Class Library that uses the Microsoft.Bcl library (which doesn't have Task.WhenAll). Each article has a url to rss comments that I need to asynchronously retrieve as well. The code below is my library. I call GetArticles() but it does not return any of the which creates a list of tasks that call GetComments() to asynchronously get the comments. I've tried using Task.WaitAll in GetArticles to wait for the comments but it does not

Xamarin Studio Mac, Portable class library, Async and Android

与世无争的帅哥 提交于 2019-11-30 16:39:41
Edit: On the Alpha Channel Profile7, Profile49 and Profile78 seem to work. I'm working with the setup that was described here: Getting PCL, Mvvmcross, Nuget and Xamarin Studio to play "nice" on Mac . How do you make a PCL in Xamarin Studio with Async support work. I'm usually using Profile104 which is TargetFrameworkVersion v4.0 I tried the following combinations of the hree different v4.5 profiles Profile7, Profile49, Profile78 with the different versions of Xamarin Studio: Profile7 Profile 49 Profile 78 Alpha (4.1.10, mono=3.2.2) 1 1 1 Beta (4.0.12, mono=3.2.1) 2 2 2 Stable (4.0.12, mono=3.2