nullreferenceexception

Object reference not set to an instance of an object - WCF Service and Delegates (WCF Hosted before Delegate is instantiated)

时光怂恿深爱的人放手 提交于 2019-12-12 22:19:10
问题 I am using delegates to allow my service to grab a string that is stored in my form. When I run the code my service log states the following: System.NullReferenceException: Object reference not set to an instance of an object. Pointing towards diData.DIDataCompressed = GetDIData(); I tried setting a breakpoint at DataServer = new ModelDataService(); in my form's constructor. And noticed that my WCF service was started (I got the popup from WcfSvcHost in tray and also in the WCF Service Host

NullReferenceException from an impossible place?

感情迁移 提交于 2019-12-12 13:00:50
问题 I want to know if anyone have ever encounter the same situation with me, that a NullReferenceException occurred from a place which is impossible. Here's the exact same code piece that throws the exception: private readonly StatePair[] _pairs = { new StatePair(0), new StatePair(1), new StatePair(2) }; public void CommitAll() { var states = new State[_pairs.Length]; // collect in reverse order for (var i = _pairs.Length - 1; i >= 0; i--) { // The only exit of CaptureState() method is a "new

Object reference not set to an instance of an object

陌路散爱 提交于 2019-12-12 12:26:51
问题 When I run this program in NUnit I get an error Object reference not set to an instance of an object. Though this is not the original program I get a similar error there too. Any help appreciated. Exception occurs at driver.Navigate().GoToUrl("http://www.yahoo.com/"); Program: using System; using System.Collections.Generic; using System.Linq; using System.Text; using NUnit.Framework; using OpenQA.Selenium.Firefox; using OpenQA.Selenium; namespace Class_and_object { [TestFixture] public class

Why would this NRE occur after a successful operation?

自作多情 提交于 2019-12-12 06:57:24
问题 I have a project-wide exception handler in my Windows CE app that is logging this when my app crashes in a specific scenario: Message: From application-wide exception handler: System.NullReferenceException: NullReferenceException at HHS.FrmDelivery.ReaderForm_Activated(Object sender, EventArgs e) at System.Windows.Forms.Form.OnActivated(EventArgs e) at System.Windows.Forms.Form.WnProc(WM wm, Int32 wParam, Int32 lParam) at System.Windows.Forms.Control._InternalWnProc(WM wm, Int32 wParam, Int32

Object reference not set Error in Json Serialize in Lists

折月煮酒 提交于 2019-12-12 05:39:45
问题 I have 3 c# classes in that I have 2 lists, when I trying to make a json string, I got Object reference not set to an instance of an object Error. I have tried with one list. it perfectly works, but 2 classes or more classes have the list in my program, it not worked. pls help me resolve. Model Json - { "accessKey": "7eb228097576abf56968e9845ab51b90", "channelId": "103", "hotels": [ { "hotelId": "2", "rooms": [ { "roomId": "1" } ] } ] } C# Classes - public class RootObject { public string

EPPlus Saving file throws NULL reference exception

我只是一个虾纸丫 提交于 2019-12-12 05:14:44
问题 Saving Excel file that contains (even an empty) pivot table results in "Null Reference Exception" without any helpful message. The image that shows the exception message is here below. 回答1: If you create pivot tables with EPPlus, make sure all your columns have headers (naming of the column as first row ). Missing headers result in "null reference exception" when trying to save the file, even though all the rest of the application is perfectly functioning. What a devil. 来源: https:/

What is a NullReferenceException, and how do I fix it?

拈花ヽ惹草 提交于 2019-12-12 04:51:41
问题 This post is a Community Wiki . Edit existing answers to improve this post. It is not currently accepting new answers. I have some code and when it executes, it throws a NullReferenceException , saying: Object reference not set to an instance of an object. What does this mean, and what can I do to fix this error? 回答1: What is the cause? Bottom Line You are trying to use something that is null (or Nothing in VB.NET). This means you either set it to null , or you never set it to anything at all

How to get custom information from UserProfile?

柔情痞子 提交于 2019-12-12 04:37:04
问题 I add in my UserProfile the custom field UserType as string. I want to change my login post method to get the value from UserType and pass this value in a TempData. This is my code on AccountController: [HttpPost] [AllowAnonymous] [ValidateAntiForgeryToken] public ActionResult Login(LoginModel model, string returnUrl) { if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe)) { var context = new UsersContext(); var currentUser = Membership

Unable to set value to textBox control programatically in WebBrowser

丶灬走出姿态 提交于 2019-12-12 04:23:17
问题 I am trying to set a value programatically to a textbox in a web browser but it is throwing the Null exception. This is the code, I have tried:- webBrowser1.Document.GetElementById("field-summary").InnerText = "Something"; webBrowser1.Document.GetElementById("field-summary").SetAttribute("value", "Something"); I have tried to find the element by using the Quick Watch and it is there, but I am unable to set a value. Hereby, I have attached the snap of watch too. And this is the error, I am

Unity3D Null reference in Instantiate

ε祈祈猫儿з 提交于 2019-12-12 03:22:27
问题 The "Object reference not set to an instance of an object" error is still showing. I tried Debug.Log on every variable, no errors. This is my code: using UnityEngine; using System.Collections; using System.Collections.Generic; public class PlatformSpawn : MonoBehaviour { public GameObject platform; public GameObject life; private Vector3 platformrotation; private Vector2 platformpoint, lifepoint; private float platformrange, liferange; public List<Vector2> SpawnList = new List<Vector2> ();