Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This is happens when some DLL lost in tem directory. For resolve this issue I need to remove all directory #34547

Closed
denispasternak opened this issue Apr 4, 2020 · 4 comments
Labels
area-Single-File untriaged New issue has not been triaged by the area owner

Comments

@denispasternak
Copy link

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.

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 selected "Produce single file", "Self-Contained" when I publish it.

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.

Application code if it will helpful:
`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));
            }
        }
    }
}

}`

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-System.Threading untriaged New issue has not been triaged by the area owner labels Apr 4, 2020
@ghost
Copy link

ghost commented Apr 4, 2020

Tagging @swaroop-sridhar as an area owner

@swaroop-sridhar
Copy link
Contributor

swaroop-sridhar commented Apr 4, 2020

This is a dup of #3778.
Fix is checked in: dotnet/core-setup#9013
Expected in May servicing release.

In the meantime, as a workaround you can set DOTNET_BUNDLE_EXTRACT_BASE_DIR environment variable to a non-temp directory.

@denispasternak
Copy link
Author

denispasternak commented Apr 5, 2020

This is a dup of #3778.
Fix is checked in: dotnet/core-setup#9013
Expected in May servicing release.

In the meantime, as a workaround you can set DOTNET_BUNDLE_EXTRACT_BASE_DIR environment variable to a non-temp directory.

It is nice that this problem is known.
Unfortunately, I have no programming experience at all. Please tell me how I can change the DOTNET_BUNDLE_EXTRACT_BASE_DIR variable, instead of "% temp%.net\application\id", set to "% LOCALAPPDATA%.net\application\id" (system variable), will use app only on Windows OS. So that the directory is not cleared by the system or system cleaning applications.
This method suits me, but I do not know how to implement it and did not found this. In every post they only talk about it, but there is no instruction or how to do it (I think everyone knows how to do it except me :) )

Thanks!

@swaroop-sridhar
Copy link
Contributor

@denispasternak You can set environment variables on the command line https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/set_1

Or via "My Computer" -> "Properties"

@ghost ghost locked as resolved and limited conversation to collaborators Dec 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Single-File untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

4 participants