ILSpy
ILSpy copied to clipboard
dynamic JObject() not decompile correctly
public unsafe static async Task<string> CreateJiraIssue(int projectId, string issueSubj, string body, TicketBasicInfo ticket, int issueTypeId)
{
string text = string.Format(JiraUrl + "/rest/api/2/issue");
dynamic val = new JObject();
val.fields = new JObject();
val.fields.summary = issueSubj;
val.fields.description = body + "\n\r" + TicketUtils.GetIssueUrl(ticket.TicketID, ticket.InstanceID);
val.fields.issuetype = new JObject();
val.fields.issuetype.id = issueTypeId;
val.fields.project = new JObject();
val.fields.project.id = projectId;
using (WebClient wc = new WebClient())
{
wc.SetBasicAuthCredentials(Username,Password);
wc.Encoding = Encoding.UTF8;
wc.Headers[HttpRequestHeader.ContentType] = "application/json";
if (_003C_003Eo__0._003C_003Ep__17 == null)
{
_003C_003Eo__0._003C_003Ep__17 = CallSite<Func<CallSite, object, string>>.Create(Binder.Convert(CSharpBinderFlags.None, typeof(string), typeof(Jira)));
}
Func<CallSite, object, string> target = _003C_003Eo__0._003C_003Ep__17.Target;
CallSite<Func<CallSite, object, string>> _003C_003Ep__ = _003C_003Eo__0._003C_003Ep__17;
dynamic val2 = wc.UploadStringTaskAsync(text, "POST", val.ToString()).GetAwaiter();
if (!(bool)val2.IsCompleted)
{
ICriticalNotifyCompletion awaiter = val2 as ICriticalNotifyCompletion;
AsyncTaskMethodBuilder<string> asyncTaskMethodBuilder = default(AsyncTaskMethodBuilder<string>);
if (awaiter == null)
{
INotifyCompletion awaiter2 = (INotifyCompletion)val2;
asyncTaskMethodBuilder.AwaitOnCompleted(ref awaiter2, ref *(_003CCreateJiraIssue_003Ed__0*)/*Error near IL_07b2: stateMachine*/);
}
else
{
asyncTaskMethodBuilder.AwaitUnsafeOnCompleted(ref awaiter, ref *(_003CCreateJiraIssue_003Ed__0*)/*Error near IL_07c5: stateMachine*/);
}
/*Error near IL_07ce: leave MoveNext - await not detected correctly*/;
}
object arg = val2.GetResult();
dynamic val3 = JsonConvert.DeserializeObject(target(_003C_003Ep__, arg));
string str = val3.key;
string text2 = JiraUrl + "/browse/" + str;
return text2;
}
}
And I found the code using:
using Microsoft.CSharp.RuntimeBinder; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Net; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks;
what's missing from my setting?
(possible) duplicate of #1388