Delight icon indicating copy to clipboard operation
Delight copied to clipboard

Unity hangs after saving a View with embedded C#

Open negue opened this issue 4 years ago • 1 comments

This Issue took some time to understand and to find cause each try the process stopped working 😁

System: Win10 - 20H2 Unity: 2020.3.17f1 Delight: current store version

When using this example view

<NewView AdjustToParent="Stretch" MyBool="t:Boolean" 
                         BasedOn="LayoutRoot">
 <Grid AdjustToParent="Stretch"> 
<Group Spacing="10" Alignment="BottomLeft"
         BackgroundColor="Green" Orientation="Horizontal">

  <Group Spacing="10" Alignment="TopLeft" 
         IsVisible="$ {MyBool} != false " >
  <Group Orientation="Horizontal">
    <Label Text="Test: {MyBool}" /> 
  </Group>
  
</Group>

</Group>

   </Grid>

</NewView>

This or other embedded C# Codes seems to break the process of creating the script files: IsVisible="$ {MyBool} != false "

Reproduce:

  1. Be in the designer, change anything in the view file

  2. Save and stop the running "game"

  3. You'll see something like this in the Console Log:

    Copying assembly from 'Temp/Assembly-CSharp.dll' to 'Library/ScriptAssemblies/Assembly-CSharp.dll' failed. Detailed error: Sharing violation on path

  4. Unfocus Unity, and refocus it

  5. due to the issue in 3. - unity never comes back from image

Nothing happens when you don't have the embedded C# code then it all "just works"

negue avatar Oct 19 '21 21:10 negue

I tried moving Delight to the Library Directory, like described in #28. I hoped that this would decouple some things so that the editor doesn't to reload everything, but it seems that doesn't work for this Package at all. (Designer not working then anymore).

I tried disabling the auto-compile of Unity but it seems that "crash" of the following log is repeated endless:

Compilation is still ongoing. Will not reload assemblies. Reloading assemblies after forced synchronous recompile.

On Unity 2021.1.25f1 it doesn't have the "Reload Script Assemblies" endless loop of ^ but it still stops at

Copying assembly from 'Temp/Assembly-CSharp.dll' to 'Library/ScriptAssemblies/Assembly-CSharp.dll' failed. Detailed error: Sharing violation on path

and then need to kill Unity inorder to work again.


I can't seem to find the reason why its only happening when you edit something from inside the Unity Delight Designer that use Embedded C# Code.

If you change the XML outside and press "Rebuild All" on the Delight-Panel - there is no issue.

Could it be that the process after exiting the running Unity "game" still has some weird Assembly References that prevents everything to replace it?

negue avatar Oct 27 '21 23:10 negue