我从以下代码中得到异常,特别是“Newtonsoft.dll”的13.0.1版本。但是,如果我用较低版本降级newtonsoft.dll,我不会得到错误消息。我担心的是newtonsoft的12.0.2版本易受攻击。(如果我使用newtonsoft.dll的12.0.2版本扫描我的应用程序,我从CodeQL扫描中得到漏洞异常)
有什么想法应该解决这个问题吗?
using (WebClient webClient = new WebClient())
{
webClient.DownloadFile(webResource, zipFilePath); //Gettting error from this line
}
异常消息:-
System.Net.WebException: An exception occurred during a WebClient request. ---> System.IO.FileLoadException: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)
at System.Net.WebClient.GetWebResponse(WebRequest request)
at System.Net.WebClient.DownloadBits(WebRequest request, Stream writeStream, CompletionDelegate completionDelegate, AsyncOperation asyncOp)
at System.Net.WebClient.DownloadFile(Uri address, String fileName)
--- End of inner exception stack trace ---
at System.Net.WebClient.DownloadFile(Uri address, String fileName)
1条答案
按热度按时间ljsrvy3e1#
代码片段中没有涉及JSON反序列化,也没有Newtonsoft类的提示。您是如何得出这是原因的结论的?