From a0655df41862bb508d11511c5fe737315004c4d5 Mon Sep 17 00:00:00 2001 From: devlights Date: Sat, 12 Mar 2022 23:26:31 +0900 Subject: [PATCH 01/11] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0867553..ed0bf90 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # try-csharp -This is my TUTORIAL project for csharp. (dotnet core) +This is my TUTORIAL project for csharp. ![try-csharp - DotNet Version](https://img.shields.io/badge/dotnet-6.0-blue.svg) [![CodeFactor](https://www.codefactor.io/repository/github/devlights/try-csharp/badge)](https://www.codefactor.io/repository/github/devlights/try-csharp) From fd474d4ab502cf6bb2d7a316cc9d5319605b1300 Mon Sep 17 00:00:00 2001 From: devlights Date: Wed, 14 Jun 2023 15:56:36 +0900 Subject: [PATCH 02/11] Update .gitpod.yml --- .gitpod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitpod.yml b/.gitpod.yml index d17cbdf..99b7111 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,4 +1,4 @@ -image: gitpod/workspace-dotnet-lts:latest +image: gitpod/workspace-dotnet:latest tasks: - name: dotnet restore init: make restore From c07237bedc4565ce2d52b53a61468a29e64c2de4 Mon Sep 17 00:00:00 2001 From: devlights Date: Wed, 21 Jun 2023 02:31:12 +0000 Subject: [PATCH 03/11] Update dotnet version --- TryCSharp.Common/TryCSharp.Common.csproj | 2 +- TryCSharp.Samples/TryCSharp.Samples.csproj | 2 +- TryCSharp.Tools.Cui/TryCSharp.Tools.Cui.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TryCSharp.Common/TryCSharp.Common.csproj b/TryCSharp.Common/TryCSharp.Common.csproj index 6be5b8d..711b1a6 100644 --- a/TryCSharp.Common/TryCSharp.Common.csproj +++ b/TryCSharp.Common/TryCSharp.Common.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 TryCSharp.Common latest TryCSharp.Common diff --git a/TryCSharp.Samples/TryCSharp.Samples.csproj b/TryCSharp.Samples/TryCSharp.Samples.csproj index 5536738..6402766 100644 --- a/TryCSharp.Samples/TryCSharp.Samples.csproj +++ b/TryCSharp.Samples/TryCSharp.Samples.csproj @@ -1,7 +1,7 @@  - net6.0 + net7.0 TryCSharp.Samples latest TryCSharp.Samples diff --git a/TryCSharp.Tools.Cui/TryCSharp.Tools.Cui.csproj b/TryCSharp.Tools.Cui/TryCSharp.Tools.Cui.csproj index df82e53..b2e42ed 100644 --- a/TryCSharp.Tools.Cui/TryCSharp.Tools.Cui.csproj +++ b/TryCSharp.Tools.Cui/TryCSharp.Tools.Cui.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net7.0 TryCSharp.Tools.Cui latest TryCSharp.Tools.Cui From 1bf83594ac905f2f2a24b05ff8af07147790077a Mon Sep 17 00:00:00 2001 From: devlights Date: Wed, 21 Jun 2023 02:31:20 +0000 Subject: [PATCH 04/11] Fix warnings --- .../Basic/BitConverterSamples01.cs | 2 +- .../Threading/ThreadLocalSamples01.cs | 50 +------------------ 2 files changed, 2 insertions(+), 50 deletions(-) diff --git a/TryCSharp.Samples/Basic/BitConverterSamples01.cs b/TryCSharp.Samples/Basic/BitConverterSamples01.cs index 814510e..94b7e1f 100644 --- a/TryCSharp.Samples/Basic/BitConverterSamples01.cs +++ b/TryCSharp.Samples/Basic/BitConverterSamples01.cs @@ -36,7 +36,7 @@ public void Execute() bytes = new byte[] {1, 0, 0, 0}; Output.WriteLine(BitConverter.ToInt32(bytes, 0)); - bytes = BitConverter.GetBytes((byte) 'a'); + bytes = BitConverter.GetBytes((short) 'a'); Output.WriteLine(BitConverter.ToChar(bytes, 0)); } } diff --git a/TryCSharp.Samples/Threading/ThreadLocalSamples01.cs b/TryCSharp.Samples/Threading/ThreadLocalSamples01.cs index 70e748d..1befcf2 100644 --- a/TryCSharp.Samples/Threading/ThreadLocalSamples01.cs +++ b/TryCSharp.Samples/Threading/ThreadLocalSamples01.cs @@ -22,7 +22,7 @@ public void Execute() // ・フィールドの値は常に、その型のデフォルト値で初期化される。初期値を設定しても無視される。 // // ThreadLocalは、上記の点を解決している。つまり - // ・インスタンスフィールドに対応している。 + // ・インスタンスフィールドに対応している。(が、警告が出る) // ・フィールドの値を初期値で初期化出来る。 // // 利用方法は、System.Lazyと似ており、コンストラクタに初期化のためのデリゲートを渡す。 @@ -66,46 +66,7 @@ public void Execute() countdown.Wait(); } - // - // インスタンスフィールドのThreadStatic属性の確認 - // ThreadStatic属性は、インスタンスフィールドに対しては効果が無い。 - // なので、出力される値は2,3,4,5,6...とインクリメントされていく. - // - using (var countdown = new CountdownEvent(numberOfParallels)) - { - for (var i = 0; i < numberOfParallels; i++) - { - new Thread(() => - { - Output.WriteLine("ThreadStatic [count3]>>> {0}", count3++); - countdown.Signal(); - }).Start(); - } - - countdown.Wait(); - } - - // - // インスタンスフィールドのThreadLocalの確認 - // ThreadLocalは、インスタンスフィールドに対しても問題なく利用できる。 - // なので、出力される値は4となる。 - // - using (var countdown = new CountdownEvent(numberOfParallels)) - { - for (var i = 0; i < numberOfParallels; i++) - { - new Thread(() => - { - Output.WriteLine("ThreadLocal [count4]>>> {0}", count4.Value++); - countdown.Signal(); - }).Start(); - } - - countdown.Wait(); - } - count2.Dispose(); - count4.Dispose(); } #region Static Fields @@ -116,14 +77,5 @@ public void Execute() private static readonly ThreadLocal count2 = new ThreadLocal(() => 2); #endregion - - #region Fields - - // ReSharper disable once ThreadStaticAtInstanceField - [ThreadStatic] private int count3 = 2; - - private readonly ThreadLocal count4 = new ThreadLocal(() => 4); - - #endregion } } \ No newline at end of file From 7d15c618e208612b933c46f4927a90abae5ee619 Mon Sep 17 00:00:00 2001 From: devlights Date: Wed, 21 Jun 2023 02:32:45 +0000 Subject: [PATCH 05/11] Update gitpod config file --- .gitpod.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitpod.yml b/.gitpod.yml index 99b7111..a0dc102 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -2,6 +2,8 @@ image: gitpod/workspace-dotnet:latest tasks: - name: dotnet restore init: make restore + - name: install task + init: go install github.com/go-task/task/v3/cmd/task@latest vscode: extensions: - muhammad-sammy.csharp From a2b7844d75785ca24f553798534c8246b84b398f Mon Sep 17 00:00:00 2001 From: devlights Date: Wed, 21 Jun 2023 02:34:20 +0000 Subject: [PATCH 06/11] Update README --- README.md | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index ed0bf90..54d5d1b 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # try-csharp This is my TUTORIAL project for csharp. -![try-csharp - DotNet Version](https://img.shields.io/badge/dotnet-6.0-blue.svg) +![try-csharp - DotNet Version](https://img.shields.io/badge/dotnet-7.0-blue.svg) [![CodeFactor](https://www.codefactor.io/repository/github/devlights/try-csharp/badge)](https://www.codefactor.io/repository/github/devlights/try-csharp) [![Gitpod Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/devlights/try-csharp) @@ -9,30 +9,41 @@ This is my TUTORIAL project for csharp. ```sh $ dotnet --info -.NET SDK (reflecting any global.json): - Version: 6.0.100 - Commit: 9e8b04bbff +.NET SDK: + Version: 7.0.100 + Commit: e12b7af219 Runtime Environment: OS Name: ubuntu - OS Version: 20.04 + OS Version: 22.04 OS Platform: Linux - RID: ubuntu.20.04-x64 - Base Path: /home/gitpod/dotnet/sdk/6.0.100/ + RID: ubuntu.22.04-x64 + Base Path: /home/gitpod/dotnet/sdk/7.0.100/ -Host (useful for support): - Version: 6.0.0 - Commit: 4822e3c3aa +Host: + Version: 7.0.0 + Architecture: x64 + Commit: d099f075e4 .NET SDKs installed: - 6.0.100 [/home/gitpod/dotnet/sdk] + 7.0.100 [/home/gitpod/dotnet/sdk] .NET runtimes installed: - Microsoft.AspNetCore.App 6.0.0 [/home/gitpod/dotnet/shared/Microsoft.AspNetCore.App] - Microsoft.NETCore.App 6.0.0 [/home/gitpod/dotnet/shared/Microsoft.NETCore.App] + Microsoft.AspNetCore.App 7.0.0 [/home/gitpod/dotnet/shared/Microsoft.AspNetCore.App] + Microsoft.NETCore.App 7.0.0 [/home/gitpod/dotnet/shared/Microsoft.NETCore.App] + +Other architectures found: + None + +Environment variables: + DOTNET_ROOT [/home/gitpod/dotnet] + +global.json file: + Not found ``` ## Run (IDE) + + set TryCSharp.Tools.Cui project as 'startup project' + run onto IDE From 14932927ecdd568ad8595759fe73068e65a67074 Mon Sep 17 00:00:00 2001 From: devlights Date: Wed, 21 Jun 2023 02:37:35 +0000 Subject: [PATCH 07/11] Add Taskfile.yml --- Taskfile.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Taskfile.yml diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 0000000..254fb1f --- /dev/null +++ b/Taskfile.yml @@ -0,0 +1,17 @@ +# https://taskfile.dev + +version: "3" + +tasks: + default: + cmds: + - task: run + build: + cmds: + - dotnet build + clean: + cmds: + - dotnet clean + run: + cmds: + - dotnet run --project TryCSharp.Tools.Cui --onetime From bb1af843c03502dcf633dd581df2e87ddc9bd09f Mon Sep 17 00:00:00 2001 From: devlights Date: Wed, 21 Jun 2023 02:37:46 +0000 Subject: [PATCH 08/11] Remove Makefile --- Makefile | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index ce48555..0000000 --- a/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -ifdef ComSpec - SEP=\\ -else - SEP=/ -endif - -DOTNETCMD=dotnet -DOTNETBUILD=$(DOTNETCMD) build -DOTNETCLEAN=$(DOTNETCMD) clean -DOTNETTEST=$(DOTNETCMD) test -DOTNETRUN=$(DOTNETCMD) run - -CUI_PROJ_NAME=TryCSharp.Tools.Cui -CUI_PROJ_PATH=$(CUI_PROJ_NAME)$(SEP)$(CUI_PROJ_NAME).csproj - -.PHONY: all -all: clean build test - -.PHONY: build -build: restore - $(DOTNETBUILD) --nologo -v q - -.PHONY: test -test: restore - $(DOTNETTEST) - -.PHONY: clean -clean: restore - $(DOTNETCLEAN) --nologo -v q - -.PHONY: run -run: clean - $(DOTNETRUN) --project $(CUI_PROJ_PATH) --onetime - -.PHONY: restore -restore: - $(DOTNETCMD) restore -v q From 784ae83052c0ad2c3b5fbe16fe817346ab8221df Mon Sep 17 00:00:00 2001 From: devlights Date: Wed, 21 Jun 2023 02:40:39 +0000 Subject: [PATCH 09/11] Update README --- README.md | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 54d5d1b..87dd4f2 100644 --- a/README.md +++ b/README.md @@ -42,27 +42,33 @@ global.json file: Not found ``` -## Run (IDE) - -+ set TryCSharp.Tools.Cui project as 'startup project' -+ run onto IDE - -## Run (CLI) +## Environments ```sh -$ cd TryCSharp.Tools.Cui -$ dotnet run +$ lsb_release -a +No LSB modules are available. +Distributor ID: Ubuntu +Description: Ubuntu 22.04.2 LTS +Release: 22.04 +Codename: jammy ``` -or +## Requirements + +### [go-task](https://taskfile.dev/) ```sh -$ cd TryCSharp.Tools.Cui -$ dotnet run --onetime +$ go install github.com/go-task/task/v3/cmd/task@latest ``` -or +## Run (IDE) + ++ set TryCSharp.Tools.Cui project as 'startup project' ++ run onto IDE + +## Run (CLI) ```sh -$ make run +$ task run +task: [run] dotnet run --project TryCSharp.Tools.Cui --onetime ``` From 1363bca87c6ef988283c13a631dec754bd989c79 Mon Sep 17 00:00:00 2001 From: devlights Date: Wed, 21 Jun 2023 02:43:44 +0000 Subject: [PATCH 10/11] Update --- .devcontainer/Dockerfile | 2 +- .devcontainer/devcontainer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 9a60615..c0df489 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,5 +1,5 @@ # [Choice] .NET version: 6.0, 5.0, 3.1, 6.0-bullseye, 5.0-bullseye, 3.1-bullseye, 6.0-focal, 5.0-focal, 3.1-focal -ARG VARIANT="6.0-bullseye" +ARG VARIANT="7.0-bullseye" FROM mcr.microsoft.com/vscode/devcontainers/dotnet:0-${VARIANT} # [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8504e97..b8a0faa 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,7 +4,7 @@ "build": { "dockerfile": "Dockerfile", "args": { - "VARIANT": "6.0", + "VARIANT": "7.0", "NODE_VERSION": "lts/*" } }, From 9e0229095f479d980c01b49a6cffa25479f39755 Mon Sep 17 00:00:00 2001 From: devlights Date: Wed, 21 Jun 2023 02:45:20 +0000 Subject: [PATCH 11/11] Update --- .gitpod.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index a0dc102..1be9dbf 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,7 +1,5 @@ image: gitpod/workspace-dotnet:latest tasks: - - name: dotnet restore - init: make restore - name: install task init: go install github.com/go-task/task/v3/cmd/task@latest vscode: