使用AngleSharp v 0.9.9.0 this:
var siteUrl = "https://richmond.csod.com/ats/careersite/search.aspx?site=1&c=richmond";
var configuration = Configuration.Default.WithDefaultLoader().WithCookies();
var currentContext = BrowsingContext.New(configuration);
var originalDoc = currentContext.OpenAsync(siteUrl).Result;
Console.WriteLine(originalDoc.DocumentElement.OuterHtml);
工作正常。但是如果我升级到v 0.9.9.2就会抛出这个:
Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.FormatException: String was not recognized as a valid DateTime.
at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
at AngleSharp.Services.Default.MemoryCookieProvider.Sanatize(String cookie)
at AngleSharp.Services.Default.MemoryCookieProvider.SetCookie(String origin, String value)
at AngleSharp.Dom.Document.set_Cookie(String value)
at AngleSharp.Dom.Document.Setup(CreateDocumentOptions options)
at AngleSharp.Dom.Html.HtmlDocument.<LoadAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at AngleSharp.BrowsingContextExtensions.<OpenAsync>d__2.MoveNext()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at AngleSharpTest.Program.Main(String[] args) in C:\Users\matt.burland\source\repos\AngleSharpTest\AngleSharpTest\Program.cs:line 21
它似乎是从AngleSharp内部发生的,并且发生在几个不同的,完全不相关的网址上。 FWIW,我的文化设置为en-US
,我尝试过设置不变的文化,但这似乎也没有帮助。
还有其他人看过这个问题吗?有工作吗?