I am in the process of restoring some reports. To do this I had to grab and re-create the RDL files with the method here: Where does a published RDL file sit.
I am taking the output from the query in that other thread, save results as (as one commenter noted that you might not get all of the data otherwise), then opening it in a text editor to strip out some junk characters at the beginning, and replacing two double quotes in a row with one double quote, then uploading the RDL file to the report server.
This has been working so far for reports without any custom functions - however, once I got to a report with SumLookup and AvgLookup functions, I get the following error:
An error has occurred.
An unexpected error occurred while compiling expressions. Native compiler return value: '[BC42353] Function 'AvgLookup' doesn't return a value on all code paths. Are you missing a 'Return' statement?'.
The original AvgLookup function which I googled before and has been working fine up until now is:
Function AvgLookup(ByVal items As Object()) As Decimal
If items Is Nothing Then
    Return Nothing
End If
Dim suma As Decimal = 0
Dim avga As Decimal = 0
Dim counta As Integer = 0
For Each item As Object In items
    If Not item Is Nothing Then
    counta += 1
    suma += Convert.ToDecimal(item)
    End If
Next
If counta > 0 Then
    avga = suma / counta
Else
    avga = 0
End If
Return avga
End Function
I tried replacing this with a simple function that simply returns 1:
Function AvgLookup(ByVal items As Object()) As Decimal
Return 1
End Function
But this gives me the same error.
Everything I have searched for so far seems to involve a function which actually doesn't always have a return value, so I am at a bit of a loss that the simple "Return 1" function gives the same error.
All I can think to do is delete all custom code from the RDL files as well as any references to those functions and then replace them after uploading. Is there possibly another solution?