Code Monkey home page Code Monkey logo

Comments (5)

dcariola avatar dcariola commented on June 11, 2024

It looks like there's a duplicate element somewhere. Give me some more info to reproduce.

from xcodeeditor-for-unity.

frarees avatar frarees commented on June 11, 2024

Cannot reproduce it right now cause I'm getting violation exceptions all the time.

Reproduce steps:

Do a fresh build (no CMD+B, no Build & Run, create the Xcode project in a new folder). It says:

IOException: Sharing violation on path /Users/frarees/Desktop/sandbox/Unity-iPhone.xcodeproj/project.pbxproj
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Applications/buildAgent/work/3df08680c6f85295/mcs/class/corlib/System.IO/FileStream.cs:320)
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share)
(wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) (at /Applications/buildAgent/work/3df08680c6f85295/mcs/class/corlib/System.IO/StreamWriter.cs:124)
System.IO.StreamWriter..ctor (System.String path, Boolean append)
(wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string,bool)
System.IO.File.CreateText (System.String path) (at /Applications/buildAgent/work/3df08680c6f85295/mcs/class/corlib/System.IO/File.cs:159)
UnityEditor.XCodeEditor.XCProject.Save () (at Assets/Editor/XCodeEditor/XCProject.cs:958)
XCodePostProcess.OnPostProcessBuild (BuildTarget target, System.String path) (at Assets/Editor/XCodePostProcess.cs:21)
UnityEditor.HostView:OnGUI()

Then, I do an append, to try again, over the same folder. It doesn't work of couse cause the project is broken.
Then, I do a build again over the same folder (replace), and the violation problem occurs again.

The post build script I'm using is:

using UnityEditor;
using UnityEditor.Callbacks;
using UnityEngine;

public static class XCodePostProcess
{
    [PostProcessBuild]
    public static void OnPostProcessBuild( BuildTarget target, string path )
    {
        if (target == BuildTarget.iPhone) {
            // Create a new project object from build target
            UnityEditor.XCodeEditor.XCProject project = new UnityEditor.XCodeEditor.XCProject( path );

            // Find and run through all projmods files to patch the project
            var files = System.IO.Directory.GetFiles( Application.dataPath, "*.projmods", System.IO.SearchOption.AllDirectories );

            foreach( var file in files )
                project.ApplyMod( file );

            // Save
            project.Save();
        }
    }
}

from xcodeeditor-for-unity.

frarees avatar frarees commented on June 11, 2024

Any progress on this?

from xcodeeditor-for-unity.

HenryStrattonFW avatar HenryStrattonFW commented on June 11, 2024

For anyone who finds this after all this time.
This issue is with the PBX parser. Around line 182 (approx) There is the case statement for DICTIONARY_ASSIGN_TOKEN

this case by default simply adds to the dictionary regardless of the key's use. In our use we have simply modified this to do a standard "If exists then set value , else add value" pattern. However for your own uses you may want to flag this up to the user with the values or whatever to have a more hands on resolution of the conflict.

from xcodeeditor-for-unity.

nacho4d avatar nacho4d commented on June 11, 2024

I am facing exactly the same issue here.
I received once An element with the same key already exists in the Dictionary<TKey, TValue> but it is not reproducible all the times. I am sure my xcode project file has some duplicated keys but I am not sure what are those keys.

This helped a bit http://stackoverflow.com/questions/23836364/ioexception-sharing-violation-on-path-on-building-a-unity-project-on-mac-os-x

It would be nice that XcodeEditor-for-Unity checks the existance of an object associated to a key. If the object is the same, then just skip. Otherwise print a debug log warning of throw an exception

from xcodeeditor-for-unity.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.