Report source cannot be processed Exception Occured

3 posts, 0 answers
  1. Software
    Software avatar
    9 posts
    Member since:
    Mar 2017

    Posted 09 Jan Link to this post

    Hi Telerik, I am creating Telerik Report using Telerik REST Services. I created my report and now I want to use it in my company project. For that I created reference of Reporting project to my Company' Project and called the Constructor of Report. Here is code for that:

    string ReportsPath = @"C:\ReportsDownload";
    string reportFileName = String.Format("FormReport-{0}.pdf", frm);
    string reportWebPath = String.Format("/Reports/{0}", reportFileName);
    var formReport = new AQSRestServiceObject.AQSReport(); // Calling Report Constructor 
    formReport.ReportParameters["FormNumber"].Value = 12476;
    var processor = new ReportProcessor();
    var result = processor.RenderReport("PDF", formReport, null);
    using (var pdfStream = new MemoryStream(result.DocumentBytes))

    using (var reportFile = new FileStream(Path.Combine(ReportsPath, reportFileName), FileMode.Create))
          {
              pdfStream.CopyTo(reportFile);
           }

    As you can see above I am having FormNumber as parameter for my Report and it is coming by objectDataSource. When I run my project I get an exception and I need help to solve it.
    Here is an Exception: 
    System.InvalidOperationException: The view 'An error occured while evaluating the report parameters. Report source cannot be processed.' or its master was not found or no view engine supports the searched locations. The following locations were searched:
    ~/Views/Home/An error occured while evaluating the report parameters. Report source cannot be processed..aspx
    ~/Views/Home/An error occured while evaluating the report parameters. Report source cannot be processed..ascx
    ~/Views/Shared/An error occured while evaluating the report parameters. Report source cannot be processed..aspx
    ~/Views/Shared/An error occured while evaluating the report parameters. Report source cannot be processed..ascx
    ~/Views/Home/An error occured while evaluating the report parameters. Report source cannot be processed..cshtml
    ~/Views/Home/An error occured while evaluating the report parameters. Report source cannot be processed..vbhtml
    ~/Views/Shared/An error occured while evaluating the report parameters. Report source cannot be processed..cshtml
    ~/Views/Shared/An error occured while evaluating the report parameters. Report source cannot be processed..vbhtml

    SourceControl Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

     

    Here is my ReportController Paths:
    var appPath = HttpContext.Current.Server.MapPath("~/AQSReport");
    var reportsPath = Path.Combine(appPath, "Reports");

     

    Can anyone please help me to solve this exception.?

  2. Software
    Software avatar
    9 posts
    Member since:
    Mar 2017

    Posted 09 Jan Link to this post

    If I use following code then I get new error

    Telerik.Reporting.TypeReportSource typeReportSource = new Telerik.Reporting.TypeReportSource();
    typeReportSource.TypeName = typeof(AQSReport).AssemblyQualifiedName;
    typeReportSource.Parameters["FormNumber"].Value = frm;
    var result = processor.RenderReport("PDF", typeReportSource, null);

    Error:

    [InvalidOperationException: The view 'Object reference not set to an instance of an object.' or its master was not found or no view engine supports the searched locations. The following locations were searched: ~/Views/Home/Object reference not set to an instance of an object..aspx ~/Views/Home/Object reference not set to an instance of an object..ascx ~/Views/Shared/Object reference not set to an instance of an object..aspx ~/Views/Shared/Object reference not set to an instance of an object..ascx ~/Views/Home/Object reference not set to an instance of an object..cshtml ~/Views/Home/Object reference not set to an instance of an object..vbhtml ~/Views/Shared/Object reference not set to an instance of an object..cshtml ~/Views/Shared/Object reference not set to an instance of an object..vbhtml] System.Web.Mvc.ViewResult.FindView(ControllerContext context) +499 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +143 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +88 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +831 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +81 System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +185 System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38 System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29 System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +65 System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52 System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +36 System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38 System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +43 System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +65 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +607 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +134

  3. Todor
    Admin
    Todor avatar
    18 posts

    Posted 12 Jan Link to this post

    Hi,

    Going through the error, I assume that a string parameter is returned by a Home controller action (as View name). However, instead of the correct View name, the corresponding string parameter receives an exception message as a value. Hence, a View with the specified name (the error message) cannot be found.

    The information is not sufficient for locating the problem. I suggest you to open a support ticket and attach the project (runnable), so that we can investigate it locally and try to give you an appropriate advice.

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