Error running application under Windows 10 20H2 when using ClickOnce deployment

Casper Børgesen 1 Reputation point
2022-06-29T07:00:39.817+00:00

I have an WPF .NET 6 application which in this case does nothing but running a BAT file. The BAT file is executing an external application for which I don't have the source code and thus no control over.

I have published the code using a FolderProfile (publish to folder and no installation) and when I run WPF application all looks good.
When I published the same code using a ClickOnceProfile (which get installed somewhere deep inside the user folder) and run the WPF application, the external application fails with error code 4294967295.

I am running Windows 10 and my organisation has recently upgraded Windows 10 from 1904 to 20H2. Before the upgrade the ClickOnce deployment worked without problems, after the upgrade I get the above mentioned error. So something changed when my organisation upgraded from Windows 10 1904 to 20H2 which apparently affects the circumstances in which a ClickOnce deployed application is running under.

The elephant in the room is of course the external application which for some reason fails, but I would like to focus on the changed environment regarding ClickOnce deployment, since that is the environment I need to work in.

Can anyone perhaps give me a clue as to what I can investigate here?

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,417 questions
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,647 questions
{count} votes

2 answers

Sort by: Most helpful
  1. MotoX80 31,316 Reputation points
    2022-07-01T13:24:56.753+00:00

    after the upgrade I get the above mentioned error.

    Where do you see that error? In the WPF program? In the bat file?

    in this case does nothing but running a BAT file.

    Add logging to the bat file to display a few items and call the program. Capture both stdout and stderr.

    set log=C:\Temp\MyLog.txt  
    echo %date% %time% BAT file invoked. >> %log% 2>&1  
    whoami.exe >> %log% 2>&1    
    echo %date% %time% Contents of current directory >> %log% 2>&1   
    dir >> %log% 2>&1   
    echo %date% %time% Calling external program. >> %log% 2>&1  
    C:\Apps\Whatever.exe >> %log% 2>&1  
    echo %date% %time% Whatever.exe ended. RC=%errorlevel% >> %log% 2>&1   
       
    

    Have you reviewed the application and system eventlogs when the error occurs?

    You may need to run Process Monitor and trace the failure. Start by looking for "access denied" events.

    https://learn.microsoft.com/en-us/sysinternals/downloads/procmon

    0 comments No comments

  2. Limitless Technology 39,296 Reputation points
    2022-07-03T14:49:15.817+00:00

    Hi CasperBrgesen,

    Greetings for the day!

    Thanks for taking time to explain the scenario and we are glad to help you!

    I have few suggestion for trying the workaround in your case.

    1. You have mentioned that the BAT file calls the external source when you run it from the WPF application locally and the error
      received only when you publish the files. Can you try if there are any missing entries in the publish folder?
    2. I hope WPF is a form based application and you can run the exe from the release or debug folder. Just to confirm there are no
      issues with the release package, try running the exe from release folder. If it works you can try deploying the same manually to
      the publish folder.
    3. If step 2 works, then the issue is with only during the click one deployment. Below link will provide additional details incase
      you would like to analyze this. https://learn.microsoft.com/en-us/visualstudio/deployment/quickstart-deploy-using-clickonce-folder?view=vs-2022

    https://learn.microsoft.com/en-us/visualstudio/deployment/building-clickonce-applications-from-the-command-line? view=vs-2022
    view=vs-2022

    1. Try to find additional information about the error. In case the logs from application doesn't help much, try verifying the
      eventlogs. To verify event logs, please follow below steps.
      Type "eventvwr" in run
      Open Event Viewer.
      In the console tree, expand Windows Logs, and then click Security. The results pane lists individual security events. https://learn.microsoft.com/en-us/windows/security/threat-protection/auditing/view-the-security-event-log 5
    2. Final option would be resolving the third party code. At some point you must find the code base to get rid of the risk.

    Its not suggestable to remove the Windows updates as the your development code works fine. Also you can verify if there are any know issues related to what you have mentioned in below link.

    https://learn.microsoft.com/en-us/windows/release-health/resolved-issues-windows-10-20h2

    Feel free to get back if you have any questions.

    -----------------------------------------------------------------------------------------------------------------------------------

    --If the reply was helpful, please don’t forget to upvote or accept as answer--

    0 comments No comments