jueves, 12 de marzo de 2020

Problema al llamar a Get Method of a Rest API en la web en mi código Xamarin.Forms

 System.NullReferenceException: Object reference not set to an instance of an object.


Estoy tratando de consumir un método Get de un WebAPI aleatorio en la Web a través de mi Xamarin.Formscódigo. Pero no puedo llamar a esa API.

Codigo Inicial


  private HttpClient httpClient;  

  public async Task<List<User>> GetUsersGroup(string group)

        {          
            List<User> users1 = new List<User>();

            var url = $"{Config.RoomsEndPoint}/{group}";
            var result = await httpClient.GetStringAsync(url);
            users1 = JsonConvert.DeserializeObject<List<User>>(result);
            return users1;


        }

Solucion


private HttpClient httpClient; 

public async Task<List<User>> GetUsersGroup(string group)
        {
            if (httpClient == null)
            {
                httpClient = new HttpClient();
            }
            List<User> users1 = new List<User>();

            var url = $"{Config.RoomsEndPoint}/{group}";
            var result = await httpClient.GetStringAsync(url);
            users1 = JsonConvert.DeserializeObject<List<User>>(result);
            return users1;


        }

function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method

The 'AddToGroup' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'AddToGroup'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'signalRGroupActions' to type IAsyncCollector`1. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
[12/03/2020 03:01:23 p. m.] The 'Messages' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'Messages'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'signalRMessages' to type IAsyncCollector`1. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
[12/03/2020 03:01:23 p. m.] The 'negotiate' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'negotiate'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'signalRConnectionInfo' to type SignalRConnectionInfo. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
[12/03/2020 03:01:23 p. m.] The 'RemoveFromGroup' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'RemoveFromGroup'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'signalRGroupActions' to type IAsyncCollector`1. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
[12/03/2020 03:01:23 p. m.] The 'User' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'User'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'userTable' to type CloudTable. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
[12/03/2020 03:01:23 p. m.] The 'Users' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'Users'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'usersTable' to type CloudTable. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
Hosting environment: Production
Content root path: C:\DevProjects\OrdenesTrabajo\Mobile\Trino\ChatTrino.Function\bin\Debug\netcoreapp2.1


Solución 


Pude solucionar este problema agregando el paquete NuGet
Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator

martes, 10 de marzo de 2020

The $(TargetFrameworkVersion) for Trino.Android (v8.1) is less than the minimum required $(TargetFrameworkVersion) for Xamarin.Forms (9.0). You need to increase the $(TargetFrameworkVersion)

Severity Code Description Project File Line Suppression State
Error The $(TargetFrameworkVersion) for Trino.Android (v8.1) is less than the minimum required $(TargetFrameworkVersion) for Xamarin.Forms (9.0). You need to increase the $(TargetFrameworkVersion) for Trino.Android. Trino.Android



Tuve un problema similar resuelto siguiendo los pasos
1. Vaya a C: \ Archivos de programa (x86) \ Android \ android-sdk
2. ejecute SDK Manager.exe.
3. Haga clic en Actualizar los paquetes. (Descargará las actualizaciones necesarias)
4. Vaya a Propiedades de la aplicación
5. Configure la versión de Android de destino (6 o 7 según el error).

lunes, 9 de marzo de 2020

Error: unexpected element found in XAMARIN

De repente recibo este error de compilación en VS 2019 pero no en VS 2017 cuando construyo mi proyecto de Android:
unexpected element <receiver> found in <manifest>
Solución:

entrar a las opciones del proyecto android y marcar la propiedad Use Incremental Android packaging system (aapt2)



Despues compilar
volver a entrar a esa opcion y desmarcar.




Compilar, y ya no debe marcar ese error.

jueves, 5 de marzo de 2020

SQL Server sp_refreshview para actualizar la definición de vista

Si la definición SQL de una vista en SQL Server está desactualizada debido a que los objetos dependientes han sido alterados , es necesario actualizar la definición de la vista usando procedimiento del sistema sp_refresh SQL Server.

Si los administradores de la base de datos de SQL Server o los desarrolladores de Transact-SQL han creado objetos de la Vista SQL que no están delimitados por esquemas, si el objeto de la base de datos dependiente ( tabla , vista o función) de la vista SQL cambia, la definición de la vista SQL Server también debería ser actualizado.

La sintaxis sql del procedimiento almacenado sp_refreshview SQL Server es la siguiente:


EXECUTE sp_refreshview [ @viewname = ] 'viewname' -- sp_refreshview syntax
Execute sp_refreshview 'MySampleSQLView' -- as an example