SSRS contract class downcast setting null

Hi,

In the following code, the as operator is assigning a null value to myContract. I have checked everything but could not find anything much of help.



protected void preRunModifyContract()
{
MyContract myContract;
RecId tmpTableDataRecId;
;

tmpTableDataRecId = this.fetch();
myContract = this.parmReportContract().parmRdpContract() as MyContract;//setting null to the instance name
myContract.parmTmpTableDataRecId(tmpTableDataRecId);
myContract.parmDesignParam(#ReportName);
if(printDestinationSetting)
{
this.parmReportContract().parmPrintSettings(printDestinationSetting);
}

}



Since, myContract is set to null, the subsequent method calls fail.


protected void preRunModifyContract()
{
    MyContract           myContract;
    RecId                    tmpTableDataRecId;
    ;

    tmpTableDataRecId = this.fetch();
    myContract = this.parmReportContract().parmRdpContract() as MyContract;//setting null to the instance name
    myContract.parmTmpTableDataRecId(tmpTableDataRecId);
    myContract.parmDesignParam(#ReportName);
    if(printDestinationSetting)
    {
        this.parmReportContract().parmPrintSettings(printDestinationSetting);
    }

}

It means that parmReportContract() either returns null, or an instance of a type not compatible with MyContract. Please check the value and the type in debugger.

Hi,

This was weird, I asked a colleague to check it on his machine, and it started to work just fineā€¦ After my effort for the past two days.

Thank you Martin!