JavaScriptServices icon indicating copy to clipboard operation
JavaScriptServices copied to clipboard

Recieving "Can't resolve all parameters for HttpXsrfCookieExtractor" after you add some files to the app folder. (Angular)

Open elAndyG opened this issue 9 years ago • 6 comments

I've tried multiple projects in both VS Code using the dotnet new, as well as the Visual Studio 2017 Angular templates for Angular. Once i begin adding new files to the app folder, it seems fine and hot modules properly. But once i stop the build and start it again, I receive the following error:

NodeInvocationException: Can't resolve all parameters for HttpXsrfCookieExtractor: (?, [object Object], [object Object]). Error: Can't resolve all parameters for HttpXsrfCookieExtractor: (?, [object Object], [object Object]). at Error (native) at syntaxError (C:\toolkit3\ClientApp\dist\vendor.js:37092:34) at CompileMetadataResolver.module.exports.CompileMetadataResolver._getDependenciesMetadata (C:\dummy\ClientApp\dist\vendor.js:51159:35) at CompileMetadataResolver.module.exports.CompileMetadataResolver._getTypeMetadata (C:\dummy\ClientApp\dist\vendor.js:51027:26) at CompileMetadataResolver.module.exports.CompileMetadataResolver._getInjectableMetadata (C:\dummy\ClientApp\dist\vendor.js:51013:21) at CompileMetadataResolver.module.exports.CompileMetadataResolver.getProviderMetadata (C:\dummy\ClientApp\dist\vendor.js:51304:40) at C:\dummy\ClientApp\dist\vendor.js:51233:49 at Array.forEach (native) at CompileMetadataResolver.module.exports.CompileMetadataResolver._getProvidersMetadata (C:\dummy\ClientApp\dist\vendor.js:51193:19) at CompileMetadataResolver.module.exports.CompileMetadataResolver.getNgModuleMetadata (C:\dummy\ClientApp\dist\vendor.js:50848:50) Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance+d__7.MoveNext()

**Is there something with webpack that i need to reset, or does this seem like a bug? **

Steps to reproduce:

  1. cmd to c:\
  2. dotnet --version 2.0.0
  3. mkdir dummy
  4. cd dummy
  5. dotnet new angular
  6. dotnet restore
  7. npm install
  8. dotnet run

start copying or adding files into the app/ folder.

kill the build

trigger dotnet run again...

I think i've done 5 straight new projects and have been able to reproduce it each time. Please let me know if i can supply you with any additional information.

elAndyG avatar Aug 30 '17 18:08 elAndyG

I did some more research, and it looks like it cannot update to version 4.3.0+ (currently trying to update to 4.3.6.) so if you update the @angular items in package config to 4.3.6 this error will immediately trigger. It also refers to this module here. https://angular.io/api/common/http/HttpClientXsrfModule.

I will move this issue over to the aspnet/templates sp please feel free to close this ticket as i believe i reported this in the wrong area.

elAndyG avatar Aug 30 '17 23:08 elAndyG

same problem

Writing some code with angular and .NET is really an hell

Trapulo avatar Sep 01 '17 15:09 Trapulo

Indeed, at mostly every upgrade there are breaking changes.

andrei-ga avatar Sep 01 '17 18:09 andrei-ga

Thanks for letting us know.

start copying or adding files into the app/ folder.

Which specific files should you copy or add? Because adding arbitrary unrelated files to that dir doesn't have any effect.

Am I right in understanding that the real repro is "update Angular packages to 4.3.0+"? If so, we certainly will be updating the templates to 4.3.0+ at some point, but until then we can't guarantee compatibility with arbitrary future Angular versions because they can introduce breaking changes at any time.

SteveSandersonMS avatar Sep 06 '17 13:09 SteveSandersonMS

We already managed to make it work. See https://github.com/aspnet/Templates/issues/866

andrei-ga avatar Sep 06 '17 16:09 andrei-ga

Glad to hear it.

SteveSandersonMS avatar Sep 07 '17 12:09 SteveSandersonMS