Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
51 views

After upgrading my Kotlin application from Spring Boot 3.5.8 to Spring Boot 4.0.0, I get a lot of compiler errors Type argument is not within its bounds: must be subtype of 'Any'. How is it possible ...
Honza Zidek's user avatar
  • 21.8k
Advice
0 votes
1 replies
49 views

I am using the com.microsoft.graph.serviceclient.GraphServiceClient class to retrieve users: UserCollectionResponse userCollectionResponse = graphClient.users().get(conf -> { conf....
fascynacja's user avatar
  • 3,186
2 votes
2 answers
126 views

The following code generates CS1503 with the message: error CS1503: Argument 1: cannot convert from '<null>' to 'T?' public class MyClass<T> where T : notnull { // This is the only ...
Jeff G's user avatar
  • 4,735
5 votes
1 answer
140 views

I'm trying to run the following code with Java 25 package test; import static org.junit.jupiter.api.Assertions.assertTrue; import java.lang.reflect.Field; import org.jspecify.annotations.Nullable; ...
Thomas Oellrich's user avatar
1 vote
1 answer
262 views

Suppose in C# I have one class that inherits from another like this: internal class TestImplementation : TestBase { [SetsRequiredMembers] public TestImplementation(List<string> param) : ...
Oliver Bleen's user avatar
0 votes
0 answers
34 views

Consider this code (C# 12/.NET 8): class Content { public string Value { get; set; } } class Something { public bool IsOK { get; set; } public Content? TheContent { get; set; } } ...
Kjell Rilbe's user avatar
  • 1,623
-3 votes
1 answer
103 views

I'm not super experienced with C#, and this is a bit of a puzzle. Consider the following code: #nullable enable using System.Collections.Generic; // Biology.dll public abstract class Animal { ...
suszterpatt's user avatar
  • 8,327
2 votes
1 answer
170 views

So I've got a little method that looks like: public static bool AnyNull(params object?[] args) { if (args.Any(a => IsNull(a))) { return true; } return false; } private ...
Sean's user avatar
  • 115
2 votes
3 answers
271 views

The method java.util.List#copyOf in Java 24 calls another method java.util.ImmutableCollections#listCopy which has the following body: @SuppressWarnings("unchecked") static <E> ...
Dmitry Ovchinnikov's user avatar
1 vote
1 answer
118 views

I have a function that returns a nullable result and has an out parameter that is also nullable: public Result? GetResult(out Parameter? parameter) { Result? result = //...get the result somehow ...
Daniel Möller's user avatar
1 vote
2 answers
103 views

I've read several of the other questions on the topic of nullable types in generics and I still don't understand why MinMaxBase<T> and MyIntDecl compile and YourIntDecl doesn't. The compiler ...
Rudiger W.'s user avatar
1 vote
2 answers
134 views

I have this one specific case, where I have a model for an entity in our project, and that model has a collection inside it. That collection is nullable, like so: public class Model { public List<...
 Tims's user avatar
  • 579
0 votes
1 answer
104 views

I am guessing the answer will eventually be "no, you can't do that", but trying to figure out how to do a thing in C#. I am wondering on a bit of glue code between two pieces that I do not ...
Nathan Weyer's user avatar
0 votes
2 answers
110 views

I am working on a program that can use different cryptographical ciphers, though I don't think the actual application is incorrect. The entire codebase is here (a bit of an older version without the ...
Foxitb123's user avatar
0 votes
1 answer
85 views

I have an object with the following inheritance: [ProtoContract] public class Country : CountryCommon<Country, ConstructDB.Country> { Which inherits: public abstract class CountryCommon<T, ...
Tom Gullen's user avatar
  • 61.9k
2 votes
0 answers
84 views

I have such a component in swagger.json (OpenAPI version: "3.0.1") "ids": { "type": "array", "items": { "type": "string", ...
Jason's user avatar
  • 21
0 votes
0 answers
50 views

I ran the following code: String s = String.Empty; bool abool = false; bool? nbool = false; BoolsClass bc = new BoolsClass(); bc.classbool = false; bc.classnbool = false; s += $"The type of ...
Plaje's user avatar
  • 174
3 votes
2 answers
132 views

I'm trying to parse an XML file which has same tags with varying number of attributes (some attributes may not be present) to C# class. If an attribute isn't present, its value should be set to null, ...
Planeptunia's user avatar
0 votes
0 answers
41 views

I have this code, which also compiles and works: public partial class MeasurementInfoLabel : Label { /// <summary> /// The two points clicked. /// </summary> public PointF?[...
JoniKauf's user avatar
  • 346
0 votes
1 answer
40 views

I have a large .NET 9 code base maintained by a team. It doesn't all have null-checking enabled as we have migrated it up from .NET Core originally, but we are introducing it (one assembly at a time ...
Keith's user avatar
  • 157k
2 votes
2 answers
81 views

Following is my query: SELECT 'INSERT INTO MyTable ( CancellationReason ) VALUES ( ''' + rc.CancelReason + ''' )' FROM AnotherTable a I get below result: Since the column a.CancelReason is ...
Raghavendra HG's user avatar
5 votes
2 answers
116 views

I am attempting to validate multiple config parameters, ideally reporting all issues in a single pass. This takes a form similar to: var isValid = true; if (arg1 == null) { // logger.LogError... ...
Bob's user avatar
  • 16.9k
0 votes
1 answer
97 views

IntelliJ keeps telling me i have to initialize my injected fields. I know a workaround would be to create a ctor and annotate it with @Inject but i dont want to change all of my classes. So is there a ...
unrated's user avatar
  • 280
0 votes
1 answer
93 views

After upgrading my .NET 5.0 project to .NET 8.0, the LINQ query now generates an exception System.InvalidOperationException: Nullable object must have a value The code below executes successfully in ...
colinsl77's user avatar
1 vote
1 answer
91 views

Considering the following class: public class Property { public string StringValue { get; private set; } private Property(string value) { this.StringValue = value; } } I am ...
fharreau's user avatar
  • 2,425
0 votes
1 answer
56 views

Lets say I invoke AWS APIs in my java/kotlin code. Example on getHostedZone route53 API below. Should I check if response == null first or is response guaranteed to be non null? Is null pointer check ...
user3201336's user avatar
-1 votes
1 answer
80 views

So I created a nullable class, say called Unit, the instance is created: unit??=new Unit(pars) I check if it's null: Debug.Log("check" + unit==null); returns False. I test if it's null: if ...
Alex's user avatar
  • 970
1 vote
1 answer
116 views

In my C# application, I have an abstract class that is a wrapper around UnitsNet library to group closely related properties (such as a numeric value and unit for that value that user has chosen), to ...
K.S.'s user avatar
  • 77
1 vote
3 answers
208 views

In C# when having nullable objects such as Decimal?, Int?, etc. While doing null checks, but with early stopping. The compiler does not track the nullability of such object (prevMaxSpeed in this case) ...
Mathias Graabeck's user avatar
1 vote
0 answers
39 views

I have the following PostgreSQL "function1" function1(par1 Enum_1), function1(par1 integer), ... function1(par1 text) In Npgsql V 3.2.7, the parameters could be created together with the ...
Ruebezaehler's user avatar
0 votes
1 answer
92 views

In my C# WPF project I am trying to assign a value to nullable short with the shorthand function: short? var = (textbox.Text.Length > 0) ? short.Parse(textbox.Text) : null; Visualstudio does not ...
Malte's user avatar
  • 3
1 vote
1 answer
91 views

I need to use two versions of base type in the same generic: nullable and non-nullable. Like int? and int, Guid? and Guid, DateOnly? and DateOnly and so on. Nullable type should be at the class ...
Doctor Coder's user avatar
  • 1,071
0 votes
0 answers
56 views

Take the following code (or check it out online): public class Program { public static void Main() { var foo = new MyNullable<int>(); var bar = new MyNullable<string&...
infinitezero's user avatar
  • 2,147
1 vote
1 answer
78 views

Dummy code: // TSource1 elementObj can be struct or can be class object and never can be nullable struct or null (because method inner code will create Exceptions in that case) public static TSource1? ...
Andrew's user avatar
  • 33
1 vote
1 answer
59 views

Conside this simple class in C# (nullability feature enabled): public class Error { public string Message = "..."; public static implicit operator bool(Error? err) => err is not ...
chainerlt's user avatar
  • 267
1 vote
1 answer
57 views

I have a razor component in a separate project that defines a search parameter like this: [Parameter, EditorRequired] public Func<string, Task<IEnumerable<T>>> Search { get; set; } = ...
Alex's user avatar
  • 913
-1 votes
1 answer
101 views

I have a function that's correctly specified as returning a potentially-null object. My code calls that function but in a way where it isn't going to return a null. MyClass? MyFunction(string x); /* .....
billpg's user avatar
  • 3,313
-1 votes
1 answer
26 views

public IActionResult Login( UserDto dto) { try { var roleName = (from r in _context.Roles join u in _context.Users on r.UserId equals u.UserId ...
Muhammad Anas imtiaz's user avatar
5 votes
3 answers
148 views

I was wondering why this was the case, as it went against what I would have expected. This has to do with how Generic Nullable types are interpreted in C#. public static int? MyFunction(){ ...
msheridan's user avatar
2 votes
1 answer
109 views

I am trying to create a table in ClickHouse with the following SQL CREATE TABLE stage.test_int_null ( is_active Nullable(Int8), name String ) ENGINE = MergeTree() ORDER BY (tuple()) AS select ...
Dongqing's user avatar
  • 686
1 vote
0 answers
32 views

Consider the following helper method which comes from a legacy codebase public static class ListHelper { public static bool HasAny<T>(this IReadOnlyCollection<T>? list) { ...
h0wXD's user avatar
  • 380
1 vote
3 answers
207 views

If I run the below code in x86 (32-bit) mode (.NET Framework 4.7.2 on recent Windows 11 machine) then, as expected, it writes to the console (proving that the data read out is not one of the two ...
mjwills's user avatar
  • 24.1k
0 votes
1 answer
114 views

I am trying to get items from a nullable array using a safe call (?. operator). data class myObject(val i: Int) var arr: Array<myObject>? = arrayOf(myObject(123),myObject(456)) // var arr: ...
vector001's user avatar
1 vote
1 answer
105 views

What is the easiest way to check multiple nullable values, to know if those that are not null are equal? double? a = null double? b = 2; double? c = 3.5; should return false double? a = 2.5 double? b ...
patsy2k's user avatar
  • 745
0 votes
1 answer
88 views

I have Java classes with some nullable members, which get constructed from JSON objects with some optional keys. After construction, I will modify the objects, populating some previously-null members, ...
Sparr's user avatar
  • 7,830
0 votes
0 answers
94 views

Here's my code that declares & sets ReturnUrl. public class ExPageBase : ExComponentBase { [Parameter] [SupplyParameterFromQuery(Name = "returnUrl")] public string? ReturnUrl ...
David Thielen's user avatar
1 vote
1 answer
63 views

I've found a strange inconsistency between the nullability of a variable in the hover-over tooltip in Visual Studio / sharplab.io and the compiler's handling of the variable re nullability. I wanted ...
mclayton's user avatar
  • 10.4k
0 votes
1 answer
91 views

If a nullable property gets used in the Execute part of a RelayCommand, and that property is already checked against null in the CanExecute method, what is the proper way to handle the CS8602: ...
bil-bal's user avatar
0 votes
1 answer
80 views

Type type = typeof(Program); type = type.BaseType; // [CS8600] Converting null literal or possible null value to non-nullable type. do { type = type.BaseType; // [CS8602] Dereference of a ...
Ilya Chernomordik's user avatar
1 vote
1 answer
71 views

I would like to set some cells to null based on a condition. For example: import pandas as pd # version is 2.2.2 df = pd.DataFrame({'x' : [1, 2, 2, 1, 1, 2]}) df["b"]=False df.loc[df["x&...
aabyssx's user avatar
  • 43

1
2 3 4 5
51