This question concerns Switzerland, but I suppose this can apply to many countries with similar rules.
When a foreigner (non-CH or EU citizen) applies for a student (B) permit, this person has to provide a written formal commitment to leave the country once the studies are over.
If the person, during the studies, decides to get married with a Swiss citizen, and later on requests a B permit allowing the spouses to live together, could the previous commitment be a problem in any way ? For example, could the authorities refuse to recognize/perform the marriage because it would break such commitment ? Or, after the marriage, refuse the B permit usually provided to Swiss citizen's spouse, for the same reason ?
I did not find anything about this online. I know exactly what is required for the student permit application form, as well as for the marriage, but did not find anything that directly answers this question.