I am trying to integrate device calendar into my Xamarin Forms application, however, in Windows 10 Mobile facing some serious issues! On the platform specific project for UWP I call the following native API:
var store = await Windows.ApplicationModel.Appointments.AppointmentManager.RequestStoreAsync(Windows.ApplicationModel.Appointments.AppointmentStoreAccessType.AppCalendarsReadWrite);
After calling the API, platform specific project throws this exception:
The message filter indicated that the application is busy.
A COM call (IID: {638BB2DB-451D-4661-B099-414F34FFB9F1}, method index: 6) to an ASTA (thread 9840) appears deadlocked and was timed out.
I guess it has something to do with multi-threading and application domain! considering that I have given the calendar permission to the app, anyone has faced similar error ever before?
My Development Environment
Microsoft Visual Studio Community 2017
Version 15.1 (26403.7) Release
VisualStudio.15.Release/15.1.0+26403.7
Microsoft .NET Framework Version 4.7.02046
Visual Studio Tools for Universal Windows Apps 15.0.26403.07
Xamarin 4.4.0.34 (3f99c5a)
I have checked your project and reproduced the issue. You could solve the issue by replacing .Result with await keyword.
Although async programming is relatively straightforward, there are some details to keep in mind which can prevent unexpected behavior.
async methods need to have an await keyword in their body or they will never yield!
This is important to keep in mind. If await is not used in the body of an async method, the C# compiler will generate a warning, but the code will compile and run as if it were a normal method. Note that this would also be incredibly inefficient, as the state machine generated by the C# compiler for the async method would not be accomplishing anything.
For more detail please refer to Asynchronous programming.
It is not recommend doing more logic code in the property's get method. So you could get your CalendarEvents in OnAppearing method just like following code.
protected async override void OnAppearing()
{
base.OnAppearing();
var events = await DependencyService.Get<ICalendar>(DependencyFetchTarget.GlobalInstance).GetEventsAsync();
}
Related
Google cloud print android implementation available in https://developers.google.com/cloud-print/docs/android
Google cloud print c# implementation available in Google Cloud Print using C#
The above methods does not work on windows phone 8.1. Please help.
I recommend that you create a console application and get the code working on that app to verify that, yes the code, works as expected. The failure exhibited may be due to factors outside of the phone's code.
Once satisfied that one is getting the proper results, port the code over to Windows Phone.
Keep in mind that the CLR used by console applications is different from the Silverlight CLR so some methods may not be available. So one may have to find alternates to the missing or incorrect functions.
I know silverlight is outdated and Microsoft it self has shutdown further development on it. However I came across one strange & security issue.
Understand the following scenario: I have my silverlight application up & running on hosted server and there are approx 500 user who are using it same time with application version around 192.3XXXX.
Later on I have developed some crucial business functionality and released application on server with version around 192.4XXXX. Next day all 500 user are working on application version 192.4XXXX. and on same day I found that I have made some serious mistake & I have to fix it as soon as possible. so I have applied the fix and released the Application on server with version around 192.5XXXX.
Now here come my Question. How can I enforce this 500 user to use 192.5XXXX at same time. I can not tell each user to reload the app and some of may misuse the application's functionality (as earlier mention, some serious mistake I made in code like showing confrontational data on some form etc. )
How to overcome such situation? Or something like that I can manage from server to force client reload app and download new version.
Thank Your All,
I came up with wonderful solution. I have created one signalR hub and I am broadcasting the message to all connected client to reload the application.
Let me know if anyone want detail description.
I'm using MSpec to drive some automated UI tests using Selenium WebDriver. Much like the examples I found online. I'm having problems getting it to take screenshot when the test fails.
I saw a comment on another issue where it works because they have a ResultSupplementer in the sample web specs. However, ResultSupplementer does not seem to exist in the latest version of Mspec (0.9.1).
Is there a different way to do this in the latest version of mspec? Ultimately, I'm going to generate HTML reports as TeamCity artifacts and include the screenshot on any failing specs.
I've updated the samples for the latest version of MSpec (in short, you need to implement ISupplementSpecificationResults yourself).
I've also merged the solutions and converted the MVC project to Nancy. You'll find that there's a bit more infrastructure-related code that grew over the last couple of years and works around various things, like
status codes 4xx and 5xx logged by IIS Express
IIS and Chrome Driver ports bound by other processes
page objects access the web driver with a high-level API
I use Paket for dependency management because it's far more powerful than plain NuGet
All that said, you need to run msbuild.exe mspec-samples.sln and then All-Specs.cmd. I've also checked that a TeamCity build creates screenshots.
What ORM's support async operations and postgresql ?
I prefer simple MicroOrms like Dapper and OrmLite because they seems to have great performance and they are really simple, but they do not support async operations as far as I can tell.
Maybe I am wrong, but isn't important to make all IO bound operations async to get the full benefits of say an async web service that needs to scale?
So what are the options regarding an MicroOrm with support for both async operations and Postgresql? I have just read about a new Orm called Insight.Data, but I am unsure whether it properly supports PostgreSql.
If you are using .NET 4.5, I wrote a fork of Dapper that adds async methods that internally call ExecuteReaderAsync. It is also available on NuGet. I haven't tested it with Postgresql but if Dapper works with it then my fork should as well.
Just stumbled upon this new ORM called Insight.Database and they claim to support async queries:
List<Beer> beerMenu = await Database1.AsyncQuery<Beer>("FindBeer", new { Name = "Sly Fox" });
I did not try it yet...
Telerik's free OpenAccess ORM supports PostgeSQL, but I can't see anything mentioned about async. Maybe you could contact them, their online support is pretty good.
Insight.Database has full async support and works with any .NET SqlProvider. I haven't specifically tested it on postgres, but if you post an issue on the github site, I'd gladly incorporate postgres into the test suite.
https://github.com/jonwagner/Insight.Database
EDIT: Insight v3.0 and later supports most databases.
AsyncPoco, a fork of PetaPoco, supports asynchronous operations (exclusively) and PostgeSQL.
Dapper has had async support for some time, but only when targeting .NET 4.5. I could probably back-port to 4.0 using the BCL async targeting pack, but to date: I have not done so.
AFAIK the only RDBMS which natively supports asynchronous executions, provider side and server side (not fake ones like wrapping a call with a Task.Run()) on its reader, is SQL Server. You can see this by decompiling the specific ADO.NET data provider. The default implementation of ExecuteReaderAsync calls internally the synchronous one, if not overridden. Please double check by decompiling the specific ADO.NET provider because you may end up in doing database operations in the UI thread when using async and await.
I have a class library which is a set of helper classes to develop windows phone 7 applications.
One of core helper classes I have in this library is responsible to provide location service functionalities, so it uses ILocationWatcher and references to System.Device.
Now the problem is even if I don't use this helper class (i.e. LocationWatcher will never be started) after submitting the app in marketplace, it shows "Location services" as one of capabilities my app is using.
I believe the way marketplace detects this, is more or less analysing all codes and libraries within the project.
How can we somehow override this behaviour?
Capabilites are detected using static analysis when your xap is submitted to the marketplace.
The location capabiltiy is reported if you reference the assembly System.Device and use the namespace System.Device.Location.
All assemblies in your XAP are analysed. Even ones you get from 3rd parties.
If you don't want the capability to be reported in the marketplace then remove the references which triggers its detection.
You may want to consider how you structure your shared/common libraries/code with this in mind.
You can check your used capabilities with the free capability detection tool supplied with the second Mango SDK beta. If you use location without defining it at the WMAppManifest.xml, the user will get a "Access denied" message and your app will throw an UnauthorizedAccessException. Afaik there is no possible way to circumvent this behaviour. It is meant as a security feature to warn users before they install a app so they can check on marketplace what features the application will want to use.
I don't believe it is analyzing the code. Rather it is using the manifest's Capabilities section to determine what is required. You can learn more about that section here:
http://msdn.microsoft.com/en-us/library/ff769509(v=vs.92).aspx#BKMK_Capabilities
Does the application's manifest include ID_CAP_LOCATION? If it does, and you aren't using it - it can safely be removed.