Curious if I've messed up some Visual Studo settings that should be flagging this, or if I'm misunderstanding something entirely.
I have a funcion A which has 2 very basic interfaces as parameters:
Function B has a single parameter:
Function A calls Function B, passing oConfiguration as an argument. I don't seem to get any compiler errors or warnings in Visual Studio but of course I get the runtime error:
Unable to cast object of type 'ConfigurationImplementationA' to type 'IEventLogHandler'.
Turn on Option Strict .
It's off by default to support legacy VB6 code. Otherwise, it's just pain and suffering to leave it off, so don't.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.