Skip to Content
avatar image
Former Member

Type 'System.String' cannot be marshaled as an unmanaged structure; ... error is back again

This question has been asked before on a previous version of CR for VS here but was never really answered. We might be in a similar situation, but to not mix things up I decided to start a new question.

There is one report with several fixed images in it and one image which is retrieved from our database. The fixed images were imported as PNG images and the dynamically retrieved image is a PNG as well. All are 300dpi and 24bit colour which they need to be to get the quality of printing we require.

When retrieving a report from the designer with sample data or when showing the report in a report viewer on screen the report works. However when using Rows.Count or ExportToDisk from code the report most of the times comes up with the error "Type 'System.String' cannot be marshaled as an unmanaged structure ..."

The previous question mentioned a workaround by ignoring the exception thrown, but this does not work for us because ignoring the exception does not always mean the report will be created. Sometimes it does, most of the times it does not and this throws a spanner in our production process which expects certain output.

This is the only report misbehaving out of the dozens of different reports we make on a daily basis for customers. But is also the only report with images in it. This seems to agree with the suggestion in previous question about this that the exception has to do with images inside a report.

Information about the report: it is a single page report fed from code by a strong typed dataset created from an XSD file. The dynamic image is an IBlobFieldObject linked to a base64binary field in the XSD. The fixed images are ICROleObjects. There are two subreports which contain fixed images as well.

We are developing in VS2015 under Win10 with CR for VS 13.0.20.2399.

The question: does anyone know another type of workaround or real solution to solve this?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Nov 14, 2017 at 08:10 AM

    Fixed it more or less by installing 13.0.21. It now more often than not works.

    Add comment
    10|10000 characters needed characters exceeded