Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C#

Borislav Yordanov
Borislav Yordanov
4,800 Points

Treehouse Fitness Frog error

I have finished the course ASP.NET Web Forms and I deployed the project in Azure and then i deleted every entry. Now it shows NaN, which is not good. I think instead should be 0, but after I enter some entry in the app it shouws : "Server Error in '/' Application." Runtime Error. Then I start in Visual Studio and got this error :

Sequence contains no elements

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Sequence contains no elements

Source Error:

Line 66: { Line 67: // Get the next available entry ID. Line 68: int nextAvailableEntryId = Data.Entries Line 69: .Max(e => e.Id) + 1; Line 70:

Here is the link for the website : http://fitnessfrog.azurewebsites.net/ and here the source code : https://github.com/jumparo/fitnessFrog/tree/master/aspnet-fitness-frog Please advise me how to fix that error :)

Steven Parker
Steven Parker
231,261 Points

You will need to share more of the code to make analysis possible.

If you have a github repo, you could post the link to it here.

2 Answers

Steven Parker
Steven Parker
231,261 Points

:point_right: Did you forget to initialize your total?

Without seeing the code, this is just a wild guess — but did you forget to set the value of the total to 0?

Borislav Yordanov
Borislav Yordanov
4,800 Points

Any more ideas? I still can't figure it out