none
Problems with my code after converting from Visual studio 2013 to Visual studio 2017 RRS feed

  • Question

  • I have a project that is working correctly on Visual studio 2013 Ultimate ( is a VB.net project ). Now we have installed Visual studio 2017 Enterprise. When I compile and run my project on VS2017 , on several lines of code I receive a strange error message :

    "Cannot obtain value of the local variable or argument because it is not
     available at this instruction pointer, possibly because it has been optimized away." 
    

    What can I do , because on VS2013 I had no problems at all.

    Thank you !

    Tuesday, February 27, 2018 1:21 AM

All replies

  • Hi

    Post the code lines around where each error is occurring.


    Regards Les, Livingston, Scotland

    Tuesday, February 27, 2018 1:24 AM
  • Sorry , but everything was working correctly on Visual studio 2013. So is there any configuration on VS 2017 that cause this.

    Anyway , one line of code  is this :

    If headeredit.Visible = False then

    where headeredit is just a textbox.

    Now I have 2 computers , one with visual studio 2013 and one with visual studio 2017.

    In the first PC my program works correctly , the same program on the PC with vs2017 has these errors.

    Tuesday, February 27, 2018 1:31 AM
  • Hi

    That particular line of code is perfectly valid.

    Suggest you put Option Strict On and Option Explicit On at the very top of your code which may highlight areas which the compiler doesn't like.

    Also, you say when you 'compile and run', then you get the errors - is that correct? In which case, the code is compiling, and the errors are run time exceptions - for that you might set Try...Catch blocks around areas where exceptions are being thrown, and put a Stop in the Catch block to see what the exception message might say.


    Regards Les, Livingston, Scotland

    Tuesday, February 27, 2018 1:41 AM
  •  That appears to be a problem caused by the code optimization settings and/or the configuration Debug/Release.  Try some of the suggestions in the following links which where found by doing a google search of the exact error message you gave.  They all seem to suggest the same 2 or 3 VS settings to check.

    Brendan's Compendium - "Cannot obtain value of the local variable or argument because it is not available at this instruction pointer, possibly because it has been optimized away."

    VS 2015 Debugger - "Cannot obtain value of the local variable or argument because it is not available at this instruction pointer, possibly because it has been optimized away."

    Cannot obtain value of local or argument as it is not available at this instruction pointer, possibly because it has been optimized away 


    If you say it can`t be done then i`ll try it

    Tuesday, February 27, 2018 1:41 AM
  • I've already read these.

    But :

    1) the suggestion to disable Optimize code on Project Properties -Build is not possible to make because on Project-Properties there's no Build Tab.

    2) The other suggestion : 

    Debug->Options or Tools->Options

    and check Debugging->General->Suppress JIT optimization on module load (Managed only)

    This configuration resolve the problems on several lines , but other problems appear

    Tuesday, February 27, 2018 2:25 AM
  • I've already read these.

    But :

    1) the suggestion to disable Optimize code on Project Properties -Build is not possible to make because on Project-Properties there's no Build Tab.

    2) The other suggestion : 

    Debug->Options or Tools->Options

    and check Debugging->General->Suppress JIT optimization on module load (Managed only)

    This configuration resolve the problems on several lines , but other problems appear

    From what I posted in your other question, there is no equivalent for vb.net projects.

    Documentation C# only

    Well there is also this under compile/Advance compile options


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites


    Tuesday, February 27, 2018 2:44 AM
    Moderator
  • So what can I do on vb.net to resolve this problem ?
    Tuesday, February 27, 2018 2:46 AM
  • So what can I do on vb.net to resolve this problem ?
    It's not a vb.net issue really. Perhaps you should try the Visual Studio general questions forum.

    La vida loca

    Tuesday, February 27, 2018 11:57 PM
  • I've already read these.

    But :

    1) the suggestion to disable Optimize code on Project Properties -Build is not possible to make because on Project-Properties there's no Build Tab.

    2) The other suggestion : 

    Debug->Options or Tools->Options

    and check Debugging->General->Suppress JIT optimization on module load (Managed only)

    This configuration resolve the problems on several lines , but other problems appear

    Did you check everything in the third link IronRazerz posted?

    1. Ensure you are in Debug config, not Release.
    2. Did you do a Build -> Clean <Solution> from the Build menu?
    3. Did you check the App.Config file to ensure that there are no compiler options being set in the config file?

    If you have verified all of these things and the problem still exists, try the following:

    1. Go to the folder where the solution is saved and make a copy
    2. Open the copy of the solution folder
    3. Ensure that your file explorer is set to Show Hidden Files
    4. Locate the hidden .vs folder in the solution folder
    5. Delete the hidden .vs folder
    6. Open the solution in Visual Studio

    If you still have a problem let us know.  You may need to file an issue and have someone from the VS team examine your project and/or log files.


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Wednesday, February 28, 2018 1:58 PM
    Moderator
  • I've already read these.

    But :

    1) the suggestion to disable Optimize code on Project Properties -Build is not possible to make because on Project-Properties there's no Build Tab.

    2) The other suggestion : 

    Debug->Options or Tools->Options

    and check Debugging->General->Suppress JIT optimization on module load (Managed only)

    This configuration resolve the problems on several lines , but other problems appear

    Did you check everything in the third link IronRazerz posted?

    1. Ensure you are in Debug config, not Release.
    2. Did you do a Build -> Clean <Solution> from the Build menu?
    3. Did you check the App.Config file to ensure that there are no compiler options being set in the config file?

    If you have verified all of these things and the problem still exists, try the following:

    1. Go to the folder where the solution is saved and make a copy
    2. Open the copy of the solution folder
    3. Ensure that your file explorer is set to Show Hidden Files
    4. Locate the hidden .vs folder in the solution folder
    5. Delete the hidden .vs folder
    6. Open the solution in Visual Studio

    If you still have a problem let us know.  You may need to file an issue and have someone from the VS team examine your project and/or log files.


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"


    I've done all these steps , but without success. , but I repeat again that this project run without problems on vs2013. So the vs2017 may have some configuration that make my application to fail.
    Wednesday, February 28, 2018 4:08 PM
  • I've already read these.

    But :

    1) the suggestion to disable Optimize code on Project Properties -Build is not possible to make because on Project-Properties there's no Build Tab.

    2) The other suggestion : 

    Debug->Options or Tools->Options

    and check Debugging->General->Suppress JIT optimization on module load (Managed only)

    This configuration resolve the problems on several lines , but other problems appear

    Did you check everything in the third link IronRazerz posted?

    1. Ensure you are in Debug config, not Release.
    2. Did you do a Build -> Clean <Solution> from the Build menu?
    3. Did you check the App.Config file to ensure that there are no compiler options being set in the config file?

    If you have verified all of these things and the problem still exists, try the following:

    1. Go to the folder where the solution is saved and make a copy
    2. Open the copy of the solution folder
    3. Ensure that your file explorer is set to Show Hidden Files
    4. Locate the hidden .vs folder in the solution folder
    5. Delete the hidden .vs folder
    6. Open the solution in Visual Studio

    If you still have a problem let us know.  You may need to file an issue and have someone from the VS team examine your project and/or log files.


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"


    I've done all these steps , but without success. , but I repeat again that this project run without problems on vs2013. So the vs2017 may have some configuration that make my application to fail.

    Last thing: are you on the latest release of VS2017?  You should be on 15.5.7.

    If you are on the latest version and the problem persists, please use the Feedback button at the top-right side of the title bar in VS and use the Report a Problem button describing the situation and the steps you've taken to resolve it.  You can include a link to this thread in the submission.


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Wednesday, February 28, 2018 9:05 PM
    Moderator