xamarin / azure-mobile-services Goto Github PK
View Code? Open in Web Editor NEWThis project forked from azure/azure-mobile-services
License: Apache License 2.0
This project forked from azure/azure-mobile-services
License: Apache License 2.0
I have tested this with FORBIDDEN and INTERNAL SERVER ERROR.
The task doesnt ever have its status set as Faulted, which makes it hard to track server failures on delete.
The test project compiles properly and runs on simulator but fails to compile for device.
The error message obtained is:
ZumoQuery.Test.cs:29 - The type or namespace "MobileServiceTableQueryDescription" could not be found.
This is despite the fact that the type is clearly available in the referenced assembly Microsoft.Azure.Zumo.iOS and despite the facts that the IDE sees and can navigate to the type and the same code compiles properly for the simulator.
On MonoTouch (and I'd expect on other platforms as well) the library can't deserialize JsonArrays (even if they are ignored) and throws an exception instead.
Steps to reproduce
function read(query, user, request) {
request.execute({
success : function(results) {
for(var i=0; i<results.length; i++) results[i].ThisIsAnArrayProperty = [1,2,3];
request.respond(statusCodes.OK, results);
}
});
}
What happens
app crashes with System.InvalidCastException: Unable to cast object of type 'Windows.Data.Json.JsonArray' to type 'Windows.Data.Json.JsonValue'.
on azure-mobile-services-master/sdk/xamarin/android/src/Microsoft.Azure.Zumo.Android/Windows.Data.Json/JsonObject.cs:56 (public JsonValue GetNamedValue (string name))
What should happen
the array property should be deserialized into a JsonArray.
Possible fix (worked for me)
Change return type of the GetNamedValue method to a more general IJsonValue and propagate the type change across all usages - worked for me and didn't seem to break anything.
From:
public JsonValue GetNamedValue (string name)
{
return (JsonValue)this[name];
}
To:
public IJsonValue GetNamedValue (string name)
{
return (IJsonValue)this[name];
}
I tried to implement a simple DelegatingHandler, but in the current set of MobileServiceClient() constructors, passing a DelegatingHandler subclass is not possible. Can you add this, or am I possibly missing something?
This repository has had no activity in more than [x amount of time]. Long periods of inactivity present security and code hygiene risks. Archiving will not prevent users from viewing or forking the code. A banner will appear on the repository alerting users that the repository is archived.
Please see https://aka.ms/sunsetting-faq to learn more about this process.
✍️
❗**If this repository is still actively maintained, please simply close this issue. Closing an issue on a repository is considered activity and the repository will not be archived.🔒
If you take no action, this repository is still inactive 30 days from today it will be automatically archived..
MobileServiceClient.LoginInProgress property is not being set to false upon completion. I was able to modify the code locally to get it to work properly for my application. The code I added is marked below with //added this line
in MobileServiceClient.Android.cs
internal Task<MobileServiceUser> SendLoginAsync(Context context, MobileServiceAuthenticationProvider provider, JsonObject token = null)
{
if (this.LoginInProgress)
{
throw new InvalidOperationException(Resources.MobileServiceClient_Login_In_Progress);
}
if (!Enum.IsDefined(typeof(MobileServiceAuthenticationProvider), provider))
{
throw new ArgumentOutOfRangeException("provider");
}
string providerName = provider.ToString().ToLower();
this.LoginInProgress = true;
TaskCompletionSource<MobileServiceUser> tcs = new TaskCompletionSource<MobileServiceUser> ();
if (token != null)
{
// Invoke the POST endpoint to exchange provider-specific token for a Windows Azure Mobile Services token
this.RequestAsync("POST", LoginAsyncUriFragment + "/" + providerName, token)
.ContinueWith (t =>
{
if (t.IsCanceled)
tcs.SetCanceled();
else if (t.IsFaulted)
tcs.SetException (t.Exception.InnerExceptions);
else
{
SetupCurrentUser (t.Result);
tcs.SetResult (this.CurrentUser);
}
this.LoginInProgress = false; //added this line
});
}
else
{
// Launch server side OAuth flow using the GET endpoint
Uri startUri = new Uri(this.ApplicationUri, LoginAsyncUriFragment + "/" + providerName);
Uri endUri = new Uri(this.ApplicationUri, LoginAsyncDoneUriFragment);
WebRedirectAuthenticator auth = new WebRedirectAuthenticator (startUri, endUri);
auth.Error += (o, e) =>
{
Exception ex = e.Exception ?? new Exception (e.Message);
tcs.TrySetException (ex);
this.LoginInProgress = false; //added this line
};
auth.Completed += (o, e) =>
{
if (!e.IsAuthenticated)
tcs.TrySetCanceled();
else
{
SetupCurrentUser (JsonValue.Parse (e.Account.Properties["token"]));
tcs.TrySetResult (this.CurrentUser);
}
this.LoginInProgress = false; //added this line
};
Intent intent = auth.GetUI (context);
context.StartActivity (intent);
}
return tcs.Task;
}
Hi I can't seem to compile the todo sample soulution, I get this error:
And I also can't find instructions for it
Error 17 Source file 'C:\Users\Nir\Downloads\azure-mobile-services-master\azure-mobile-services-master\sdk\xamarin\libs\Xamarin.Auth\src\Xamarin.Auth.Android\ActivityEx.cs' could not be opened ('Unspecified error ') Microsoft.Azure.Zumo.Android
Error 8 Source file 'C:\Users\Nir\Downloads\azure-mobile-services-master\azure-mobile-services-master\sdk\xamarin\libs\Xamarin.Auth\src\Xamarin.Auth.Android\ActivityStateRepository.cs' could not be opened ('Unspecified error ') Microsoft.Azure.Zumo.Android
Error 1 Source file 'C:\Users\Nir\Downloads\azure-mobile-services-master\azure-mobile-services-master\sdk\xamarin\libs\Xamarin.Auth\src\Xamarin.Auth.Android\AndroidAccountStore.cs' could not be opened ('Unspecified error ') Microsoft.Azure.Zumo.Android
Error 2 Source file 'C:\Users\Nir\Downloads\azure-mobile-services-master\azure-mobile-services-master\sdk\xamarin\libs\Xamarin.Auth\src\Xamarin.Auth.Android\FormAuthenticatorActivity.cs' could not be opened ('Unspecified error ') Microsoft.Azure.Zumo.Android
Error 14 Source file 'C:\Users\Nir\Downloads\azure-mobile-services-master\azure-mobile-services-master\sdk\xamarin\libs\Xamarin.Auth\src\Xamarin.Auth.Android\WebAuthenticatorActivity.cs' could not be opened ('Unspecified error ') Microsoft.Azure.Zumo.Android
Error 5 Source file 'C:\Users\Nir\Downloads\azure-mobile-services-master\azure-mobile-services-master\sdk\xamarin\libs\Xamarin.Auth\src\Xamarin.Auth\Account.cs' could not be opened ('Unspecified error ') Microsoft.Azure.Zumo.Android
Error 15 Source file 'C:\Users\Nir\Downloads\azure-mobile-services-master\azure-mobile-services-master\sdk\xamarin\libs\Xamarin.Auth\src\Xamarin.Auth\AccountStore.cs' could not be opened ('Unspecified error ') Microsoft.Azure.Zumo.Android
Error 3 Source file 'C:\Users\Nir\Downloads\azure-mobile-services-master\azure-mobile-services-master\sdk\xamarin\libs\Xamarin.Auth\src\Xamarin.Auth\Authenticator.cs' could not be opened ('Unspecified error ') Microsoft.Azure.Zumo.Android
Error 6 Source file 'C:\Users\Nir\Downloads\azure-mobile-services-master\azure-mobile-services-master\sdk\xamarin\libs\Xamarin.Auth\src\Xamarin.Auth\AuthException.cs' could not be opened ('Unspecified error ') Microsoft.Azure.Zumo.Android
Error 12 Source file 'C:\Users\Nir\Downloads\azure-mobile-services-master\azure-mobile-services-master\sdk\xamarin\libs\Xamarin.Auth\src\Xamarin.Auth\ExceptionEx.cs' could not be opened ('Unspecified error ') Microsoft.Azure.Zumo.Android
Error 10 Source file 'C:\Users\Nir\Downloads\azure-mobile-services-master\azure-mobile-services-master\sdk\xamarin\libs\Xamarin.Auth\src\Xamarin.Auth\FormAuthenticator.cs' could not be opened ('Unspecified error ') Microsoft.Azure.Zumo.Android
Error 9 Source file 'C:\Users\Nir\Downloads\azure-mobile-services-master\azure-mobile-services-master\sdk\xamarin\libs\Xamarin.Auth\src\Xamarin.Auth\OAuth1.cs' could not be opened ('Unspecified error ') Microsoft.Azure.Zumo.Android
Error 4 Source file 'C:\Users\Nir\Downloads\azure-mobile-services-master\azure-mobile-services-master\sdk\xamarin\libs\Xamarin.Auth\src\Xamarin.Auth\OAuth1Authenticator.cs' could not be opened ('Unspecified error ') Microsoft.Azure.Zumo.Android
Error 13 Source file 'C:\Users\Nir\Downloads\azure-mobile-services-master\azure-mobile-services-master\sdk\xamarin\libs\Xamarin.Auth\src\Xamarin.Auth\OAuth2Authenticator.cs' could not be opened ('Unspecified error ') Microsoft.Azure.Zumo.Android
Error 16 Source file 'C:\Users\Nir\Downloads\azure-mobile-services-master\azure-mobile-services-master\sdk\xamarin\libs\Xamarin.Auth\src\Xamarin.Auth\WebAuthenticator.cs' could not be opened ('Unspecified error ') Microsoft.Azure.Zumo.Android
Error 7 Source file 'C:\Users\Nir\Downloads\azure-mobile-services-master\azure-mobile-services-master\sdk\xamarin\libs\Xamarin.Auth\src\Xamarin.Auth\WebEx.cs' could not be opened ('Unspecified error ') Microsoft.Azure.Zumo.Android
Error 11 Source file 'C:\Users\Nir\Downloads\azure-mobile-services-master\azure-mobile-services-master\sdk\xamarin\libs\Xamarin.Auth\src\Xamarin.Auth\WebRedirectAuthenticator.cs' could not be opened ('Unspecified error ') Microsoft.Azure.Zumo.Android
Compile success but deploy fail with the following warning.
Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file:
Any solution? Is there a bug with GCM as they have change to Firebase Cloud Messaging !
When using the client.LoginAsync(..) method to pop open a web view and have the user authenticate, the auth cookie does not seem to be cached. If you close the app and rerun it and call LoginAsync, the browser will display a credentials prompt for the auth provider again. I've verified this behavior for Microsoft Account, Google and Twitter (haven't tried facebook).
The behavior happens regardless of whether you tick the "remember me" box or not.
If you're creating a custom API in Azure mobile services there's no way with the client to query that API.
It's available in the source repo - https://github.com/WindowsAzure/azure-mobile-services/blob/master/sdk/Managed/src/Microsoft.WindowsAzure.MobileServices/MobileServiceClient.cs#L299 so it'd be great to get this back in sync
At a minimum, we need to be able to set the Title of the iOS and Android screens when authenticating. Since these UIs are actually just Xamarin.Auth under the covers, we should be able to simply facade the webredirectauthenticator's Title property in the MobileServiceClient.
It would also be nice to be able to control the ability to not allow Cancelling the auth flow, which is a feature recently added to Xamarin.Auth.
Hello Team,
I'm using Azure Mobile App with Xamarin.Forms to create an offline capable mobile app.
the synchronization between the server and the SQLlite database is very long.
To display the list of 40,000 articles, the operation takes between 20-21 minutes
async Task InitializeAsync()
{
//Short circuit -local database is already initialized
if (Client.SyncContext.IsInitialized)
{
Debug.WriteLine("InitializeAsync: Short Circuit");
return;
}
// Create a reference to the local sqlite store
Debug.WriteLine("InitializeAsync: Initializing store");
var store = new MobileServiceSQLiteStore(PlatformProvider.GetSyncStore());
// Define the database schema
Debug.WriteLine("InitializeAsync: Defining Datastore");
store.DefineTable<Customer>();
store.DefineTable<Article>();
store.DefineTable<User>();
// Actually create the store and update the schema
Debug.WriteLine("InitializeAsync: Initializing SyncContext");
//await Client.SyncContext.InitializeAsync(store);
// Do the sync
//Debug.WriteLine("InitializeAsync: Syncing Offline Cache");
//await SyncOfflineCacheAsync();
// Actually create the store and update the schema
// Little hack to avoid initializing the SyncContext more than once: We wait for the task to finish
Task.Run(async () => await Client.SyncContext.InitializeAsync(store)).Wait();
}
````
public async Task SyncOfflineCacheAsync<T>(bool overrideServerChanges) where T : TableData
{
Debug.WriteLine("SyncOfflineCacheAsync: Initializing...");
await InitializeAsync();
if (!(await CrossConnectivity.Current.IsRemoteReachable(Client.MobileAppUri.Host, 443)))
{
Debug.WriteLine($"Cannot connect to {Client.MobileAppUri} right now - offline");
return;
}
// Push the Operations Queue to the mobile backend
Debug.WriteLine("SyncOfflineCacheAsync: Pushing Changes");
try
{
await Client.SyncContext.PushAsync();
}
catch (MobileServicePushFailedException ex)
{
if (ex.PushResult != null)
{
foreach (var error in ex.PushResult.Errors)
{
await ResolveConflictAsync<T>(error, overrideServerChanges);
}
}
}
// Pull each sync table
Debug.WriteLine("SyncOfflineCacheAsync: Pulling Customers table");
var customerTable = await GetTableAsync<Customer>();
//await customerTable.PurgeAsync("PurgeQuery", null, true, CancellationToken.None);
await customerTable.PullAsync();
Debug.WriteLine("SyncOfflineCacheAsync: Pulling Artciles table");
var articleTable = await GetTableAsync<Article>();
//await articleTable.PurgeAsync("PurgeQuery", null, true, CancellationToken.None);
await articleTable.PullAsync();
}``
public Command RefreshCommand { get; }
async Task Refresh()
{
if (IsBusy)
return;
IsBusy = true;
try
{
await CloudService.SyncOfflineCacheAsync<Customer>(overrideServerChanges: true);
var table = await CloudService.GetTableAsync<Customer>();
ICollection<Customer> list;
list = await table.ReadItemsOrderedAsync(1,100,o => o.Designation);
var sorted = from item in list
orderby item.Designation
group item by item.Designation.Substring(0, 1).ToUpper() into itemGroup
select new Grouping<string, Customer>(itemGroup.Key, itemGroup);
ItemsGrouped = new ObservableCollection<Grouping<string, Customer>>(sorted);
ItemsCopy = new ObservableCollection<Customer>(list);
}
catch (Exception ex)
{
Debug.WriteLine($"[CustomersList] Error loading items: {ex.Message}");
}
finally
{
IsBusy = false;
}
}
Cordially
Hi,
While trying to package in release mode I am getting the following error:
"
Found conflicts between different versions of the same dependent assembly. In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts; otherwise, add the following binding redirects to the "runtime" node in the application configuration file:
"
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.