Console errors in DesignerScripts

Stimulsoft Reports.WEB discussion
Post Reply
shadowkras
Posts: 27
Joined: Wed Jan 30, 2013 10:53 am
Location: Cuiabá/Mato Grosso - Brazil

Console errors in DesignerScripts

Post by shadowkras »

These show up on version 2019.2.1, and, apparently, are harmless, but you never know.
stimulerror.png
stimulerror.png (12.78 KiB) Viewed 3158 times
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Console errors in DesignerScripts

Post by Lech Kulikowski »

Hello,

Please send us a simple project which reproduces the issue for analysis.

Thank you.
shadowkras
Posts: 27
Joined: Wed Jan 30, 2013 10:53 am
Location: Cuiabá/Mato Grosso - Brazil

Re: Console errors in DesignerScripts

Post by shadowkras »

More errors, this time I noticed that I cannot use the preview tab of the designer.
The project is the asp.Net Core version 2019.2.1 using a controller to implement the report methods (DesignReport, GetReport, GetReportDesigner, etc).
While the views are created using Html.StiNetCoreViewer and Html.StiNetCoreDesigner Razor methods.

This is from an update from version 2018.3.2 to 2019.2.1.

stimulerror2.png
stimulerror2.png (32.04 KiB) Viewed 3143 times
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Console errors in DesignerScripts

Post by Lech Kulikowski »

Hello,

We couldn't reproduce the issue on our samples.
Please send us a simple project which reproduces the issue for analysis.

Thank you.
shadowkras
Posts: 27
Joined: Wed Jan 30, 2013 10:53 am
Location: Cuiabá/Mato Grosso - Brazil

Re: Console errors in DesignerScripts

Post by shadowkras »

This is the generated html: https://pastebin.com/XMCvGUfn
Apparently, it's missing the script that defines StiJsViewer somehow.

It was generated using this code: https://pastebin.com/DAFVuWu7

Which was loaded using this action:

Code: Select all

public IActionResult ViewReport()
{
    try
    {
        var viewModel = new RelatorioViewModel('Test', 1);//This is merely a view model to pass debugging arguments to the view
        return View("~/Views/Shared/Stimul/Viewer.cshtml", viewModel);
    }
    catch (Exception Ex)
    {
        throw Ex;
    }
}
I also noticed that the sample projects (source) are using JQuery 2.2, while my project is updated to 3.2.
shadowkras
Posts: 27
Joined: Wed Jan 30, 2013 10:53 am
Location: Cuiabá/Mato Grosso - Brazil

Re: Console errors in DesignerScripts

Post by shadowkras »

After a few more tests today, I figured the cause of the issue.

Code: Select all

<script type="text/javascript" src="/GrupoImpressao/ViewerEvent/Fabrica/Cadastro?&stiweb_component=Viewer&stiweb_action=Resource&stiweb_data=scripts&stiweb_theme=Office2013WhiteBlue&stiweb_cachemode=cache&stiweb_version=2019.2.3"></script>
The src here is using the url for this report instead of the url for the StiJsViewer, which fails to load because there is nothing in that url.

This is my url for that viewer:

Code: Select all

/Fabrica/Cadastro/GrupoImpressao/ViewReport
As you can see, the order of routes is messed up:

Code: Select all

/GrupoImpressao/ViewerEvent/Fabrica/Cadastro?
This is my ViewEvent action, if relevant:

Code: Select all

        public IActionResult ViewerEvent()
        {
            return StiNetCoreViewer.ViewerEventResult(this);
        }
Why is it creating that url? What should be the src there instead? How do I fix that?
shadowkras
Posts: 27
Joined: Wed Jan 30, 2013 10:53 am
Location: Cuiabá/Mato Grosso - Brazil

Re: Console errors in DesignerScripts

Post by shadowkras »

I created a copy of the sample project and tried to reproduce the issue. I discovered that this happens due to routing. When a controller has an Area and calls an inherited action instead of using RedirectToAction, the GetReport method will mess up the route when writing that URL.

This works:

Code: Select all

    [Area("MyArea")]
    public class ViewerWithoutErrorController : ViewerController
    {
        static ViewerWithoutErrorController()
        { }

        [Route("IndexRedirect")]
        public IActionResult IndexRedirect()
        {
            return RedirectToAction(nameof(Index));
        }
    }
This causes the error:

Code: Select all

    [Area("MyArea")]
    public class ViewerErrorController : ViewerController
    {
        static ViewerErrorController()
        { }

        [Route("IndexError")]
        public IActionResult IndexError(string id)
        {
            return this.Index(id);
        }
    }
Here is a sample project with the necessary modifications to make the error happen:
Show Report in the Viewer.zip
(1.23 MiB) Downloaded 193 times
shadowkras
Posts: 27
Joined: Wed Jan 30, 2013 10:53 am
Location: Cuiabá/Mato Grosso - Brazil

Re: Console errors in DesignerScripts

Post by shadowkras »

The problem is very similar to what was reported on this other thread.
Lech Kulikowski
Posts: 6245
Joined: Tue Mar 20, 2018 5:34 am

Re: Console errors in DesignerScripts

Post by Lech Kulikowski »

Hello,

Thank you for the detailed description. We need some to investigate the issue. We will let you know about the result.

Thank you.
#8275
Post Reply