Do sellers of source code in the form of a source code library open themselves up to a lawsuit from software patent holders? 

For example, you have written a library of extension methods to the .NET framework classes. Which you sell for $100. A software patent holder looks at your code and sees that you are inadvertently using an algorithm that is covered by their patent. The software patent holder then says they want $100 for every sale of your code. Or they say you cannot distribute your code at all.

Does this sort of thing happen?