While executing the IsDate() method in a routine I found the following error.

Text = Cannot evaluate expression because the code of the current method is optimized.
While I have been able to find some explanations of optimization, all of which are beyond my level, I really have no understanding of what this means or how to approach dealing with it.

What I am doing is just validating a date input to a textbox. I do know of other methods to do this, but it was my understanding that using the IsDate() method was quite simple. Is there perhaps a tool or library required?