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

feat(dotnet): Support for JSII_DEBUG and JSII_RUNTIME #724

Merged
merged 10 commits into from
Aug 26, 2019
Merged

Conversation

assyadh
Copy link
Contributor

@assyadh assyadh commented Aug 20, 2019

Fixes #438

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@assyadh assyadh requested review from costleya and a team as code owners August 20, 2019 21:47
@mergify
Copy link
Contributor

mergify bot commented Aug 20, 2019

The title of this Pull Request does not conform with Conventional Commits guidelines. It
will need to be adjusted before the PR can be merged.

@assyadh assyadh changed the title Support for JSII_DEBUG and JSII_RUNTIME feat(dotnet): Support for JSII_DEBUG and JSII_RUNTIME Aug 20, 2019
Copy link
Contributor

@RomainMuller RomainMuller left a comment

Choose a reason for hiding this comment

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

👌🏻 - I'll approve once you've had a chance to look at my question here

RedirectStandardInput = true,
RedirectStandardOutput = true,
RedirectStandardError = true
}
};

_process.StartInfo.EnvironmentVariables.Add("JSII_AGENT", "DotNet/" + Environment.Version);
_process.StartInfo.EnvironmentVariables.Add(JsiiAgent, "DotNet/" + Environment.Version);
Copy link
Contributor

Choose a reason for hiding this comment

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

Any chance we can be more "accurate" than "DotNet"? Is it possible to get ideas of the framework build version or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, we do it in the SDK, will do the same here.

RomainMuller
RomainMuller previously approved these changes Aug 23, 2019
@@ -915,7 +915,7 @@ public void OptionalAndVariadicArgumentsTest()
[Fact(DisplayName = Prefix + nameof(JsiiAgent))]
public void JsiiAgent()
{
Assert.Equal("DotNet/" + Environment.Version.ToString(), JsiiAgent_.JsiiAgent);
Assert.Equal("DotNet/" + Environment.Version.ToString() + "/.NETStandard,Version=v2.0/1.0.0.0", JsiiAgent_.JsiiAgent);
Copy link
Contributor

Choose a reason for hiding this comment

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

What does it take for this to break? Does it need manual action (source change somewhere else)? Or can it change just by getting updated toolkit?

Copy link
Contributor Author

@assyadh assyadh Aug 23, 2019

Choose a reason for hiding this comment

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

An update to the framework that your app is targeting.

There is no 'clean' way to get the running .NET Core version:

https://weblog.west-wind.com/posts/2018/Apr/12/Getting-the-NET-Core-Runtime-Version-in-a-Running-Application

I could just test that it StartsWith("DotNet")?

Copy link
Contributor

Choose a reason for hiding this comment

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

As an aside, were we not going to change to core 2.1 target?

Standard is great, except it makes it look like we support framework - and I don't even really want to give developers that option.

@@ -915,7 +915,7 @@ public void OptionalAndVariadicArgumentsTest()
[Fact(DisplayName = Prefix + nameof(JsiiAgent))]
public void JsiiAgent()
{
Assert.Equal("DotNet/" + Environment.Version.ToString(), JsiiAgent_.JsiiAgent);
Assert.Equal("DotNet/" + Environment.Version.ToString() + "/.NETStandard,Version=v2.0/1.0.0.0", JsiiAgent_.JsiiAgent);
Copy link
Contributor

Choose a reason for hiding this comment

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

As an aside, were we not going to change to core 2.1 target?

Standard is great, except it makes it look like we support framework - and I don't even really want to give developers that option.

var assemblyFileVersionAttribute = assembly.GetCustomAttribute(typeof(AssemblyFileVersionAttribute)) as AssemblyFileVersionAttribute;
var frameworkAttribute = assembly.GetCustomAttribute(typeof(TargetFrameworkAttribute)) as TargetFrameworkAttribute;
return new Tuple<string, string>(
frameworkAttribute == null ? "Unknown" : frameworkAttribute.FrameworkName,
Copy link
Contributor

Choose a reason for hiding this comment

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

frameworkAttribute?.FrameworkName ?? "Unknown"

:P This is just a nit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor Author

@assyadh assyadh left a comment

Choose a reason for hiding this comment

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

On the 2.1 target, this issue was created last week: #714

@mergify
Copy link
Contributor

mergify bot commented Aug 26, 2019

Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it!

@mergify mergify bot added the pr/ready-to-merge This PR is ready to be merged. label Aug 26, 2019
@mergify mergify bot merged commit 1816740 into master Aug 26, 2019
@mergify mergify bot removed the pr/ready-to-merge This PR is ready to be merged. label Aug 26, 2019
@mergify mergify bot deleted the hamzaad/misc branch August 26, 2019 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dotnet: Respect JSII_RUNTIME and JSII_DEBUG
3 participants