Click here to Skip to main content
15,899,475 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I've added ribbon form in my project. when i Insert textbox into my rich edit control. it has added perfectly. my problem is i closed my form then it'll show me "Object reference not set to an instance of an object." Exception. i dont know why this error occur and even dont know how to fix it?
Another one thing.. I've developed this project individually its working perfect. when i integrate this project to another main project. there oly error occur.

Is there any way to avoid exception using FormClosing Event or Exception handling Method..
This is Output sample


16.05.13 12:20:36.992	Action 'ShowNavigationItem' done
16.05.13 12:20:37.148	Application startup done
16.05.13 12:20:37.148	=========================
16.05.13 12:20:37.148	Application running
16.05.13 12:20:37.148	====================
16.05.13 12:20:42.259	--------------------------------------------------------------------------------
16.05.13 12:20:42.259	Execute action
16.05.13 12:20:42.259		Type: DevExpress.ExpressApp.Actions.SimpleAction
16.05.13 12:20:42.275		ID: ListViewShowObject
16.05.13 12:20:42.275		Category: ListView
16.05.13 12:20:42.275		ContextName: Snap Template
16.05.13 12:20:42.275		IsRoot: True
16.05.13 12:20:42.275		Selection.Count: 1
16.05.13 12:20:42.275		CurrentObject: M5.Objects.SnapTemplate(dbd012b1-f1b9-477a-82ef-1e4f7da1c0f5)
'M5.Win.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\DevExpress.XtraRichEdit.v12.2.Extensions\12.2.7.0__b88d1754d700e49a\DevExpress.XtraRichEdit.v12.2.Extensions.dll'
'M5.Win.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\DevExpress.Snap.v12.2\12.2.7.0__b88d1754d700e49a\DevExpress.Snap.v12.2.dll'
'M5.Win.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\DevExpress.Snap.v12.2.Core\12.2.7.0__b88d1754d700e49a\DevExpress.Snap.v12.2.Core.dll'
'M5.Win.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\DevExpress.Snap.v12.2.Extensions\12.2.7.0__b88d1754d700e49a\DevExpress.Snap.v12.2.Extensions.dll'
'M5.Win.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll'
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadInvalidTypeException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Xpo.v12.2.dll
A first chance exception of type 'DevExpress.Xpo.Exceptions.CannotLoadObjectsException' occurred in DevExpress.Data.v12.2.dll
A first chance exception of type 'System.NullReferenceException' occurred in DevExpress.RichEdit.v12.2.Core.dll
A first chance exception of type 'System.NullReferenceException' occurred in System.Windows.Forms.dll
A first chance exception of type 'System.NullReferenceException' occurred in DevExpress.XtraRichEdit.v12.2.dll
16.05.13 12:21:04.161	================================================================================
The error occurred:

	Type:       NullReferenceException
	Message:    Object reference not set to an instance of an object.
	Data:       0 entries
	Stack trace:

   at DevExpress.XtraRichEdit.Model.DocumentModel.ApplyChangesCore(PieceTable pieceTable, DocumentModelChangeActions actions, RunIndex startRunIndex, RunIndex endRunIndex)
   at DevExpress.XtraRichEdit.Model.ContentTypeBase.ApplyChangesCore(DocumentModelChangeActions actions, RunIndex startRunIndex, RunIndex endRunIndex)
   at DevExpress.XtraRichEdit.Model.PieceTable.ApplyChangesCore(DocumentModelChangeActions actions, RunIndex startRunIndex, RunIndex endRunIndex)
   at DevExpress.XtraRichEdit.Model.RichEditIndexBasedObject`1.ApplyChanges(DocumentModelChangeActions changeActions)
   at DevExpress.XtraRichEdit.Model.PropertiesBase`1.DevExpress.XtraRichEdit.Model.IPropertiesContainer.EndPropertiesUpdate()
   at DevExpress.XtraRichEdit.Model.TableCellProperties.CopyFrom(TableCellProperties properties)
   at DevExpress.XtraRichEdit.Model.TableCellStyle.CopyProperties(TableCellStyle source)
   at DevExpress.XtraRichEdit.Model.DocumentModelCopyCommand.ReplaceStylesCore[T](StyleCollectionBase`1 targetStyles, StyleCollectionBase`1 sourceStyles)
   at DevExpress.XtraRichEdit.Model.DocumentModelCopyCommand.ReplaceDefaultStyles(DocumentModel targetModel, DocumentModel sourceModel)
   at DevExpress.XtraRichEdit.Model.DocumentModelCopyCommand.ExecuteCore()
   at DevExpress.XtraRichEdit.Model.PieceTableCommand.Execute()
   at DevExpress.XtraRichEdit.Model.TextBoxFloatingObjectContent.Clone(FloatingObjectAnchorRun run)
   at DevExpress.XtraRichEdit.Model.FloatingObject.CopyFrom(FloatingObject floatingObject)
   at DevExpress.XtraRichEdit.Model.FloatingObjectAnchorRun.Copy(DocumentModelCopyManager copyManager)
   at DevExpress.XtraRichEdit.Model.CopyParagraphOperation.ProcessRuns(RunIndex firstRunIndex, RunIndex lastRunIndex)
   at DevExpress.XtraRichEdit.Model.CopyParagraphOperation.ProcessParagraph(RunIndex runIndex, ParagraphIndex paragraphIndex)
   at DevExpress.XtraRichEdit.Model.CopyParagraphOperation.ProcessMiddleCore(ParagraphIndex startIndex, ParagraphIndex endParagraphIndex)
   at DevExpress.XtraRichEdit.Model.CopyParagraphOperation.ProcessMiddle(RunInfo info, Int32 paragraphCount, Boolean documentLastParagraphSelected)
   at DevExpress.XtraRichEdit.Model.SelectionBasedOperation.ProcessContentCrossParent(RunInfo info, Boolean documentLastParagraphSelected)
   at DevExpress.XtraRichEdit.Model.SelectionBasedOperation.ExecuteCore(RunInfo info, Boolean documentLastParagraphSelected)
   at DevExpress.XtraRichEdit.Model.CopyParagraphOperation.ExecuteCore(RunInfo info, Boolean documentLastParagraphSelected)
   at DevExpress.XtraRichEdit.Model.CopySectionOperation.ProcessContentInsideParent(RunInfo info, Boolean allowMergeWithNextParagraph, Boolean documentLastParagraphSelected)
   at DevExpress.XtraRichEdit.Model.CopySectionOperation.ProcessTail(RunInfo info, Boolean documentLastParagraphSelected)
   at DevExpress.XtraRichEdit.Model.SelectionBasedOperation.ProcessContentCrossParent(RunInfo info, Boolean documentLastParagraphSelected)
   at DevExpress.XtraRichEdit.Model.SelectionBasedOperation.ExecuteCore(RunInfo info, Boolean documentLastParagraphSelected)
   at DevExpress.XtraRichEdit.Model.CopySectionOperation.ExecuteCore(RunInfo runInfo, Boolean documentLastParagraphSelected)
   at DevExpress.XtraRichEdit.Model.SelectionBasedOperation.Execute(DocumentLogPosition startLogPosition, Int32 length, Boolean documentLastParagraphSelected)
   at DevExpress.XtraRichEdit.Model.DocumentModelCopyCommand.ExecuteCore()
   at DevExpress.XtraRichEdit.Model.PieceTableCommand.Execute()
   at DevExpress.XtraRichEdit.Model.DocumentModel.CreateDocumentModelForExport(Action`1 initializeEmptyDocumentModel)
   at DevExpress.XtraRichEdit.API.Internal.InternalAPI.PrepareModelForExport(DocumentFormat format)
   at DevExpress.XtraRichEdit.API.Internal.InternalAPI.PreparePlainTextExport(PlainTextDocumentExporterOptions options)
   at DevExpress.XtraRichEdit.API.Internal.InternalAPI.GetDocumentPlainTextContent(PlainTextDocumentExporterOptions options)
   at DevExpress.XtraRichEdit.API.Internal.InternalAPI.GetDocumentPlainTextContent()
   at DevExpress.XtraRichEdit.API.Internal.InternalAPI.get_Text()
   at DevExpress.XtraRichEdit.RichEditControl.get_Text()
   at System.Windows.Forms.Control.OnHandleDestroyed(EventArgs e)
   at DevExpress.XtraRichEdit.RichEditControl.OnHandleDestroyed(EventArgs e)
   at System.Windows.Forms.Control.WmDestroy(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at DevExpress.XtraRichEdit.RichEditControl.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
	InnerException is null
Posted
Updated 15-May-13 21:30pm
v4
Comments
kumar2413 16-May-13 2:33am    
For this it might have problem with your datatype length. Check back all your data member data type with the length.
sencsk 16-May-13 2:36am    
I've used varbinary(MAX) because i'm trying to store byte values(Rich edit control values).
kumar2413 16-May-13 2:38am    
Don just check 1 datatype check for everything. I have made the same mistake many time tht y i can know or may be you didn't use the NEW keyword when assign a new variable. check all this. It is best if you post your code
sencsk 16-May-13 2:40am    
How could i? its containing 5 files.
sencsk 16-May-13 2:43am    
In my table i've 2 fields only one is Bytevalue-varbinary(MAX) another one is Name-varchar(100). then how can i proceed next

1 solution

The only thing you can do is to use the debugger.
Run your code, close your form and when you get the exception, look at the line of code it is complaining about. Use the mouse over to examine all the variables in use on the line, and find which one contains a null value. Then it's just a case of working out why it doesn't have a sensible value!

Sorry to sound unhelpful here, but without that kind of information (line and method at a minimum) we really can't help much more!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900