Bug 56961 - System.MissingFieldException: Field 'System.Net.HttpWebRequest.ResendContentFactory' not found.
Summary: System.MissingFieldException: Field 'System.Net.HttpWebRequest.ResendContentF...
Status: CONFIRMED
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools (show other bugs)
Version: XI 10.12 (d15-3)
Hardware: All All
: --- normal
Target Milestone: Future Cycle (TBD)
Assignee: Martin Baulig
URL:
Depends on:
Blocks:
 
Reported: 2017-05-30 14:30 UTC by smorsi27
Modified: 2017-11-09 17:34 UTC (History)
6 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 56961 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
CONFIRMED

Description smorsi27 2017-05-30 14:30:54 UTC
I noticed this issue happen both on my Mac OSX and Windows machine (via VM). 

When I compile my solution and I try to login to my iOS application on my iOS simulator, it get this error message: 

2017-05-30 10:18:39.248 ProjectiOS[12320:249066] System.AggregateException: One or more errors occurred. ---> System.MissingFieldException: Field 'System.Net.HttpWebRequest.ResendContentFactory' not found.
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].Start[TStateMachine] (TStateMachine& stateMachine) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.36/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:471 
  at System.Net.Http.HttpClientHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00033] in <cc3195cffe3c4c5ca64f6aa1f48aa0bb>:0 
  at System.Net.Http.HttpMessageInvoker.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00000] in <cc3195cffe3c4c5ca64f6aa1f48aa0bb>:0 
  at System.Net.Http.HttpClient.<>n__0 (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationTo
ken cancellationToken) [0x00000] in <cc3195cffe3c4c5ca64f6aa1f48aa0bb>:0 
  at System.Net.Http.HttpClient+<SendAsyncWorker>d__48.MoveNext () [0x0005c] in <cc3195cffe3c4c5ca64f6aa1f48aa0bb>:0 
   --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.36/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:2157 
  at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.36/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:3189 
  at System.Threading.Tasks.Task.Wait () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.36/src/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/Task.cs:3054 
  at Mobile.ClientServices.Login[T] (System.String 
url) [0x00053] in C:\Projects\AppiOS\Project.iOS\Mobile\ClientServices.cs:376 
---> (Inner Exception #0) System.MissingFieldException: Field 'System.Net.HttpWebRequest.ResendContentFactory' not found.
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].Start[TStateMachine] (TStateMachine& stateMachine) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.10.0.36/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:471 
  at System.Net.Http.HttpClientHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00033] in <cc3195cffe3c4c5ca64f6aa1f48aa0bb>:0 
  at System.Net.Http.HttpMessageInvoker.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00000] in <cc3195cffe3c4c5ca64f6aa1f48aa0bb>:0 
  at System.Net.Http.HttpClient.<>n__0 (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken
 cancellationToken) [0x00000] in <cc3195cffe3c4c5ca64f6aa1f48aa0bb>:0 


So then login fails for my app. I noticed this issue only happen after I installed the latest Xamarin version. Before then, I was able to login my app just fine and my coworkers said it works fine for them (they can login and they are not using the latest Xamarin version). 

So it's not an api issue. 

I was able to solve the issue temporarily on my mac (using Xamarin Studio) by deleting Mono.Security.dll as suggested by someone on github (can't find the url at the moment). I'm currently trying to launch my app and login on my Windows VM now using VS2017 and launching the iOS simulator on my mac and I'm running into the same issue again. I tried to delete the Mono.Security.dll again but it doesnt' work anymore. 

Basically, I can't login my application because of the error above.
Comment 1 smorsi27 2017-05-30 14:33:15 UTC
It did mention a possibly error at ClientService at line 376 and Here's the method at those lines: 

public static T Login<T>(string url) where T : new(){
			try {
				using(HttpClient httpClient = new HttpClient ()){
					httpClient.DefaultRequestHeaders.Accept.Clear();
					httpClient.DefaultRequestHeaders.Accept.Add (MediaTypeWithQualityHeaderValue.Parse ("application/json"));
					httpClient.DefaultRequestHeaders.Clear();
					Task<HttpResponseMessage> taskResponse = httpClient.PostAsync(url, new StringContent(""));
					taskResponse.Wait();
					if (taskResponse.Result.IsSuccessStatusCode) {
						Task<string> taskResult = taskResponse.Result.Content.ReadAsStringAsync ();
						taskResult.Wait(); //line 376 error
						return JSONToObject<T>(taskResult.Result);
					}
				}
			} 
			catch(Exception e){
				Console.WriteLine (e);
			}
			return new T();
		}
Comment 3 Rodrigo Kumpera 2017-05-30 17:03:44 UTC
This looks like a linker issue, reassigning.
Comment 4 smorsi27 2017-06-02 09:35:27 UTC
Anyone looking into it?
Comment 5 Manuel de la Peña [MSFT] 2017-06-05 15:47:33 UTC
@smorsi yes, i'm looking into an app that reproduces the issue to later use it to test it. Will keep the bug as new until it is reproducible.
Comment 6 smorsi27 2017-06-06 12:50:10 UTC
Manuel, so there's a github repo issue that is similar the the issue I'm facing. It looks like it's occuring to other users as well. 

It seems every time when the Mono.Security.dll is regenerated (after I deleted it), I can't login into my app again and the issue persists. This is definitely a blocker and it seems to have only happened on the latest version of Xamarin I upgraded to. The previous version was working fine. 

Here's the github ticket: https://github.com/edjCase/JsonRpc/issues/28

Not sure if this would help you or not.
Comment 7 Manuel de la Peña [MSFT] 2017-06-06 15:59:42 UTC
Will add @baulig in /cc since he is the expert in this area.
Comment 8 Manuel de la Peña [MSFT] 2017-06-07 09:51:16 UTC
@smorsi I talked with @baulig he will take a look and we will get back to you.
Comment 9 smorsi27 2017-06-14 16:30:08 UTC
Status update? This is a blocker for us. Thanks!
Comment 10 Manuel de la Peña [MSFT] 2017-09-11 15:17:20 UTC
@baulig have you taken a look at this bug?
Comment 11 Manuel de la Peña [MSFT] 2017-09-18 11:35:58 UTC
@smorsi I'm going to look if that field was present or was removed by accident. Once we have that info, we can ping the bel team to deal with it (I'm a Xamarin.iOS eng myself).
Comment 12 smorsi27 2017-11-08 17:02:35 UTC
Any update on this issue? Seems to still occur in latest version of Xamarin: 

Xamarin.iOS
Version: 11.2.1.0 (Visual Studio Community)