Binding project for UltraliteJNI12.jar - "already defines a member" error - xamarin.android

We need to use a Sybase Ultralite database in our Mono for Android app (it's a port of an existing application, synchronising with a Sybase server database).
I'm not aware of an existing Mono binding, so I'm setting off on the task of creating a binding library using the new project type in 4.2.
So... I've added UltraliteJNI12.jar, set its build action to InputJar, and clicked 'build'.
I get an error:
Com.Ianywhere.Ultralitejni12.Implementation.JniDbMgr' already defines a member called 'Release' with the same parameter types
and yes, when I look at the generated source, there are two identical Release members declared.
Is there a way of working round this? I've read the tutorial and can't see anything there which points to a solution.
Thanks, and apologies for what may be a stupid question - I'm just starting out on this!
James

The answer - as supplied by Jonathan Pryor on the Mono for Android list - was to rename one of the instances of release, by adding the following to metadata.xml:
<attr
path="/api/package[#name='com.ianywhere.ultralitejni12.implementation']/class [#name='JniDbMgr']/method[#name='release']"
name="managedName">Release2
</attr>

Related

Not being able to build F# type provider SDK

I have finally come across something that no one else seemed to have come across (at least from what I can tell). I trying to build an F# type provider using TypeProviders.SDK.
As soon as I build the solution I get the error: "FS0810, Property 'CultureName' cannot be set, \LemonadeProvider\paket-files\fsprojects\FSharp.TypeProviders.SDK\src\ProvidedTypes.fs" on line 2090 and again at 3162 in the design time project of the solution.
I do not think this is useful but the Test project also fails as it can not find the LemonadeProvider.Runtime.dll. I am assuming this will get created when the Runtime project will build successfully.
PS: As of right now I am just tring to build the provided template, I have not changed the code or added anything to it. Hence I have not attached any code, but please feel free to ask for it.
The corresponding issue is https://github.com/fsprojects/FSharp.TypeProviders.SDK/issues/353
Known workarounds
Change minimum target to net461. Replace all instances of net45 with net461, except for in netfx.props, where you can just delete the lines referencing net45* frameworks (I suspect the removal of those lines isn't strictly speaking necessary).
I did this workaround but am now facing these kinds of errors: (like 2000 of them)
C:\Users\user\source\repos\HelloWorldProvider\paket-files\fsprojects\FSharp.TypeProviders.SDK\src\ProvidedTypes.fs(34,7): error FS0074: The type referenced through 'System.Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard'. [C:\Users\user\source\repos\HelloWorldProvider\src\HelloWorldProvider.DesignTime\HelloWorldProvider.DesignTime.fsproj]
I found out that the issue lied with the ProvidedTypes.fs and ProvidedTypes.fsi files created by the SDK.
The issue was solved for me when I replaced the files with the ones found in 'SDK-dsyme-patch-7' which provided compatibility for different .Net environments which was missing from the original SDK. There might be other differences but this is the one I found and it fixed the problem for me.
The files can be found under '/src/' in the dsyme patch.
The code I am referring to is as follows and has been added twice to the ProvidedTypes.fs:
#if NETSTANDARD
asmName.CultureName <- System.Globalization.CultureInfo.InvariantCulture.Name
#else
asmName.CultureInfo <- System.Globalization.CultureInfo.InvariantCulture
#endif
asmName
I am not aware if there is a new SDK that has solved the problem. But at the time when the question was asked, this is what worked for me.

Error when I bind an Objective-C Package

I want to bind an Objective-C Package in my Xamarin project. I follow the step from
here.
However,the content seems incomplete.And I want to know what to do next.Any advice will help me.
Have you get two file(xxx_ApiDefinitions.cs and xxx_StructsAndEnums.cs )? Copy the code from two files to binding project.
That's not enough. The compiler will prompt a large number of errors . Such as
You have to do something. For example, use the ulong/long instead of nuint ,and annotate the code such as [Verify(MethodToProperty)] .In addition,there are some differences between iOS and Xamarin.iOS in name of Object.For example ,NSURL in OC and NSUrl in C#.You need to manually modify it.

Referencing App Object Across Multiple Build Targets iOS

I need to make several versions of an iOS application each with a different target and name. Most of the differences between the applications are in the applications resources and not the source code. I am trying to share as much source code across versions as possible.
My issue arises when I try to access the application object in a version which does not have the same name as the original. For instance, I have two versions of the application named UserApp and UserApp2 and the following code which references the data store:
var user = UserApp.User
When I try to run this code in the UserApp2 target, it throws an error saying UserApp is undefined.
My question is: How can I make this code load the proper application object depending on what target is currently running? I would like a solution that can be used across all targets without the need to change code.
EDIT: The UserApp object is an XCDataModel.
The UserApp class might not be added in all of your application targets. verify the target membership for the class.

creating createM3FromEclipseProject in Rascal creates no data

I'm new to Rascal and have a very very basic question.
I'm using in a little test project the follwing command :
createM3FromEclipseProject(|project://example-project|);
and uses the code to extract data from a project
It only gives my {}... I assume that means that my M3 model is empty.
What am I doing wrong? It has to be something really basic..
Greets
Doerak
Have you followed the recipe in http://tutor.rascal-mpl.org/Recipes/Recipes.html#/Recipes/Metrics/MeasuringJava/MeasuringJava.html ?
If no: then please do because that example code is tested.
If yes, then it means there is no data in your project. This can be caused by:
there really is no code in your project. This can be remedied :-)
or the source path of the example project (with the Java code) is not configured to point to the place where you have your Java code. This can be fixed in the properties pane (right-click on the project and its the bottom option). From there on, find help on managing Eclipse projects on stackoverflow.com.

How to resolve "Main module of program is empty: nothing will happen when it is run"

I have two projects in an F# solution.
1. main project with [EntryPoint] and set as the StarUp project.
2. support, the second project, holds a group of support modules. I.e. they are only called and never initiate anything nor serve as the entry point nor are the StartUp project.
For the last module in the support project, compiling in Visual Studio gives
warning FS0988: Main module of program is empty; nothing will happen
when it is run
While using compiler option nowarn inline as #nowarn "988" in the module causing the warning does suppress the message I would rather add something like a dummy function with comments that resolves the issue.
How does one make such a dummy function to resolve the warning?
EDIT
Jack is correct in that my support project was setup as a Console Application instead of a Class Library. Changing to Class Library resolved the warning. It is also nice to know about do () for the other case.
EDIT
While it seemed odd that I would have set a support project as a Console Application, I recently found that for some reason when I made a change to the code in the project, something changed the Output type from Class Library to Console Application. I suspect it has to do with the F# PowerPack and it's build rules, but it's only a guess.
Are you building the support project as a Library or as a Console Application? (This is set via the project properties page.)
If you're building it as a library, then you may need to add a do() at the end of the last file in the project. This is necessary to make the F# compiler happy in a few specific scenarios, like when you create a module which contains only assembly-level attributes (because they're applied to the assembly, the module appears "empty" to the compiler).
You can see an example in my code here:
https://github.com/jack-pappas/FSharp.Compatibility/blob/master/FSharp.Compatibility.OCaml/AssemblyInfo.fs

Resources