Using Delphi and FastReport I get this error message while debugging inside Delphi immediately after this line:
<FastReport_Component>.ShowReport(true);
Then this error appear:
Project myapp.exe raised exception class EVariantTypeCastError with message 'Could not convert variant of type (String) into type (Double)'.
It appears twice before displaying the report. but if I run myapp without debugging no error message appear.
How I can find which memo cause this error ? the report has so many memos. some has also expressions inside using IIF
and the error message does not display any more info.
I got this exact same error but not with FastReport. I'll leave the context of my error, as it may help someone else. I got this error on:
I was using the TClientDataSet with TRESTResponseDataSetAdapter so that after a request to my web service the adapter would load a data set with the JSON string returned by the web service. This data set was being used to automatically check/uncheck checkboxes and load textedits and comboboxes. Since TJSONObject does not parse booleans correctly in json, I changed some checkboxes to check/uncheck based on an integer value instead of a boolean. I was then changing my webservice so that it looks for boolean columns in the datatable to an integer value 1 or 0. For some reason (my fault entirely), I was outputting a json with "" in that field instead of the integer ("1" or "0"). And this yielded that exact error. After correcting this, the error disappeared.
This is just the debugger. It's probably just getting an expected error (one handled by a
try..except
in the FR code) and properly dealing with it, but the debugger has no way of knowing that and tells you the exception happened. (It's a common issue when working with Indy, which raises exceptions as part of normal program flow.)There are three ways to deal with this situation when debugging:
Just hit
Continue
on the exception dialog when it appears. (You can tell it's a debugger exception because you get theBreak
orContinue
option, and because it only happens when debugging.)You can disable a specific exception class (or all exceptions) when debugging, using the
Tools->Options->Debugger Options
. In this case, you can addEVariantTypeCastError
to the list of exceptions to ignore.(My preferred method) Use the
Advanced Breakpoint Properties
dialog to skip the debugger's exception handling around the specific line of code you know will raise the exception you want to ignore.Breakpoint Properties
from the context menu.Advanced
button on theBreakpoint Properties
dialog, and in theActions
groupbox, uncheckBreak
and checkIgnore subsequent exceptions
.Break
and uncheckIgnore subsequent exceptions
on this second breakpoint.The advantage of option #3 is that it ignores all exception handling, but only on the code block between the two breakpoints, so you still get exceptions in all other areas of your code that may be valid exceptions in the debugger.