Using package on a Mac
Hi,
Managed to add to a .net Core 3.1 project and rendered fine on windows, switched to a Mac received this error:
{Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: An unexpected error occurred in Report Processing. ---> System.DllNotFoundException: Unable to load shared library 'kernel32.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(libkernel32.dll, 1): image not found}
When running the method:
public byte[] Render (string format, string deviceInfo, out string mimeType, out string encoding, out string fileNameExtension, out string[] streams, out Warning[] warnings);
I've seen this error with another reporting viewer library, I assume this is an underlying mac library (I'm not very familiar with Macs) that doesn't use kernel32.dll.
Is there a workaround for this or is this a dependancy rework issue.
System and Project details: macOS Catalina 10.15.6 Visual Studio Mac 8.7.6 Build 2 .net Core 3.1
Hi. Two weeks ago I've merged changes from LivingNaturally's fork, removing references to Win32-specific DLLs. Have you tried this version? If problem still occurs in most recent version, please check which native method is still called. It should be right at the top of innermost exception's stack trace.
Yeah, using the version including the LivingNaturally's fork.
Here is the innermost exception's stack trace.
I take it this one: at Microsoft.ReportingServices.Diagnostics.NativeMemoryMethods.LocalAlloc(Int32 uFlags, UIntPtr sizetdwBytes)
Here is the rest if it helps:
" at Microsoft.ReportingServices.Diagnostics.NativeMemoryMethods.LocalAlloc(Int32 uFlags, UIntPtr sizetdwBytes)\n at Microsoft.ReportingServices.Diagnostics.SafeLocalFree.LocalAlloc(Int32 flags, Int32 cb)\n at Microsoft.ReportingServices.Diagnostics.SafeLocalFree.LocalAlloc(Int32 cb)\n at Microsoft.ReportingServices.Diagnostics.SafeCryptoBlobIn..ctor(Byte[] data)\n at Microsoft.ReportingServices.Diagnostics.DataProtectionLocal.ProtectData(Byte[] data, Int32 dwFlags)\n at Microsoft.ReportingServices.Diagnostics.DataProtectionLocal.LocalProtectData(Byte[] data)\n at Microsoft.ReportingServices.Diagnostics.DataProtectionLocal.DataProtectionLocalInstance.ProtectData(String unprotectedData, String tag)\n at Microsoft.ReportingServices.DataExtensions.DataSourceInfo.SetOriginalConnectionString(String connectionString, IDataProtection dataProtection)\n at Microsoft.ReportingServices.DataExtensions.DataSourceInfo..ctor(String originalName, String extension, String connectionString, Boolean originalConnectStringExpressionBased, Boolean integratedSecurity, String prompt, IDataProtection dataProtection)\n at Microsoft.ReportingServices.ReportPublishing.ReportPublishing.ReadDataSource(DataSourceNameValidator dataSourceNames, PublishingContextStruct context, IDataProtection dataProtection)\n at Microsoft.ReportingServices.ReportPublishing.ReportPublishing.ReadDataSources(PublishingContextStruct context, IDataProtection dataProtection)\n at Microsoft.ReportingServices.ReportPublishing.ReportPublishing.ReadReport(IDataProtection dataProtection)\n at Microsoft.ReportingServices.ReportPublishing.ReportPublishing.Phase1(Stream definitionStream, String& description, String& language, DataSourceInfoCollection& dataSources, DataSetInfoCollection& sharedDataSetReferences, Boolean& hasExternalImages, Boolean& hasHyperlinks)\n at Microsoft.ReportingServices.ReportPublishing.ReportPublishing.InternalCreateIntermediateFormat(Stream definitionStream, String& description, String& language, ParameterInfoCollection& parameters, DataSourceInfoCollection& dataSources, DataSetInfoCollection& sharedDataSetReferences, UserLocationFlags& userReferenceLocation, ArrayList& dataSetsName, Boolean& hasExternalImages, Boolean& hasHyperlinks, Byte[]& dataSetsHash)\n at Microsoft.ReportingServices.ReportPublishing.ReportPublishing.CreateIntermediateFormat(Byte[] definition, String& description, String& language, ParameterInfoCollection& parameters, DataSourceInfoCollection& dataSources, DataSetInfoCollection& sharedDataSetReferences, UserLocationFlags& userReferenceLocation, ArrayList& dataSetsName, Boolean& hasExternalImages, Boolean& hasHyperlinks, Byte[]& dataSetsHash)\n at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CompileOdpReport(PublishingContext reportPublishingContext, PublishingErrorContext errorContext, String& reportDescription, String& reportLanguage, ParameterInfoCollection& parameters, DataSourceInfoCollection& dataSources, DataSetInfoCollection& sharedDataSetReferences, UserLocationFlags& userReferenceLocation, ArrayList& dataSetsName, Boolean& hasExternalImages, Boolean& hasHyperlinks, Byte[]& dataSetsHash)\n at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CreateIntermediateFormat(PublishingContext reportPublishingContext)"
That does not look right. In LivingNaturally's fork DataProtectionLocal.LocalProtectData is an empty method. If you are compiling project from sources please inspect Microsoft.ReportViewer.Common\Microsoft.ReportingServices.Diagnostics\DataProtectionLocal.cs and check if LocalProtectData returns same blob it receives as a parameter. If you are using precompiled package from NuGet, make sure you use 15.1.3 version I've published few hours ago.
Also it turns out only portable report format is EXCELOPENXML (xlsx) and WORDOPENXML (docx). Any other renderer, including PDF, depends heavily on native Windows components and as of yet won't work on other platforms.
Hi, apologies for the late reply, updated the package to 15.1.3 and I'm no longer getting the error associated with DataProtectionLocal.LocalProtectData. Managed to build a EXCELOPENXML on a mac. Are there any plans include PDF to the package as a future update or are there any workarounds that would enable PDF's to be generated as well?
For now there are no workarounds for PDF support on non-Windows platforms. It looks like PDFWriter uses native methods at least for computing glyph widths and other metrics. From earlier experiments, omitting those in PDF results in overlapping letters and completely broken kerning. I guess one could still use it with monospaced fonts, but apart from that, only way to get it working properly is complete rewrite of 10 or so methods in Microsoft.ReportingServices.Rendering.ImageRenderer.PDFWriter to use some other cross-platform TTF parsing library.
There is now a workaround available for PDF support on non-Windows platforms. While not ideal, it should cover your use case. See Linux rendering workaround on main page for details.