1

I'm having an issue with a build that involves the use of a DialogResult object not showing up when I

  1. Publish the app or

  2. Commit the changes and deploy to production.

The quirky part is it will work and pop-up with a local build (Using Ctrl+F5 or just F5).

Is there an issue with windows forms objects not working in this instance or is something else possibly the issue? Both the deployment and publish direct to the site that has a special small addition to the code that allows a photo to be displayed that had been previously blocked by CORS policy. I'm not sure what else to add as I can't think of anything relevant that would potentially affect this.

As requested, the snippet of code that is not showing up.

 DialogResult dialogResult = MessageBox.Show("Are you sure you want to delete this photo?", "Delete Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, MessageBoxOptions.DefaultDesktopOnly);
 if (dialogResult == DialogResult.Yes)
 {
   //Delete File and all related material.
 }
 else if (dialogResult == DialogResult.No)
 {
      PicturePlaceholder.Controls.Clear();
 }

 //Reload photos.
Nick
  • 61
  • 9

1 Answers1

1

There is no difference between debug/relese modes and MessageBox class behaviour.

If I understood right, you are trying to show Messagebox from web application running on web server. Short answer is: Don't.

Longer answer with some alternatives is given i.e here or here.

MessageBox and whole Windows Forms-framework is meant for Windows Desktop GUI applications. In your case problem is context where program is running. When executing windows forms UI-application in server context, process should be executed in UserInteractive mode, and there should be proper user logged in with active desktop session running on default desktop.

Risto M
  • 2,919
  • 1
  • 14
  • 27