Running sample projects in MvvmCross v3 (Hot Tuna) - xamarin.ios

I'm trying to run sample projects (viz. BestSellers and Conference) that are present in MvvmCross v3 branch. I resolved the strong assembly reference issues successfully. However each time I run a sample project, I get System.TypeLoadException in MvxFullBinding and MvxValueConverterRegistryFiller classes.
Exception in MvxFullBinding class:
Exception in MvxValueConverterRegistryFiller class:
Is anybody able to run the sample projects successfully? How do I get around these exceptions?

It looks like you're running this as the 'Touch' projects from Visual Studio? In which case you are way ahead of what I've managed to achieve.
If that is correct, then I suspect that what you are seeing is that you have:
built proper PCLs built in VS/Windows against the portable reference assemblies
but these cannot be executed against the current MonoTouch/Xamarin.iOS runtime.
If you try, you may see issues like: iOS black screen and MissingMethodException: Method not found: 'System.Type.op_Equality'
For some more info see 'almost portable binaries' on http://slodge.blogspot.co.uk/2013/01/almost-portable-binaries.html
There is 'proper' PCL support currently being worked on within XamLabs - so I am hopeful that there may be a solution to this problem arriving in the Xamarin.Android Alpha channel any day now - but don't expect this to be painless initially.
Of course, I might be wrong on this - this really is new territory and I will be fascinated to hear/read about your adventures. If you want to try to find more detail, then it may help to try looking deeper into the exception details, and looking into the console log trace on your mac.
For these two particular exceptions, I can confirm that both samples...
... although that is when I'm working on my Mac.

Related

unresolved reference: fillMaxSize() and unresolved reference: size() error in android studio with Kotlin

I started very basic android development and from the very first day it seems that android studio and kotlin are just like a bundle of problems. Like after first installation of androidstudio I build the basic samples on Kotlin and it worked fine. After few hours I got a notification on androidstudio about some update so I did it and then every thing stopped working I looked for solution on Internet and tried for 2-3 hours but didn't get it back working. Then I uninstalled everything related to androidstudio on my PC and re-installed it and then it started to work again.
After few days I started to implement a tutorial and I used the same code and configuration described in tutorial but on the very first step where they just created a basic sample application without any thing and it started to show errors like Unresolved reference: fillMaxSize and Unresolved reference: size and I couldn't find any solid solution on Internet and surprisingly found out that internet is full of these kind of issues on androidstudio.
In the project I am using the function fillMaxSize() in another file where it works 100% fine but in the same project but in different file it gives error. Can anybody give a solution to this?
Apart from this I just want to ask that is android development in general is like this? That every time you go 1 line further and you see new errors and then you have to spend hours on internet and look for solutions and you then found tons of queries about these errors on internet and nothing is clear and particularly working for your case but it is kind of similar error_
Adding new imports, changing plugin versions, adding plugins, changing dependencies and versions.
After few hours I got a notification on androidstudio about some update so I did it and then every thing stopped working
Updates of course are good as they try to fix or enhance something. However, some updates will add, remove or change some previous working functions to achieve the fixing or enhancing purpose. And that's why some programs require certain version of Software instead of always the latest one to run.
In the project I am using the function fillMaxSize() in another file where it works 100% fine but in the same project but in different file it gives error
In this case, you will have to check whether you have really added the corresponding import to that particular file. If there is really configuration problem, it should not have worked in one file but not the other. import is something that you have to do in every file using that function.

How can I use AutoMapper with my Xamarin.iOS project?

It seems that when I reference AutoMapper v3.1.0 in my Xamarin.iOS project, the build fails with this error message:
Error MT2002: Failed to resolve "System.Linq.Expressions.Expression System.Linq.Expressions.ExpressionVisitor::Visit(System.Linq.Expressions.Expression)" reference from "System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" (MT2002)
When I roll back to the revision before I added this, it all works fine.
Unfortunately, I've already done quite a bit of work with AutoMapper in my unit tests and it would be problematic to remove it now. I guess that's a lesson to learn: just because it works in a test doesn't mean it works in Xamarin.iOS.
I would be very grateful if anyone has any ideas.
Edit: I have now discovered a MonoTouch directory in the AutoMapper package, but referencing the AutoMapper.dll and AutoMapper.iOS.dlls found within does not solve the problem.
Edit #2: This issue only occurs when building for the device - I guess the MSIL to native converter doesn't like AutoMapper for some reason. I'm trying to find a way to "hint" to this compiler that we need these symbols, which is what I think the purpose of the LinkerPleaseInclude.cs file is.
This issue is temporarily resolved - I had to hack out the offending symbols in AutoMapper and recompile it. Please see automapper issue #429 for more information on what symbols I removed. Until AutoMapper is updated to fix this problem, that's how you have to solve it for now.
The reason for this is explained concisely in another StackOverflow question - basically there are subtle differences between the .NET and Mono frameworks that in this case are incompatible with AutoMapper.
This answer previously stated that you should turn off linking to work with AutoMapper. While you can do this for development, it's not suitable for production use as it will yield a massive binary and you will not be able to submit your app to the app store.

Compile Errors Galore - Cannot build some ServiceStack solutions download from GitHub

This is just odd.
I'm getting a build error in ServiceStack.Text after just bringing down the latest build from GitHub.
if (endpointUrl.IsNullOrEmpty() || !endpointUrl.StartsWith("http"))
return null;
Error 1 No overload for method 'IsNullOrEmpty' takes 0 arguments
ServiceStack\src\ServiceStack.Common\Messaging\ClientFactory.cs 10 18
ServiceStack.Common
I'm also getting bunch of other build errors:
Error 35 'int' does not contain a definition for 'Times' and no extension method 'Times' accepting a first argument of type 'int' could be found (are you missing a using directive or an assembly reference?) ServiceStack.Redis\src\ServiceStack.Redis\Messaging\RedisMqServer.cs 192 37 ServiceStack.Redis
and after downloading the ServiceStack branch, I even tried opening ServiceStack-master\src\ServiceStack.sln and tried to build and it's totally broken:
I don't know what's going on here, there can't possibly be this many build errors if any right? I pray not but it seems as such.
Purpose of this post, what I'm asking about and need help clarifying and resolving (mythz???)
I need input from ServiceStack here on the following:
1) are the builds really this broken? Am I imagining this?
2) The branch stucture on GitHub is all over the place meaning I'm finding dup project folders all over and I do not know what this ServiceStack branch is as in it's src folder has a ton of projects there, different versions, as well as doesn't have projects like ServiceStack.Text, etc. so I don't know what's going on here. I want to use the basic core of service stack but there's like repeated stuff everywhere overall on GitHub. I need ServiceStack to clear all this up for me.
Here is my code, so you can see for yourself, it doesn't build.
This one won't build in terms of the ServiceStack projects - it's my solution in which I'm simply trying to include the ServiceStack projects I need along with my own projects that are using ServiceSTack. All I did was downoad those individual projects from https://github.com/ServiceStack then added them to my solution and made sure that any references to each other were now Project references, no longer binary..I removed the binary refs and readded them as project refs. So for example ServiceStack.Common depends on ServiceStack.Text but it was referencing it via binary so I removed it and readded the reference to ServiceStack.Text as a project ref now because in the end we plan on being able to look at and work with the base Stack code. The errors I posted above are happening in this Solution for ServiceStack related projects.
This one won't build - it's a download of the ServiceStack branch master (originally folder name is ServiceStack-master, I removed the -master)
UPDATE: yes I confirmed it's a bad build checked in on the GitHub site (refering to the ServiceStack branch master right above here). I had to remove unused using statements that were causing the build to fail and one of these was a dup using statement causing part of the build failure. I am surprised at this...this stuff should build and people should be checking in code that BUILDS successfully! common! Yes mythz, any dev trying to consume your API would be pissed that there are so many build erros all the time, I can't even get our protype going because this is not the only solution that won't build. First we had the Examples solution all breaking and now the core. I'm willing to fix these if I can but I honestly can't believe it's been a mountain to try to even use this API because of these checked in builds that are failing.
This one Will build because it was Nuget down, so ServiceStack is referencing other layers via binary references in the lib folder so this builds...probably builds here because someone has a working set of builds across all core projects but the stuff on the site for download is not the same revision and broken when you try to use them as project references (source code)?? Just my conclusion as it's only building IF you are using binary references to the lib folder. We want the source, not the binaries to work inside our solution so this is a brick wall for me
There are a lot of big changes happening on master right now - it will be unstable for a while.
I suggest you branch from the v3-fixes tag or pull the references from nuget.
#CoffeeAddict
Yesterday, the mythz answered about these problems in your previous question
"#CoffeeAddict like I said before, ServiceStack's is undergoing significant re-factoring and master in alpha and not for public use. While everything still builds for me and tests still pass in CI, it will be frequently unstable until its in beta. You're likely mixing v3 with v4 dlls which are technically incompatible. The release on NuGet is off the v3 branches of each project, that's what you should checkout if you want to build from src. Any contribs should be done to v3-fixes only - see Contributing docs for more info. – mythz 9 hours ago"
well looks like when I had downloaded all the stack branches, at the time earlier today contributors had checked in broken builds. Fabulous.
I just got latest early this morning, and appears people must have fixed the build and checked some stuff back in for various core projects. Now it builds.
Suggestion to mythz, get CI in place NOW. Don't wait for v4. This cost me a freakin day of trying various things to get this stuff to build and the problems were across several projects. This shouldn't happen, setup CI please. It's 2am and nobody using this project should have to deal with it.
I will contribute but first I had to get a full build to work! Not too happy as no dev would be wasting an entire day getting ServiceStack to build.
To compile v3:
Would someone with true knowledge post PROPER instructions on compiling v4 or v3? I had no luck with the build.bat files for v3 or v4, and opening solutions will not compile for most.
git clone servicestack, servicestack.text, redis, ormlite
make a new directory and copy from under src so you have these:
ServiceStack
ServiceStack.Client
ServiceStack.Common
ServiceStack.Interfaces
ServiceStack.OrmLite
ServiceStack.Redis
ServiceStack.Server
ServiceStack.Text
open csproj for ServiceStack.Interfaces ... right click properties, go to the signing tab, click the combo, new, type in your own signing pfx, I used servicestackInterfaces.pfx (doesn't matter) and make up a password.
Compiles fine, since it has not much referenced.
saved solution as ServiceStackV3 in folder C:\2015\SSv3compile
add csproj ServiceStack.Text, set signature, compiles ok
add csproj ServiceStack.Common, set signature, remove references, add references using solution for interface, text, compiles ok
add csproj ServiceStack.Client, set signature, remove references, add references using solution for interface, text, compiles ok
add csproj ServiceStack, set signature, remove references, add references using solution for client, common, interface, text, compiles ok
add csproj ServiceStack.OrmLite, set signature, remove references, add references using solution for common, interface, text, compiles ok
add csproj ServiceStack.Redis, set signature, remove references, add references using solution for common, interface, text, compiles ok
add csproj ServiceStack.ServiceStack.Server, set signature, remove references, add references using solution for Servicestack, ServiceStack.Client, ServiceStack.Common, ServiceStack.Interface, ServiceStack.Text, ServiceStack.Ormlite, ServiceStack.Redis
compiles ok
have some more trouble compiling the tests...
and finding so many tweaks and changes which are for me maddening to find
(endless agentransack searching for "namespace ISomethinMissing" in *.cs
... there seems to be namespace ServiceStack with cs code contained in projects other than Servicestack...
isn't that VERY improper? (now you require both DLLs? why not one?)
whatever...its free and works for what I wanted.
looks like there is some code leakage from v4...
after getting my head around v3, not sure I want to buy v4 - I will probably buy it in the future, I expect, and hope someday I can just clone and compile from the solution
ANyway, I love servicestack and have been
replacing old webservices
and the config nightmares of WCF with great happiness...
I say it is well worth the initial hassle.
I put this all in code block because I found the editor wouldn't accept this simple text when it was in a numbered list. whatever.

Is there any tool replacement for SONAR for .net code quality and generate report from it?

I have a Visual studio solution, which is designed using c# 4.0 .
I want to check the code quality for my solution and generate report out of it.
I tried the FxCop and i also got the report but i need the report something like this(from the image).
The rules compliance is 85% but in FxCop it only showed me the critical, error, etc.
I was not able to even deploy my project into SONAR because I had some timeout issue
coming for one of my project in the solution.
please someone help me.
Thanks in advance.
Regards,
Roopini
I don't know if there's an equivalent of SonarQube for .NET projects, but if you really want such reporting (which I can understand, obviously!), you should rather ask questions on how to resolve your installation issue for SonarQube instead of searching for something else. There are plenty of organizations where big .NET solutions are successfully analyzed with SonarQube and the C# plugins, so there's no reason why it can't work for you!
You can find useful material on the net to help you on this. For instance, a blog post written by John M Wright about "setting up SonarQube for C# projects". John periodically updates his post, so the information should still be very relevant.
Have you tried the tool NDepend? It generates interactive reports about .NET code quality and code rules compliance. Here are some sample reports.
NDepend is also a tool integrated in Visual Studio (2017, 2015, 2013, 2012, 2010) that proposes a range of interactive features (graph, dependency matrix, code metrics visualization, code diff...). Another point about NDepend is that code rules are actually C# LINQ queries, so it is pretty easy to customize a default code rule or create your own code rules.
NDepend also integrates in VS Team Services and you'll get all code quality data from your VSTS UI instead of being redirected to a server.
I read that you have time-out problems analyzing your code base, maybe it is because your code base is pretty large. NDepend is optimized and it can analyze a very large code base and create a report in a few dozens of seconds (it takes around a minute to analyze the whole .NET Fx).
A 14 days full featured trial is available.
Disclaimer: I work in the NDepend team
If you haven't already, I would suggest taking a look at my blog post on setting up SonarQube for C# projects: http://www.wrightfully.com/setting-up-sonar-analysis-for-c-projects/
The key to fixing your issue will be determining what the system is doing when the timeout occurs. Take a look at your log files and see what the last lines were before it timed out. It could be that your code is complex and just needs more time, in which case you can adjust the timeout values for whichever tool is running at the time.
Otherwise, I would suggest running whichever analysis tool (fxcop, gendarme, sytlecop, etc) was running when the timeout occurred outside of SonarQube. That is, run the tool directly from the commandline to see if it still times out or provides any additional information on the console.
Also, assuming you're using the sonar-runner tool to execute the SonarQube analysis, you can add the -X argument to the commandline, which will run it with debug-level logging enabled. This will create a LOT more log messages which may shed some additional light on the issue.

Error serializing with ServiceStack JSON on MonoTouch

I am experimenting with ServiceStack's JSON engine. I grabbed the MonoTouch binary build, v2.20. Works fine from simulator, but from the iOS device (iPad2, iOS5) I get an exception thrown by the type initializer for JsonWriter (and not much other than that). I am using MonoTouch 5, MonoDevelop 2.8.1, and targeting iOS 5. I have disabled library linking because I am getting an error when enabled.
I created a sample and uploaded to https://github.com/t9mike/ServiceStack-JSON1.
I'm trying to determine whether the issue is my compilation options, Service Stack, or MonoTouch. Thanks in advance.
A quick partial answer that might help:
I have disabled library linking because I am getting an error when enabled.
The current (5.0) managed linker can eliminate some unused (from a static analysis point of view) code from your application. This generally occurs when using Link all option, i.e. where user code gets processed by the linker.
One alternative is using the Link SDK assemblies only that won't touch the user code (only the code shipped with MonoTouch itself will be processed by the linker).
Another alternative is adding [Preserve] attributes on your code to ensure the serializer requirements are still met after the linker has processed your code. More information about the linker and [Preserve] attributes can be found here.
The next (5.2) release of MonoTouch will include a bit more sophisticated step in the linker to ensure the basic XML serialization and DataContract requirements are not broken. Not sure if this will solve this specific case (ServiceStack JSON) but I'll have a look into it.
As for the rest of your question I'll try to build this myself and duplicate your issue.
I ended up grabbing the ServiceStack.Text sources from GitHub, version 3.0.3. I created a new MonoTouch library project. I had to tweak ServiceStack.Text/JsConfig.cs slightly to conditionalize away the System.Drawing.Color bits. I'll send a patch and MT csproj to the authors.
After using this new assembly, my sample MT app ran fine on the device. I have updated my sample at https://github.com/t9mike/ServiceStack-JSON1 with the new ServiceStack.Text dll.

Resources