-
Notifications
You must be signed in to change notification settings - Fork 15
Tool produces a 0-byte binary when compilation fails #35
Comments
Is this really a bug in precompilation (we always create a stream for the PE file?), or is it possibly a bug on Roslyn or something? |
It's the former. Compilation errors are exposed as part of emitting the binary and we create a file stream to emit it. I'll have a look at what csc does to see if there's a better way to do this. |
Looks like they're using API's not publicly available to produce diagnostics without having a Stream (https://github.com/dotnet/roslyn/blob/2d871994b396f7ceca6722464f5b8c85905b343e/src/Compilers/Core/Portable/Compilation/Compilation.cs#L1643). I'll just remove the file in the event compilation fails. |
Eh that's ugly. Can we get a recommendation from Roslyn on how to do this? |
I can ask. The other alternative is to write to a memory stream (which is what we do at runtime) and copy to disk if it's successful. |
DNX used the |
I think I prefer that. Write to disk only when it's safe. |
@Eilon could we consider this for 1.1.1? The experience without this change is pretty bad. @DamianEdwards seemed interested in this |
Let's get this into 1.2.0 as you have it, and log a new bug for 1.1.1 to track porting this. |
Steps:
int x = "Hello world";
)dotnet-razor-precompile
on the app with the right arguments.Expected:
View compilation fails and no
.Precompiled.dll
binary is produced.Actual:
View compilation fails and a 0-byte binary is produced.
The text was updated successfully, but these errors were encountered: