我正在编写我的小项目,我需要下载音乐专辑数据。
我尝试使用last.fm API,但遇到一个奇怪的错误:)
public HelpLastFmItemSearch(string albumName)
{
//For test
albumName = "Meteora";
string _albumsSearchURL = "http://ws.audioscrobbler.com/2.0/?method=album.search&album=" + albumName + "&api_key="+ Api.LastFMKeySingleton.Instance.getApiKey()+"&format=json";
HttpClient albumSearchClient = new HttpClient();
var jsonAlbumsSearch = albumSearchClient.GetStringAsync(_albumsSearchURL);
var deserializeJsonAlbumsSearch = JsonConvert.DeserializeObject<dynamic>(jsonAlbumsSearch.Result);
var deserializeJsonAlbumsSearchTest = JsonConvert.DeserializeObject<ViewHelp_Music.AddMusic.LastFm_Api.AlbumSearch.HelpLastFMJsonAlbumsSearch>(jsonAlbumsSearch.Result);
//Testing !
var _artistname = deserializeJsonAlbumsSearchTest.Results.Albummatches.Album[0].Artist;
var _albumname = deserializeJsonAlbumsSearchTest.Results.Albummatches.Album[0].Name;
string _albumInfoURL = "http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=" + Api.LastFMKeySingleton.Instance.getApiKey() + "&artist=" + _artistname + "&album=" + _albumname + "&format=json";
HttpClient albumInfoClient = new HttpClient();
var jsonAlbumInfo = albumInfoClient.GetStringAsync(_albumInfoURL);
var deserializeJsonAlbumInfo = JsonConvert.DeserializeObject<dynamic>(jsonAlbumInfo.Result);
var deserializeJsonAlbumInfoTest = JsonConvert.DeserializeObject<ViewHelp_Music.AddMusic.LastFm_Api.AlbumInfo.HelpLastFMJsonAlbumInfo>(jsonAlbumInfo.Result);
//////Do Poprawy!
}
我究竟做错了什么?
最佳答案
你有试过吗
Function evaluation timed out when examining variables in debug/stepping through
The most likely cause of this problem is an implicit evaluation of a property or ToString method which causes an issue with the CLR evaluation thread. To verify this turn off implicit evaluation.
- Tools -> Options
- Debugging
- Uncheck "Enable property evaluation and other implicit function calls"
Then restart your scenario and see if it works."
关于c# - C#Api Last.FM这是错误吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44696911/