Development issue: Plugin configuration is not saved in Debug mode (1 Viewer)

horned_reaper

Test Group
  • Team MediaPortal
  • January 7, 2011
    1,233
    461
    Munich
    Home Country
    Germany Germany
    Hi all,

    I try to debug the Configuration dialog window of the FRITZ!Box Manager plugin. Therefore I created the following code. When I run it the plugin is shown without any problem and all settings are loaded. But if I change settings they are not saved to the MediaPortal.xml file. The file isn't changed at all. However the plugin 's log messages are written to the MediaPortal.log file. And there's no error message.
    All other functions of the Configuration dialog window are working fine.

    If I do the same via the MediaPortal Configuration.exe tool the settings are saved without any problem.

    Does anyone know the reason for this strange behaviour?
    Any support is highly appreciated.

    Code:
    namespace FritzBoxConfigTester
    {
        internal class Program
        {
            [STAThread]
            private static void Main(string[] args)
            {
                Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
                Application.EnableVisualStyles();
     
                // test for direct save
                MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(@"C:\Documents and Settings\All Users\Application Data\Team MediaPortal\MediaPortal\MediaPortal.xml");
                xmlwriter.SetValue("Section1", "Entry1", "Test");
     
                new FritzBox.FritzBox().ShowPlugin();
            }
     
            static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
            {
                try
                {
                    Exception ex = (Exception)e.ExceptionObject;
                    MessageBox.Show("Unhandled exception. Please contact the developers with the following information:\n\n" + ex.Message + ex.StackTrace, "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
                finally
                {
                    Application.Exit();
                }
            }
     
            public static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
            {
                DialogResult result = DialogResult.Abort;
                try
                {
                    result = MessageBox.Show("Unhandled exception. Please contact the developers with the following information:\n\n" + e.Exception.Message + e.Exception.StackTrace, "Application Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop);
                }
                finally
                {
                    if (result == DialogResult.Abort) Application.Exit();
                }
            }
        }
    }
     

    JDWestoby

    MP Donator
  • Premium Supporter
  • April 9, 2008
    265
    32
    68
    Poltimore, Devon
    Home Country
    United Kingdom United Kingdom
    I've had similar experience - where config changes (normally inside mediaPortal) are not saved - but with my own plugins 9and xml files).

    I never thought if it might be related to being a debug dll, interesting...
     

    horned_reaper

    Test Group
  • Team MediaPortal
  • January 7, 2011
    1,233
    461
    Munich
    Home Country
    Germany Germany
    If I use the PluginConfigLoader tool to directly show the settings dialog of a plugin the behaviour is exactly the same. The interesting thing is that the settings save is working with some plugins (e. g. MovingPictures) and with other not (e. g. MyLyrics).
    Can anyone imagine why?
     

    horned_reaper

    Test Group
  • Team MediaPortal
  • January 7, 2011
    1,233
    461
    Munich
    Home Country
    Germany Germany
    I've been found it out by myself. The plugin developer needs to add the following line to its setting save method:
    MediaPortal.Profile.Settings.SaveCache();
     

    Users who are viewing this thread

    Top Bottom