-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Make sure references are readable multiple times #2461
Conversation
Hi @Alxandr, I'm your friendly neighborhood Microsoft Open Technologies, Inc. Pull Request Bot (You can call me MSOTBOT). Thanks for your contribution! The agreement was validated by Microsoft Open Technologies, Inc. and real humans are currently evaluating your PR. TTYL, MSOTBOT; |
We actually already have code sitting around for a stream implementation that wraps a stream and prevents disposal. That would avoid creating the extra copy. |
So not really sure which would be smaller. |
It's the This might be irrelevant anyway, would this be accessed concurrently or re-entrantly? If that's the case what you're doing is necessary. |
I don't know. Depends if dnx locks emits or not. Though it's the Roslyn immutable api that consumes it, so it might be expected to be parallizable |
Hi @Alxandr, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution! TTYL, DNFBOT; |
@Alxandr, Thanks for signing the contribution license agreement so quickly! Actual humans will now validate the agreement and then evaluate the PR. |
cc @davidfowl . AFAIK it does. |
Could I get some more feedback here? Do you want me to change it to use |
Could we perhaps start by re-seeking the stream: We can change it to create a new stream if we do see issues during compilation. |
@pranavkm No, because it's disposed by roslyn (ie, roslyn uses it in a |
Ok, that makes sense. One of the things @DamianEdwards wants to discuss as part of the precompilation discussion today is to determine if we should conditionally precompile views (as part of release \ prod builds, deployment) rather than attempting to support it at dev time. If we decide this is the way forward, the extra allocation here would be less of a concern. Let's wait until #2463 (comment) is completed to figure out how to proceed with this work item. |
Is there any good reason this is still being held off? |
Nope. I just haven't gotten around to getting this in. That said, I think switching to |
Do the non disposable stream reset position on every use? On Tue, Aug 11, 2015, 18:50 Pranav K [email protected] wrote:
|
Nope. All it does is no-op the Dispose. I guess it would look like:
|
This would completely break in parallel though... But that might not be an On Tue, Aug 11, 2015, 19:51 Pranav K [email protected] wrote:
|
@Alxandr, I guess we would have similar issues if the stream was being read in parallel now. |
@pranavkm Yeah, it can't be read in parallel, but you can request multiple in parallel, and read them by themselves. Inside Roslyn these streams are used as |
Let's start with assuming they don't get requested in parallel. We could always fix this later on. |
Yeah, that's probably reasonable. Though, given that this is literally just On Wed, Aug 12, 2015, 23:38 Pranav K [email protected] wrote:
|
👍 |
Merged in 39ab9ba |
When you reference a project containing precompiled Razor views from a project that uses a custom compiler (like F#), the result is often that the project get's compiled multiple times. Roslyn closes the resource streams when it's done with them, so therefore just using a single
MemoryStream
ends up withObjectDisposedException
on the second compilation. This commit fixes that.