First of all this issue only happens when I run the db4oTool against an assembly taregeting the Mono For Android profile, targeting a normal .Net class library works fine.
The issue: I am running the following command as a post build event:
Db4oTool.exe -tp -vv -debug -collections -by-attribute:DoNotDb4OEnhance -not $(TargetPath)
This results in the following error printed to the output window: (Full Log here)
Entering method 'System.Int32 Ats.Loto.Model.EnergyTagExtensions::GetNextTagNumber(System.Collections.Generic.IList
1<Ats.Loto.Model.EnergyTag>,Ats.Loto.Model.EnergyType)' System.NullReferenceException: Object reference not set to an instance of an object. at Db4oTool.TA.TACollectionsStep.<TAEnabledCollectionInstantiations>b__4(Instruction candidate) at Db4oTool.Core.InstrumentationUtil.<Where>d__0.MoveNext() at Db4oTool.TA.TACollectionsStep.InstrumentCollectionInstantiation(MethodDefinition methodDefinition) at Db4oTool.TA.TACollectionsStep.Process(MethodDefinition method) at Db4oTool.TA.TAInstrumentation.ProcessMethod(MethodDefinition method) at Db4oTool.Core.AbstractAssemblyInstrumentation.ProcessMethods(IEnumerable methods) at Db4oTool.Core.AbstractAssemblyInstrumentation.ProcessTypes(IEnumerable
1 types, Predicate1 filter, Action
1 action) at Db4oTool.Core.AbstractAssemblyInstrumentation.ProcessAssembly() at Db4oTool.Core.AbstractAssemblyInstrumentation.Run(InstrumentationContext context) at Db4oTool.Core.InstrumentationPipeline.Run() at Db4oTool.Program.RunPipeline(ProgramOptions options) at Db4oTool.Program.Run(ProgramOptions options) at Db4oTool.Program.Main(String[] args)
If I remove the -collections attribute it will work. I try to exclude the "EnergyTagExtensions" class with the
-by-attribute:DoNotDb4OEnhance -not
switches but it either has no effect or I'm doing it wrong.
Below is the class that I think is causing the db4otool to be unhappy based on the log.
[DoNotDb4OEnhance]
public static class EnergyTagExtensions
{
public static int GetNextTagNumber(this IList<EnergyTag> source, EnergyType activeEnergyType)
{
if (source.Count == 0)
return 1;
var concernedTags =
source.Where(c => c.TagId != null && c.TagId.StartsWith(activeEnergyType.Prefix)).OrderBy(
c => c.TagIndex).ToList();
if (!concernedTags.Any())
return 1;
return (concernedTags.Max(c => c.TagIndex) + 1);
}
}
Any ideas on how to get this working? Thanks in advance for any insight.