BlackCath
BlackCath

Reputation: 826

VS C# Express not working properly

I have a problem and don't know what to do. I'm using Visual C# Express 2010, but sometimes, when I execute my code (F5), the debugger interrupts at some point with an exception, sometimes says "method not implemented" or "there is no source code available". Then, the IDE begins to do weird things. For example, when debugging step by step, it stops the cursor at blank lines, and the program doesn't work as expected. So when this happens, I need to overwrite the entire project with a previous backup. It's like all the project were corrupted.

This is an image of the editor: enter image description here

And this is an image at Runtime: enter image description here

I'd like to know what's is happening, and how to solve it, without loading a backup.

Thanks!

Upvotes: 1

Views: 526

Answers (3)

BlackCath
BlackCath

Reputation: 826

Well the only solution was formatting my PC and reinstalling windows. After this, reinstall VS and no more problems.

Upvotes: 0

Gustavo Mori
Gustavo Mori

Reputation: 8386

To make sure you're rebuilding your project, I would delete the output directory (typically, this folder is called Debug or Release, and contains the exe and pdb files), and see if that makes a difference. Maybe you think you are rebuilding, but you aren't.

Also, when you run your project, make sure you're running the same configuration you're building. If you build Release, but run Debug, the generated code will not match, even if the files are up to date.

You can get to the output path by going to the project Properties page, Build tab, and clicking on the Output path Browse button:

enter image description here

Remember that just because you haven't explicitly defined an interface, it doesn't mean that your program doesn't use interfaces. Code you're using may already implement interfaces with default code that needs to be overridden in your code.

As others have suggested, I would search for the string NotImplementedException, just to make sure you aren't inadvertently throwing this exception somewhere in your code.

Also, I would change the code to catch the exception, so you can go up the stack and identify where it's being thrown:

for (int i = 1; i <= 4; i++)
{
    try
    {
        MyDevice.SetGpo(i, false);
    }
    catch (NotImplementedException ex)
    {
        Console.WriteLine(ex.Message); // set your breakpoint here
        throw ex;
    }
}

Upvotes: 0

Pankaj Upadhyay
Pankaj Upadhyay

Reputation: 13574

For any changes in the code, I would always suggest you to first rebuild the project and then running the programming whether in debug or direct mode. Changes to the code files don't reflect, if the solution isn't rebuilded.

About the Error : method not implemented - It is shown when a method from an abstract class or interface is not implemented in the dervied class.

there is no source code . This might be because of no build. Try rebuilding, it should not come again

Upvotes: 1

Related Questions