Skip to content

BuildTask mode should not generate types from InternalsVisibleTo referenced assemblies#1492

Merged
jevansaks merged 6 commits into
mainfrom
user/jevansaks/buildtask-internalsvisibleto
Oct 21, 2025
Merged

BuildTask mode should not generate types from InternalsVisibleTo referenced assemblies#1492
jevansaks merged 6 commits into
mainfrom
user/jevansaks/buildtask-internalsvisibleto

Conversation

@jevansaks

Copy link
Copy Markdown
Member

We were handling the case of not emitting types from referenced assemblies if they were public but for InternalsVisibleTo we weren't. That's because the logic to check if we could see the type is based on the assemblyName in the CSharpCompilation we are building, and we passed in some placeholder thing.

The fix here is to plumb assemblyName through from the targets => task => generator => compilation.

Also added a test to exercise this as well.

@whiskhub

Copy link
Copy Markdown

Sorry to hijack this PR, but could you please ensure that for each new release on NuGet, a matching release is created on GitHub? See #1472.

There are now multiple new releases on NuGet (in the last days), and we don't know what has changed. Does it already include the (eagerly awaited 🚀) AOT/ComWrappers support? Thanks for your efforts!

Comment thread src/CsWin32Generator/Program.cs
@jevansaks

Copy link
Copy Markdown
Member Author

Sorry to hijack this PR, but could you please ensure that for each new release on NuGet, a matching release is created on GitHub? See #1472.

There are now multiple new releases on NuGet (in the last days), and we don't know what has changed. Does it already include the (eagerly awaited 🚀) AOT/ComWrappers support? Thanks for your efforts!

I just published them. And yes, it does include that support. Please give it a try and let me know how it goes for you. :)

@jevansaks jevansaks force-pushed the user/jevansaks/buildtask-internalsvisibleto branch from 10dc70b to ceea687 Compare October 20, 2025 19:57
@jevansaks jevansaks force-pushed the user/jevansaks/buildtask-internalsvisibleto branch from ceea687 to a054b3d Compare October 20, 2025 19:58
Comment thread integration-tests/buildtask-sdk/app/NativeMethods.json Outdated
Comment thread integration-tests/buildtask-sdk/dependency/AssemblyInfo.cs Outdated
Comment thread integration-tests/buildtask-sdk/buildtask-sdk.sln Outdated
@jevansaks jevansaks enabled auto-merge (squash) October 20, 2025 23:48
@jevansaks jevansaks merged commit 56ee24c into main Oct 21, 2025
6 checks passed
@jevansaks jevansaks deleted the user/jevansaks/buildtask-internalsvisibleto branch October 21, 2025 00:08
craigktreasure pushed a commit to craigktreasure/StartMenuCleaner that referenced this pull request Oct 25, 2025
Updated
[Microsoft.Windows.CsWin32](https://github.com/microsoft/CsWin32) from
0.3.205 to 0.3.228.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.Windows.CsWin32's
releases](https://github.com/microsoft/CsWin32/releases)._

## 0.3.228

## What's Changed
* BuildTask mode should not generate types from InternalsVisibleTo
referenced assemblies by @​jevansaks in
microsoft/CsWin32#1492
* CsWin32 build task fixes for NET8/CSharp12 by @​jevansaks in
microsoft/CsWin32#1498
* Fix platform case sensitivity issue with CsWin32Generator tool by
@​jevansaks in microsoft/CsWin32#1499
* Update documentation for CsWin32RunAsBuildTask mode by @​jevansaks in
microsoft/CsWin32#1497
* ArrayPool can be larger than requested resulting in freeing
uninitialized GCHandles by @​jlaanstra in
microsoft/CsWin32#1405
* Fix analyzer test break in devdiv AzDO account by @​AArnott in
microsoft/CsWin32#1504

## New Contributors
* @​jlaanstra made their first contribution in
microsoft/CsWin32#1405

**Full Changelog**:
microsoft/CsWin32@v0.3.217...v0.3.228

https://www.nuget.org/packages/Microsoft.Windows.CsWin32/0.3.228

## 0.3.217

## What's Changed
* Add cswin32 mode to generate [GeneratedComInterface] and
[LibraryImport] code by @​jevansaks in
microsoft/CsWin32#1474
* Handle UnauthorizedAccessException in new ComTests by @​jevansaks in
microsoft/CsWin32#1486
* Project byte* parameters as Span<byte> by @​jevansaks in
microsoft/CsWin32#1488
* Fix nuspec to refer to only signed files and drop apphost.exe from the
nuget by @​jevansaks in microsoft/CsWin32#1489


**Full Changelog**:
microsoft/CsWin32@v0.3.213...v0.3.217

## 0.3.213

## What's Changed
* Retarget to roslyn for VS 2022 Update 14 by @​AArnott in
microsoft/CsWin32#1466
* .NET targeting projects should reference
`Microsoft.Windows.SDK.NET.Ref` instead by @​AArnott in
microsoft/CsWin32#1471
* Update win32metadata version to 65.0.8-preview by @​jevansaks in
microsoft/CsWin32#1469
* Update dependency Microsoft.Build.NoTargets to 3.7.134 by
@​renovate[bot] in microsoft/CsWin32#1461


**Full Changelog**:
microsoft/CsWin32@v0.3.205...v0.3.213

Commits viewable in [compare
view](microsoft/CsWin32@v0.3.205...v0.3.228).
</details>

[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Microsoft.Windows.CsWin32&package-manager=nuget&previous-version=0.3.205&new-version=0.3.228)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

3 participants