Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key needs to be greater than 0 - possible error when running task multiple times #27

Open
mpseidel opened this issue May 10, 2019 · 3 comments

Comments

@mpseidel
Copy link

mpseidel commented May 10, 2019

This error in ILMerge can occur when using the build task multiple times in the same build.

In our case we had about 10 projects in a solution that needed to be merged individually. As the build task loads the ILMerge assembly once into the build process and ILMerge uses statics this can lead to the error Key needs to be greater than 0 explained in more detail in the referenced issue.

Our workarround was to turn on BuildInParallel and setting -maxcpucount > 1 which reduced the number of merge operations per msbuild process.

As

it [ILmerge] was definitely written as a console application that would run once and then terminate.

I would suggest a) allow the option to spawn a new ILMerge process per merge operation or b) load ILMerge into a secondary AppDomain and unload it after the merge or c) maybe consider a upstream fix if possible.

This issue has caused us quite some pain as builds were failing seemingly randomly so I hope someone else finds this and can save themselves some headache.

@emerbrito
Copy link
Owner

Thanks a bunch for investigating the issue and taking the time to post it here.
I went trough the ticket you provided in the ILMerge project and it is very helpful - looks like you guys covered it in details in there.

I will see what I can do here and get back to you.

@emerbrito
Copy link
Owner

Just wanted to let you know I'm still looking into this. Hopefully will be able to get to a conclusion in a few weeks.

@mpseidel
Copy link
Author

mpseidel commented Jun 19, 2019

Thats great to hear. Even though we are using multiple msbuild processes now yesterday we ran into the error again. Good thing is this led us to do an overdue depenency reorganization which reduced the amount of merging work but still would be great to know this is solved for good at some point :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants