amh1979 / AspNetCore.Reporting

Reporting For .Net Core
26 stars 30 forks source link

Unable to get it working #3

Open dinonovak opened 5 years ago

dinonovak commented 5 years ago

am trying to execute the report in .net core API project

here is the code:

List <MileageItem> dsMileageItems = new List<MileageItem>();
MileageItem newItem = new MileageItem();
newItem.CreatedAt = DateTime.Now;
newItem.EntryTime = DateTime.Now;
newItem.Mileage = 100000;
newItem.Note = "NewNote";
dsMileageItems.Add(newItem);

LocalReport localReport = new LocalReport("TestReport1.rdlc");
localReport.AddDataSource("DataSource1", dsMileageItems);

var result = localReport.Execute(RenderType.Pdf, extension);

byte[] bytes = result.MainStream;

Stream stream = new MemoryStream(bytes);
stream.Position = 0;
return File(stream, "application/pdf", "Report.pdf");

But I am getting the following error:

An unhandled exception has occurred while executing the request. AspNetCore.Reporting.LocalProcessingException: An error occurred during local report processing.;The definition of the report 'TestReport1.rdlc' is invalid. An unexpected error occurred in Report Processing. 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 ---> AspNetCore.Reporting.DefinitionInvalidException: The definition of the report 'TestReport1.rdlc' is invalid. An unexpected error occurred in Report Processing. 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 ---> AspNetCore.ReportingServices.ReportProcessing.ReportProcessingException: An unexpected error occurred in Report Processing.

Any help would be appreciated.

RDLC is created in Visual Studio 2017 (as part of Windows Application project 4.6.1) RDLC Report Designer is 14.2 RDLC is connecting to Dataset (XSD) that has Table Adapter in it that is connected to SQL Server

This is from RDLC file `<?xml version="1.0" encoding="utf-8"?>

` Based on the above I presumed that this dataset could be represented by List in .net core. Project is running in Visual Studio on Mac
sheryever commented 5 years ago

We never move the stream cursor to position 0.

We uses the as below and never received any error.

List <MileageItem> dsMileageItems = new List<MileageItem>();
MileageItem newItem = new MileageItem();
newItem.CreatedAt = DateTime.Now;
newItem.EntryTime = DateTime.Now;
newItem.Mileage = 100000;
newItem.Note = "NewNote";
dsMileageItems.Add(newItem);

LocalReport localReport = new LocalReport("TestReport1.rdlc");
localReport.AddDataSource("DataSource1", dsMileageItems);

var result = localReport.Execute(RenderType.Pdf, extension);

return File(result.MainStream, "application/pdf", "Report.pdf");

Are you referencing System.Drawing.Common in your project?

We use Microsoft ReportBuilder 2016, It is simple application.

gokujax commented 4 years ago

I got the same error after publishing a release of my website to the production server. An error occurred during local report processing.;The definition of the report 'SummaryReport.rdlc' is invalid. An unexpected error occurred while compiling expressions. Native compiler return value: ‘[BC30560] 'GeneratedCodeAttribute' is ambiguous in the namespace 'System.CodeDom.Compiler'.’.

gokujax commented 4 years ago

The problem was the expressions. Don't use expression for calculation, show/hide controls, etc... Make your calculation in your app code behind and pass the result to a field Use this field in the control that will display the calculation result in the report That's the way I did to make it work for release till the package fully complete.

dinonovak commented 4 years ago

any fix suggested for: [BC30560] 'GeneratedCodeAttribute' is ambiguous in the namespace 'System.CodeDom.Compiler'. issue.

RDLC generation works on development machine, but when published on production server above error is generated

gokujax commented 4 years ago

Make sure you installed "System.CodeDom" from Nuget and also "System.Data.SqlClient" then republish again to the production server.

dinonovak commented 4 years ago

Both nugets are included, but I am using expressions in report, no way to avoid them, so I susupect this could be issue. Any idea why expressions are such an issue?

gokujax commented 4 years ago

yes it's an issue

AmirImam commented 3 years ago

I have the same error .Net core 3.1 API Any help ?

elmoslem commented 3 years ago

Any Help PLease : AspNetCore.Reporting.LocalProcessingException: 'An error occurred during local report processing.;An unexpected error occurred in Report Processing. Index was outside the bounds of the array.'

sheryever commented 3 years ago

@AmirImam and @elmoslem

Check this rdlc-report-in-dotnet-core repository.

I have used the WCF service which is using the WebForms ReportViewer Control to "generate" the report. "I am not showing the report in the viewer but exporting report as PDF, Excel, Word etc"

This solution is much easier than all "available workarounds" specially when you are generating the report data in C #.

And you can also use the same solution for database data sources as WebForms ReportViewer will execute your report.

You can utilize all the feature which are supported WebForms ReportViewer control which mean all most all the feature

italoaguiar commented 3 years ago

Same problem here. It works locally but when deployed in azure it gives an error. [BC30560] 'GeneratedCodeAttribute' is ambiguous in the 'System.CodeDom.Compiler' namespace.

I found this alternative repository and it worked perfectly for me https://github.com/lkosson/reportviewercore

elmoslem commented 3 years ago

@AmirImam i need Solve the problem , i used asp.net core reportibg rdlc

AmirImam commented 3 years ago

@elmoslem Yes me too. Didn't found any thing useful. I am still using WebForms project to display reports

augustovandyk commented 3 years ago

Same problem here. It works locally but when deployed in azure it gives an error. [BC30560] 'GeneratedCodeAttribute' is ambiguous in the 'System.CodeDom.Compiler' namespace.

I found this alternative repository and it worked perfectly for me https://github.com/lkosson/reportviewercore

This was the answer to our problems. Thanks!

miguelangelflores1983 commented 3 years ago

Both nugets are included, but I am using expressions in report, no way to avoid them, so I susupect this could be issue. Any idea why expressions are such an issue?

I have the same problem, you found the solution?