The public enum 'StocksGroupType' is in the namespace 'EquityTrades'.
Before the code at the base of this email, I have the code line:
xmlns:EquityTrades="clr-namespace:EquityTrades;assembly=EquityTrades"
The code fails to identify the 'StocksGroupType' enum at the line with:
It returns the error: "Type reference cannot find type named '{http://schemas.microsoft.com/winfx/2006/xaml/presentation}EquityTrades.StocksGroupType'."
I've tried deleting the ';assembly=EquityTrades', and other variations, according to what I've found on the internet. Nothing seems to work. Please help. I'm using VS2010.
<Window.Resources>
<ObjectDataProvider x:Key="stocksGroupTypeName" MethodName="GetValues" ObjectType="{x:Type System:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="EquityTrades.StocksGroupType" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</Window.Resources>
The following line is wrong.
<x:Type TypeName="EquityTrades.StocksGroupType" />
You have to change TypeName value from EquityTrades.StocksGroupType to EquityTrades:StocksGroupType.
Related
I am working on a Xamarin project that is using AutoMapper. When linking is set to "Link Framework SDKs Only" I get the following error when initializing the maps
System.ArgumentNullException: Value cannot be null. Parameter name:
method
The exception is not much to go on and neither is the callstack
AutoMapper.Mappers.ConvertMapper.MapExpression
AutoMapper.Execution.TypeMapPlanBuilder.ObjectMapperExpression
AutoMapper.Execution.TypeMapPlanBuilder.MapExpression
AutoMapper.Mappers.NullableSourceMapper.MapExpression
AutoMapper.Execution.TypeMapPlanBuilder.ObjectMapperExpression
AutoMapper.Execution.TypeMapPlanBuilder.MapExpression
AutoMapper.Execution.TypeMapPlanBuilder.MapExpression
AutoMapper.Execution.TypeMapPlanBuilder.CreatePropertyMapFunc
AutoMapper.Execution.TypeMapPlanBuilder.CreatePropertyMapFunc
AutoMapper.Execution.TypeMapPlanBuilder.TryPropertyMap
AutoMapper.Execution.TypeMapPlanBuilder.CreateAssignmentFunc
AutoMapper.Execution.TypeMapPlanBuilder.CreateMapperLambda
AutoMapper.TypeMap.Seal AutoMapper.MapperConfiguration.Seal
AutoMapper.MapperConfiguration..ctor
AutoMapper.MapperConfiguration..ctor AutoMapper.Mapper.Initialize
The initial reading of that suggests that the Linker is simply removing some properties or indeed methods from some class we are using.
However, after commenting out most of the mappings and then reintroducing them one at a time I find that this class is currently causing the error.
[Preserve]
internal class ItemBase : CareRecordItemBase
{
[Preserve]
public string Topic { get; set; }
[Preserve]
public string InPractice { get; set; }
[Preserve]
public string PrivateVal { get; set; }
}
If I comment out the InPractice property the exception does not get thrown. This makes no sense to me. Can anyone explain why this might be a problem?
Are there better ways of diagnosing these issues?
Based on Pat's Answer:
Add an XML file LinkDescription.xml, you can name it anything you want.
Add this code:
<linker>
<assembly fullname="mscorlib">
<type fullname="System.Convert" preserve="All" />
</assembly>
</linker>
Set the file's build action to LinkDescription
See comment from AutoMapper author Lucian Bargaoanu. I needed to include an xml file that adds configuration to the Linking process.
Lucian refers to this Automapper Issue, https://github.com/AutoMapper/AutoMapper/issues/2272
Also see
Custom Linker configuration
I have following class
namespace MyApplication.Services
{
public class TagEqualityComparer : IEqualityComparer<Tag>{/*code goes here*/}
}
Now what I would like to register it in autofac using .config file based configuration:
<autofac>
<components>
<component type="MyApplication.Services.TagEqualityComparer, MyApplication.Services"
service="System.Collections.Generic.IEqualityComparer, mscorlib" />
</components>
</autofac>
I have already spent whole sunday searching for solution I failed to find any. Other registrations, non templates, works perfectly but this one refuses.
Any idea how to solve it?
You need to define the rest of the generic type to specify the parameter type. Something like this:
<component type="MyApplication.Services.TagEqualityComparer, MyApplication.Services"
service="System.Collections.Generic.IEqualityComparer`1[[MyApplication.Services.Tag, MyApplication.Services]], mscorlib" />
I am trying to use NineOldAndroids to enable backwards compatibility with pre-3.x devices, but I am encountering the following build error:
.../NineOldAndroids/obj/Debug/generated/src/Com.Nineoldandroids.Animation.AnimatorSet.cs(83,83):
Error CS0508:
Com.Nineoldandroids.Animation.AnimatorSet.SetDuration(long)': return
type must beCom.Nineoldandroids.Animation.Animator' to match
overridden member
`Com.Nineoldandroids.Animation.Animator.SetDuration(long)' (CS0508)
(NineOldAndroids)
but the signature in generated code looks like this:
public override global::Com.Nineoldandroids.Animation.AnimatorSet SetDuration (long p0)
and the class signature of AnimatorSet looks like this:
public sealed partial class AnimatorSet : global::Com.Nineoldandroids.Animation.Animator {
The problem is, since AnimatorSet is inherited from Animator, I'm not sure why it should be a problem.
Are there any examples of binding NineOldAndroids for MonoDroid that you're aware of or know how to fix this?
These error messages are because C# doesn't support Covariant Return Types while Java ≥1.5 does.
Add these lines to Transforms/Metadata.xml:
<attr path="/api/package/class[#name='AnimatorSet']/method[#name='setDuration']" name="managedReturn">Com.Nineoldandroids.Animation.Animator</attr>
<attr path="/api/package/class[#name='ValueAnimator']/method[#name='setDuration']" name="managedReturn">Com.Nineoldandroids.Animation.Animator</attr>
I try to bind BugSense 3.0.5 to MonoDroid. I create a new Java Binding Library project, add the bugsense3.0.5.jar to the Jars-folder. I build it, and get the following error:
'Crash': member names cannot be the same as their enclosing type
The auto generate code:
[global::Android.Runtime.Register ("com/bugsense/trace/models/Crash", DoNotGenerateAcw=true)]
public partial class Crash : global::Java.Lang.Object, global::Java.IO.ISerializable {
[Register ("CRASH")]
public const int Crash = (int) 1;
So I need to rename the global variable "Crash" in the Metadata.xml- but how do I do that?
I have try:
<attr path="/api/package[#name='com.bugsense.trace.models']/class[#name='Crash']/field[#name='Crash']" name="managedName">mCrash</attr>
But it fails: matched no nodes
Fixed it renaming the class instead
<attr path="/api/package[#name='com.bugsense.trace.models']/class[#name='Crash']]" name="managedName">Crashed</attr>
You should always look for original fields name in java.
As i know it is lowerCamelCase. And it is probably hidden into setter/getter so you should search for /method[#name='getCrash']
I have a question concerning an Error I experience while trying to read an XML-File through the XNA 4.0 Content Pipeline in order to build Objects. First I reused old XNA 3.1 Code of mine which worked back in the day but now throws the an Error Message:
Building content threw InvalidOperationException: Instanzen von abstrakten Klassen können nicht erstellt werden. (Unable to build Instances of abstract Classes - roughly translated)
at ReflectionEmitUtils()
...and goes on forever, I can post it, if it's needed, but for better readability of my initial request..
Then I used this Method but it throws the same error.
These are the relevant pieces of source code:
I've written a class to define the content/structure of the XML-File:
public class Command
{
public List<bool> mButtons;
public List<Keys> keys;
public Enum iD;
}
And this is my XML File, with which I want to build Command-Objects
<?xml version="1.0" encoding="utf-8" ?>
<XnaContent>
<Asset Type="KinectRTS_Input.Command">
<mButtons>true/mButtons>
<keys>
<Item>LeftControl/Item>
</keys>
<iD>SMulti/iD>
</Asset>
</XnaContent>
(In my code, the Brackets are all correct, though since this Form processes XML-Tags...;))
I used a Test-Application in order to find out, which Format the XNA-Serializer uses to output List-Items and enums, so I'm reasonably sure, that there's not the error.
It looks like either your XML is invalid or your Model is. For the mButtons field, you have defined it as a List<bool> but in the XML it's a bool not a List<bool>. I would either edit the XML to have the <mButtons> element contain a single <Item> element or change the declaration of mButtons in the Model to be a bool not List<bool>.
Too easy...the problem wasn't with the Lists, in fact the Test-Application mentioned in my request actually returned XML-Tags with Item-Tags for the keys-List and without Item-Tags for the bool-list. Wrapping the bool into Item-Tags resulted in an " at not expected"-Error. I have no idea, why the Serializer handles List and List differently, though.
The problem was the Enum 'iD', which is an abstract class and thus throws the Error mentiones above. It seems that I was overwhelmed by the sheer size of the error-message and just disregarded the crucial bit of info - that the Serializer tries to build an abstract class.
But thanks anyway. – Kuroni Kaimei