Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Edit and Continue with Windows host to Linux container #8173

Closed
scottaddie opened this issue Jul 30, 2018 · 6 comments
Closed

Edit and Continue with Windows host to Linux container #8173

scottaddie opened this issue Jul 30, 2018 · 6 comments
Assignees
Labels
3 - Done bug cost: S Will take up to 2 days to complete PRI: 1 - Required Must be handled in a reasonable time

Comments

@scottaddie
Copy link
Member

Moved from dotnet/AspNetCore.Docs#7707. See that issue for more context. Originally opened by @djhmateer. /cc: @mkArtakMSFT

I've been unsuccessful getting Edit and Continue mentioned above working.

Windows 10 host to Linux container using ASP.NET Core 2.1 being able to update a .cshtml and see the changes in the browser (after doing F5 in browser) without doing a Ctrl F5 in Visual Studio.

Details of what I did are in: https://stackoverflow.com/questions/51441893/visual-studio-2017-docker-edit-and-continue


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@pranavkm
Copy link
Contributor

pranavkm commented Aug 4, 2018

The issue is an side effect of the way ActionDescriptorCollectionProvider listens for changes. On a Linux based docker container, the file system watching is passive i.e. IChangeToken.ActiveChangeCallbacks = false. The ChangeToken.OnChange pattern that we rely in here does not account for passive IChangeToken instances. A possible fix for this would be to stash the result of GetCompositeChangeToken() and query if it's different. Alternatively, we could modify ActionDescriptorCollectionProvider.ActionDescriptors to always update the collection on demand. E.g.

public ActionDescriptorCollection ActionDescriptors
{
    get
    {
        if (_collection == null || _changeToken.HasChanged)
        {
            UpdateCollection();
            _changeToken = GetChangeToken();
        }

        return _collection;
    }
}

@pranavkm
Copy link
Contributor

pranavkm commented Aug 4, 2018

@djhmateer, you could try using a custom implementation of IActionDescriptorCollectionProvider as a workaround until we've addressed this in the framework. Here's what you'd do:

services.AddSingleton<IActionDescriptorCollectionProvider, PollingActionDescriptorCollectionProvider>();
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

I was able to verify locally that this addressed the issue you were seeing.

@mkArtakMSFT mkArtakMSFT added the PRI: 1 - Required Must be handled in a reasonable time label Aug 6, 2018
@mkArtakMSFT mkArtakMSFT added this to the 2.2.0-preview2 milestone Aug 6, 2018
@djhmateer
Copy link

Many thanks @pranavkm. The https://gist.github.com/pranavkm/10759ca15205c49e94ecd8739ae3a44a link gave me a compile error: Method must have a return type. I'm not quite sure how to resolve.

public ActionDescriptorCollectionProvider1(
IEnumerable actionDescriptorProviders,
IEnumerable

@scottaddie
Copy link
Member Author

@djhmateer Looks to me like that should be a constructor. Try the following constructor signature:

public PollingActionDescriptorCollectionProvider (
            IEnumerable<IActionDescriptorProvider> actionDescriptorProviders,
            IEnumerable<IActionDescriptorChangeProvider> actionDescriptorChangeProviders)

@pranavkm
Copy link
Contributor

pranavkm commented Aug 7, 2018

Yup, @scottaddie got it right. Fixed the gist with the correct type name.

@djhmateer
Copy link

@scottaddie and @pranavkm much appreciated - yes I can confirm that this works. Very interesting and thank you for the explanation.

@pranavkm pranavkm added the cost: S Will take up to 2 days to complete label Aug 10, 2018
pranavkm added a commit to aspnet/FileSystem that referenced this issue Aug 21, 2018
The ChangeToken.OnChange pattern that's commonly used by providers to listen to
changes requires IChangeToken to be active. The only two instances in the framework
that does not support are the PollingChangeToken.

This change makes the polling be active unless configured otherwise.

Fixes aspnet/Mvc#8173
pranavkm added a commit to aspnet/FileSystem that referenced this issue Aug 22, 2018
The ChangeToken.OnChange pattern that's commonly used by providers to listen to
changes requires IChangeToken to be active. The only two instances in the framework
that does not support are the PollingChangeToken.

This change makes the polling be active unless configured otherwise.

Fixes aspnet/Mvc#8173
pranavkm added a commit to aspnet/FileSystem that referenced this issue Aug 22, 2018
The ChangeToken.OnChange pattern that's commonly used by providers to listen to
changes requires IChangeToken to be active. The only two instances in the framework
that does not support are the PollingChangeToken.

This change makes the polling be active unless configured otherwise.

Fixes aspnet/Mvc#8173
pranavkm added a commit to aspnet/FileSystem that referenced this issue Aug 23, 2018
The ChangeToken.OnChange pattern that's commonly used by providers to listen to
changes requires IChangeToken to be active. The only two instances in the framework
that does not support are the PollingChangeToken.

This change makes the polling be active unless configured otherwise.

Fixes aspnet/Mvc#8173
pranavkm added a commit to aspnet/FileSystem that referenced this issue Aug 28, 2018
The ChangeToken.OnChange pattern that's commonly used by providers to listen to
changes requires IChangeToken to be active. The only two instances in the framework
that does not support are the PollingChangeToken.

This change makes the polling be active unless configured otherwise.

Fixes aspnet/Mvc#8173
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3 - Done bug cost: S Will take up to 2 days to complete PRI: 1 - Required Must be handled in a reasonable time
Projects
None yet
Development

No branches or pull requests

4 participants