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

Unity3D - Failed to weave assembly. #3199

Closed
georgiitonchev opened this issue Jan 24, 2023 · 4 comments · Fixed by #3200
Closed

Unity3D - Failed to weave assembly. #3199

georgiitonchev opened this issue Jan 24, 2023 · 4 comments · Fixed by #3200

Comments

@georgiitonchev
Copy link

georgiitonchev commented Jan 24, 2023

What happened?

I get the "Failed to weave assembly." error for one of my assemblies in my Unity project. Happens on any assembly reload.
Tools > Realm > Weave Assemblies also produces the same result.

Repro steps

Assembly Reload due to code changes in solution -> "Failed to weave assembly."
Tools > Realm > Weave Assemblies -> "Failed to weave assembly."

Version

10.19.0

What Atlas Services are you using?

Local Database only

What type of application is this?

Unity

Client OS and version

Microsoft Windows 11 Pro - 10.0.22621 Build 22621, Unity 2021.3.16f1

Code snippets

No response

Stacktrace of the exception/crash you're getting

[Game.Dialogue] Failed to weave assembly. If the error persists, please report it to https://github.com/realm/realm-dotnet/issues: System.InvalidOperationException: Operation is not valid due to the current state of the object.
  at Mono.Collections.Generic.Collection`1+Enumerator[T].CheckState () [0x00036] in <847bd8c6804f451e8e587bcc6a3e4780>:0 
  at Mono.Collections.Generic.Collection`1+Enumerator[T].MoveNext () [0x00000] in <847bd8c6804f451e8e587bcc6a3e4780>:0 
  at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00059] in <1c318258bf0843289b0e2cbe692fee39>:0 
  at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00059] in <1c318258bf0843289b0e2cbe692fee39>:0 
  at RealmWeaver.Weaver+<GetReferencedTypes>d__58.MoveNext () [0x0022b] in <847bd8c6804f451e8e587bcc6a3e4780>:0 
  at System.Linq.Enumerable+WhereEnumerableIterator`1[TSource].MoveNext () [0x0004e] in <1c318258bf0843289b0e2cbe692fee39>:0 
  at System.Linq.Enumerable+ConcatIterator`1[TSource].MoveNext () [0x0002b] in <1c318258bf0843289b0e2cbe692fee39>:0 
  at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00059] in <1c318258bf0843289b0e2cbe692fee39>:0 
  at System.Linq.Set`1[TElement].UnionWith (System.Collections.Generic.IEnumerable`1[T] other) [0x00018] in <1c318258bf0843289b0e2cbe692fee39>:0 
  at System.Linq.Enumerable+DistinctIterator`1[TSource].FillSet () [0x0000b] in <1c318258bf0843289b0e2cbe692fee39>:0 
  at System.Linq.Enumerable+DistinctIterator`1[TSource].ToArray () [0x00000] in <1c318258bf0843289b0e2cbe692fee39>:0 
  at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <1c318258bf0843289b0e2cbe692fee39>:0 
  at RealmWeaver.Weaver.WeaveSchema (Mono.Cecil.TypeDefinition[] types) [0x00070] in <847bd8c6804f451e8e587bcc6a3e4780>:0 
  at RealmWeaver.Weaver.Execute (RealmWeaver.Analytics+Config analyticsConfig) [0x00105] in <847bd8c6804f451e8e587bcc6a3e4780>:0 
  at RealmWeaver.UnityWeaver.WeaveAssemblyCore (System.String assemblyPath, System.Collections.Generic.IEnumerable`1[T] references, System.String framework, System.String targetOSName) [0x00066] in <847bd8c6804f451e8e587bcc6a3e4780>:0 
UnityEngine.Debug:LogError (object)
RealmWeaver.UnityWeaver/UnityLogger:Error (string,Mono.Cecil.Cil.SequencePoint)
RealmWeaver.UnityWeaver:WeaveAssemblyCore (string,System.Collections.Generic.IEnumerable`1<string>,string,string)
RealmWeaver.UnityWeaver/<>c__DisplayClass19_0:<WeaveAllAssemblies>b__0 ()
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()

Relevant log output

No response

@nirinchev
Copy link
Member

Hey, do you think you can share with us a simple repro case? It appears like there's a bug in the code that iterates over your classes to build the Realm schema and it'll be super helpful if we could get access to your project to test against.

@nirinchev nirinchev self-assigned this Jan 24, 2023
@nirinchev nirinchev added the More-information-needed More information is needed to progress. The issue will close automatically in 2 weeks. label Jan 24, 2023
@sync-by-unito sync-by-unito bot added the Waiting-For-Reporter Waiting for more information from the reporter before we can proceed label Jan 24, 2023
@georgiitonchev
Copy link
Author

Hey, @nirinchev, I've shared with you a project where the error still persists.

@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed More-information-needed More information is needed to progress. The issue will close automatically in 2 weeks. Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels Jan 24, 2023
@nirinchev
Copy link
Member

Thanks for this. I was able to reproduce it and as far as I can tell, it's a bug in Mono, though I can't quite put my finger on what's causing it. In any case, I have a workaround that seems to resolve the issue in the repro project you provided.

@georgiitonchev
Copy link
Author

Great, thanks! I'll be sure to update this issue once I have an update.

@sync-by-unito sync-by-unito bot removed the Needs-Attention Reporter has responded. Review comment. label Jan 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants