That's what happened to me.
I came to US with a B2 visa and told CBP that I was going to get married and go back because I was working.
He was not happy and start saying that was illigal and I should have come with a K1 visa, but he didn't believe and had to check.
They took me to a room where I waited for a while, saw two families in there (one was released and the other one looked like they'd be deported). I got really anxious/nervous/etc, but I stayed calm and when it was my turn the guy in there just asked couple questions and said I could go. I visited one more time before we filed the I-130 and this is the first time I'm visiting while the I-130 is processing.