Fody/PropertyChanged

Specify namespace for <>PropertyChangedEventArgs

tranb3r opened this issue ยท 8 comments

Today, the "<>PropertyChangedEventArgs" class is created in the root namespace of the assembly.
Could it be created within a specific namespace instead (for example the default namespace for the assembly) ?
Use-case: when merging several assemblies that have been processed by fody.propertychanged, the corresponding "<>PropertyChangedEventArgs" classes conflict in the merged assembly.

I'd rather use Fody.[assembly name] as the namespace (that would be more reliable, and Fody does not provide the default namespace information to its addins).

But IL merging could still easily fail for other reasons, for instance if you activate nullable reference types (the compiler will synthesize attributes). So I'm not sure making IL merging easier is a good idea anyway.

This is now deployed. NuGet may take some time to make it available for download.

@SimonCropp
Thanks for the quick fix !
Would it be possible to the same kind of change for the "ProcessedByFody" type ? (in Fody repo, not in PropertyChanged repo)

now that i think about it doesn ILMerge handle conflicts for non public types automatically?

For private types, this is not a problem since no outside client can see it anyway, so ILMerge just does the renaming by default.

https://github.com/dotnet/ILMerge/blob/master/ilmerge-manual.md

Actually, I'm not using ILMerge, but Babel Obfuscator, which has its own algorithm for merging assemblies.
The conflict is handled properly by Babel, but it raises a warning (found duplicate type in merged assembly). I can ignore it, but I'd rather not hide it, because for sure if this happens in my own code, I'd like to know about it.
Anyway, I still think it would be better to group inside their own unique namesapce the classes generated by fody.

fair enough. i will look at fody marker type tomorrow.

new version of Fody pushed