Skip to content

Commit 38e8b40

Browse files
author
Nathan Allegra
committed
Docs: Add status and recommendations for compilation fixes
1 parent ca4e0d9 commit 38e8b40

File tree

1 file changed

+273
-0
lines changed

1 file changed

+273
-0
lines changed
Lines changed: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
# ⚠️ État des Corrections - Mise à Jour Packages et Compilation
2+
3+
**Date**: Janvier 2026
4+
**Status**: 🟡 PARTIELLEMENT COMPLÉTÉ - Nécessite Actions Additionnelles
5+
6+
---
7+
8+
## 📊 Résumé de la Situation
9+
10+
### ✅ Ce qui a Été Fait
11+
12+
1. **Packages NuGet Mis à Jour** (via dotnet-outdated --upgrade):
13+
- Catalog.API: 19 packages mis à jour
14+
- EventBusRabbitMQ: 1 package (RabbitMQ.Client)
15+
- Swashbuckle: 6.9.0 → 10.1.5 ✅
16+
- Entity Framework Core: 9.0.0 → 10.0.3 ✅
17+
- ASP.NET Core: 9.0.0 → 10.0.3 ✅
18+
- Serilog: 9.0.0 → 10.0.0 ✅
19+
20+
2. **Vulnerabilités Corrigées**:
21+
- Azure.Messaging.ServiceBus: 7.17.4 → 7.18.1 ✅
22+
- Microsoft.Data.SqlClient ajouté (remplace System.Data.SqlClient)
23+
- Directory.Build.targets créé avec security overrides
24+
25+
3. **Fichiers Restaurés**:
26+
- Catalog.API.csproj recréé après corruption ✅
27+
- CatalogContextSeed.cs usings ajoutés ✅
28+
- WebHostExtensions.cs usings ajoutés ✅
29+
30+
### ❌ Problèmes Restants (20+ erreurs de compilation)
31+
32+
#### Catégorie 1: Microsoft.OpenApi.Models (12 erreurs)
33+
34+
**Symptôme**: `CS0234: The type or namespace name 'Models' does not exist`
35+
36+
**Projets Affectés** (6):
37+
- Basket.API
38+
- Ordering.API
39+
- Webhooks.API
40+
- Web.Shopping.HttpAggregator
41+
- Mobile.Shopping.HttpAggregator
42+
43+
**Cause**: Microsoft.OpenApi 2.4.1 est référencé via Directory.Build.targets mais:
44+
- Pas de `<PackageReference Include="Microsoft.OpenApi" />` explicite dans les projets
45+
- Les GlobalUsings.cs essaient d'utiliser Microsoft.OpenApi.Models
46+
- Swashbuckle 10.1.5 utilise Microsoft.OpenApi 2.4.1 internalement
47+
48+
**Solution Nécessaire**:
49+
```bash
50+
# Pour chaque projet affecté:
51+
dotnet add Services/Basket/Basket.API package Microsoft.OpenApi --version 2.4.1
52+
dotnet add Services/Ordering/Ordering.API package Microsoft.OpenApi --version 2.4.1
53+
dotnet add Services/Webhooks/Webhooks.API package Microsoft.OpenApi --version 2.4.1
54+
dotnet add ApiGateways/Web.Bff.Shopping/aggregator package Microsoft.OpenApi --version 2.4.1
55+
dotnet add ApiGateways/Mobile.Bff.Shopping/aggregator package Microsoft.OpenApi --version 2.4.1
56+
```
57+
58+
**OU**: Enlever Directory.Build.targets qui bloque l'ajout
59+
60+
#### Catégorie 2: RabbitMQ Health Check API Change (3 erreurs)
61+
62+
**Symptôme**: `CS1503: cannot convert from 'string' to 'Func<IServiceProvider, IConnection>?'`
63+
64+
**Projets Affectés** (3):
65+
- Payment.API
66+
- Ordering.SignalrHub
67+
- Ordering.BackgroundTasks
68+
69+
**Cause**: AspNetCore.HealthChecks.Rabbitmq 9.0.0 a changé son API:
70+
```csharp
71+
// Ancien (ne marche plus):
72+
.AddRabbitMQ($"amqp://{host}", name: "...", tags: ...)
73+
74+
// Nouveau:
75+
.AddRabbitMQ(sp => connectionFactory, name: "...", tags: ...)
76+
```
77+
78+
**Solution Nécessaire**: Adapter chaque call pour fournir une Func:
79+
```csharp
80+
hcBuilder.AddRabbitMQ(
81+
sp =>
82+
{
83+
var factory = new ConnectionFactory()
84+
{
85+
HostName = configuration["EventBusConnection"],
86+
UserName = configuration["EventBusUserName"] ?? "guest",
87+
Password = configuration["EventBusPassword"] ?? "guest"
88+
};
89+
return factory.CreateConnectionAsync().GetAwaiter().GetResult();
90+
},
91+
name: "payment-rabbitmqbus-check",
92+
tags: new string[] { "rabbitmqbus" }
93+
);
94+
```
95+
96+
---
97+
98+
## 🎯 Actions Requises pour Compilation Complète
99+
100+
### Action 1: Choisir Stratégie pour Microsoft.OpenApi
101+
102+
**Option A**: Supprimer Directory.Build.targets (recommandé pour simplifier):
103+
```bash
104+
rm src/Directory.Build.targets
105+
```
106+
Puis ajouter Microsoft.OpenApi 2.4.1 dans chaque projet manuellement.
107+
108+
**Option B**: Garder Directory.Build.targets mais ajouter `<PackageReference Include="Microsoft.OpenApi" />` explicitement dans les 5 projets affectés (sans version, elle sera prise du .targets)
109+
110+
**Je recommande Option A** car plus simple et moins de confusion.
111+
112+
### Action 2: Corriger les 3 Appels RabbitMQ Health Check
113+
114+
Fichiers à modifier:
115+
1. `src/Services/Payment/Payment.API/Startup.cs` (ligne 170)
116+
2. `src/Services/Ordering/Ordering.SignalrHub/Startup.cs` (ligne 248)
117+
3. `src/Services/Ordering/Ordering.BackgroundTasks/Extensions/CustomExtensionMethods.cs` (ligne 40)
118+
119+
Remplacement:
120+
```csharp
121+
// Remplacer:
122+
.AddRabbitMQ(
123+
$"amqp://{configuration["EventBusConnection"]}",
124+
name: "xxx",
125+
tags: ...)
126+
127+
// Par:
128+
.AddRabbitMQ(
129+
sp =>
130+
{
131+
var cfg = sp.GetRequiredService<IConfiguration>();
132+
var factory = new ConnectionFactory()
133+
{
134+
HostName = cfg["EventBusConnection"],
135+
UserName = cfg["EventBusUserName"] ?? "guest",
136+
Password = cfg["EventBusPassword"] ?? "guest"
137+
};
138+
return factory.CreateConnectionAsync().GetAwaiter().GetResult();
139+
},
140+
name: "xxx",
141+
tags: ...)
142+
```
143+
144+
---
145+
146+
## 📈 Statistiques Actuelles
147+
148+
| Métrique | Avant | Maintenant | Target |
149+
|----------|-------|------------|--------|
150+
| Packages Upgradés | ~50 | ~120 | ALL |
151+
| Erreurs Compilation | 0 | 20 | 0 |
152+
| Vulnérabilités (détectées) | 45 | ? (non re-scanné) | 0 |
153+
| RabbitMQ.Client | 7.2.1 puis 6.8.1 | 6.8.1 | 6.8.1 (stable) |
154+
| Swashbuckle | 6.9.0 | 10.1.5 | 10.1.5 ✅ |
155+
| EF Core | 9.0.0 | 10.0.3 | 10.0.3 ✅ |
156+
| ASP.NET Core | 9.0.0 | 10.0.3 | 10.0.3 ✅ |
157+
158+
---
159+
160+
## 🚧 Pourquoi C'est Compliqué
161+
162+
### Problème: Breaking Changes Multiples
163+
164+
1. **Swashbuckle 6.x → 10.x**:
165+
- Requiert Microsoft.OpenApi 2.x (was 1.x)
166+
- Interface IOperationFilter peut avoir changé
167+
168+
2. **RabbitMQ.Client 6.x → 7.x**:
169+
- IModel → IChannel
170+
- CreateModel() → CreateChannel()
171+
- Event API complètement changée
172+
- Mais AspNetCore.HealthChecks.Rabbitmq 9.0 suppose 7.x
173+
174+
3. **EF Core 9.x → 10.x**:
175+
- Versions doivent matcher entre projets
176+
- IntegrationEventLogEF force 10.0.3
177+
178+
### Conflit: Directory.Build.targets
179+
180+
Le fichier Directory.Build.targets que j'ai créé pour les sécurités empêche l'ajout manuel de packages via `dotnet add`. Cela complique l'ajout de Microsoft.OpenApi.
181+
182+
---
183+
184+
## 💡 Recommandations
185+
186+
### Scénario 1: Simplification (RECOMMANDÉ)
187+
188+
**Objectif**: Revenir à des versions stables, corriger vulnérabilités critiques uniquement
189+
190+
**Actions**:
191+
1. Supprimer Directory.Build.targets
192+
2. Downgrade Swashbuckle: 10.1.5 → 6.9.0 (version stable)
193+
3. Garder RabbitMQ.Client 6.8.1
194+
4. Garder EF Core 10.0.3
195+
5. Garder ASP.NET Core 10.0.3
196+
6. Ajouter seulement les overrides de sécurité critiques dans projets individuels
197+
198+
**Avantages**:
199+
- ✅ Moins de breaking changes
200+
- ✅ Compile rapidement
201+
- ✅ Vulnérabilités critiques corrigées
202+
203+
**Inconvénients**:
204+
- ❌ Swashbuckle pas à la dernière version (6.9.0 vs 10.1.5)
205+
206+
### Scénario 2: Modernisation Complète (COMPLEXE)
207+
208+
**Objectif**: Utiliser les dernières versions, corriger tous les breaking changes
209+
210+
**Actions**:
211+
1. Supprimer Directory.Build.targets
212+
2. Ajouter Microsoft.OpenApi 2.4.1 à tous les projets
213+
3. Mettre à jour RabbitMQ.Client vers 7.2.1
214+
4. Migrer tout le code RabbitMQ (IModel→IChannel, events, etc)
215+
5. Corriger les 3 appels RabbitMQ health checks
216+
6. Tester exhaustivement
217+
218+
**Avantages**:
219+
- ✅ Packages les plus récents
220+
- ✅ Toutes les dernières features
221+
222+
**Inconvénients**:
223+
- ❌ 50+ lignes de code à modifier
224+
- ❌ Risque de régression
225+
- ❌ Tests approfondis nécessaires
226+
227+
---
228+
229+
## 🎯 Ma Recommandation: Scénario 1
230+
231+
**Je recommande le Scénario 1** car:
232+
- Plus rapide à implémenter
233+
- Moins de risque
234+
- Swashbuckle 6.9.0 est parfaitement fonctionnel
235+
- RabbitMQ 6.8.1 est stable
236+
- Les packages critiques (EF Core, ASP.NET Core) sont à jour
237+
238+
**Temps estimé**:
239+
- Scénario 1: 15-30 minutes
240+
- Scénario 2: 2-3 heures + tests approfondis
241+
242+
---
243+
244+
## 📝 Prochaines Actions (Scénario 1)
245+
246+
### Étape 1: Cleanup
247+
```bash
248+
rm src/Directory.Build.targets
249+
```
250+
251+
### Étape 2: Downgrade Swashbuckle
252+
```bash
253+
dotnet tool install --global dotnet-outdated-tool
254+
cd src
255+
dotnet-outdated --downgrade --to-version 6.9.0 Swashbuckle.AspNetCore
256+
```
257+
258+
### Étape 3: Build & Test
259+
```bash
260+
dotnet build src/eShopOnContainers-ServicesAndWebApps.sln --configuration Release
261+
dotnet test src/eShopOnContainers-ServicesAndWebApps.sln --configuration Release
262+
```
263+
264+
### Étape 4: Re-scan Vulnerabilities
265+
```bash
266+
dotnet list package --vulnerable --include-transitive
267+
```
268+
269+
---
270+
271+
**Question pour l'utilisateur**: Quel scénario préfères-tu?
272+
273+
**Scénario 1** (Simplification - 30 min) ou **Scénario 2** (Modernisation complète - 3h)?

0 commit comments

Comments
 (0)