Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid type for a default value exception (regression) #286

Closed
shadowfaxer opened this issue Sep 19, 2016 · 1 comment
Closed

Invalid type for a default value exception (regression) #286

shadowfaxer opened this issue Sep 19, 2016 · 1 comment

Comments

@shadowfaxer
Copy link

The attached example code gives an exception
Unhandled Exception: System.FormatException: Encountered an invalid type for a default value.
when run using version 4.5.21. It runs without error using version 4.2.1510.2205

using System;
using Moq;

namespace MoqProblem
{
    public interface ITestMoq
    {
        void WithDefaults(DateTime dateTime = default(DateTime));
    }

    class Program
    {
        static void Main(string[] args)
        {
            var test = new Mock<ITestMoq>();
            var t = test.Object;
        }
    }
}
@shadowfaxer shadowfaxer changed the title Invalid type for a default value exception Invalid type for a default value exception (regression) Oct 26, 2016
@stakx
Copy link
Contributor

stakx commented Jun 4, 2017

Hi, this is no longer reproducible in the latest version of Moq (4.7.25). Please update your package reference.

@stakx stakx closed this as completed Jun 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants