首页 > 解决方案 > 为什么 VB.NET 编辑并继续对选项严格关闭不起作用?

问题描述

我一直很难让编辑和继续可靠地工作。

我在这段代码片段中重现了这个问题,其中编辑并继续导致所有变量都变为 Nothing。

如果我删除选项结构并定义所有变量,那么它就可以工作。但我喜欢 option strict off,因为它可以节省大量的开发时间。

option strict off
option Explicit off


Module _Main_Module

    Sub Main()

        DO
            ' Get user command:
            user_line = CONSOLE.READLINE

            AAA=111
            
        Loop
    End Sub



End Module

要引起问题,请执行以下步骤...

1.  Set breakpoint at line 13  
2.  run  
3.  press any key  
4.  hover over "user_line".  It contains what you typed.  
5.  Add line "BBB=222" after line 13:  
6.  Press F10 to execute next line  
7. hover over "user_line".  It is now "Nothing".

在此处输入图像描述

标签: .netvb.net

解决方案


推荐阅读