Skip to content

Commit

Permalink
Fixes ConstructorInjector rented array return
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavopsantos committed Jan 4, 2023
1 parent de8c737 commit d51853c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions Assets/Reflex/Scripts/Injectors/ConstructorInjector.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Reflex.Scripts;

namespace Reflex.Injectors
{
Expand All @@ -18,13 +17,16 @@ internal static object ConstructAndInject(Type concrete, Container container)

try
{
var instance = info.Activator(objects);
ArrayPool<object>.Shared.Return(objects);
return instance;
return info.Activator(objects);
}
catch (Exception e)
{
throw new Exception($"Error occurred while instantiating object with type '{concrete.GetFormattedName()}'\n\n{e.Message}");
throw new Exception(
$"Error occurred while instantiating object with type '{concrete.GetFormattedName()}'\n\n{e.Message}");
}
finally
{
ArrayPool<object>.Shared.Return(objects);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Assets/Reflex/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.gustavopsantos.reflex",
"displayName": "Reflex",
"version": "3.5.1",
"version": "3.5.2",
"unity": "2019.3",
"description": "Minimal dependency injection framework for Unity",
"keywords": ["Dependency Injection", "IoC", "DI", "DI Container"],
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Reflex is an [Dependency Injection](https://stackify.com/dependency-injection/)

### Install via UPM (using Git URL)
```json
"com.gustavopsantos.reflex": "https://github.com/gustavopsantos/reflex.git?path=/Assets/Reflex/#3.5.1"
"com.gustavopsantos.reflex": "https://github.com/gustavopsantos/reflex.git?path=/Assets/Reflex/#3.5.2"
```

### Install manually (using .unitypackage)
Expand Down

0 comments on commit d51853c

Please sign in to comment.