Replies: 4 comments 5 replies
-
My first question would be, what I can do to investigate this any further. Can it be a concurrency issue? Is there another way to process the file instead of starting a |
Beta Was this translation helpful? Give feedback.
-
Converting to discussion for now, it's unlikely a cefsharp bug. A new issue can be opened if code changes are required. |
Beta Was this translation helpful? Give feedback.
-
As the error occured only to non-technical users the response hasn't been checked in devtools. I didn't find anything related in the forum. I increased the log level to verbose. E.g. the error occured today at 11:37:35 am. You find the log file attached cef-debug.log. There's also a warning logged (although this warning also appears when opening documents without any issues):
I implemented the request handling logic as suggested but the issue remains: public IResourceHandler Create(IBrowser browser, IFrame frame, string schemeName, IRequest request)
{
if (schemeName != this.SchemeName)
{
string message = $"Invalid scheme '{schemeName}' in URL '{request.Url}'.";
Log.Error(message);
return ResourceHandler.ForErrorMessage(message, HttpStatusCode.BadRequest);
}
string file = ResolveFilePath(request);
if (!File.Exists(file))
{
string message = $"File '{file}' doesn't exist.";
Log.Warn(message);
return ResourceHandler.ForErrorMessage(message, HttpStatusCode.NotFound);
}
Log.Debug("Open stream ...");
var stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read);
var extension = Path.GetExtension(file);
var mimeType = CefSharp.Cef.GetMimeType(extension);
Log.Debug("File processed. Returning resource handler.");
return ResourceHandler.FromStream(stream, mimeType, autoDisposeStream: true);
} The logs at the corresponding time show that the file is processed properly and the last statement There maybe an issue loading the file from the SMB share. But then I would expect that EDIT: I wonder how to find the root cause of this issue. Is there a way to open devtools when the issue shows up (although this maybe too late)? Is there another way to monitor the process when CEF loads and displays the file? |
Beta Was this translation helpful? Give feedback.
-
Thanks for your help, I'll give the local caching a try.
My account is disabled. It tells me to contact a board administrator. But I didn't find a contact form or anything. It seems, without being logged in it's not possible to get in touch with an admin. My username is sugar76. May you have an idea what to do? |
Beta Was this translation helpful? Give feedback.
-
Is there an existing issue for this?
CefSharp Version
124.3.50
Operating System
Windows 11
Architecture
x64
.Net Version
.Net 4.8
Implementation
WPF
Reproduction Steps
This happens only sometimes. I do not see any way to reproduce it.
Expected behavior
Browser displays PDF file's content.
Actual behavior
Browser shows a gray screen instead of file content.
E.g. this happened at 2024-05-21 16:37:32. But the cef-debug.log doesn't show any error except from some issue regarding an extension. I don't think this extension log message has anything to do with the issue described above as it is logged everytime you open a PDF file.
cef-debug.log
Regression?
This also happend with version 123.0.60, but never with 106.0.260.
Known Workarounds
No response
Does this problem also occur in the CEF Sample Application
No.
Other information
We're using CefSharp in a WPF
TabControl
to display PDF files which are located on a SMB share.The files are processed using a
ResourceHandler
implementation (see below).As this issue occurs only sometimes it may be some concurrency issue.
Beta Was this translation helpful? Give feedback.
All reactions