Thanks to Fuji Nguyen excellent write up on how to compile and debug the Reports module source.
I have managed to track down the problem. Actually, it's two problems. One problem regarding the use of parameters in the reports module and another problem with exception logging.
When the search indexer calls the ReportsController.GetSearchItems() the parameter collection that is passed down to the DotNetNukeDataSource instance will be empty. If the query requires one or more parameters (@TabId in my case) the SQL will fail because of the missing parameter. An exception will be thrown from line 50 in DotNetNukeDataSource.vb.
When the exception is being logged the Message property in ReportsModuleException.vb will fail yet again and obscure the original exception message:
Public Overrides ReadOnly Property Message() As String
Get
Dim localized As String = String.Empty
If Not String.IsNullOrEmpty(_resourceFile) Then
localized = Localization.GetString(_resourceKey, _resourceFile)
Else
localized = Localization.GetString(_resourceKey)
End If
If _formatArgs IsNot Nothing AndAlso _formatArgs.Length > 0 Then
Return String.format(localized, _formatArgs) <-- localized Is Nothing!!
Else
Return localized
End If
End Get
End Property
Instance field values:
_resourceKey = "SqlError.Text"
_resourceFile = "/DataSources/DotNetNuke/App_LocalResources/DataSource.ascx.resx"
_formatArgs = {Length=2}
{0} = "1"
(1) = "Must declare the scalar variable "@TabId"."
The error reporting can't resolve the value for "SqlError.Text". Could it be the resource file name that is incorrect?
Can the missing parameters be added for the GetSearchItems() method also? I know @UserId must be set to Null, but the other parameters like @TabId, @PortalId and @ModuleId are known when the indexer is running.