.NET Questions and Solutions

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries for the ‘object reference’ Category

DEFECT ERROR: Object Reference not set to an Instance of an Object

Symptoms
“Object reference not set to an instance of an object” This error occurs when generating a report for a company that has been deleted from within FRx.
Resolution
This SMR has been fixed in R04670 Service Pack, please check our website () for availability of Service Packs for your General Ledger. You may also sign up for automatic notification of Services on our website .

CLM: Object reference not set to an instance of an object

Symptoms
Source: Microsoft Support
Resolution
RAPID PUBLISHING ARTICLES PROVIDE INFORMATION DIRECTLY FROM WITHIN THE MICROSOFT SUPPORT ORGANIZATION.THE INFORMATION CONTAINED HEREIN IS CREATED IN RESPONSE TO EMERGING OR UNIQUE TOPICS, OR IS INTENDED SUPPLEMENT OTHER KNOWLEDGE BASE INFORMATION.

BUG: Starting Word Manually Uses Same Instance as Automation

Symptoms
You run a Visual Basic application that uses the CreateObject function tostart a hidden instance of Microsoft Word. The application is idle, but itstill maintains a reference to Word. Next, you manually start an instanceof Word. A separate instance of Word should open, but the same instancethat was created by the Visual Basic application is made active instead. Ifyou close Word and continue to work in the Visual Basic application, one of the following errors occurs when the application tries to use Word objectsbecause Word is no longer running:

Run-time error ‘462′:
The remote server machine does not exist or is unavailable
-or-

Run-time error ‘-2147023174 (800706ba)’:
Automation errorThis automation error translates to “The RPC server is unavailable.”
Resolution
Use one of the following to work around this problem:Before you create your Word object, first create a temporary Wordobject. After you create your object, close the temporary object. Thiscauses Word to act properly when you control it through Automation (thatis, if a user interactively starts Word, a new instance of Word isopened for the user). The automation instance remains hidden andseparate. See the Steps to Reproduce Behavior section for an example ofthis workaround.Make the Word object visible immediately after using the CreateObjectfunction. This workaround is only for Microsoft Word 97. For example:

Set wrdApp = CreateObject(“Word.Application”)wrdApp.Visible = True

BUG: Script Errors with Cache-Control:no-cache HTTP Header and HTTP Compression

Symptoms
If you read Web pages from a site, an HTML page may be incomplete, or you may receive script error messages such as the following in Microsoft Internet Explorer (Programming) version 6.0:

Object doesn’t support this property or method
-or-

‘(object reference)’ is null or not an object It is also possible that an HTML page may be incomplete.
This occurs when you read Web pages from a site that uses all the following: Script in external files, for example, JScript (.js) filesFrames and script inside the frames that refers to variables or to methods that are defined in other framesHTTP compression to compress the HTML and the script filesHTTP headers that prevent the browser from caching the pages
The symptoms of this problem typically occur inconsistently and may appear random. Sometimes the error messages may appear when you first load the site. At other times the error messages may appear when you refresh the page.
Resolution
To work around this problem, you can do either of the following: If you use a Cache-Control: no-cache HTTP header to prevent the files from caching, remove that header. In some situations, if you substitute an Expires HTTP header, you do not trigger the problem.
-or-
Do not enable HTTP compression for the script files.

BUG: SavePicture Function Hangs VFP When Zero Disk Space

Symptoms
Using the SavePicture function to create a bitmap from a picture objectreference and saving it to a storage media that has zero disk space hangsVisual FoxPro 5.x or 6.0.
Resolution
Free up some disk space before using the SavePicture function to create abitmap.

BUG: Report Preview with Form’s Name Clears Object Reference

Symptoms
Issuing a REPORT FORM PREVIEW command on a report that has the same filename as a form that is running causes the form to lose its objectreference. If you attempt to reference the form object in code, this errormessage appears:

Object not found
Resolution
If you have a form called Customer and issue the following command, anobject reference named Customer is created for the form:

DO FORM Customer Preview a report named Customer by issuing the following command:

REPORT FORM Customer PREVIEW The customer object now references the Report Preview window. When theReport Preview window is closed, the customer object is released. Workaround this problem by giving your forms a different object reference thanthe reports with the same name. Do this by using the NAME clause in the DOFORM command. For example, to give the Customer Form an object reference ofCustform, you would issue the following command:

DO FORM Customer NAME Custform