Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

If requesting help, make sure to mention what game you are attempting to use ACT with.
For the best FFXIV support, join Ravahn's Discord Server. Also check out ngld's FFXIV FAQ for starter diagnostics. Lastly, Jojo's setup guide.

A new guard page for the stack cannot be created

Originally I assumed this was a problem with the ACT-Discord-Triggers plugin, so I created an issue for it.
The owner of the repo thinks given the behaviour, this is actually a bug with ACT and not the plugin.

The problem is, when I attempt to play a TTS trigger after either connecting then disconnecting my bot to/from a voice channel or disabling the ACT_DiscordTriggers.dll plugin, I get an error popup saying "A new guard page for the stack cannot be created".

The log file contains the following information.
***** 2018-12-12T18:44:40 - Error with DeInit of Discord Plugin.
System.NullReferenceException: Object reference not set to an instance of an object.
   at DiscordAPI.DiscordClient.<deInIt>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at ACT_DiscordTriggers.DiscordPlugin.<DeInitPlugin>d__26.MoveNext()
   at Advanced_Combat_Tracker.FormActMain.WriteExceptionLog(Exception ex, String MoreInfo)
   at ACT_DiscordTriggers.DiscordPlugin.<DeInitPlugin>d__26.MoveNext()
   at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at ACT_DiscordTriggers.DiscordPlugin.DeInitPlugin()
   at Advanced_Combat_Tracker.FormActMain.pluginPanelEnabledChecked(Object sender, EventArgs e)
   at System.Windows.Forms.CheckBox.OnCheckedChanged(EventArgs e)
   at System.Windows.Forms.CheckBox.set_CheckState(CheckState value)
   at System.Windows.Forms.CheckBox.OnClick(EventArgs e)
   at System.Windows.Forms.CheckBox.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at Advanced_Combat_Tracker.ActLoader.Main(String[] args)



  • I'm afraid I have no idea what that means.

    Even with the possibility that there is a bug in ACT, ACT did not create that message.  I've never heard of a Win32/.NET Framework message like that either.

    Given general web searches, the error occurs somewhere inside of Windows or the .NET Framework in response to possibly running out of memory or a stack overflow where too many recursive calls are made.  But the cause is not definite.

    Given the screenshot title bar, it is a system generated message which is not reported to the plugin or ACT itself.  Since that is the case, there will probably be nothing in ACT's error log and the only way to debug the issue is to attach a debugger to the process before/when that message appears and read the stack trace to see what the last action was and what module it is currently in.

    Since this only happens in response to the plugin being used, one would need to know exactly what the plugin is doing when the error occurs.  (The stack trace helps with this)  That's not really something I can help with as I barely know what the plugin does.

    Said plugin also uses several 3rd party libraries and interactions with them may be causing your issue instead of something specifically in the plugin or ACT.

    Unless I miss my guess, this plugin does not use ACT's TTS or sound engine.  Meaning that all ACT does in this situation is host the plugin's image and tell the plugin when to start and stop.

    All of your steps to reproduce include playing a trigger (whatever that means).  This plugin replaces ACT's internal sound methods... so I assume the issue is with NAudio or the custom re-implementation of TTS from .NET... and/or the plugin's usage of such.
  • Well that's disheartening to hear. I guess there's no way for you or me to fix this then, I'll just have to restart ACT everytime. Thanks for looking into it though.

    When I say "play a TTS trigger" I mean going to the Custom Triggers tab, selecting a trigger that is set to play TTS and clicking the play button.
  • Webberjo said:

    When I say "play a TTS trigger" I mean going to the Custom Triggers tab, selecting a trigger that is set to play TTS and clicking the play button.
    If the plugin is ever loaded, ACT's TTS engine is completely replaced by the plugin.  By the stack trace in your edited message, the plugin does not close properly and is probably not restoring the TTS engine ACT usually has.  So any TTS ACT tries to create goes to the plugin and if there is an error with that, it is due to the plugin's implementation.

    I couldn't tell you why it is unable to close properly either.  The stack trace gets confusing by the point it starts using unnamed methods.

    If you need TTS working, you either need to not use that plugin or get the plugin's TTS engine to work properly.  (or get the plugin author to make an option to not replace ACT's TTS and/or sound engine)
  • edited December 2018
    Actually, reviewing their plugin deinit method, I can tell you exactly why TTS is broken after the plugin closes.

            public async void DeInitPlugin() {
                ActGlobals.oFormActMain.PlayTtsMethod = ActGlobals.oFormActMain.TTS;
                ActGlobals.oFormActMain.PlaySoundMethod = ActGlobals.oFormActMain.PlaySoundWmpApi;
                try {
                    await DiscordClient.deInIt();
                } catch (Exception ex) {
                    ActGlobals.oFormActMain.WriteExceptionLog(ex, "Error with DeInit of Discord Plugin.");
                lblStatus.Text = "Plugin Exited";
    The plugin is restoring the wrong methods here.

    The plugin author is picking random methods to restore here instead of restoring the methods they originally replaced.

    They need to put PlayTtsMethod/PlaySoundMethod into plugin variables during init, and during deinit they need to set the variables back into these fields.  What they did was arbitrarily pick ACT methods they thought would work.

    If the user used a different sound engine selected in ACT, this plugin would not honor that setting.

    Even worse, the ActGlobals.oFormActMain.TTS method is absolutely not to be used for this.  It is supposed to be used by plugins to cause TTS to be performed and ACT will internally use the current implementation to do so.  What Line 321 is doing here is telling ACT to use the current implementation finder/performer as the current implementation.  This will cause an infinite loop when TTS is played, which will cause a stack overflow.

    This is unrelated to whatever other problem the plugin is having while closing from your OP logged exception message. (Error with DeInit of Discord Plugin)

Sign In or Register to comment.