Aaron
Aaron

Reputation: 4480

Waiting for a file to change before restarting dotnet error

I am using asp.net core, razor engine, and entity framework. I am getting this error when I try to run my code in VS code using dotnet watch run. Here is the full error.

Project c-login (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation.
A JSON parsing exception occurred in [/Users/aaronmk2/Desktop/CodingDojo/c#/asp.net/entity/c-
login/bin/Debug/netcoreapp1.0/c-login.deps.json]: * Line 1, Column 2 Syntax error: Malformed
token
Error initializing the dependency resolver: An error occurred while parsing /Users/aaronmk2/D
esktop/CodingDojo/c#/asp.net/entity/c-login/bin/Debug/netcoreapp1.0/c-login.deps.json
[DotNetWatcher] fail: dotnet exit code: 139
[DotNetWatcher] info: Waiting for a file to change before restarting dotnet...

Has anyone seen this error before? What is the workaround?

Upvotes: 7

Views: 9834

Answers (4)

DOUMBIA Mamadou
DOUMBIA Mamadou

Reputation: 390

I think, you just have to successfully build your project and restart the server. It worked for me.

Upvotes: 1

poppert-longdog
poppert-longdog

Reputation: 1

Although this was already solved I wanted to give another solution since I couldn't find much on this specific error.

I had a similar issue using MySQL that looked like this:

A JSON parsing exception occurred in [C:\foo\bin\Debug\netcoreapp3.1\foo.deps.json]: * Line 1, Column 2 Syntax error: Malformed token
Error initializing the dependency resolver: An error occurred while parsing: C:\foo\bin\Debug\netcoreapp3.1\foo.deps.json

I ended up dropping my schema and removing all my previous migrations and then it started working fine. My best theory is that something I did to my models caused it. Hopefully, this helps someone out.

Upvotes: 0

PhatLee
PhatLee

Reputation: 37

I had the same error, after trying everything I figure out that it was because of the corrupted certificate. For some reason my certificate got corrupted so, I had to delete the old one and generate a new one. To generate:

dotnet dev-certs https

To trust:

dotnet dev-certs https --trust

Upvotes: 2

drethedevjs
drethedevjs

Reputation: 484

I received the same error but I had something else wrong. The issue that I had was that I was trying to connect to a server in my appsettings.json file using Microsoft credentials such as using Server=(LocalDB). After updating it to the MacOS way of connecting to a DB, it worked.

I went from

"DefaultConnection": "Server=(localdb)\\MSSQLLocalDB;Database=ShirtDB;Trusted_Connection=True;MultipleActiveResultSets=true"

To

"DefaultConnection": "Server=localhost,*port number*;Database=MyDB;User ID=sa;Password=******"

Upvotes: 0

Related Questions