none
Remove or recreate temp\.net\application folder RRS feed

  • Question

  • Hello,
    I have a problem with my application. At some computers application does not starts with error at event logs:

    Description: A .NET Core application failed.
    Application: firefox.exe
    Path: C:\Program Files\Mozilla Firefox\firefox.exe
    Message: Error:
      An assembly specified in the application dependencies manifest (firefox.deps.json) was not found:
        package: 'runtimepack.Microsoft.NETCore.App.Runtime.win-x64', version: '3.1.1'
        path: 'Microsoft.Win32.Registry.dll'
    This is happens when some DLL lost in tem directory. For resolve this issue I need to remove all directory  "\AppData\Local\Temp\.net\firefox\crzm4sor.ju1". After that application will create new one with DLLs and will start normal.
    
    

    I don`t know why does it happens. But what can I do for resolve this issue?

    I see different ways and different questions :) 

    1. How force recreate temp\.net\app folder with DLLs every time when application starts?

    2. How can I remove that folder on close? I found how remove files on close, but this file are busy.

    3. I can make group policy or powerhsell script which will remove temp folder, but it is no nice solution. I believe and really hope you will help me find a way out with 1-2 or other way.

    Thank you.

    If it can be helpful, here my application code.

    using System;
    using System.Diagnostics;
    using System.Threading;
    using System.IO;
    
    
    namespace firefoxWatcher
    {
    
        static class firefoxWatcher
        {
            private static Mutex mutex = null;
            [STAThread]
    
    
            public static void Main()
            {
                const string appName = "firefox";
                bool createdNew;
                mutex = new Mutex(true, appName, out createdNew);
                if (!createdNew)
                {
                    //app is already running! Exiting the application  
                    Console.WriteLine("Application is already running.");
                    return;
                }
                else
                {
                }
    
                Console.WriteLine("Mutex passed");
    
    
    
                // Start the process.
                using (Process myProcess = Process.Start("C:\\Program Files\\Mozilla Firefox\\firefox_original.exe"))
                {
                    // Display the process statistics until
                    // the user closes the program.
                    System.Threading.Thread.Sleep(3000);
                    Process[] localByName = Process.GetProcessesByName("firefox_original");
                    foreach (Process theprocess in localByName)
                    {
    
                        Console.WriteLine("Process: {0} ID: {1}", theprocess.ProcessName, theprocess.Id);
                        Console.WriteLine($"Started process: {theprocess.HasExited}");
    
                        do
                        {
                            if (!theprocess.HasExited)
                            {
                                // Refresh the current process property values.
                                theprocess.Refresh();
                                Console.WriteLine();
    
                                // Display current process statistics.
    
                                Console.WriteLine($"running process: {theprocess.Id}");
    
                                if (theprocess.Responding)
                                {
                                    Console.WriteLine("Status = Running");
                                }
                                else
                                {
                                    Console.WriteLine("Status = Not Responding");
                                }
                            }
                            else
                            {
                                System.Threading.Thread.Sleep(100);
                                
    
                            }
                        }
                        while (!theprocess.WaitForExit(1000));
                    }
                }
            }
        }
    }


    Friday, April 3, 2020 4:10 PM

Answers

  • This may be an issue with the framework. It doesn't sound like an issue with your app.

    Please post over in the official .NET Core Github repo so an engineer on the framework team can help you. 


    Michael Taylor http://www.michaeltaylorp3.net

    Saturday, April 4, 2020 4:57 PM
    Moderator

All replies

  • This sounds like an issue with .NET Core. Please post this to the CoreFx Github repo so the team can look at it and provide you guidance. This forum is for C#-specific questions only.

    Michael Taylor http://www.michaeltaylorp3.net

    Friday, April 3, 2020 5:53 PM
    Moderator
  • Sorry miss text


    when the application starts, it creates files in local \ temp \ .net \ applicationname, creates a directory and dll files.

    If you leave the directory and delete some DLLs. An error occurs.

    The program does not check for missing files and fail to start with error.
    If I delete the entire directory, the program will start and create the directory again.
    Friday, April 3, 2020 6:35 PM
  • "when the application starts, it creates files in local \ temp \ .net \ applicationname, creates a directory and dll files."

    As in your application explicitly creates this or the framework creates this stuff and it crashes when restarting?


    Michael Taylor http://www.michaeltaylorp3.net

    Friday, April 3, 2020 6:44 PM
    Moderator
  • "when the application starts, it creates files in local \ temp \ .net \ applicationname, creates a directory and dll files."

    As in your application explicitly creates this or the framework creates this stuff and it crashes when restarting?


    Michael Taylor http://www.michaeltaylorp3.net

    My application. When I publish I use this options. Exe file contains all necessary DLLs.

    Saturday, April 4, 2020 6:10 AM
  • Let me clarify. If you deploy your app and run it. Then delete a file and rerun and it blows up then that is expected. Removing any "required" runtime files is a fatal error. 

    If your app specifically creates a file when it runs and then the user deletes it and your app crashes then the issue is with your code that is looking for that file. If you post the code then we can help.

    If your app crashes at startup because of some file that is auto-generated by the framework then it is more related to .NET Core and you should post over on Github like I mentioned in my first post. 

    I'm looking more closely at your error and it appears you're running Firefox so how your app plays into this is beyond me. The assembly it is looking for is where Win32 registry code resides. This is a framework assembly but for you to use it in .NET Core you'd have to take a NuGet dependency on the corresponding package. Therefore this sounds like a .NET Core issue and should be posted over on Github.


    Michael Taylor http://www.michaeltaylorp3.net

    Saturday, April 4, 2020 6:33 AM
    Moderator
  • Let me clarify. If you deploy your app and run it. Then delete a file and rerun and it blows up then that is expected. Removing any "required" runtime files is a fatal error. 

    If your app specifically creates a file when it runs and then the user deletes it and your app crashes then the issue is with your code that is looking for that file. If you post the code then we can help.

    If your app crashes at startup because of some file that is auto-generated by the framework then it is more related to .NET Core and you should post over on Github like I mentioned in my first post. 

    I'm looking more closely at your error and it appears you're running Firefox so how your app plays into this is beyond me. The assembly it is looking for is where Win32 registry code resides. This is a framework assembly but for you to use it in .NET Core you'd have to take a NuGet dependency on the corresponding package. Therefore this sounds like a .NET Core issue and should be posted over on Github.


    Michael Taylor http://www.michaeltaylorp3.net

    Thank you for your answers and for attention to my problem :)

    This application has library dependencies that may not be on the user's computer.

    For this, I used the following command
    dotnet publish -r win-x64

    and options specified by you at the time of publication.

    The application works perfectly and more than 1000 users actively use it. All that the application does is launch Firefox for the user and control the processes. The app is needed for UE-V technology. But all this is not important for this problem.

    The application starts, and it seems to unpack the libraries it contains into a TEMP directory. The path like appdata\local\.net\applicationname\someID\*.dlls
    This is good because no need to install libraries manually.


    The problem is that some users began to receive the same errors instead of launching the application.
    I managed to find out that :
    if delete the entire temporary directory, the program will start, because the directory will be created again.
    if I leave the directory but delete several DLLs, the application will not create them and will give an error.

    Maybe I missed some option, something like forcing unpacking or should I add a workaround to the code


    I am not a programmer, but the written program helps me a lot to solve my problem. Unfortunately, I am not experienced in this matter.


    Saturday, April 4, 2020 7:25 AM
  • This may be an issue with the framework. It doesn't sound like an issue with your app.

    Please post over in the official .NET Core Github repo so an engineer on the framework team can help you. 


    Michael Taylor http://www.michaeltaylorp3.net

    Saturday, April 4, 2020 4:57 PM
    Moderator
  • This may be an issue with the framework. It doesn't sound like an issue with your app.

    Please post over in the official .NET Core Github repo so an engineer on the framework team can help you. 


    Michael Taylor http://www.michaeltaylorp3.net

    Thank you, I`ll try.
    Saturday, April 4, 2020 6:40 PM