MS Winforms Reportviewer control in local mode causes
Overload resolution failed error
To reproduce:
1. In C# create Code module :
public class Util {
public static bool Empty(int nValue) {
return (nValue == 0);
}
}
2. In report hidden expression call use this function with integer field parameter like
=Util.Empty(Fields!myintegerfield.Value))
Observed:
Error shown below.
How to force ReportViewer to call my function ?
Should I use some attribute in method declaration ?
Microsoft.Reporting.WinForms.LocalProcessingException: An error occurred during local report processing. ---> Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: The Hidden expression for the textbox ‘Textbox23’ contains an error: Overload resolution failed because no Public 'Empty' is most specific for these arguments:
'Public Shared Function Empty(nValue As Integer) As Boolean':
Not most specific.
at Microsoft.ReportingServices.ReportProcessing.ReportRuntime.RegisterRuntimeErrorInExpression(VariantResult& result, Exception e, IErrorContext iErrorContext, Boolean isError)
at Microsoft.ReportingServices.ReportProcessing.ReportRuntime.EvaluateStartHiddenExpression(Visibility visibility, IVisibilityHiddenExprHost hiddenExprHostRI, ObjectType objectType, String objectName)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ProcessingContext.ProcessReceiver(Int32 uniqueName, Visibility visibility, IVisibilityHiddenExprHost visibilityExprHostRI, ObjectType objectType, String objectName)
at Microsoft.ReportingServices.ReportProcessing.ReportItemInstanceInfo.Microsoft.ReportingServices.ReportProcessing.IShowHideReceiver.ProcessReceiver(ProcessingContext context, Int32 uniqueName)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RuntimeRICollection.EvalReportItemAttr(ReportItem reportItem, ReportItemInstance riInstance, ReportItemInstanceInfo riInstanceInfo, ProcessingContext processingContext)
at Microsoft.ReportingServices.ReportProcessing.ReportItemInstanceInfo.ConstructorHelper(ProcessingContext pc, ReportItem reportItemDef, ReportItemInstance owner)
at Microsoft.ReportingServices.ReportProcessing.ReportItemInstanceInfo..ctor(ProcessingContext pc, ReportItem reportItemDef, ReportItemInstance owner, Int32 index)
at Microsoft.ReportingServices.ReportProcessing.TextBoxInstance..ctor(ProcessingContext pc, TextBox reportItemDef, Int32 index)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RuntimeRICollection.CreateTextBoxInstance(TextBox textBox, ProcessingContext processingContext, Int32 index, IScope containingScope)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RuntimeRICollection.CreateInstance(ReportItem reportItem, Boolean setupEnvironment, Int32 index)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RuntimeRICollection.CreateInstances(ReportItemColInstance collectionInstance, ReportItemCollection reportItemsDef)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RuntimeRICollection.CreateInstance(ReportItem reportItem, Boolean setupEnvironment, Int32 index)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RuntimeRICollection.CreateInstances(ReportItemColInstance collectionInstance, ReportItemCollection reportItemsDef)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RuntimeRICollection.CreateInstances(ReportItemColInstance collectionInstance, Boolean ignorePageBreaks, Boolean ignoreInstances)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RuntimeTableObj.CreateRowInstances(ProcessingContext processingContext, RuntimeRICollectionList rowRICols, TableRowInstance[] rowInstances, Boolean repeatOnNewPages, Boolean enterGrouping)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RuntimeTableGroupLeafObj.CreateInstance()
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RuntimeGroupLeafObj.Traverse(ProcessingStages operation)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RuntimeGroupLeafObj.TraverseAllLeafNodes(ProcessingStages operation)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RuntimeGroupingObj.Traverse(ProcessingStages operation, Boolean ascending)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RuntimeGroupRootObj.CreateInstances(ReportItemInstance riInstance, IList instanceList, RenderingPagesRangesList pagesList)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RuntimeTableObj.CreateInstances(ReportItemInstance riInstance, IList instanceList, RenderingPagesRangesList pagesList)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RuntimeRICollection.CreateInstance(ReportItem reportItem, Boolean setupEnvironment, Int32 index)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RuntimeRICollection.CreateInstances(ReportItemColInstance collectionInstance, ReportItemCollection reportItemsDef)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.Merge.CreateInstances(ParameterInfoCollection parameters, Boolean noRows)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.Merge.Process(ParameterInfoCollection parameters, Boolean mergeTran)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ProcessReport(Report report, ProcessingContext pc, ProcessingContext context)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ProcessReport(Report report, ProcessingContext pc, Boolean snapshotProcessing, Boolean processWithCachedData, GetReportChunk getChunkCallback, ErrorContext errorContext, DateTime executionTime, CreateReportChunk cacheDataCallback, ProcessingContext& context)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RenderReport(IRenderingExtension renderer, DateTime executionTimeStamp, GetReportChunk getCompiledDefinitionCallback, ProcessingContext pc, RenderingContext rc, CreateReportChunk cacheDataCallback, Boolean& dataCached)
at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RenderReport(IRenderingExtension renderer, DateTime executionTimeStamp, GetReportChunk getCompiledDefinitionCallback, ProcessingContext pc, RenderingContext rc)
at Microsoft.Reporting.LocalService.RenderWithDataCache(PreviewItemContext itemContext, ParameterInfoCollection reportParameters, IEnumerable dataSources, DatasourceCredentialsCollection credentials, IRenderingExtension renderer, ReportProcessing repProc, CreateAndRegisterStream createStreamCallback, ReportRuntimeSetup runtimeSetup)
at Microsoft.Reporting.LocalService.Render(PreviewItemContext itemContext, Boolean allowInternalRenderers, ParameterInfoCollection reportParameters, IEnumerable dataSources, DatasourceCredentialsCollection credentials, CreateAndRegisterStream createStreamCallback, ReportRuntimeSetup runtimeSetup, ProcessingMessageList& warnings)
at Microsoft.Reporting.WinForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, CreateAndRegisterStream createStreamCallback, Warning[]& warnings)
--- End of inner exception stack trace ---
at Microsoft.Reporting.WinForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, CreateAndRegisterStream createStreamCallback, Warning[]& warnings)
at Microsoft.Reporting.WinForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings)
at Microsoft.Reporting.WinForms.ProcessingThread.ProcessThreadMain(Object arg)
Andrus