locked
Problem with RemoveNotification RRS feed

  • General discussion

  • There appears to be an issue with RemoveNotification, or at least a "feature" that isn't mentioned in the documentation - you have to call RemoveNotification on the same WHSInfoClass object that you called AddNotification on.
    If you call RemoveNotification on a different instance of that object, you'll get:

    Unhandled Exception: System.Runtime.InteropServices.COMException (0x8000FFFF): Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))


    Here is a simple app to demonstrate. Call it with "appname.exe test 2 test test"

            static void Main(string[] args)
            {
                if (args.Length != 4)
                {
                    Console.WriteLine("Invalid arguments");
                    return;
                }
                WHSInfoClass info = new WHSInfoClass();
                info.Init(args[0]);
                info.AddNotification(args[0], (WHS_Notification_Severity)Convert.ToInt32(args[1]), args[2], args[3], null, null, null);
                Console.ReadKey();
                WHSInfoClass info2 = new WHSInfoClass();
                info2.Init(args[0]);
                info2.RemoveNotification(args[0]); //<-- change this to info.RemoveNotification and it works fine
                Console.ReadKey();
            }
    Monday, November 26, 2007 4:22 PM

All replies