Skip to content

[CodeGen] Support net6+ on server #414

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
232 commits
Select commit Hold shift + click to select a range
aff18a7
Build for EFCore 6 for net6
lindellhugo Nov 10, 2022
41ff8bc
Fix license
lindellhugo Nov 16, 2022
8fe35a1
Replace obsolete IsDependentToPrincipal with IsOnDependent
lindellhugo Nov 16, 2022
abe98d1
Replace more obsolete properties
lindellhugo Nov 16, 2022
beeadb2
If def depending on netstandard or net 6
lindellhugo Nov 16, 2022
419ca1c
Remove design
lindellhugo Nov 16, 2022
ce8c5d0
Added more ifdef
lindellhugo Nov 17, 2022
2f820ba
Cover all cases for type descriptor
lindellhugo Nov 18, 2022
3016878
Codegen using net 6
lindellhugo Nov 21, 2022
01e6de0
Delete OpenRiaServices - Backup.Server.EntityFrameworkCore.csproj
lindellhugo Nov 21, 2022
0aa659c
Merge branch 'feature/build_EFCore_for_net6' into feature/code_gen_us…
lindellhugo Nov 22, 2022
d3c2e1b
Add back removed code with comments
lindellhugo Nov 22, 2022
eac1ee4
WIP
lindellhugo Nov 22, 2022
28b4f07
Merge main
lindellhugo Nov 22, 2022
b41325c
WIP
lindellhugo Nov 22, 2022
2d556dd
WIP Run tests in net 6 to get correct asembly
lindellhugo Nov 23, 2022
43a3c8a
Make it build using net 6
lindellhugo Apr 17, 2023
8427d79
Fix
lindellhugo Apr 17, 2023
5a311ba
Make OpenRia.Services.Tools.Test
lindellhugo Apr 17, 2023
23a6a09
WIP
lindellhugo Apr 17, 2023
f8e871e
Test
lindellhugo Apr 17, 2023
b233d06
Data annotations
lindellhugo Apr 17, 2023
7662c9a
Make build work
lindellhugo Apr 17, 2023
bc471f8
WIP
lindellhugo Apr 17, 2023
a02e00f
Build engine is not supported for Net6
lindellhugo Apr 18, 2023
3f1b786
Fix cecil path
lindellhugo Apr 19, 2023
c1b0ee5
Comments
lindellhugo Apr 19, 2023
e493e57
Fix so we can run net 6
lindellhugo Apr 19, 2023
b84dd5c
Make more project build in two types
lindellhugo Apr 19, 2023
b2a9f81
Assebly fix
lindellhugo Apr 19, 2023
a24376b
Fix test
lindellhugo Apr 19, 2023
c2a2956
Fix some test by adding back BuildEngine
lindellhugo Apr 20, 2023
9203d34
Missing build engine task
lindellhugo Apr 20, 2023
e27f81b
Fix build helper framworkj
lindellhugo Apr 20, 2023
6d26f07
WIP
lindellhugo Apr 20, 2023
cf468d3
WIP
lindellhugo Apr 21, 2023
e91053c
More tests works
lindellhugo Apr 21, 2023
b5d1abf
WIP Dual Compile
lindellhugo Apr 21, 2023
c422f88
Make server test build
lindellhugo May 8, 2023
f224ae6
Merge
lindellhugo May 8, 2023
5f27b1e
MErge
lindellhugo May 8, 2023
e2a7a3c
Builds fixes
lindellhugo May 9, 2023
99dbd8d
Do not use reflection only in net 6
lindellhugo May 9, 2023
1e7cf17
Add test for net6
lindellhugo May 9, 2023
f294879
Assert net 6
lindellhugo May 9, 2023
0e2b742
Test for server project works
lindellhugo May 9, 2023
bbde6ba
Fix net6
lindellhugo May 9, 2023
de01c8a
Fails on .exe
lindellhugo May 9, 2023
dde624a
WIP
lindellhugo May 10, 2023
e4c4653
some compile fixes
Daniel-Svensson May 10, 2023
17e0789
try resolving assemblies "smarter"
Daniel-Svensson May 10, 2023
caf2cb9
Fix build
lindellhugo May 10, 2023
28842cc
Register msbuild instance
Daniel-Svensson May 10, 2023
120551c
update GetReferenceAssemblies
Daniel-Svensson May 10, 2023
1f0bba0
fix msbuild resolver
Daniel-Svensson May 10, 2023
75b9a84
Merge branch 'feature/assembly_load_context' of https://github.com/li…
lindellhugo May 10, 2023
cc0de94
WIP
lindellhugo May 10, 2023
e840bc2
Revert cecil
lindellhugo May 11, 2023
aa7994e
Migrate to net 7
lindellhugo May 11, 2023
98cdd02
Composition 7
lindellhugo May 11, 2023
4b5d48b
Use EF 7
lindellhugo May 11, 2023
bc61c7e
Fix bug
lindellhugo May 11, 2023
4cbfbba
Use net 7.0 in test
lindellhugo May 11, 2023
a47093f
Lägg till msbuildlog loggning i GetReferenceAssemblies
Daniel-Svensson May 11, 2023
d294920
Use assembly references for resolving and use common build version
lindellhugo May 11, 2023
f3db00c
Fixa "GetReferenceAssemblies"
Daniel-Svensson May 11, 2023
1b75a74
use new helper even om net4
Daniel-Svensson May 11, 2023
a498086
use metadataloadcontext in assemblygenerator AssemblyGenerator
Daniel-Svensson May 11, 2023
d137ed3
WIP
lindellhugo May 16, 2023
94beae2
Merge branch 'feature/assembly_load_context' of https://github.com/li…
lindellhugo May 16, 2023
ac9ecdf
The TS test is passing
lindellhugo May 16, 2023
d9d7103
Merge main
lindellhugo May 17, 2023
eace5bf
Fix nuspec
lindellhugo May 17, 2023
af23571
Remove
lindellhugo May 17, 2023
b88fc19
Fix query stri ng
lindellhugo May 17, 2023
066ccf9
Remove PDB
lindellhugo May 17, 2023
6a7b966
Fix merge
lindellhugo May 17, 2023
ce1759c
Fiz
lindellhugo May 17, 2023
4cbe759
WIP
lindellhugo May 17, 2023
c191d1d
Started cleaning of branch
lindellhugo May 17, 2023
6496adc
Revert
lindellhugo May 22, 2023
986f2c7
WIP
lindellhugo May 22, 2023
0d52b99
Revert to net 6
lindellhugo May 22, 2023
207be6e
Revert AspNet to Net6
lindellhugo May 22, 2023
c199d4a
Revert
lindellhugo May 22, 2023
7863eb5
Revert
lindellhugo May 22, 2023
b3b81c9
Revert
lindellhugo May 22, 2023
377600b
Do not include sample project
lindellhugo May 22, 2023
afbfa24
Make tools build
lindellhugo May 22, 2023
ce16ab3
Revert client
lindellhugo May 22, 2023
c497bf9
Make tests run 6.0
lindellhugo May 22, 2023
8966bd4
Run test only for net framework
lindellhugo May 22, 2023
42e64a1
Revert config
lindellhugo May 22, 2023
ca3a609
Use NETFRAMEWORK
lindellhugo May 22, 2023
9b7bb56
If-def sandboxer
lindellhugo May 22, 2023
0f62670
Builds
lindellhugo May 22, 2023
fc3da00
Add back
lindellhugo May 22, 2023
e2f1978
Revert
lindellhugo May 22, 2023
0c350a1
Revert LinqToSql
lindellhugo May 22, 2023
1de8095
Revert EFCore to net 6
lindellhugo May 22, 2023
d41669d
Revert
lindellhugo May 22, 2023
ed228d5
NEt 6
lindellhugo May 22, 2023
a2b2e28
Revert
lindellhugo May 22, 2023
fdc8841
Revert
lindellhugo May 22, 2023
9f4e1ab
Revert
lindellhugo May 22, 2023
a7e1158
Fix net 472 tests
lindellhugo May 22, 2023
b88bae6
Fixes for MetaDataLoadContext
lindellhugo May 22, 2023
6197880
Net 472 tests for tools works
lindellhugo May 23, 2023
a29c355
All 4.72 tests pass but still an issue with the attributes
lindellhugo May 23, 2023
25977fe
Remove assert
lindellhugo May 23, 2023
711ddc0
Merge main
lindellhugo May 23, 2023
3e1f547
Fix test
lindellhugo May 23, 2023
6b85726
FIX VB failing project, only 29 left in net 7
lindellhugo May 23, 2023
ede8650
CodeProcessor attribute is not supported
lindellhugo May 23, 2023
b4574a0
Fix logging messages
lindellhugo May 23, 2023
fea3da2
Fix validation since messages are different for Net6
lindellhugo May 23, 2023
0f6a68b
WIP - 25 test failing
lindellhugo May 23, 2023
227f394
WIP - 25 test left, we will have problems with types due to MetaDataL…
lindellhugo May 23, 2023
574c791
Fix constructor
lindellhugo May 23, 2023
4cb96b3
Fix complete test
lindellhugo May 23, 2023
92d39e6
Use not hard coded directory
lindellhugo May 23, 2023
0e618c9
Remove hardcoded path
lindellhugo May 23, 2023
a8fedcf
ScaffoldTableAttribute
lindellhugo May 23, 2023
b510dcd
Fix
lindellhugo May 23, 2023
5d9439e
Clean up
lindellhugo May 23, 2023
6232c01
Remove not used code
lindellhugo May 23, 2023
a7942e8
Use net 6
lindellhugo May 24, 2023
1f62723
Use 200
lindellhugo May 24, 2023
7c7bf4a
Add codegen project
lindellhugo May 24, 2023
efc384d
Fix build#
lindellhugo May 24, 2023
c10fd90
Revert code processor
lindellhugo May 24, 2023
2a9ae25
Fixes
lindellhugo May 24, 2023
8a69cbc
Added code for the console app
lindellhugo May 24, 2023
f5cc999
Replace !NET6_0_OR_GREATER => NETFRAMEWORK
lindellhugo May 24, 2023
21be150
Review fixes
lindellhugo May 24, 2023
d768fea
Fixes
lindellhugo May 24, 2023
ce81f18
wip
lindellhugo May 25, 2023
891f1dc
Add Ignore to tests failing in net6
lindellhugo May 25, 2023
9839f9d
Revert
lindellhugo May 25, 2023
2653308
Merge branch 'feature/assembly_load_context' of https://github.com/li…
lindellhugo May 25, 2023
b21600c
Added Ignore
lindellhugo May 25, 2023
951bcc9
Send parameters through console program
lindellhugo May 25, 2023
ba433e0
Fix build and tests
lindellhugo May 25, 2023
bafc28d
WIP sending commands to command logger
lindellhugo May 25, 2023
76cac7f
Pass parameters to code generator
lindellhugo May 25, 2023
b8548fd
Move more parameters to the console app.
lindellhugo May 25, 2023
0519946
Add more parameters
lindellhugo May 26, 2023
63108a2
Can send parameters#
lindellhugo May 29, 2023
dfb48ad
Can run codegen through Console
lindellhugo May 29, 2023
16863bf
Debug with command line arguments
lindellhugo May 29, 2023
124e907
Fix code gen ref
lindellhugo May 30, 2023
01584f3
Fix post build script#
lindellhugo May 30, 2023
1a22c0a
All tests ok
lindellhugo May 30, 2023
b1b5c3e
Not needed change
lindellhugo May 30, 2023
afe3621
Remove backslash
lindellhugo May 31, 2023
be6aa18
Use xcopy
lindellhugo May 31, 2023
652b9d7
Log more output to console
Daniel-Svensson May 31, 2023
6012abb
Added references, more logging and start process with ProcessStartInfo
SandstromErik May 31, 2023
276e5e4
Fix clean compilation of ClientClassLib
Daniel-Svensson May 31, 2023
04a16e6
A small fix for IsNetFramework
Daniel-Svensson May 31, 2023
08e31a9
Use Microsoft.Build.Locator in console app
Daniel-Svensson May 31, 2023
c2e4a2b
Use net 6.0
lindellhugo Jun 1, 2023
e5db68f
Run codegen on latest availible runtime
Daniel-Svensson Jun 1, 2023
a5dedb3
Make sure to read .dll instead of .exe of server project
Daniel-Svensson Jun 1, 2023
1634b53
Setting for debugging child processes
SandstromErik Jun 1, 2023
4e8ceb5
Enable loading of aspnetcore assemblies
Daniel-Svensson Jun 1, 2023
8bd7e4f
Merge remote-tracking branch 'upstream/main' into feature/assembly_lo…
Daniel-Svensson Jun 2, 2023
83e1256
Only use default AssemblyLoadContext in console app
Daniel-Svensson Jun 2, 2023
9bd6bcc
CreateRIA60_TS is green !
Daniel-Svensson Jun 2, 2023
0cf7419
Update nuspec files
Daniel-Svensson Jun 2, 2023
9611194
run more tests which now works
Daniel-Svensson Jun 3, 2023
b38211f
remove AppDomainUtilities since we don't do read only reflection anymore
Daniel-Svensson Jun 9, 2023
2db4077
IsNetFramework -> IsServerProjectNetFramework and simplify
Daniel-Svensson Jun 9, 2023
9fc6236
cleanup
Daniel-Svensson Jun 9, 2023
991a85e
more cleanup
Daniel-Svensson Jun 9, 2023
43ae0e2
Delete launchSettings.json
Daniel-Svensson Jun 9, 2023
a0f9b05
equals instead of compare agains 0
Daniel-Svensson Jun 9, 2023
ed57422
Cleanup after comments
SandstromErik Jun 9, 2023
12e6f9b
Remove SandBoxer
SandstromErik Jun 9, 2023
f2e2415
remove MEDIUM_TRUST specific code
Daniel-Svensson Jun 9, 2023
85c9f08
remove project reference
Daniel-Svensson Jun 9, 2023
8413d76
Fix AreTypes equal
Daniel-Svensson Jun 9, 2023
2b15e37
remove some more code
Daniel-Svensson Jun 9, 2023
3c8cb13
more cleanup
Daniel-Svensson Jun 9, 2023
77fdb45
Remove binary formatter
SandstromErik Jun 13, 2023
5152f20
Add CrossProcess logger based on pipes
Daniel-Svensson Jun 13, 2023
bdd3909
obsolete unused property
Daniel-Svensson Jun 13, 2023
b180abc
logg update
Daniel-Svensson Jun 13, 2023
c517dd2
Working cross process logger
Daniel-Svensson Jun 13, 2023
341d4b7
fix build
SandstromErik Jun 13, 2023
c16aa5a
move binders to console project and use temp file for arguments
Daniel-Svensson Jun 13, 2023
3d99da6
Fix paremeter passing
Daniel-Svensson Jun 13, 2023
32c4abf
Enable usage of "dotnet build" compatible task
Daniel-Svensson Jun 14, 2023
b62cddc
Change comment to remove compilation warning
Daniel-Svensson Jun 14, 2023
e7d7fcb
Move assemblyloadcontext code away from ClientCodeGenerationDispatcher
Daniel-Svensson Jun 14, 2023
ae9acac
Refactor code to avoid loading assemblies
Daniel-Svensson Jun 14, 2023
e68ba96
Fix warning about ordering of "+"
Daniel-Svensson Jun 14, 2023
bc7d7dc
Fix t4 nuspec
SandstromErik Jun 14, 2023
5142296
Log exitcode when not 0 and dont delete file with arguments
SandstromErik Jun 14, 2023
01c16b6
suppress obsolete warnings in tools
Daniel-Svensson Jun 15, 2023
5e36e9f
Use EscapeUriString=> EscapeDataString and minor fixes
Daniel-Svensson Jun 15, 2023
bbbf301
undo uncommenting of test file
Daniel-Svensson Jun 16, 2023
caf43b6
maybe fix analyzer comment
Daniel-Svensson Jun 16, 2023
e925eb3
Fix NotificationMethodGeneratorTest
Daniel-Svensson Jun 19, 2023
3f348fe
use HAS_LINQ2SQL for T4 template and avoid creating Attribute builder…
Daniel-Svensson Jun 19, 2023
3b0d064
Codegen speed: Dont create attribute builders for OpenRiaServicesAttr…
Daniel-Svensson Jun 19, 2023
090e733
NotificationMethodGeneratorTest update
Daniel-Svensson Jun 19, 2023
b8ded25
Some fixes
SandstromErik Jun 19, 2023
11484c7
Summary for param logger
SandstromErik Jun 19, 2023
ed31987
Fix code analysis varnings
Daniel-Svensson Jun 19, 2023
46deba6
remove UnitTestTraceListener
Daniel-Svensson Jun 19, 2023
8602e12
remove UnitTestTraceListener
Daniel-Svensson Jun 19, 2023
93eb28a
Minor test fixes
Daniel-Svensson Jun 19, 2023
0240770
update version of mstest and Microsoft.NET.Test.Sdk
Daniel-Svensson Jun 19, 2023
5a4ccd6
remove VB reference from .NET in tests again
Daniel-Svensson Jun 19, 2023
c36cded
Stop ignoring some tests for net6 and some refactoring
SandstromErik Jun 19, 2023
15c92b7
Add testhost.dll.config
SandstromErik Jun 19, 2023
bea9fa8
cleanup deployment item
Daniel-Svensson Jun 19, 2023
1f77b9f
Downgrade MSTest to 2.2.1
Daniel-Svensson Jun 19, 2023
cff3220
Use ClientClassLib as reference for code generation since it has net6…
Daniel-Svensson Jun 19, 2023
a000bb7
Fix a few codegen tests for net6
Daniel-Svensson Jun 19, 2023
9fdbb04
suppress varnings about 'AssociationAttribute' being obsolete
Daniel-Svensson Jun 19, 2023
fe259e3
Change before netstandard2 so it is used in tests
Daniel-Svensson Jun 19, 2023
c75e390
Fixes for tests
Daniel-Svensson Jun 20, 2023
37e0d9f
Improve MockSharedCodeServcie
Daniel-Svensson Jun 20, 2023
cd1aaab
Fix MockSharedCodeService fix - it did not work with net framework
Daniel-Svensson Jun 20, 2023
1b8bf8c
use NETFRAMEWORK instead of !NET6
SandstromErik Jun 20, 2023
888b557
Another one
SandstromErik Jun 20, 2023
cd20bd2
Fixed comments
SandstromErik Jun 20, 2023
ccd3e7d
remove some todo and fix analyser varning
Daniel-Svensson Jun 20, 2023
9f23695
Fix todo and codesmell
SandstromErik Jun 20, 2023
472275d
disable test for .NET 6
Daniel-Svensson Jun 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@
<file src="..\..\src\bin\Release\net472\OpenRiaServices.Tools.dll" target="tasks\net472\OpenRiaServices.Tools.dll"/>
<file src="..\..\src\bin\Release\net472\Mono.Cecil.dll" target="tasks\net472\Mono.Cecil.dll"/>
<file src="..\..\src\bin\Release\net472\Mono.Cecil.Pdb.dll" target="tasks\net472\Mono.Cecil.Pdb.dll"/>
<!-- TODO: Make a publish of project and take assemblies from there instead -->
<file src="..\..\src\OpenRiaServices.Tools.CodeGenTask\bin\Release\net6.0\**\*.*" target="tasks\net6.0\"/>
</files>
</package>
</package>
17 changes: 15 additions & 2 deletions NuGet/OpenRiaServices.T4.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@
<language>en-US</language>
<tags>WCF RIA Services RIAServices T4 OpenRiaServices</tags>
<dependencies>
<dependency id="OpenRiaServices.Server" version="$version$" />
<dependency id="Mono.Cecil" version="0.11.5" />
<group targetFramework="net6.0">
<dependency id="OpenRiaServices.Server" version="$version$" />
<dependency id="Mono.Cecil" version="0.11.5" />
</group>
<group targetFramework="net472">
<dependency id="OpenRiaServices.Server" version="$version$" />
<dependency id="Mono.Cecil" version="0.11.5" />
</group>
</dependencies>
</metadata>
<files>
Expand All @@ -27,5 +33,12 @@
<file src="..\src\bin\Release\net472\OpenRiaServices.Tools.dll" target="lib\net472\OpenRiaServices.Tools.dll" />
<file src="..\src\bin\Release\net472\OpenRiaServices.Tools.pdb" target="lib\net472\OpenRiaServices.Tools.pdb" />
<file src="..\src\bin\Release\net472\OpenRiaServices.Tools.xml" target="lib\net472\OpenRiaServices.Tools.xml" />

<file src="..\src\bin\Release\net6.0\OpenRiaServices.Tools.TextTemplate.dll" target="lib\net6.0\OpenRiaServices.Tools.TextTemplate.dll" />
<file src="..\src\bin\Release\net6.0\OpenRiaServices.Tools.TextTemplate.pdb" target="lib\net6.0\OpenRiaServices.Tools.TextTemplate.pdb" />
<file src="..\src\bin\Release\net6.0\OpenRiaServices.Tools.TextTemplate.xml" target="lib\net6.0\OpenRiaServices.Tools.TextTemplate.xml" />
<file src="..\src\bin\Release\net6.0\OpenRiaServices.Tools.dll" target="lib\net6.0\OpenRiaServices.Tools.dll" />
<file src="..\src\bin\Release\net6.0\OpenRiaServices.Tools.pdb" target="lib\net6.0\OpenRiaServices.Tools.pdb" />
<file src="..\src\bin\Release\net6.0\OpenRiaServices.Tools.xml" target="lib\net6.0\OpenRiaServices.Tools.xml" />
</files>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public WebDomainClient(Uri serviceUri, bool usesHttps, WcfDomainClientFactory do
private static WcfDomainClientFactory CreateDefaultDomainClientFactory()
{

#if NETSTANDARD
#if !NETFRAMEWORK
return new SoapDomainClientFactory();
#else
return new WebDomainClientFactory();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net472;net6.0;netstandard2.0;</TargetFrameworks>
<PackageTags>WCF;RIA;Services;RIAServices;Silverlight;OpenRiaServices</PackageTags>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<ItemGroup Condition=" '$(TargetFramework)' != 'net472' ">
<PackageReference Include="System.ServiceModel.Http" Version="4.10.2" />
</ItemGroup>

Expand Down Expand Up @@ -36,7 +36,7 @@
</ItemGroup>

<!-- Remove ServiceModel.Web dependent parts (binary endpoint) -->
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<ItemGroup Condition="'$(TargetFramework)' != 'net472'">
<Compile Remove="Data\Behaviors\MessageUtility.cs" />
<Compile Remove="Web\WebDomainClientFactory.cs" />
<Compile Remove="Web\Behaviors\WebDomainClientWebHttpBehavior.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace OpenRiaServices.Client.Web
{
#if NETSTANDARD
#if !NETFRAMEWORK
/// <summary>
/// Base class DomainClientFactories targeting WCF and creating <see cref="WebDomainClient{TContract}"/> instances.
/// For most uses you should use a concerete implementation such as
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<PackageReference Include="EntityFramework" Version="6.4.4" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Test\Desktop\OpenRiaServices.Common.DomainServices.Test\OpenRiaServices.Common.DomainServices.Test.csproj" />
Expand Down
22 changes: 0 additions & 22 deletions src/OpenRiaServices.Hosting.Local/Test/DomainServiceProxyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -666,28 +666,6 @@ public void DisposalTracking()

#endregion // IDisposable Tests

#region MediumTrust Tests


[TestMethod]
[Ignore]
// TODO: [roncain] Need to work with CLR team to understand why we require SecurityPermission.Unrestricted to be
// run this test. With only Internet zone permissions, OperationException throws TypeLoadException due to its
// GetObjectData being SecuritySafeCritical.
[Description("Verifies the proxies in partial trust")]
public void DomainServiceProxy_MediumTrust_Proxies()
{
SandBoxer.ExecuteInMediumTrust(Callback_MediumTrust_Proxies);
}

public static void Callback_MediumTrust_Proxies()
{
var proxy = DomainServiceProxy.Create<IMockDomainServiceContract, MockDomainService>(new MockDomainServiceContext(DomainOperationType.Query));
var results = proxy.GetEntities();
}

#endregion // MediumTrust Tests

#endregion Test Methods

#region Helper Methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -672,39 +672,7 @@ private static ModuleBuilder CreateModuleBuilder()
string name = string.Format(CultureInfo.InvariantCulture, "DataContractSurrogates_{0}", Guid.NewGuid().ToString());
assemName.Name = name;

// The following code seems have been part of the original WCF Ria Services.
// Using it in signed build might enable medium trust support but, I haven't tested it
#if MEDIUM_TRUST
// If the AppDomain is running in full trust, then put SecurityCriticalAttribute on the dynamic assembly
// such that our surrogates can call into entity types that are critical (which is the default for
// applications running in full trust).
// Otherwise, use SecurityTransparentAttribute.
CustomAttributeBuilder securityAttribute;
if (myDomain.IsFullyTrusted)
{
securityAttribute = new CustomAttributeBuilder(
typeof(AllowPartiallyTrustedCallersAttribute).GetConstructor(Type.EmptyTypes),
Array.Empty<object>());
}
else
{
securityAttribute = new CustomAttributeBuilder(
typeof(SecurityTransparentAttribute).GetConstructor(Type.EmptyTypes),
Array.Empty<object>());
}

AssemblyBuilder assemblyBuilder = myDomain.DefineDynamicAssembly(
assemName,
AssemblyBuilderAccess.Run,
new CustomAttributeBuilder[]
{
securityAttribute,
new CustomAttributeBuilder(
typeof(SecurityRulesAttribute).GetConstructor(new Type[] { typeof(SecurityRuleSet) }),
new object[] { SecurityRuleSet.Level2 })
},
SecurityContextSource.CurrentAppDomain);
#elif NET5_0_OR_GREATER
#if NET6_0_OR_GREATER
// Dev note: the SecurityContextSource.CurrentAppDomain is new in CLR 4.0
// and permits the assembly builder to inherit the security permissions of the
// app domain. - CDB Removed, Medium trust support removed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public override bool CanBuildChannelFactory<TChannel>(BindingContext context)
return context.CanBuildInnerChannelFactory<TChannel>();
}

#if !SILVERLIGHT && !NETSTANDARD2_0
#if NETFRAMEWORK
public override IChannelListener<TChannel> BuildChannelListener<TChannel>(BindingContext context)
{
if (context == null)
Expand Down
16 changes: 0 additions & 16 deletions src/OpenRiaServices.Hosting.Wcf/Test/Data/DomainServiceHostTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,22 +122,6 @@ private THost CreateHost<THost, TService>(params Uri[] baseAddresses) where THos
{
return (THost)Activator.CreateInstance(typeof(THost), typeof(TService), baseAddresses);
}

#if !MEDIUM_TRUST

[Ignore]
#endif
[TestMethod]
[Description("Verifies the DomainServicesSection can be created in partial trust")]
public void DomainServiceHost_MediumTrust_DomainServicesSection()
{
SandBoxer.ExecuteInMediumTrust(Callback_MediumTrust_DomainServicesSection);
}

public static void Callback_MediumTrust_DomainServicesSection()
{
new DomainServicesSection();
}
}

[OpenRiaServices.Server.EnableClientAccess]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' != 'net472' ">
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
Expand Down
113 changes: 0 additions & 113 deletions src/OpenRiaServices.Server/Test/DomainServiceDescriptionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1594,119 +1594,6 @@ public void DomainServiceDescription_InterfaceAttributes()
}
}

#if MEDIUM_TRUST

[TestMethod]
[Description("Verifies the medium trust sandbox calls back as SecurityTransparent")]
public void DomainServiceDescription_MediumTrust_Verify_Sandbox_IsTransparent()
{
Assert.IsFalse(typeof(DomainServiceDescriptionTest).IsSecurityTransparent, "Expected our unit test to be not transparent");
SandBoxer.ExecuteInMediumTrust(Callback_Verify_Sandbox_Transparent);
}

public static void Callback_Verify_Sandbox_Transparent()
{
Assert.IsTrue(typeof(DomainServiceDescriptionTest).IsSecurityTransparent, "Expected our unit test to be transparent");
}

[TestMethod]
[Description("Verifies the medium trust sandbox assert and parameter mechanisms are handled properly")]
public void DomainServiceDescription_MediumTrust_Verify_SandboxAssertMechanism()
{
AssertFailedException expectedException = null;
AssertFailedException actualException = null;

// Capture a real Assert.Fail exception for comparison
try
{
Assert.Fail("oops");
}
catch (AssertFailedException afe)
{
expectedException = afe;
}

// Now go do that in partial trust
try
{
SandBoxer.ExecuteInMediumTrust(Callback_Verify_SandboxAssertException, "oops");
Assert.Fail("SandBox mechanism failed to throw");
}
catch (AssertFailedException afe)
{
actualException = afe;
}

Assert.AreEqual(expectedException.Message, actualException.Message, "SandBoxAssertException did not work properly.");
}

public static void Callback_Verify_SandboxAssertException(string message)
{
Assert.Fail(message);
}

// TODO: [roncain] Investigating why this succeeds
//[TestMethod]
//[Description("Private reflection should not work in partial trust")]
//public void DomainServiceDescription_MediumTrust_PrivateReflection_Throws()
//{
// MethodInfo mInfo = typeof(DomainServiceDescriptionTest).GetMethod("AFineAndPrivatePlace", BindingFlags.Static | BindingFlags.NonPublic);
// Assert.IsNotNull(mInfo, "Expected to find AFineAndPrivatePlace method");
// SandBoxer.ExecuteInMediumTrust(Callback_Verify_Sandbox_PrivateReflection);
//}

//public static void Callback_Verify_Sandbox_PrivateReflection()
//{
// try
// {
// MethodInfo mInfo = typeof(DomainServiceDescriptionTest).GetMethod("AFineAndPrivatePlace", BindingFlags.Static | BindingFlags.NonPublic);
// SandBoxer.Assert(mInfo == null, "Did not expect private reflection to succeed");
// }
// catch (SecurityException)
// {
// }
// }
//private static void AFineAndPrivatePlace() { }

[TestMethod]
[Description("TypeDescriptor.AddProvider should fail")]
public void DomainServiceDescription_MediumTrust_TdpRegistrationFails()
{
SandBoxer.ExecuteInMediumTrust(Callback_TdpRegistrationFail);
}

public static void Callback_TdpRegistrationFail()
{
try
{
Mock_CG_SimpleEntity entity = new Mock_CG_SimpleEntity();
RegisterProvider(entity);
Assert.Fail("Expected TDP registration to throw SecurityException");
}
catch (SecurityException)
{
}
}

private static void RegisterProvider(object instance)
{
TypeDescriptor.AddProvider(TypeDescriptor.GetProvider(instance), instance);
}

[TestMethod]
[Description("Verifies DomainServiceDescription.GetDescription works in medium trust")]
public void DomainServiceDescription_MediumTrust_GetDescription()
{
SandBoxer.ExecuteInMediumTrust(Callback_BasicDescriptionSucceeds);
}

public static void Callback_BasicDescriptionSucceeds()
{
DomainServiceDescription dsd = DomainServiceDescription.GetDescription(typeof(DomainService_Basic));
Assert.IsNotNull(dsd, "Expected nominal DomainServiceDescription to return non-null instance");
}
#endif

[TestMethod]
[Description("DomainServiceDescription's internal cache should be thread-safe")]
public void DomainServiceDescription_MultipleThreads()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System.CommandLine;
using System.CommandLine.Binding;

namespace OpenRiaServices.Tools.CodeGenTask;

/// <summary>
/// Binder class for <see cref="ClientCodeGenerationOptions"/>. Used to bind arguments to handlers
/// </summary>
public class ClientCodeGenerationOptionsBinder : BinderBase<ClientCodeGenerationOptions>
{
private readonly Option<string> _language;
private readonly Option<string> _clientFrameworkPath;
private readonly Option<string> _serverProjectPath;
private readonly Option<string> _clientProjectPath;
private readonly Option<string> _clientRootNamespace;
private readonly Option<string> _serverRootNamespace;
private readonly Option<bool> _isApplicationContextGenerationEnabled;
private readonly Option<TargetPlatform> _clientProjectTargetPlatform;
private readonly Option<bool> _useFullTypeNames;

/// <summary>
/// Constructor that sets all arguments
/// </summary>
public ClientCodeGenerationOptionsBinder(Option<string> language, Option<string> clientFrameworkPath, Option<string> serverProjectPath, Option<string> clientProjectPath, Option<string> clientRootNamespace, Option<string> serverRootNamespace, Option<bool> isApplicationContextGenerationEnabled, Option<TargetPlatform> clientProjectTargetPlatform, Option<bool> useFullTypeNames)
{
_language = language;
_clientFrameworkPath = clientFrameworkPath;
_serverProjectPath = serverProjectPath;
_clientProjectPath = clientProjectPath;
_clientRootNamespace = clientRootNamespace;
_serverRootNamespace = serverRootNamespace;
_isApplicationContextGenerationEnabled = isApplicationContextGenerationEnabled;
_clientProjectTargetPlatform = clientProjectTargetPlatform;
_useFullTypeNames = useFullTypeNames;
}

/// <summary>
/// Parse result in binding context to create and return <see cref="ClientCodeGenerationOptions"/>
/// </summary>
protected override ClientCodeGenerationOptions GetBoundValue(BindingContext bindingContext)
{
return new ClientCodeGenerationOptions
{
Language = bindingContext.ParseResult.GetValueForOption(_language),
ClientFrameworkPath = bindingContext.ParseResult.GetValueForOption(_clientFrameworkPath),
ServerProjectPath = bindingContext.ParseResult.GetValueForOption(_serverProjectPath),
ClientProjectPath = bindingContext.ParseResult.GetValueForOption(_clientProjectPath),
ClientRootNamespace = bindingContext.ParseResult.GetValueForOption(_clientRootNamespace),
ServerRootNamespace = bindingContext.ParseResult.GetValueForOption(_serverRootNamespace),
IsApplicationContextGenerationEnabled = bindingContext.ParseResult.GetValueForOption(_isApplicationContextGenerationEnabled),
ClientProjectTargetPlatform = bindingContext.ParseResult.GetValueForOption(_clientProjectTargetPlatform),
UseFullTypeNames = bindingContext.ParseResult.GetValueForOption(_useFullTypeNames),
};
}
}
Loading