пʼятниця, 28 липня 2017 р.

Very fast previewing XAML and Linux


Generally, the compiling is very fast,
but there are one more solution, even faster.

While GTK is not ready it is possible to try the next:

http://www.moonmile.net/blog/archives/8669
http://www.moonmile.net/blog/archives/8655

(you may use the Google translation from Japanese language to English)

вівторок, 25 липня 2017 р.

issue :: "XamlCTask" task failed unexpectedly.


Tried to compile https://github.com/davidbritch/xamarin-forms/tree/master/DataBinding101

Xamarin.Forms.targets(62,3): error MSB4018: The "XamlCTask" task failed unexpectedly.

There are something with .csproj file, I don't know what.
So I created a fresh Xamarin project and copied 3 necessary files there - now all works.

Activity name


Activity name can be found here:

/wrk/all/one/projects/SampleResources1/Droid/obj/Debug/android/manifest/AndroidManifest.xml
or here
/wrk/all/one/projects/SampleResources1/Droid/obj/Debug/android/AndroidManifest.xml

понеділок, 24 липня 2017 р.

Visual Studio Code issue

I forget to add 2 imports in the file

using System.Collections.Generic;
using Xamarin.Forms;

and my code may be builded normally from the command line,
but in IDE I can't use the Ctrl+click navigation and intellisense in that file,
so I may
1. close the IDE;
2. build the project from the command line;
3. re-open the IDE and look at the errors' list or if I can't see errors then
to open the files one by one where intellisense doesn't work and find where I missed the import (it may be marked with red lines or not marked at all) or have other errors.

понеділок, 17 липня 2017 р.

Droid resources


If I change the styles (android resources) then sometimes I may need to delete manually the
Droid/Resources/Resource.designer.cs

Но я могу ошибаться...
поскольку я случайно перепутал что в colors.xml я изменений не делал.

понеділок, 3 липня 2017 р.

resgen or ResXFileCodeGenerator


https://forums.xamarin.com/discussion/87175/not-able-to-use-resgen-on-mac-to-generate-cs-strongly-types-resource-class-file

https://docs.microsoft.com/en-us/dotnet/framework/tools/resgen-exe-resource-file-generator

Unfortunately resgen.exe for mono and normal resgen.exe are different software - I can not generate the AppResources.Designer.cs file in Linux.

It doesn't work:

    <EmbeddedResource Include="Resx\AppResources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>AppResources.Designer.cs</LastGenOutput>
    </EmbeddedResource>

And I can't say why.

Interesting that msbuild can generate that file for Droid project (strings.xml), but not for PCL.

Solution:

https://msdn.microsoft.com/ru-ru/library/system.resources.tools.stronglytypedresourcebuilder(v=vs.110).aspx

modify the result .cs:

sed -i 's/using System;/using System;\n    using System.Reflection;\n/g' AppResources.Designer.cs

sed -i 's/typeof(AppResources).Assembly/typeof(AppResources).GetTypeInfo().Assembly/g' AppResources.Designer.cs

It works when I put the AppResources.resx in the root directory of PCL, but if I use other directory, then it may not work. I have no time today to figure out how to configure it if it possible.


P.S. For myself - other related links to review:
https://dzone.com/articles/missing-reswfilecodegenerator )
http://reswcodegen.codeplex.com/
https://github.com/christianhelle/reswcodegen

https://www.codeproject.com/Articles/13830/Extended-Strongly-Typed-Resource-Generator

http://www.linuxonly.nl/docs/49/145_Run_custom_tool_on_each_resx_file_when_building.html

https://stringresourcetool.codeplex.com/SourceControl/latest

https://marketplace.visualstudio.com/items?itemName=JohnAaronNelson.ForceCode (?)

https://marketplace.visualstudio.com/items?itemName=EZSlaver.ExtendedStronglyTypedResourceGenerator (source code exists)

http://blog.baltrinic.com/software-development/dotnet/t4-template-replace-resxfilecodegenerator

Interesting:

https://forums.xamarin.com/discussion/58542/resx-localization-not-working-on-real-devices

To answer:

https://forums.xamarin.com/discussion/80627/can-i-generate-resource-designer-cs-programatically
https://forums.xamarin.com/discussion/86800/is-there-any-way-to-generate-designer-cs-files-from-command-line


субота, 1 липня 2017 р.

Exceptions...


E/AndroidRuntime( 1892): Caused by: android.runtime.JavaProxyThrowable: System.DivideByZeroException: Attempted to divide by zero.
E/AndroidRuntime( 1892):   at Sample.PersonalBudget..ctor () [0x00230] in <f5634a8f2718474699a651b585799c90>:0
E/AndroidRuntime( 1892):   at Sample.App..ctor () [0x0000f] in <f5634a8f2718474699a651b585799c90>:0

vs

I/MonoDroid( 2066): System.DivideByZeroException: Attempted to divide by zero.
I/MonoDroid( 2066):   at Sample.PersonalBudget..ctor () [0x00230] in /wrk/all/one/projects/Sample/Sample/PersonalBudget.cs:70 
I/MonoDroid( 2066):   at Sample.App..ctor () [0x0000f] in /wrk/all/one/projects/Sample/Sample/App.xaml.cs:14 
I/MonoDroid( 2066):   at Sample.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x00027] in /wrk/all/one/projects/Sample/Droid/MainActivity.cs:27 

Seems this is a solution:
./adb shell setprop debug.mono.debug 1