Questions tagged [unity-container]

The Unity Application Block (i.e. Unity) is a lightweight, extensible dependency injection container for .NET with support for interception. DO NOT USE THIS TAG TO REFER TO THE UNITY GAME ENGINE! Use unity-game-engine instead (https://stackoverflow.com/tags/unity-game-engine/info)!

Filter by
Sorted by
Tagged with
0 votes
1 answer
21 views

Resolving Microsoft Logger with Unity throws error

I am using .NET 4.8. and I registered Microsoft.Logger with unity injection: var factory = new LoggerFactory(); factory.AddLog4Net("log4net.config"); container.RegisterInstance<...
pakerinjo's user avatar
2 votes
1 answer
40 views

Unable to register Microsoft Logger with Unity

I have a Worker with logger and the project is throwing an error: Resolution of the dependency failed, type = "Test.IWorker", name = "(none)" public class SimpleWorker : IWorker { ...
pakerinjo's user avatar
0 votes
0 answers
8 views

When the ConfidentialClientApplication.AcquireTokenForClient() will return the same access token?

My project is using unity container and Microsoft.Identity.Client 4.22 which not support the cache methods. I register one class like AppTokenProvider as the singleton per container, and in the class, ...
feili's user avatar
  • 1
0 votes
0 answers
40 views

How to use MediatR with Unity in legacy ASP.NET 4.7.2?

I am working on a legacy ASP.NET application with target framework .NET 4.7.2. There is already a Unity container implemented (using Microsoft.AspNet.WebFormsDependencyInjection.Unity v1.0.0). Now, I ...
Mahesh's user avatar
  • 402
0 votes
1 answer
30 views

No member matching data has been found - Registering Dictionary in Unity Container

I'm attempting to be able to use multiple db connections in different repositories and am following this answer. I am on .NET Framework 4.8 so things are a little different but everything has been ...
Quiver's user avatar
  • 1,371
0 votes
0 answers
26 views

Games HelixJump in Unity [duplicate]

I have an error in the code. NullReferenceException: Object reference not set to an instance of an object. UIManager.Update () (at Assets/Scripts/UIManager.cs:13) I hope the ball bounces and counts ...
Matías Bazán's user avatar
0 votes
0 answers
10 views

Unity-container | Resolve with many parameters | "Has not Typeparameters"

I want to resolve a class via the interface. one of the new() has two parameters (class-object , class-object). Dim X = Kernel.UnityService.GetInstance.Container.Resolve(Of IOrdersEditorForm)(New ...
frankk's user avatar
  • 1
0 votes
0 answers
41 views

Integrating Unity into SwiftUI iOS App with Native Tab Bar Interaction

How to update UnityAppController to use an existing UIView for rendering? I'm working on an iOS app that uses Unity for rendering some parts of the application. Currently, I'm using the ...
user avatar
0 votes
2 answers
142 views

Prism Unity Register NLog as Microsoft.Extension.Logging.ILogger<T>

I have a shared Code between my backend and my frontend(WPF), where be backend currently uses NReco.Logging.File which is compatible with Microsoft.Extensions.Logging.ILogger. But in the fronend, I ...
Franz's user avatar
  • 378
-4 votes
1 answer
79 views

Error appears while running the program in unity

I installed the Unity Hub. But one error message appears while running the program. How can I solve this problem ? I cannot hold on my works because of this problem.
Sezgin Karagülle's user avatar
3 votes
1 answer
98 views

UseUnityServiceProvider doesn't works properly on WebApplicationBuilder

I'm trying to migrate from .NET3.1 to .NET6.0 WebAPI. I read this as manual to do this migration. I'm using UnityContainer as DependencyInjection framework. So in .NET3.1 I have something like this: ...
RezaNoei's user avatar
  • 1,341
0 votes
0 answers
33 views

No public constructor is available for type System.Security.Principal.IIdentity

I face error when injecting dependencies. No public constructor is available for type System.Security.Principal.IIdentity var container = new UnityContainer(); container.RegisterType<...
Maysam's user avatar
  • 1
0 votes
1 answer
78 views

How can the ASP.NET built-in DI read dependencies from a file at runtime?

As you can see in C# Unity container, we can configure a container (a list of dependency and object creation policy) from a file, and it is very good when, I want change a dependency (backend for ...
sorosh_sabz's user avatar
  • 2,576
0 votes
0 answers
16 views

How to inject Unity Container dependency in ActionFilter Attribute, in Webapi

after doing all the configuration in UnityConfig I am not able to see Instant in Action filter. inject Unity Container dependency in ActionFilter Attribute, is it possible to inject inside ...
Karthik Kalaivanan's user avatar
0 votes
0 answers
166 views

Microsoft extension logging with ASP.NET MVC & VB.NET and Unity dependency injection

I'm trying to use Microsoft extension logging in ASP.NET MVC 5 with dependency injection using Unity but its not showing any logs in the console. Here are my complete code, Global.asax.vb: Sub ...
Ris's user avatar
  • 1,152
0 votes
0 answers
42 views

What is the AutoFac equivalent of the Unity liftetime HierarchicalLifetimeManager?

I am attempting to convert the below unity container registration into an AutoFac container container.RegisterType<C1Context>(new HierarchicalLifetimeManager()); container.RegisterFactory<...
DrollDread's user avatar
0 votes
1 answer
69 views

How do you make a player not bend down when you place the mouse pointer on it in C# and Unity?

I'm trying to make a script for the player's movements in order to make the player walk in all directions and rotate around itself, the problem is when I place the mouse pointer on the head or on the ...
user avatar
1 vote
1 answer
189 views

Unity Container - How to correctly resolve a parameterised MemoryCache that's registered as a singleton

Despite Unity container being deprecated, unfortunately I find myself having to use it since the current wpf codebase I'm working on has been dependent on it for years. On the server side, I'm able to ...
user3613025's user avatar
0 votes
1 answer
45 views

How to default the Unity Lifetime Manager

I'm updating a legacy codebase which was using Unity 3.5 for dependency injection. It's using a custom extension to set the default LifetimeManager, in much the same way as this stackflow question. ...
DBPaul's user avatar
  • 500
-1 votes
1 answer
90 views

About Reverse Animation in Unity

I'm currently making a game that replays the player in reverse. Is there a way to make the player animation play in reverse smoothly? For now, animation is recorded every 0.02 seconds, and when ...
jinwoo11037's user avatar
0 votes
0 answers
58 views

DI in global.asax does not works after adding WebApi2 Controller

I have an asp.net web forms project, which also consists of WebApi2 controller file, in short i want to run webapi within my existing asp.net project. I also had Dependency Injection in my asp.net ...
Abbas's user avatar
  • 4,986
0 votes
1 answer
72 views

Refactor C# Class with Generics from IUnityContainer to Ninject

I would like to move away from the Unity NuGet package for Dependency Injection and switch to Ninject since Unity is no longer being maintained. I was wondering if someone might be able to help me ...
ADH's user avatar
  • 3,021
0 votes
0 answers
43 views

Is it possible to have Unity search any child containers if a resolution fails?

I have a unity container with a number of registrations. I then create a child container and add some more registrations. The child container is meant to contain a specific group of registrations ...
Flack's user avatar
  • 5,759
2 votes
1 answer
167 views

Injection Constructor Dependency Injection with parameters

I am trying to understand how do I resolve multiple parameters being passed to a constructor from a DI container. I have an interface IDataAccess (#1) and a class called SQL implementing IDataAccess (#...
Prasanth Sarath's user avatar
0 votes
0 answers
20 views

RegisterInstance of dbcontext with Unity

I have the following context class: public class MyContext : DbContext { ... } My repository constructor looks like this: public class MyRepo { public MyRepo(DbContext dbContext) { ...
SOfanatic's user avatar
  • 5,533
1 vote
2 answers
165 views

Unity to DryIoC conversion ParameterOverride

We are transitioning from Xamarin.Forms to .Net MAUI but our project uses Prism.Unity.Forms. We have a lot of code that basically uses the IContainer.Resolve() passing in a collection of ...
mnx's user avatar
  • 11
0 votes
0 answers
24 views

Identity return null after adding Unity in ASP MVC

i recently added unity MVC 5 to my mvc project for dependency injection. but after that User.Identity.GetUserId() return null. this is my unityConfig.cs : container.RegisterType<...
manora's user avatar
  • 23
0 votes
0 answers
95 views

MenuItem single check box in unity

I already know how to use MenuItem to extend the unity menu and we can use checkmark to let the item marked. My question is if we can let the whole menu or sub-menu only have one checked item? Such as ...
Hurui's user avatar
  • 1
1 vote
1 answer
152 views

MediatR PipelineBehavior is not triggered. Prism.Unity is used as the DI-Container

I want to improve my WPF Prism App by using a MediatR Pipelining. But my Pipline "LoggingBehavior" ist not triggert. The setup of the pipelin in the DI Contianer settings: ...
Peter Krämer's user avatar
0 votes
2 answers
168 views

Package manager error every time I create a project

Package manager error every time I create a new project in Unity occurs. I'm removing the error from the package manager, but it's inconvenient to get the error every time I create a project. How can ...
임서현's user avatar
2 votes
0 answers
61 views

SignalR issue where presumably several hubs are being created and messages are getting lost

I'm using unity as IoC container, and I'm using SignalR. This is how I configure SignalR, in Startup.cs, inside the Configure method app.Map("/signalr", map => { ...
Oscar Cabrera Rodríguez's user avatar
0 votes
0 answers
142 views

.Net Framework 4.7 - HttpClientFactory to use data from the current request context

Web API C# .NET Framework 4.7.2 Unfortunately it is not possible to use NET CORE. I have to do something a lot like: Configure HttpClientFactory to use data from the current request context my ...
Fede's user avatar
  • 7
0 votes
2 answers
134 views

.NET core SDK cannot be located vscode unity c#

my problem I am on windows 10 I tried reinstalling .net multiple times and re installed vscode i am really despreate for soloutions now
Rick's user avatar
  • 1
0 votes
1 answer
5k views

Task :unityLibrary:BuildIl2CppTask FAILED

#FAILURE: Build failed with an exception.# Where: Build file '/Users/amboji/Documents/react-native-unity-main/example/unity/builds/android/unityLibrary/build.gradle' line: 66 What went wrong: ...
amboji alur's user avatar
1 vote
1 answer
203 views

How to use unity container registered Named Type in ServiceStack Requesthandler

I am using ServiceStack (5.12.0) in my ASP.NET service along with Unity Container. I am registering instances of same type as follows public static IUnityContainer Create() { container....
A_m0's user avatar
  • 984
2 votes
1 answer
687 views

How to register existing instances in Microsoft.Extensions.DependencyInjection?

I am migrating my .NET applications Dependency Injection framework from Unity Container to Microsoft.Extensions.DependencyInjection. Now I did not find a way to register an already existing instance ...
clamp's user avatar
  • 33.2k
1 vote
0 answers
135 views

How to use InjectionFactory in C# Unity

I am new developer using C# and I am working on a project which uses C# Unity for Dependency Injection. So the current code is like this ISomeInterface var = new SomeConcreteType(param); ...
Vic's user avatar
  • 11
0 votes
0 answers
204 views

Dependency injection integration with Unity.MVC, container.Resolve cannot be used with arguments of type

I'm trying to integrate Dependency Injection with Unity.MVC to my project. With the default configuration that Unity has, controllers works perfectly fine but I would like to implement DI en other ...
Egon's user avatar
  • 25
1 vote
0 answers
390 views

Does dotnet Maui Support Unity Container for Dependency Injection

I am converting my Xamarin Forms Application to dotnetMAUI. In Xamarin I've used Unity Container for dependency injection. Is Unity Container supported in dotnet MAUI?
Mars's user avatar
  • 289
1 vote
1 answer
48 views

Move container registrations to a new assembly with Prism.Unity.Forms

I'm currently using Prism with Unity in a Xamarin.Forms project. I'm using protected override void RegisterTypes(IContainerRegistry containerRegistry) {} to register my classes in App.xaml.cs, but as ...
T-Rev's user avatar
  • 92
0 votes
1 answer
114 views

c# Converting a type to a generic

I'm trying to consolidate some code in an old .NET 4.0 project using UnityContainer for DI. I have the following list of registrations, which are lazy loaded, with a constructor injection in a Unity ...
Rebecca's user avatar
  • 14k
0 votes
0 answers
477 views

How to configure Unity container with ILogger<T> and EventLog?

I have the following problem: I am coding a Windows service using a console app project and Topshelf nuget . I am using Unity container to implement DI. Additionally, I would like to log the Windows ...
bodzio05's user avatar
0 votes
1 answer
76 views

Unity- vs code error: if ($?) { dotnet run $Player_Movement }

Hi I am getting "cd "c:\Users\UMUT\Desktop\Unity Projects\Newest\Assets" ; if ($?) { dotnet run $Player_Movement }" message and I get this error message "Couldn't find a ...
a python learner's user avatar
0 votes
1 answer
879 views

Draw line on canvas, but under text in an UI

How can i draw this line on my canvas and image, BUT under text? so basically the render order should be this: canvas image line text so text would be on top of every one of them. right now i am ...
jackermut's user avatar
0 votes
1 answer
36 views

Unity Container returning base type but wasn't before

I just got my unity config working, I started playing with web.config transformers and now it won't stop returning the base type. I've stepped through the code to confirm the mapto value being picked ...
TheFunVampire's user avatar
0 votes
1 answer
144 views

How to register a unity IoC type in web.config so that it uses a specific constructor?

I've found several places that explain how to specify a constructor when registering a type in Unity IoC using source code, but what about in a configuration file? I'd like to register a type in my ...
TheFunVampire's user avatar
0 votes
0 answers
32 views

How to inject dependencies of the same interface in some order? [duplicate]

interface I1{} class Imp1: I1{} class Imp2: I1{} class User{ I1 var1; I1 var2; User(I1 v1, I1 v2){ var1 = v1; var2 = v2; } } So we have something like this, User has ...
Vitalyk Chernysh's user avatar
1 vote
1 answer
67 views

Unity AR Animation doesn't convert to GameObject

Hello i'm coding an AR application but i have this type of error in Unity so i'm confused what i'm need to change. May you explain me how to solve this problem? using System.Collections; using System....
Harrower's user avatar
1 vote
1 answer
1k views

My game size is larger than 150 MB and I am struggling to upload on both platforms. (Unity)

I have a question regarding the upload of my game on Android playstore and iOS appstore. My game size is larger than 150 MB and I am struggling to upload on both platforms. I am writing this to you to ...
Jirawat Yodthum's user avatar
1 vote
1 answer
393 views

Unity Scene Window GUI Buttons are not rendering properly

I recently installed unity 2021.3.2f1, everything is fine, but the scene window buttons are not rendering properly, mainly there icons. Is there a way to fix this issue? NOTE: My PC does not have ...
Techno Soft's user avatar

1
2 3 4 5
79