Showing posts with label suddenly. Show all posts
Showing posts with label suddenly. Show all posts

Saturday, March 31, 2012

Strange "Object reference not set to an instance of an object" error in webform

I suddenly received an unexpected error in my project. I have been working
on this project for some time without this issue. Nothing has changed in the
form that caused the exception. A little experimentation shows that I cannot
run ANY .NET web project without getting this error:

-----------------------
--

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

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

Source Error:

Line 1: <%@dotnet.itags.org. Page Language="vb" AutoEventWireup="false"
Codebehind="Login.aspx.vb" Inherits="DataBayWeb.Login" %>
Line 2: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
Line 3: <HTML
Source File: c:\inetpub\wwwroot\DataBayWeb\login.aspx Line: 1

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an
object.]
System.Web.UI.Control.get_Controls()
System.Web.UI.Control.AddParsedSubObject(Object obj)

System.Web.UI.Control.System.Web.UI.IParserAccesso r.AddParsedSubObject(Objec
t obj)
ASP.Login_aspx.__BuildControlTree(Control __ctrl) in
c:\inetpub\wwwroot\DataBayWeb\login.aspx:1
ASP.Login_aspx.FrameworkInitialize()
System.Web.UI.Page.ProcessRequest()
System.Web.UI.Page.ProcessRequest(HttpContext context)

System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication+IExecutionSte
p.Execute()
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously)

Other developers on my team can run the latest version of the project
without an issue. What has happened?

ChrisVery strange indeed. It might sound obscure, but try removing the
space in <%@. Page...

Otherwise, I would be tempted to do the inevitable and reinstall the
framework.

Simon.

Strange "Object reference not set to an instance of an object" error in web

I suddenly received an unexpected error in my project. I have been working
on this project for some time without this issue. Nothing has changed in the
form that caused the exception. A little experimentation shows that I cannot
run ANY .NET web project without getting this error:
----
--
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
Source Error:
Line 1: <%@dotnet.itags.org. Page Language="vb" AutoEventWireup="false"
Codebehind="Login.aspx.vb" Inherits="DataBayWeb.Login" %>
Line 2: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
Line 3: <HTML>
Source File: c:\inetpub\wwwroot\DataBayWeb\login.aspx Line: 1
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.]
System.Web.UI.Control.get_Controls()
System.Web.UI.Control.AddParsedSubObject(Object obj)
System.Web.UI.Control.System.Web.UI.IParserAccessor.AddParsedSubObject(Objec
t obj)
ASP.Login_aspx.__BuildControlTree(Control __ctrl) in
c:\inetpub\wwwroot\DataBayWeb\login.aspx:1
ASP.Login_aspx.FrameworkInitialize()
System.Web.UI.Page.ProcessRequest()
System.Web.UI.Page.ProcessRequest(HttpContext context)
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionSte
p.Execute()
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously)
Other developers on my team can run the latest version of the project
without an issue. What has happened?
ChrisVery strange indeed. It might sound obscure, but try removing the
space in <%@. Page...
Otherwise, I would be tempted to do the inevitable and reinstall the
framework.
Simon.

Monday, March 26, 2012

strange error

My webform is working properly for an hour or so.. then suddenly it stops working. No matter what I put inside Page_Load(), Response.Redirect("hhsjdh.aspx"); for example, it doesn´t redirect or seem to care what I type.

I don´t get any errors or so, but empty tables since the mysql data is not fetched.

I have cleaned the cache and tried three different browsers. I rebuild the solution everytime I make a change in a code behind file.

I use sessions and mysql odbc driver 3.51 if that helps.Does the web server you posting to have a proxy server? Even some hardware firewalls come with proxy servers now. If so, it may have chached your page and you will need to clear the server's cache.
restart your IIS may help. type this in command line widow: iisreset /restart. It is possible that your IIS does not work properly.

Strange Error

Hello,

I am using ASP.NET 2.0 with SQL 2005 to save the profile.

Suddenly, out of nothing I got the following error:

The 'System.Web.Profile.SqlProfileProvider' requires adatabase schema compatible with schema version '1'. However, thecurrent database schema is not compatible with this version. You mayneed to either install a compatible schema with aspnet_regsql.exe(available in the framework installation directory), or upgrade theprovider to a newer version.

Description:Anunhandled exception occurred during the execution of the current webrequest. Please review the stack trace for more information about theerror and where it originated in the code.

Exception Details:System.Configuration.Provider.ProviderException:The 'System.Web.Profile.SqlProfileProvider' requires a database schemacompatible with schema version '1'. However, the current databaseschema is not compatible with this version. You may need to eitherinstall a compatible schema with aspnet_regsql.exe (available in theframework installation directory), or upgrade the provider to a newerversion.

Source Error:

Line 22: Public Overridable Property Contacts() As PR.Contacts
Line 23: Get
Line 24: Return CType(Me.GetPropertyValue("Contacts"),PR.Contacts)
Line 25: End Get
Line 26: Set


I have no idea what is going on.

I already deleted all the databases and added a few more but nothing ... I used aspnet_regsql.exe from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regsql.exe.

What should I do?

Thanks,

Miguel

You are missing the schema entry in the aspnet_schemaversions table for your database, if you moved the db from one server to another using scripts you still need to add the entries in this table.

Open this table and see if anything is missing. (profile,1,true) is what you need.

-c


Hello,

I didn't move the database. This is on my computer and I created the databases using aspnet_regsql.exe.

I opened ScemaVersions database and I have this:

common1Truehealth monitoring1Truemembership1Truepersonalization1Trueprofile1Truerole manager1True

What might be going wrong here?

I started to get this error out of nothing. I really have no idea what might be the cause of it.

Thanks,

Miguel


Can you post the profile config xml from your web.config - remember to hide passwords! ;)

Hi,

Where is my profile code in Web.Config:

<!-- Profile -->
<profile enabled="true" defaultProvider="ProfileProvider" automaticSaveEnabled="true">

<!-- Profile Providers -->
<providers>
<clear/>
<add applicationName="AppName" connectionStringName="MyDatabase" name="ProfileProvider" type="System.Web.Profile.SqlProfileProvider"/>
</providers>

<!-- Profile Properties -->
<properties>
<add allowAnonymous="false" name="Collaborator" type="MyWebSite.Collaborator" serializeAs="Binary"/>
<add allowAnonymous="false" name="Contacts" type="MyWebSite.Contacts" serializeAs="Binary"/>
<add allowAnonymous="false" name="Options" type="MyWebSite.Options" serializeAs="Binary"/>
<add allowAnonymous="false" name="Personal" type="MyWebSite.Personal" serializeAs="Binary"/>
<add allowAnonymous="true" name="Settings" type="MyWebSite.Settings" serializeAs="Binary"/>
</properties>

</profile>

Any idea what might be going on?

Thanks,

Miguel


Ok some more questions - I see you're using custom types with a binary serializer - why? and did you change the class definitions for any of these custom types? If so and there was stored profile data, this would break your system since the serializer wouldn't be able to de-serialize the objects.

-c


maybe just something to try - but if you did change your class definitions - try deleting all the data in the profile table, it should re-serialize and might fix it.

-c


Hi,

Should I use other type?

Here is a class as example:

' Collaborator
<Serializable()> _
Public Class Collaborator

' -- [Properties] --------------

' Comments
Private _Comments As String
Public Property Comments() As String
Get
Return _Comments
End Get
Set(ByVal value As String)
_Comments = value
End Set
End Property ' Comments

' CurriculumVitae
Private _CurriculumVitae As String
Public Property CurriculumVitae() As String
Get
Return _CurriculumVitae
End Get
Set(ByVal value As String)
_CurriculumVitae = value
End Set
End Property ' CurriculumVitae
...

And by the way, suddenly I stopped getting the error.

This was really strange.

Thanks,

Miguel