Hi @MiPakTeh-6272,
>>My problem is, it can start a Watcher.exe but at the windows Load become error "The program Stop Working".
First, I made a test with your code and didn't encounter the error you said.
And what is "windows Load"? Please explain in detail and provide more information to reproduce the situation.
Best Regards,
Daniel Zhang

sorry my explanation not good. "Windows Load" is startup windows
Hi @MiPakTeh-6272 ,
About Windows is checking for a solution to the problem error, I suggest you try to follow the steps below to disable error reporting in Windows 10:
1.Click the Start menu, type services and press Enter.
2Find Windows Error Reporting Service and then right-click on that entry from the list.
3.Select Properties.
4.Next to Startup type, select Disabled from the drop down.
5.Click OK or Apply to save the settings.
Best Regards,
Daniel Zhang
Hi @MiPakTeh-6272,
I am very happy to help you solve the problem, I have turned my comment into an answer.
And I am glad to help if you have any other questions.
Best Regards,
Daniel Zhang
Hi @MiPakTeh-6272 ,
What version of your Windows system?
And you can try to run Services as an administrator
1. Click on Start.
2. In the start Search box type “Services”.
3. Right Click on run as administrator.
Best Regards,
Daniel Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Check and see if sOri actually exists.
Also, if sOri points to network mounted folders, the network path may not be accessible yet.
It will be useful to debug if you can wrap your Form1_Load() content in try...catch... block and show the exception message with MessageBox.Show().
You may find corresponding error event in Event Viewer -> Application too since the error is not handled.
cheong00 can you show an example ;
It will be useful to debug if you can wrap your Form1_Load() content in try...catch... block and show the exception message with MessageBox.Show().
private void Form1_Load(object sender, EventArgs e)
{
try
{
watcher.NotifyFilter = NotifyFilters.Attributes
| NotifyFilters.CreationTime
| NotifyFilters.DirectoryName
| NotifyFilters.FileName
| NotifyFilters.LastAccess
| NotifyFilters.LastWrite
| NotifyFilters.Security
| NotifyFilters.Size;
string sOri = @"C:\";
watcher.Path = sOri;
watcher.Created += OnCreated;
watcher.IncludeSubdirectories = true;
watcher.EnableRaisingEvents = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}

When follow you advice , the error message like above.
Help me, I don't how to do.
You don't have right to listen to folders that you don't have access to.
Try limit the access to somewhere that user can write instead.
9 people are following this question.
Insert a node as child ,before or after a node in nested dynamic JSON Node using C#
Visual Studio 2019: Undefined behavior in a C++/CLI wrapper project.
Example for how to get Package Metadata from Azure DevOps Rest-Api Artifacts using c#
How to collapse individual nested grids/stackpanels inside a grid?