question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problems when generating internal types

See original GitHub issue

I want to test internal stuff (using InternalsVisibleTo on the main assembly). Specifically, I want FsCheck to generate instances of internal types. This seems to be a bit hit-and-miss, and mostly seems to fail. For example, generating values of an internal union gives SystemArgumentException with message X is an F# union type but its representation is private. You must specify BindingFlags.NonPublic to access private type representations. Generation of some other internal types seem to loop until the test times out and gets aborted.

Is this a known issue? Is it deliberate? Would it be possible to make FsCheck able to generate internal types?

Currently I’m just leaning towards making everything public, but that means the public API of the main assembly is rather more noisy than it needs to be.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:19 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
kurtschelfthoutcommented, Oct 5, 2017

I’m on the fence about getting FsCheck to take internal and private constructors into account. I usually use that to signal that the ctor doesn’t do validation or doesn’t necessarily uphold an invariant. I assume that the same problem would exist when FsCheck would be trying to call those ctors. So it can cause some confusion - “why isn’t FsCheck only using my public ctor, it’s generating bogus instances by breaking my encapsulation” type issues.

On 4 Oct 2017, at 10:01, Christer van der Meeren notifications@github.com wrote:

Nevermind the infinite loop part; it seems that it was caused by FsCheck not picking up internal Arbitrary-returning members on the class I specified in the PropertiesAttribute, and thus not using my designated generators for a few recursive types.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

1reaction
kurtschelfthoutcommented, Mar 27, 2022

Ok - that’s fair. Like I said it’s easy to add, and I’m all for un-opinionated tools. I’ll leave it here as a reminder to add.

Nullability - yes it would be great if there was a good way for FsCheck to figure out whether to generate null for ambiguous types like string.

Read more comments on GitHub >

github_iconTop Results From Across the Web

4 Types of Internal Controls Weaknesses and 5 Ways to Fix ...
4 Types of Internal Control Weaknesses · Technical Internal Control Weakness · Operational Internal Control Weakness · Administrative Control Weaknesses.
Read more >
The advantages and disadvantages of internal recruitment
However, over-reliance on internal recruitment can have negative side-effects, such as creating resentment or leading to an inflexible culture. Nikoletta Bika.
Read more >
7 Types of Internal Conflict in Literature (Plus How To Use ...
Use a strong conflict. An internal conflict with significant risk and repercussions can draw readers into your story and create a more engaging ......
Read more >
Internal Controls: 5 Common Challenges for Small ...
The most common types of internal control weaknesses detected in small businesses can often be mitigated through implementing a combination ...
Read more >
What are the 3 Types of Internal Controls?
Organization commonly categorize internal controls for an internal audit into three types: Preventive, Detective, and Corrective.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found