Similar Threads
1. Object reference not set to an instance of an object - Exception in System.Data.OracleClient - ADO.Net
2. Null Reference Exception In System.Data.OracleClient Method?!
3. [newbie] need help on this NULL object reference - Asp.Net
4. Does setting object reference to null help the GC in collection
I am having this confusion going on in my head for sometime now. The
question is whether setting the object reference to null (nothing)
help the GC in collection in anyway?
Can anyone shed some light on this? Is there any way to validate this
proposition? Or is it just a myth...
-Thanks,
Shree
5. DataSet.Select & FindClosestCandidateIndex - CSharp/C#
6. Async calls to HttpWebResponse giving Null reference in system.dll at System.Net.Sockets.OverlappedAsyncResult.CompletionPortCallback
I am trying to grab web pages using asynchronous calls HttpWebResponse.BeginGetResponse. It looks something like thi
for (int i = 0; i<50; i++)
request[i] = (HttpWebRequest)WebRequest.Create("some website")
request[i].BeginGetResponse(new AsyncCallback(ProcessResponse),link)
Thread.Sleep(40000)
void ProcessResponse(System.IAsyncResult state
HttpWebRequest request = ((HttpWebRequest)state.AsyncState).EndGetResponse(state)
StreamReader lstream = new StreamReader(linkpage.GetResponseStream());
//Process the html page via the lstrea
I just put the sleep in there because I wasn't sure if there was a problem with using Waitall and autoresetevents, but I guess after taking that out there is still a problem. I would like to put that back in there when I clear up this error
What happens is it gets to the sleep statement and processes the first 3 webpages and then throws a System.NullReferenceException in >system.dll! System.Net.Sockets.OverlappedAsyncResult.CompletionPortCallback(uint errorCode = 64, uint numBytes = 0, System.Threading.NativeOverlapped* nativeOverlapped = 1670656) + 0xa0 bytes
Can anybody help me get rid of this
Thank you
7. Object reference set to a null reference? - CSharp/C#
8. System.NullReferenceException: Object reference not set to an instance of an object
I have a given dll file(PDFCreator.dll) - probably generated by VC++.
I want to use its method(PDFCreator()) in dotNet environment. It works
well in WindiowsApplication, but bad in WebApplication ,the line that
calls the function results in the "Object reference not set to an
instance of an object" error.
The following is the VB.NET code I am using to define the structures,
declare the unmanaged DLL function and call the unmanaged DLL
function.
Any help on this would be tremendously appreciated.
--------------------------------------------------------------------------------
efine a class which declare the methods of PDFCreator.dll
Public Class Class1
ethod of PDFCreator.dll
Public Declare Function PDFExtractor Lib "PDFCreator.dll" Alias
"?PDFExtractor@@YGHPBD@Z" (ByVal xmlFileName As String) As Long
ethod of PDFCreator.dll
Public Declare Function PDFCreator Lib "PDFCreator.dll" Alias
"?PDFCreator@@YGHPBD00QAPADI@Z" _
(ByVal xmlFileName As String, _
ByVal addrFileName As String, _
ByVal pdfFileName As String, _
ByRef attachFileName() As String, _
ByVal attachFileCnt As Long) As Long
End Class
--------------------------------------------------------------------------------
Use methods of Class1 in an Windows Form
Run this Form, everything is ok
Public Class Form1
Inherits System.Windows.Forms.Form
Public Sub New()
MyBase.New()
InitializeComponent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
Private components As System.ComponentModel.IContainer
Friend WithEvents Button1 As System.Windows.Forms.Button
< Private Sub
InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(152, 88)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(80, 48)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 12)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim c As Class1 = New Class1
Use method of Class1, it goes well
c.PDFExtractor("c:\a\a.pdf")
End Sub
End Class
--------------------------------------------------------------------------------
Use methods of Class1 in a WebForm
Run this WebForm , it goes wrong
Public Class WebForm1
Inherits System.Web.UI.Page
< Private Sub
InitializeComponent()
End Sub
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim c As Class1 = New Class1
Use method of Class1 , raise an error
c.PDFExtractor("c:\a\a.pdf")
End Sub
End Class
--------------------------------------------------------------------------------
the error message :
source error:
line 29: Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
line 30: Dim c As Class1 = New Class1
line 31: c.PDFExtractor("c:\a\a.pdf")
line 32: End Sub
line 33: End Class
stack trace:
[NullReferenceException: Object reference not set to an instance of an
object. ]
ClassLibrary1.Class1.PDFExtractor(String& xmlFileName) +0
WebApptest.WebForm1.Button1_Click(Object sender, EventArgs e) in
C:\Inetpub\wwwroot\WebApptest\WebForm1.aspx.vb:31
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
--------------------------------------------------------------------------------
version: Microsoft .NET Framework version :1.1.4322.573; ASP.NET
Version:1.1.4322.573