-
-
Notifications
You must be signed in to change notification settings - Fork 1k
DNX451 support #87
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
DNX451 support #87
Conversation
…uto-generated files that are created during tests execution
…oft.Dnx.Compilation, no dependency to msbuild/bat. NOT working yet!
… to compile. works but is kind of hardcoded
… DNX451 of IntegrationTests
…text (assembly version contains only numbers)
…tFoundEx when trying to delete dir after calling .Exists()
…lder that compiler is fine with it
… (at least from VS/xUnit)
…oject.json simplification
…and affinity. For DNX we start cmd.exe that starts dnx.exe that starts our auto-generated program. Since high priority is not inherited in Windows, we need to do this
@AndreyAkinshin Sorry for this! I can see that dotnet cli has changed the paths. I will push a fix asap |
@adamsitnik, don't worry, it is fine. After this fix, I will merge it and publish v0.9.2 (no new features, only DNX support). |
… outputpath on our own to be independent and check whether the exe exists
@AndreyAkinshin Thanks! But I can imagine that it was not the best impression if first sample has failed to execute ;) There were few changes in dotnet cli that caused troubles:
|
I successfully run it a few weeks ago, so, don't worry. =) However, we still have some troubles. Try to do the following things:
It doesn't work on my machine. =( |
@AndreyAkinshin what error are you getting? Does it fail to restore nuget package, to build the app or to run it? I just tried to reproduce, and it worked. But I have faced some weird issues with caching of the old local nuget packages. What I did:
|
Here is my log:
I looks that generate and build stages work fine: I have an executable |
Thanks for the log. I will implement some kind of debug/trace mode for dnx toolchain. We will probably need it for user bug reports. Just one more question: is the executable located in "ConsoleApp2..\Md5VsSha256_Md5\binaries" folder? |
Full path: |
With my latest changes the folder structure should be like this:
The exe from dnx451 folder should fail. The executable from binaries folder is the only one runnable. Do you have this folder? If not, then could you try to repeat the nuget-cleanup step from my previous post? |
Here is my tree:
I tried to remove BDN from |
Thanks for the detailed info. Now I am sure, that 0.9.2 is somewhere cashed on your machine without my recent fixes, which affect output folder structure (new folder called binaries should appear). The easiest test would be to change the version number locally, let's say 0.9.3, deploy it to local nuget feed and change your test app to use 0.9.3. |
Yes, you are right! I changed package version and now everything works great. It is very interesting, where NuGet keeps local cache. I want to play a little bit more with DNX version of BDN. If everything is fine, I will merge your branch tomorrow. |
Great! I am very happy to hear that! Please let me know if there are any more bugs or unclear things. |
Finally merged with master! |
@AndreyAkinshin Awesome! Thank you for your trust in me! I have just merged master into develop and added unit test for GCDiagnosers to make sure it works with both DNX and CLASSIC. |
Cool, thanks! |
Ok, great! As for the CoreCLR, I need 1-2 days for development. The only problem I have is that I am a total newbie with Unix based OS, so I am not sure how long testing will take for me. |
My second OS is Linux, so, I can help you with testing. =) You can create a new |
Cool! I will do that. Do you @AndreyAkinshin or @mattwarren plan to do some huge refactoring in the upcoming week? My Core changes will affect mostly all calls to Reflection methods and project.json files. |
I can wait. |
same here Or at least I'll make sure I only check-in code under the Diagnostics project, so it won't be a problem. |
Introduction to DNX
I start with some short introduction since the idea of Cross-Platform .NET is quite fresh.
DNX stands for Dot Net eXecution environment. It lets us restore Nuget packages, compile the code and execute it with native CLR Host. Some good introduction can be found here.All that aims at cross-platform .NET. A very modularized .NET to be honest!DNX451 is a DNX SDK running on .Net 4.5.1 (Desktop CLR / Full BCL and FCL). So it is not Cross-Platform yet, which NETCORE aka DNXCORE50 is.
To me DNX451 support is just a huge step forward for NETCORE support, which it the cool thing we aim for ;)
Changes in .NET applications development:
We need DNX toolchain to be installed link. It contains of . NET Version Manager (DNVM) and DNX. Once installed, we can get our hands on latest runtime with simple „dnvm upgrade” command. „dnvm update-self” is also worth to mention.dnudotnet restore”. Sometimes VS will do this for you (currently VS is still using dnu), sometimes you will have to do this on your own.Dnu is just an alias for a part of Dnx.dnxdotnet run”. Run is just a command in your project.json file.Program’s startup seems to be longer to me now. If you set DNX_TRACE to 1 then you get detailed status updates from DNX. That explains a lot! (I created dedicated VS profile for BDN for this to make troubleshooting easier)Failed PoC:
How it works
I have built a new toolchain that relies on the classic one. In order to reuse as much code as possible, most of the new classes just inherit from the existing ones.
dnudotnet restore command is being executed. It is just a new „nuget restore”. It produces project.lock.json file.CHANGE: Instead of compiling code and emitting assembly and then running it, a dnx run command is being executed. It does all that with single command and in memory (no .dll file). The disadvantage of doing it in memory is that we have to compile it with each iteration.CHANGE: I have changed the way how console output is being read. Instead of while(output.ReadLine() != null) I used events. I have also added reading of error output. This might give us more detailed informations on errors.Tricky things
dnudotnet restore” working when executing in VS/xUnit runner I had to put the auto-generated project.json file closer to VS solution folder root (DnxGenerator. GetDirectoryPath).The other thing to get it running was to switch between dependency to BenchmarkDotNet project and package. When developing, we want our auto-generated program to get code from project, but when we are at production, then we want to it from the official nuget( BenchmarkDnxGenerator.GetTargetType()). I have relied it on the existing convention of AssemblyTitleAttribute ending with „-Dev”.To get „dnx run” working I had to define the compiler in project.json in explicit way (roslyn). When it was using the default compiler (DesignTime) it had differnt configuration and was unable to resolve dependencies.To get the x86/x64 working I had to tell dnvm to use exact processor architecture (BenchmarkDnxExecutor. BuildParameters)To ensure the high priority and right affinity in scenario where instead of starting single process I startcmd.exe that starts dnx.exedotnet.exe that starts the program I set these at Program.Main of the autogenerated program. This is because HIGH_PRIORITY is not inherited by child processes in Windows linkHow to test
It all seems crazy, but faking the nuget repo needs to be done only now, for testing the solution before official nuget package release. And the whole dnu/dxn/dotnet thing is just the new way of executing .NET apps so the rest will be no suprise to the users.
How to debug:
Please start testing, and do not hesitate to ask.
I think that if you accept this this PR I will remove existing .csprojs and old solution.I can also squash the commits if you want. I left it this way just to keep the history.