11using System ;
22using System . Collections . Generic ;
3+ using System . Diagnostics ;
34using System . IO ;
45using System . Linq ;
56using System . Reflection ;
2627using JetBrains . ReSharper . UnitTestFramework . Exploration . Artifacts ;
2728using JetBrains . Rider . Model ;
2829using JetBrains . Util ;
30+ using JetBrains . Util . Dotnet . TargetFrameworkIds ;
2931using UtBot . Rd . Generated ;
3032using UtBot . VSharp ;
3133using Thread = System . Threading . Thread ;
@@ -68,7 +70,8 @@ protected override void Process(CSharpGeneratorContext context, IProgressIndicat
6870 var typeElement = context . ClassDeclaration . DeclaredElement ;
6971 if ( typeElement == null ) return ;
7072 if ( ! ( typeElement is IClass ) && ! ( typeElement is IStruct ) ) return ;
71- var assembly = project . GetOutputFilePath ( context . PsiModule . TargetFrameworkId ) ;
73+ var tfm = context . PsiModule . TargetFrameworkId ;
74+ var assembly = project . GetOutputFilePath ( tfm ) ;
7275 var descriptors = new List < UnitTestMethodDescriptor > ( ) ;
7376 foreach ( var inputElement in context . InputElements . WithProgress ( progress , "Generating Unit tests" )
7477 . OfType < GeneratorDeclaredElement < IMethod > > ( ) )
@@ -83,7 +86,7 @@ protected override void Process(CSharpGeneratorContext context, IProgressIndicat
8386 {
8487 try
8588 {
86- Generate ( indicator , project , assembly , descriptors ) ;
89+ Generate ( indicator , project , assembly , descriptors , tfm ) ;
8790 }
8891 finally
8992 {
@@ -93,7 +96,7 @@ protected override void Process(CSharpGeneratorContext context, IProgressIndicat
9396 }
9497
9598 private void Generate ( IBackgroundProgressIndicator progressIndicator , IProject project ,
96- VirtualFileSystemPath assemblyPath , List < UnitTestMethodDescriptor > descriptors )
99+ VirtualFileSystemPath assemblyPath , List < UnitTestMethodDescriptor > descriptors , TargetFrameworkId tfm )
97100 {
98101 SolutionBuilderRequest buildRequest ;
99102 var contextUnloaded = false ;
@@ -136,7 +139,7 @@ private void Generate(IBackgroundProgressIndicator progressIndicator, IProject p
136139 _logger . Verbose ( "Start Generation" ) ;
137140 _logger . Catch ( ( ) =>
138141 {
139- project . Locks . AssertNonMainThread ( ) ;
142+ project . Locks . AssertNonMainThread ( ) ;
140143 var pluginPath = FileSystemPath . Parse ( Assembly . GetExecutingAssembly ( ) . Location )
141144 . Parent ;
142145 var vsharpRunner = pluginPath . Combine ( "UtBot.VSharp.dll" ) ;
@@ -148,7 +151,7 @@ private void Generate(IBackgroundProgressIndicator progressIndicator, IProject p
148151 var args = new GenerateArguments ( assemblyPath . FullPath , projectCsprojPath , solutionFilePath ,
149152 moduleFqnName , methodToken , _generationTimeout ) ;
150153 var result = proc . VSharpModel . Generate . Sync ( args , RpcTimeouts . Maximal ) ;
151- unitTestProjectLocation = result ? . GeneratedProjectPath ?? "" ;
154+ unitTestProjectLocation = result ? . GeneratedProjectPath ?? "" ;
152155 _shellLocks . ExecuteOrQueue ( _lifetime , "UnitTestBuilder::Generate" , ( ) =>
153156 {
154157 if ( solution . IsValid ( ) )
@@ -233,4 +236,4 @@ private IProject TryToFindProject(ISolution solution, VirtualFileSystemPath unit
233236 {
234237 return solution . FindProjectItemsByLocation ( unitTestProjectPath ) . SingleItem ( ) as IProject ;
235238 }
236- }
239+ }
0 commit comments