I'm pretty desperate finding the solution for the problem stated below.

I have a cross platform solution which has 4 projects,

3 OS specifics 
    MyApp.android,
    MyApp.Winphone,
    MyApp.IOS
and a PCL project
    MyApp.BLL

inside the MyApp.BLLbll, I'm using the MyApp namespace and in the root I have the class TranslateExtension.cs

namespace MyApp
{
[ContentProperty("Text")]
public class TranslateExtension: IMarkupExtension {
readonly CultureInfo ci;
const string ResourceId = "MyApp.Resources.AppResource"; public TranslateExtension()
{
ci = DependencyService.Get<ILocalize>().GetCurrentCultureInfo();
} public string Text { get; set; } public object ProvideValue(IServiceProvider serviceProvider)
{
if (Text == null)
return ""; ResourceManager resmgr = new ResourceManager(ResourceId
, typeof(TranslateExtension).GetTypeInfo().Assembly); var translation = resmgr.GetString(Text, ci);
try
{
if (translation == null)
{
#if DEBUG
throw new ArgumentException(
String.Format("Key '{0}' was not found in resources '{1}' for culture '{2}'.", Text, ResourceId, ci.Name),
"Text");
#else
translation = Text; // HACK: returns the key, which GETS DISPLAYED TO THE USER
#endif
}
}
catch (Exception exp) {
}
return translation;
}
}

inside the Xamarin Forms I'm using the following to enable the translation for the labels, etc.

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MyApp.Views.RegisterWebServiceXaml"
xmlns:trans="clr-namespace:MyApp;assembly=MyApp.BLL"
IsBusy="{Binding IsWorking}"
> <ContentPage.Content>
<StackLayout Orientation="Vertical" VerticalOptions="FillAndExpand" Padding="0,75,0,0">
<Entry Text="{Binding Path=OrganizationId, Mode=TwoWay}" Placeholder="{trans:Translate OrganizationId}" Style="{StaticResource LoginStyle}" />
...
<Label Text="{trans:TranslateUpper Next}" x:Name="LoginLabel" HorizontalOptions="Center" Style="{StaticResource BasicLabel}" />
</StackLayout>
</ContentPage.Content>
</ContentPage>

This is working like a charm using the debug modus, but when I try to compile the solution for Android in release mode, my application is suddenly stopping directly after loading the splashscreen stating 'MyApp is stopped'

looking in the Application output, I can find the following error message:

[Xamarin.Insights] Warning: Unhandled exception: Xamarin.Forms.Xaml.XamlParseException: MarkupExtension not found for trans:Translate
[Xamarin.Insights] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x00028>
[Xamarin.Insights] at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (object) <0x0003f>
[Xamarin.Insights] at Android.App.SyncContext/<Post>c__AnonStorey0.<>m__0 () <0x00027>
[Xamarin.Insights] at Java.Lang.Thread/RunnableImplementor.Run () <0x0003f>
[Xamarin.Insights] at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) <0x0003b>
[Xamarin.Insights] at (wrapper dynamic-method) object.44dc0140-8f03-4bf1-a261-186aa2a7ef42 (intptr,intptr) <0x0003b>
[art] JNI RegisterNativeMethods: attempt to register 0 native methods for md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable
[AndroidRuntime] Shutting down VM
[AndroidRuntime] FATAL EXCEPTION: main
[AndroidRuntime] Process: MyApp.MyApp, PID: 32091
[AndroidRuntime] java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
[AndroidRuntime] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1184)
[AndroidRuntime] Caused by: java.lang.reflect.InvocationTargetException
[AndroidRuntime] at java.lang.reflect.Method.invoke(Native Method)
[AndroidRuntime] at java.lang.reflect.Method.invoke(Method.java:372)
[AndroidRuntime] at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1389)
[AndroidRuntime] ... 1 more
[AndroidRuntime] Caused by: md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable: Xamarin.Forms.Xaml.XamlParseException: MarkupExtension not found for trans:Translate
[AndroidRuntime] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () <0x00028>
[AndroidRuntime] at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (object) <0x0003f>
[AndroidRuntime] at Android.App.SyncContext/<Post>c__AnonStorey0.<>m__0 () <0x00027>
[AndroidRuntime] at Java.Lang.Thread/RunnableImplementor.Run () <0x0003f>
[AndroidRuntime] at Java.Lang.IRunnableInvoker.n_Run (intptr,intptr) <0x0003b>
[AndroidRuntime] at (wrapper dynamic-method) object.44dc0140-8f03-4bf1-a261-186aa2a7ef42 (intptr,intptr)<0x0003b>[AndroidRuntime][AndroidRuntime] at mono.java.lang.RunnableImplementor.n_run(NativeMethod)[AndroidRuntime] at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:29)[AndroidRuntime] at android.os.Handler.handleCallback(Handler.java:739)[AndroidRuntime] at android.os.Handler.dispatchMessage(Handler.java:95)[AndroidRuntime] at android.os.Looper.loop(Looper.java:145)[AndroidRuntime] at android.app.ActivityThread.main(ActivityThread.java:5944)[AndroidRuntime]...4 more

Does any body has a solution for this problem? I can't find it. I have tried using the several namespaces ( MyApp.android, MyApp, MyApp.BLL, MyApp.MyApp ), but until now I haven't found the right one.

Why is this working in Debug mode and not in Release/App store mode?

Check the project settings, make sure linking is turned off or SDK-ony

.

If it was "Link all assemblies" and without it your code becomes too big you may want to instead use the [Preserve] attribute on your class.

See this page for more info on Xamarin Linker

Xamarin.Forms.Xaml.XamlParseException: MarkupExtension not found for trans:Translate using a PCL in Release Mode的更多相关文章

  1. Xamarin.Forms XAML的辅助功能Code Snippet

    Xamarin.Forms XAML的辅助功能Code Snippet   在Visual Studio中,使用Code Snippet(代码片段)功能可以减少基础代码的编写量,如常见的标签.循环语句 ...

  2. Xamarin.Forms XAML控件的公共属性

    Xamarin.Forms XAML控件的公共属性   Xamarin.Forms XAML控件有很多.通过官网API,可以查看每个控件的属性.但是官网只给出了控件的特有属性,而公共属性没有列出.所以 ...

  3. Creating Reusable XAML User Controls with Xamarin Forms

    In the previous post on making fancy layouts with Xamarin Forms we saw how you can design a Dashboar ...

  4. Xamarin.Forms之XAML

    官网参考 XAML基础知识 XAML(eXtensible Application Markup Language)可扩展应用程序标记语言,允许开发者在Xamarin.Forms应用中采用标记而不是代 ...

  5. 老司机学新平台 - Xamarin Forms开发框架之MvvmCross插件精选

    在前两篇老司机学Xamarin系列中,简单介绍了Xamarin开发环境的搭建以及Prism和MvvmCross这两个开发框架.不同的框架,往往不仅仅使用不同的架构风格,同时社区活跃度不同,各种功能模块 ...

  6. Xamarin.Forms介绍

    On May 28, 2014, Xamarin introduced Xamarin.Forms, which allows you to write user-interface code tha ...

  7. Xamarin.Forms入门学习路线

    Xamarin 介绍 Xamarin是一套跨平台解决方案,目的是使用C#语言创造原生的iOS,Android,Mac和Windows应用. Xamarin的三个优势: Xamarin App拥有原生A ...

  8. Xamarin.Forms 开发资源集合(复制)

    复制:https://www.cnblogs.com/mschen/p/10199997.html 收集整理了下 Xamarin.Forms 的学习参考资料,分享给大家,稍后会不断补充: UI样式 S ...

  9. Xamarin.Forms 自定义 TapGestureRecognizer 附加属性

    While creating Xamarin.Forms applications, definitely you are going to need TapGestureRecognizer oft ...

随机推荐

  1. Java反射--基于ParameterizedType实现泛型类,参数化类型

    一.引子: 项目中使用Gson的反序列化将json转化成具体的对象,具体方法是: package com.google.gson;下的反序列化方法 public <T> T fromJso ...

  2. JS脚本病毒调试脚本-Trojan[Downloader]:JS/Nemucod

    1.前言 遇到Trojan[Downloader]:JS/Nemucod需要分析,这款病毒主要为js运行.从网上各种找js调试方法.发现52的帖子还挺沾边的. TrojanDownloader:JS/ ...

  3. Linux内核入门(六)—— __attribute__ 机制【转】

    转自:https://blog.csdn.net/yunsongice/article/details/5538020 GNU C的一大特色(却不被初学者所知)就是__attribute__机制.__ ...

  4. mysql双主+keepalived【转】

    简单原理 1.在两台服务器上分别部署双主keepalived,主keepalived会在当前服务器配置虚拟IP用于mysql对外提供服务 2.在两台服务器上分别部署主主mysql,用于故障切换 3.当 ...

  5. Spring Boot Mvc 单元测试

    https://blog.csdn.net/hfmbook/article/details/70209162

  6. 【BZOJ】4025: 二分图

    题解 lct维护一个结束时间作为边权的最大生成树,每次出现奇环就找其中权值最小的那条边,删掉的同时还要把它标记上,直到这条边消失 如果有标记则输出No 边权通过建立虚点来维护 代码 #include ...

  7. 【AtCoder】AGC024

    A - Fairness 如果奇数次是b - a 否则是a - b #include <bits/stdc++.h> #define fi first #define se second ...

  8. python 包详解

    包 包是一种管理 Python 模块命名空间的形式,采用"点模块名称". 比如一个模块的名称是 A.B, 那么他表示一个包 A中的子模块 B . 就好像使用模块的时候,你不用担心不 ...

  9. csp刷题

    title: csp刷题 date: 2018-12-13 16:41:33 tags: --- Markdown 在第7个点挂了,,,不改了,,,太恶心了这种题QAQ,,,, 有谁想改的改完了告诉我 ...

  10. RAR压缩包审计工具unrar-nofree

    RAR压缩包审计工具unrar-nofree   RAR是常见的一种压缩包格式,广泛应用于Windows系统下.Kali Linux提供一款专用的审计工具unrar-nofree.该工具由WinRAR ...