EricVoll / ros-sharp

ROS# is a set of open source software libraries and tools in C# for communicating with ROS from .NET applications, in particular Unity3D
Apache License 2.0
36 stars 7 forks source link

Reference Rewriter Error #9

Open dnlwbr opened 4 years ago

dnlwbr commented 4 years ago

Hello @EricVoll

when compiling my Project I receive the following three errors:

[...]
Error: method `!!0& System.Runtime.CompilerServices.Unsafe::Unbox<TClass>(System.Object)` doesn't exist in target framework. It is referenced from System.Text.Json.dll at TProperty System.Text.Json.ReflectionMemberAccessor/<>c__DisplayClass14_0`2::<CreateStructPropertyGetter>b__0(System.Object).
Error: method `!!0& System.Runtime.CompilerServices.Unsafe::Unbox<TClass>(System.Object)` doesn't exist in target framework. It is referenced from System.Text.Json.dll at System.Void System.Text.Json.ReflectionMemberAccessor/<>c__DisplayClass15_0`2::<CreateStructPropertySetter>b__0(System.Object,TProperty).

UnityEngine.Debug:LogError(Object)
PostProcessWinRT:RunReferenceRewriter() (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessWinRT.cs:1203)
PostProcessWinRT:Process() (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessWinRT.cs:209)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Reference rewriter: Error: method `!!0& System.Runtime.CompilerServices.Unsafe::Unbox<TClass>(System.Object)` doesn't exist in target framework. It is referenced from System.Text.Json.dll at TProperty System.Text.Json.ReflectionMemberAccessor/<>c__DisplayClass14_0`2::<CreateStructPropertyGetter>b__0(System.Object).
UnityEngine.Debug:LogError(Object)
PostProcessWinRT:RunReferenceRewriter() (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessWinRT.cs:1205)
PostProcessWinRT:Process() (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessWinRT.cs:209)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Reference rewriter: Error: method `!!0& System.Runtime.CompilerServices.Unsafe::Unbox<TClass>(System.Object)` doesn't exist in target framework. It is referenced from System.Text.Json.dll at System.Void System.Text.Json.ReflectionMemberAccessor/<>c__DisplayClass15_0`2::<CreateStructPropertySetter>b__0(System.Object,TProperty).
UnityEngine.Debug:LogError(Object)
PostProcessWinRT:RunReferenceRewriter() (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessWinRT.cs:1205)
PostProcessWinRT:Process() (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessWinRT.cs:209)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

So I've tested your example project and unfortunatly I get the same errors. Nevertheless, the building process still completes successfully and it seems to work when deployed to the Hololens. Did you receive these errors as well?

By the way, is there a reason you choose the "Web Socket Sharp" protocol over "Web Socket UWP" in the RosConnector component in your example project? Which one should be prefered? As serializer I chose Newtonsoft_JSON.

Thanks in advance.

Best, Daniel

EricVoll commented 3 years ago

Hi @dnlwbr

thanks for creating this issue. I have definitely seen these errors as well, but I am not sure if they came up in my last builds. I'll check as soon as I do the next builds. From the look of it it seems, that these errors originate in the Newtonsoft library.

For some reason the build includes System.Text.Json.dll in the build files, which shouldn't be used in UWP apps anyways. Maybe adding this library to the link.xml file could resolve this issue. I'll check that and will comment here.

EricVoll commented 3 years ago

Quick update: When building for Android I don't seem to receive this error message.

EricVoll commented 3 years ago

I am also getting these errors when building for HoloLens. They never broke anything or so... I'll look into it when I have more time, since it is not a blocking issue. -Eric

flymaxty commented 3 years ago

Hi @EricVoll , I have the errors on Unity 2019.4.13f1c1, I can deploy the app to Hololens2, but no connections established between ROS and App.

I'm a freshman in Unity, so I can not figure out why, but would like to provide more details if you need anything. :)

EricVoll commented 3 years ago

hi @flymaxty Did you try to deploy the demo app, or did you build a custom app? When you say, that you can't connect to the ROS master: Do you mean, that you literally can't connect to the rosbridge, or "only" that no messages arrive? Maybe something to note for the demo app: The demo app subscribes to the "/clock" topic. Could you make sure on your rosmaster that something publishes clock messages to this topic? Cheers, Eric