How to determine whether a DLL is a managed assembly or native (prevent loading a native dll)?

Answer quoted by lubos hasko is good but it doesn’t work for 64-bit assemblies. Here’s a corrected version (inspired by http://apichange.codeplex.com/SourceControl/changeset/view/76c98b8c7311#ApiChange.Api/src/Introspection/CorFlagsReader.cs) public static bool IsManagedAssembly(string fileName) { using (Stream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read)) using (BinaryReader binaryReader = new BinaryReader(fileStream)) { if (fileStream.Length < 64) { return false; } //PE Header starts @ 0x3C … Read more

Linking.canOpenURL returning false when targeting android 30 sdk on React Native

The answer lies in a new Android security feature: Package Visibility. This works similar to iOS’ LSApplicationQueriesSchemes. Targeting Android 11 (SDK 30) requires you to update your AndroidManifest.xml and include a list of applications you’re querying for. E.g. here’s the code I’m using to check for Google Maps navigation in my own app. It also … Read more

tech