C
C#2mo ago
Kushiwushi

Ending of curly braces results in an error?

c-sharp
namespace SpotifyLyrics
{
public class SpotifyAPI
{
private string MainURL = "https://curly-orbit-g4459qpggwg5cpg4g-8000.app.github.dev/trackid/";
private string Track = "0MnTkIEP4zZN1IUSu8MvIz";

public async Task<string> RequestAPI(string track)
{
this.Track = track;
string requestApiUrl = MainURL + track;

using (HttpClient client = new HttpClient())
{
HttpResponseMessage response = await client.GetAsync(requestApiUrl);

string lyrics = await response.Content.ReadAsStringAsync();
return lyrics;
}
}
}
c-sharp
namespace SpotifyLyrics
{
public class SpotifyAPI
{
private string MainURL = "https://curly-orbit-g4459qpggwg5cpg4g-8000.app.github.dev/trackid/";
private string Track = "0MnTkIEP4zZN1IUSu8MvIz";

public async Task<string> RequestAPI(string track)
{
this.Track = track;
string requestApiUrl = MainURL + track;

using (HttpClient client = new HttpClient())
{
HttpResponseMessage response = await client.GetAsync(requestApiUrl);

string lyrics = await response.Content.ReadAsStringAsync();
return lyrics;
}
}
}
here's the code
No description
7 Replies
Kushiwushi
KushiwushiOP2mo ago
i don't get why the ending curly brace is an error, if i remove it, it's also an error idk what to do with this one xd
Pobiega
Pobiega2mo ago
Could it be $vsdrunk ?
MODiX
MODiX2mo ago
* close VS * remove the hidden folder .vs * remove all bin and obj folder next to each csproj (DO NOT TOUCH THE .git FOLDER OR WHAT'S INSIDE) * restart vs
Pobiega
Pobiega2mo ago
If you compile from the terminal using dotnet cli, does that work?
Kushiwushi
KushiwushiOP2mo ago
there's no .vs hidden folder hold on how do i try that btw for some reason adding another curly brace end seems to fix the problem? but another problem occurs lol wait what the actual fuck i seemed to have fixed it by removing the curly brace and adding another curly brace at the end of the code
Pobiega
Pobiega2mo ago
missing braces can sometime confuse it, since it cant really tell which one is missing but for future reference, dotnet build in the project root
asdf
asdf2mo ago
Btw you should reuse http client

Did you find this page helpful?