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

PictureBox and CheckBox not display

6 Answers 141 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Louis
Top achievements
Rank 1
Iron
Iron
Iron
Louis asked on 29 Sep 2019, 01:56 AM

Hello,

I have a regular report in my asp.net core 2.2 with 1 picturebox and 3 checkboxs. Works #1.

I create a new asp.net core 3.0 (copying everything from 2.2).  My picturebox and the 3 squares of the checkboxs (but the labels are ok) are not anymore display in the reportViewer (javascript).  When i generate a PDF version everthing worked.

Telerik.Reporting v13.2.19.920-hotfix (same problem with 13.2.19.918)
Telerik.Reporting.Services.AspNetCore  v13.2.19.920-hotfix (same problem with 13.2.19.918)

Any idea? 

6 Answers, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 02 Oct 2019, 03:05 PM

Hi Louis,

I noticed that you opened a support ticket on the same issue. I will summarize our communication also here for the benefit of our community.

The exception message associated with the problem is "Synchronous operations are disallowed. Call WriteAsync or set AllowSynchronousIO to true instead". The problem is described in the .Net Core 3 preview: Synchronous operations are disallowed Stackoverflow thread. The solution can be found in the same thread. You need to manually set AllowSynchronousIO to true in Startup.cs file for IIS. The ConfigureServices class may look like:

 

public void ConfigureServices(IServiceCollection services)
{
    this.services = services;
    this.services.Configure<CookiePolicyOptions>(options =>
    {
        // This lambda determines whether user consent for non-essential cookies is needed for a given request.
        options.CheckConsentNeeded = context => true;
        options.MinimumSameSitePolicy = SameSiteMode.None;
    });
    services.Configure<IISServerOptions>(options =>
    {
        options.AllowSynchronousIO = true;
    });
    this.services.AddSingleton<ConfigurationService>();
    this.services.AddRazorPages()
        .AddNewtonsoftJson();
}

 

For Kestrel you need to use the following code:

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
     WebHost.CreateDefaultBuilder(args)
         .UseStartup<Startup>()
         .ConfigureKestrel((context, options) =>
         {
             options.AllowSynchronousIO = true;
         })

 

Regards,
Todor
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Marcin
Top achievements
Rank 1
Veteran
answered on 24 Oct 2019, 01:15 PM

Synchronouse API. As docs says:

> AllowSynchronousIO enables or disables synchronous IO APIs, such as HttpRequest.Body.Read, HttpResponse.Body.Write, and Stream.Flush. These APIs are a source of thread starvation leading to app crashes.

Do you have any plans to use await WriteAsync instead of Write in Reporting code?

 

0
Marcin
Top achievements
Rank 1
Veteran
answered on 24 Oct 2019, 01:21 PM

The simple change

public virtual void GetResource

to 

public virtual async Task GetResource

await this.Response.Body.WriteAsync

or

public virtual Task GetResource

return this.Response.Body.WriteAsync

 

0
Todor
Telerik team
answered on 29 Oct 2019, 11:01 AM

Hi Marcin,

Thank you for the suggestion. We will discuss it in the team whether it is appropriate and possible to make the requests for the resources asynchronous.

Regards,
Todor
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Marcin
Top achievements
Rank 1
Veteran
answered on 12 Nov 2019, 09:14 AM

I simply overriden 1 method in class inheriting from ReportsControllerBase and all is working without enabling SychronousIO:

/// <summary>
       /// </summary>
       [AllowAnonymous]
       [HttpGet("old/clients/{clientID}/instances/{instanceID}/documents/{documentID}/resources/{resourceID}")]
       public override void GetResource(string clientId, string instanceId, string documentId, string resourceId)
       {
           base.GetResource(clientId, instanceId, documentId, resourceId);
       }
 
       /// <summary>
       /// </summary>
       [AllowAnonymous]
       [HttpGet("clients/{clientID}/instances/{instanceID}/documents/{documentID}/resources/{resourceID}")]
       public async Task GetResourceAsync(string clientId, string instanceId, string documentId, string resourceId)
       {
           var propertyInfo = typeof(ReportsControllerBase).GetProperties(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly).Single(p => p.Name == "Engine");
 
           var engine = (IReportEngine)propertyInfo.GetValue(this);
 
           var resource =
               engine.GetResource(clientId, instanceId, documentId, resourceId);
 
           var data = resource.Bytes;
 
           await this.Response.Body.WriteAsync(data, 0, data.Length);
       }
0
Ivan Hristov
Telerik team
answered on 15 Nov 2019, 08:26 AM

Hi Marcin,

Thank you for your efforts and provided solution for obtaining the resources asynchronously. You are right - it seems pointless to keep using the synchronous operations when async ones are available. Although the problem arises only when using .NET Core 3, I believe it makes sense to change it for all the frameworks after proper testing. Your suggestion is already logged for discussion and implementation. Since we highly appreciate ideas that help you further develop our product, as a token of gratitude we updated your Telerik points.

Regards,
Ivan Hristov
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Louis
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Todor
Telerik team
Marcin
Top achievements
Rank 1
Veteran
Ivan Hristov
Telerik team
Share this question
or