Visual Studio Enterprise 2015.
Simple Windows Forms C# application, which a few TextBoxes. The information in the text boxes are stored in an application.settings file, so that the entries are saved and reloaded on quit/startup.
Up until now, I've been building and running the app in VS in the Build configuration. Now, suddenly when I try building/running it, I get a NullReferenceException that wasn't there before. No changes in the code whatsoever after the last successful run. The strange thing is that the exception occurs in the application.Designer.cs file, which I've not edited manually at all. My code contains all the try-catches necessary. Here's the code in application.Designer.cs about which VS suddenly started complaining (in red):
The complete error from the VS debugger:
It's not possible to do any try-catch checking in that file, as far as I can see? In any case, this error suddenly appeared after I switched to the Release configuration, did a few builds/runs, and then switched back to Debug.
When I switch configuration to Release and do a build/run, then it works like before. No errors.
I've cleaned the solution and rebuilt, but other than that I don't know what else to try.
I also tried creating a new configuration, copying the settings from the (working) Release configuration. When I try building/running that, I get the same Exception error as in the Debug configuration.
Any ideas? I'd like to be able to build and run the solution in both the Debug and Release configurations. In any case, I'd like this seemingly random error gone. I hate errors like this, that seemingly makes no sense.
Simple Windows Forms C# application, which a few TextBoxes. The information in the text boxes are stored in an application.settings file, so that the entries are saved and reloaded on quit/startup.
Up until now, I've been building and running the app in VS in the Build configuration. Now, suddenly when I try building/running it, I get a NullReferenceException that wasn't there before. No changes in the code whatsoever after the last successful run. The strange thing is that the exception occurs in the application.Designer.cs file, which I've not edited manually at all. My code contains all the try-catches necessary. Here's the code in application.Designer.cs about which VS suddenly started complaining (in red):
C#:
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public int rowcount {
get {
[COLOR=#ff0000]return ((int)(this["rowcount"]));[/COLOR]
}
set {
this["rowcount"] = value;
}
}
The complete error from the VS debugger:
C#:
[B]NullreferenceException was unhandled[/B]
An unhandled exception of type 'System.NullreferenceException' occured in ...
Additional information: Object reference not set to an instance of an object.
It's not possible to do any try-catch checking in that file, as far as I can see? In any case, this error suddenly appeared after I switched to the Release configuration, did a few builds/runs, and then switched back to Debug.
When I switch configuration to Release and do a build/run, then it works like before. No errors.
I've cleaned the solution and rebuilt, but other than that I don't know what else to try.
I also tried creating a new configuration, copying the settings from the (working) Release configuration. When I try building/running that, I get the same Exception error as in the Debug configuration.
Any ideas? I'd like to be able to build and run the solution in both the Debug and Release configurations. In any case, I'd like this seemingly random error gone. I hate errors like this, that seemingly makes no sense.
Last edited: