.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Intermittant production NullReferenceException

Posted By:      Posted Date: September 07, 2010    Points: 0   Category :ASP.Net
I have some code that has been running in production for over a month now and is executed dozens of times a day.  Over the month I have received three NullReferenceException reports (I use Elmah to report unhandled exceptions).  I am baffled as to how my code could generate this exception.  The exception is thrown in a subclass of this abstract base class (some code ommited for brevitypublic abstract class EvidenceBase { protected EvidenceBase() { } public abstract string Description { get; } ... The subclass looks like thispublic class PassedCourse : EvidenceBase { private float? scaledScore = null; public PassedCourse(float? scaledScore) { this.scaledScore = scaledScore; } public float? ScaledScore { get { return this.scaledScore; } } public override string Description { get { if (ScaledScore != null && ScaledScore.HasValue) // Throws NullReferenceException { The classes are, of course, more complex than what I have shown but I am reasonably confident that the pieces I have omitted are not relevant.  Can anyone give me a hint as to how the indicated line could possibly throw NullReferenceException?  Running under ASP.Net 4 on a hosted server. 

View Complete Post

More Related Resource Links

Intermittant error: "A connection attempt failed because the connected party did not properly respon



I'm having a doozy of a problem, and can't find a solution.  I have a WFC Web Service installed to a pair of servers, and accessed through a load balancer.  I am accessing the service from an ASP.NET client app, also via WCF.  The Client is not load balanced.

I'm getting an intermittant error:

(Inner Most Exception) System.Net.Sockets.SocketException:  A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond x.x.x.x:80

(Middle Exception) System.Net.WebException: Unable to connect to the remote server

(Outer Exception) System.ServiceModel.EndpointNotFoundException:  Could not connect to http://<MYSite>/<MYApp>/<MYService>.svc. TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond x.x.x.x:80.

I can reproduce this error with about 20% reliability if I execute the exact same page request on the client from 2 browsers at the same time.  When the problem occurs, the successful p

CLR Inside Out: Production Diagnostics Improvements in CLR 4


The Common Language Runtime (CLR) 4 includes new APIs that expand diagnostic support toward the production end of the spectrum. We explain how the debugging APIs support dump debugging for application crash and hang scenarios and make it easier to detect when hangs are caused by multi-threading issues.

Jon Langdon

MSDN Magazine May 2010

Debugging: Root Out Elusive Production Bugs with These Effective Techniques


Errors happen. But in production, error logs often provide little or no help in pinpointing the exact line of code in which the problem originates. You can't usually isolate the root cause by modifying code in a production environment because recreating the exact same environment is very difficult due to the large number of potential software and hardware configurations. This article provides some concrete steps you can take to get at the heart of the problems in your production code.

Matt Adamson

MSDN Magazine July 2005

App_Data - development vs production - SQLExpress


Help please, on mdf/ldf files manipulation between dev and prod App_Data folders.

My dev folder: ...\Visual Studio 2010\Projects\WebApplication1\
My prod folder: C:\inetpub\mywebsite\

There are 4 files in [dev]\APP_Data

The VS2010 publishing process copies the 4 files to [prod]\App_Data where my website users interact with them updating data therein.

Next time I publish, the files in [prod]\App_Data get overwritten, losing all current membership and app data changed by my website users.

I tried using SQL Server Management Studio, before publishing, to export current data from [prod]\App_Data\aspnetdb.mdf and myappdb.mdf, and import to [dev]\App_Data\aspnetdb.mdf and myappdb.mdf, but that brought up a bunch of detaching/attaching issues, ending up wiping out all security permissions settings of all the related files, even though I had used SQL Server Configuration Manager to stop the SQLExpress Service beforehand.

IIS Application Pool Identity:

App_Data mdf/ldf files security permission settings:
    SYSTEM: Full Control (dev/prod)
    NETWORK SERVICE: Read/Write (dev/prod)

'Meter number is not registered ' error FedEx ship web service move to production



I want to integrate FedEx ship web service in my website. It works fine for local but for production it gives error. I changed test credentials by production credentials. also changed test url "https://gatewaybeta.fedex.com:443/webservices" by production url "https://gateway.fedex.com:443/webservices" But I am getting error that meter number is not registered. Please advice.

Deploying custom Web Parts on SharePoint 2007 production server

I would like to develop a custom SharePoint 2007 Web Part for a client. Currently I'm using Visual Studio to deploy my solution to a test environment (since it's a SharePoint Project I choose just Build -> Deploy from the menu). What are the appropriate steps to deploy it to the production server?

I'd like keep it simple and safe (i.e. use the principle of least privilege). Therefore (if possible) avoid using stsadm, achieve this through web interface, or avoid using administrative rights.

Also, can I specify the scope of my Web Part, i.e. choose on which Web Application or Site Collection will it be installed?

FormsAuthentication.SignOut() results in System.NullReferenceException


Hi. I am getting a "System.NullReferenceException" when I call 
FormsAuthentication.SignOut() from Session_End method in global.asax. 
Code is as follow:
void Session_End(object sender, EventArgs e) 

System.NullReferenceException: At Createtask Activity



I created  Approval Workflow application(.net3.0), it has successfully deployed at sharepoint server, but when executing  workflow at createTask activity, the following errror has occured.

System.NullReferenceException: Object reference not set to an instance of an object.     at BasicApprovalWorkflow.Workflow2.createApprovalTask_MethodInvoking(Object sender, EventArgs e)

below is the code :



void createApprovalTask_MethodInvoking(object sender, EventArgs e)



Is CTP4 good enough to be used in production code



Can we use CTP4 in production code?

When will it be included in .net framework 4.0?

How to copy table data from test to production database

I'm using SQL Server 2008 R2 and I'd like to copy all data rows from one table of a test database to the identical table in a production database. The primary key of the table is referred to by other tables so a DELETE followed by a number of INSERTs won't do it because of referential integrity issues. What is the best method to replace the data rows in the destination database with the values from the source database? Thanks, Guido

limit ASP.NET User Session without blocking production

 If the Web Site is in production and there are hits from one particular place (Say London!) and the after 1000 (or x) requests, user session should not be allowed. So what to do in such situation without affecting current production site?  Please Advice. Thanks!  

Moving Membership tables to production; empty

Hi all: I'm currently moving my application from my testing environment, onto our live environment.  I've moved my database, including all membership tables over, and everyting is empty.  Again, this is what I wanted.  The test environment had far too much "crap" data, including fake user, so I wanted to just start from scratch on the production environment.  I don't know how to re-create the application or the first user though in these membership tables??  I'm sure this isn't an odd thing to do, but I havent' had any luck yet with finding an answer of how to do this.  Any help is greatly appreciated! Thanks, Terri-Lynn 

SharePoint Designer Worklfows with Test/Stage/Production enviroment

We have an environment (SharePoint 2010 Test / Stage / Prod.) The access via SharePoint Designer 2010 is not allowed in the stage and production enviroment. Is there a way with die SharePoint Designer 2010 to design worklfows in a development enviroment and pass all levels? (Test/Stage/Prod.) We do not want Visual Studio or Nintex workflow

File System Deployment from DEVelopment to PRODuction

Looking for best practices for doing an SSIS File System deployment from a DEV environment to a PROD environment using either Team System or strictly file based.

Application_Error not firing on Production server.

 Hi, I am trying to setup my application on Production server. Whenever any error occurs, we are redirecting to a specific page in Application_Error Event in Global.asaxThe code in Application_Error Page_________________________________________ string _rawUrl = Request.RawUrl;if (_rawUrl.IndexOf(".aspx") == -1 && _rawUrl.IndexOf(".gif") == -1 && _rawUrl.IndexOf(".jpg") == -1){       string[] _arrRawURL = _rawUrl.Split('/');       Server.Transfer("~/UserHomePage/Default.aspx?UserProfile=" + _arrRawURL[_arrRawURL.Length - 1]);}  It is getting fired Locally. As it was not working, I tried the alternative as belowMade Custom Errors to On in Web.config. and in IIS, in Custom Errors section, under 404 Page I gave the ErrorPage file Name and written the above code. But still  it is not working.Kindly help me out!  Thanks in Advance. Chaitanya.

Development and Production Server software information for Sharepoint 2010 ??

Need to ask my IT Team to get me softwares for Development machines to write code / develop sites which we can give to end customers for deploying in their Sp2010 Production farm . W.r.t to that i have following questions : For Development , a) Which Windows Server 2008 OS version is sufficient - Standard , Enterprise , R2 ? b) Which SQL Server Version is sufficient ? c) Which VIsual studio version ? d) Which Sp2010 license version ?   From Production environment perspective , have following questions - a) What should be a recommendation to client for Production Server - Widows 2008Server sp2 or R2 ? SQL Server 2008 Server Sp2 or R2 ? Which is better and why ?  

System.NullReferenceException: Object reference not set to an instance of an object

        BVWS.Vardering oWS = new BVWS.Vardering();        BVWS.strucBPVardering oSvar1 = new BVWS.strucBPVardering();        BVWS.StrucPaket oPaket = new BVWS.StrucPaket();                 if (Page.IsPostBack)        {             oSvar1 = oWS.BpVardering("", "", regnummer.Text, "2000", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", DropDownList1.SelectedValue);      tdCHK1.Visible = false;                  try            {                if (oSvar1.rubst01.Length > 0)                {                   
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend