PDF Express is crashing Chrome and Edge in development but not in prod

I have a reproducible crash in chrome and edge in development when I initialize WebViewer. It doesn’t happen in production however only in my development env.

onecore\net\netprofiles\service\src\nsp\dll\namespaceserviceprovider.cpp(550)\nlansp_c.dll!00007FFF7AB7C759: (caller: 00007FFFAFB8388E) LogHr(2) tid(2c20) 8007277C No such service is known. The service cannot be found in the specified name space.
Exception thrown: ‘System.OperationCanceledException’ in System.Private.CoreLib.dll
Exception thrown: ‘System.Net.Sockets.SocketException’ in System.Private.CoreLib.dll
The program ‘’ has exited with code 4294967295 (0xffffffff).
The thread 0x0 has exited with code 0 (0x0).
The program ‘localhost:5001’ has exited with code 4294967295 (0xffffffff).
Exception thrown: ‘System.OperationCanceledException’ in System.Private.CoreLib.dll
The program ‘[14772] XYZ.Server.exe’ has exited with code 0 (0x0).

Since it’s only in dev I know it isn’t PDFjs.Express (free license) causing the crash. Is there a way to run the library with heightened debugging info so I can see what is crashing it?

Thanks

Grasping at straws

The init call is here:

function initWebViewer(viewer) {
const elementName = viewer + “Viewer”;
const viewerElement = document.getElementById(elementName);
try {
WebViewer({
path: ‘lib’,
initialDoc: ‘/files/Blank.pdf’,
licenseKey: ‘BobsYourUncle’
}, viewerElement).then((instance) => {
const { documentViewer, annotationManager } = instance.Core;
instance.UI.setTheme(‘dark’);
})
}
catch (ex) {
alert("Error: ");
}
}

Hi there,

Thank you for reaching pdf.js express forums,

We are not aware of any heightened debugging for the pdf.js library.

It looks like your WebViewer code looks fine, can you share any console error messages /screenshots you get when you attempt to initialize in development mode?

Best regards,
Kevin Kim

Hey Kevin,

That is the blockquoted part in the first message. It looks like it’s looking for a namespace.

Craig

Hi Craig,

Are you using 8.7 of pdf.js express?

If not, could you please try with a fresh install https://pdfjs.express/download

Best regards,
Kevin Kim

New install. Nope:

info: System.Net.Http.HttpClient.BlazorHero.API.ClientHandler[101]
Received HTTP response headers after 303ms - 200
info: System.Net.Http.HttpClient.BlazorHero.API.LogicalHandler[101]
End processing HTTP request after 306.6ms - 200
onecore\net\netprofiles\service\src\nsp\dll\namespaceserviceprovider.cpp(550)\nlansp_c.dll!00007FFF7AB7C759: (caller: 00007FFFAFB8388E) LogHr(2) tid(7f48) 8007277C No such service is known. The service cannot be found in the specified name space.
Exception thrown: ‘System.Net.Sockets.SocketException’ in System.Private.CoreLib.dll
Exception thrown: ‘System.Net.Sockets.SocketException’ in System.Private.CoreLib.dll
Exception thrown: ‘System.Net.Sockets.SocketException’ in System.Private.CoreLib.dll
Exception thrown: ‘System.Net.Sockets.SocketException’ in System.Private.CoreLib.dll
Exception thrown: ‘System.Net.Sockets.SocketException’ in System.Private.CoreLib.dll
The program ‘’ has exited with code 4294967295 (0xffffffff).
Exception thrown: ‘System.Net.Sockets.SocketException’ in System.Private.CoreLib.dll
The thread ‘Assistance On Call’ (0x0) has exited with code 0 (0x0).
The program ‘localhost:5001’ has exited with code 4294967295 (0xffffffff).
The program ‘[26712] AssistantOnCall.Server.exe’ has exited with code 0 (0x0).

OK some new info: When I run in Internet Explorer it doesn’t crash and gives this:

(index) Value
UI version ‘8.7.0’
Core version ‘8.7.0’
webviewer.min.js ‘8.7.0’
Build ‘Ny8yMC8yMDIyfDJhMWM5ZWYwOA==’
WebViewer Server false
Full API false
  1. Object

addCustomModal.js:98 ‘setCustomModal’ deprecated since version 8.5. Please use UI.addCustomModal instead

browserLink:21 GET http://localhost:50541/e4bd448…/browserLinkSignalR/…ationData.browserId&browserId=a827-6c07&clientProtocol=1.3&_=1679000893637 net::ERR_CONNECTION_REFUSED

PDFJSDocumentType.js:2585 PDFJS.express: Development environment detected. This license key is currently registered to mombo-desktop.com

pdf.worker.js:129 Warning: TT: undefined function: 32

browserLink:21 GET http://localhost:50541/e4bd448…/browserLinkSignalR/…ationData.browserId&browserId=961e-0bd7&clientProtocol=1.3&_=1679000898536 net::ERR_CONNECTION_REFUSED

I don’t think the two refused connections are related.

Craig

Hi Craig,

Thank you for your response,

Does this happen with any pdf file?
Is it specifically happening for chromium browsers?
Could you try disabling hardware acceleration (as it has been known to have issues with chromium browsers)

Could you please share a minimal runnable sample project to reproduce this issue?

Best regards,
Kevin Kim

Hey Kevin,

I did all you asked, still broken. Is anyone at PDF Express running Windows 11? Can they test and just get past the init() call? The error I’m getting is the same as this one

This would solve why it works in production (Windows 10) and not in Dev (Windows 11)

Could your code be calling GetHostByName()?

Let me know, thanks.

Craig

Hi Craig,

I looked for GetHostByName but it is not used in our code.

I checked on BrowserStack Windows 11 latest Chrome version with a local instance of running pdf.js express, and there seems to be no issues with initialization:

Best regards,
Kevin Kim

1 Like