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

File access crash when saving compiled codes #836

Open
epicRedHot opened this issue Feb 1, 2024 · 45 comments
Open

File access crash when saving compiled codes #836

epicRedHot opened this issue Feb 1, 2024 · 45 comments
Assignees
Labels

Comments

@epicRedHot
Copy link

epicRedHot commented Feb 1, 2024

Please use this issue if you have encounted the following exception:

    Type: IOException
    Message: The requested operation cannot be performed on a file with a user-mapped section open.

Please provide any information you can in relation to the crash as the issue is currenly not reproducable with any of the developers.

This issue appears to affect all games.

Below is the original post


Any time I click "Save" or "Save and Play", I get the below error.

HMM_Snapshot_00012024201739.txt

HMM Info:

    Version: 7.12-4
    Args: 
    StartDir: C:\Program Files (x86)\Steam\steamapps\common\Sonic Generations
    Process Level: User
    Game: Sonic Generations
    GameInstall: Sonic Generations
    Update Status: Up To Date

Exception:

    Type: IOException
    Message: The requested operation cannot be performed on a file with a user-mapped section open.

    Source: mscorlib
    Function: Void WinIOError(Int32, System.String)
    StackTrace: 
       at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
       at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
       at HedgeModManager.CodeCompiler.CodeProvider.CompileCodes[TCollection](TCollection sources, String assemblyPath, IIncludeResolver includeResolver, String[] loadsPaths)
       at HedgeModManager.ModsDB.<SaveDB>d__39.MoveNext() in D:\GitHub\HedgeModManager\HedgeModManager\ModsDB.cs:line 254
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at HedgeModManager.MainWindow.<SaveModsDB>d__43.MoveNext() in D:\GitHub\HedgeModManager\HedgeModManager\UI\MainWindow.xaml.cs:line 739
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at HedgeModManager.MainWindow.<SaveConfig>d__55.MoveNext() in D:\GitHub\HedgeModManager\HedgeModManager\UI\MainWindow.xaml.cs:line 1104
@Hunt-K
Copy link

Hunt-K commented Feb 10, 2024

I am having this same issue with not only Gens, but Origins and Frontiers as well.
If anyone knows how to fix this please let me know.

image

@S1ayerXYZ
Copy link

try removing the codes.dll file, looks like issue i was having

@thesupersonic16
Copy link
Owner

Can you all try checking if the process is running in the background while having this issue?

@cnamani45
Copy link

I deleted hedgemodmanager and everything within the Mod file, where all the mods are typically loaded. However, I couldn't delete the Codes.dll application extension because it says the app is still open even though I deleted it from my computer and ensured it wasn't downloaded. I find it interesting and wonder if that might be a clue to the hedgemodmanager not working correctly.

Screenshot 2024-02-23 221654

@cnamani45
Copy link

I forgot to mention that I was able to have two Codes.dll application extensions by moving the first one to another location and loading in a new application extension. I couldn't delete either one because the file is open in another program, but what does that mean?

@thesupersonic16
Copy link
Owner

Can you try closing all games and HMM then try again? If it fails can you show me the list of processes you have open?

@cnamani45
Copy link

How do I do that? Is it found in Task Manager?

@thesupersonic16
Copy link
Owner

Open Task Manager and select the details tab and look for Any processes starting with Sonic or HedgeModManager.

@cnamani45
Copy link

I checked, but I don't see anything Sonic or HedgeModManager. I can understand HedgeModManager not being in the task manager since I deleted it for now, but shouldn't Sonic Frontiers be visible since that's downloaded?

@thesupersonic16
Copy link
Owner

It will only show what is open.

@cnamani45
Copy link

Oh, that makes sense. I'll try opening Sonic Frontiers, and perhaps download and run HedgeModManager as well.

@thesupersonic16
Copy link
Owner

Are you currently having the issue right now where you can't move the file?

@thesupersonic16
Copy link
Owner

Might be easier to find the process by using Process Explorer.

Just download that zip and extract all the files, then open procexp64.exe. Once the program opens, hold Ctrl and Shift, then press F, in the search box write Codes.dll then press Search.

@cnamani45
Copy link

Well, just recently, I restarted my PC and was able to delete the Codes.dll application extensions. However, something interesting happened when I tried opening Sonic Frontiers on Steam. I'll post some pictures.

@cnamani45
Copy link

Screenshot 2024-02-24 121521(0)
Screenshot 2024-02-24 121611(1)
Screenshot 2024-02-24 121935(3)

I also noticed that I'm missing emblems on the title screen I once had. I 100% the game without mods, but the game seems to act as if I still have mods. I haven't redownloaded HedgeModManager yet.

@thesupersonic16
Copy link
Owner

Deleting Hedge Mod Manager doesn't remove the mod loaders, you need to uninstall the mod loaders using HMM.

Also can you show me your SonicFrontiers folder? The modloader shouldn't be loading twice.

@cnamani45
Copy link

Screenshot 2024-02-24 123310(4)

@cnamani45
Copy link

I have a lot of my mods in another file in the Downloads folder called Mods

@thesupersonic16
Copy link
Owner

Can you delete both d3d11.dll and dinput8.dll then use Hedge Mod Manager to reinstall the mod loader? Also make sure you have update checking enabled.

@cnamani45
Copy link

Sure thing. Should I also permanently delete the .dll's in the recycle bin too?

@thesupersonic16
Copy link
Owner

If you want. Hedge Mod Manager should've deleted d3d11.dll on its own, also asked to delete dinput8.dll so HMM can download a clean version from GitHub.

@cnamani45
Copy link

Screenshot 2024-02-24 124542(6)
Screenshot 2024-02-24 124934(7)

I first permanently deleted the d3d11.dll and dinput8.dll application extensions, then redownloaded HedgeModManager from GitHub, opened the executable, and noticed that everything was already checked marked in settings. The pictures show the results of redownloading HedgeModManager.

@thesupersonic16
Copy link
Owner

That should be fine. Are you still having the same issues?

@cnamani45
Copy link

I've been playing the game so far with the HedgeModManager enabled, and it has been working for a while. However, the same issue started happening again when I tried to click save after downloading and enabling some codes. I have not added any mods yet, and HedgeModManager was originally working with the codes turned on, too. For some reason, it decided not to work again.
HMM Crash
HMM Crash 2

@thesupersonic16
Copy link
Owner

Might be easier to find the process by using Process Explorer.

Just download that zip and extract all the files, then open procexp64.exe. Once the program opens, hold Ctrl and Shift, then press F, in the search box write Codes.dll then press Search.

Try checking with Process Explorer.

@cnamani45
Copy link

I did that, but Codes.dll wouldn't show, although I did have Codes.dll in the Mods folder in the Sonic Frontiers directory. I tried opening Codes.dll to see if it will show on Process Explorer, but I don't have anything that can properly open it.

@cnamani45
Copy link

It took a while, and it also took some different solutions that seemed to work until they didn't, but I managed to solve the issue.

@thesupersonic16
Copy link
Owner

How did you resolve this issue?

@cnamani45
Copy link

I went to the Mods directory and got all my mods, Codes.hmm, and ModsDB into one folder, thus having only one folder within the main Mods directory. I left Codes.dll outside of the folder but still in the Mods directory. However, I checked and apparently made another Codes.dll inside the new folder I created with all my modes and stuff. The mod directory still works, though.

@Hunt-K
Copy link

Hunt-K commented Feb 29, 2024

Wait, so how exactly do I fix this?
Cause I thought all of those were in one folder already.

@thesupersonic16
Copy link
Owner

thesupersonic16 commented Feb 29, 2024

Are you able to get it to occur very consistently? If it's consistent, can you run through the list of releases from top to bottom until you get a release where the issue is totally gone? Just make sure to reboot or log off and back on with every release you test.

@Hunt-K
Copy link

Hunt-K commented Feb 29, 2024

So just keep using different versions of the Mod Manager until it works?

@thesupersonic16
Copy link
Owner

So just keep using different versions of the Mod Manager until it works?

Yes, but also do a reboot or log off so the issue clears when you start testing a release. Once you find a release that never has the issue, let me know so I can see what was changed.

@thesupersonic16
Copy link
Owner

I would stop at 7.10-1 if the issue continues occur to that point as it may be something else like the modloaders, which we will look into if we need to.

@Hunt-K
Copy link

Hunt-K commented Feb 29, 2024

I downloaded 10, 11, & 12
Still the same error.

@Hunt-K
Copy link

Hunt-K commented Feb 29, 2024

No matter what I do or what game I play it will give me this
image

@thesupersonic16
Copy link
Owner

I downloaded 10, 11, & 12 Still the same error.

Got some questions:
Have you tried it after a reboot/log off? If not then we may need to look into the mod loaders.
Did it work for the first time then fail the next?
Does it happen when you press Save without ever starting any game since the last user login?

@Hunt-K
Copy link

Hunt-K commented Feb 29, 2024

I downloaded 10, 11, & 12 Still the same error.

Got some questions: Have you tried it after a reboot/log off? If not then we may need to look into the mod loaders. Did it work for the first time then fail the next? Does it happen when you press Save without ever starting any game since the last user login?

I rebooted my PC everytime I downloaded and used the versions of HedgeMod
And it happens anytime I hit Save or Save & Play, haven't been able to play since

@thesupersonic16
Copy link
Owner

So it can happen without ever touching Play or Save & Play? If so this can't be a modloader issue.

Does it also happen on the dev version?

@Hunt-K
Copy link

Hunt-K commented Mar 1, 2024

Just downloaded it and yes.

@Hunt-K
Copy link

Hunt-K commented Mar 1, 2024

It's weird, I can still play the game if I load it up via Steam or click on the Shortcut
But once I try to with the Mod Loader, it throws a hissy fit

@epicRedHot
Copy link
Author

I forgot I already made this when I posted this other bug report a few minutes ago, my apologies. As for this -

Can you all try checking if the process is running in the background while having this issue?

I don't see anything in Task Manager listed under "background processes" that appear to be related to Generations or HMM.

@thesupersonic16 thesupersonic16 pinned this issue Mar 14, 2024
@thesupersonic16 thesupersonic16 changed the title [SonicGenerations] Unable to play game or save mod/code settings. File access crash when saving compiled codes Mar 14, 2024
@thesupersonic16
Copy link
Owner

I forgot I already made this when I posted this other bug report a few minutes ago, my apologies. As for this -

Can you all try checking if the process is running in the background while having this issue?

I don't see anything in Task Manager listed under "background processes" that appear to be related to Generations or HMM.

Can you try checking in Process Explorer as mentioned below?

Might be easier to find the process by using Process Explorer.

Just download that zip and extract all the files, then open procexp64.exe. Once the program opens, hold Ctrl and Shift, then press F, in the search box write Codes.dll then press Search.

@epicRedHot
Copy link
Author

I was able to boot up the game a single time with HMM after restarting my computer, but after that point both Save and Save And Play went back to giving the same results as before.

I installed Process Explorer and tried searching for Codes.dll both after closing HMM and while the program was still open, but it said that there were 0 matching items during both searches.

@cnamani45
Copy link

I've been playing Sonic Frontiers for a while with the solution I found to the problem, but I later found out it was no more than a band-aid than an actual solution to the problem. I think there might be some weird bug or another problem with Codes.dll. Whenever I get the Hedgemodmanager Exception message, I would either delete or move Codes.dll outside the Mods file. This would allow me to save and play with my mods and codes, but it will create a new Codes.dll file. After some playing, closing, and playing again of the game, the Exception message would randomly decide to show up again when I try to save and play with my mods. I have to repeat the previous process to play with my mods again.
Also, I tried deleting all the Codes.dll files I had to move, and I could delete all of them except for one, which was the very first Codes.dll file I had before anything happened. I tried deleting it, but it said it couldn't be deleted because the Hedgemodmanager program was still open. I closed it, but I still got the same message, so I checked Task Manager and Process Explorer, but I didn't get anything that pertained to Hedgemodmanager. I still got the same message, so I deleted Hedgemodmanager again to see if the changes anything, but it didn't. I know if I restart my PC and delete the Codes.dll file again, it will work, but I've been doing that a lot recently whenever such an issue occurs. I feel like there's got to be a better way to permanently deal with the issue.
Overall, my method did not really work all too well, but it did allow me to play with my mods for some time.

Screenshot 2024-03-21 065433
Screenshot 2024-03-21 062537
Screenshot 2024-03-21 062511
Screenshot 2024-03-21 060159

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants