dataobjects-net
dataobjects-net copied to clipboard
Unable to remove backing field
Our team is getting random errors during build:
EXEC: Error XW0006 : Unable to remove backing field: type: MyType, property: MyProperty, field:
We are using Xtensive.Orm 6.0.11 with .net 4.7.2. We are also using Postsharp 2023.0.7
I've been able to attach te debugger to Xtensive.Orm.Weaver.dll: The issue seems to be that RemoveBackingFieldTask.GetBackingFieldName() is returning null.
private string GetBackingFieldName()
{
foreach (var instruction in property.GetMethod.Body.Instructions) {
if (instruction.OpCode.Code==Code.Ldfld) {
var field = (FieldReference) instruction.Operand;
return field.Name;
}
}
return null;
}
The contents of property.GetMethod.Body.Instructions seems to indicate the assembly was already processed wy the weaver
Arguments file passed to the weaver:
/type:.csproj
/backup
/stamp
/pdb
/input:C:\code\Solution\MyProject\obj\Debug\MyProject.dll
[SNIP]
And MyProject.dll from obj\Debug contains the ProcessedByWeaver attribute:
This error is a problem for us because the workaround is to clean, the build again the solution which takes 8 minutes because we have a big solution.
I'm not able to reproduce it every time : this error appears randomly. I suspect something in the build process when doing a partial build of the solution is causing the weaver to get as an input an assembly that is already weaved.
Do you think adding a condition in the weaver do to nothing if the file is already weaved could be a solution?
I have saved the content of an obj folder just before the error and the command to launch the weaver : I can share them privately if needed.