We have a Desktop Windows app using some UWP Bluetooth LE UWP functions. We start the watcher:
string BTLEDeviceWatcherAQSString = "(System.Devices.Aep.ProtocolId:=\"{bb7bb05e-5972-42b5-94fc-76eaa7084d49}\")";
string[] props = { "System.Devices.Aep.DeviceAddress", "System.Devices.Aep.IsConnected", "System.Devices.Aep.Bluetooth.Le.IsConnectable"};
watcher = DeviceInformation.CreateWatcher(BTLEDeviceWatcherAQSString, props, DeviceInformationKind.AssociationEndpoint);
It runs OK on most machines, just rarely we have an anonymized error log:
System.Exception: Element not found. Property key syntax error. A property key must either be specified as a canonical property name (preferred) or be of the form {fmtid} pid.
at Windows.Devices.Enumeration.DeviceInformation.CreateWatcher(String aqsFilter, IEnumerable`1 additionalProperties, DeviceInformationKind kind)
We run this code for Windows 10.0.15063 (i.e. 1703) or higher, so all properties should be available by doc.
What may cause this error? Some HW configuration or Windows 10 settings?
I have seen this exception in a windows WPF desktop application. The reason was that I had neglected to detect the revision of Windows 10 was greater than version 1703 AKA creators edition. Therefore anyone running the application on an earlier version of Windows 10 would see this error. Its unfortunate that the error is so obscure, a not supported error would be better.
Related
Add a WMAsfReader caused Error,HRESULT was -2147024770.The code is as follow:
sourceFilter = (IBaseFilter) new WMAsfReader();
((IFileSourceFilter)sourceFilter).Load(fileSource, null);
hr = filterGraph.AddFilter(sourceFilter, "WM ASF Reader");
MessageBox.Show(hr.ToString());
When I run this code on Win10 with WMP,it works well;but it does not work on Win7 without WMP.But I can find the "WM Asf Reader" in the registry,qasf.dll as well.What is the problem?Thanks.
Error Image:
The error code -2147024770 is 0x8007007E ERROR_MOD_NOT_FOUND "The specified module could not be found."
Such error for a Windows core component might indicate that something is broken in your Windows (e.g. certain application installed and registered the same DLL and then it was deinstalled - resulting in broken registration of the original module). It might also be caused by Windows 7 N version having no Windows Media in the default configuration, you are supposed to add the feature by installing a Feature Pack.
but it does not work on Win7 without WMP...
...The Media Feature Pack for Windows 7 N or Windows 7 KN will install Media Player and related technologies on a computer running...
It is not only Windows Media Player missing in N editions, but also the underlying APIs, used by WM ASF Reader.
I'm new to UWP, and i tried instantinate MediaPlayer class. On local machine it's work fine, but on mobile emulator throws next exception:
An exception of type 'System.Runtime.InteropServices.COMException'
occurred in project.exe but was not handled in user code
Additional information: ClassFactory cannot supply requested class
(Exception from HRESULT: 0x80040111 (CLASS_E_CLASSNOTAVAILABLE))
StackTrace:
at System.StubHelpers.StubHelpers.GetWinRTFactoryObject(IntPtr pCPCMD)
at Windows.Media.Playback.MediaPlayer..ctor()
at Project.Services.PlaybackServiceFactory.Create(PlayerArgument arg)
at Project.ViewModels.PlayerViewModel..ctor(PlayerArgument arg)
at Project.MainPage.d__3.MoveNext()
All uwp examples with MediaPlayer also crashes. Previously it worked fine, whats maybe wrong? I would be glad of any help, thank you.
UPD: Problem actual for 10.0.10586 emulator version
The MediaPlayer constructor is available from "Universal, introduced version 10.0.14393.0". So please run your project in 14393 emulator or grater.
You could dynamically detect features with API contracts (10 by 10)
The Universal Windows Platform (UWP) allows you to write your app once and target multiple device families, while also taking advantage of new APIs introduced on later versions of the OS as well as using unique APIs only present on certain device families.
Just downloaded Xamarin Studio 5.9.6 (build 23), and went into Tools - Options - Language, and selected "English" as the "User interface language".
When I created a new C# "empty project", Xamarin complained, a dialog box displayed saying: "An error has occurred - The project could not be created".
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException:
The type initializer for 'Microsoft.FSharp.Compiler.SourceCodeServices.FSharpChecker' threw an exception. ---> System.TypeInitializationException:
The type initializer for '<StartupCode$FSharp-Compiler-Service>.$Service' threw an exception. ---> System.TypeInitializationException:
The type initializer for '<StartupCode$FSharp-Compiler-Service>.$Reactor' threw an exception. ---> System.Globalization.CultureNotFoundException: Culture is not supported.
Parameter name: culture
4096 (0x1000) is an invalid culture identifier.
Kinda of a strange little annoyance. Running Windows 10 x64. I have tons of Visual Studios on this PC as well, including VS2015.
This is a bug in Xamarin Studio's language selection on Windows 10. It is fixed in Xamarin Studio 5.10.
This is normally seen when English is selected, typically this would be done with Windows 10 using a non-English language, and configuring Xamarin Studio to use English would not change the UI text but would still show the language used by Windows.
The problem is that on Windows 10 a lot of the English non-neutral cultures returned from CultureInfo.GetCultures have an unspecified custom locale ID (LCID) which is 0x1000. Earlier versions of Windows do not have this problem. One of these cultures was being used to set the current UI culture and it was ignored since it is invalid. According to the MSDN documentation before Windows 10 unspecified custom locale ids were assigned to custom cultures created by the user. In Windows 10 this unspecified custom locale id is assigned to any culture that does not have a unique locale identifier and does not have complete system provided data. So Windows 10 returns more locales with this unspecified locale id.
Since Xamarin Studio was using an invalid culture this caused the F# exception.
Now these cultures with unspecified custom locale ids are ignored by Xamarin Studio 5.10 and above.
The interesting thing about this error is it is complaining about the F# compiler. Yet, my intent was to create a new C# empty project. ...and I do have F# loaded due to my Visual Studio instance(s). And I am in the USA, it's not like I was attempting to load a different language.
So the quick fix for this was to go back into Xamarin Tools - Options - Language, and change it back to (default).
User error (?) by selecting English.
I have a situation where I have a windows Desktop APP in .Net C# that must on both Windows 7 and Windows XP rename a shortcut. I have it working in Windows 7 but on XP this fails.
.Net 4.0 Client Profile and Extended is installed on XP and all other parts of the applciation are functioning on XP. The project has a reference Interop.Shell32 (MIcrosoft Shell Controls and Automation through COM Interop rahter than pinvoke) and the code is simply the following:
var shl = new Shell32.Shell();
argStrLnkPath = System.IO.Path.GetFullPath(argStrLnkPath);
var dir = shl.NameSpace(System.IO.Path.GetDirectoryName(argStrLnkPath));
var itm = dir.Items().Item(System.IO.Path.GetFileName(argStrLnkPath));
itm.Name = "My Shortcut Name";
The above works in 7 but not XP. The following versions of the Shell32.dll exist:
Win7 Shell32.dll version 6.1.7601
WinXP Shell32.dll version 6.00.29.6242
When I spy the XP shell32dll in the object browser, the same objects exist, so the functionalty should be there (unless I'm not seeing something important).
My project is set to build as x86 platform for both machines. For the reference, I have tried the Embed Interop Types as True and also copy local as False.
I have an msi installer but is there something I need to do on the target XP machine? And should I copy Local? Any ideas on the propper way to get this working?
I have run the code on that XP Machine and receive the following from teh Event Viewer:
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidCastException
Embed Interop Types for Reference = True: The stackTrace for this error is:
Unable to cast COM object of type 'System.__ComObject' to interface type 'Shell3
2.Shell'. This operation failed because the QueryInterface call on the COM compo
nent for the interface with IID '{866738B9-6CF2-4DE8-8767-F794EBE74F4E}' failed
due to the following error: No such interface supported (Exception from HRESULT:
0x80004002 (E_NOINTERFACE)).
Embed Interop Types for Reference = False: The stackTrace for this error is:
Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.IO.FileNotFoundException
Issue Solved! I hadn't realized that when you make those types of COM Interop inclusions, they must have a Setup Project (msi installer if going on another system). Also, another caveat is that if you have already created a setup project, you must Add > project Output again. This will automatically pull all of those interop inclusions in under the Detected Dependencies folder. This solved my issue.
I am using Windows Update API (WUApiLib) in a C# .NET 2.0 project.
I get the following error on Windows XP (in Windows 7 it works alright):
"System.MissingMethodException: Method not found: 'WUApiLib.UpdateSearcher WUApiLib.UpdateSessionClass.CreateUpdateSearcher()'."
This is my code:
WUApiLib.UpdateSessionClass session = new WUApiLib.UpdateSessionClass();
WUApiLib.IUpdateSearcher searcher = session.CreateUpdateSearcher();
WUApiLib.ISearchResult result = searcher.Search("Type='Software'");
if (result.Updates.Count > 0)
{
//do stuff
}
The error occurs at runtime, the compiler shows no errors...
Does anybody know why I get this error?
You are no doubt battling a version problem, the Win7 version is WUA version 2, XP is probably still stuck at 1. If you want to support XP then make sure to use an interop library that you generated with Tlbimp.exe on a XP machine. Keeps you out of trouble, you can't accidentally use an interface or method that isn't supported on XP.
I don't see much in the way of documentation for what's available in which version and to what degree version 2 is backwards compatible with version 1. Only this MSDN Library page seems relevant.