I’ve written code that is very similar to the solution, but doesn’t exactly match it, and when I click Run it either spins forever or takes several minutes to output an error. The one error I’ve gotten is
/usr/share/dotnet/sdk/3.1.421/NuGet.targets(128,5): error : Failed to retrieve information about ‘Microsoft.NET.Test.Sdk’ from remote source ‘https://api.nuget.org/v3-flatcontainer/microsoft.net.test.sdk/index.json‘. [/home/ccuser/workspace/csharp-interfaces-finish-truck-class/LearnInterfaces.csproj]
Can someone please help me? I’d really like to continue the course without having to ‘cheat’ by copying the solution every time.
The second step is what was giving me the error. However, when I retried running the (unchanged) code this morning it worked. So maybe there was an environmental issue? Are there any steps I can take in the future to avoid this kind of error?
Here is the code in question:
using System;
namespace LearnInterfaces
{
class Truck : IAutomobile
{
public string LicensePlate
{ get; }
public double Speed
{ get; private set; }
public int Wheels
{ get; }
public double Weight
{ get; }
public void Honk()
{
Console.WriteLine("HONK!");
}
public Truck(double speed, double weight) {
Speed = speed;
Weight = weight;
LicensePlate = Tools.GenerateLicensePlate();
if (weight < 400) {
Wheels = 8;
} else {
Wheels = 12;
}
}
}
}