Is .net SDK (IGWebApiClient) compatible with Mono?

2 posts / 0 new
Last post
redrett
Is .net SDK (IGWebApiClient) compatible with Mono?

I tried it on ubuntu 16.04 with mono 5.2.0.215.
When I run the following line
var response = await igRestApiClient.SecureAuthenticate(ar, apiKey);
I got the following exception.

ex.Source: mscorlib
ex.Message: One or more errors occurred.
ex.StackTrace: at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in <204f770036d441bb8dfd3daba3550e83>:0
at System.Threading.Tasks.Task`1[TResult].GetResultCore (System.Boolean waitCompletionNotification) [0x0002b] in <204f770036d441bb8dfd3daba3550e83>:0
at System.Threading.Tasks.Task`1[TResult].get_Result () [0x0000f] in <204f770036d441bb8dfd3daba3550e83>:0
at IGWebApiClient.IgRestService+<RestfulService>d__6`1[T].MoveNext () [0x00123] in <044c9f6ccd2647aeb7e8d7356fcf1d06>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <204f770036d441bb8dfd3daba3550e83>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <204f770036d441bb8dfd3daba3550e83>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <204f770036d441bb8dfd3daba3550e83>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <204f770036d441bb8dfd3daba3550e83>:0
at IGWebApiClient.IgRestApiClient+<fetchEncryptionKey>d__12.MoveNext () [0x0007d] in <044c9f6ccd2647aeb7e8d7356fcf1d06>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <204f770036d441bb8dfd3daba3550e83>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <204f770036d441bb8dfd3daba3550e83>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <204f770036d441bb8dfd3daba3550e83>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <204f770036d441bb8dfd3daba3550e83>:0
at IGWebApiClient.IgRestApiClient+<SecurePassword>d__10.MoveNext () [0x00074] in <044c9f6ccd2647aeb7e8d7356fcf1d06>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <204f770036d441bb8dfd3daba3550e83>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <204f770036d441bb8dfd3daba3550e83>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <204f770036d441bb8dfd3daba3550e83>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <204f770036d441bb8dfd3daba3550e83>:0
at IGWebApiClient.IgRestApiClient+<SecureAuthenticate>d__9.MoveNext () [0x0008d] in <044c9f6ccd2647aeb7e8d7356fcf1d06>:0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <204f770036d441bb8dfd3daba3550e83>:0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <204f770036d441bb8dfd3daba3550e83>:0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <204f770036d441bb8dfd3daba3550e83>:0
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <204f770036d441bb8dfd3daba3550e83>:0
at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <204f770036d441bb8dfd3daba3550e83>:0
at TestIG.Program+<Login>d__29.MoveNext () [0x000ba] in <d0520d88994f417391cb15c010c0d103>:0

ex.InnerException.Source: mscorlib
ex.InnerException.Message: Field 'System.Net.HttpWebRequest.ResendContentFactory' not found.
ex.InnerException.StackTrace: at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].Start[TStateMachine] (TStateMachine& stateMachine) [0x0002c] in <204f770036d441bb8dfd3daba3550e83>:0
at System.Net.Http.HttpClientHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00033] in <87f8b5c7f72e421da9517f7994c1c4a2>:0
at System.Net.Http.HttpMessageInvoker.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00000] in <87f8b5c7f72e421da9517f7994c1c4a2>:0
at System.Net.Http.HttpClient.<>n__0 (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00000] in <87f8b5c7f72e421da9517f7994c1c4a2>:0
at System.Net.Http.HttpClient+<SendAsyncWorker>d__47.MoveNext () [0x0005c] in <87f8b5c7f72e421da9517f7994c1c4a2>:0

The same code runs correctly on windows 10 with visual studio 2017

redrett
I figured this out by myself.

I figured this out by myself. It turned out the PCL library Microsoft.Net.Http doesn't work well with Mono.
I converted IGWebApiClient from portable to .net framewrok 4.6.2 target and don't reference to Microsoft.Net.Http. net framewrok 4.6.2 target project has referenced System.Net.Http by default and it works well with Mono.
PCLCrpto doesn't work either after converting to net framewrok 4.6.2 but I bypassed the password encryption. It seems working without password encryption.

Log in or register to post comments