I have a variant (v1) in a language A and another variant (v2) in another language B. Both of those variants are created in master language C and published in master and respective languages.
When I retrieve all variant as given below in language A or B, everything including contentlink is fine._contentRepository.GetChildren<Variant>(contentLink);
If I am at language B and retrieve all variant from A as well (or vice versa) as given below, I get proper content link v2 but for v1 I get content link of master language.foreach(var culture in cultures)_contentRepository.GetChildren<Variant>(contentLink, new CultureInfo(culture));
Even if I try to resolve as below, it does not work. GetUrl gives proper string url but could not get contentreference.ContentReference.Parse(_urlResolver.GetUrl(v1.ContentLink, culture))
That scenario you've described sounds like the correct behaviour to me.
"I have a variant (v1) in a language A and another variant (v2) in another language B"
"If I am at language B and retrieve all variants..... I get proper content link v2 but for v1 I get content link of master language".
You will get the master language because for variant v1 isnt available in that language. If you navigate to v1 in EPiServer, and access language B from the available languages (in the all property view), does EPiServer prompt you to create a language branch for that variant, in that language?