Skip to content

Commit 33a6121

Browse files
GetRequiredSercie should not be nullable since the method throws an exception of service was not found
1 parent 779b5bd commit 33a6121

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

DevExpress.Mvvm.CodeGenerators.Tests/UnitTests/GenearationTests/GenerationTestsDx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ public object? ParentViewModel {
316316
protected IServiceContainer ServiceContainer { get => serviceContainer ??= new ServiceContainer(this); }
317317
IServiceContainer ISupportServices.ServiceContainer { get => ServiceContainer; }
318318
protected T? GetService<T>() where T : class => ServiceContainer.GetService<T>();
319-
protected T? GetRequiredService<T>() where T : class => ServiceContainer.GetRequiredService<T>();
319+
protected T GetRequiredService<T>() where T : class => ServiceContainer.GetRequiredService<T>();
320320
321321
protected void RaisePropertyChanged(PropertyChangedEventArgs e) => PropertyChanged?.Invoke(this, e);
322322
protected void RaisePropertyChanging(PropertyChangingEventArgs e) => PropertyChanging?.Invoke(this, e);

DevExpress.Mvvm.CodeGenerators/Generators/InterfaceGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void AppendImplementation(SourceBuilder source) {
7272
source.AppendIf(!isSealed, protectedModifier)
7373
.AppendLine("T? GetService<T>() where T : class => ServiceContainer.GetService<T>();")
7474
.AppendIf(!isSealed, protectedModifier)
75-
.AppendLine("T? GetRequiredService<T>() where T : class => ServiceContainer.GetRequiredService<T>();");
75+
.AppendLine("T GetRequiredService<T>() where T : class => ServiceContainer.GetRequiredService<T>();");
7676
}
7777
}
7878
class IActiveAwareGenerator : IInterfaceGenerator {

0 commit comments

Comments
 (0)