Hello,
We are having a situation where the ContextMenu property for the RadRichTextBox is showing as null. What would cause this? Could this be from assembly reference issues? We have one application that is working and another that is not even though they are running the same code/xaml from a shared assembly.
Thanks,
Wil
We are having a situation where the ContextMenu property for the RadRichTextBox is showing as null. What would cause this? Could this be from assembly reference issues? We have one application that is working and another that is not even though they are running the same code/xaml from a shared assembly.
Thanks,
Wil
9 Answers, 1 is accepted
0
Hi Wil,
Thank you for your interest in Telerik RadRichTextBox!
The most common reason for this strange behavior is because RadRichTextBox is influenced by its use of MEF which is used to load extensible components like the format providers and UI widgets. There are some cases when MEF cannot find the assemblies and load the types. To overcome this issue you should change the default catalog used by MEF as described in this help article.
Please, be aware that the default implementation of the Context Menu is related to Telerik.Windows.Documents.RadRichTextBoxUI.dll and make sure all required references are added in your project.
In case you are still experiencing problems, would it be possible to create a sample working project and send it to me? This will be the fastest way to investigate the problem and try to provide a solution.
I hope this helps! Let me know how it goes.
Regards,
Yancho
Telerik
Thank you for your interest in Telerik RadRichTextBox!
The most common reason for this strange behavior is because RadRichTextBox is influenced by its use of MEF which is used to load extensible components like the format providers and UI widgets. There are some cases when MEF cannot find the assemblies and load the types. To overcome this issue you should change the default catalog used by MEF as described in this help article.
Please, be aware that the default implementation of the Context Menu is related to Telerik.Windows.Documents.RadRichTextBoxUI.dll and make sure all required references are added in your project.
In case you are still experiencing problems, would it be possible to create a sample working project and send it to me? This will be the fastest way to investigate the problem and try to provide a solution.
I hope this helps! Let me know how it goes.
Regards,
Yancho
Telerik
0
Wil
Top achievements
Rank 1
answered on 25 Feb 2014, 03:10 PM
Hi Yancho,
Thanks for your response. I will check out the links and information you have provided and let you know how it goes.
Wil
Thanks for your response. I will check out the links and information you have provided and let you know how it goes.
Wil
0
Wil
Top achievements
Rank 1
answered on 03 Mar 2014, 08:00 PM
Hi Yancho,
We've refactored the code to not rely on that menu. I am however, getting a null reference when calling Show on the form and I do not know what is causing it. I've pasted the callstack below.
Thanks,
Wil
We've refactored the code to not rely on that menu. I am however, getting a null reference when calling Show on the form and I do not know what is causing it. I've pasted the callstack below.
Type=System.NullReferenceException
Source=Telerik.Windows.Documents
Message=Object reference not
set
to an instance of an
object
.
StackTrace:
at Telerik.Windows.Documents.UI.DocumentWebLayoutPresenter.FocusCaret(Boolean forceFocus)
at Telerik.Windows.Documents.UI.DocumentWebLayoutPresenter.<SetupUILayers>b__1()
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
Thanks,
Wil
0
Hi Wil,
I’m afraid that I couldn’t determine the cause of this exception. If you have replaced the default ContextMenu of RadRichTextBox, I would suggest you to take a look at this help article which illustrates the recommended way of doing this by using the ContextMenuBuilder class.
If you are still experiencing problems, please send me a sample working project. I would be glad to provide any further assistance.
Thank you in advance. I'm looking forward to your reply.
Regards,
Yancho
Telerik
I’m afraid that I couldn’t determine the cause of this exception. If you have replaced the default ContextMenu of RadRichTextBox, I would suggest you to take a look at this help article which illustrates the recommended way of doing this by using the ContextMenuBuilder class.
If you are still experiencing problems, please send me a sample working project. I would be glad to provide any further assistance.
Thank you in advance. I'm looking forward to your reply.
Regards,
Yancho
Telerik
DevCraft Q1'14 is here! Join the free online conference to see how this release solves your top-5 .NET challenges. Reserve your seat now!
0
Wil
Top achievements
Rank 1
answered on 06 Mar 2014, 03:10 PM
Hi Yancho,
Thanks for your response. Unfortunately, this is working in one app and not the other and they are a bit complicated. I'm not sure if I'd be able to get it down to a small reproducible sample. I'll try if we can't figure it out.
The context menu does not seem to be causing any issues anymore so I think we can ignore that.
What objects are being referenced in the FocusCaret method? That would give me a clue as to what is null.
The code we have replacing the catalog is below - maybe something is missing here.
Thanks,
Wil
Thanks for your response. Unfortunately, this is working in one app and not the other and they are a bit complicated. I'm not sure if I'd be able to get it down to a small reproducible sample. I'll try if we can't figure it out.
The context menu does not seem to be causing any issues anymore so I think we can ignore that.
What objects are being referenced in the FocusCaret method? That would give me a clue as to what is null.
The code we have replacing the catalog is below - maybe something is missing here.
RadCompositionInitializer.Catalog =
new
TypeCatalog(
// format providers
typeof
(RtfFormatProvider),
typeof
(HtmlFormatProvider),
typeof
(TxtFormatProvider),
// mini toolbars
typeof
(SelectionMiniToolBar),
typeof
(ImageMiniToolBar),
// context menu
typeof
(ContextMenu),
// dialogs
typeof
(ChangeEditingPermissionsDialog),
typeof
(FindReplaceDialog),
typeof
(FloatingBlockPropertiesDialog),
typeof
(FontPropertiesDialog),
typeof
(ImageEditorDialog),
typeof
(InsertCaptionDialog),
typeof
(InsertDateTimeDialog),
typeof
(InsertTableDialog),
typeof
(ManageStylesDialog),
typeof
(ProtectDocumentDialog),
typeof
(RadInsertSymbolDialog),
typeof
(RadParagraphPropertiesDialog),
typeof
(StyleFormattingPropertiesDialog),
typeof
(TableBordersDialog),
typeof
(TablePropertiesDialog),
typeof
(TabStopsPropertiesDialog),
typeof
(UnprotectDocumentDialog));
Thanks,
Wil
0
Hi Wil,
I’m afraid that it’s very hard to investigate and determine the cause of this problem based on the given information. Could you share more details about your scenario? What kind of modification have you done? Please try to send us a sample working project it would really clear the situation.
As to the FocusCaret() method, the object that is most likely null is the RadRichTextBox. However, like I said, it is hard to tell what is causing this based on the provided information.
Regards,
Yancho
Telerik
I’m afraid that it’s very hard to investigate and determine the cause of this problem based on the given information. Could you share more details about your scenario? What kind of modification have you done? Please try to send us a sample working project it would really clear the situation.
As to the FocusCaret() method, the object that is most likely null is the RadRichTextBox. However, like I said, it is hard to tell what is causing this based on the provided information.
Regards,
Yancho
Telerik
DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.
0
Wil
Top achievements
Rank 1
answered on 17 Mar 2014, 08:48 PM
Yancho,
I debugged through the code and it seems it is the RadRichTextBox that is null. It seems there is a bug in DocumentWebLayoutWebPresenter.SetupUILayers. It should be checking if Owner is null before calling FocusCaret in the delegate that's being scheduled on the dispatcher.
Do you think you can provide a binary with that change so I can test?
Thanks,
Wil
I debugged through the code and it seems it is the RadRichTextBox that is null. It seems there is a bug in DocumentWebLayoutWebPresenter.SetupUILayers. It should be checking if Owner is null before calling FocusCaret in the delegate that's being scheduled on the dispatcher.
Do you think you can provide a binary with that change so I can test?
Thanks,
Wil
0
Hi Wil,
Thank you for the follow up.
Checks whether the Owner is null are made in the FocusCaret() method itself, so I am not sure this is the cause of the issue. We investigated this extensively, but could not locate a problem or cause the result observed on your end. What is more, we are not quite sure what to look for as the default context menu is not wired with the logic visible from the stack trace.
Like I said in my previous answers, please try to create a sample working project demonstrating the issue you are facing and send it to us through a support ticket. This will be the fastest way to investigate the problem and try to provide a solution.
Additionally, please be aware that we do not provide custom builds. All licensed users have the opportunity to download the source code of our controls. If in your scenario there is a need to change something in the source code, it’s up to you to change and rebuild it. However, an important thing to note is that we do not support any modified source code.
Do not hesitate to contact us back.
Regards,
Yancho
Telerik
Thank you for the follow up.
Checks whether the Owner is null are made in the FocusCaret() method itself, so I am not sure this is the cause of the issue. We investigated this extensively, but could not locate a problem or cause the result observed on your end. What is more, we are not quite sure what to look for as the default context menu is not wired with the logic visible from the stack trace.
Like I said in my previous answers, please try to create a sample working project demonstrating the issue you are facing and send it to us through a support ticket. This will be the fastest way to investigate the problem and try to provide a solution.
Additionally, please be aware that we do not provide custom builds. All licensed users have the opportunity to download the source code of our controls. If in your scenario there is a need to change something in the source code, it’s up to you to change and rebuild it. However, an important thing to note is that we do not support any modified source code.
Do not hesitate to contact us back.
Regards,
Yancho
Telerik
DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.
0
Wil
Top achievements
Rank 1
answered on 20 Mar 2014, 03:05 PM
Hi Yancho,
Thanks for the update.
These checks are not in the assembly we have so they must have been added in a later version than what we have. I'll check to see what the versions are. Hopefully, all that will be needed is to update to the latest version.
I'll let you know.
Thanks,
Wil
Thanks for the update.
These checks are not in the assembly we have so they must have been added in a later version than what we have. I'll check to see what the versions are. Hopefully, all that will be needed is to update to the latest version.
I'll let you know.
Thanks,
Wil