microsoft / CsWinRT

C# language projection for the Windows Runtime
MIT License
548 stars 105 forks source link

Error CS0122: 'NotifyCollectionChangedAction' is inaccessible due to its protection level #1813

Closed manodasanW closed 1 week ago

manodasanW commented 2 weeks ago

Collection of built-in WinRT mapped enums don't have the right generic instantiations generated for them. NotifyCollectionChangedAction isn't marked blittable in our mapping when it probably should be.

U-C-S commented 2 weeks ago
CS0122  'ILauncherUIOptions' is inaccessible due to its protection level    
CS0122  'ILauncherOptions' is inaccessible due to its protection level  

I am having similar issue for the following

<PropertyGroup>
    <CsWinRTEmbedded>true</CsWinRTEmbedded>
    <CsWinRTWindowsMetadata>sdk</CsWinRTWindowsMetadata>
    <CsWinRTGenerateProjection>true</CsWinRTGenerateProjection>
</PropertyGroup>
<ItemGroup>
    <PackageReference Include="Microsoft.Windows.CsWinRT" Version="2.1.5" />
</ItemGroup>
<PropertyGroup>
    <CsWinRTIncludes>
        Windows.Foundation;
        Windows.System.LauncherOptions;
        Windows.System.Launcher;
    </CsWinRTIncludes>
    <CsWinRTExcludes>
        Windows.Foundation.PropertyType;
    </CsWinRTExcludes>
</PropertyGroup>
manodasanW commented 1 week ago
CS0122    'ILauncherUIOptions' is inaccessible due to its protection level    
CS0122    'ILauncherOptions' is inaccessible due to its protection level  

I am having similar issue for the following

true sdk true Windows.Foundation; Windows.System.LauncherOptions; Windows.System.Launcher; Windows.Foundation.PropertyType;

Can you confirm what target framework (TFM) you are targeting and what your scenario is? I feel like you are running into an unrelated issue. With embedded support, you use it typically to embed a projection within your own sources when you are unable to target the netx-windows10.0.xxxxx.0 TFM. In your case, based on the protection level error, I feel like you are indeed targeting that TFM. With embedded support today, typically you would need to list the exclusive interfaces too like Windows.System.ILaunchOptions on the CsWinRTIncludes. If you are not targeting the TFM I mentioned and you are still seeing the same issue, feel free to open another issue as I am probably going to close this one as part of the PR that got merged to fix that.