Skip to content

make sure OOP inherit same culture as VS otherwise culture sensitive …#24332

Merged
heejaechang merged 2 commits intodotnet:dev15.6.xfrom
heejaechang:OOPCulture2
Jan 19, 2018
Merged

make sure OOP inherit same culture as VS otherwise culture sensitive …#24332
heejaechang merged 2 commits intodotnet:dev15.6.xfrom
heejaechang:OOPCulture2

Conversation

@heejaechang
Copy link
Copy Markdown
Contributor

…resource such as xml doc comment will not work properly

Customer scenario

User sets VS language to something else than system language (culture), but in some cases, still get descriptions such as xml documment or diagnostic description in system language in some features

Bugs this fixes

#24317

Workarounds, if any

there is no workaround

Risk

the fix is quite straight forward. and low risk

Performance impact

I don't see any impact on perf

Is this a regression from a previous update?

No

Root cause analysis

Roslyn out of process didn't set default culture for its app domain and use default system culture when VS supports setting different culture than system culture.

How was the bug found?

Dogfooding, customer report

@heejaechang heejaechang requested a review from a team as a code owner January 19, 2018 00:01
@heejaechang heejaechang changed the base branch from master to dev15.6.x January 19, 2018 00:02
@heejaechang
Copy link
Copy Markdown
Contributor Author

@dotnet/roslyn-ide @jinujoseph @Pilchie can I get code review and approval for 15.6? quite simple change.

@heejaechang
Copy link
Copy Markdown
Contributor Author

@NTaylorMullen I am fixing it in 15.6 branch. is that okay?

@heejaechang
Copy link
Copy Markdown
Contributor Author

@jinujoseph @NTaylorMullen which release should this go? right now I targeted it to dev15.6.x which I believe is for next preview?

@NTaylorMullen
Copy link
Copy Markdown

NTaylorMullen commented Jan 19, 2018

@NTaylorMullen I am fixing it in 15.6 branch. is that okay?

15.6 is totally fine for us.

var uiCultureLCIDE = 0;
var cultureLCID = 0;

var host = await instance._rpc.InvokeAsync<string>(nameof(IRemoteHostService.Connect), current, uiCultureLCIDE, cultureLCID, telemetrySession).ConfigureAwait(false);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you change the culture within a VS session? How does that get propagated to the remote host?

Copy link
Copy Markdown
Contributor Author

@heejaechang heejaechang Jan 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a mock for testing. this code path just ignore culture.

Copy link
Copy Markdown
Contributor Author

@heejaechang heejaechang Jan 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah. mis-understood your question. no you can't change culture within VS session. you need to re-open VS.

// make sure connection is done right
var host = await client._rpc.InvokeWithCancellationAsync<string>(
nameof(IRemoteHostService.Connect), new object[] { current, TelemetryService.DefaultSession.SerializeSettings() }, cancellationToken).ConfigureAwait(false);
nameof(IRemoteHostService.Connect), new object[] { current, uiCultureLCID, cultureLCID, TelemetryService.DefaultSession.SerializeSettings() }, cancellationToken).ConfigureAwait(false);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is real one. and RemoteHostService set culture of OOP same as VS one which we got here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well. I could change CultureInfo.CurrentUICuture to CultureInfo.DefaultCurrentUICuture.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would that help? If the VS culture changes, that's not going to update the CultureInfo.DefaultCurrentUICuture.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just saying changing CultureInfo.CurrentUICuture to CultureInfo.DefaultCurrentUICuture since someone could have changed current threads culture.

not sure what you mean by

How would that help?

about

If the VS culture changes, that's not going to update the CultureInfo.DefaultCurrentUICuture.

you can't change VS culture without close and re-open VS, so I don't need to monitor VS culture setting change.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. For some reason I didn't realize it required a restart.

@Pilchie
Copy link
Copy Markdown
Member

Pilchie commented Jan 19, 2018

Tagging @tmeschter as a "World Ready" issue.

// report exception
WatsonReporter.Report(ex);

// ignore expected exception
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they are expected, why are we reporting them to Watson?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still want to see how often VS uses wrong LCID and what LCID it uses.

// report exception
WatsonReporter.Report(ex);

// ignore expected exception
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they are expected, why are we reporting them to Watson?

@heejaechang
Copy link
Copy Markdown
Contributor Author

@Pilchie let me know if there is something you want me to change.

@Pilchie
Copy link
Copy Markdown
Member

Pilchie commented Jan 19, 2018

Approved - this will show up in 15.6 Preview 4.

@heejaechang heejaechang merged commit a9679c5 into dotnet:dev15.6.x Jan 19, 2018
@sharwell sharwell added this to the 15.6 milestone Jan 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants