Cosmos icon indicating copy to clipboard operation
Cosmos copied to clipboard

Doing a FileSystem operation via an Action makes a CPU Exception and creates a corrupted file

Open selkij opened this issue 2 years ago • 3 comments

Area of Cosmos - What area of Cosmos are we dealing with?

Filesystem

Expected Behaviour - What do you think that should happen?

It should create a file like supposed to

Actual Behaviour - What unexpectedly happens?

makes a CPU Exception x06 and creates a corrupted directory when its supposed to be a file and sometimes it corrupts the entire filesystem making it unusable image

Reproduction - How did you get this error to appear?

if (!Kernel.tryCatch(() => File.WriteAllText(@"0:\fscheck.txt", "This is a test file"), Logger.LogLevel.Fatal))
{
       Logger.Warn("File system checks failed. Disk operations won't be available");
       return;
}

Kernel.tryCatch():

public static bool tryCatch(Action action, Logger.LogLevel exceptionLevel)
    {
        try
        {
            action();
        }
        catch (Exception ex)
        {
            Logger.Log(exceptionLevel, ex.Message);
            return false;
        }
        
        return true;
    }

Version - Were you using the User Kit or Dev Kit? And what User Kit version or Dev Kit commit (Cosmos, IL2CPU, X#)?

last devkit as of 7/11/2022

selkij avatar Nov 07 '22 09:11 selkij

Can you check if the issue also happens when you replace action with just throwing an exception?

        try
        {
            throw new Exception();
        }
        catch (Exception ex)
        {
            Logger.Log(exceptionLevel, ex.Message);
            return false;
        }
        
        return true;

quajak avatar Nov 08 '22 18:11 quajak

Well it wouldnt be using an action anymore and it will work, the try catch or the logger.log isnt the problem

selkij avatar Nov 08 '22 18:11 selkij

And I cant use my pc rn20221108_194450.jpg

selkij avatar Nov 08 '22 18:11 selkij

Closing because we can't reproduce this issue

quajak avatar Dec 20 '22 16:12 quajak