.NET Core application debug error: “Unable to set the next statement. This file does not exactly match the...











up vote
2
down vote

favorite












While debugging a .NET Core console application in VS 2017, I'm unable to make an edit and then set the next statement. It gives me the error mentioned in the title:



enter image description here



For example, if I set the breakpoint where indicated by the comment, then debug, and modify the string in the first line directly above the breakpoint, I get the error:



static void Main(string args)
{
string x = "foo"; // modify this after debug breaks.
string y = "bar"; // breakpoint here
}


NOTE: this works as expected in a .NET Framework console application.



When I google the title of this OP, I get zero results, even if I split the two sentences from the error message into separate quoted strings. When I google without quotes, I get a number of results that don't provide an an answer. For example, this one is similar in that it starts out with "Unable to set the next statement" but then the rest is different. This one is also similar but again is different after the first sentence.



What is causing this?










share|improve this question
























  • Just a hunch, but have you tried toggling your "Enable Edit and Continue" debug option? I really have no idea if that's related, but something I'd check.
    – itsme86
    Nov 19 at 16:51










  • Thanks for the suggestion. I just tried it and it didn't change the behavior.
    – rory.ap
    Nov 19 at 17:14










  • Are you directly modifying the code, or modifying "x" in the Immediate Window? I am not sure of your original problem, but maybe that would be a helpful workaround? You should be able to type 'x = "newFoo"' in the Immediate Window.
    – Cardi DeMonaco Jr
    Nov 19 at 17:57








  • 1




    I'm directly modifying it. Your workaround didn't work but it did lead me to another workaround, which was to set the next line first and then modify the value of x. It doesn't work when I modify x and then try to set the next line.
    – rory.ap
    Nov 20 at 13:10












  • Can anyone repro this? Or is it just me?
    – rory.ap
    Nov 20 at 13:10















up vote
2
down vote

favorite












While debugging a .NET Core console application in VS 2017, I'm unable to make an edit and then set the next statement. It gives me the error mentioned in the title:



enter image description here



For example, if I set the breakpoint where indicated by the comment, then debug, and modify the string in the first line directly above the breakpoint, I get the error:



static void Main(string args)
{
string x = "foo"; // modify this after debug breaks.
string y = "bar"; // breakpoint here
}


NOTE: this works as expected in a .NET Framework console application.



When I google the title of this OP, I get zero results, even if I split the two sentences from the error message into separate quoted strings. When I google without quotes, I get a number of results that don't provide an an answer. For example, this one is similar in that it starts out with "Unable to set the next statement" but then the rest is different. This one is also similar but again is different after the first sentence.



What is causing this?










share|improve this question
























  • Just a hunch, but have you tried toggling your "Enable Edit and Continue" debug option? I really have no idea if that's related, but something I'd check.
    – itsme86
    Nov 19 at 16:51










  • Thanks for the suggestion. I just tried it and it didn't change the behavior.
    – rory.ap
    Nov 19 at 17:14










  • Are you directly modifying the code, or modifying "x" in the Immediate Window? I am not sure of your original problem, but maybe that would be a helpful workaround? You should be able to type 'x = "newFoo"' in the Immediate Window.
    – Cardi DeMonaco Jr
    Nov 19 at 17:57








  • 1




    I'm directly modifying it. Your workaround didn't work but it did lead me to another workaround, which was to set the next line first and then modify the value of x. It doesn't work when I modify x and then try to set the next line.
    – rory.ap
    Nov 20 at 13:10












  • Can anyone repro this? Or is it just me?
    – rory.ap
    Nov 20 at 13:10













up vote
2
down vote

favorite









up vote
2
down vote

favorite











While debugging a .NET Core console application in VS 2017, I'm unable to make an edit and then set the next statement. It gives me the error mentioned in the title:



enter image description here



For example, if I set the breakpoint where indicated by the comment, then debug, and modify the string in the first line directly above the breakpoint, I get the error:



static void Main(string args)
{
string x = "foo"; // modify this after debug breaks.
string y = "bar"; // breakpoint here
}


NOTE: this works as expected in a .NET Framework console application.



When I google the title of this OP, I get zero results, even if I split the two sentences from the error message into separate quoted strings. When I google without quotes, I get a number of results that don't provide an an answer. For example, this one is similar in that it starts out with "Unable to set the next statement" but then the rest is different. This one is also similar but again is different after the first sentence.



What is causing this?










share|improve this question















While debugging a .NET Core console application in VS 2017, I'm unable to make an edit and then set the next statement. It gives me the error mentioned in the title:



enter image description here



For example, if I set the breakpoint where indicated by the comment, then debug, and modify the string in the first line directly above the breakpoint, I get the error:



static void Main(string args)
{
string x = "foo"; // modify this after debug breaks.
string y = "bar"; // breakpoint here
}


NOTE: this works as expected in a .NET Framework console application.



When I google the title of this OP, I get zero results, even if I split the two sentences from the error message into separate quoted strings. When I google without quotes, I get a number of results that don't provide an an answer. For example, this one is similar in that it starts out with "Unable to set the next statement" but then the rest is different. This one is also similar but again is different after the first sentence.



What is causing this?







c# .net visual-studio debugging visual-studio-2017






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 at 16:14









itsme86

16.2k32948




16.2k32948










asked Nov 19 at 16:00









rory.ap

23.3k63998




23.3k63998












  • Just a hunch, but have you tried toggling your "Enable Edit and Continue" debug option? I really have no idea if that's related, but something I'd check.
    – itsme86
    Nov 19 at 16:51










  • Thanks for the suggestion. I just tried it and it didn't change the behavior.
    – rory.ap
    Nov 19 at 17:14










  • Are you directly modifying the code, or modifying "x" in the Immediate Window? I am not sure of your original problem, but maybe that would be a helpful workaround? You should be able to type 'x = "newFoo"' in the Immediate Window.
    – Cardi DeMonaco Jr
    Nov 19 at 17:57








  • 1




    I'm directly modifying it. Your workaround didn't work but it did lead me to another workaround, which was to set the next line first and then modify the value of x. It doesn't work when I modify x and then try to set the next line.
    – rory.ap
    Nov 20 at 13:10












  • Can anyone repro this? Or is it just me?
    – rory.ap
    Nov 20 at 13:10


















  • Just a hunch, but have you tried toggling your "Enable Edit and Continue" debug option? I really have no idea if that's related, but something I'd check.
    – itsme86
    Nov 19 at 16:51










  • Thanks for the suggestion. I just tried it and it didn't change the behavior.
    – rory.ap
    Nov 19 at 17:14










  • Are you directly modifying the code, or modifying "x" in the Immediate Window? I am not sure of your original problem, but maybe that would be a helpful workaround? You should be able to type 'x = "newFoo"' in the Immediate Window.
    – Cardi DeMonaco Jr
    Nov 19 at 17:57








  • 1




    I'm directly modifying it. Your workaround didn't work but it did lead me to another workaround, which was to set the next line first and then modify the value of x. It doesn't work when I modify x and then try to set the next line.
    – rory.ap
    Nov 20 at 13:10












  • Can anyone repro this? Or is it just me?
    – rory.ap
    Nov 20 at 13:10
















Just a hunch, but have you tried toggling your "Enable Edit and Continue" debug option? I really have no idea if that's related, but something I'd check.
– itsme86
Nov 19 at 16:51




Just a hunch, but have you tried toggling your "Enable Edit and Continue" debug option? I really have no idea if that's related, but something I'd check.
– itsme86
Nov 19 at 16:51












Thanks for the suggestion. I just tried it and it didn't change the behavior.
– rory.ap
Nov 19 at 17:14




Thanks for the suggestion. I just tried it and it didn't change the behavior.
– rory.ap
Nov 19 at 17:14












Are you directly modifying the code, or modifying "x" in the Immediate Window? I am not sure of your original problem, but maybe that would be a helpful workaround? You should be able to type 'x = "newFoo"' in the Immediate Window.
– Cardi DeMonaco Jr
Nov 19 at 17:57






Are you directly modifying the code, or modifying "x" in the Immediate Window? I am not sure of your original problem, but maybe that would be a helpful workaround? You should be able to type 'x = "newFoo"' in the Immediate Window.
– Cardi DeMonaco Jr
Nov 19 at 17:57






1




1




I'm directly modifying it. Your workaround didn't work but it did lead me to another workaround, which was to set the next line first and then modify the value of x. It doesn't work when I modify x and then try to set the next line.
– rory.ap
Nov 20 at 13:10






I'm directly modifying it. Your workaround didn't work but it did lead me to another workaround, which was to set the next line first and then modify the value of x. It doesn't work when I modify x and then try to set the next line.
– rory.ap
Nov 20 at 13:10














Can anyone repro this? Or is it just me?
– rory.ap
Nov 20 at 13:10




Can anyone repro this? Or is it just me?
– rory.ap
Nov 20 at 13:10

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53378442%2fnet-core-application-debug-error-unable-to-set-the-next-statement-this-file%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53378442%2fnet-core-application-debug-error-unable-to-set-the-next-statement-this-file%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

TypeError: fit_transform() missing 1 required positional argument: 'X'