Giter Site home page Giter Site logo

lkosson / reportviewercore Goto Github PK

View Code? Open in Web Editor NEW
382.0 30.0 113.0 6.41 MB

Recompilation of Microsoft.ReportViewer for .NET Core 3.1+

C# 99.59% CSS 0.18% JavaScript 0.17% HTML 0.07%
microsoft reportviewer report-viewer reporting-services dotnet-core

reportviewercore's Introduction

ReportViewer Core

This project is a port of Microsoft Reporting Services (Report Viewer) to .NET Core 3.1+. It is feature-complete and ready for production use, but keep in mind it is not officially supported by Microsoft.

For version history and recent fixes, see changelog.

Why

With WinForms inclusion in .NET Core 3.1 and .NET 5 as a replacement for .NET Framework, it became feasible to port existing business desktop applications to .NET Core SDK to benefit from new C# and JIT features. Microsoft team stated on multiple occasions (dotnet/aspnetcore#1528, dotnet/aspnetcore#12666, dotnet/aspnetcore#22304, dotnet/docs#9607) that there are no plans to have official Reporting Services / ReportViewer package for .NET Core, which is a showstopper for applications using this technology for printing and reporting. The goal of this project is to provide transitional solution for such applications, until existing reports are reimplemented using more modern technology.

How to use

You should be able to replace references to Report Viewer in your WinForms project with ones provided in this repo and use Microsoft.Reporting.WinForms.ReportViewer as usual. See project ReportViewerCore.Sample.WinForms for a simplified example using local report processing and ReportViewerCore.Sample.WinFormsServer for remote processing using Reporting Services server.

For ASP.NET Core applications, add reference to Microsoft.Reporting.NETCore, which is based on WinForms version with stripped UI, and load/render report programmatically. See project ReportViewerCore.Console for an example or use following code as a starting point:

Stream reportDefinition; // your RDLC from file or resource
IEnumerable dataSource; // your datasource for the report

LocalReport report = new LocalReport();
report.LoadReportDefinition(reportDefinition);
report.DataSources.Add(new ReportDataSource("source", dataSource));
report.SetParameters(new[] { new ReportParameter("Parameter1", "Parameter value") });
byte[] pdf = report.Render("PDF");

For consuming Reporting Services (server-side) reports, use:

ServerReport report = new ServerReport();
report.ReportServerCredentials.NetworkCredentials = new NetworkCredential("login", "password", "DOMAIN");
report.ReportServerUrl = new Uri("http://localhost/ReportServer");
report.ReportPath = "/Invoice";
report.SetParameters(new[] { new ReportParameter("Date", DateTime.Now.Date.ToString()) });
byte[] pdf = report.Render("PDF");

or see project ReportViewerCore.WinFormsServer for more complete example.

There is no interactive, web-based report viewer provided in this project, but there are HTML4.0 and HTML5 rendering formats available. HTML5 format has been modified to also work without JavaScript. See ReportViewerCore.Sample.AspNetCore project for a simple demo.

Designing new reports

Visual Studio 2019 (version 16.9 and similar) does not include Report Designer by default. There is an extension provided by Microsoft called "Microsoft RDLC Report Designer" you need to be able to open and modify your reports. For Visual Studio 2022, you need "Microsoft RDLC Report Designer 2022" extension.

Even after installing the extension, new dataset wizard fails to show classes from your project and .NET Core projects don't have .datasource file support either. The workaround is to create and add .xsd file to your project with definitions of types you want to use in your reports. You can either create this file by hand or use the following snippet to produce one for all the classes you need:

var types = new[] { typeof(ReportItemClass1), typeof(ReportItemClass2), typeof(ReportItemClass3) };
var xri = new System.Xml.Serialization.XmlReflectionImporter();
var xss = new System.Xml.Serialization.XmlSchemas();
var xse = new System.Xml.Serialization.XmlSchemaExporter(xss);
foreach (var type in types)
{
    var xtm = xri.ImportTypeMapping(type);
    xse.ExportTypeMapping(xtm);
}
using var sw = new System.IO.StreamWriter("ReportItemSchemas.xsd", false, Encoding.UTF8);
for (int i = 0; i < xss.Count; i++)
{
    var xs = xss[i];
    xs.Id = "ReportItemSchemas";
    xs.Write(sw);
}

After including ReportItemSchemas.xsd file in your project, Report Designer should see a new datasource called ReportItemSchemas which you can use to add a dataset to your report.

What works

  • RDLC file loading and compiling
  • Local data sources
  • Parameter passing
  • All rendering formats, including PDF and XLS
  • WinForms report preview
  • Remote processing using Reporting Services
  • Linux and MacOS support
  • MSChart control

Supported rendering formats

All formats are supported on Windows, Linux and Mac OS. For formats marked with asterisk (*), see "Linux rendering workaround" section below.

  • HTML4.0 / HTML5 / MHTML
  • PDF (*)
  • IMAGE (TIFF/EMF) (*)
  • EXCEL (Microsoft Excel 97/2003) (*)
  • EXCELOPENXML (Microsoft Excel Open XML)
  • WORD (Microsoft Word 97/2003) (*)
  • WORDOPENXML (Microsoft Word Open XML)

Linux rendering workaround

Some rendering formats (most notably PDF) uses Windows-provided native libraries for font measurements (Uniscribe), which are unavailable on other platforms. They are, however, provided in barely working condition, by Wine version 5.0 or higher. To export your reports to PDF, TIFF or XLS:

  • Install Wine 5.0 or newer. For Debian Bullseye, apt install wine will do.
  • Download Windows version of .NET runtime binaries from https://dotnet.microsoft.com/en-us/download/dotnet - e.g. https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/runtime-3.1.30-windows-x86-binaries.
  • Extract/install those binaries to some local folder, e.g. ~/dotnet-3.1-windows.
  • Start your application using 64-bit version of Wine and Windows version of .NET, e.g. wine64 ~/dotnet-3.1-windows/dotnet.exe YourApplication.dll.

If your application crashes with unsupported flags 00000020 somewhere inside bcrypt, make sure you have proper version of Wine installed. Version 4.1 provided in Debian Buster and earlier won't work.

What doesn't work

  • Spatial SQL types. Those require Microsoft.SqlServer.Types package, which is available only in .NET Framework. Reports using SqlGeography won't load.
  • Expression sandboxing and code security. Do not load and run reports from untrusted sources.
  • Interactive web report preview. It is closely tied to WebForms and ASP.NET architecture and porting it to ASP.NET Core would involve rewriting significant portions of the codebase.
  • WinForms control designer. To use ReportViewer in your WinForms project, add the control programmatically, as in ReportViewerCore.Sample.WinForms\ReportViewerForm.cs.
  • Single .exe deployment. Roslyn needs to be able to reference .NET and ReportViewer assemblies at runtime. When compiled to a single file, those are unavailable and any non-trivial report won't compile.
  • Map control. Not really tested, but included in project anyway.
  • As of .NET 6, Microsoft deprecated System.Drawing on non-windows platforms and removed it completely in .NET 7. This breaks reports using images on those platforms. Using a workaround mentioned above in Linux rendering workaround might help in those cases.

If you get Version conflict detected for "Microsoft.CodeAnalysis.Common" error when adding this NuGet package, try first adding Microsoft.CodeAnalysis.CSharp.Workspaces 3.6.0 or Microsoft.CodeAnalysis.Common 3.6.0 (manually selecting version 3.6.0) package to your project. For .NET 5 use 3.8.0 version. For .NET 6 use 4.0.1.

Reporting bugs

Before reporting issue, please make sure that your problem occurs only when using this package, i.e. it doesn't happen on original Report Viewer. When filing an issue, include full exception stack trace and - where possible - provide relevant RDLC or a sample project.

Sources

Source code for this project comes from decompiling Report Viewer for WinForms, version 15.0.1404.0 using ILSpy. Original Reporting Services use external Visual Basic and System.CodeDom compilation, both of which are not available in .NET Core. Those have been replaced with Roslyn Visual Basic compiler. References to .NET Framework assemblies have been updated to NuGet packages where possible. References to unavailable assemblies, such as Microsoft.SqlServer.Types, have been removed along with functionalities that depend on them. Sources are intentionally left formatted as decompiled by ILSpy.

Project Microsoft.ReportViewer.WinForms is mostly one-to-one recompilation of original ReportViewer for WinForms. Project Microsoft.ReportViewer.NETCore is heavilly stripped down version suitable for web applications, web services and batch processing.

Binary package

A precompiled package is available as ReportViewerCore.NETCore and ReportViewerCore.WinForms at nuget.org: ReportViewerCore.NETCore, ReportViewerCore.WinForms. Legal aspects of redistributing binary package are uncertain. Feel free to compile this project on your own. You'll need Visual Studio 2022 (Community version will do) and .NET 6 SDK. Reference either Microsoft.ReportViewer.NETCore.dll or Microsoft.ReportViewer.WinForms.dll in your solution.

License

Reporting Services is a free Microsoft product. While decompiling and modifying it for compatibility reasons is legal in my local jurisdiction, redistributing modified version most likely is not. Use at your own risk.

reportviewercore's People

Contributors

ca0abinary avatar geesuth avatar horgun avatar lkosson avatar rajeshakumar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reportviewercore's Issues

Additional DLL Needed

Hello,

Is it possible you can also convert the WebForms control?

This is the package I'm currently using: Microsoft.ReportingServices.ReportViewerControl.WebForms.150.1404.0

Added 2 customizations in ReportViewer (Direct Export to a PDF File + Direct Print to a specific printer ) - no Dialogs

Hello.

As like i said i am going to use my local version for further customizations, i have just made 2 that are VERY important for our products.

I dont know how to create a thing that is NOT an issue in here.

I have a reference now to a dummy Winforms.ReportViewer that i am not showing anywhere.
Just set report + params and calls the 2 new direct features. Before i was calling from my code the asmx webservice with specific calculations for page margins and sizes ( Very Important for Label Printing )

  • Direct Export to a PDF File passed from app.
    public string ExportToPdfFile( string fileName ) {

      	var ErrorMessage = "OK";
    
      	try {
    
      		string m_mainStreamMimeType;
    
      		string m_mainStreamFileNameExt;
    
      		using ( var stream = new MemoryStream( ) ) {
    
      			this.ServerReport.InternalRender(
      				isAbortable: true ,
      				"PDF" ,
      				null , // DeviceInfo
      				new NameValueCollection {
      					{
      						"rs:PageCountMode",
      						m_pageCountMode.ToString()
      					}
      				} ,
      				stream ,
      				out m_mainStreamMimeType ,
      				out m_mainStreamFileNameExt );
      			stream.Position = 0L;
      			stream.Position = 0L;
      			var m_mainStreamBytes = new byte[ stream.Length ];
      			stream.Read( m_mainStreamBytes , 0 , (int)stream.Length );
    
      			using ( var fs = new FileStream( fileName , FileMode.OpenOrCreate ) ) {
      				fs.Write( m_mainStreamBytes , 0 , m_mainStreamBytes.Length );
      			}
    
      		}
    
      	}
      	catch ( Exception e2 ) {
      		UpdateUIState( e2 );
      		ErrorMessage = e2.Message + "\n\n" + e2.StackTrace;
      	}
    
      	return ErrorMessage;
      }
    
  • Direct Print a report to a specific printer ( no popup for selecting anything )
    public string ExportToPrinter( string printerName ) {

      	var ErrorMessage = "OK";
    
      	try {
    
      		string deviceInfo = CreateEMFDeviceInfo( 0 , 0 );
      		ProcessAsyncInvokes( );
      		BeginAsyncRender(
      			"IMAGE" ,
      			allowInternalRenderers: true ,
      			deviceInfo ,
      			PageCountMode.Estimate ,
      			CreateStreamEMFPrintOnly ,
      			OnRenderingCompletePrintOnly ,
      			new PostRenderArgs( isDifferentReport: false , isPartialRendering: false ) ,
      			requireCompletionOnUIThread: false
      		);
    
      		ReportPrintDocument reportPrintDocument = new ReportPrintDocument(
      			CurrentReport.FileManager , (PageSettings)PageSettings.Clone( )
      		);
      		reportPrintDocument.DocumentName = Report.DisplayNameForUse;
      		var ps = CreateDefaultPrintSettings( );
      		ps.PrinterName = printerName;
      		reportPrintDocument.PrinterSettings = ps;
      		reportPrintDocument.Print( );
    
      	}
      	catch ( Exception e2 ) {
      		UpdateUIState( e2 );
      		ErrorMessage = e2.Message + "\n\n" + e2.StackTrace;
      	}
    
      	return ErrorMessage;
      }
    

System.NotSupportedException: BinaryFormatter serialization and deserialization are disabled within this application.

BinaryFormatter is obsolete in AspNet Core in .net5.0

Default .net 5.0 environment -

System.NotSupportedException: BinaryFormatter serialization and deserialization are disabled within this application. See https://aka.ms/binaryformatter for more information. at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream) at System.Resources.Extensions.DeserializingResourceReader.ReadBinaryFormattedObject() at System.Resources.Extensions.DeserializingResourceReader.DeserializeObject(Int32 typeIndex) at System.Resources.Extensions.DeserializingResourceReader._LoadObjectV2(Int32 pos, ResourceTypeCode& typeCode) at System.Resources.Extensions.DeserializingResourceReader.LoadObjectV2(Int32 pos, ResourceTypeCode& typeCode) at System.Resources.Extensions.DeserializingResourceReader.LoadObject(Int32 pos, ResourceTypeCode& typeCode) at System.Resources.Extensions.RuntimeResourceSet.GetObject(String key, Boolean ignoreCase, Boolean isString) at System.Resources.Extensions.RuntimeResourceSet.GetObject(String key, Boolean ignoreCase) at System.Resources.ResourceManager.GetObject(String name, CultureInfo culture, Boolean wrapUnmanagedMemStream) at System.Resources.ResourceManager.GetObject(String name) at Microsoft.ReportingServices.Rendering.ImageRenderer.Renderer..cctor() --- End of inner exception stack trace

--- at Microsoft.ReportingServices.Rendering.ImageRenderer.Renderer..ctor(Boolean physicalPagination) at Microsoft.ReportingServices.Rendering.ImageRenderer.PDFRenderer.Render(Report report, NameValueCollection deviceInfo, Hashtable renderProperties, CreateAndRegisterStream createAndRegisterStream) at Microsoft.ReportingServices.Rendering.ImageRenderer.RendererBase.Render(Report report, NameValueCollection reportServerParameters, NameValueCollection deviceInfo, NameValueCollection clientCapabilities, Hashtable& renderProperties, CreateAndRegisterStream createAndRegisterStream) --- End of inner exception stack trace --- at Microsoft.Reporting.NETCore.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, Warning[]& warnings) at Microsoft.Reporting.NETCore.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)

Curious if others are also facing this issue?

var report = new LocalReport();
report.ReportPath = $"Resources/{reportName}.rdl";
return report.Render(format, deviceInfo); // report.Render throws above exception

UITypeEditor exists in both Microsoft.ReportViewer.DataVisualization and System.Windows.Forms

Create a Net5 windows forms application, and add the reportviercore.winforms nuget library, then enter the following

System.Drawing.Design.UITypeEditor oTest = new System.Drawing.Design.UITypeEditor();

It will fail to compile as this class is duplicated in System.Windows.Forms (net5-windows) and Microsoft.ReportViewer.DataVisualization (reportviercore.winforms nuget)

All the other classes in the System.Drawing.Design namespace exists only in:-

Assembly System.Windows.Forms.Design.Editors, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

But UITypeEditor exists in:-

Assembly System.Windows.Forms.Design.Editors, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
and
Assembly Microsoft.ReportViewer.DataVisualization, Version=15.0.0.0, Culture=neutral, PublicKeyToken=null

Bug - DateTime Parameters for the report in WinForms ReportViewer

Hello,

i think i just found a bug in WinForms ReportViewer that applies to date parameters.
I think it applies to both server reports and local reports but i am not sure about local as i dont have any.

Selecting a date from Calendar to 01-May -> sets it first time, then it refreshes the parameters panel by itself and it is changed to 05-Jan
Sometimes it doesnt do that, but, if i set first time to a value and it is set correctly, second time i set the same parameter ( OR ANY other parameter in the parameters panel ) does the same shit.

So a consistent way to reproduce it if it doesnt happen first time is either try to set again still to a value with a day < 12 or to set some other parameter it doesnt matter which. Then it flickers the parameters, and the values in the dates becomes wrong

It seems that it just reparses the date this time with MM/DD format.

My report DOES NOT have any culture set, and my apps also uses the default. SO it cannot be from localization.
If it would be from localization i would get an exception setting the date to 31-May for example, but i dont get any errors, and the report works as it should with day > 12. All days < 12 do this crap.

Like i said what i notice is that the parameters panel flickers a bit and it puts me the wrong value in there, even if when coming from calendar selection it sets correct the date in the text.

thank you in advance for your answers there.
I can look by myself also in there, but i dont really know where to start to look in.

Trouble loading image from varbinary(max) to Report

Hello,

I have an image stored in a database as type varbinary(max). In my .RDLC file, I have an image, with the appropriate Value, Source, and MIMEType set. I'm using EF to fill a a dataset I use as the report datasource. The column in my dataset is of datatype "String".

This is how I'm filling my dataset:

myDataSet.ImageColumn = myImageAsByteArray.ToString()

The .xsd Dataset gives me no option to set the datatype as byte[] or varbinary, that's why I'm using a string.

When I do this, I get the Exception: KeyNotFoundException: The given key "InvalidImage" was not present in the dictionary.

Any help is appreciated, thank you in advance!

Formatting issue

I've rendered completely the same report in .NET Framework ReportViewer and with reportviewercore.
In core it adds extra zeros in decimal and spaces in dates. Format string in rdlc in fields with three decimal places is "N". This could be an issue with .NET 5.0.

.NET Framework:
image

.NET Core:
image

Null refrence exception when a image is not found (Word export)

When I put an external image in a report with href is a field of a dataset, if the url is not found (404) i've got an null reference exception on "InvalidImage" Ressource.

namespace : Microsoft.ReportingServices.Rendering.WordRenderer
class : PictureDescriptor
in constructor line 160, bitmap is null.

Microsoft.ReportViewer.WinForms display "Parameters" errors when convert to dotnet5

first, i want to thank you for your work on this reportviewer controls. (I use winforms reportviewer)

i download the sample. everything works fine. But, when i change from dotnetcoreapp3.1 to dotnet5 like this:
net5.0-windows

the sample Error with:
InvalidOperationException: (24) : error BC30652: Reference required to assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' containing the type 'MarshalByRefObject'. Add one to your project.
with detail:
This exception was originally thrown at this call stack:

Microsoft.ReportingServices.RdlExpressions.VBExpressionCodeProvider.CompileAssemblyFromDom(System.CodeDom.Compiler.CompilerParameters, System.CodeDom.CodeCompileUnit[]) in VBExpressionCodeProvider.cs
 Microsoft.ReportingServices.RdlExpressions.ExprHostCompiler.InternalCompile(System.AppDomain, bool) in ExprHostCompiler.cs
 Microsoft.ReportingServices.RdlExpressions.ExprHostCompiler.Compile.AnonymousMethod__0() in ExprHostCompiler.cs
 Microsoft.ReportingServices.Diagnostics.RevertImpersonationContext.Run(Microsoft.ReportingServices.Diagnostics.ContextBody) in RevertImpersonationContext.cs
 Microsoft.ReportingServices.RdlExpressions.ExprHostCompiler.Compile(Microsoft.ReportingServices.ReportIntermediateFormat.IExpressionHostAssemblyHolder, System.AppDomain, bool, Microsoft.ReportingServices.ReportPublishing.PublishingVersioning) in ExprHostCompiler.cs
 Microsoft.ReportingServices.ReportPublishing.ReportPublishing.Phase3(out Microsoft.ReportingServices.ReportProcessing.ParameterInfoCollection, out System.Collections.Generic.Dictionary<string, int>) in ReportPublishing.cs
 Microsoft.ReportingServices.ReportPublishing.ReportPublishing.InternalCreateIntermediateFormat(System.IO.Stream, out string, out string, out Microsoft.ReportingServices.ReportProcessing.ParameterInfoCollection, out Microsoft.ReportingServices.DataExtensions.DataSourceInfoCollection, out Microsoft.ReportingServices.DataExtensions.DataSetInfoCollection, out Microsoft.ReportingServices.ReportProcessing.UserLocationFlags, out System.Collections.ArrayList, out bool, out bool, out byte[]) in ReportPublishing.cs
 Microsoft.ReportingServices.ReportPublishing.ReportPublishing.CreateIntermediateFormat(byte[], out string, out string, out Microsoft.ReportingServices.ReportProcessing.ParameterInfoCollection, out Microsoft.ReportingServices.DataExtensions.DataSourceInfoCollection, out Microsoft.ReportingServices.DataExtensions.DataSetInfoCollection, out Microsoft.ReportingServices.ReportProcessing.UserLocationFlags, out System.Collections.ArrayList, out bool, out bool, out byte[]) in ReportPublishing.cs
 Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CompileOdpReport(Microsoft.ReportingServices.ReportProcessing.PublishingContext, Microsoft.ReportingServices.ReportProcessing.PublishingErrorContext, out string, out string, out Microsoft.ReportingServices.ReportProcessing.ParameterInfoCollection, out Microsoft.ReportingServices.DataExtensions.DataSourceInfoCollection, out Microsoft.ReportingServices.DataExtensions.DataSetInfoCollection, out Microsoft.ReportingServices.ReportProcessing.UserLocationFlags, out System.Collections.ArrayList, out bool, out bool, out byte[]) in ReportProcessing.cs
 Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CreateIntermediateFormat(Microsoft.ReportingServices.ReportProcessing.PublishingContext) in ReportProcessing.cs

but when i REMOVED the parameters field from the designer (don't show the parameter "Title"), everything runs well.

internal override void EnsureExecutionSession()
{
	if (DefinitionSource == DefinitionSource.Unknown)
	{
		throw new MissingReportSourceException();
	}
	try
	{
	       if (!HasExecutionSession)
		{
			m_processingHost.CompileReport();  --> ERRORS HERE
			m_processingHost.SetReportParameters(m_parentSuppliedParameters);
		}
		}
		catch (SecurityException processingException)
		{
		      throw new LocalProcessingException(CommonStrings.LocalModeMissingFullTrustErrors,processingException);
		}
		catch (Exception processingException2)
		{
			throw WrapProcessingException(processingException2);
		}
	}

how to resolved this issued on Dotnet5 ?

System.IO.FileNotFoundException: 'Could not load file or assembly 'projectPath\file:\outputPath\Microsoft.ReportViewer.Common.dll'.

Hello,

I have some rdlc reports that import the System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a assembly to be able to have some custom code on an image field.

Apparently when the assembly is getting imported this exception is thrown:
System.IO.FileNotFoundException: 'Could not load file or assembly 'projectPath\file:\outputPath\Microsoft.ReportViewer.Common.dll'. The filename, directory name, or volume label syntax is incorrect.
in
Microsoft.ReportViewer.Common/Microsoft.ReportingServices.Diagnostics/AssemblyLocationResolver.cs
method
public static AssemblyLocationResolver CreateResolver(AppDomain tempAppDomain)
line 17
return (AssemblyLocationResolver)tempAppDomain.CreateInstanceFromAndUnwrap(typeFromHandle.Assembly.CodeBase, typeFromHandle.FullName);

Is there a workaround or is there no support for importing additional assemblies into reports?

Thank you in advance.

Error when calling report.GetParameters()

Hi,
I was testing your code and for a wile all was ok, but when i add a parameter, everything stop working :

My code :

var report = new LocalReport();

            report.LoadReportDefinition(new MemoryStream(Resources.Report1));
            
            var parameters = report.GetParameters(); // ERROR !!

            var dataSources = report.GetDataSourceNames();

            Random random = new Random();
            int i = random.Next(100);

            ProjibatDataSource projibatDataSource = new ProjibatDataSource();

            for (int j = 0; j < i; j++)
            {
                var customer = (CustomersRow)projibatDataSource.Customers.NewRow();
                customer.CustomerId = j;

                projibatDataSource.Customers.Rows.Add(customer);
            }



            foreach (var dataSource in dataSources)
            {
                report.DataSources.Add(new ReportDataSource(dataSource, (DataTable)projibatDataSource.Customers));
            }



            foreach (var parameter in parameters)
            {
                report.SetParameters(new ReportParameter(parameter.Name, i.ToString()));
            }

            var word = report.Render("WORDOPENXML");

Error:

Microsoft.ReportViewer.NETCore: An error occurred during local report processing. Microsoft.ReportViewer.Common: The definition of the report '' is invalid. Microsoft.ReportViewer.Common: An unexpected error occurred in Report Processing. Microsoft.ReportViewer.Common: Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. File not found

Report1.zip
ProjibatDataSource.Designer.zip

If i remove the parameter, all work fine

Calling DataSources on Microsoft.Reporting.WinForms.LocalReport fails

Hi

I am getting this error
CustomCode(2) : error BC30456: 'RegularExpressions' is not a member of 'System.Text'.
in code that ran successfully under .Net Framework but fails under .Net 5
If required I will happily narrow down in a test harness if the data below is not enough

Thank you
Alan Dobson

Local property

public Microsoft.Reporting.WinForms.LocalReport Report { get; private set; }

Error Call

this.Report.GetDataSourceNames()

Failure method

public void SetDataSet(DataSet dataset)
{
this.DataSet = dataset;

foreach (string sDataSourceName in this.Report.GetDataSourceNames()) 
{
	if (dataset.Tables.Contains(sDataSourceName))
	{
		ReportDataSource oDataSource = this.Report.DataSources[sDataSourceName];

		if (oDataSource == null)
		{
			oDataSource = new ReportDataSource(sDataSourceName, dataset.Tables[sDataSourceName]);

			this.Report.DataSources.Add(oDataSource);
		}
		else
		{
			oDataSource.Value = dataset.Tables[sDataSourceName];
		}
	}
}

}

Exception details from the debugger

Microsoft.Reporting.WinForms.LocalProcessingException
HResult=0x80131500
Message=An error occurred during local report processing.
Source=Microsoft.ReportViewer.WinForms
StackTrace:
at Microsoft.Reporting.WinForms.LocalReport.EnsureExecutionSession()
at Microsoft.Reporting.WinForms.LocalReport.GetDataSourceNames()
at SDS.Optical.Windows.BPL.Reports.SDSLocalReport.SetDataSet(DataSet dataset) in E:\Release_60\ClassLibraries\SDS.Optical.Windows.BPL\Reports\SDSLocalReport.cs:line 195

This exception was originally thrown at this call stack:
[External Code]

Inner Exception 1:
DefinitionInvalidException: The definition of the report '' is invalid.

Inner Exception 2:
ReportProcessingException: An unexpected error occurred in Report Processing.

Inner Exception 3:
InvalidOperationException: CustomCode(2) : error BC30456: 'RegularExpressions' is not a member of 'System.Text'.

More comprehensive stack trace from our QA team

                    • EXCEPTION INFORMATION - - - - - - - - - - - - - -
                      Exception ID: 637533410315857836
                      Exception Logged: 4/6/2021 9:23:51 PM


ExceptionType: Microsoft.Reporting.WinForms.LocalProcessingException
TargetSite: Void EnsureExecutionSession()
Message: An error occurred during local report processing.
Data:
HelpLink: NULL
Source: Microsoft.ReportViewer.WinForms
HResult: -2146233088
StackTrace:
at Microsoft.Reporting.WinForms.LocalReport.EnsureExecutionSession()
at Microsoft.Reporting.WinForms.LocalReport.GetDataSourceNames()
at SDS.Optical.Windows.BPL.Reports.SDSLocalReport.SetDataSet(DataSet dataset)
at SDS.Optical.Windows.BPL.Reports.SDSWinFormsReportingBPL.SetReport(SDSReportingBPL sdsReportingBPL, LocalReport report, DataSet dataset, Hashtable parameters, SystemAuditEvent startPrintingSystemAuditEvent)
at SDS.Optical.Windows.Reports.Forms.ReportPreviewRPLFormCode.SetReport(SDSReportingBPL reportingBPL, DataSet reportData, Hashtable parameters, SystemAuditEvent startPrintingSystemAuditEvent)
at SDS.Optical.Windows.Reports.Forms.ReportPreviewRPLFormCode.SetReport(SDSReportingBPL reportBPL)
at SDS.Optical.Windows.Billing.Forms.BillingPaymentAllocation2FormCode.OpenBookPage()


ExceptionType: Microsoft.Reporting.DefinitionInvalidException
Message: The definition of the report '' is invalid.
ExceptionLevelHelpLink: https://go.microsoft.com/fwlink/?LinkId=20476&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=pvInvalidDefinition&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&ProdVer=1.0
SkipTopLevelMessage: False
Code: pvInvalidDefinition
AdditionalTraceMessage: NULL
ExceptionData:
TargetSite: Microsoft.ReportingServices.ReportProcessing.PublishingResult CompileReport(Microsoft.ReportingServices.Diagnostics.ICatalogItemContext, Byte[], Boolean, Microsoft.ReportingServices.Library.ControlSnapshot ByRef)
Data:
HelpLink: NULL
Source: Microsoft.ReportViewer.Common
HResult: -2146233088
StackTrace:
at Microsoft.Reporting.ReportCompiler.CompileReport(ICatalogItemContext context, Byte[] reportDefinition, Boolean generateExpressionHostWithRefusedPermissions, ControlSnapshot& snapshot)
at Microsoft.Reporting.LocalService.GetCompiledReport(PreviewItemContext itemContext, Boolean rebuild, ControlSnapshot& snapshot)
at Microsoft.Reporting.LocalService.CompileReport()
at Microsoft.Reporting.LocalService.Microsoft.Reporting.ILocalProcessingHost.CompileReport()
at Microsoft.Reporting.WinForms.LocalReport.EnsureExecutionSession()


ExceptionType: Microsoft.ReportingServices.ReportProcessing.ReportProcessingException
ProcessingMessages: NULL
Message: An unexpected error occurred in Report Processing.
ExceptionLevelHelpLink: https://go.microsoft.com/fwlink/?LinkId=20476&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsInternalError&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&ProdVer=1.0
SkipTopLevelMessage: False
Code: rsInternalError
AdditionalTraceMessage: NULL
ExceptionData:
TargetSite: Microsoft.ReportingServices.ReportProcessing.PublishingResult CreateIntermediateFormat(Microsoft.ReportingServices.ReportProcessing.PublishingContext)
Data:
HelpLink: NULL
Source: Microsoft.ReportViewer.Common
HResult: -2146233088
StackTrace:
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CreateIntermediateFormat(PublishingContext reportPublishingContext)
at Microsoft.Reporting.ReportCompiler.CompileReport(ICatalogItemContext context, Byte[] reportDefinition, Boolean generateExpressionHostWithRefusedPermissions, ControlSnapshot& snapshot)


Launch book page report

ExceptionType: System.InvalidOperationException
TargetSite: System.CodeDom.Compiler.CompilerResults CompileAssemblyFromDom(System.CodeDom.Compiler.CompilerParameters, System.CodeDom.CodeCompileUnit[])
Message: CustomCode(2) : error BC30456: 'RegularExpressions' is not a member of 'System.Text'.
Data:
HelpLink: NULL
Source: Microsoft.ReportViewer.Common
HResult: -2146233079
StackTrace:
at Microsoft.ReportingServices.RdlExpressions.VBExpressionCodeProvider.CompileAssemblyFromDom(CompilerParameters options, CodeCompileUnit[] compilationUnits)
at Microsoft.ReportingServices.RdlExpressions.ExprHostCompiler.InternalCompile(AppDomain compilationTempAppDomain, Boolean refusePermissions)
at Microsoft.ReportingServices.RdlExpressions.ExprHostCompiler.<>c__DisplayClass46_0.b__0()
at Microsoft.ReportingServices.Diagnostics.RevertImpersonationContext.Run(ContextBody callback)
at Microsoft.ReportingServices.RdlExpressions.ExprHostCompiler.Compile(IExpressionHostAssemblyHolder expressionHostAssemblyHolder, AppDomain compilationTempAppDomain, Boolean refusePermissions, PublishingVersioning versioning)
at Microsoft.ReportingServices.ReportPublishing.ReportPublishing.Phase3(ParameterInfoCollection& parameters, Dictionary`2& groupingExprCountAtScope)
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)
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)
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)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CreateIntermediateFormat(PublishingContext reportPublishingContext)

                    • END OF EXCEPTION - - - - - - - - - - - - - - - - -

Pagination on UI

I am using this project with .Net 5 and trying to show report on UI. I have used the html response to show the report. Is there a way to implement pagination or I have to download the whole report?

PDF & Image generation fails on Windows Nano Server Docker container

Hi,

We need to containerize a legacy application using rdlc report and migrate to .net 5.0. We uses your porting succesfully but testing with a NanoServer returns this error when render reports to PDF/TIFF:

Microsoft.Reporting.NETCore.LocalProcessingException: An error occurred during local report processing. ---> System.NotImplementedException: The method or operation is not implemented. at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode) at Microsoft.ReportingServices.Rendering.RichText.Paragraph.ScriptItemize(Directions direction) at Microsoft.ReportingServices.Rendering.RichText.TextBox.ScriptItemize() at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.GetRichTextBox() at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.CalculateVerticalSize(PageContext pageContext) at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.DetermineVerticalSize(PageContext pageContext, Double topInParentSystem, Double bottomInParentSystem, List1 ancestors, Boolean& anyAncestorHasKT, Boolean hasUnpinnedAncestors)
at Microsoft.ReportingServices.Rendering.HPBProcessing.PageItem.CalculateVertical(PageContext pageContext, Double topInParentSystem, Double bottomInParentSystem, PageItem[] siblings, List1 ancestors, Boolean& anyAncestorHasKT, Boolean hasUnpinnedAncestors, Nullable1 sourceWidth)
at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.RowInfo.CalculateVerticalLastDetailCell(PageContext context, Boolean firstTouch, Boolean delayCalc)
at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.CreateDetailCell(Tablix tablix, TablixMember colMemberParent, Int32 colGridIndex, RowInfo rowInfo, PageContext pageContext)
at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.TraverseColumnMembers(Tablix tablix, TablixMember colMemberParent, Int32 parentColIndex, RowInfo currRowInfo, Boolean create, Double startInTablix, Double endInTablix, Int32& detailCellIndex, Int32& visibleSpan, List1 detailCellsState, PageContext pageContext) at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.TraverseColumnMembers(Tablix tablix, TablixMember colMemberParent, Int32 parentColIndex, RowInfo currRowInfo, Boolean create, Double startInTablix, Double endInTablix, Int32& detailCellIndex, Int32& visibleSpan, List1 detailCellsState, PageContext pageContext)
at Microsoft.ReportingServices.Rendering.HPBProcessing.Tablix.CreateDetailRow(Tablix tablix, TablixMember rowMemberParent, Int32 parentRowIndex, Int32 parentColIndex, PageContext pageContext)`

The problem is that NanoServer is a headless SO and no support GDI+ and Uniscribe libraries. There is planned that ReportViewerCore works on Linux or NanoServer in this case?

Thanks

Thread.Abort call by ReportViewer

Hi

This is my first ever post to this type of environment so please be kind. We have converted to .Net 5 and have a windows based
code part which does our reporting. Whilst rendering a report we get this exception if the user quits out of the window before
the report is ready. Thread.Abort is raising PlatformNotSupportedException. I am currently upgrading to use the CancelRendering method.

Is that the correct approach?
Is the Thread.Abort being removed?
Is what I have posted on this issue correct?

Thanks in advance
Alan Dobson

We are using namespace

Microsoft.Reporting.WinForms
{
[Designer("Microsoft.Reporting.WinForms.ReportViewerDesigner, Microsoft.ReportViewer.Design, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91", typeof(IDesigner))]
[Docking(DockingBehavior.Ask)]
[SRDescriptionAttribute("ReportViewerDescription")]
public class ReportViewer : UserControl, IRenderable

ExceptionType: System.PlatformNotSupportedException
TargetSite: Void Abort()
Message: Thread abort is not supported on this platform.
Data:
HelpLink: NULL
Source: System.Private.CoreLib
HResult: -2146233031
StackTrace:
at System.Threading.Thread.Abort()
at Microsoft.Reporting.WinForms.ProcessingThread.Cancel(Int32 millisecondsTimeout)
at Microsoft.Reporting.WinForms.ReportViewer.CancelRendering(Int32 millisecondsTimeout)
at Microsoft.Reporting.WinForms.ReportViewer.CancelAllRenderingRequests()
at Microsoft.Reporting.WinForms.ReportViewer.Dispose(Boolean disposing)
at System.Windows.Forms.Control.Dispose(Boolean disposing)
at System.Windows.Forms.Form.Dispose(Boolean disposing)
at SDS.Windows.Forms.BaseForm.Dispose(Boolean disposing)
at SDS.Optical.Windows.Reports.Forms.ReportPreviewRPLFormCode.Dispose(Boolean disposing)
at System.Windows.Forms.Form.WmClose(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)

                    • END OF EXCEPTION - - - - - - - - - - - - - - - - -

Invalid report error while rendor in .NET Core application, but this rdlc file works in windows application

I am getting error as below for rdlc report when I use this library, error while redner. but this report working in other windows
based application. Please help as soon aspossible.

CODE :
byte[] reportresult = null;
try
{
//using (FileStream stream = new FileStream(reportpath, FileMode.Open))
//{
//reportDefinition = stream;

            LocalReport report = new LocalReport();

            report.DataSources.Clear();
            
            report.ReportPath = reportpath;
                //report.LoadReportDefinition(reportDefinition);

                AddDataSources(reportparameters, report);
                //report.Refresh();
                ****reportresult = report.Render("PDF");****

            //}
        }

ERROR :

Error : Source : Microsoft.ReportViewer.NETCore Inner Exception : System.ApplicationException: The report definition for report SalesPrint has not been specified
---> System.IO.FileNotFoundException: Could not find file D:\Production\QuickAPI\QuickAPI\Reports\SalesPrint.rdlc.
File name: D:\Production\QuickAPI\QuickAPI\Reports\SalesPrint.rdlc
at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at System.IO.File.OpenRead(String path)
at Microsoft.ReportingServices.StandalonePreviewStore.GetReportDefinition(PreviewItemContext itemContext)
--- End of inner exception stack trace ---
at Microsoft.ReportingServices.StandalonePreviewStore.GetReportDefinition(PreviewItemContext itemContext)
at Microsoft.Reporting.LocalService.GetCompiledReport(PreviewItemContext itemContext, Boolean rebuild, ControlSnapshot& snapshot)
at Microsoft.Reporting.LocalService.CompileReport()
at Microsoft.Reporting.LocalService.Microsoft.Reporting.ILocalProcessingHost.CompileReport()
at Microsoft.Reporting.NETCore.LocalReport.EnsureExecutionSession() Stack: at Microsoft.Reporting.NETCore.LocalReport.EnsureExecutionSession()
at Microsoft.Reporting.NETCore.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, Warning[]& warnings)
at Microsoft.Reporting.NETCore.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
at Microsoft.Reporting.NETCore.LocalReport.Render(String format, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
at Microsoft.Reporting.NETCore.Report.Render(String format, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
at Microsoft.Reporting.NETCore.Report.Render(String format, String deviceInfo)
at Microsoft.Reporting.NETCore.Report.Render(String format)
at QuickAPI.Helpers.HelperReport.Report(ReportParameters reportparameters) in D:\QuickSales\QuickAPI\QuickAPI\QuickAPI\Helpers\HelperReport.cs:line 41

Won't render WORD format.

For any report that has an image:

Could not find the resource "Microsoft.ReportingServices.Rendering.WordRenderer.Images.resources" among the resources "Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings.resources", "Microsoft.ReportingServices.OnDemandReportRendering.RenderErrors.resources", "Microsoft.ReportingServices.RdlObjectModel.SR.resources", "Microsoft.ReportingServices.RdlObjectModel.SRErrors.resources", "Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelRenderRes.resources", "Microsoft.ReportViewer.Common.Microsoft.ReportingServices.Rendering.ExcelRenderer.Images.resources", "Microsoft.ReportingServices.Rendering.HPBProcessing.HPBRes.resources", "Microsoft.ReportViewer.Common.Microsoft.ReportingServices.Rendering.HPBProcessing.Images.resources", "Microsoft.ReportingServices.Rendering.ImageRenderer.ImageRendererRes.resources", "Microsoft.ReportViewer.Common.Microsoft.ReportingServices.Rendering.ImageRenderer.Images.resources", ... embedded in the assembly "Microsoft.ReportViewer.Common", nor among the resources in any satellite assemblies for the specified culture. Perhaps the resources were embedded with an incorrect name.

at System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing(String fileName)
at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
at System.Resources.ResourceManager.GetObject(String name, CultureInfo culture, Boolean wrapUnmanagedMemStream)
at System.Resources.ResourceManager.GetObject(String name)
at Microsoft.ReportingServices.Rendering.WordRenderer.PictureDescriptor..cctor()

Unable to use Nuget package.

Happens both in projects using either ,net core 3.1 or .Net 5

Severity Code Description Project File Line Suppression State
Error NU1107 Version conflict detected for Microsoft.CodeAnalysis.Common. Install/reference Microsoft.CodeAnalysis.Common 3.6.0 directly to project OHADST.Compass.Management to resolve this issue.
OHADST.Compass.Management -> ReportViewerCore.NETCore 15.1.11 -> Microsoft.CodeAnalysis.VisualBasic 3.6.0 -> Microsoft.CodeAnalysis.Common (= 3.6.0)
OHADST.Compass.Management -> Microsoft.VisualStudio.Web.CodeGeneration.Design 3.1.3 -> Microsoft.VisualStudio.Web.CodeGenerators.Mvc 3.1.3 -> Microsoft.VisualStudio.Web.CodeGeneration 3.1.3 -> Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore 3.1.3 -> Microsoft.VisualStudio.Web.CodeGeneration.Core 3.1.3 -> Microsoft.VisualStudio.Web.CodeGeneration.Templating 3.1.3 -> Microsoft.CodeAnalysis.CSharp 3.3.1 -> Microsoft.CodeAnalysis.Common (= 3.3.1). OHADST.Compass.Management D:\Dev\Visual Studio 2019\CompassManagement\OHADST.Compass.Management\OHADST.Compass.Management.csproj 1

Getting an error when trying to use dll in .net core web app

I am getting an error "Attempt by method 'Microsoft.Reporting.NETCore.LocalReport..ctor()' to access method 'Microsoft.ReportingServices.StandalonePreviewStore..ctor()' failed." when trying to create an instance of LocalReport() in my .net core 3.1 app

here is my sample (which is based of the console app)

  string fileDirPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
  string rdlcFilePath = string.Format("{0}\\{1}.rdlc", fileDirPath, "Invoice");
  var fs = new FileStream(rdlcFilePath, FileMode.Open);
  LocalReport CIReport = new LocalReport(); // Getting error here
  CIReport.LoadReportDefinition(fs);

  CIReport.DataSources.Add(new ReportDataSource("DataSource1", myDataSource));

  return CIReport.Render("PDF");

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

An error occurred during local report processing

I am using this library from report viewing to my .Net Core project, but I am facing a problem after completing production.
In debugging mode, everything is
working fine . But the fact in IIS. In IIS a got this error. image

Issue on Ubuntu

I have an exception while generating local rdl reports

.ctor exception: Culture is not supported. (Parameter 'culture')
4096 (0x1000) is an invalid culture identifier., Stack trace:    at System.Globalization.CultureInfo..ctor(Int32 culture, Boolean useUserOverride)
   at Microsoft.ReportingServices.ReportIntermediateFormat.RecordSetInfo..ctor(Boolean readerExtensionsSupported, Boolean persistCalculatedFields, DataSetInstance dataSetInstance, DateTime reportExecutionTime)
   at Microsoft.ReportingServices.OnDemandProcessing.ProcessingDataReader..ctor(OnDemandProcessingContext odpContext, DataSetInstance dataSetInstance, String dataSetName, IDataReader sourceReader, Boolean hasServerAggregateMetadata, String[] aliases, String[] names, DataSourceErrorInspector errorInspector)
   at Microsoft.ReportingServices.OnDemandProcessing.RuntimeDataSet.CreateProcessingDataReader(IDataReader reader, DataSourceErrorInspector errorInspector, Boolean readerExtensionsSupportedLocal)
   at Microsoft.ReportingServices.OnDemandProcessing.RuntimeDataSet.StoreDataReader(IDataReader reader, DataSourceErrorInspector errorInspector)
   at Microsoft.ReportingServices.OnDemandProcessing.RuntimeLiveQueryExecutor.RunLiveQuery(List`1 queryParams, Object[] paramValues)
   at Microsoft.ReportingServices.OnDemandProcessing.RuntimeDataSet.RunEmbeddedQuery(List`1 queryParams, Object[] paramValues)
   at Microsoft.ReportingServices.OnDemandProcessing.RuntimeDataSet.RunDataSetQuery()
   at Microsoft.ReportingServices.OnDemandProcessing.RuntimeDataSet.InitializeAndRunLiveQuery()
   at Microsoft.ReportingServices.OnDemandProcessing.RuntimeAtomicDataSet.InitializeRowSourceAndProcessRows(ExecutedQuery existingQuery)
   at Microsoft.ReportingServices.OnDemandProcessing.RuntimeAtomicDataSet.Process(ExecutedQuery existingQuery)
   at Microsoft.ReportingServices.OnDemandProcessing.RuntimeAtomicDataSet.ProcessConcurrent(Object threadSet)

Please help or provide me an advice. Thanks!

Generation fails when run through a single-file .exe

Very strange behavior observed. When running the project as an single .exe in .NET 5.0, an exception occurs when rending the report.

Microsoft.Reporting.NETCore.LocalProcessingException: An error occurred during local report processing.
 ---> Microsoft.Reporting.DefinitionInvalidException: The definition of the report '' is invalid. ---> Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: An unexpected error occurred in Report Processing. ---> System.TypeInitializationException: The type initializer for 'Microsoft.ReportingServices.ReportIntermediateFormat.Persistence.IntermediateFormatVersion' threw an exception. ---> System.ArgumentException: The path is empty. (Parameter 'path')
   --- End of inner exception stack trace ---
   at Microsoft.Reporting.NETCore.LocalReport.EnsureExecutionSession()
   at Microsoft.Reporting.NETCore.LocalReport.SetParameters(IEnumerable`1 parameters)

Having issues with using custom font on Windows

We have a report that generates box labels with barcodes. The report uses the custom font "Code128Double.ttf" for bar codes. The .NET framework version works ok but the .NET Core version with ReportViewerCore control prints an error in the bar code. Can you please help?

image

image

ServerReport Issue + Solution for having Server on HTTPS.

Hello,

i found an issue with the Server Reports. The render fails if the server is on HTTPS.

Solution:
Project: Microsoft.Reporting.WinForms
Folder: Microsoft.Reporting.WinForms.Internal.Soap.ReportingServices2005.Execution
Class: ReportExecutionServiceSoapClient
Method: public ICredentials Credentials - set

Replace: binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
with:

if ( Url.StartsWith( "https" ) ) {
binding.Security.Mode = BasicHttpSecurityMode.Transport;
}
else {
binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
}

WPF .Net 5 Support

Does it support WPF .Net 5 applications?
I added the nuget package to the project, but couldn't figure out how to use it..

PDF generation fails on Linux Docker container

I have implemented this on my local windows machine and it works fine, but when I go and deploy this on a linux docker container it thows an error as shown below


System.TypeInitializationException: The type initializer for 'Gdip' threw an exception. ---> System.DllNotFoundException: Unable to load shared library 'libgdiplus' or one of its dependencies. 
In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibgdiplus: cannot open shared object file: No such file or directory   
at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& token, StartupInput& input, StartupOutput& output)   
at System.Drawing.SafeNativeMethods.Gdip..cctor()   --- End of inner exception stack trace ---   at System.Drawing.SafeNativeMethods.Gdip.GdipCreateBitmapFromScan0(Int32 width, Int32 height, Int32 stride, Int32 format, IntPtr scan0, IntPtr& bitmap)   
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)   at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)   
at Microsoft.ReportingServices.Rendering.ImageRenderer.GraphicsBase..ctor(Single dpiX, Single dpiY)   
at Microsoft.ReportingServices.Rendering.ImageRenderer.PDFWriter.BeginReport(Int32 dpiX, Int32 dpiY)   
at Microsoft.ReportingServices.Rendering.ImageRenderer.PDFRenderer.Render(Report report, NameValueCollection deviceInfo, Hashtable renderProperties, CreateAndRegisterStream createAndRegisterStream)   
at Microsoft.ReportingServices.Rendering.ImageRenderer.RendererBase.Render(Report report, NameValueCollection reportServerParameters, NameValueCollection deviceInfo, NameValueCollection clientCapabilities, Hashtable& renderProperties, CreateAndRegisterStream createAndRegisterStream)

We tried to fix it by modifying the docker file using the solution provided here Here

but now it gives an error below

System.DllNotFoundException: Unable to load shared library 'usp10.dll' or one of its dependencies. 
In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libusp10.dll: 
cannot open shared object file: No such file or directory   
at Microsoft.ReportingServices.Rendering.RichText.Win32.ScriptItemize(String pwcInChars, Int32 cInChars, Int32 cMaxItems, SCRIPT_CONTROL& psControl, SCRIPT_STATE& psState, SCRIPT_ITEM[] pItems, Int32& pcItems)   
at Microsoft.ReportingServices.Rendering.RichText.Paragraph.ScriptItemize(Directions direction)   
at Microsoft.ReportingServices.Rendering.RichText.TextBox.ScriptItemize()   
at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.GetRichTextBox()   
at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.CalculateVerticalSize(PageContext pageContext)   
at Microsoft.ReportingServices.Rendering.HPBProcessing.TextBox.DetermineVerticalSize(PageContext pageContext, Double topInParentSystem, Double bottomInParentSystem, List`1 ancestors, Boolean& anyAncestorHasKT, Boolean hasUnpinnedAncestors)   
at Microsoft.ReportingServices.Rendering.HPBProcessing.PageItem.CalculateVertical(PageContext pageContext, Double topInParentSystem, Double bottomInParentSystem, PageItem[] siblings, List`1 ancestors, Boolean& anyAncestorHasKT, Boolean hasUnpinnedAncestors, Nullable`1 sourceWidth)   
at Microsoft.ReportingServices.Rendering.HPBProcessing.PageItemContainer.DetermineContentVerticalSize(PageContext pageContext, Double topInParentSystem, Double bottomInParentSystem, List`1 ancestors, Boolean& anyAncestorHasKT, Boolean hasUnpinnedAncestors, Boolean resolveState, Boolean resolveItem)   
at Microsoft.ReportingServices.Rendering.HPBProcessing.PageItemContainer.DetermineVerticalSize(PageContext pageContext, Double topInParentSystem, Double bottomInParentSystem, List`1 ancestors, Boolean& anyAncestorHasKT, Boolean hasUnpinnedAncestors)   
at Microsoft.ReportingServices.Rendering.HPBProcessing.PageItem.CalculateVertical(PageContext pageContext, Double topInParentSystem, Double bottomInParentSystem, PageItem[] siblings, List`1 ancestors, Boolean& anyAncestorHasKT, Boolean hasUnpinnedAncestors, Nullable`1 sourceWidth)   
at Microsoft.ReportingServices.Rendering.HPBProcessing.ReportSection.NextPage(RPLWriter rplWriter, Int32 pageNumber, Int32 totalPages, Double top, Double availableHeight, ReportSection nextSection, Boolean isFirstSectionOnPage)   at Microsoft.ReportingServices.Rendering.HPBProcessing.Report.NextPage(RPLWriter rplWriter, Int32 totalPages)   
at Microsoft.ReportingServices.Rendering.HPBProcessing.HPBProcessing.GetNextPage(RPLReport& rplReport)   
at Microsoft.ReportingServices.Rendering.ImageRenderer.PDFRenderer.Render(Report report, NameValueCollection deviceInfo, Hashtable renderProperties, CreateAndRegisterStream createAndRegisterStream)   
at Microsoft.ReportingServices.Rendering.ImageRenderer.RendererBase.Render(Report report, NameValueCollection reportServerParameters, NameValueCollection deviceInfo, NameValueCollection clientCapabilities, Hashtable& renderProperties, CreateAndRegisterStream createAndRegisterStream)

is there any workaround to this?

Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: 'There is no data for the field at position N.'

Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: 'There is no data for the field at position N.'

The previous version of the report viewer in .NET Framework tolerated that, now having this constraint really does not help in porting hundreds of reports to .NET 5.0. Make it tolerable for not provided dataset fields, make a property with which we can make it tolerable for such issues.

Render PDF is not working as expected.

Hi,

Great work. I have an issue with the PDF rendering not working when running in Azure as an App Service. It works fine in Visual Studio on my desktop, but not in the App Service.

Any help with this would be greatly appreciated

Regards

Brian

roadmap

I'm generating PDFs using RDLC from a asp.net web api, and need to upgrade to asp.net core.
This project looks very interesting but the readme states that it isn't ready for production use.
In what ways isn't it ready, and do you have an estimate for when it might be?

Missing a dll in /lib/netcoreapp3.1

Hi, great work for doing this.
I reviewed the nuget package and found that the Microsoft.Reporting.WinForms.dll is missing, i did add a reference directly to that file in a sample project and just works.

Hope you get time to add that dll to the Nuget package, thanks in advance.

stream is null if the project type is mvc or api.

using var rs = Assembly.GetExecutingAssembly().GetManifestResourceStream("ReportViewerCore.Sample.AspNetCore.Reports.Report.rdlc");

this is working fine when razor pages, but not work when mvc.
Have any solution?

winforms .rdlc error client rendering on some report file (with colors) on project Dotnet5

i have alot of report viewer client (.rdlc) files.
after the patched u do yesterday, i can run the report viewer controls smoothly on my new dotnet5 winforms. thanks alot.
but after i refreshreport, error occured (not all rdlc files. but when the report contains COLORS).

an error occurred during client rendering. the type initializer for 'microsoft.reporting.winforms.gdicontext' threw an exception. could not find the resource "microsoft.reporting.winforms.interactivityimages.resources" among the resources ... etc.

i attached the error message here:

image

i can solved this problems by manually remove the ROWS and then manually type description and set COLORS. this problems goes away.

is it the limitation of the report viewer control on dotnet5? since the gdicontext is only support on windows, maybe. :p
any comment will be appreciated.

Failing to render images from RDLC for HTML

I have a RDLC file with a background image which successfully renders in a word, excel or pdf file. I'm playing with a conversion from html => pdf for possibly running on linux using dinktopdf. This works quite well apart for images (still testing on Windows btw) which don't render.

Using HTML4.0 and HTML5 the renderer is unable to render the image in the html file, everything else does render.

Looking into the file the src looks very strange, saying that I have little experience in how rdlc files encodes these I can't be sure its strange, only that its not rendering the image.

Any help would be greatly appreciated.

Error connecting to reporting server

Hi,
Firstly thanks a lot for your effort providing this package.

I´m using the nuget for Winforms (we are migrating an old WinForms solution to .NET 5), but I´m completely stuck when I try to connect to my reporting server calling "RepViewer.ServerReport.GetParameters()". I have amended of course the dll "System.Web.Services", but I receive the next error:


at System.Web.Services.Protocols.SoapClientType..ctor(Type type)
at System.Web.Services.Protocols.SoapHttpClientProtocol..ctor()
at Microsoft.Reporting.WinForms.Internal.Soap.ReportingServices2005.Execution.ReportExecutionService..ctor()
at Microsoft.Reporting.WinForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection..ctor(String reportServerLocation, EndpointVersion version)
at Microsoft.Reporting.WinForms.SoapReportExecutionService.ServerReportSoapProxy..ctor(WindowsIdentity impersonationUser, String reportServerLocation, IEnumerable1 headers, IEnumerable1 cookies, EndpointVersion version)
at Microsoft.Reporting.WinForms.SoapReportExecutionService.get_Service()
at Microsoft.Reporting.WinForms.SoapReportExecutionService.SetExecutionId(String executionId)
at Microsoft.Reporting.WinForms.ServerReport.ApplyExecutionIdToService(IReportExecutionService service)
at Microsoft.Reporting.WinForms.ServerReport.get_Service()
at Microsoft.Reporting.WinForms.ServerReport.EnsureExecutionSession()
at Microsoft.Reporting.WinForms.ServerReport.GetParameters()
at Sims.Win.Controls.frmReportViewer.RefreshReport(ICollection`1 param)

Any ideas?
Thanks in advance
Daniel Leiva

Subreport and Memory Issues

I recently moved to using this library for RDLC when moving from NET Framework to NET 5. In doing so, a memory leak issue has come back up that I need to address.

I had a piece of code that got around a memory leak issue when running lots of reports in a short period of time in NET Framework. It was:

LifetimeServices.LeaseTime = TimeSpan.FromSeconds(5);
LifetimeServices.LeaseManagerPollTime = TimeSpan.FromSeconds(5);
LifetimeServices.RenewOnCallTime = TimeSpan.FromSeconds(1);
LifetimeServices.SponsorshipTimeout = TimeSpan.FromSeconds(5);

The fix worked as a result of this thread:
https://www.codeproject.com/questions/636950/how-to-fix-memory-leak-in-microsoft-report-rdlc

I can't take this approach anymore in NET 5, and was wondering how you are using remoting (or not) in this implementation and how one might do the same approach.

I realize this is somewhat of a vague request/issue, but could absolutely use the help should anyone in this project be able to address it.

Report with Date parameters crashes + Fix

Hello, i've been testing my reports back and forth now.

I think i will keep a copy local on my comp for the moment as i would like to do some customizations in reportviewer that i would have wanted to do for AGES now.
Like removing Export to all crap not ever used, like TIFF, Web Archive, xml and so on. Leave only PDF / Excel / Word there.
Also print button you CANNOT configure to print Directly to a specific printer and so on

I discovered a bug and i've applied a quick fix for it. If your report has a date parameter it wants to show a datepicker
This crashes now in :
Namespace: Microsoft.Reporting.WinForms
File: TextBoxWithImage
Line: Image image = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream(imageResource));

After a quick investigation over manifest resources from the assembly, i've applied the current fix before calling the method:
imageResource = imageResource.Replace( ".Resources" , ".Resources.Resources" );

For some reason the resources are embedded with double resources folder, and they are accessed with only one.
This applies to All resources from there i think.
Mine particular was Resources.16cal.gif that tries to show a calendar icon.

Thank you again for your help regarding server side reports
Have a nice day

ReportViewerCore.NETCore Package Error

image

Hi I am installing ReportViewerCore.NETCore in my .NET Core application, above error occurred. My application target framework is .NET Core 3.1, Can you help me, please?

Also By this package Can we load SSRS report in report viewer?

Getting a slue of File not found errors around WCF and .NET Core 5

Could not load file or assembly 'System.ServiceModel.Primitives, Version=4.8.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

I installed the nuget package for the assembly above, then get one for System.ServiceModel.Http, Version=4.8.1.0

Guessing because core did away with WCF? I'll try and keep installing nuget packages and see what happens.

Need help with datasets

Is there a way to get the dataset query in a local report?
As an example:

select * from calls

image

Images with Source=External fails

If you add an image, and set the "source" property to external and reference a file path - it fails with the following error:

An unhandled exception occurred while processing the request.
ArgumentNullException: Value cannot be null. (Parameter 'encoder')
System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)

LocalProcessingException: An error occurred during local report processing.
Microsoft.Reporting.NETCore.LocalReport.InternalRender(string format, bool allowInternalRenderers, string deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, out Warning[] warnings)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.