I have a table with blob field and some others as well. I am trying to read blob field and save it to file using IBlobStream, and the thing compiles. The problem comes up in run-time, when calling blobStream.SaveToFile() method, saying:

'object' does not contain a definition for 'SaveToFile'

the following code:

int blobFieldID= table.Fields.FindField("MODEL_NAME");
int nameFieldID= table.Fields.FindField("MODEL");
ICursor cursor = table.Search(null, true);
IRow row = cursor.NextRow();
while (row != null)
    IBlobStream blobStream = (IBlobStream)row.get_Value(blobFieldID);
    blobStream.SaveToFile(@"C:\TEMP\" + row.get_Value(nameFieldID) + ".tbx"); //error
    row = cursor.NextRow();

When i hover mouse over SaveToFile method it says:

(dynamic expression)
This operation will be resolved at runtime

I can't figure out what's the problem in here

  • Hi, is this sample running on such as console application? – Darksanta Apr 16 '13 at 14:04
  • @Darksanta No, It is an action on button click - ESRI.ArcGIS.SystemUI.ICommand.OnClick() – Sunder Apr 16 '13 at 14:09
  • hmm, it looks like strange problem. Usually these kind of error happen when using dynamic keyword. Is this able to get other field values correctly? – Darksanta Apr 16 '13 at 15:37
  • 2
    Ensure that "Embed interop types" is turned off for all Esri references. Second, try IMemoryBlobStream instead of IBlobStream (this really shouldn't make a difference though). – Petr Krebs Apr 16 '13 at 15:49
  • 1
    @Petr Krebs Ohh right... I were making this in new project, and forgot to set Embed interop types to false so they would no longer by dynamic - problem solved, Thanks! You can actually make it as an answer I guess. – Sunder Apr 17 '13 at 6:21

Ensure that "Embed interop types" is turned off for all Esri interop assembly references.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.