Unable to Upload the RDL to PowerBI portal via POST method

Rajesh 21 Reputation points
2021-09-19T18:42:57.64+00:00

Hello Team,

We are unable to upload a paginated report that has simple custom code to the PowerBI portal using the POST Method (Powershell script).

![133364-image.png][1]

The below is the compilation error we are getting while trying to upload the rdl file.

           **Report is invalid. ErrorCode: rsUnexpectedCompilerError, Details: An unexpected error occurred while compiling expressions. Native compiler return value: [BC42105] Function TestFun doesnt return a value on all code paths. A null reference exception could occur at run time when the result is used..**

To reproduce the issue we have tried with simple report that has below custom code.

Custom Code:
Public Function TestFun() As String
Return "hi"
End Function

We are using the below url to post the rdl file.

https://api.powerbi.com/v1.0/myorg/groups/$GroupId/imports?datasetDisplayName=$fileName&nameConflict

Is there any way to skip the compilation error and continue the upload ?

Thanks

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,163 questions
SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,951 questions
0 comments No comments
{count} votes

Accepted answer
  1. Joyzhao-MSFT 15,601 Reputation points
    2021-09-20T03:07:56.537+00:00

    Hi @Rajesh ,
    This is a pretty standard/vague error. You might try checking the Reports error log.
    Native mode report server
    APPLIES TO: ✔️ SQL Server Reporting Services (2016)
    C:\Program Files\Microsoft SQL Server\MSRS13.MSSQLSERVER\Reporting Services\ReportServer

    APPLIES TO: ✔️ SQL Server Reporting Services (2017 and later)
    C:\Program Files\Microsoft SQL Server Reporting Services\SSRS\ReportServer

    APPLIES TO: ✔️ Power BI Report Server
    C:\Program Files\Microsoft Power BI Report Server\PBIRS\ReportServer

    For PowerBI related issues, we recommend that you initiate an inquiry on the relevant forum: Microsoft Power BI Community.
    Best Regards,
    Joy


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1 additional answer

Sort by: Most helpful
  1. Rajesh 21 Reputation points
    2021-09-20T06:18:37.68+00:00

    Thanks for the reply.

    Based on the Sample Function it actually returned all path still we are getting the same issue.

    Just checking if we have to make any changes in RDL function so that we can upload it without errors via POST method.

    Thanks


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.