Bug using Option Strict ON in ASP.net 2.0 app

Last post 11-11-2005 5:13 PM by d88b. 1 replies.

Sort Posts:

  • Hmm [^o)] Bug using Option Strict ON in ASP.net 2.0 app

    11-08-2005, 7:10 PM
    • Member
      30 point Member
    • d88b
    • Member since 11-03-2005, 7:44 PM
    • Fredericton, NB Canada
    • Posts 6
    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.
     
    Work around: This sucks but..you need to set option explicit at the top of every code page.
     
    I notified the Microsoft regional director and after testing he concurred with my conclusion.
     
    Note: This only affects ASP.net apps not Windows apps.

    (Unless of course I'm completely retarted and missed something obvious )
  • Re: Bug using Option Strict ON in ASP.net 2.0 app

    11-11-2005, 5:13 PM
    • Member
      30 point Member
    • d88b
    • Member since 11-03-2005, 7:44 PM
    • Fredericton, NB Canada
    • Posts 6

    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

Page 1 of 1 (2 items)