Nullreference exception was unhandled

I am creating a microsoft WPF project and ran into the following hindrance:

Null reference was unhandled Object reference not set to an instance of an object

My VS 2010 points to the following line of code:

string connectionString = ConfigurationManager.ConnectionStrings["Lab06Wpf.Properties.Settings.AppConnectionString"].ConnectionString;

Not sure why this is happening, I have a similar project where I have a similar connection string and it runs itself just fine.

The ConnectionStrings argument Lab06Wpf.Properties.Settings.AppConnectionString is valid and the connection has been tested.

Any leads anyone?

-------------Problems Reply------------


That is returning null and your are calling ConnectionString on it. You need to find out why it is returning null. Use your debugger to see what ConnectionStrings contains and why your call is failing.

Category:c# Views:0 Time:2011-06-17

Related post

  • Nullreference excpetion was unhandled (Object reference not set to an instance of an object) 2011-09-15

    I have a form with four combobxes say cbmefrom(age from ) cbmeto( age to) cbperiod(periodtype values liek this "Next 7 Days" ......) and cbgender(cbgender).. i have a datagrid view also(dgvreports).. what i am trying to do is i am populating the memb

  • Vb 10 nullreference exception 2011-03-08

    i got this code from the net , but i can't make this code work on the system i am programming so, i used the same codes to another system and it worked, when i tried using it to my system, it failed, so i started a new program and it still fails... w

  • NullReference Exception unhandled. C# Reflection 2010-10-27

    ControlType = "System.Windows.Forms.WindowsFormsApplication1." + "PictureBox1"; System.Reflection.Assembly asm; asm = typeof(Form).Assembly; ControlObject = (System.Windows.Forms.Control)asm.CreateInstance(ControlType); ControlObject.Name = ControlNa

  • NullReference was unhandled exception 2011-09-12

    I'm using the following code for validating date and time values to view the records present in database in datagridview1. The bottom part of the code alters the query according to what has been entered by the user and I want to show results accordin

  • "NullReferenceException was unhandled by user code" 2011-10-28

    This question already has an answer here: What is a NullReferenceException and how do I fix it? 18 answers I was having some issues the other day with my interface lagging and after asking here someone suggested using a using statement to dispose of

  • Catching unhandled exceptions in ASP.NET UserControls 2008-08-14

    I'm dynamically loading user controls adding them to the Controls collection of the web form. I'd like to hide user controls if they cause a unhandled exception while rendering. So, I tried hooking to the Error event of each UserControl but it seems

  • How to catch unhandled exceptions when using .NET Remoting 2008-09-03

    I want to catch all unhandled exceptions thrown in a remote object on the server and log them there before I translate them into some custom exception so that specific exceptions do not cross the client/server boundary. I think I have to use a custom

  • Troubleshooting a NullReference exception in a service 2008-09-07

    I have a windows service that runs various system monitoring operations. However, when running SNMP related checks, I always get a NullReference exception. The code runs fine when run through the user interface (under my username and password), but a

  • Unhandled exception logging for Windows Forms 2008-09-15

    Is there anything like ELMAH for Windows Forms? I'm looking for a standard way to process unhandled exceptions and grab a screenshot and other environment information before packaging that up for support. --------------Solutions------------- The very

  • How to skip sys.exitfunc when unhandled exceptions occur 2008-09-17

    As you can see, even after the program should have died it speaks from the grave. Is there a way to "deregister" the exitfunction in case of exceptions? import atexit def helloworld(): print "Hello World!" atexit.register(helloworld) raise Exception(

  • VS2008 Debugger does not break on unhandled exception 2008-09-19

    I'm having an odd problem with my vs debugger. When running my program under the vs debugger, the debugger does not break on an unhandled exception. Instead control is returned to VS as if the program exited normally. If I look in the output tab, The

  • Strange unhandled exception from application - Validation of viewstate MAC failed 2008-09-23

    I don't know if anyone has seen this issue before but I'm just stumped. Here's the unhandled exception message that my error page is capturing. Error Message: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster,

  • Is there a way to define an action for unhandled exceptions in a WinForms .NET 3.5 app? 2008-09-30

    Note, I realize that this has been addressed here. That post discusses exception handling in .NET 1.1 while implying that there is a better solution for >.NET 2.0 so this question is specifically about the more recent .NET versions. I have a windo

  • "An unhandled non-continuable exception was thrown during process load" 2008-10-24

    This error message appears on a colleague's machine when he tries to launch a Windows application he's working on: An unhandled non-continuable exception was thrown during process load What does this mean, and how does one go about investigating what

  • Unhandled exceptions in BackgroundWorker 2008-11-03

    My WinForms app uses a number of BackgroundWorker objects to retrieve information from a database. I'm using BackgroundWorker because it allows the UI to remain unblocked during long-running database queries and it simplifies the threading model for

  • Catching all unhandled C++ exceptions? 2008-11-09

    Is there some way to catch exceptions which are otherwise unhandled (including those thrown outside the catch block)? I'm not really concerned about all the normal cleanup stuff done with exceptions, just that I can catch it, write it to log/notify t

  • Unhandled Socket securityError even when (seemingly) handling it 2008-11-17

    I Have a problem where I occasionally (i.e. not always) see the below error popup from the Debug Flash Player after launching my app: Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: ca

  • Easy way to catch all unhandled exceptions in C#.NET 2008-11-17

    I have a website built in C#.NET that tends to produce a fairly steady stream of SQL timeouts from various user controls and I want to easily pop some code in to catch all unhandled exceptions and send them to something that can log them and display

  • Flash TextField HTML - How do I prevent the error dialogue for missing images? (Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found.) 2008-11-21

    I'm using a Flash TextField control to display some HTML content inside a Flash presentation to be shown on a large touch-screen kiosk. Unfortunately, if any image tag in the displayed HTML content points to a non-existent image, a dialogue is shown

Copyright (C), All Rights Reserved.

processed in 0.140 (s). 11 q(s)