Refit 6 not working when android project built with unity - c#

I'm using Refit 6 in unity for rest calls but when project is built for Android getting below error.
Message: MissingMethodException: Constructor on type 'Refit.Implementation.Generated+*InterfaceName*' not found.
Stack Trace:
System.RuntimeType.CreateInstanceImpl (System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes, System.Threading.StackCrawlMark& stackMark) (at <00000000000000000000000000000000>:0)
System.Activator.CreateInstance (System.Type type, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes) (at <00000000000000000000000000000000>:0)
Refit.RestService.For[T] (System.Net.Http.HttpClient client, Refit.IRequestBuilder`1[T] builder) (at <00000000000000000000000000000000>:0)
System.Action`1[T].Invoke (T obj) (at <00000000000000000000000000000000>:0)
System.Action`1[T].Invoke (T obj) (at <00000000000000000000000000000000>:0)
UnityEngine.Events.UnityAction.Invoke () (at <00000000000000000000000000000000>:0)
UnityEngine.Events.UnityEvent.Invoke () (at <00000000000000000000000000000000>:0)
UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1].Invoke (T1 handler, UnityEngine.EventSystems.BaseEventData eventData) (at <00000000000000000000000000000000>:0)
UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at <00000000000000000000000000000000>:0)
UnityEngine.EventSystems.StandaloneInputModule.ProcessTouchPress (UnityEngine.EventSystems.PointerEventData pointerEvent, System.Boolean pressed, System.Boolean released) (at <00000000000000000000000000000000>:0)
UnityEngine.EventSystems.StandaloneInputModule.ProcessTouchEvents () (at <00000000000000000000000000000000>:0)
UnityEngine.EventSystems.StandaloneInputModule.Process () (at <00000000000000000000000000000000>:0)
UnityEngine.EventSystems.StandaloneInputModule:Process()
I tried adding link.xml but didn't help.
Any help on this will be useful.

It looks like they added support for code generation in 2021.2 (https://docs.unity3d.com/2021.2/Documentation/Manual/roslyn-analyzers.html)
But how you use that with refit, I don't know. I'd like to get refit working with Unity as well.

Related

AmbiguousMatchException Raised Without Changing Anything in Unity

Recently I Opened my project after 6 Months, and When is started it, it asked me To Automatically Update some files in the project, to which I said Yes, When Unity Started There was this Error in log repeating Every second. Please Help.
System.RuntimeType.GetMethodImplCommon (System.String name, System.Int32 genericParameterCount, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConv, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) (at <cdc4992cc04a4e77a24a09cd121af77b>:0)
System.RuntimeType.GetMethodImpl (System.String name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Reflection.CallingConventions callConv, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) (at <cdc4992cc04a4e77a24a09cd121af77b>:0)
System.Type.GetMethod (System.String name, System.Reflection.BindingFlags bindingAttr) (at <cdc4992cc04a4e77a24a09cd121af77b>:0)
System.Type.GetMethod (System.String name) (at <cdc4992cc04a4e77a24a09cd121af77b>:0)
GooglePlayServices.UnityCompat.GetUnity56AndAboveApplicationIdentifier (UnityEditor.BuildTarget buildTarget) (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/AndroidResolver/src/UnityCompat.cs:437)
GooglePlayServices.UnityCompat.GetApplicationId (UnityEditor.BuildTarget buildTarget) (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/AndroidResolver/src/UnityCompat.cs:491)
GooglePlayServices.PlayServicesResolver.GetAndroidApplicationId () (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:996)
GooglePlayServices.PlayServicesResolver.<PollBundleId>m__36 () (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:1370)
GooglePlayServices.PlayServicesResolver+PropertyPoller`1[T].Poll (System.Func`1[TResult] getCurrentValue, GooglePlayServices.PlayServicesResolver+PropertyPoller`1+Changed[T] changed) (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:343)
GooglePlayServices.PlayServicesResolver.PollBundleId () (at /Users/chkuang/Workspace/Git/unity-jar-resolver/source/AndroidResolver/src/PlayServicesResolver.cs:1370)
UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <86784050fcd345038b967d1b887020c3>:0)```

OleDB in Pythonnet and Mono on Mac OS X

I am trying to run several method of a dll library that I own. I use pythonnet 3.0.0dev, python3.9 and Mono 6.10.0. One of the methods triggers creating an .mdb file. On a windows machine I've install Microsoft Access Database Engine (suggested by the dll provider) and I could run my script without any problem. However, doing the same on a Mac OS X triggers the following error:
NotImplementedException: OleDb is not implemented.
at System.Data.OleDb.OleDbConnection..ctor () [0x0000b] in <bd12f551d3b343c5a146c906291931e8>:0
at (wrapper remoting-invoke-with-check) System.Data.OleDb.OleDbConnection..ctor()
at Csu.Modsim.NetworkUtils.DBUtil.OpenDBConnection () [0x0000b] in <1c83b754d09149ce95a722be79ca7efb>:0
at Csu.Modsim.NetworkUtils.DBUtil.Create (System.Boolean Overwrite, System.Boolean LeaveOpen) [0x00026] in <1c83b754d09149ce95a722be79ca7efb>:0
at Csu.Modsim.NetworkUtils.ModelOutputMSDB.InitializeOutput () [0x000a6] in <1c83b754d09149ce95a722be79ca7efb>:0
at Csu.Modsim.NetworkUtils.ModelOutputSupport.FlushOutputToCSV (Csu.Modsim.ModsimModel.Model mi, System.Boolean finalizeOutput) [0x0030d] in <1c83b754d09149ce95a722be79ca7efb>:0
at Csu.Modsim.ModsimModel.GlobalMembersOperate.operate (Csu.Modsim.ModsimModel.Model mi, Csu.Modsim.ModsimModel.Model mi2) [0x012ab] in <6f164bf9bd4744b9a0c1e4daaabc0e8a>:0
at Csu.Modsim.ModsimModel.Modsim.RunSolver (Csu.Modsim.ModsimModel.Model mi) [0x002f7] in <6f164bf9bd4744b9a0c1e4daaabc0e8a>:0
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <55adae4546cd485ba70e2948332ebe8c>:0
What could be a possible solution to this problem. All my installed components are 64-bit.
Thanks

MissingMethodException in Xamarin.Forms project

I am developing an app using Xamarin.Forms. I have a method which returns all properties of a given object as a string.
public static string GetAllProperties(this object obj)
{
return string.Join(" ", obj
.GetType()
.GetRuntimeProperties()
.Select(prop => prop.GetValue(obj)));
}
It works fine on iOS and UWP, but throws a MissingMethodException on Android when accessing IsTransient property of the given object.
[0:] System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Attempted to access a missing method.
at (wrapper managed-to-native) System.Exception:nIsTransient (int)
at System.Exception.get_IsTransient () [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0004b] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at System.Reflection.MonoProperty.GetValue (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] index, System.Globalization.CultureInfo culture) [0x00038] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at System.Reflection.PropertyInfo.GetValue (System.Object obj) [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
at Fantom.Helpers.Global.GetAllProperties (System.Object obj) [0x00034] in ...
at Fantom.ViewModel.SignUpViewModel+<<FirebaseSignUp>b__20_0>d.MoveNext () [0x00340] in ...
I tried the following with no luck.
Cleaning the solution and restarting Visual Studio.
Changing the .NET framework for the PCL project from 4.5.1 to 4.6 (Project Properties > Library > Targeting > Change...), but even though 4.6 is listed it doesn't let me pick it.
Making sure the latest version of Xamarin NuGet packages are installed on each platform project.
I don't think it would help diagnose the problem, but I have the following NuGet packages installed in the PCL project.
Firebase.Xamarin
Humanizer
Microsoft.Bcl
Microsoft.Bcl.Build
Microsoft.Net.Http
Newtonsoft.Json
PCLAppConfig
PCLStorage
Rx-Core, Rx-Interfaces, Rx-Linq, Rx-Main, Rx-PlatformServices
Xamarin Forms
Platform projects only have the Xamarin packages installed.

UITest failed with : "SetUp : System.InvalidOperationException"

I can't use UITest anymore with my xamarin project since the last update of xamarin on the stable channel with Xcode 8.2.
Everytime, when I launch the test, I have an error : "SetUp : System.InvalidOperationException : Sequence contains no matching element". My test series doesn't change from a long time and works well before...
So I don't know how to correct this problem now...
The stack trace :
at System.Linq.Enumerable.First[TSource] (System.Collections.Generic.IEnumerable1[T] source, System.Func2[T,TResult] predicate) [0x00065] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/System.Core/System/Linq/Enumerable.cs:965
at Xamarin.UITest.iOS.Instruments.GetAutomationTemplatePath () [0x00031] in :0
at Xamarin.UITest.iOS.Instruments.StartInstrumentsInternal (System.String targetApplication, Xamarin.UITest.iOS.iOSRunType runType, System.String deviceId, System.String runLoopPath, Xamarin.UITest.Configuration.AppDataMode appDataMode, System.Predicate`1[T] dropLine) [0x00006] in :0
at Xamarin.UITest.iOS.Instruments.StartInstruments (System.String targetApplication, Xamarin.UITest.iOS.iOSRunType runType, System.String deviceId, Xamarin.UITest.Configuration.AppDataMode appDataMode) [0x00012] in :0
at Xamarin.UITest.iOS.iOSAppLauncher.RunAppInEmulatorInternal (System.String application, Xamarin.UITest.iOS.Instruments instruments, Xamarin.UITest.Shared.Http.HttpClient httpClient, System.Uri deviceUri, Xamarin.UITest.Shared.Artifacts.ArtifactFolder artifactFolder, Xamarin.UITest.Configuration.AppDataMode appDataMode, System.String deviceIdentifier) [0x00095] in :0
at Xamarin.UITest.iOS.iOSAppLauncher.RunAppInEmulator (Xamarin.UITest.Shared.iOS.AppBundle appBundle, Xamarin.UITest.iOS.Instruments instruments, Xamarin.UITest.Shared.Http.HttpClient httpClient, System.Uri deviceUri, Xamarin.UITest.Shared.Artifacts.ArtifactFolder artifactFolder, Xamarin.UITest.Configuration.AppDataMode appDataMode, System.String deviceIdentifier) [0x00099] in :0
at Xamarin.UITest.iOS.iOSAppLauncher.LaunchApp (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration, Xamarin.UITest.Shared.Http.HttpClient httpClient, Xamarin.UITest.TestCloud.TestCloudiOSAppConfiguration testCloudAppConfiguration, Xamarin.UITest.Shared.Http.HttpClient testCloudWsClient) [0x000e4] in :0
at Xamarin.UITest.iOS.iOSApp..ctor (Xamarin.UITest.Configuration.IiOSAppConfiguration appConfiguration) [0x002db] in :0
at Xamarin.UITest.Configuration.iOSAppConfigurator.StartApp (Xamarin.UITest.Configuration.AppDataMode appDataMode) [0x00017] in :0
at Ac.Test.TestV35.BeforeEachTest () [0x00012] in /Users/ShaprAdmin/Documents/ac/Ac.Test/TestV35.cs:17
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00038] in /private/tmp/source-mono-4.6.0/bockbuild-mono-4.6.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/corlib/System.Reflection/MonoMethod.cs:305
Thank you!
try to grab the newest Xcode and
then beside proper NUnit version (2.6.x and proper NUnitTestAdapter 2.1.0)
try do upgrade/downgrade the Xamarin.UITest package to version 2.5.
For me it was not working (with same error) for 2.7 for 2.5 it's ok.
Regards,

Method not found: 'System.Web.Hosting.HostingEnvironment.get_InClientBuildManager'

I'm running ASP.NET MVC 4 application on Linux machine thanks to Mono, my problem is that each time I run it for few seconds instead of displaying page I get following error:
System.MissingMethodException
Method not found: 'System.Web.Hosting.HostingEnvironment.get_InClientBuildManager'.
Description:
HTTP 500.Error processing request.
Details:
Non-web exception. Exception origin (name of application or object): mscorlib.
Exception stack trace:
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
Version Information(server is xsp):
3.2.8 (Debian 3.2.8+dfsg-4ubuntu1); ASP.NET Version: 4.0.30319.17020
Detailed info:
[System.Web.HttpException]: The pre-application start initialization method Run on type WebActivatorEx.ActivationManager threw an exception with the following error message: Exception has been thrown by the target of an invocation. at System.Web.Compilation.BuildManager.CallPreStartMethods () [0x00000] in :0 at System.Web.HttpApplicationFactory.InitType (System.Web.HttpContext context) [0x00000] in :0 [System.Reflection.TargetInvocationException]: Exception has been thrown by the target of an invocation. at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0 at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in :0 at System.Web.Compilation.BuildManager.CallPreStartMethods () [0x00000] in :0 [System.MissingMethodException]: Method not found: 'System.Web.Hosting.HostingEnvironment.get_InClientBuildManager'. at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in :0
As I said, this error is gone shortly after starting application but I'm looking for solution to it. I don't have similiar error on other machine.
Version information(Debian+Nginx+FastCGI):
3.6.1 (master/1910095 Mon Jul 7 12:30:38 CEST 2014); ASP.NET Version: 4.0.30319.17020

Categories

Resources