Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
J

john_masen

@john_masen
About
Posts
3
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • retrieving the COM class factory for component with CLSID {0002E55D-0000-0000-C000-000000000046} failed due to the following error: 80040154
    J john_masen

    looks your system still looking for the CLSID in 64bit registry. I think you can use process monitor monitor the registry to confirm. Then you know if you're on the right way.

    .NET (Core and Framework) help csharp dotnet wpf wcf

  • A question about windows MUI
    J john_masen

    please check your xml file encoding. for example <?xml version="1.0" encoding="UTF-8"?> means utf-8 encoding

    .NET (Core and Framework) xml tutorial question

  • How to propagate an exception raised in a worker thread to the UI thread
    J john_masen

    hi daniel, I've read your code and performed following test. looks you can not just throw your exception in the new thread. you can handle it in the worker thread and use delegate to process it in GUI thread. The following is my test code. 2 buttons in one single form. "Button1" can cause the program crash. "Button2" success capture the error. Hope it helps.

    public partial class Form1 : Form
    {
    public Form1()
    {
    InitializeComponent();
    }

        private void button1\_Click(object sender, EventArgs e)
        {
            
            Thread t = new Thread(delegate()
            {
                DoWork();
            });
    
            try
            {
                t.Start();
            }
            catch (Exception ex)
            {
                commonExceptionHandler(ex);
            }
        }
    
        private void button2\_Click(object sender, EventArgs e)
        {
            Thread t = new Thread(delegate()
            {
                try
                {
                    DoWork();
                }
                catch (Exception ex)
                {
    
                    commonExceptionHandler(ex);
                }
            });
            t.Start();
        }
        private void commonExceptionHandler(Exception ex)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new Action(() => commonExceptionHandler(ex)));
            }
            else
            {
                //your code here
                MessageBox.Show("\[got it!\] "+Environment.NewLine+ ex.ToString());
            }
        }
    
        private void DoWork()
        {
            throw new InvalidOperationException("this is test");
        }
    }
    
    .NET (Core and Framework) csharp help perl database oracle
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups