RibbonControlAdv Object reference not set to an instance of an object

Hello,

My RibbonControlAdv has a TabbedMDIControl.

That TabbedMDICOntrol has ShowCloseButton = true.

Everytime I close a Tab on Close button, I got this Exception and all Aplication exits...

{"Object reference not set to an instance of an object."} which is pointing to my program.cs Application.Run(new Form());

   at Syncfusion.Styles.StyleInfoBase._GetExpandableObjectProperty(StyleInfoProperty sip)
   at Syncfusion.Styles.StyleInfoBase.GetValue(StyleInfoProperty sip)
   at Syncfusion.Windows.Forms.Tools.ToolStripExStyleInfo.get_LauncherStyle()
   at Syncfusion.Windows.Forms.Tools.LauncherStyleInfo.GetLauncherForeColor(IToolStripExSupport2 IRibbon)
   at Syncfusion.Windows.Forms.Tools.ToolStripExThemeRenderer.PaintLauncher(Graphics g, Rectangle rcCaption, IToolStripExSupport2 iRibbon)
   at Syncfusion.Windows.Forms.Tools.ToolStripExThemeRenderer.DrawCaption(ToolStrip ts)
   at Syncfusion.Windows.Forms.Tools.Office12ToolStripRenderer.CToolStripWindow.OnNcPaint(Message& m)
   at Syncfusion.Windows.Forms.Tools.Office12ToolStripRenderer.CToolStripWindow.ProcessMessage(Message& m)
   at Syncfusion.Windows.Forms.Tools.NativeMessageHandler.CallWndProc(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at Syncfusion.Windows.Forms.Tools.NativeMessageHandler.WndProc(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

9 Replies 1 reply marked as answer

VR Vijayalakshmi Roopkumar Syncfusion Team August 31, 2020 12:56 PM UTC

Hi Carlos 
 
We have checked the reported behavior with RibbonControlAdv using the reported scenario, but we are unable to reproduce the reported issue. Please check our sample and confirm us whether our replication scenario is same with you. 
 
 
 
Please check this video , sample and let us know if it is same with you. If not, kindly modify our sample into issue reproducible and also provide your currently using product version details. It would be helpful for us to proceed on this further. 
 
Regards, 
Vijayalakshmi VR. 



CF Carlos Ferreira August 31, 2020 03:39 PM UTC

Hello and thank you for your answer.

I found a way to resolve this problem.

I created a custom Office2019 theme and added the first line "SkinManager.LoadAssembly(typeof(MyTheme).Assembly);" of program.cs file before any other line, like this:

            SkinManager.LoadAssembly(typeof(MyTheme).Assembly);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Forms.NavigationMenu());

Commenting the first line, the problem is resolved, however, the theme is not applied at all.

Dragged the SkinManager to my RibbonForm and uncommenting the first line, the Theme is back and only a few times the problem is back. So, I can't see where the problem is, really!


VR Vijayalakshmi Roopkumar Syncfusion Team September 1, 2020 12:23 PM UTC

Hi Carlos 
 
Thank you for your update. 
 
Query :Commenting the first line, the problem is resolved, however, the theme is not applied at all. Dragged the SkinManager to my RibbonForm and uncommenting the first line, the Theme is back and only a few times the problem is back. So, I can't see where the problem is, really! 
 
The theme would apply only on setting the skinmanager with theme in Program.cs. However we cleared that issue is due to Office2019 theme. 
 
So, we have checked the reported behavior using custom office2019 theme by exporting the office2019colorful and apply it in using program.cs. The application has been working fine at our end without any exception. Please find the sample and video for the same from below links: 
 
 
 
Please check the sample, video and confirm us our replication is same with yours. If not, please modify our sample into issue reproducible along with brief replication scenario. Also, we would like to have a web meeting with you in order to check the application at your end to avoid the further delays. Please let us know your availability time , so that we can arrange it accordingly. 
 
Regards, 
Vijayalakshmi VR 



CF Carlos Ferreira September 2, 2020 01:48 PM UTC

Well, you're right.
The Theme is not the problem.

The problem is that I have a MainForm which is MdiContainer.
That MainForm has ribbonControlAdv and some buttons.
When I click one of those buttons, the new Form (Form A) will open in MainForm as a new Tab.
That new Form (Form A) has other buttons (which are merged in ribbonControlAdv with ribbonPanelMergeContainer1) and OnCLick, will open other Forms (Form B).
I need those other Forms (Form B or C or others) opened in MainForm MdiContainer.

For that, I'm using like this (In this case is a CellDoubleClick Event on a SfDataGrid on Form A), but is the same from a button.

private void data_CellDoubleClick(object sender, Syncfusion.WinForms.DataGrid.Events.CellClickEventArgs e)
        {
            EditForm edit = new EditForm(this, SelectedRow);
            edit.MdiParent = ActiveForm as MainForm;
            edit.Show();
        }
The Form B opens in MdiContainer correctly (as expected) and I can work in Form B. Even closing Form B has same issues.

When I click the Close button tab in MdiContainer MainMenu on Form A, the error arrises in here:

FormA.Designer.cs - in Form A
protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing); //Error: Object not set to an instance of an object
        }

Now, I can't figure out what's causing this but maybe the Form B is still not Disposed correctly? Need to add some kind of event On Form Closing or Form Closed?


CF Carlos Ferreira September 2, 2020 03:18 PM UTC

I've attached your sample modified with my currently forms just to show the errors.

Start Project.
Open Form 1.
Open other Form 2.
Close Form 2.
Close Form 1.

Attachment: Office2019thememodified_ef1945bc.zip


VR Vijayalakshmi Roopkumar Syncfusion Team September 3, 2020 01:29 PM UTC

Hi Carlos 
 
Thank you for your update. 
 
We have checked the reported behavior " NRE crash occurred in RibbonControlAdv on closing the TabbedMDI child with Office2019 and High Contrast Themes" with RibbonControlAdv and confirmed it is a defect. We have logged a report on this and the patch for this fix is estimated to be available on 17th Sep,2020. You can track the status of this defect using the following feedback link: 
 
 
Also, please let us know your currently using product version, so that we can check and provide you the patch accordingly. Please try this solution and let us know if it meets your requirement. 
 
Regards, 
Vijayalakshmi VR 



CF Carlos Ferreira September 3, 2020 01:46 PM UTC

Hello.

Thank you for your reply.

Currently using version 18.2.0.44


VR Vijayalakshmi Roopkumar Syncfusion Team September 4, 2020 04:25 AM UTC

Hi Carlos, 
 
Thank you for your update. 
 
As updated earlier , we will provide you the patch in 18.2.0.44v on 17th Sep, 2020. 
 
Please let us know if you have any other concerns. 
 
Regards 
Vijayalakshmi VR  



VR Vijayalakshmi Roopkumar Syncfusion Team September 17, 2020 03:59 PM UTC

Hi Carlos,     
    
Thanks for your patience.   
   
The reported issue has been fixed with RibbonControlAdv and included in the patch which can be download from the below links.   
    
Recommended approach - exe will perform automatic configuration.    
    
Please find the patch setup from below location:    
    
 
 
 
   
  
Assembly Version: 18.2.0.44   
    
Installation Directions:    
This patch should replace the files "Syncfusion.Tools.Windows” under the following folder.    
$system drive:\ Files\Syncfusion\Essential Studio\$Version # \precompiledassemblies\$Version#\[TargetFramework]    
Eg : $system drive:\Program Files\Syncfusion\Essential Studio\18.2.0.44\precompiledassemblies\18.2.0.44\\4.6    
    
To automatically run the Assembly Manager, please check the Run assembly manager checkbox option while installing the patch. If this option is unchecked, the patch will replace the assemblies in precompiled assemblies’ folder only. Then, you must manually copy and paste them to the preferred location or you must run the Syncfusion Assembly Manager application (available from the Syncfusion Dashboard, installed as a shortcut in the Application menu) to re-install assemblies.    
    
       
Disclaimer:    
Please note that we have created this patch for version 18.2.0.44 specifically to resolve the issue reported in this incident. If you have received other patches for the same version for other products, please apply all patches in the order received.  Please let us know, if you are using any other Syncfusion version, we will provide patch in your version.    
    
Regards,    
Vijayalakshmi VR 


Marked as answer
Loader.
Up arrow icon