Catia API Usage

Hi ,
I am a novice Catia user, currently working on the MECMOD and INFIT C# APIs
I am trying to create a drawing document through the code .

Every time this statement :
ProductStructureTypeLib.Product Prd = (ProductStructureTypeLib.Product)DrwGenBeh.Document ;

throws this error in Visual Studio:
"Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))"

Does anybody know what could be the resolution here?

Thanks.