Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script compilations created from a previous compilation have incorrect return type #17403

Closed
abock opened this issue Feb 26, 2017 · 0 comments · Fixed by #17404
Closed

Script compilations created from a previous compilation have incorrect return type #17403

abock opened this issue Feb 26, 2017 · 0 comments · Fixed by #17404

Comments

@abock
Copy link
Contributor

abock commented Feb 26, 2017

We are now finally able to use the Roslyn 2.0 NuGet for Xamarin Workbooks, which means I can finally leverage my work for supporting compilations against a target (not host) corlib.

Unfortunately the tests I wrote for that fix were not extensive enough to catch an issue where subsequent compilations result in an implicit reference to host corlib and not the target corlib.

This is due to the implementation of ScriptCompilationInfo.ReturnType, which was desired to never return null:

public Type ReturnType => ReturnTypeOpt ?? typeof(object);

I did not catch all the places in Roslyn that were using ReturnType but should now be using ReturnTypeOpt:

  • CSharpScriptCompilationInfo.WithPreviousScriptCompilation
  • CSharpCompilation.WithScriptCompilationInfo
  • VisualBasicScriptCompilationInfo.WithPreviousScriptCompilation
  • VisualBasicCompilation.WithScriptCompilationInfo

This is how the bug ends up manifesting in Workbooks:

screen shot 2017-02-26 at 3 44 52 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants