✅ Can someone explain CA1416 about a call site only being reachable on ...

I'm getting the following warning that I don't understand.
Severity Code Description Project File Line Suppression State
Warning CA1416 This call site is reachable on all platforms. 'Network' is only supported on: 'Windows' 7.0 and later. IRC.Global.View B:\Contents\Best Chat\Code\IRC\Global\View\NetworkListDlg.xaml.cs 89 Active
Severity Code Description Project File Line Suppression State
Warning CA1416 This call site is reachable on all platforms. 'Network' is only supported on: 'Windows' 7.0 and later. IRC.Global.View B:\Contents\Best Chat\Code\IRC\Global\View\NetworkListDlg.xaml.cs 89 Active
Both assemblies involved have the same .NET and Windows versions specified. I keep checking that.
46 Replies
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will PittengerOP14mo ago
That doesn't explain things either. Both libraries have the same settings. The image on the left is the DLL using the one on the right (Network).
No description
No description
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will PittengerOP14mo ago
Do note that the Network class is inside IRC.Data.
Will Pittenger
Will PittengerOP14mo ago
^^^
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will PittengerOP14mo ago
Both target the same platform. BestChat.IRC.Data.Defs.Network
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will PittengerOP14mo ago
No, it stores the definition of an IRC network. Yes.
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will PittengerOP14mo ago
Well, Network is declared as:
namespace BestChat.IRC.Data.Defs
{
public class Network : Platform.Data.Obj<Network>, ModuleInterfaces.INetwork, IDataDef<Network>
namespace BestChat.IRC.Data.Defs
{
public class Network : Platform.Data.Obj<Network>, ModuleInterfaces.INetwork, IDataDef<Network>
Here's Platform.Data.Ob<Network>:
namespace BestChat.Platform.Data
{
/// <summary>
/// Provides a means to access some aspects of <see cref="Obj{TypeOfObj}"/> even if you don't know the type parameters.
/// </summary>
[System.Text.Json.Serialization.JsonSourceGenerationOptions(GenerationMode = System.Text.Json.Serialization
.JsonSourceGenerationMode.Metadata | System.Text.Json.Serialization.JsonSourceGenerationMode.Serialization,
IgnoreReadOnlyFields = true, IgnoreReadOnlyProperties = true, WriteIndented = true)]
public abstract class ObjBase : System.ComponentModel.INotifyPropertyChanged
.
.
.
}
public abstract class Obj<TypeOfObj> : ObjBase
where TypeOfObj : Obj<TypeOfObj>
{
namespace BestChat.Platform.Data
{
/// <summary>
/// Provides a means to access some aspects of <see cref="Obj{TypeOfObj}"/> even if you don't know the type parameters.
/// </summary>
[System.Text.Json.Serialization.JsonSourceGenerationOptions(GenerationMode = System.Text.Json.Serialization
.JsonSourceGenerationMode.Metadata | System.Text.Json.Serialization.JsonSourceGenerationMode.Serialization,
IgnoreReadOnlyFields = true, IgnoreReadOnlyProperties = true, WriteIndented = true)]
public abstract class ObjBase : System.ComponentModel.INotifyPropertyChanged
.
.
.
}
public abstract class Obj<TypeOfObj> : ObjBase
where TypeOfObj : Obj<TypeOfObj>
{
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will PittengerOP14mo ago
Well, that'll be preferred.
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will PittengerOP14mo ago
Ah. I remembered where IDataDef was.
namespace BestChat.IRC.Data
{
public interface IDataDefBasic<ItemType>
namespace BestChat.IRC.Data
{
public interface IDataDefBasic<ItemType>
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will PittengerOP14mo ago
public interface IDataDef<ItemType> : IDataDefBasic<ItemType>
where ItemType : Platform.Data.Obj<ItemType>
}
public interface IDataDef<ItemType> : IDataDefBasic<ItemType>
where ItemType : Platform.Data.Obj<ItemType>
}
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will PittengerOP14mo ago
Well, I didn't know of that attribute and I wrote every line.
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will PittengerOP14mo ago
As I said, I wrote all of it.
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will PittengerOP14mo ago
It won't because I know my code.
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will PittengerOP14mo ago
I'm on the wrong computer at the moment.
PS Microsoft.PowerShell.Core\FileSystem::\\goofy\projects\Best Chat\Code> dir *.cs -Recurse | ?{(Get-Content $_.fullname) -like "*supported*"} | %{$a = $_.fullname;((Get-Content $_.Fullname) -split '\r\n|\n\r|\n|\r') | ?{$_ -like '*supported'}| %{"$a`: $_"}}
PS Microsoft.PowerShell.Core\FileSystem::\\goofy\projects\Best Chat\Code> dir *.cs -Recurse | ?{(Get-Content $_.fullname) -like "*supported*"} | %{$a = $_.fullname;((Get-Content $_.Fullname) -split '\r\n|\n\r|\n|\r') | ?{$_ -like '*supported'}| %{"$a`: $_"}}
That returned nothing. Attributes with "supported" are in there, but they're all assemblyinfo.cs. Ironically, I did find the string "supported" in Network.cs, it's throwing a NotSupportedException.
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will PittengerOP14mo ago
But I'm dealing with a compiler error.
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will PittengerOP14mo ago
As I said, that's code in the file. Nothing is actually throwing it. All I said, was I found the string.
PS Microsoft.PowerShell.Core\FileSystem::\\goofy\projects\Best Chat\Code> dir *.cs -Recurse | ?{(Get-Content $_.fullname) -like "*supported*attribute"}
PS Microsoft.PowerShell.Core\FileSystem::\\goofy\projects\Best Chat\Code> dir *.cs -Recurse | ?{(Get-Content $_.fullname) -like "*supported*attribute"}
That returned nothing. The code you referred to requires the network manager to be told to add a network with name "X", but it already has a name. The UI code should prevent it.
if(mapServers.ContainsKey(server.Domain))
throw new System.NotSupportedException("This server is already present");
if(mapServers.ContainsKey(server.Domain))
throw new System.NotSupportedException("This server is already present");
Nothing to do with platforms. I should change that to InvalidProgramException.
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will PittengerOP14mo ago
Yes.
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will PittengerOP14mo ago
As I said, I'm in the wrong room. I'm accessing the files remotely.
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will PittengerOP14mo ago
What's that?
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will PittengerOP14mo ago
Well, I've had problems checking code in. VS seems to have decided to store some projects as absolute file names in the solution file. Now it won't send them to GIT because it thinks they're outside the solution folder. There's a thread in here about that that's been ignored. https://discord.com/channels/143867839282020352/1160338972233449572 I put it on the Learn.microsoft.com Q&A site too--again with no response.
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will PittengerOP14mo ago
And be careful saying "provide repo" as "repo" can be either "repository" or "reproduction".
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will PittengerOP14mo ago
They do hava a common parent. The solution folder.
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Will Pittenger
Will PittengerOP14mo ago
I tried that too.
Will Pittenger
Will PittengerOP14mo ago
Discord
Discord - A New Way to Chat with Friends & Communities
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
Will Pittenger
Will PittengerOP14mo ago
@TeBeClone I just noticed two of the projects targeted an older framework. Instead of <TargetFramework>net7.0-windows</TargetFramework>, they had <TargetFramework>net6.0...</TargetFramework>. I replaced that and the target problem seems to have gone away. As for the relative paths, that seems to have been solved by a combination of your suggestion and completing replacement of the absolute paths.
Unknown User
Unknown User14mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server