Microsoft information protection SDK 1.7.133 - LoadLibrary failed - microsoft-information-protection

I saw that the MIP SDK 1.7.133 now has support for .NET Core, and I'm trying to implement Microsoft Information Protection SDK in an Azure Function using .NET Core to label documents in SharePoint (by downloading, labeling and uploading the document again), but when calling MIP.Initialize(MipComponent.File) I'm getting the error below.
Executed 'SensitivityLabeling' (Failed, Id=591fade7-7c51-40b6-b723-56b68af3a66d, Duration=572ms)
System.Private.CoreLib: Exception while executing function: SensitivityLabeling. Microsoft.InformationProtection: LoadLibrary failed for: [F:\<verified-path-to-function>\SensitivityLabelingFunction\bin\Debug\netcoreapp3.1\x64\mip_dotnet.dll].
I followed the quick-start guide before the update which worked well, but when I now update the SDK in the same project and run it with version 1.7.133 it crashes on the same command as my new Azure Function project.
I tried both the plain overload above and with the path using the below example from another question, verifying that the path is correct while debugging, but with the same error.
var path = Path.Combine(
Directory.GetParent(Path.GetDirectoryName(newUri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath)).FullName,
Environment.Is64BitProcess ? "bin\\x64" : "bin\\x86");
//Initialize Wrapper for File API operations
MIP.Initialize(MipComponent.File, path);
Another semi-related question, is there any other way to label a specific document in SharePoint using code except for the MIP SDK? No other API seems to support applying labels, only changing the actual label settings.

Running it in release mode with version 1.7.133 instead according to Microsoft information protection SDK 1.7.133 - Load library failed issue error seems to work.

Related

Can not resolve reference: `Windows.Foundation.UniversalApiContract in Android App

I developed a Xamarin Cross Platform application that is working perfectly on Windows but when I try to recompile for Android I get the following error:
Can not resolve reference: `Windows.Foundation.UniversalApiContract
I use the Windows.Foundation.UniversalApiContract reference because of the Windows.Storage class (generate files in internal memory).
I understand that I may have to change the recording method on Android but I can't even get to that stage...
How do I resolve this situation?
Just as ToolmakerSteve said, Windows namespace relies on features that exist only in Windows. The reference should not be in the main .Net Standard library but in the UWP Application.
First, you can move the code to the Windows folder or set the #if Windows around it.
Second, you can write the code for each platform. I found the answer you can refer to Can not resolve reference: Windows.Foundation.UniversalApiContract in Android Application.

Xamarin.Android binding invalid opcode

Recently received a new Android SDK (aar) to bind in Xamarin. When initially starting the binding I receive the error
COMPILETODALVIK : Uncaught translation error : com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)
This error is due to the SDK containing Java 8 (v1.8) byte code and it needs to be compatible with Java 7 (v1.7) to support lower API versions of Android.
In your Android project (not the binding project), add the following property.
<AndroidEnableDesugar>True</AndroidEnableDesugar>
or if you are in VS 2019+ you can turn on D8 which enables this by default.
<AndroidDexTool>d8</AndroidDexTool>
Desugaring is the process of allowing Java 8 byte code to be converted into Java 7 compatible byte code. This is a Google process that performs the conversion and is part of the Xamarin.Android build process.
Then if the SDK doesn't have any dependencies, it should all work. If you have EmbeddedReferenceJars, then things get more complicated.
In Visual Studio 2017 you will experience errors similar to
Error: java.lang.TypeNotPresentException : Type io.reactivex.functions.Consumer not present
It will be unable to find these types in reference jars, because the desugaring processing isn't working properly. From Github Issues you eventually find the reason:
The first fix here is to add the `--classpath_entry` flag for every
`--input`, for some reason `Desugar` is not treating `--input` jars as
classpath entries
The bug is already tracked and fixed in Visual Studio 2019 Preview 2.
Now you switch to Visual Studio 2019 Preview 2 and you will come across this error.
Java.Lang.NoClassDefFoundError: Failed resolution of: Lcom/google/devtools/build/android/desugar/runtime/ThrowableExtension;
The desugaring processing is failing again because it needs this class to help communicate to the desugared code.
The class ThrowableExtension is actually found: https://github.com/bazelbuild/bazel/blob/master/src/tools/android/java/com/google/devtools/build/android/desugar/runtime/ThrowableExtension.java
You then take that Java class and you can compile it into a jar. A quick way to do it is copy that java file into a folder. Then inside that folder create a folder called output.
Call this command
javac -d ./output ThrowableExtension.java
Then move into the output directory and call this command
jar cvf desugar.jar *
It will create desugar.jar. Add that as an EmbeddedReferenceJar in your Android binding project. Your binding with Java 8 byte code with desugaring should now work.
Hopefully this might be resolved in a future Visual Studio version, so all these steps aren't necessary, but until then, at least you know what is happening and how to fix it.

Unable to convert classes into dex format Unity

Using the google play games services and Admob plugin I cannot seem to get my back to build into an APK and I am receiving the following error message. Any help would be appreciated as I have removed some duplicate files but I am still failing to find why I cannot build my app.
I am using Unity Unity 5.6.1f1 (64-bit).
game services: https://github.com/playgameservices/play-games-plugin-for-unity Ads: https://github.com/unity-plugins/Firebase-Admob-Unity
CommandInvokationFailure: Unable to convert classes into dex format.
C:/Program Files/Java/jdk1.8.0_121\bin\java.exe -Xmx2048M -Dcom.android.sdkmanager.toolsdir="C:/Users/Jack/AppData/Local/Android/sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -
stderr[
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzbyb;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzbyc;
2 errors; aborting
]
Some Background
When Unity builds your project for Android, it invokes several tools from the Android SDK. As part of that process, it converts all of your native (Java) code for Android into a file format called DEX (Dalvik executable).
All of your Android plugins get built up into a single package using that tool. The problems start when a few plugins have the same compiled Java code (classes) in them. This will cause the DEX tool to fail with an error like the one you're seeing:
Uncaught translation error: java.lang.IllegalArgumentException:
already added: Lcom/google/android/gms/internal/zzbyb;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/internal/zzbyc;
This means that classes with those names were already included in another library, and so they cannot be added again.
Possible Causes
As explained above, this error occurs when you have duplicate plugins in your project; this can happen in different scenarios, here are some examples:
The same plugin is included more than once, under different folders of the project.
The same plugin is included more than once with different versions.
A plugin contains other dependencies "embedded" inside it, but these dependencies are already included in the project in some form.
How To Fix
You should look up duplicate Android plugins in your project and eliminate them (keep only 1 copy). From the error message you posted, the issue here is related to Google play services libraries. You should look into that (libraries named play-services-xxxx.aar).
Paid Help (Shameless Plug)
I provide a professional service for fixing this exact kind of issue. In case you (or anyone else) are not able to resolve such an issue themselves, feel free to contact me and get it solved.
I was facing the same problem after add admob in my project, here are 2 possible solutions:
Go to the file >> build settings and change the option internal to gradle
Open libs folders separately of both Facebook SDK and Google Play services and delete the matching files
It would be something like (support v4)
Google ads 11.2 has errors. It reuses certain jar classes .
On its own, it isnot an issue
Once you add in another google class, ie firebase, your done for.
There is a fix though. Google put out firebase 4.2 and ads 11.4

ros::init(...) throws an error - Windows roscpp

I'm trying to use ros in cpp with Visual Studio 2012. I wrote the publisher and subscriber tutorial (http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29) and first, I configure the project as says in the guide (http://wiki.ros.org/win_ros/hydro/Msvc%20SDK%20Projects).
Then i compiled an linked the publisher, but when I tried to run it, ros::init(argc,argv,"talker") throws an exception... The console says that I ROS_MASTER_URI is not defined but I've got it defined
There are 2 images here:
https://www.dropbox.com/s/o12m0l38gaxiugi/error1.png -
https://www.dropbox.com/s/ocdmf0wj6rj0962/error.png
Can anyone helps me?
Thanks in advance
So, I had the same issue, although I didn't set the ROS_MASTER_URI globally.
I managed to get around this specific issue by adding
ROS_MASTER_URI=http://localhost:11311
to the debugging environment variables (Project->Properties->Configuration Properties->Debugging->Environment).
However, after implementing the above I got an uncaught exception (Unhandled exception at 0x768bc41f in ros_demo.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0028f0e4..).
That went away when I built, compiled and ran the project in release mode (which matched my ROS SDK build).
I got the idea for the release/debug build from here:
xstring isn't an OSG specific object, so the error is elsewhere in the
3rd party dependency chain. As I know nothing about your OS and
software setup I can't speculate what this might be.
In general though this type of error could well be a linking issue -
for instance Visual Studio is hopeless at handling different libs
being built debug and release and will crash randomly.
That was fun to discover..

OpenCV_HelloWorld project in VC++ 2010 Runtime Error:

I set up the environment according to this tutorial:
http://opencv.willowgarage.com/wiki/VisualC%2B%2B_VS2010
However the picture they want you to use is no longer there, so I just saved the supplied screen shot with the same name as the original file.
Builds fine, Begins to run but then I get a runtime error
Here is the runtime error:
OpenCV_HelloWorld.exe - Application Error : The application was unable to start correctly (0xc0150002). Click OK to close the application.
I looked in Event Viewer and found that it also set off a another error but did not announce
Here is the unannounced error:
Activation context generation failed for "C:\OpenCV2.1\bin\cxcore210d.dll". Dependent Assembly Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8" could not be found. Please use sxstrace.exe for detailed diagnosis.
As you can see it says to use sxstrace.exe however I don't appear to have that program. After a quick Google I read that the program was included in the Microsoft Windows Platform SDK, so I'm downloading the most relevant version (windows 7 version for c# and .net) and installing that to follow up on that, I'll post what I find as it comes.
Any help is very much appreciated
Unexpectedly the project builds and runs now. The only modifications made were removing spaces in the c++ directory and linker options from the tutorial. External changes were the completed installation of the windows platform SDK, however OpenCV has no dependencies with windows platform sdk. I am unsure how it was resolved, but it's no longer a problem.

Resources