I set OPTION STRICT ON as a default in VS2005 and also added it to the WEB.config file.
I noticed today in an ASP.net app I'm working on that the code wasn't throwing an error during implicit type conversions. Hmmm, that's strange...so after investigating every possiblility and multiple testing, I discovered that there's a bug in Visual Studio
2005. <div> </div> <div>Work around: This sucks but..you need to set option explicit at the top of every code page.</div> <div> </div> <div>I notified the Microsoft regional director and after testing he concurred with my conclusion.</div> <div> </div> <div>Note:
This only affects ASP.net apps not Windows apps.
(Unless of course I'm completely retarted and missed something obvious )</div>
Sorry about the inconvenience. There unfortunately isn’t a GUI way to enable option strict, but you can enable it by copying and pasting
this statement into your application’s web.config file (it should go immediately underneath the root <configuration> element:
d88b
Member
30 Points
6 Posts
Bug using Option Strict ON in ASP.net 2.0 app
Nov 08, 2005 11:10 PM|LINK
I noticed today in an ASP.net app I'm working on that the code wasn't throwing an error during implicit type conversions. Hmmm, that's strange...so after investigating every possiblility and multiple testing, I discovered that there's a bug in Visual Studio 2005. <div> </div> <div>Work around: This sucks but..you need to set option explicit at the top of every code page.</div> <div> </div> <div>I notified the Microsoft regional director and after testing he concurred with my conclusion.</div> <div> </div> <div>Note: This only affects ASP.net apps not Windows apps.
(Unless of course I'm completely retarted and missed something obvious )</div>
d88b
Member
30 Points
6 Posts
Re: Bug using Option Strict ON in ASP.net 2.0 app
Nov 11, 2005 09:13 PM|LINK
This is the answer I got from Microsoft...
Sorry about the inconvenience. There unfortunately isn’t a GUI way to enable option strict, but you can enable it by copying and pasting this statement into your application’s web.config file (it should go immediately underneath the root <configuration> element:
<system.codedom>
<compilers>
<compiler compilerOptions ="/optionexplicit+ /optionstrict+" language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</compilers>
</system.codedom>
This will then enable option strict for both code-behind and your app_code directory.
Hope this helps,
Scott