Hi,
Based on your description, problem happens on self-developed/write code/script. It is beyond the support scope of Windows-10 forum as it is not Windows system/built-in issue.
If possible, we would recommend you to post on windows dev forum and they may provide you suggestion about your code, or test the code operation & compatibility:
https://developer.microsoft.com/en-us/
Or, you may post new thread with tag (including key word such as vs) to invite dev professional to your thread discussion.
Best Regards,
Eve Wang