Search Issue Tracker

Fixed in 2019.2.X

Fixed in 2019.1.X

Votes

1

Found in

2019.1.0a12

2019.1.0a13

Issue ID

1113207

Regression

Yes

[Version Control]"UnauthorizedAccessException" is thrown on switching to perforce in version control mode

Version Control

-

"UnauthorizedAccessException" is thrown on switching to perforce in version control mode. Refer the attached video

Steps to reproduce:
1) Open attached project
2) Edit > Project Settings > Editor
3) Under version control, select mode Perforce

Actual result: "UnauthorizedAccessException" is thrown in console.

Expected result: No exception is thrown in console

Occurs in: 2019.1.0a13, 2019.1.0a12
Working fine in: 2019.1.011, 2018.3.0f2

Environment: Both Windows and Mac

Stack trace:

UnauthorizedAccessException: Access to the path "C:\Users\gs1801\Perforce\Vinod_wks\VCS-Callback\ProjectSettings\XRSettings.asset" is denied.System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) (at <1aa022ba59ae4cfa86ec80b69d3d4fc2>:0)System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options, System.String msgPath, System.Boolean bFromProxy, System.Boolean useLongPath, System.Boolean checkHost) (at <1aa022ba59ae4cfa86ec80b69d3d4fc2>:0)(wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions,string,bool,bool,bool)System.IO.StreamWriter.CreateFile (System.String path, System.Boolean append, System.Boolean checkHost) (at <1aa022ba59ae4cfa86ec80b69d3d4fc2>:0)System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding, System.Int32 bufferSize, System.Boolean checkHost) (at <1aa022ba59ae4cfa86ec80b69d3d4fc2>:0)System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding, System.Int32 bufferSize) (at <1aa022ba59ae4cfa86ec80b69d3d4fc2>:0)System.IO.StreamWriter..ctor (System.String path) (at <1aa022ba59ae4cfa86ec80b69d3d4fc2>:0)(wrapper remoting-invoke-with-check) System.IO.StreamWriter..ctor(string)UnityEditorInternal.VR.XRProjectSettings.Internal_SaveSettings () (at C:/buildslave/unity/build/Modules/VREditor/Mono/XRPackageSettings.cs:99)UnityEditorInternal.VR.XRProjectSettings.OnDestroy () (at C:/buildslave/unity/build/Modules/VREditor/Mono/XRPackageSettings.cs:64)

  1. Resolution Note (fix version 2019.2):

    XRSettings.asset is a serialized ScriptableObject, but because it's in PackageSettings we couldn't use Asset Database to handle serialization. That means we were not getting the benefit of it's integration with the Provider system. This means that we were always trying to write to a locked file if Perforce were enabled.

    The change here is to add a call to the Provider to ask for check out permissions. This should unlock the file if allowed. We also check for Read Only state after that to make sure we aren't trying to write to a file that may be manually locked.

Comments (1)

  1. efournier

    Jun 12, 2019 17:54

    Hi. The editor is now able to checkout the file but the only reason it does it is to change the line ending character encoding. It does it even with Perforce workspace's line ending setting is set to UNIX. That is the only thing that change in the file (it does that for other settings files too).

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.