PictureBox and CheckBox not display

7 posts, 0 answers
  1. Louis
    Louis avatar
    85 posts
    Member since:
    Jun 2011

    Posted 28 Sep Link to this post

    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? 

  2. Todor
    Admin
    Todor avatar
    397 posts

    Posted 02 Oct Link to this post

    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
  3. Marcin
    Marcin avatar
    190 posts
    Member since:
    Jan 2011

    Posted 24 Oct Link to this post

    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?

     

  4. Marcin
    Marcin avatar
    190 posts
    Member since:
    Jan 2011

    Posted 24 Oct in reply to Marcin Link to this post

    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

     

  5. Todor
    Admin
    Todor avatar
    397 posts

    Posted 29 Oct Link to this post

    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
  6. Marcin
    Marcin avatar
    190 posts
    Member since:
    Jan 2011

    Posted 12 Nov Link to this post

    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);
           }
  7. Ivan Hristov
    Admin
    Ivan Hristov avatar
    210 posts

    Posted 15 Nov Link to this post

    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
Back to Top