by Guest » 15 Jan 2025, 17:18
Ich habe einen wirklich seltsamen Fehler. Hier ist ein MRE:
Code: Select all
var outputs = new (
(Typing First, Typing Second) a,
(Typing First, Typing Second) b,
(Typing First, Typing Second) c,
(Typing First, Typing Second) d,
(Typing First, Typing Second)? e,
(Typing First, Typing Second) f,
(Typing First, Typing Second)? g,
(Typing First, Typing Second)? h
)[2];
outputs[0] = (
(new Typing(), new Typing()),
(new Typing(), new Typing()),
(new Typing(), new Typing()),
(new Typing(), new Typing()),
(new Typing(), new Typing()),
(new Typing(), new Typing()),
(new Typing(), new Typing()),
(new Typing(), new Typing())
);
outputs[0].h = null; // Cannot convert null to type parameter 'T1' because it could be a value type. Consider using 'default(T)' instead.
class Typing
{
}
Sie fragen sich vielleicht, warum dieser MRE so „nicht minimal“ ist. Nun, wenn ich das Tupel kleiner mache (indem ich zum Beispiel f oder g entferne), erhalte ich keinen Fehler mehr.
Beweis:
Fehler:

Kein Fehler :
Möglicherweise müssen Sie dies zu Ihrem csproj hinzufügen, um den Fehler zu sehen:
Details:
Code: Select all
JetBrains Rider 2024.3.3
Build #RD-243.22562.250, built on December 23, 2024
Licensed to **************************
Subscription is active until *******************
Runtime version: 21.0.5+8-b631.28 amd64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.windows.WToolkit
Windows 11.0
.NET Core v8.0.4 x64 (Server GC)
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 4078M
Cores: 16
Registry:
ide.experimental.ui=true
i18n.locale=
llm.show.ai.promotion.window.on.start=false
Non-Bundled Plugins:
com.jetbrains.space (243.21565.122)
com.chesterccw.excelreader (2024.11.1-243)
me.lensvol.blackconnect (0.6.2)
com.github.copilot (1.5.30-242)
com.intellij.resharper.azure (4.3.8)
Ich habe einen wirklich seltsamen Fehler. Hier ist ein MRE:
[code]var outputs = new (
(Typing First, Typing Second) a,
(Typing First, Typing Second) b,
(Typing First, Typing Second) c,
(Typing First, Typing Second) d,
(Typing First, Typing Second)? e,
(Typing First, Typing Second) f,
(Typing First, Typing Second)? g,
(Typing First, Typing Second)? h
)[2];
outputs[0] = (
(new Typing(), new Typing()),
(new Typing(), new Typing()),
(new Typing(), new Typing()),
(new Typing(), new Typing()),
(new Typing(), new Typing()),
(new Typing(), new Typing()),
(new Typing(), new Typing()),
(new Typing(), new Typing())
);
outputs[0].h = null; // Cannot convert null to type parameter 'T1' because it could be a value type. Consider using 'default(T)' instead.
class Typing
{
}
[/code]
Sie fragen sich vielleicht, warum dieser MRE so „nicht minimal“ ist. Nun, wenn ich das Tupel kleiner mache (indem ich zum Beispiel f oder g entferne), erhalte ich keinen Fehler mehr.
Beweis:
Fehler:
[img]https://i.sstatic.net/JfioLpI2.png[/img]
Kein Fehler :
[img]https://i.sstatic.net/oJz9GlIA.png[/img]
Möglicherweise müssen Sie dies zu Ihrem csproj hinzufügen, um den Fehler zu sehen:
[code]enable
CS8600;CS8602;CS8603
[/code]
Details:
[code]JetBrains Rider 2024.3.3
Build #RD-243.22562.250, built on December 23, 2024
Licensed to **************************
Subscription is active until *******************
Runtime version: 21.0.5+8-b631.28 amd64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.windows.WToolkit
Windows 11.0
.NET Core v8.0.4 x64 (Server GC)
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 4078M
Cores: 16
Registry:
ide.experimental.ui=true
i18n.locale=
llm.show.ai.promotion.window.on.start=false
Non-Bundled Plugins:
com.jetbrains.space (243.21565.122)
com.chesterccw.excelreader (2024.11.1-243)
me.lensvol.blackconnect (0.6.2)
com.github.copilot (1.5.30-242)
com.intellij.resharper.azure (4.3.8)
[/code]