Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Bug Unity CS2012: Cannot open 'Assembly-CSharp.dll' for writing

Discussion in 'Editor & General Support' started by ZanOlsena, Jan 12, 2024.

  1. ZanOlsena

    ZanOlsena

    Joined:
    Apr 5, 2020
    Posts:
    11
    Hey all, recently had this error pop up seemingly out of nowhere in my project (file paths edited for privacy):

    error CS2012: Cannot open 'C:\Users\username\Documents\GitHub\project-ubiquitous-umbrella\UbiquitousUmbrella\Library\Bee\artifacts\1900b0aE.dag\Assembly-CSharp.dll' for writing -- 'The requested operation cannot be performed on a file with a user-mapped section open. : 'C:\Users\username\Documents\GitHub\project-ubiquitous-umbrella\UbiquitousUmbrella\Library\Bee\artifacts\1900b0aE.dag\Assembly-CSharp.dll''

    I didn't import anything new into my project, and this didn't start after pulling a commit from the github repo. One minute I was editing and compiling scripts, the next this popped up. I was able to get things working again by restarting my computer, but the next time I compiled a script it popped right back up again.

    I've tried re-importing and refreshing just about everything, even deleting my library folder, which didn't work because Windows swears Assembly-CSharp.dll is being used by something. I have no idea what though, because according to Process Explorer its not being used anywhere.

    I have no idea why this is happening and I can't really work like this, so any help would be greatly appreciated.
     
    FROST6 likes this.
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,571
    Be sure you're excluding that DLL from your source control. (See below)

    Otherwise maybe you have some antivirus attempting to lock and study that DLL and preventing Unity from rewriting it.




    PROPERLY CONFIGURING AND USING ENTERPRISE SOURCE CONTROL

    I'm sorry you've had this issue. Please consider using proper industrial-grade enterprise-qualified source control in order to guard and protect your hard-earned work.

    Personally I use git (completely outside of Unity) because it is free and there are tons of tutorials out there to help you set it up as well as free places to host your repo (BitBucket, Github, Gitlab, etc.).

    You can also push git repositories to other drives: thumb drives, USB drives, network drives, etc., effectively putting a complete copy of the repository there.

    As far as configuring Unity to play nice with git, keep this in mind:

    https://forum.unity.com/threads/prefab-links-keep-getting-dumped-on-git-pull.646600/#post-7142306

    I usually make a separate repository for each game, but I have some repositories with a bunch of smaller test games.

    Here is how I use git in one of my games, Jetpack Kurt:

    https://forum.unity.com/threads/2-steps-backwards.965048/#post-6282497

    Using fine-grained source control as you work to refine your engineering:

    https://forum.unity.com/threads/whe...grammer-example-in-text.1048739/#post-6783740

    Share/Sharing source code between projects:

    https://forum.unity.com/threads/your-techniques-to-share-code-between-projects.575959/#post-3835837

    Setting up an appropriate .gitignore file for Unity3D:

    https://forum.unity.com/threads/removing-il2cpp_cache-from-project.1084607/#post-6997067

    Generally the ONLY folders you should ever source control are:

    Assets/
    ProjectSettings/
    Packages/

    NEVER source control Library/ or Temp/ or Logs/
    NEVER source control anything from Visual Studio (.vs, .csproj, none of that noise)

    Setting git up with Unity (includes above .gitignore concepts):

    https://thoughtbot.com/blog/how-to-git-with-unity

    It is only simple economics that you must expend as much effort into backing it up as you feel the work is worth in the first place. Digital storage is so unbelievably cheap today that you can buy gigabytes of flash drive storage for about the price of a cup of coffee. It's simply ridiculous not to back up.

    If you plan on joining the software industry, you will be required and expected to know how to use source control.

    Source control does require learning, but there are TONS of tutorials and courses and online reference.

    You should strive to use source control as confidently as you use your file/folder system.

    "Use source control or you will be really sad sooner or later." - StarManta on the Unity3D forum boards
     
  3. ZanOlsena

    ZanOlsena

    Joined:
    Apr 5, 2020
    Posts:
    11
    Thanks for the response! I double checked the repo, and the Assets, Project Settings, and Packages are the only folders tracked by source control. There is a .vsconfig in there, but its always been there and I'm pretty sure its auto generated.

    Wise of my antivirus, I haven't changed anything on my end, but that seems to be the most logical conclusion. Something takes over the entire Library file as soon as I try and compile a script. I tried rebooting my PC, deleting library since I have access until I compile something, and re-generating it. That still hasn't helped the problem, the same error shows up every time. I tested one of my other projects, and it complies just fine, so it seems to be exclusive to this one project.

    I also got this error last time, which might provide some more info:

    Failed to find entry-points:
    Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Assembly-CSharp-Editor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' ---> System.Exception: Failed to resolve assembly 'Assembly-CSharp-Editor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' in directories: C:\Program Files\Unity\Hub\Editor\2022.3.11f1\Editor\Data\MonoBleedingEdge\lib\mono\unityjit-win32
    C:\Users\username\Documents\GitHub\project-ubiquitous-umbrella\UbiquitousUmbrella\Library\PackageCache\com.unity.burst@1.8.9
    C:\Users\username\Documents\GitHub\project-ubiquitous-umbrella\UbiquitousUmbrella\Library\PackageCache\com.unity.burst@1.8.9\Unity.Burst.CodeGen
    C:\Users\username\Documents\GitHub\project-ubiquitous-umbrella\UbiquitousUmbrella\Library\PackageCache\com.unity.visualscripting@1.9.1\Editor\VisualScripting.Core\Dependencies\DotNetZip
    C:\Users\username\Documents\GitHub\project-ubiquitous-umbrella\UbiquitousUmbrella\Library\PackageCache\com.unity.ext.nunit@1.0.6\net35\unity-custom
    C:\Users\username\Documents\GitHub\project-ubiquitous-umbrella\UbiquitousUmbrella\Library\PackageCache\com.unity.visualscripting@1.9.1\Editor\VisualScripting.Core\EditorAssetResources
    C:\Users\username\Documents\GitHub\project-ubiquitous-umbrella\UbiquitousUmbrella\Library\PackageCache\com.unity.collections@1.2.4\Unity.Collections.LowLevel.ILSupport
    C:\Users\username\Documents\GitHub\project-ubiquitous-umbrella\UbiquitousUmbrella\Library\PackageCache\com.unity.collab-proxy@2.2.0\Lib\Editor\PlasticSCM
    C:\Program Files\Unity\Hub\Editor\2022.3.11f1\Editor\Data\Managed
    C:\Users\username\Documents\GitHub\project-ubiquitous-umbrella\UbiquitousUmbrella\Library\PackageCache\com.unity.ide.rider@3.0.25\Rider\Editor
    C:\Program Files\Unity\Hub\Editor\2022.3.11f1\Editor\Data\PlaybackEngines\WindowsStandaloneSupport
    C:\Users\username\Documents\GitHub\project-ubiquitous-umbrella\UbiquitousUmbrella\Library\PackageCache\com.unity.visualscripting@1.9.1\Runtime\VisualScripting.Flow\Dependencies\NCalc
    C:\Users\username\Documents\GitHub\project-ubiquitous-umbrella\UbiquitousUmbrella\Library\PackageCache\com.unity.visualscripting@1.9.1\Editor\VisualScripting.Core\Dependencies\YamlDotNet
    C:\Program Files\Unity\Hub\Editor\2022.3.11f1\Editor\Data\Managed\UnityEngine
    C:\Users\username\Documents\GitHub\project-ubiquitous-umbrella\UbiquitousUmbrella\Library\ScriptAssemblies ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Assembly-CSharp-Editor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
    at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00105] in <853812ae52c341daaef3c62ecdb86b32>:0
    at zzzUnity.Burst.CodeGen.AssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00013] in <772865cdae2d4bff9c305a06338cabcf>:0
    --- End of inner exception stack trace ---
    at zzzUnity.Burst.CodeGen.AssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00060] in <772865cdae2d4bff9c305a06338cabcf>:0
    at Burst.Compiler.IL.AssemblyLoader.Resolve (Mono.Cecil.AssemblyNameReference name) [0x0007e] in <772865cdae2d4bff9c305a06338cabcf>:0
    at Burst.Compiler.IL.Server.EntryPointMethodFinder.FindEntryPoints (System.String[] rootAssemblyNames, Burst.Compiler.IL.Hashing.CacheRuntime.HashCacheAssemblyStore assemblyStore, Burst.Compiler.IL.AssemblyLoader assemblyLoader, Burst.Compiler.IL.NativeCompilerOptions options, Burst.Compiler.IL.Server.ProfileDelegate profileCallback, System.Boolean includeRootAssemblyReferences, System.Boolean splitTargets) [0x00055] in <772865cdae2d4bff9c305a06338cabcf>:0
    at Burst.Compiler.IL.Server.CompilerServer+<>c__DisplayClass18_1.<FindMethods>b__0 (Burst.Compiler.IL.Server.Caching.CacheManager cacheManager) [0x0005e] in <772865cdae2d4bff9c305a06338cabcf>:0
    at Burst.Compiler.IL.Server.CompilerServer+<>c__DisplayClass26_0`1[TResult].<RunTask>b__0 () [0x00145] in <772865cdae2d4bff9c305a06338cabcf>:0
    at Burst.Compiler.IL.Server.CompilerServer.RunTask[TResult] (Burst.Compiler.IL.Server.TargetKey target, System.String taskName, System.String[] assemblyFolders, System.Threading.CancellationToken cancellationToken, System.Func`2[T,TResult] function) [0x00131] in <772865cdae2d4bff9c305a06338cabcf>:0
    at Burst.Compiler.IL.Server.CompilerServer.FindMethods (Burst.Compiler.IL.Server.CompilerServerOptions options, Burst.Compiler.IL.Aot.AotCompilerOptions aotOptions, Burst.Compiler.IL.Server.TargetKey target, Burst.Compiler.IL.Server.Caching.CacheManager cacheManager, Burst.Compiler.IL.CompilerStatistics stats, System.Threading.CancellationToken cancellationToken) [0x00299] in <772865cdae2d4bff9c305a06338cabcf>:0
    at Burst.Compiler.IL.Server.CompilerServer+<>c__DisplayClass26_0`1[TResult].<RunTask>b__0 () [0x00145] in <772865cdae2d4bff9c305a06338cabcf>:0
    at Burst.Compiler.IL.Server.CompilerServer.RunTask[TResult] (Burst.Compiler.IL.Server.TargetKey target, System.String taskName, System.String[] assemblyFolders, System.Threading.CancellationToken cancellationToken, System.Func`2[T,TResult] function) [0x00131] in <772865cdae2d4bff9c305a06338cabcf>:0
    at Burst.Compiler.IL.Server.CompilerServer.Compile (Burst.Compiler.IL.Server.CompilerServerOptions options, Burst.Compiler.IL.Server.CompilationMessageStreamer streamer, System.Threading.CancellationToken cancellationToken) [0x001af] in <772865cdae2d4bff9c305a06338cabcf>:0

    Sorry for the poor formatting.
     
    Last edited: Jan 12, 2024
  4. ZanOlsena

    ZanOlsena

    Joined:
    Apr 5, 2020
    Posts:
    11
    Quick update: I've since completely nuked the project from my PC and pulled it fresh from GitHub. The same error still happens in the exact same way. Its only on this project, and everyone else working on the project has no issues on their respective ends. It only seems to happen when I open Visual Studio, edit a script, and then tab back to Unity after saving the script. The error always occurs at that specific recompile.
     
  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,571
    Well that's kinda nutty... maybe cross check all the VS plugin crud??

    Here's my checklist:

    This may help you with intellisense and possibly other Visual Studio integration problems:

    Sometimes the fix is as simple as doing Assets -> Open C# Project from Unity. Other times it requires more.

    Other times it requires you also nuke the userprefs and .vsconfig and other crufty low-value high-hassle files that Visual Studio tends to slowly damage over time, then try the above trick.

    Barring all that, move on to other ideas:

    https://forum.unity.com/threads/intellisense-not-working-with-visual-studio-fix.836599/

    Also, try update the package inside of Unity: Window -> Package Manager -> Search for Visual Studio Editor -> Press the Update button

    Depending on flavor and version of Visual Studio, it may also have an installation step that you perform within the actual Visual Studio. This step seems finicky at best and may require multiple openings of VS before it comes up.

    Update: The VSCode extension has been deprecated and abandoned:

    https://forum.unity.com/threads/update-on-the-visual-studio-code-package.1302621/

    Update: the VSCode integration is back... maybe!?

    https://forum.unity.com/threads/microsoft-previews-unity-extension-for-visual-studio-code.1468913/

    There may be a community fork available that is receiving updates.

    https://github.com/Chizaruu/com.tsk.ide.vscode

    Also, this: https://forum.unity.com/threads/no-suggestions-in-vscode.955197/#post-6227874

    Recently (July 2023) I worked on a Windows11 system that required a Microsoft component to be installed from within Visual Studio before it would work properly with all the OTHER software installed under Unity. I have no documentation on that process as I have only seen it once and it surprised me as well.
     
  6. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    2,256
    sure nothings nuked your .net versions for the api level you're aiming at?
     
  7. Odyssean

    Odyssean

    Joined:
    Jan 20, 2023
    Posts:
    19
    I just happened upon this, the same thing happened to me yesterday. My project suddenly decided not to work, gave me the same error, navigating to the same file. File wont delete, says its open elsewhere. Ive tried uninstalling/reinstalling both Unity and VS, and even a computer restore. Nothing works. Tried new projects, old versions, etc. Open a new one, create script, type literally "//wheeee" and get the same error, this time directing to the new projects path to the same file (assembly-csharp.dll)

    Hopefully we can figure this out.
     
  8. ZanOlsena

    ZanOlsena

    Joined:
    Apr 5, 2020
    Posts:
    11
    Thats a good next step. I already tried checking that everything was up to date and working in the Package Manager, but I'll check VS itself and report back. Your checklist mentioned the .vsconfig, which I've never messed with or given much thought to, would it be worth deleting it just to see if that helps?

    As far as I can tell, no. Like I said above, this is only happening with this specific project. I had another project I was working on a couple of days ago that still works fine, I can compile scripts all day, same with a new project I made.

    Man that really sucks, thankfully its only happening on one project for me. I'll be sure to @ you if/when I find a solution!
     
  9. Odyssean

    Odyssean

    Joined:
    Jan 20, 2023
    Posts:
    19
    Thanks, I appreciate it. My friend and I started a multiplayer game Jan 1st, it took a while but I finally set up a working server. today we were supposed to link projects and test it with friends, but I randomly got that error, and no nothing in any unity project will work. AND I cant find any helpful info online, its either not relevant or it doesnt lead anywhere...

    Ive also tried using (i forget the name) but its like microsoft fire lock...? It finds apps that are in use, and where they are open. Tried to delete the file, said it was open. Searched that file. Not open. tried to delet again, said its open somewhere.

    Likewise, if I (somehow) find a solution, ill try to put it here.
     
  10. ZanOlsena

    ZanOlsena

    Joined:
    Apr 5, 2020
    Posts:
    11
    Ok, another update, I have found what seems to be the problem. Turns out it was my anti-virus, I use Webroot and it decided that every time I restart Unity and try to compile a script its going to lock down the Assembly-CSharp.dll. My work-around for this has been to completely kill the Webroot process (not just turn off protection, as I had before) while Unity is running. After that, I seem to have full access again and everything compiles just fine. I've used Webroot longer than I've been using Unity and never had a problem like this, so I can only imagine an update was pushed that is causing this. I'm going to look into how to allow Unity through any protections its put in place.

    @Odyssean I'm not sure what anti-virus you use, but you might try what I did with yours and see if that helps as a short term fix.

    @Kurt-Dekker Thanks a ton for the help and info (you linked some stuff on Unity and source control I've saved for future reference), but I'm 90% sure this is not a Unity related problem. Any further advice would be appreciated if you have it though.
     
    FROST6 likes this.
  11. Odyssean

    Odyssean

    Joined:
    Jan 20, 2023
    Posts:
    19
    @ZanOlsena hmm interesting. I have the same anti-virus (which cant be a coincidence), and ive disabled the 3 notches to the right and it still hasnt worked, but you mentioned killing the process completely. Dumb question but... how? Also, could you get it back? I would rather keep an anti-virus after all haha
     
    FROST6 likes this.
  12. ZanOlsena

    ZanOlsena

    Joined:
    Apr 5, 2020
    Posts:
    11
    Interesting, so Webroot must have done something then.

    To shut it down completely, I had to right click the small task bar icon (under hidden icons, I'm spacing the proper name for those) and choose "shut down protection". I did that with nothing open on my PC except Unity, just in case. After its shut down, I made a script edit to make sure it recompiled correctly, which it did, then searched up the Webroot executable and launched it again while Unity was still open. That let me recompile or do anything else I needed to until I closed the editor. Have to do the whole process the next time you launch it, but its a good temporary solution.

    Haven't had the chance to figure out how to tell Webroot to ignore it yet, but if I find one I'll @ you again.
     
  13. Odyssean

    Odyssean

    Joined:
    Jan 20, 2023
    Posts:
    19
    @ZanOlsena wow you werent kidding, that worked for me too. Huzzah! However, a temporary solution is not preferred (obviously).

    I tried allocating that single file (Assembly-CSharp.dll) that started both our problems to be allowed through the advanced settings (in webroot its the PC security gear button, then Block/Allow Files, then Add File) but that didnt seem to do anything.

    I also tried putting the Unity application itself as allowed, also did nothing.

    I also thought about doing VS but couldnt find it as an application. I also may have incorrectly done the above ones, so you could try them as well if you feel the need. Were making progress!
     
  14. ZanOlsena

    ZanOlsena

    Joined:
    Apr 5, 2020
    Posts:
    11
    @Odyssean I tried what you did as well, I think I allowed almost every file in my project through Webroot and it compiled ONCE before I got the error again. I even allowed Visual Studio through (the files and application are in Program Files (x86) for me) and that didn't help. Oh well, the restart trick still seems to work.

    I'm honestly out of ideas, I've reached out to Webroot through their support with a description of the issue just to see if I can get any response, but I get the feeling I'm in for a long wait and something about "adding it to the Block/Allow Files list" and a dismissive "try contacting Unity support" as if its somehow Unity's problem.
     
  15. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,571
    Make sure your Antivirus has absolutely NOTHING to do with the contents of your project folder area. Don't just add the DLL, exclude the entire project folder structure, all of it. This is software development, which regularly involves compiling fresh code, which to an AV solution might be flagged as nefarious shenanigans.

    Also make sure you aren't using anything line OneDrive or DropBox or DriveSync or whatever on this project. ALL types of drive sharing and mirroring software is explicitly NOT supported under Unity. Use proper source control.
     
  16. Odyssean

    Odyssean

    Joined:
    Jan 20, 2023
    Posts:
    19
    @ZanOlsena Interesting update: I just completely changed AVs. Swapped to Mcafee, but sadly (and weirdly) didnt change anything.
     
  17. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    2,256
    did you exclude your project folder?
     
  18. ZanOlsena

    ZanOlsena

    Joined:
    Apr 5, 2020
    Posts:
    11
    I just added my entire Unity editor and project folders to my AV's allowed list, and I got one compile in before it threw the same error again. And nope, not using any sort of drive sharing software, only GitHub.

    Very interesting, I got a response from Webroot's support which was basically "send us a log file", which I've done, so I'll report back what they tell me. Might be the AV isn't the issue, but somehow resetting it fixes it for a short period?
     
  19. Odyssean

    Odyssean

    Joined:
    Jan 20, 2023
    Posts:
    19
    definitely weird. Seems like its one of the only things it could be since getting rid of it is the only thing that works.
     
  20. SMSoftworks

    SMSoftworks

    Joined:
    Jan 19, 2024
    Posts:
    1
    I'm having this issue, and it's going to ground any progress I could make until it's resolved.

    Hope for a quick fix!

    Damn you Webroot :C

    Edit:

    Wait hol up... maybe I fixed it

    I had my game stored in C:/Users/MYUSERNAME/Onedrive/Documents

    It's never been an issue until now but I moved everything out of the Onedrive folder and into the proper (or at least, non One-Drive version) of the Documents folder, and it looks like that might have squashed it. I also added the DLL to Webroot's allowed scripts.

    My game is now located at C:\Users/MYUSERNAME\Documents\

    Edit 2:
    Nevermind, got my hopes up for nothing...
    It worked for a few minutes, until I created a script. Then it broke again.
    My project was brand new and scriptless before this.
     
    Last edited: Jan 22, 2024
  21. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    2,256
    It should never be in a onedrive, google drive, apple drive area. because they then try to copy files while maybe you want to now delete them
     
  22. Rabadash8820

    Rabadash8820

    Joined:
    Aug 20, 2015
    Posts:
    100
    This same issue is happening for me in Unity 2022.3.7f1. I also use Webroot (have been since ~2014, only used Unity since ~2016 and never had this issue before), and shutting down Webroot from the task tray as @ZanOlsena suggested above did remove the error. However, I have also experienced this error with non-Unity VS projects, as did another user on Reddit. I recently updated Visual Studio (and also added Microsoft's new PowerToys developer tool), so I'm wondering if maybe a recent VS update is not playing nice with Webroot, rather than Unity or Webroot itself.
     
    q-l-77 and ChimiChangle like this.
  23. Rabadash8820

    Rabadash8820

    Joined:
    Aug 20, 2015
    Posts:
    100
    I also get an error if I try to manually delete the Assembly-CSharp.dll from File Explorer: "The action can't be completed because the file is open in another program" (permanently deleting with Shift+Del does work though...).
    However, neither ProcessExplorer's "Find Handle or DLL" feature, nor Resource Monitor's "Associated Handles" feature, nor the new "What's using this file?" feature from PowerToys could reveal what might be using the DLL. Closing Webroot does allow me to delete the file, and I can then re-import my Assets/ folder (or a subfolder) in Unity to make the "user-mapped section" error go away. If I mess around in Visual Studio and save changes then go back to Unity, the domain reloads and the error does not come back, until I reactivate Webroot.

    This help article explains how to Allow (ignore) specific paths during Webroot's scanning. Unfortunately, looks like you can only ignore specific files, not whole folders, as many other angry people on the Webroot forums have noted...
     
    q-l-77 and ChimiChangle like this.
  24. Odyssean

    Odyssean

    Joined:
    Jan 20, 2023
    Posts:
    19
    Yep, all of that is 100% exactly the same, at least to me. As of right now, when I work, i just gotta disable it and re-enable it when im done.
     
  25. KMONEY808

    KMONEY808

    Joined:
    Jun 6, 2023
    Posts:
    1
    I also have webroot on my computer and having the same exact error message in unity. I tried to open my projects and it prompted me to go into 'safe mode' and gives me this error message. Has anyone figure out a permanent solution?
     
  26. ChimiChangle

    ChimiChangle

    Joined:
    Feb 28, 2017
    Posts:
    8
    I was just locked up by this exact error (same language, same exact file). Read the entire thread + some others on google, I also had webroot AV so I was feeling distraught. On a whim, I tried deleting these #pragma statements, saved, recompiled, and suddenly the error is gone.

    upload_2024-1-30_16-59-43.png

    I have no clue whether or not this was the real issue, I can only share my experience and hope it helps.

    I did Not:
    - Fiddle with my Webroot AV
    - Use any source control
    - Delete bin (not sure how to, even)
    - Reimport assets
    - Restart computer

    I did:
    - Close all Visual Studio tabs (didn't work)
    - also regenerate csproject files (didn't work)
    - delete #pragma lines

    edit: It popped up again today, back to being bricked.
    Turning off protection works.
     
    Last edited: Feb 1, 2024
  27. Cubixrube

    Cubixrube

    Joined:
    Jul 7, 2017
    Posts:
    3
    Just had this start happening today. Also using webroot. Anyone find an actual fix yet?
     
  28. PeppeDK

    PeppeDK

    Joined:
    Aug 16, 2016
    Posts:
    13
    Same problem here with Webroot, only deactivating it works, any solution?

    my error is:

    error CS2012: Cannot open 'F:\MyUnityProjects\Testproject\Library\Bee\artifacts\1900b0aE.dag\Assembly-CSharp.ref.dll' for writing -- 'The process cannot access the file 'F:\MyUnityProjects\Testproject\Library\Bee\artifacts\1900b0aE.dag\Assembly-CSharp.ref.dll' because it is being used by another process.'

    but actually Webroot is not performing any operation atleast as it shows, probably is checking it in background but makes it impossible to work with Unity right now.

    i've already tried to restart the PC, restart webroot, make a full pc scan by webroot, use webroot's utilities to clean the pc, but nothing, the problem keeps.
     
    Last edited: Feb 1, 2024
  29. q-l-77

    q-l-77

    Joined:
    Jan 13, 2024
    Posts:
    1
    Had the exactly same bug on the same file and yes of course I use Webroot. So it is an issue between VS and webroot.
     
  30. pjdidelot

    pjdidelot

    Joined:
    Jan 22, 2020
    Posts:
    4
    I opened up Unity for the first time in a week and was met with the same error and I have Webroot as well…
     
  31. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,756
    If you guys capture this error happening using Windows Performance Recorder with File I/O activity (instructions here) and send me the log via DM, I can probably tell you what's locking the file or why Unity cannot open it.
     
  32. bugfinders

    bugfinders

    Joined:
    Jul 5, 2018
    Posts:
    2,256
    Well everyone who gets this issue has webroot - is this not a clear enough issue?
     
  33. PeppeDK

    PeppeDK

    Joined:
    Aug 16, 2016
    Posts:
    13
    Windows performance analyzer shows that a moment earlier WRSA.exe gets access to the assembly-csharp.dll with success and with the flag FILE_COMPLETE_IF_OPLOCKED (i guess this locks the file, im not sure)
    And a moment later (see next pic) dotnet.exe tries to access to it but without success.

    Moment earlier
    upload_2024-2-2_15-38-15.png

    Moment later
    upload_2024-2-2_15-38-32.png

    Im sorry i cant send the full log as its a huge file even if the record was done for seconds.

    @Tautvydas-Zilys correct me if im wrong.
     
    Last edited: Feb 2, 2024
  34. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,756
    Looks about right. I'd suggest dragging the event type column to the right side of the yellow line, and sort by "Start" time. That will make show all the events happening in order.

    As for the file size, yeah, they're huge. However if you were to put it into a zip file, they compress really well.

    It's quite clear there's some interaction between Unity and webroot issue. But it's unclear which software is doing the wrong thing without further analysis.
     
  35. PeppeDK

    PeppeDK

    Joined:
    Aug 16, 2016
    Posts:
    13
    I've remade the record with different settings, its much smaller the size now so i've just sent to you @Tautvydas-Zilys in DM
     
  36. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,756
    Your analysis was pretty much correct. It seems that WebRoot opens the file multiple times. First with FILE_SHARE_READ FILE_SHARE_WRITE FILE_SHARE_DELETE flags, which allows file to be deleted or overwritten while it's open. However later it opens the same file with FILE_SHARE_READ, which prevents it from being deleted overwritten. It holds the file open for about 1.1 seconds, which is enough for Unity to try to overwrite it and fail.

    Specifically, out of all the processes, it's the WRSkyClient.x64.exe that is at fault: I don't know if that's a component that you can disable, but this information that I just posted might be valuable to the WebRoot vendor if you make a support ticket with them.
     
  37. jazz3dart

    jazz3dart

    Joined:
    Jul 18, 2021
    Posts:
    1
    i just moved the files that were giving me errors from the file structure onto my desktop so they are out of the file and project (since i could not delete). that seems to have gotten rid of the errors and allows me to compile, test in engine, and continue working. hope this helps!
     
  38. Odyssean

    Odyssean

    Joined:
    Jan 20, 2023
    Posts:
    19
    Nope, still doesnt work...
    I did figure out a small thing though: if I turn off my antivirus, i am able to delete the file (where i wasnt before). buuuut the same error still pops up.
     
  39. MikePanoff

    MikePanoff

    Joined:
    Apr 29, 2015
    Posts:
    21
    Thank you, I just opened a support ticket with Webroot, I will post the response, if any.
     
    Rabadash8820 likes this.
  40. NeoChrisOmega

    NeoChrisOmega

    Joined:
    Nov 20, 2020
    Posts:
    2
    I have a student that I teach online getting the same error. Obviously I do not want to tell the student to turn off the anti-virus (or any other future students that might get this error), so hopefully there is a solution soon. I'm mostly replying to get the notification when Webroot (hopefully) responds with a solution.
     
  41. Odyssean

    Odyssean

    Joined:
    Jan 20, 2023
    Posts:
    19
    It seems like I solved it!!!! @ZanOlsena it was completely unintentional, but the bug seems to have gone away, and i just remembered this forum. All I did: Update Unity VC. thats it.

    The project im working on with my friend had some problems, so we started to use branching (havent before, kinda stupid we never tried) and in order to, we had to both update the built in Unity Version Control. while it was doing its thing, I noticed it was doing something to the code editor- I just tested it now, and it seems to be working! Let me know if this seems like a fix!
     
  42. Rabadash8820

    Rabadash8820

    Joined:
    Aug 20, 2015
    Posts:
    100
    @Odyssean Glad you found a solution for your project. My team uses git so that won't help me unfortunately. Pretty sure I've updated git since encountering this error too. I still just disable Webroot when doing Unity stuff.
     
    bugfinders likes this.
  43. Odyssean

    Odyssean

    Joined:
    Jan 20, 2023
    Posts:
    19
    You can still "use" unity VC, but go through git. All I did was just update the popup window for the branch explorer.