var ctor = Module.ImportReference(ctorinforef);
// IL_0001: newobj instance void class [Tizen.NUI.Xaml.UIComponents]Tizen.NUI.Xaml.UIComponents.Button::'.ctor'()
// IL_0006: stloc.0
- Context.IL.Emit(OpCodes.Newobj, ctor);
+ bool isConvertValue = false;
+ if (node.CollectionItems.Count == 1 && node.CollectionItems.First() is ValueNode valueNode)
+ {
+ if (valueNode.CanConvertValue(Context.Module, typeref, (TypeReference)null))
+ {
+ var converterType = valueNode.GetConverterType(new ICustomAttributeProvider[] { typeref.Resolve() });
+ if (null != converterType)
+ {
+ isConvertValue = true;
+ Context.IL.Append(vnode.PushConvertedValue(Context, typeref, new ICustomAttributeProvider[] { typedef },
+ node.PushServiceProvider(Context), false, true));
+ }
+ }
+ }
+
+ if (false == isConvertValue)
+ {
+ Context.IL.Emit(OpCodes.Newobj, ctor);
+ }
Context.IL.Emit(OpCodes.Stloc, vardef);
}
else if (ctorInfo != null && node.Properties.ContainsKey(XmlName.xArguments) &&
for (var i = arguments.Count; i < factoryCtorInfo.Parameters.Count; i++)
{
var parameter = factoryCtorInfo.Parameters[i];
- var arg = new ValueNode(parameter.Constant.ToString(), node.NamespaceResolver);
+ var arg = new ValueNode(parameter.Constant?.ToString(), node.NamespaceResolver);
foreach (var instruction in arg.PushConvertedValue(Context,
parameter.ParameterType,
if (node.NamespaceURI == XamlParser.X2009Uri)
{
var n = node.XmlType.Name.Split(':')[1];
- return n != "Array";
+ return n != "Array" && n != "Nullable";
}
if (node.NamespaceURI != "clr-namespace:System;assembly=mscorlib")
return false;
if (compiledConverterName != null && (compiledConverterType = Type.GetType (compiledConverterName)) != null) {
var compiledConverter = Activator.CreateInstance (compiledConverterType);
var converter = typeof(ICompiledTypeConverter).GetMethods ().FirstOrDefault (md => md.Name == "ConvertFromString");
- IEnumerable<Instruction> instructions = (IEnumerable<Instruction>)converter.Invoke (compiledConverter, new object[] {
- node.Value as string, context, node as BaseNode});
+ IEnumerable<Instruction> instructions = null;
+
+ try
+ {
+ instructions = (IEnumerable<Instruction>)converter.Invoke(compiledConverter, new object[] {
+ node.Value as string, context, node as BaseNode});
+ }
+ catch
+ {
+ }
if (null != instructions)
{
else
LoggingHelper.LogMessage(Low, $"{new string(' ', 2)}Ignoring dependency and reference paths due to an unsupported resolver");
- var debug = DebugSymbols || (!string.IsNullOrEmpty(DebugType) && DebugType.ToLowerInvariant() != "none");
-
var readerParameters = new ReaderParameters
{
AssemblyResolver = resolver,
ReadWrite = !ReadOnly,
- ReadSymbols = debug,
};
using (var assemblyDefinition = AssemblyDefinition.ReadAssembly(System.IO.Path.GetFullPath(Assembly), readerParameters))
{
assemblyDefinition.Write(new WriterParameters
{
- WriteSymbols = debug,
});
LoggingHelper.LogMessage(Low, $"{new string(' ', 2)}done.");
}