Xamarin Android Binding referencing Org.Apache.Xml.Security.Algorithms - xamarin

I am trying to create a Xamarin Android binding library which is referencing org.apache.xml.security.transforms , Org.Apache.Xml.Security.Algorithms
Which reference I have to add to make sure it is working fine?
Sample errors
1>BINDINGSGENERATOR : warning BG8900: Type org.apache.xml.security.transforms.Transforms: FxDG naming violation: Type name 'Transforms' matches namespace part 'Transforms'.
\obj\Debug\generated\src\Org.Apache.Xml.Security.Algorithms.Implementations.IntegrityHmac.cs(150,20,150,31): warning CS0108: 'IntegrityHmac.IntegrityHmacRIPEMD160.GetDHandler()' hides inherited member 'IntegrityHmac.GetDHandler()'. Use the new keyword if hiding was intended.

These are not errors, but rather the binding generator giving you a couple of fair warnings.
1>BINDINGSGENERATOR : warning BG8900: Type org.apache.xml.security.transforms.Transforms: FxDG naming violation: Type name 'Transforms' matches namespace part 'Transforms'.
This is simply a warning telling you that the name Transforms matches part of the previous namespace org.apache.xml.security.transforms. Again this isn't a big issue unless these classes are not generating.
\obj\Debug\generated\src\Org.Apache.Xml.Security.Algorithms.Implementations.IntegrityHmac.cs(150,20,150,31): warning CS0108: 'IntegrityHmac.IntegrityHmacRIPEMD160.GetDHandler()' hides inherited member 'IntegrityHmac.GetDHandler()'. Use the new keyword if hiding was intended.
This warning is saying that the GetDHandler() implementation of IntegrityHmac.IntegrityHmacRIPEMD160 is being hidden. Typically this is an issue of obfuscation.
I do have a general binding guide that has most of these aspects covered once you know what you're looking for:
https://gist.github.com/JonDouglas/dda6d8ace7d071b0e8cb
However after looking over your source, it seems that everything compiles just fine. There are a few notes here:
Ensure you are compiling with the correct JDK. I used JDK 1.8 in testing yours, but the documentation of the SDK you are binding to might use a different one.
Make sure you are using the correct Build Action for your JARs. You can find a recommended use case in our documentation: https://developer.xamarin.com/guides/android/advanced_topics/binding-a-java-library/#Build_Actions (InputJar does not embed into the .dll and must be found at runtime. Thus you should use EmbeddedJar)

Related

Seeing many compilation errors after upgrading my c++ project to VS19

I had built a c++ dektop project with VS17.
Now due to certain requirements, I needed it to migrate to VS19.
After making changes to compile my project with VS19, I am seeing many errors like below:
C3646 'OVERRIDE': unknown override specifier
C2039: 'wstring': is not a member of 'std'
I found this link - https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-2/compiler-error-c3646?view=msvc-170
but could not find it useful to fix my issue.
I am looking for an easy fix, like if there is a way to use VS17 c++ compiler in VS19.
Rather than going back to the old compiler, you might be better off tackling the errors one-by-one:
OVERRIDE: is probably defined as macro somewhere in your project. Find out, what value OVERRIDE is being resolved to. Put the cursor into the word OVERRIDE to get the value. It could be that the respective include file is not properly included for some reason. Does your old project include a forced include for global definitions?
wstring: to be recognized as std::wstring, you have to include <string>.
Check your UNICODE settings. They determine the usage of 8-byte vs. multi-byte characters for strings. Look at Configuration Properties / Advanced / Character Set in the solution properties.

iOS project doesn't reference a static library from Binding project when in Release mode

I've got a static library, which was used to generate the wrapping code by Sharpie. The library was Built after that (including, generated *.dll) successfully.
AppDefinition.cs contains the namespace and the mappings, like this:
namespace TheNamespace
{
// #interface TheParameters : NSObject
[BaseType(typeof(NSObject))]
interface TheParameters
{
The library itself built in Release mode with LinkTarget.ArmV7 | LinkTarget.ArmV7s | LinkTarget.Arm64.
However, when referencing this binding project from my iOS project, it works only in Debug mode.
When I change it to Release, the namespace (and all the related clasees) not available. Also, when exploring the binding library reference in Object Browser, it doesn't display any elements: it's totally empty.
Just to point that: it gets available when changing it in the dropdown to Debug and disappears on Release, what's interesting, undependently on what actually project is selected in Current Project dropdown!
What might be the issue? Thanks!
I think the problem should come from when building static library .When generating static library , there is a build type of release/debug to select.
Above screenshot shows static library types after building , there are three types (Two is Debug and One is Release ). You can see that tt distinguishes between release and debug .
After some Googling I found the solution.
The issue happens because of Visual Studio bug, I guess. And also referred here. (And it's weird it's not mentioned in Xamarin docs on Microsoft website.
To resolve the issue the Binding Project(s) must not reside in the same solution with the main project. Just remove them and attach the library as regular reference.

Xamarin iOS binding, symbol not found in library

I needed a sketch/painting control for my Xamarin.iOS project, and while I couldn't seem to find one compatible with C# I did find a good component available written in Objective C. https://github.com/acerbetti/ACEDrawingView
I've done Xamarin bindings before, so I had hoped that the process would be fairly simple, but unfortunately I've hit a few roadblocks along the way.
I started off creating my static library and used an ant build script to make a FAT binary to cover devices and the simulator:
snippet of my ant script
AceDrawingViewSDK.a: libAceDrawingView-i386.a libAceDrawingView-armv7.a libAceDrawingView-armv7s.a libAceDrawingView-arm64.a xcrun -sdk iphoneos lipo -create -output $# $^
Next, I ran
sharpie bind --sdk=iphoneos10.1 *.h
on the header files to get my ApiDefinitions and Structs and Enum files.
I checked and removed a the Verify attributes. (They all looked fine.) But this is where some of my other issues started.
The type ACEDrawingLabelViewTransform' already contains a definition forTransform' (CS0102) (AceDrawingViewBinding).
For the sake of just trying to move on and get something working, I just commented out this reference.
I then got multiple problems similar to this:
The type or namespace name `IACEDrawingTool' could not be found. Are you missing an assembly reference? (CS0246) (AceDrawingViewBinding)
I figured it related to this:
// #interface ACEDrawingPenTool : UIBezierPath
[BaseType(typeof(UIBezierPath))]
interface ACEDrawingPenTool : IACEDrawingTool
and this:
// #protocol ACEDrawingTool
[Protocol, Model]
[BaseType(typeof(NSObject))]
interface ACEDrawingTool
I tried to fix this my making the interface name consistent (I tried both IACEDrawingTool and ACEDrawingTool.) Doing this got past this error and allowed me to compile
One of my enums came out as
[Native]
public enum ACEDrawingMode : nuint
{
Scale,
OriginalSize
}
I couldn't find how to handle [Native] in this case (so once again, for testing sake I removed it.) I tried using removing the nuint from the enum and using uint. Either approach seemed to fix the error.
So with those errors fixed I was able to generate the .dll from my binding project and add it to my main project.
Now, I am getting 2 more issues.
If I build and deploy to the simulator I am able to run my app up until the point that I try to create a new instance of the ACEDrawingView from the binding. I get:
Could not create an native instance of the type 'ACEDrawingView': the native class hasn't been loaded.
It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.
If I try to build and deploy to my phone I get different errors in the build phase which prevents it from launching on the device at all:
MTOUCH: error MT5211: Native linking failed, undefined Objective-C class: ACEDrawingArrowTool. The symbol 'OBJC_CLASS$ACEDrawingArrowTool' could not be found in any of the libraries or frameworks linked with your application.
MTOUCH: error MT5211: Native linking failed, undefined Objective-C class: ACEDrawingDraggableTextTool. The symbol '_OBJC_CLASS$ACEDrawingDraggableTextTool' could not be found in any of the libraries or frameworks linked with your application.
MTOUCH: error MT5211: Native linking failed, undefined Objective-C class: ACEDrawingEllipseTool. The symbol '_OBJC_CLASS$_ACEDrawingEllipseTool' could not be found in any of the libraries or frameworks linked with your application.
...and so on.
I've tried going back, rereading and redoing steps and have tried to reuse some of the scripts and settings from my previous successful bindings with no luck.
Does anyone have suggestions for what might fix these issues?
The type or namespace name `IACEDrawingTool' could not be found.
Add a new interface, like this interface IACEDrawingTool{ }
public enum ACEDrawingMode : nuint
Change the nuint to ulong

TypeScript 1.6 Ionic error TS2322 Build Type is not assignable to type 'IActionSheetOptions'

I updated Visual Studio 2015 to TypeScript 1.6 and my Apache Cordova application broke. I'm getting errors with Ionic UIActionSheet Options cssClass. For example, the line:
cssClass: "class_action_sheet"
results in the error: TS2322 Build Type is not assignable to type 'IActionSheetOptions'.
I tried to add a flag to the project file to suppress the new strictness, but either I added it wrong, or it can't be fixed that way.
Any help would be greatly appreciated.
This is of the same type of problem addressed here.
This seems to be a reversal of 'type compatibility' premise, but discussing that won't solve the problem.
The easiest solution is to make sure your ionic.d.ts file is complete. There is a version on definitely typed currently that does contain a property for cssClass in action sheet options, however it is not a direct descendant of the .d.ts file you are currently using and this will imply some refactoring.
For example the action sheet options is ionic.actionSheet.IonicActionsheetOptions not Ionic.IActionSheetOptions.
Another option would be to extend the interface on your own by saying interface MyActionSheetOptions extends Ionic.IActionSheetOptions, then define cssClass.
This seems incorrect to me as it's not a true subset but merely trying to fix gaps in the ionic definition file.

ASP.Net Library name conflict between Ektron app_code and library

I've got an Ektron 8.2 site, and I was trying to integrate Quartz.NET into it, in order to run some scheduling. Quartz.NET requires a library Common.Logging. This library introduces a conflict and breaks the Ektron code in App_Code/VBCode.
E.g. the following code from Utilities.vb
Case Is = Common.EkEnumeration.FolderType.Community
imageURL &= "images/ui/icons/folderCommunity.png"
Case Common.EkEnumeration.FolderType.Catalog
imageURL &= "images/ui/icons/folderGreen.png"
now gives a compile time error-
App_Code\VBCode\Utilities.vb(703,0): error BC30456: 'EkEnumeration' is not a member of 'Common'.
It appears that Common.Logging is conflicting with Ektron.Cms.Common (the Ektron files have a Imports Ektron.Cms statement). Is it possible to specify the priority on libraries? Or namespace an imported library?
Update
The Utilities.vb code is written by Ektron. I'd like to either make no changes to this code, or minimal changes, as any changes would need to be re-done upon Ektron upgrades. This is really a clash between 2 libraries - Ektron and Quartz.Net. Can I resolve this clash without changing the code of either library? Is there a configuration setting for aliasing libraries?
A simple solution is to use the full namespace, Ektron.Cms.Common.EkEnumeration, rather than relying on the include to sort things out automatically.
I.e.
Case Is = Ektron.Cms.Common.EkEnumeration...
Not elegant, but should get you working again.
Another alternative is to use a namespace alias:
using EkCommon = Ektron.Cms.Common;
So your code would instead look like:
EkCommon.EkEnumeration.FolderType.Community

Resources