It seems the problem lies in the PDFViewer component (it should be a COM exception).
Are you sure the target platform is the same in Debug and Release? I have checked for a similar error when dealing with a PdfViewer (or alike) class, and I found this article, stating that using the approach described in the article works only if the platform is x86, since the pdf viewer component cannot work in x64 (which is equivalent to AnyCPU on an x64 system).
Are you sure the target platform is the same in Debug and Release? I have checked for a similar error when dealing with a PdfViewer (or alike) class, and I found this article, stating that using the approach described in the article works only if the platform is x86, since the pdf viewer component cannot work in x64 (which is equivalent to AnyCPU on an x64 system).