I have just upgraded to v8 of AutoMapper and the expression below fails but I really cannot see why.
cfg.CreateMap<string, Nmtoken>()
.ConstructUsing(i => new Nmtoken(i))
.ForMember(m => m.Token, o => o.MapFrom(s => s));
I believe that the passed expressions are valid. I get no build errors and intellisense is happy. But I get runtime error:
System.MissingMethodException: 'Method not found:
'AutoMapper.IMappingExpression`2<!0,!1>
AutoMapper.IMappingExpression`2.ConstructUsing(System.Func`2<!0,!1>)'.'
I'm happy to admit that I don't understand the error message.
Apologies. I have two projects linked with a dependency and one of them was still using AutoMapper 7.
I had the samme issue, but i was using AutoMapper v8.0.0.
Upgrading to version v8.1.0 solved the issue.
Related
We were using the automapper v5.0 in our code. In our create map statement, we had a statement ->
m.ResolveUsing((src, o, context) => (CodeObject)context.Options.Items["test"]))
When we upgraded the Automapper version to 5.1.1, we are getting build error in the above statement.
Can you please suggest how to correct this with latest version.
Finally i have got the answer after going through the automapper source code. We can do it this way:
m => m.ResolveUsing((src, o, destMemb, context) => (CodeObject)context.Items["test"]))
We have been building our application using groovy 2.3.6. Now because of some platform level issues we are advised to downgrade our groovy version to 2.2.1. I am facing no. of issues regarding this downgrade.
groovy is not able to infer the type of it variable in ver 2.2.1 so if i have code something like this
names.any { sliceName.endsWith(it) }
it gives me exception
[Static type checking] - Cannot find matching method java.lang.String#endsWith(java.lang.Object)
Secondly all the default method that i had used in collections no longer seem to exist
positions.any { it.primary }
groovy is unable to find the any method on list.
One way would be turn off static type checking, which will expose the code to a lot more runtime errors.
Is there any way to resolve these errors, without turning off static type checking. Also are these features only added in groovy 2.3.6 like default groovy methods and type inference for it variable
If you go back to an old version, old bugs will bite you.
Try giving the static compiler more of a hint
names.any { String it -> sliceName.endsWith(it) }
I have a puppet program that I'm trying to use stages in to better manage timing, but when I try that, nothing happens. I then tried to just use a dependency chain, but that throws back this error:
Error: Could not apply complete catalog: Found 1 dependency cycle:
(Anchor[apt::ppa::ppa:saltstack/salt] => Apt::Ppa[ppa:saltstack/salt] => class[Pp_package_manager] => Class[User_manager] => User_manager::User[coder] => User[coder] => File[/etc/default/perfectpitch] => Class[Pp_package_manager])
I'm trying to understand what this error is telling me, but the => signs are confusing the heck out of me. I also tried to open up the .dot file using the --graph flag, but that just confuses me as well. I'd love a guiedhttps://gist.github.com/supereman16/1ff46d6fbb1c7ac9b709.
I'd love a guide on how to interpret these and possibly some help with where the problem actually is. Any help will be greatly appreciated in helping me understand this error, and the steps I should take to find the problem and fix it. Thanks in advance!
Please read this article about relations and ordering in puppet.
In summary.
Puppet is a declarative language, where you describe a desired state of your system (not how to achieve it). So when it compiles manifests code to catalogue, it tries to establish order in which resources should be realized achieve desired state (it creates graph of dependencies).
E.g you cannot run mysql server unless you install mysql package.
Generally puppet properly solves relationships between resources. But sometimes it needs help. For each resource you can manually define relationship between other resources, using before, require, notify, subscribe metaparameters. Unfortunately, using these metaparameters you can easily create a cycle of dependencies.
E.g
file { a: require => File['b'] }
file { b: require => File['c'] }
file { c: require => File['a'] }
Such declaration of resources will create a cycle of dependencies causing compilation error similar to what you have.
It the message you provide, a => b means do resource a before resource b.
You got a cycle of dependencies: ...=> class[Pp_package_manager] => ... Class[Pp_package_manager].
I'm guessing you have defined relationships File[/etc/default/perfectpitch] => Class[Pp_package_manager] and class[Pp_package_manager] => Class[User_manager] , which causes an error.
java.lang.NoClassDefFoundError:
org/junit/internal/AssumptionViolatedException at
org.spockframework.runtime.JUnitSupervisor.error(JUnitSupervisor.java:92)
at
org.spockframework.runtime.BaseSpecRunner.invokeRaw(BaseSpecRunner.java:318)
at
org.spockframework.runtime.BaseSpecRunner.invoke(BaseSpecRunner.java:297)
at
org.spockframework.runtime.BaseSpecRunner.runSpec(BaseSpecRunner.java:90)
at
org.spockframework.runtime.BaseSpecRunner.run(BaseSpecRunner.java:81)
at org.spockframework.runtime.Sputnik.run(Sputnik.java:63) at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
I have a simple test case that calls a method,
def 'some test for empty Lists'(){
setup:
List<Object> clauses=new ArrayList<Object>()
when:
String someString=builder.buildString(clauses, "someName", "AND");
then:
noExceptionThrown()
someString==""
}
Assume builder is injected via spring. I can't make out why this happens. It happens only for a few test cases.
Any help is much appreciated :) I use spock 0.6 with groovy 1.8.
The solution for spock 1.0 with jUnit 4.12
As soon as I added hamcrest-core-1.3 to my test classpath the error disappeared.
What was the problem?
I observed the same error described in the question, but I managed to get spock 1.0 groovy 2.4 to work with junit-4.12.
The problem was that junit-4.12 depends on hamcrest.
In fact org.junit.internal.AssumptionViolatedException implements the interface org.hamcrest.SelfDescribing.
I've got the same error with spock tests using a simple Eclipse java project with these versions:
spock-core-1.0-groovy-2.3
junit-4.12
The exception was thrown only when there was a test failures, but was working for the successful ones
I've found that it was a Junit version compatibility matter. i resolved it using junit-4.7 and also tested the following versions:
junit-4.6 => ok
junit-4.5 => ok
junit-4.4 => ko
junit-4.0 => ko
Hope it helps
I had the same compatibility issue while trying to run my spocks in STS:3.6.4 and JBoss Developer Studio Version: 7.1.1.GA.
It was resolved using junit-4.7 instead of junit-4.12
Other instructions can be found at https://code.google.com/p/spock/wiki/GettingStarted#Eclipse
With a skeleton project with FirstView from HotTuna package, and with Build linker behavior set to "Link all assemblies", I get the following error:
System.MissingMethodException: Default constructor not found for type Cirrious.CrossCore.IoC.MvxPropertyInjector
Using NuGet package v3.1.1 for all MvvmCross (4 packages)
LinkerPleaseInclude file does have the line
[MonoTouch.Foundation.Preserve(AllMembers = true)]
Using the latest stable build:
On PC:
Xamarin for VS 1.12.278
Xamarin.iOS 1.12.278
Mac:
Xamarin.iOS 7.2.2.2
Of course with Linker behavior of SDK only, it runs fine. Any suggestions anyone?
Solved; So, with the basic project, there were three consecutive errors in the following order:
System.MissingMethodException: Default constructor not found for type Cirrious.CrossCore.IoC.MvxPropertyInjector
can be resolved either by --linkskip=Cirrious.Core (ugly), or by including the following in LinkerPleaseInclude.cs
public void Include(MvxPropertyInjector injector){
injector = new MvxPropertyInjector ();
}
Next error is:
Cirrious.CrossCore.Exceptions.MvxException: Failed to construct and initialize ViewModel for type {0} from locator MvxDefaultViewModelLocator - check MvxTrace for more information
This one is difficult; Simple fix is to ofcourse to do a --linkskip=portableLibrary, or to crate an instance of the ViewModel somewhere (perhaps in LinkerPleaseInclude.cs); problem with the second approach at-least in my case is, most of my VM doesn't have a parameter less constructor, and obviously using IOC in this case wouldn't help.
Final Error:
System.ArgumentNullException: missing source event info in MvxWeakEventSubscription
Parameter name: sourceEventInfo
Either use --linkskip=System (ugly), or add the following to LinkerPleaseInclude.cs
public void Include(INotifyPropertyChanged changed)
{
changed.PropertyChanged += (sender, e) => {
var test = e.PropertyName;
};
}
This was enough for my basic project to run with LinkAllAssemblies, Using LLVM optimizer, and Use SGen collector.
Hope this will help anyone looking for a solution.
I hit this when my XCode was out of sync with the latest Xamarin on my Mac. Upgrading XCode to the latest resolved the problem.