Conversation
- Mark as IsAotCompatible true - Use AssemblyFileVersionAttribute instead of FileVersionInfo
|
What needs to be done to show that it works with AOT? As I don't use any AOT features, would you like to add a small app that would fail if this PR weren't applied? Then I'm pretty sure that if I make changes in the future, I won't break this PR. |
|
Wow, quick reply :D Best case, all the unit tests could be published to an AOT executable, which could then be run like a normal program. This is how xunit.v3 does it, for example. I haven't worked with NUnit much, but it seems like AOT support is missing. I also tried to get it to work locally, but it looks like the issues start with the use of reflection during test discovery and continue with the dynamic code generation for parameterized tests, ... I don't think that switching to xUnit makes a lot of sense for this project, so I added the AOT smoke test. In the future it should be enough to
|
First of all, thank you for maintaining this great alternative SerialPort library. We publish our apps with AOT, and while this works for now, I wanted to add some analyzers that help discover misuse.
The only thing that seems to be incompatible right now is the
WinNativeSerial.Versionproperty, which returns no version when you compile for a single executable (because then there is no assembly file to find the version for). To fix this, I am using theAssemblyFileVersionAttributewhich returns the same Version information (see the tests included here).The tests are more a demonstration that the change works; I am happy to remove them from the PR.