我有一个WinForms应用程序,它将运行数小时。间歇运行3-4小时后,它开始崩溃。它使用CefSharp。事件日志显示错误与CEFSharp有关,但我无法再进一步了。任何帮助将不胜感激
Machine: Windows 7 Sp1
VC++ runtime installed
.NET framework 4.7
The crash dump shows below information:
Exception: the thread tried to read from or write to a virtual
address for which it does not have the appropriate access.
Tried debugging crash dump, but not useful
下面的事件日志:
- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
<Provider Name=".NET Runtime" />
<EventID Qualifiers="0">1026</EventID>
<Level>2</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2019-05-31T14:38:54.000000000Z" />
<EventRecordID>920</EventRecordID>
<Channel>Application</Channel>
<Security />
</System>
- <EventData>
<Data>Application: Client.exe Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled
exception. Exception Info: System.AccessViolationException at
CefSharp.Internals.MCefRefPtr<CefPostData>.op_Assign(CefPostData*) at
CefSharp.Internals.CefPostDataWrapper.~CefPostDataWrapper() at
CefSharp.Internals.CefPostDataWrapper.Dispose(Boolean) at
CefSharp.Internals.CefPostDataWrapper.Dispose() at
Client.AsmxRequestHandler+
ProcessRequestAsync(IRequest请求,ICallback回调){ m_callback =回调;
Task.Run(() =>
{
using (callback)
{
try
{
using (var postData = request.PostData)
{
if (postData.Elements != null)
{
var elements = postData.Elements;
var charSet = request.GetCharSet();
var element = elements[0];
var elementBodyString = string.Empty;
foreach (var elemt in elements)
{
if (element.Type == PostDataElementType.Bytes)
{
elementBodyString += elemt.GetBody(charSet);
}
}
if (element.Type == PostDataElementType.Bytes)
{
XmlSerializer mySerializerObj = new XmlSerializer(typeof(AsmxWrapperClasses.Envelope));
var mySoapRequest = (AsmxWrapperClasses.Envelope)mySerializerObj.Deserialize(GenerateStreamFromString(elementBodyString));
var requestBody = mySoapRequest.Body;
try
{
var myResult = ProcessRequestBody(requestBody);
var stream = GenerateStreamFromString(myResult);
stream.Position = 0;
ResponseLength = stream.Length;
MimeType = MimeTypeMap.GetMimeType(Path.GetExtension(".asmx"));
StatusCode = (int)HttpStatusCode.OK;
Stream = stream;
callback.Continue();
}
catch (ArgumentException ex)
{
if (ex.Message == "requestBody invalid")
throw new Exception(elementBodyString);
throw;
}
}
}
}
}
catch (Exception ex)
{
Debug.WriteLine(ex);
CLogger.GetInstance().LogError(ex.Message);
}
}
});
return true;
}
答案 0 :(得分:1)
我遇到了同样的问题。
看来问题是您处理了PostData
using (var postData = request.PostData)
如果删除该行,该问题似乎已解决。