We have used Azure SDK in our xamarin app.
When we are login using google or Facebook using Azure in our app and then go for the subscription using In app purchase, app is crashing in iOS.
As soon as the In app purchase dialog is open, app is getting crashed.
Also, it is crashing while making subscription for the first time after app install. Then everything is working fine.
Please have a look below detailed error log.
2019-02-08 17:19:59.065 EarnieJr.iOS[4133:1596190] [AppCenterCrashes] ERROR: +[MSWrapperLogger MSWrapperLog:tag:level:]/7 Unhandled Exception:
UIKit.UIKitThreadAccessException: UIKit Consistency error: you are calling a UIKit method that can only be invoked from the UI thread.
at UIKit.UIApplication.EnsureUIThread () [0x00020] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.13/src/Xamarin.iOS/UIKit/UIApplication.cs:89
at UIKit.UIControl.RemoveTarget (Foundation.NSObject target, System.IntPtr sel, UIKit.UIControlEvent events) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.13/src/Xamarin.iOS/UIKit/UIControl.g.cs:235
at UIKit.UIControl.RemoveTarget (System.EventHandler notification, UIKit.UIControlEvent events) [0x00048] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.13/src/Xamarin.iOS/UIKit/UIControl.cs:116
at UIKit.UIControl.remove_TouchUpInside (System.EventHandler value) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.13/src/Xamarin.iOS/UIKit/UIControl.cs:182
at Xamarin.Forms.Platform.iOS.ButtonRenderer.Dispose (System.Boolean disposing) [0x00017] in <55e20ffeeae44e4d8fcf262393127192>:0
at Foundation.NSObject.Finalize () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.13/src/Xamarin.iOS/Foundation/NSObject2.cs:143
2019-02-08 17:19:59.072 EarnieJr.iOS[4133:1596190] [AppCenterCrashes] WARNING: +[MSWrapperLogger MSWrapperLog:tag:level:]/7 Cannot serialize UIKit.UIKitThreadAccessException exception for client side inspection. If you want to have access to the exception in the callbacks, please add a Serializable attribute and a deserialization constructor to the exception class.
2019-02-08 17:19:59.082 EarnieJr.iOS[4133:1596190] Unhandled managed exception:
UIKit Consistency error: you are calling a UIKit method that can only be invoked from the UI thread. (UIKit.UIKitThreadAccessException)
at UIKit.UIApplication.EnsureUIThread () [0x00020] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.13/src/Xamarin.iOS/UIKit/UIApplication.cs:89
at UIKit.UIControl.RemoveTarget (Foundation.NSObject target, System.IntPtr sel, UIKit.UIControlEvent events) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.13/src/Xamarin.iOS/UIKit/UIControl.g.cs:235
at UIKit.UIControl.RemoveTarget (System.EventHandler notification, UIKit.UIControlEvent events) [0x00048] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.13/src/Xamarin.iOS/UIKit/UIControl.cs:116
at UIKit.UIControl.remove_TouchUpInside (System.EventHandler value) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.13/src/Xamarin.iOS/UIKit/UIControl.cs:182
at Xamarin.Forms.Platform.iOS.ButtonRenderer.Dispose (System.Boolean disposing) [0x00017] in <55e20ffeeae44e4d8fcf262393127192>:0
at Foundation.NSObject.Finalize () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.13/src/Xamarin.iOS/Foundation/NSObject2.cs:143
Version details are as below for used packages,
"Microsoft.Azure.Mobile.Client" Version="4.1.1"
"Plugin.InAppBilling" Version="2.0.0"
"Xamarin.Forms" Version="3.5.0.129452"
var billing = CrossInAppBilling.Current;
var purchase = await billing.PurchaseAsync("ProductId here", ItemType.Subscription, "devId");
Related
I have an Azure (durable) function that is using the new Runtime Version 3 which is supposed to generate a PDF using IronPDF from a URL. The function keeps failing and the only error that gets logged to Insights is something like this:
Exception: Exception while executing function: A_GetPdfDataFromUrl
Type: Microsoft.Azure.WebJobs.Host.FunctionInvocationException
Stack Trace
Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: A_GetPdfDataFromUrl
---> System.Exception: Error while generating PDF from 'https://www.myurl.com'
at .(String , CefRenderSettings , CefBrowserSettings )
at .RenderPdfDocumentFromUri(ChromePdfRenderOptions Options, ChromeHttpLoginCredentials Login, Uri url)
at IronPdf.Rendering.Abstractions.PdfRenderProxy'2.RenderUrlAsPdf(Uri Url)
at IronPdf.Rendering.Abstractions.PdfRenderProxy'2.RenderUrlAsPdf(String UrlOrPath)
at IronPdf.Rendering.Abstractions.PdfRenderProxy'2.<>c__DisplayClass19_0.b__0()
at System.Threading.Tasks.Task'1.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
at MyFuncs.PdfFunc.GetPdfDataFromUrl(String url) in D:\a\1\s\Funcs\PdfFunc.cs:line 155
at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker'2.InvokeAsync(Object instance, Object[] arguments) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionInvoker.cs:line 52
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.InvokeWithTimeoutAsync(IFunctionInvoker invoker, ParameterHelper parameterHelper, CancellationTokenSource timeoutTokenSource, CancellationTokenSource functionCancellationTokenSource, Boolean throwOnTimeout, TimeSpan timerInterval, IFunctionInstance instance) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 572
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstanceEx instance, ParameterHelper parameterHelper, ILogger logger, CancellationTokenSource functionCancellationTokenSource) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 518
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(IFunctionInstanceEx instance, FunctionStartedMessage message, FunctionInstanceLogEntry instanceLogEntry, ParameterHelper parameterHelper, ILogger logger, CancellationToken cancellationToken) in C:\projects\azure-webjobs-sdk-rqm4t\src\Microsoft.Azure.WebJobs.Host\Executors\FunctionExecutor.cs:line 296
Unfortunately, IronPDF logs dont get generated in Azure due to a bug in their current version which they said will be fixed in the next release. So until then I'm unable to figure out why this simple code is failing in Azure.
[FunctionName("A_GetPdfDataFromUrl")]
public async Task<byte[]> GetPdfDataFromUrl([ActivityTrigger] string url)
{
IronPdf.License.LicenseKey = "";
IronPdf.Logging.Logger.EnableDebugging = true;
IronPdf.Logging.Logger.LoggingMode = IronPdf.Logging.Logger.LoggingModes.All;
ChromePdfRenderer chromePdfRenderer = new ChromePdfRenderer();
var trackReportPdf = chromePdfRenderer.RenderUrlAsPdf(url);
return trackReportPdf.BinaryData;
}
Thank you darren. Posting your suggestions as an answer to help other community members.
The logs will be generated in Azure where all the logs will be stored in a container called $logs. The container $logs is automatically generated when the storage account is created.
All logs are stored in block blobs in a container named $logs.
This is automatically created when Storage Analytics is enabled for a storage account.
The $logs container is located in the blob namespace of the storage account
To answer your question Raihan-Iqbal
Do you mean the storage account that is assigned to the azure function
Yes the storage account that creates when we create Azure Function or it may be any of the storage account the $logs container will be generated automatically.
For further details see Iron Log Files.
I created a small mobile app using Xamarin.Forms This app use Cosmos DB (Azure Database). I need to know if it is possible to use Microsoft.Azure.Cosmos (Nuget) in Xamarin.forms. If it is possible, can you help me to figure out what I am doing wrong.
I used the Microsoft.Azure.DocumentDB.Core(v2.51)
https://www.nuget.org/packages/Microsoft.Azure.DocumentDB.Core/). This is under azure-cosmos-dotnet-v2. Everything works OK.
Today, I am trying to update to Microsoft.Azure.Cosmos (v3.10) https://www.nuget.org/packages/Microsoft.Azure.Cosmos/. This is under azure-cosmos-dotnet-v3. But as soon i hit the line CreateItemAsync, the system fail.
CosmosClient client = new CosmosClient(CosmosEndpointUrl, CosmosAuthKey);
AccountProperties ap= await client.ReadAccountAsync(); // Check connection... It is OK
Database db = client.GetDatabase("MyDatabase");//My Database name is OK,
DatabaseResponse dbresponse= await db.ReadAsync();///Fail
Container container = client.GetContainer("MyDatabase", "MyCollection");
dynamic testItem = new { id = "1234", userId = "2222", details = "it's working" };
ItemResponse<dynamic> response = await container.CreateItemAsync<dynamic>(testItem); /// Fail...
[0:] DocDBTrace Error: 0 :
[0:] Operation will NOT be retried. Current attempt 0, Exception: System.NotSupportedException: Linked Away
at System.Runtime.Remoting.Messaging.CallContext.LogicalGetData (System.String ) [0x00005] in <4b124141b7914f4d8253001e6b8a15cf>:0
at System.Diagnostics.CorrelationManager.get_ActivityId () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.110/src/Xamarin.iOS/mcs/class/referencesource/System/compmod/system/diagnostics/CorrelationManager.cs:23
at Microsoft.Azure.Cosmos.ActivityScope..ctor (System.Guid activityId) [0x0000c] in <36733228c2e04bedaa8ccf505865c0ea>:0
at Microsoft.Azure.Cosmos.Routing.ClientCollectionCache.ReadCollectionAsync (System.String collectionLink, System.Threading.CancellationToken cancellationToken, Microsoft.Azure.Cosmos.IDocumentClientRetryPolicy retryPolicyInstance) [0x000b8] in <36733228c2e04bedaa8ccf505865c0ea>:0
at Microsoft.Azure.Documents.BackoffRetryUtility`1[T].ExecuteRetryAsync (System.Func`1[TResult] callbackMethod, System.Func`3[T1,T2,TResult] callShouldRetry, System.Func`1[TResult] inBackoffAlternateCallbackMethod, System.TimeSpan minBackoffForInBackoffCallback, System.Threading.CancellationToken cancellationToken, System.Action`1[T] preRetryCallback) [0x0008c] in <5ffe0b54a2fb4f58adef177e11a3d996>:0
**System.NotSupportedException:** 'Linked Away'
EDIT: I add some checkpoint, and looks like the connection is OK (CosmosClient), however the database is not connected properly.
I have a WebAPI in .NET Core 2.1 e I have using the RestSharp to access the API. When I send a request (POST), I always receive the below message in the response:
{System.Net.WebException: Error getting response stream (ReadAsync): ReceiveFailure Value cannot be null.Parameter name: src ---> System.ArgumentNullException: Value cannot be null.Parameter name: src at System.Net.HttpWebRequest+d__2411[T].MoveNext () [0x000ba] in <b78695579ed9422b8bc80218eeda782c>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Net.WebResponseStream+d__48.MoveNext () [0x00253] in :0 --- End of inner exception stack trace --- at System.Net.WebConnectionStream.Read (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x00077] in :0 at RestSharp.Extensions.MiscExtensions.ReadAsBytes (System.IO.Stream input) [0x0001f] in <4b0c1fc6e5a94482990701acc6dec8b3>:0 at RestSharp.Http.ProcessResponseStream (System.IO.Stream webResponseStream, RestSharp.HttpResponse response) [0x0000e] in <4b0c1fc6e5a94482990701acc6dec8b3>:0 at RestSharp.Http.ExtractResponseData (RestSharp.HttpResponse response, System.Net.HttpWebResponse webResponse) [0x0004c] in <4b0c1fc6e5a94482990701acc6dec8b3>:0 at RestSharp.Http+<>c__DisplayClass20_0.b__0 (System.Net.HttpWebResponse webResponse) [0x00001] in <4b0c1fc6e5a94482990701acc6dec8b3>:0 at RestSharp.Http.GetRawResponseAsync (System.IAsyncResult result, System.Action1[T] callback) [0x00050] in <4b0c1fc6e5a94482990701acc6dec8b3>:0 at RestSharp.Http.ResponseCallback (System.IAsyncResult result, System.Action1[T] callback) [0x0005a] in <4b0c1fc6e5a94482990701acc6dec8b3>:0 }
The previous version of my service (.NET Framework 4.7) was working, but my new version is not. I checked the URL and that is okay, and the service is working on Swagger and Postman, and I have the SSL certificate configured on the server, but in the App I continue receiving such message.
My service is hosted on Microsoft Azure.
Does anyone any idea to help me?
Ok. I resolved.
I had the below code:
IRestRequest request = new RestRequest(method, Method.POST);
request.AddParameter("SampleKey", "SampleValue");
I don´t know why it was working with a .Net Framework WebApi, but is not working with a .Net Core WebApi.
I could resolve using the below code:
IRestRequest request = new RestRequest(method, Method.POST);
request.AddJsonBody(objBody);
With the new method, the RestSharp is responsible to serialize my object.
It's working right now.
We're using 3.4.3 of ImageResizer, and the elite plugins. It seems any trouble we’ve had have been related to the Faces plugin. Images will not show up, and upon looking at the network response, the stacktrace shows "Delegates cannot be marshaled from native code into a domain other than their home domain". Full trace is here
[NotSupportedException: Delegates cannot be marshaled from native code into a domain other than their home domain.]
System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointerInternal(IntPtr ptr, Type t) +0
System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointer(IntPtr ptr, Type t) +267
OpenCvSharp.CvInvoke..cctor() +328
[TypeInitializationException: The type initializer for 'OpenCvSharp.CvInvoke' threw an exception.]
OpenCvSharp.Cv.Load(String filename, CvMemStorage memstorage, String name, String& real_name) +222
ImageResizer.Plugins.Faces.FeatureDetectionBase`1.LoadFiles() +621
ImageResizer.Plugins.Faces.FeatureDetectionBase`1.DetectFeatures(Bitmap b) +82
ImageResizer.Plugins.Faces.FacesPlugin.PostPrepareSourceBitmap(ImageState s) +341
ImageResizer.Resizing.AbstractImageProcessor.PostPrepareSourceBitmap(ImageState s) +99
ImageResizer.ImageBuilder.Process(ImageState s) +60
ImageResizer.ImageBuilder.buildToBitmap(Bitmap source, ResizeSettings settings, Boolean transparencySupported) +276
ImageResizer.ImageBuilder.buildToStream(Bitmap source, Stream dest, ResizeSettings settings) +149
ImageResizer.ImageBuilder.BuildJob(ImageJob job) +1353
ImageResizer.ImageBuilder.Build(ImageJob job) +268
ImageResizer.ImageBuilder.Build(Object source, Object dest, ResizeSettings settings, Boolean disposeSource, Boolean addFileExtension) +124
ImageResizer.ImageBuilder.Build(Object source, Object dest, ResizeSettings settings, Boolean disposeSource) +36
ImageResizer.ImageBuilder.Build(Object source, Object dest, ResizeSettings settings) +23
ImageResizer.<>c__DisplayClass3.<HandleRequest>b__2(Stream stream) +287
ImageResizer.Plugins.DiskCache.<>c__DisplayClasse.<TryWriteFile>b__d() +593
ImageResizer.Plugins.DiskCache.LockProvider.TryExecute(String key, Int32 timeoutMs, LockCallback success) +424
ImageResizer.Plugins.DiskCache.CustomDiskCache.TryWriteFile(CacheResult result, String physicalPath, String relativePath, ResizeImageDelegate writeCallback, DateTime sourceModifiedUtc, Int32 timeoutMs, Boolean recheckFS) +517
ImageResizer.Plugins.DiskCache.CustomDiskCache.GetCachedFile(String keyBasis, String extension, ResizeImageDelegate writeCallback, DateTime sourceModifiedUtc, Int32 timeoutMs, Boolean asynchronous) +819
ImageResizer.Plugins.DiskCache.DiskCache.Process(IResponseArgs e) +209
ImageResizer.Plugins.DiskCache.DiskCache.Process(HttpContext context, IResponseArgs e) +47
ImageResizer.InterceptModule.HandleRequest(HttpContext context, String virtualPath, NameValueCollection queryString, IVirtualFile vf) +1687
ImageResizer.InterceptModule.CheckRequest_PostAuthorizeRequest(Object sender, EventArgs e) +1163
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165
I found this page and ensured we weren't using overlapped recycling. I tried upgrading to 4.1.7, but it was a bit of a nightmare trying to get all the opencv versions/bitness to line up. The app would crash often and hold the rest of the sites depending on it hostage, so we rolled back to 3.4.3 which at least works, then doesn't. Our regular issues go away temporarily when we restart the IR app pool.
We have our web apps hosted on two VMS load-balanced by BigIP. Each VM has two web apps, and they share a single image resizer hosted on the same server as them which and utilizes the URL API to make resize requests, face detection + cropping, etc.
One other bit of info I was able to obtain was from DebugDiag. I grabbed a crash of the app with the following message:
In w3wp__ImageResizer__PID__5284__Date__06_14_2017__Time_08_23_10AM__122__First chance exception 0XE0434352.dmp the assembly instruction at KERNELBASE!RaiseException in C:\Windows\System32\KERNELBASE.dll from Microsoft Corporation has caused a CLR Exception on thread 28 with the following error information:
Type: ImageResizer.Plugins.Faces.AlternateResponseException
Message: Resizing was canceled as JSON data was requested instead
This exception originated from ImageResizer.Plugins.Faces.FacesPlugin.Render(ImageResizer.Resizing.ImageState).
Debug page can be found here
When ever I install the security Patch KB2742595 on my web server I'm start getting the " Exception type: InvalidProgramException
Exception message: Common Language Runtime detected an invalid program.
at System.ServiceModel.Dispatcher.ClientRuntime..ctor(String contractName, String contractNamespace)"
Stack trace: at System.ServiceModel.Dispatcher.ClientRuntime..ctor(String contractName, String contractNamespace)
at System.ServiceModel.Description.DispatcherBuilder.BuildProxyBehavior(ServiceEndpoint serviceEndpoint, BindingParameterCollection& parameters)
at System.ServiceModel.Channels.ServiceChannelFactory.BuildChannelFactory(ServiceEndpoint serviceEndpoint, Boolean useActiveAutoClose)
at System.ServiceModel.ChannelFactory.CreateFactory()
at System.ServiceModel.ChannelFactory.OnOpening()
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open()
The configuration is W Server 2K8 SP1 and communicating the WCF service over nettcp.
Please help.