Skip to content

Exception thrown: 'System.OverflowException' in mscorlib.dl #12

Description

@RocklinSoftware

Hi Cubico,

You did a nice job on your application.

I am getting an error in a Web-Application project using v1.1.0.

A) In the Web-Application Cubico ATTEMPT 1 works and Cubico ATTEMPT 2 fails.
B) If I rollback your software to 1.0.1 Cubico ATTEMPT 1 works and Cubico ATTEMPT 2 works.

Any help is appreciated.

Thank you,
Dave
RocklinSoftware.com, Susanville, CA
SEE LAST POST.

This was in the Cubico code. Looked interesting. (? Cubico/Src/Cubico/UnitConverter.cs)
//TODO: Fix this; was Previously NaN
const double _failsafeValue = 0;
public Dictionary<string, Unit> _SymbolDictionary;
Dictionary<string, Symbol> _IndividualSymbolDictionary;
Dictionary<string, Unit> _UnitDictionary;
Dictionary<string, UnitType> _UnitTypeDictionary;
// Constructor, sets up the unit converter.

----- Web-Application Code
protected void Session_Start(object sender, EventArgs e) // WEBSITE
{
try
{
double value = Convert.ToDouble(2.2);
string c1 = "in";
string t1 = "cm";

            Cubico.UnitConverter target = new Cubico.UnitConverter();
            var v1 = target.ConvertUnits(value, c1, t1).ToString(); // CURRENT, TARGET
            var q1 = v1;
        }
        catch (Exception ex)
        {
            var message = ex.Message;
            throw;
        }

        if (Request.IsAuthenticated) // SETUP
        {
            using (ApplicationDbContext dbContext2 = new ApplicationDbContext())
            {
                try
                {
                    string email = "";
                    string id = User.Identity.GetUserId();

                    email = (from user in dbContext2.Users where user.Id == id select user.Email).First();
                    l.Initialize(Request.IsAuthenticated, User.Identity.GetUserId(), User.Identity.GetUserName(), email);
                }
                catch (Exception ex) // TODO: remove
                {
                    var message = ex.Message;
                    l.Set_AlertMessage("global error email");
                    l.Initialize(Request.IsAuthenticated, User.Identity.GetUserId(), User.Identity.GetUserName(), "global error, email");
                }
            }
        }
        else
        {
            l.Initialize(Request.IsAuthenticated, User.Identity.GetUserId(), User.Identity.GetUserName(), "");
        }

        try
        {
            double value = Convert.ToDouble(2.2);
            string c1 = "in";
            string t1 = "cm";

            Cubico.UnitConverter target = new Cubico.UnitConverter(); // FAILURE
            var v1 = target.ConvertUnits(value, c1, t1).ToString(); // CURRENT, TARGET
            var q1 = v1;
        }
        catch (Exception ex)
        {
            var message = ex.Message; // ERROR
            throw;
        }
    }

EXCEPTION THROWN: Exception thrown: 'System.OverflowException' in mscorlib.dll
BAD MESSAGE: "Value was either too large or too small for a Decimal."
BAD STACK TRACE: " at System.Number.ParseDecimal(String value, NumberStyles options, NumberFormatInfo numfmt)\r\n at System.Convert.ToDecimal(String value)\r\n at Cubico.UnitProvider.ProcessUnitConverterData2(RootObject RootObject) in c:\Users\Ivan\Source\Repos\Cubico\Src\Cubico\UnitProvider.cs:line 125\r\n at Cubico.UnitProvider.LoadJsonDataFile() in c:\Users\Ivan\Source\Repos\Cubico\Src\Cubico\UnitProvider.cs:line 115\r\n at Cubico.UnitConverter..ctor() in c:\Users\Ivan\Source\Repos\Cubico\Src\Cubico\UnitConverter.cs:line 27\r\n at Ii.Website.MvcApplication.Session_Start(Object sender, EventArgs e) in C:\Users\euser\Desktop\CODEBASE\Solution\Ii.Website\Global.asax.cs:line 64"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions