This is a migrated thread and some comments may be shown as answers.

PictureBox can not display image when hosting on linux

4 Answers 241 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
sky
Top achievements
Rank 1
sky asked on 17 Dec 2020, 07:26 AM

 

Request URL:
http://localhost:5011/api/reports/clients/a424ed34405/parameters

Response error:

{
    "message": "An error has occurred.",
    "exceptionMessage": "Invalid report type",
    "exceptionType": "System.ArgumentException",
    "stackTrace": "   at Telerik.Reporting.Processing.TypeReportDocumentResolver.Resolve(IProcessingContext context, TypeReportSource rs)\n   
at Telerik.Reporting.Processing.ReportDocumentResolver`1.Telerik.Reporting.Processing.IReportDocumentResolver.Resolve(IProcessingContext context, ReportSource rs)\n   
at Telerik.Reporting.Processing.ReportDocumentResolver.<>c__DisplayClass0_0.<Resolve>b__0(IReportDocumentResolver r)\n   
at Telerik.Reporting.Processing.ReportDocumentResolver.Bind[T](IProcessingContext context, ReportSource source, Func`2 func)\n   
at Telerik.Reporting.Processing.ReportDocumentResolver.Resolve(IProcessingContext context, ReportSource source)\n   
at Telerik.Reporting.Processing.ResolvedReportDocument.ResolveReportsRecursively(ReportSource rs, IProcessingContext context, IDictionary`2 parentRsParameters, Boolean parentShouldDispose, List`1 result, IReportDocument& definition, ResolvedReport& tocReport, ReportBookTocPosition& tocReportPosition)\n   
at Telerik.Reporting.Processing.ResolvedReportDocument.Create(ReportSource rs, IProcessingContext context)\n   
at Telerik.Reporting.Processing.DocumentParametersManager`1..ctor(ReportSource definition, IProcessingContext processingContext, IParameterValueParser parameterValueParser)\n   
at Telerik.Reporting.Processing.DocumentParametersManager..ctor(ReportSource rs, IProcessingContext processingContext, IParameterValueParser parameterValueParser)\n   
at Telerik.Reporting.Services.Engine.ReportEngine.GetParameters(String clientID, String report, Dictionary`2 parameterValues)\n   
at Telerik.Reporting.Services.AspNetCore.ReportsControllerBase.GetParameters(String clientID, ClientReportSource reportSource)\n   
at lambda_method(Closure , Object , Object[] )\n   
at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)\n   
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\n   
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()\n   
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\n   
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()\n--- End of stack trace from previous location where exception was thrown ---\n   
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\n   
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\n   
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()\n--- End of stack trace from previous location where exception was thrown ---\n   
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)"
}


4 Answers, 1 is accepted

Sort by
0
sky
Top achievements
Rank 1
answered on 17 Dec 2020, 07:35 AM

PictureBox display correct when app hosting on windows 10, but hosting on Linux or docker, throw exception.

AllowSynchronousIO value already has been set to true.

Program.cs

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseKestrel(options =>
                    {
                        options.AllowSynchronousIO = true;
                    });

                    webBuilder.UseStartup<Startup>();
                });

 

Startup.cs

            services.Configure<KestrelServerOptions>(options =>
            {
                options.AllowSynchronousIO = true;
            });

0
sky
Top achievements
Rank 1
answered on 17 Dec 2020, 07:47 AM
The picture Settings are shown in the attachment.
0
Mads
Telerik team
answered on 22 Dec 2020, 08:59 AM

Hi,

I am sorry to hear you are having issues.

Based on the Request-URL you sent I believe you are using one of the HTML5 based viewers with Report REST Service. And because you have Startup.cs and Program.cs I believe you are using .NET Core. In the posted stack-trace, GetParameters is called which is the first call from the Viewer to the REST Service which actually resolves the report. And in this first attempt at resolving the report, the exception is thrown. 

In the title of this thread, you mention the issue is the PictureBox is not being displayed on Linux, while the error is saying it's struggling to resolve the report. Can I ask what makes you sure that the PictureBox is the cause? Does it work with Reports that do not have pictures?

The Reporting engine relies on the GDI+ API which is available on the Windows OS. On Linux our codebase relies on a GDI+ replacement called libgdiplus. It doesn't provide the same functionality and in some cases, the rendering it provides is different than the rendering on Windows. I believe this could be a cause of the issue, as this library is being used for certain things when the report is being resolved. You can check the small snippet here that shows how to add it to your dockerfile.

Unfortunately, the available information is not sufficient to locate the exact problem. I suggest attaching a Trace Listener to the application that runs on Linux. Our code should log more details about the problem and hopefully let us diagnose the issue.

Regards, Mads Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
sky
Top achievements
Rank 1
answered on 28 Dec 2020, 06:45 AM

thanks!

when i ues expression binding for PictureBox value, the problem was resolved.

Value = "./resources/reportheader.png"

 

Tags
General Discussions
Asked by
sky
Top achievements
Rank 1
Answers by
sky
Top achievements
Rank 1
Mads
Telerik team
Share this question
or