Coder Social home page Coder Social logo

App crash about windowsribbon HOT 26 CLOSED

harborsiem avatar harborsiem commented on June 7, 2024
App crash

from windowsribbon.

Comments (26)

harborsiem avatar harborsiem commented on June 7, 2024

@gpsaliola : I need the project of your application for debugging.

from windowsribbon.

gpsaliola avatar gpsaliola commented on June 7, 2024

The project consists of about 170 forms and 10 external dll (some of mine, some of third's parts).
It's impossible to share all.
Is there a way to trap the error?
Thank you.

from windowsribbon.

harborsiem avatar harborsiem commented on June 7, 2024

@gpsaliola : Can you reduce the app to just one Form with the Ribbon Control in it ? You can also work with try catch blocks. In the catch (Exception ex) block you can save the Stacktrace to a file, which you can analyze.
I don't think that the Exception is thrown by the Ribbon control, because there are no operations with XML.

from windowsribbon.

gpsaliola avatar gpsaliola commented on June 7, 2024

Thank you very much.
I always use try / catch in all functions and produce a log if there is an error with the stack trace.
But in this case the application exits execution without falling into any try catch.
I see the error in VisualStudio in the output window.
I have an application with only the full ribbon and some associated events and it works fine.
Probably the problem as you say must be looked for elsewhere.
Thanks for the help.

from windowsribbon.

gpsaliola avatar gpsaliola commented on June 7, 2024

Hello, I've added my executable in regedit debug section to produce a .dmp file.
I ran this file with VisualStudio and got the following error:
Unhandled exception in 0x00007FF9AE35A7B5 (UIRibbon.dll) in OkMap.exe.968.dmp: 0xC000041D: Unhandled exception during a user callback.
Seems the resposible is this statement "Application.DoEvents()".
Any suggestions?
Thank you.

from windowsribbon.

harborsiem avatar harborsiem commented on June 7, 2024

Do you use "Application Modes" in your Ribbon ? If they are not correct designed, you can get a crash in UIRibbon.dll (Bug in UIRibbon.dll).
How many Ribbons do you use in your big application ?
Do you use Ribbon.RibbonEventException ?
Do you use try catch statements in every Ribbon, RibbonButton, ... event ?

from windowsribbon.

gpsaliola avatar gpsaliola commented on June 7, 2024

Thank you for fouy answer.
Do you use "Application Modes" in your Ribbon ? If they are not correct designed, you can get a crash in UIRibbon.dll (Bug in UIRibbon.dll).
Sorry I cannot find any properties "application modes" in ribbon control. How can I set it?
How many Ribbons do you use in your big application ?
Only one in Mdi form.
Do you use Ribbon.RibbonEventException ?
Yes but this don't trap error.
Do you use try catch statements in every Ribbon, RibbonButton, ... event ?
Yes of course.

from windowsribbon.

harborsiem avatar harborsiem commented on June 7, 2024

ApplicationModes you can set by Ribbon.SetModes.
Mdi is not supported by the Ribbon directly. see: Mdi support.
Without looking to the code of the Ribbon Form, Xml definition of the Ribbon, I have no idea how I can help.

from windowsribbon.

gpsaliola avatar gpsaliola commented on June 7, 2024

Ok, sorry! Yes I've implemented SetModes to show/hide a ribbon panel.
I use these two statements:
Ribbon1.SetModes(0, 0)
Ribbon1.SetModes(0, 1)
However app doesn't crash during execution of these statements.
Here the xml file.
RibbonMarkup.zip
My application makes good use of separate threads (file watcher, background workers, etc ..). Could this be the problem?
Thank you for your support.

from windowsribbon.

harborsiem avatar harborsiem commented on June 7, 2024

You should use Ribbon1.SetModes(0) instead of Ribbon1.SetModes(0, 0). But this is not the problem.
In your RibbonMarkup you define only LargeImages. But you often use SmallImages. It may be a better solution when you define for these items also a SmallImage. The *.png images you can only use in Windows 8 or later. The RibbonMarkup seems well designed. But I can't see the details, because I have not the images and the resourcefiles (RibbonMarkup.resx).

Have you ever tried to use a Ribbon with less complexity in your app, just a basic Ribbon ?
In a microsoft forum I found a reported crash with the UIRibbon.dll Crash. But there is no solution for the crash.

Usage of separate threads should not be a problem, but if you modify the Ribbon or any RibbonItem then you should do this only in the Form thread.

from windowsribbon.

gpsaliola avatar gpsaliola commented on June 7, 2024

Thank you for info.
May be the problem is because I've put the ribbon in a MDI form.
However if I discover something I'll report you.
Thank you very much!
Gian Paolo

from windowsribbon.

tajbender avatar tajbender commented on June 7, 2024

Just a thought, as far as I remember, WindowsRibbon is not thread safe. So all changes to the ribbon have to be in the main thread's context, using Invoke...

Just a hint.

from windowsribbon.

gpsaliola avatar gpsaliola commented on June 7, 2024

Thanks for your answer.
Of course, all calls to routines that change the state of the ribbon components are "under" invoke.
When you move the mouse over the buttons, some of them (sometimes) remained highlighted as if the mouse had remained over them.
Is there a way to prevent the buttons from lighting up when the mouse hover over them?
Thank you.

from windowsribbon.

harborsiem avatar harborsiem commented on June 7, 2024

You can set the Enabled property of the buttons to false in C# code.

from windowsribbon.

gpsaliola avatar gpsaliola commented on June 7, 2024

Thank you but I abandoned the idea of using this ribbon.
I cannot understand why the crash occurs.
Thanks for the help anyway.

from windowsribbon.

harborsiem avatar harborsiem commented on June 7, 2024

It's a pity that you abandoned the idea of using the Windows Ribbon.
My goal is to have a crash free component.

Is it possible to get your RibbonMarkup.ribbon file and all the code that communicate with the Ribbon. It's also interesting for me to have a look to the Ribbon Form code, mainly the RibbonForm.Designer.cs.
What is about the current state with MDI form ?
I have made a small test program with an MDI form (without a MenuStrip) and this seems working well.
I can also build a new Ribbon Library with more detection of HResults inside. The underlying UIRibbon.dll is a COM-Component (native code) which communicate with HResults instead of Exceptions.

Have you looked at my application ElemntViewer which uses also the Ribbon without any problems. The Ribbon specific code is in the file RibbonItems.cs.

from windowsribbon.

gpsaliola avatar gpsaliola commented on June 7, 2024

Hello,
I created a small application with the same ribbon and a small code that uses another thread and it seems to work perfectly.
Unfortunately my application is very complex (you can see the demo version at www.okmap.org) and often crashes in an unsystematic way.
The MDI form is about 18,000 lines of code and the main form (map) about 40,000.
Also it uses several third party components (WeifenLuo Dock panel, Freeimage, GpsBabel, GDAL, GpsGate, 7Zip, GeoTIFF, SQLite, TeamNet Export DBF file) so could be some interference difficult to understand.

from windowsribbon.

harborsiem avatar harborsiem commented on June 7, 2024

Hello,
I see it is a really big application. Crashes in an unsystematic way seems that there is a memory leak anywhere. You can try to set the BaseAddress of the *.dlls to a different address under Project properties > Build > Advanced.

Some hints:
If you want to support your application with the Ribbon also to Windows 7, you can not use *.png files in the Ribbon. You have to convert them to *.bmp files.
You should use a DropDownGallery instead of a DropDownButton for mnuLoadRecentProjects, mnuLoadRecentMaps, …, mnuZoom. In the Gallery you can Add and Remove Button via code.
Just a question:
Do you use the methods Execute(ExecutionVerb verb, PropertyKeyRef key, PropVariantRef currentValue, IUISimplePropertySet commandExecutionProperties) or UpdateProperty(ref PropertyKey key, PropVariantRef currentValue, ref PropVariant newValue) ? You should not do it.

Please can you tell which Ribbon (RibbonButton, …) functions, properties, events you use.

from windowsribbon.

gpsaliola avatar gpsaliola commented on June 7, 2024

I used only: Controls.RibbonItems(...), SetModes, Minimized, LoadSettingsFromStream, SaveSettingsFromStream, Items Properties: Enabled, Tag and Label, Event ExecuteEvent via addHandler.

from windowsribbon.

harborsiem avatar harborsiem commented on June 7, 2024

You should define a Command for the QuickAccessToolbar because LoadSettingsFromStream, SaveSettingsFromStream handle with the QAT. Best approach to run LoadSettingsFromStream is in the event Ribbon.ViewCreated and SaveSettingsFromStream in the event Ribbon.ViewDestroy. See implementation in the ElemntViewer, file RibbonItems.cs.

from windowsribbon.

gpsaliola avatar gpsaliola commented on June 7, 2024

Can this be the problem? I used them in map Load and map Closing

from windowsribbon.

harborsiem avatar harborsiem commented on June 7, 2024

Load event fired before ViewCreated. Maybe this is critical.
FormClosing fired before ViewDestroy
But you should define a Command in the Markup for the QAT anyway.
Is map your Form with the Ribbon ?

from windowsribbon.

gpsaliola avatar gpsaliola commented on June 7, 2024

No, the ribbon is in MdiForm.
Ribbon controls status can be changed by MDI and Map.
When there is a separated thread I test InvokeRequired and use Invoke to change ribbon controls status.

from windowsribbon.

harborsiem avatar harborsiem commented on June 7, 2024

And the Map is a Child of the MdiForm ? Is the MdiForm the MainForm of the application ?

from windowsribbon.

gpsaliola avatar gpsaliola commented on June 7, 2024

Yes. Yes. :-)

from windowsribbon.

harborsiem avatar harborsiem commented on June 7, 2024

gpsaliola changed to RibbonWinForms project for the Ribbon menu. In the Issues of the RibbonWinforms he had also problems. He solved the problems with Invoke statements in his application.
I think the problems with the WindowsRibbon are the same.

from windowsribbon.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.