Azure IotHub, UWP, DeviceClient.OpenAsync - timeout - windows-10-iot-core

I am trying to connect my UWP app to the Azure IotHub with the code below. I have tried a console app with the same code and it works but not on the UWP app.
I have given all the permissions to the UWP app (internet, and all other after that).
Tried a Get with HttpClient and the internet connection works
I have also tried to use the newest target for the UWP app (Win 10, version 1803)
To connect to the IotHub from my UWP app i am using a nuget package: Microsoft.Azure.Devices.Client v 1.17.1
On the UWP the code stops at await device.OpenAsync() and timeouts after some time
Am i missing something?
The code:
string deviceConnectionString = "<CONNECTION STRING>";
var device = DeviceClient.CreateFromConnectionString(deviceConnectionString);
await device.OpenAsync();
Message bla = new Message(Encoding.ASCII.GetBytes("blablabla"));
await device.SendEventAsync(bla);
UPDATE - FIX
The transport type needs to be defined, guess the default transport type does not work with UWP. When creating the client use this:
var device = DeviceClient.CreateFromConnectionString(deviceConnectionString, TransportType.Amqp_WebSocket_Only);

I have just tested on my RPi3B with your setup such as
compiled for Target version: Win 10, version 1803
Microsoft.Azure.Devices.Client v1.17.1
Microsoft.NETCore.UniversalWindowsPlatform v6.1.7
and the runtime failed (Windows IoT Core 10.0.17723.1000
) with the following error:
Could not load file or assembly 'System.Net.Security, Version=4.0.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
so, the workaround is:
use the Microsoft.Azure.Devices.Client version v1.6.0
after this change my test program Blinky on RPi3B is working.

The latest version client SDK does not work on UWP using AMQP.There is a Github issue#421 here. Please trace this issue. As Roman Kiss mentioned, Microsoft.Azure.Devices.Client version v1.6.0 works fine, you can try to use this version.

Related

upgraded to latest nx workspace, test fail with transform

We are upgrading angular with nx workspace to latest
The problem is when we run test, we got following errors
feature-flag.mjs:93:20: ERROR: Transforming for-await loops to the configured target environment ("es2015") is not supported yet
feature-flag.mjs:184:4: ERROR: Transforming async generator functions to the configured target environment ("es2015") is not supported yet
The feature-flag library was build es2020, and our current App also on es2020 after upgrade.
The app using the feature-flag lib test fails with the error
I am not sure how to fix it
Things I have tried, in the App I have adjust tsconfig, tsconfig.app, tsconfig.spec to es2015 or es2017, but it didn't help.

WebdriverIO - Test fails with error Openfin

I have been trying to setup automation testing for our openfin application using the below repo as base
https://github.com/openfin/webinar-automated-integration-tests
I am using Openfin (Chrome version 61.0.3163.100) and Chromedriver 2.40.565498
When I run "npm test", the openfin application opens up. But the tests don't run. After waiting for sometime, it throws the below error in console.
ERROR: unknown error: DevToolsActivePort file doesn't exist
(Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 10.0.16299 x86_64)
chrome
I tried using other versions of chromedriver like 2.33, 2.34, 2.37, 2.38, 2.39, 2.41. Using these versions even the application doesn't appear. So, I guess the chromedriver version I am using is correct. I have also tried adding the below arguments to chromeOptions
--remote-debugging-port=9222,--no-sandbox,--headless,--disable-gpu
They didn't solve my issue. Not sure what is causing the issue. Any help would be much appreciated. Thanks in advance. Cheers!
This error message...
ERROR: unknown error: DevToolsActivePort file doesn't exist
(Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 10.0.16299 x86_64)
...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You are using chromedriver=2.40
Release Notes of chromedriver=2.40 clearly mentions the following :
Supports Chrome v66-68
Presumably you are using chrome=61.0
Release Notes of ChromeDriver v2.33 clearly mentions the following :
Supports Chrome 60-62
Your Selenium Client version is unknown to us.
So there is a clear mismatch between ChromeDriver v2.40 and the Chrome Browser v60.0
Solution
Ensure that:
Selenium is upgraded to current levels Version 3.141.59.
ChromeDriver is updated to current ChromeDriver v80.0 level.
Chrome is updated to current Chrome Version 80.0 level. (as per ChromeDriver v80.0 release notes)
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your #Test as non-root user.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.

Flutter geolocator package not retrieving location

I've open an issue on the geolocator repository https://github.com/BaseflowIT/flutter-geolocator/issues/199
It entails the geolocator package not retrieving the location. They recently released a new version 3.0.0 and after that the I have had only aftermath.
I am using the correct dependencies:
dependencies:
geolocator: '^3.0.0'
targetSdkVersion 28 and compileSdkVersion 28
Flutter doctor gives me this:
[✓] Flutter (Channel stable, v1.0.0, on Mac OS X 10.14.3 18D109, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
[✓] Android Studio (version 3.2)
[✓] IntelliJ IDEA Community Edition (version 2018.2.5)
[✓] Connected device (1 available)
• No issues found!
Once I call await Geolocator().getCurrentPosition(desiredAccuracy: LocationAccuracy.high); the code just doesn't return anything and I have this output in terminal:
I/DynamiteModule( 4233): Considering local module
com.google.android.gms.maps_dynamite:0 and remote module
com.google.android.gms.maps_dynamite:221 I/DynamiteModule( 4233):
Selected remote version of com.google.android.gms.maps_dynamite,
version >= 221 V/DynamiteModule( 4233): Dynamite loader version >= 2,
using loadModule2NoCrashUtils W/System ( 4233): ClassLoader referenced
unknown path: W/System ( 4233): ClassLoader referenced unknown path:
/data/user_de/0/com.google.android.gms/app_chimera/m/00000030/n/armeabi-v7a
W/System ( 4233): ClassLoader referenced unknown path:
/data/user_de/0/com.google.android.gms/app_chimera/m/00000030/n/armeabi
I/Google Maps Android API( 4233): Google Play services client version:
12451000 I/Google Maps Android API( 4233): Google Play services
package version: 15090018 W/DynamiteModule( 4233): Local module
descriptor class for com.google.android.gms.googlecertificates not
found. I/DynamiteModule( 4233): Considering local module
com.google.android.gms.googlecertificates:0 and remote module
com.google.android.gms.googlecertificates:4 I/DynamiteModule( 4233):
Selected remote version of com.google.android.gms.googlecertificates,
version >= 4 W/System ( 4233): ClassLoader referenced unknown path:
/data/user_de/0/com.google.android.gms/app_chimera/m/0000002f/n/armeabi-v7a
W/System ( 4233): ClassLoader referenced unknown path:
/data/user_de/0/com.goo`gle.android.gms/app_chimera/m/0000002f/n/armeabi
I have spent a considerable amount of time on this. I am new to flutter and know that I may be missing a small thing to make it work.
I was facing the same issue. But my app started running after adding this.
[ Geolocator geolocator = Geolocator()..forceAndroidLocationManager = true; ]
Hope it will work.
Future<void> getCurrentLocation() async {
try {
Geolocator geolocator = Geolocator()..forceAndroidLocationManager = true;
Position position = await Geolocator().getCurrentPosition(
desiredAccuracy: LocationAccuracy.best,
);
return position;
} catch (err) {
print(err.message);
}
}
All the best.
On iOS you'll need to add the following entries to your Info.plist
file (located under ios/Runner) in order to access the device's
location. Simply open your Info.plist file and add the following:
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app needs access to location when open.</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>This app needs access to location when in the background.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>This app needs access to location when open and in the background.</string>
I was facing the same issue now it works, I've just added forceAndroidLocationManager: true to the Geolocator.getCurrentPosition.
Position position = await
Geolocator.getCurrentPosition(forceAndroidLocationManager: true,
desiredAccuracy: LocationAccuracy.lowest);
Hey #wagnerdelima had same challenge and l solved by the following :
Change the targetSdkVersion 28 and compileSdkVersion 28 to targetSdkVersion 27 and compileSdkVersion 27 and change to geolocator: '^3.0.0' to geolocator: ^2.1.1 as below:
dependencies:
flutter:
sdk: flutter
geolocator: ^2.1.1
permission_handler: "2.1.2"
google_api_availability: "1.0.4"
This was as a result of the caret ^, it is taking the google_api_availability latest, which is migrated to android x.
All the best !!
I was struggling with this problem for about 2 days. After that, I figured out this (Mac):
In Simulator iOS did not work anyway;
Connect an iOS real device After open iOS module in XCode as follow
Right-click on folder project
Choose Flutter->Open iOS module in XCode
On XCode, Select TAGETS -> Runner
In Signing & Capabilities:
Set the Team
Change the Bundle Identifier to a unique one (ex.:co.test.app456)
Run your app in XCode (it will work)
Close XCode and go back to your project in Flutter
Select the real iOS device and run your app
I had the same issue i.e it was not returning anything but keep fecthing location so i just changed from this
forceAndroidLocationManager: true
to this
forceAndroidLocationManager: false
Geolocator.getCurrentPosition(
desiredAccuracy: LocationAccuracy.bestForNavigation,
forceAndroidLocationManager: false)
.then((position) {
print(position);
});
Now its working fine. The problem is in new update because in the old package it was working fine
First things first, check the device you are using and your Flutter version.
i had same issue with only one device that is Google's Nexus 6P and Flutter Version 1.9.1+hotfix.6. The problem is with the package "geolocator" because all other devices are working fine.
I recommend new_geolocation. As it resolved the issue for all devices so far.
Secondly, how i used it, the readme file here didnt help, so went through the example project on Github here, used the same methods of this example for exact results.
I hope it will help.
This solution will work, I was facing issue with Android:
Geolocator geoLocator = Geolocator()..forceAndroidLocationManager = true;
Position position = await geoLocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.low);
print(position);
I had the same problem.
I was able to solve it by:
replacing current API key with new one
clearing out all the minor bugs in file, e.g. writing remaining #override functions, adding 'const' and 'final' keywords etc.
Try these,
it might help.
If you are using the iOS Simulator, you need to set the Location different from None in order the getCurrentPosition method returns the position:
I had this problem until I tried to set the accuracy to low. Then it worked. I believe you may need extra permissions for high accuracy location. It's funny only the low accuracy works for me, none of the others. Also, the forceAndroidLocationManager has to be set to false for it to work on my IOS emulator.
This code worked for me:
Geolocator.getCurrentPosition(
desiredAccuracy: LocationAccuracy.low,
forceAndroidLocationManager: false)
.then((currloc) {})

Houdini arm to x86 translation "Unsupported feature" error when using shared STL in Android NDK app

I created an Android Studio project from this sample NDK project provided by Google and changed a couple things so I could try to leverage Houdini arm to x86 translation:
In app/build.gradle I set abiFilters to armeabi-v7a.
In Application.mk I changed APP_ABI from all to armeabi-v7a so that x86 native libraries won't be created.
Also in Application.mk, I changed APP_STL from stlport_static to gnustl_shared.
You can see the modified code in this repo.
Then I ran the app in the BlueStacks emulator, which supports Houdini. I get the following error:
11-21 00:42:19.742 9947-9947/? D/houdini: [9947] Loading library(version: 4.0.8.45720 RELEASE)... successfully.
11-21 00:42:19.742 9947-9947/? D/houdini: [9947] Unsupported feature (ID:0x10600cae).
11-21 00:42:19.742 9947-9947/? D/houdini: [9947] Open Native Library /data/app-lib/com.sample.teapot-2/libTeapotNativeActivity.so failed.
...
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sample.teapot/com.sample.teapot.TeapotNativeActivity}: java.lang.IllegalArgumentException: Unable to load native library: /data/app-lib/com.sample.teapot-2/libTeapotNativeActivity.so
If I make APP_STL any of the supported values with shared I get this error, and with static it works fine. I'd like to get shared working, to solve this issue in React Native. Does shared STL not work with Houdini? Any workarounds?

Works on console project but not on ASP.NET project EF Core with MySql Connector

I have a weird problem here. I'm trying to access a MySql database with Entity Framework Core.
It works on the .NET console. but when the same code runs on the web app it says.
fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[0]
An unhandled exception has occurred while executing the request
System.TypeLoadException: Method 'Clone' in type 'MySQL.Data.EntityFrameworkCore.Infraestructure.Internal.MySQLOptionsExtension' from assembly 'MySql.Data.EntityFrameworkCore, Version=8.0.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' does not have an implementation.
at Microsoft.EntityFrameworkCore.MySQLDbContextOptionsExtensions.UseMySQL[TContext]
at ConsoleApplication.EmployeesContextFactory.Create(String connectionString) in BooksController.cs:line 65
Here is my code
var optionsBuilder = new DbContextOptionsBuilder<EmployeesContext>();
optionsBuilder.UseMySQL(connectionString);
var context = new EmployeesContext(optionsBuilder.Options);
context.Database.EnsureCreated();
It gives me the exception on the method UseMySql() The same exact code works fine in the console.
Also connectionString, .NET Core version and many of the constraints that I can think of are the same.
EDIT
Seeing the difference The ASP.NET project has following Nugets
The console app has the following,
Both projects show it's target framework as 2.0
What's the right way to solve this issue?
Because the current MySQL connector only supports .NET Core 1, you might not be able to use it with v2.
You could try this package at https://github.com/jasonsturges/mysql-dotnet-core