Page 1 of 1

Console errors in DesignerScripts

Posted: Thu Feb 14, 2019 3:38 pm
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 4190 times

Re: Console errors in DesignerScripts

Posted: Fri Feb 15, 2019 8:46 am
by Lech Kulikowski
Hello,

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

Thank you.

Re: Console errors in DesignerScripts

Posted: Fri Feb 15, 2019 2:18 pm
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 4175 times

Re: Console errors in DesignerScripts

Posted: Fri Feb 15, 2019 5:28 pm
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.

Re: Console errors in DesignerScripts

Posted: Mon May 06, 2019 1:07 pm
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.

Re: Console errors in DesignerScripts

Posted: Mon May 06, 2019 2:15 pm
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?

Re: Console errors in DesignerScripts

Posted: Tue May 07, 2019 4:40 pm
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 308 times

Re: Console errors in DesignerScripts

Posted: Tue May 07, 2019 6:27 pm
by shadowkras
The problem is very similar to what was reported on this other thread.

Re: Console errors in DesignerScripts

Posted: Sat May 11, 2019 12:10 pm
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