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

MethodAccessException on equality comparison of a type private to module #17541

Closed
iminashi opened this issue Aug 15, 2024 · 5 comments · Fixed by #17548
Closed

MethodAccessException on equality comparison of a type private to module #17541

iminashi opened this issue Aug 15, 2024 · 5 comments · Fixed by #17548
Assignees
Milestone

Comments

@iminashi
Copy link

Something that has worked previously now fails with a MethodAccessException when using SDK 9.0.100.

Repro steps

Calling a public function that does an equality comparison on a type that is private to the module.

module Module =
    type private DU = ABC | YYZ

    let publicFunction () : bool =
        ABC = YYZ

Module.publicFunction () |> printfn "%b"

Expected behavior

false is printed.

Actual behavior

Unhandled exception. System.MethodAccessException: Attempt by method 'Program+Module.publicFunction()' to access method 'Program+Module+DU.Equals(DU, System.Collections.IEqualityComparer)' failed.

Related information

  • 9.0.100-preview.7.24407.12
@vzarytovskii
Copy link
Member

vzarytovskii commented Aug 15, 2024

Duplicate of #17447, likely

@vzarytovskii vzarytovskii marked this as a duplicate of #17447 Aug 15, 2024
@iminashi
Copy link
Author

I ran into this when testing if #17447 was fixed in 9.0.100 (it is).

@iminashi
Copy link
Author

The example above works in 8.0.400, but fails in 9.0.100.

The example in #17447 fails in 8.0.400, but works in 9.0.100.

@T-Gro
Copy link
Member

T-Gro commented Aug 15, 2024

Still repro's in main -> issue has to be fixed.

@KevinRansom KevinRansom self-assigned this Aug 15, 2024
@KevinRansom
Copy link
Member

@iminashi - Thank you for raising this issue, it forced me to properly think about the codegen that needs to happen for Equality(typed, IComparable) which is wierdly enough different from all of the other Augmented Equals and Compare methods.

@KevinRansom KevinRansom modified the milestones: Backlog, August-2024 Aug 16, 2024
@T-Gro T-Gro linked a pull request Aug 19, 2024 that will close this issue
5 tasks
KevinRansom added a commit to KevinRansom/fsharp that referenced this issue Sep 24, 2024
vzarytovskii added a commit that referenced this issue Oct 7, 2024
* Update azure-pipelines.yml

* Refactor CE checking (#17464) (#17493)

Co-authored-by: Vlad Zarytovskii <vzaritovsky@hotmail.com>
Co-authored-by: vzarytovskii <1260985+vzarytovskii@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update azure-pipelines.yml

* Localized file check-in by OneLocBuild Task: Build definition ID 499: Build ID 2524346 (#17610)

* Fixes #17447 -MethodAccessException on equality comparison of a record with private fields (#17467)

* Fix17447

* tests + readme

* fixes #17541 - Equals visibility for DU's (#17548)

* update version number

* Switch to new VMR control set (#17703) (port from main) (#17788)

* Now that fsharp is on 9.0, we can switch to the new control set. Generally:
- DotNetBuildFromSource -> DotNetBuildSourceOnly - Building a source-only build.
- DotnetBuildFromSourceFlavor == Product -> DotNetBuildOrchestrator == true - Building in the VMR, could be source-only or MS's build.
- ArcadeBuildFromSource -> DotNetBuildRepo == true -> Indicates an outer repo build.
- ExcludeFromSourceBuild -> ExcludeFromSourceOnlyBuild

* Split out source build args

* Split out source build args

* Remove unnecessary source build env var set

* Add properties to the bootstrap compiler build

* BuildRepo -> BuildInnerRepo

* Only build proto repo in inner build

* Additional VMR properties for completeness

* Rename sourcebuild.props -> dotnetbuild.props

---------

Co-authored-by: Petr <psfinaki@users.noreply.github.com>

* respect generic arity in method uniqueness

* [17.12] Turn off realsig when building product and proto (#17808)

* Bugfix : make sure nullness does not break XmlDoc info import for methods and types (#17741)

* Remove nullness signal in string-based type encoding of a symbol (since it is used for xmldoc lookup)

* release notes

* Discard unused values

* Rendering AllowsRefStruct for type parameters (#17706)

* Update azure-pipelines.yml

---------

Co-authored-by: Vlad Zarytovskii <vzaritovsky@hotmail.com>
Co-authored-by: Petr <psfinaki@users.noreply.github.com>
Co-authored-by: Tomas Grosup <tomasgrosup@microsoft.com>
Co-authored-by: Kevin Ransom (msft) <codecutter@hotmail.com>
Co-authored-by: vzarytovskii <1260985+vzarytovskii@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Kevin Ransom <kevinr@microsoft.com>
Co-authored-by: Matt Mitchell <mmitche@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants