Sicos1977 / ChromiumHtmlToPdf

Convert HTML to PDF with a Chromium based browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chrome 111: System.NullReferenceException: Object reference not set to an instance of an object.

nicolasr75 opened this issue · comments

Just for the records if other people experience this:

We had version 2.0.0 running very stable for about two years on a server and yesterday suddenly ChromeHtmlToPdf stopped working. The exception is this:

2023-03-09T10:42:05.472 - Connecting to dev protocol on uri 'ws://127.0.0.1:50538/devtools/browser/878b8b82-c980-4ef7-9ffe-5a05b8b170df'
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at ChromeHtmlToPdfLib.Connection.WebSocketOnError(Object sender, ErrorEventArgs e)
   at WebSocket4Net.WebSocket.OnError(ErrorEventArgs e)
   at WebSocket4Net.WebSocket.OnError(Exception e)
   at WebSocket4Net.WebSocket.FireError(Exception error)
   at WebSocket4Net.Command.Handshake.ExecuteCommand(WebSocket session, WebSocketCommandInfo commandInfo)
   at WebSocket4Net.WebSocket.OnDataReceived(Byte[] data, Int32 offset, Int32 length)
   at WebSocket4Net.WebSocket.client_DataReceived(Object sender, DataEventArgs e)
...

It turned out that Chrome automatically updated to version 111 yesterday which seems to cause this error.
Updating ChromeHtmlToPdf to 2.6.7 fixed the issue.

I thought I'd report this here but of course this issue can be closed!

commented

Thanks for letting people know. I think it is an issue with WebSocket4Net but that is removed and replaced with websockets that are standerd in .net itself.