nullreferenceexception

Short-circuiting in Linq-Where

馋奶兔 提交于 2019-12-12 03:17:07
问题 I have a problem in a Linq-Where method. I get a NullReferenceException in a where clause, which should not happen because C# should use short-circuiting and the second operations hould not be executed: If Item is null, Item.State == ... should not be called, because the condition is already true (short-circuiting). But it seems, that short-circuiting does not working in this case. Does anyone else had and solved this problem? Thank you! Edit : In the end, the connectionList should not

Error #1009, ActionScript 3

余生颓废 提交于 2019-12-12 03:08:42
问题 I am using a SWF(accueil) inside another SWF(ranchleblanc_fr) and this causes the error 1009 to appear: TypeError: Error #1009: Cannot access a property or method of a null object reference. at accueil_fla::MainTimeline/frame1()" The first SWF has a particle effect in it and it won't start when I first load the page. If i click on any button of the main page and return to the accueil page, the effect works. But if I click on another button again, I get another error 1009, but this time it

cannot get stacktrace, source line # information from Mono .dll

▼魔方 西西 提交于 2019-12-12 02:50:03
问题 I am running some .NET .dll s on Windows Server 2012 . The .NET assemblies were compiled from C# code on OS X with Xamarin 4.0 . (yeah I know weird setup- but I am a game developer) In general they run perfectly, but when it comes to inspecting Exception information, it's not so good. I am trying to pull info out of an Exception object, but it's all empty. I also tried copying the .mdb files along with the .dll s, and made sure I was building in Debug , and with debug symbols. For example

Weird NullReferenceException in third party dll: C#

吃可爱长大的小学妹 提交于 2019-12-12 02:28:36
问题 I have a strange error, which has started suddenly and which is driving me crazy. In my C# application, I am doing some heavy mathematical calculations and for that purpose, I am using CenterSpace's NMath library. Recently, when I started my application from inside Visual Studio 2015 in order to debug it, the application started to crash because of NullReferenceExceptions in NMath.dll, whenever I call an NMath library method (and another library which we have written, as well). In order to

ViewDiskModel.DeleteSelectedFiles.Execute(null) does not delete any files

懵懂的女人 提交于 2019-12-12 01:57:23
问题 My App wouldn't delete the save files on the loading page in the isolated storage. The codes for the delete and the ViewDiskModel.cs class are below: LoadingPage.cs private void button2_Click(object sender, RoutedEventArgs e) { ViewDiskModel model = lstBox1.DataContext as ViewDiskModel; int m_iSelectedLoad = lstBox1.SelectedIndex; if (m_iSelectedLoad >= 0) { model.DeleteSelectedFiles.Execute(null); } MessageBox.Show("Files Successfully Deleted"); } ViewDiskModel.cs: public class FileItem :

Null reference exception while iterating over a list of StreamReader objects

守給你的承諾、 提交于 2019-12-11 20:29:29
问题 I am making a simple Program which searches for a particular Name in a set of files.I have around 23 files to go through. To achieve this I am using StreamReader class, therefore, to write less of code, I have made a List<StreamReader> FileList = new List<StreamReader>(); list containing elements of type StreamReader and my plan is to iterate over the list and open each file: foreach(StreamReader Element in FileList) { while (!Element.EndOfStream) { // Code to process the file here. } } I

Solve NullReference exception

依然范特西╮ 提交于 2019-12-11 17:33:51
问题 I use crystal report to implement reporting in my c# windows application.I create a form to show print preview of Report.I use following code to show preview: private ReportDocument _reportDocument; public CrystalReportPrintPreviewForm(ReportDocument reportDocument) { InitializeComponent(); _reportDocument = reportDocument; } private void CrystalReportPrintPreviewForm_Load(object sender, EventArgs e) { if(_reportDocument!=null) crystalReportViewer1.ReportSource = _reportDocument; } And also i

Dynamically creating Link Labels using foreach in c#

≯℡__Kan透↙ 提交于 2019-12-11 14:57:49
问题 I am trying to create link labels dynamically using foreach . I am setting the text of each linklabel to a string which is stored in flatestgames string array and whose links are stored in flatestlinks string array. But it is throwing a null reference exception at the line flg[i].Text = s though s is not set to null. Please help me out. Below is the code snippet: if (!(flatestgames == null || flatestgames.Length < 1)) { i = 0; LinkLabel[] flg = new LinkLabel[10]; foreach (string s in

KinectSensor NullReferenceException

半世苍凉 提交于 2019-12-11 11:39:19
问题 A week ago, we had a working project. The following worked, without a problem on my machine (Window 8 developing in VisualStudio 2010) KinectSensor sensor = KinectSensor.KinectSensors[0]; public KinectController() { sensor.SkeletonFrameReady += runtime_SkeletonFrameReady; sensor.ColorStream.Enable(); sensor.SkeletonStream.Enable(); sensor.Start(); } This worked no problems. When my teammate pulled this down from an SVN, it broke, giving a null reference exception on ColorStream.Enable().

NullReferenceException thrown after null check?

爷,独闯天下 提交于 2019-12-11 08:51:31
问题 So I track different users access through GUID. It has worked great up until now and I dont understand why its failing. I am assigning the variable, then I check for null, then run the code, and then it throws the nullreferenceexception error. Here is the code: if (String.IsNullOrEmpty(Session["GUID"] as string)) { Server.Transfer("~/index.aspx", true); } else { GUID = Session["GUID"].ToString(); if (!String.IsNullOrEmpty(GUID)) { itemID = (int)aooDB_Items.SelectItemID(GUID); } } The