Search code examples
c#obfuscationobjectlistview

How to make ObjectListView work in obfuscated code?


ObjectListView stops working when i obfuscate the code. The issue seems to be centred around using AspectName to set the column in MainForm.designer.cs
E.g:

this.olvColumn1.AspectName = "Name";

The Obfuscator could be renaming all my methods. Any advice on how to fix this issue?


Solution

  • AspectName is obviously using the name of the property, which is defeated by obfuscating.

    You'll have to install an AspectGetter delegate instead:

    this.olvColumn1.AspectGetter = delegate(object x) {
        return ((YourModelClass)x).Name;
    }