protobuf-csharp-port icon indicating copy to clipboard operation
protobuf-csharp-port copied to clipboard

"GenericArguments[0], 'SystemMessageTest', on 'Google.ProtocolBuffers.IBuilderLite`2[TMessage,TBuilder]' violates the constraint of type parameter 'TMessage'."

Open BrokenHell opened this issue 10 years ago • 3 comments
trafficstars

What steps will reproduce the problem? 1.Build a simple .proto file then convert into .cs file ( simple .proto file can just be a simple class with single data ) 2.Import into Unity project ( with .cs file and .dll file for windows phone 8 ) - Unity v5.0.2p1 3.Build Unity project into Windows phone 8 project 4.Run on device in RELEASE mode => see it crashed.

error_6 error_1 error_2 error_3

I cant see the whole stack trace since everything is "Null" the only message I got from debug data is this "GenericArguments[0], 'SystemMessageTest', on 'Google.ProtocolBuffers.IBuilderLite`2[TMessage,TBuilder]' violates the constraint of type parameter 'TMessage'."

But by doing exactly my step will get you guys there . ( dont run in Debug mode since it will be ok , run in Release mode instead )

Thanks.

BrokenHell avatar May 28 '15 04:05 BrokenHell

I manage to get the full stack trace here

  •   $exception  {System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'WinRTBridge.WinRTBridge' threw an exception. ---> System.TypeInitializationException: The type initializer for 'WinRTBridge.TypeInformation' threw an exception. ---> System.TypeLoadException: GenericArguments[0], 'SystemMessageTest', on 'Google.ProtocolBuffers.IBuilderLite`2[TMessage,TBuilder]' violates the constraint of type parameter 'TMessage'.
    
    at UnityEngineInternal.BootstrapHelpers.FillTypeMaps(Dictionary2& typeToTypeIdMap, List1& typeIdToTypeMap) at WinRTBridge.TypeInformation..cctor() --- End of inner exception stack trace --- at WinRTBridge.WinRTBridge..cctor() --- End of inner exception stack trace --- at WinRTBridge.WinRTBridge.set_Control(Object value) at NPlayTest.MainPage..ctor() --- End of inner exception stack trace --- at System.Windows.Navigation.PageResourceContentLoader.EndLoad(IAsyncResult asyncResult) at System.Windows.Navigation.NavigationService.ContentLoader_BeginLoad_Callback(IAsyncResult result) at System.Windows.Navigation.PageResourceContentLoader.BeginLoad_OnUIThread(AsyncCallback userCallback, PageResourceContentLoaderAsyncResult result) at System.Windows.Navigation.PageResourceContentLoader.<>c__DisplayClass4.<BeginLoad>b__0(Object args) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.UnsafeInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Delegate.DynamicInvokeImpl(Object[] args) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.Dispatch(DispatcherPriority priority) at System.Windows.Threading.Dispatcher.OnInvoke(Object context) at System.Windows.Hosting.CallbackCookie.Invoke(Object[] args) at System.Windows.RuntimeHost.ManagedHost.InvokeDelegate(IntPtr pHandle, Int32 nParamCount, ScriptParam* pParams, ScriptParam* pResult)} System.Exception {System.Reflection.TargetInvocationException}

BrokenHell avatar May 28 '15 04:05 BrokenHell

Without knowing anything about UnityEngineInternal.BootstrapHelpers.FillTypeMaps, it's hard for me to do anything else with this issue, I'm afraid.

(I've never advertised Unity as a supported platform for Protocol Buffers, and I've never used it myself. I'm not going to install it just to chase down this problem - particularly not right now, as I'm on holiday at the moment.)

As mentioned elsewhere, you could try applying https://github.com/ironhidegames/protobuf/commit/83bcfefb0be8a2a05a03e7d7080b354973c39b20 - but it's not clear that it's the same issue that that one fixes.

I suggest you contact Unity support about this - they're more likely to know about the quirks of Mono at that particular version and running on iOS than I do.

jskeet avatar May 28 '15 04:05 jskeet

Ok I had fix this via Unity side , it is not because of Protocol buffer .

Thanks a lot.

BrokenHell avatar May 28 '15 10:05 BrokenHell