'Unhandled Exception: System.FormatException: Input string was not in a correct format. Please answer where is my mistake

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

    namespace EX_02_04
    {
        public class Program
        {
            static void Main(string[] args)
            {
                int hexNum = 2015;
                Console.WriteLine("|0x{0,-8:X|", hexNum);
                double fractNum = -1.856;
                Console.WriteLine("|0,-10:f2}|", fractNum);
            }
        }
    }

When I am running this code, facing some error like below:

Unhandled Exception: System.FormatException: Input string was not in a correct format.

at System.Text.StringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.IO.TextWriter.WriteLine(String format, Object arg0)
at System.IO.TextWriter.SyncTextWriter.WriteLine(String format, Object arg0)
at System.Console.WriteLine(String format, Object arg0)

Can you please answer me where the problem in the code is?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source