supabase-community / supabase-csharp

A C# Client library for Supabase
https://github.com/supabase-community/supabase-csharp/wiki
MIT License
496 stars 50 forks source link

Building in Unity fails with: Burst internal compiler error: Burst.Compiler.IL.CompilerExceptionAssemblyResolution: Unable to resolve type `System.Runtime.CompilerServices.IsReadOnlyAttribute. Reason: Unknown.` #104

Closed GrimLothar closed 1 year ago

GrimLothar commented 1 year ago

Bug report

Describe the bug

The library seems to be working fine within the Editor, but as soon as I try to make an actual build, I get like 13 of these errors:

Burst internal compiler error: Burst.Compiler.IL.CompilerExceptionAssemblyResolution: Unable to resolve type `System.Runtime.CompilerServices.IsReadOnlyAttribute. Reason: Unknown.`

Sometimes I also get

Library/Bee/artifacts/MacStandalonePlayerBuildProgram/AsyncPluginsFromLinker: Failed to find entry-points:
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun () (at /Users/bokken/build/output/unity/unity/Editor/Mono/BuildPlayerWindow.cs:189)

But not always...

To Reproduce

I tried installing using the steps described here: https://github.com/supabase-community/supabase-csharp/wiki/Unity

And also using the NuGet for Unity package: https://github.com/GlitchEnzo/NuGetForUnity

Both result in the same outcome.

System information

I'm attaching the full Editor.log file so you can see all the errors. (too big to just post as text)

Editor.log

wiverson commented 1 year ago

Ugh, probably something wrong with the dependencies. There might be too many conflicting ones.

Try opening and running this template, LMK if it works. https://github.com/wiverson/supabase-unity-template

In particular, check to see if your dependencies match https://github.com/wiverson/supabase-unity-template/tree/main/Assets/Supabase - my guess is you are pulling in too many and something is conflicting/not resolving.

GrimLothar commented 1 year ago

Ok, good news is that the template built without issues... I'm going to try to copy over the dependencies and let you know how it goes. Thank you for the quick reply!

GrimLothar commented 1 year ago
Screenshot 2023-09-04 at 4 14 39 PM

although the lists looks completely identical... maybe something weird inside one of the packages

GrimLothar commented 1 year ago

Alright, good news again. Copying over the Supabase folder from that project made the build work! (just wish I didn't waste all day trying to fix is myself before posting here lol) So something is getting messed up when going the raw installation route.

Happy to help debug that if you want! But otherwise, i'm good now!

Will leave open depending on how you want to proceed

wiverson commented 1 year ago

I just updated the docs a bit to try to help clarify https://github.com/supabase-community/supabase-csharp/wiki/Unity

If you are good go ahead and mash that close button! :)

GrimLothar commented 1 year ago

hey @wiverson sorry to hijack my own ticket, but what is the best way to ask for some questions that are not really a bug?

Specifically right now i'm wondering how to properly handle winding down a realtime connection and then recreate it.

I see that a channel has RemovePostgresChangeHandler and Unsubscribe. Also see that RealtimeBroadcast has ClearBroadcastEventHandlers What I'm not finding is how to Unregister a broadcast on a channel. and since I didn't do that, i just run into this error:

InvalidOperationException: Register can only be called with broadcast options for a channel once.

Any tips on best practice here would be appreciated! (and where should I ask these things in the future :D )

acupofjose commented 1 year ago

@grimAgent the best place would be on the discussions.

Interesting! At the moment, there's not a way to remove a channel's broadcast registration. I haven't had anyone ask to do that yet haha.

To get around it, you could go to the main realtime client and just remove the channel (which unsubscribes it as well) and create a new one later for what you're doing.

Supabase.Realtime.Remove(Channel channel);

The idea, at least for our client right now, is that a channel would provide one particular kind of broadcast structure. Since Realtime supports any arbitrary channel name, you would just make a different channel for a different kind of broadcast structure.

GrimLothar commented 1 year ago

Perfect! Thank you @acupofjose will try that out and follow up in discussions if needed. Thanks!

kaushalkumar86 commented 1 year ago

Hi, I am also getting this error after update, using .net2.1 When followed steps mentioned by @grimAgent , I an getting another error as tasawaiter does not implement....