<?xml version="1.0" encoding="utf-8"?>

<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  <generator uri="https://jekyllrb.com/" version="3.9.3">Jekyll</generator>
  <link href="https://www.softwaredeveloper.blog/tag/quick-tips/feed.xml" rel="self" type="application/atom+xml" />
  <link href="https://www.softwaredeveloper.blog/tag/quick-tips" rel="alternate" type="text/html" hreflang="en" />
  <updated>2026-02-26T06:03:45+00:00</updated>
  <id>https://www.softwaredeveloper.blog/tag/quick-tips</id>

  
  
  

  
    <title type="html">Software Developer Blog | </title>
  

  
    <subtitle>Software craftsmanship and agile project management</subtitle>
  

  

  
    
      
    
  

  
  

  
    
    
    
    <entry>
      <title type="html">Executing assembly location in a Dotnet (core) single file app</title>
      
      <link href="https://www.softwaredeveloper.blog/executing-assembly-location-in-a-single-file-app" rel="alternate" type="text/html" title="Executing assembly location in a Dotnet (core) single file app" />
      <published>2022-01-19T10:00:00+00:00</published>
      <updated>2022-01-19T10:00:00+00:00</updated>
      <id>https://www.softwaredeveloper.blog/executing-assembly-location-in-a-single-file-app</id>
      <content type="html" xml:base="https://www.softwaredeveloper.blog/executing-assembly-location-in-a-single-file-app">&lt;p&gt;How to get Assembly location for modern &lt;em&gt;.NET&lt;/em&gt; projects embedded in a single-file app.&lt;/p&gt;

&lt;h2 id=&quot;executing-assembly-location&quot;&gt;Executing Assembly location&lt;/h2&gt;
&lt;p&gt;To get executing assembly location you can invoke:&lt;/p&gt;
&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;executableDirectory&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Reflection&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Assembly&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GetExecutingAssembly&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Location&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;But when you try to publish app as a single file, for example this way:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dotnet publish -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;then you will see following error:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;error IL3000: &apos;System.Reflection.Assembly.Location&apos; always returns an empty string for assemblies embedded in a single-file app. If the path to the app directory is needed, consider calling &apos;System.AppContext.BaseDirectory&apos;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;current-directory&quot;&gt;Current directory&lt;/h2&gt;
&lt;p&gt;You can achieve similar result with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BaseDirectory&lt;/code&gt; property from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;AppContext&lt;/code&gt; class:&lt;/p&gt;
&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;executableDirectory&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;System&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AppContext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BaseDirectory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;which will give you directory path of your single-file bundle.&lt;/p&gt;

&lt;p&gt;Note that this is exactly what error message suggests, but I know that not everyone will read it to the end (maybe that’s why your here?) :)&lt;/p&gt;

&lt;h2 id=&quot;example-usages&quot;&gt;Example usages&lt;/h2&gt;
&lt;p&gt;You can use this path for example to set current directory:&lt;/p&gt;
&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;executableDirectory&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;AppContext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BaseDirectory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;Directory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;SetCurrentDirectory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;executableDirectory&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;??&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;throw&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Exception&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Could not find out executable directory&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Or to instruct configuration file provider without changing current directory:&lt;/p&gt;
&lt;div class=&quot;language-csharp highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kt&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;builder&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;WebApplication&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;CreateBuilder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;builder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Configuration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;SetBasePath&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;AppContext&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;BaseDirectory&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;builder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Configuration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;AddJsonFile&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;CustomConfig.json&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Pay attention to lines order - setting new base path after adding json file will cause searching for json file in old base path.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;
&lt;p&gt;Retrieving application exe directory is still simple thing, but modern .NET is full of small changes which affects our lives, so I hope this short &lt;em&gt;how-to&lt;/em&gt; will be helpful.&lt;/p&gt;

&lt;p&gt;If in your version of .NET another approach is required, please share it with others in comment.&lt;/p&gt;</content>

      
      
      
      
      

      <author>
          <name>Tometchy</name>
        
        
      </author>

      

      
        <category term="quick-tips" />
      
        <category term="dotnet" />
      

      
        <summary type="html">How to get Assembly location for modern .NET projects embedded in a single-file app.</summary>
      
    </entry>
  
    
    
    
    <entry>
      <title type="html">Private Nuget feed in Docker .Net Core application</title>
      
      <link href="https://www.softwaredeveloper.blog/private-nuget-feed-in-docker" rel="alternate" type="text/html" title="Private Nuget feed in Docker .Net Core application" />
      <published>2021-04-03T10:00:00+00:00</published>
      <updated>2021-04-03T10:00:00+00:00</updated>
      <id>https://www.softwaredeveloper.blog/private-nuget-feed-in-docker</id>
      <content type="html" xml:base="https://www.softwaredeveloper.blog/private-nuget-feed-in-docker">&lt;p&gt;Using public &lt;em&gt;Nuget&lt;/em&gt; from &lt;a href=&quot;https://www.nuget.org/&quot;&gt;Nuget.org&lt;/a&gt; is always easy, you just need internet connection.
But when you need private &lt;em&gt;Nuget feed&lt;/em&gt; it sometimes doesn’t want to work, especially in isolated &lt;em&gt;Docker container&lt;/em&gt;.&lt;/p&gt;

&lt;h2 id=&quot;why-private-nuget-feed-wont-work-in-docker-without-additional-effort&quot;&gt;Why private &lt;em&gt;nuget&lt;/em&gt; feed won’t work in Docker without additional effort&lt;/h2&gt;
&lt;p&gt;When you restore &lt;em&gt;nuget&lt;/em&gt; packages in your Windows, then access to feed is granted
because of your credentials stored by &lt;em&gt;OS&lt;/em&gt;. When you try to access private &lt;em&gt;nuget&lt;/em&gt; packages in &lt;em&gt;Docker&lt;/em&gt; then
your credentials are not accessible (and you wouldn’t want to use them in &lt;em&gt;CI/CD pipeline&lt;/em&gt;) so you need to resolve
it some other way.&lt;/p&gt;

&lt;h2 id=&quot;how-to-access-private-nuget-packages-in-docker&quot;&gt;How to access private &lt;em&gt;nuget&lt;/em&gt; packages in &lt;em&gt;Docker&lt;/em&gt;&lt;/h2&gt;
&lt;p&gt;In theory, it should be easy, it should just end up with passing proper credentials to &lt;em&gt;Docker&lt;/em&gt; somehow.
In my case it was more difficult and I think similar problems are common, so I will share all steps I had to do.&lt;/p&gt;

&lt;h3 id=&quot;use-nuget-config-file-in-dockerfile-to-pass-credentials-to-docker&quot;&gt;Use &lt;em&gt;nuget&lt;/em&gt; config file in &lt;em&gt;Dockerfile&lt;/em&gt; to pass credentials to &lt;em&gt;Docker&lt;/em&gt;&lt;/h3&gt;
&lt;p&gt;First you have to pass &lt;em&gt;nuget&lt;/em&gt; config file in &lt;em&gt;Dockerfile&lt;/em&gt;.
To do so, you can use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--configfile Nuget.config&lt;/code&gt; option in &lt;em&gt;dotnet publish/restore&lt;/em&gt; commands.
This file should be stored at solution level, not to need copy-paste it for every image from solution.
Remember to set proper path (or/and copy it to convenient directory in image), otherwise you will see
error claiming that this file doesn’t exist:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/usr/share/dotnet/sdk/2.1.803/NuGet.targets(525,5): error : File &apos;/app/Nuget.config&apos; does not exist.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You can read more about &lt;em&gt;Nuget.config&lt;/em&gt; file with examples and explanations in &lt;a href=&quot;https://docs.microsoft.com/en-us/nuget/reference/nuget-config-file&quot;&gt;official documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h3 id=&quot;establishing-ssl-connection-to-private-docker-feed&quot;&gt;Establishing ssl connection to private Docker feed&lt;/h3&gt;
&lt;p&gt;Next I faced error while trying to establish encrypted connection to my Azure DevOps server &lt;em&gt;nuget feed&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;It was something like this:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. 
---&amp;gt; System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. 
---&amp;gt; System.ComponentModel.Win32Exception: The client and server cannot communicate, because they do not possess a common algorithm
   --- End of inner exception stack trace ---
   at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)
   at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslState.PartialFrameCallback(AsyncProtocolRequest asyncRequest)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I solved this one by adding &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0&lt;/code&gt; before using dotnet publish, like this:&lt;/p&gt;
&lt;div class=&quot;language-dockerfile highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;RUN &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;0 dotnet publish project &lt;span class=&quot;nt&quot;&gt;-c&lt;/span&gt; Release &lt;span class=&quot;nt&quot;&gt;--configfile&lt;/span&gt; Nuget.config
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;still-not-able-to-authenticate---response-status-code-does-not-indicate-success-401-unauthorized&quot;&gt;Still not able to authenticate - Response status code does not indicate success: 401 (Unauthorized)&lt;/h3&gt;
&lt;p&gt;After doing above steps I still faced issue while trying to use this &lt;em&gt;nuget feed&lt;/em&gt;.
I knew that credentials I used were corrected, the account which I used was created especially for &lt;em&gt;nuget&lt;/em&gt; purposes
and I knew that it had all proper permissions set and still was not able to connect. Error said:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/usr/share/dotnet/sdk/2.1.803/NuGet.targets(123,5): error : Unable to load the service index for source http://myazuredevopsserver:8080/tfs/DefaultCollection/_packaging/PackageFeed/nuget/v3/index.json. [/app/App.csproj]

/usr/share/dotnet/sdk/2.1.803/NuGet.targets(123,5): error : Response status code does not indicate success: 401 (Unauthorized). [/app/App.csproj]

The command &apos;/bin/sh -c DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0 dotnet restore App --configfile Nuget.config&apos; returned a non-zero code: 1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Azure DevOps server admin didn’t know why and couldn’t read it from server logs so suggested trying another
approach, which by the way may be good for security - using &lt;a href=&quot;https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&amp;amp;tabs=preview-page&quot;&gt;authentication with PAT (personal access token)&lt;/a&gt;.
He generated such a token, and we passed this token to &lt;em&gt;Nuget.config&lt;/em&gt; file and feed finally started to work.
Now it looks like this:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&amp;gt;
&amp;lt;configuration&amp;gt;
&amp;lt;config&amp;gt;
    &amp;lt;add key=&quot;http_proxy&quot; value=&quot;http://myazuredevopsserver:8080@company.corp&quot; /&amp;gt;
&amp;lt;/config&amp;gt;
  &amp;lt;packageSources&amp;gt;
    	&amp;lt;clear /&amp;gt;
    &amp;lt;add key=&quot;nuget.org&quot; value=&quot;https://api.nuget.org/v3/index.json&quot; /&amp;gt;
    &amp;lt;add key=&quot;Internal&quot; value=&quot;http://myazuredevopsserver:8080/tfs/DefaultCollection/_packaging/CompanyPackageFeed/nuget/v3/index.json&quot; /&amp;gt;
  &amp;lt;/packageSources&amp;gt;
	&amp;lt;activePackageSource&amp;gt;
		&amp;lt;add key=&quot;All&quot; value=&quot;(Aggregate source)&quot; /&amp;gt;
	&amp;lt;/activePackageSource&amp;gt;
  &amp;lt;packageSourceCredentials&amp;gt;
          &amp;lt;Internal&amp;gt;
            &amp;lt;add key=&quot;Username&quot; value=&quot;xxx&quot; /&amp;gt;
            &amp;lt;add key=&quot;ClearTextPassword&quot; value=&quot;xxx&quot; /&amp;gt;
            &amp;lt;add key=&quot;ValidAuthenticationTypes&quot; value=&quot;basic&quot; /&amp;gt;
          &amp;lt;/Internal&amp;gt;
  &amp;lt;/packageSourceCredentials&amp;gt;
&amp;lt;/configuration&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Where &lt;em&gt;xxx&lt;/em&gt; is the token (exactly the same value passed both to &lt;em&gt;Username&lt;/em&gt; and &lt;em&gt;ClearTextPassword&lt;/em&gt; field).
Note that (as far as I know) this token can be generated max for 1 year, so better set some reminder in your calendar, or red builds in build server will remind it for you after a year :)&lt;/p&gt;

&lt;h3 id=&quot;local-nuget-feed-as-a-last-resort&quot;&gt;Local &lt;em&gt;Nuget feed&lt;/em&gt; as a last resort&lt;/h3&gt;
&lt;p&gt;For a while till I didn’t get this working I created &lt;a href=&quot;https://docs.microsoft.com/en-us/nuget/hosting-packages/local-feeds&quot;&gt;local Nuget feed&lt;/a&gt;, to have some workaround until
I figured out proper solution.
With local feed you can store &lt;em&gt;Nugets&lt;/em&gt; in local directory and commit it to repo. But of course you need to maintain 
it by yourself, manually or with some automation which will commit new &lt;em&gt;Nuget&lt;/em&gt; versions for you, so I don’t recommend it
until it’s really the only way to get job done.&lt;br /&gt;
There are articles on the internet how to set it up, I will
just show you screenshot of how it looked in my case (it’s actually screenshot from commit which removed it from my project):
&lt;img src=&quot;/assets/images/local-nuget-feed.jpg&quot; alt=&quot;Screenshot showing Nuget.config file with local Nuget feed&quot; title=&quot;Nuget.config file with local Nuget feed&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;
&lt;p&gt;I must admit that this problem ate much of my time, moreover I had to ask Azure DevOps server admin
for help with reading server logs, and trying to figure out how to solve it.
I didn’t have time to write this post earlier, but questions about private feed were common in my inbox,
so I know that many of you face similar issues.&lt;/p&gt;

&lt;p&gt;If your case is yet different, feel free to ask question in comment.
And of course feedback is welcome, if this article has helped you or is missing something, it is very valuable for me to know it :)&lt;/p&gt;</content>

      
      
      
      
      

      <author>
          <name>Tometchy</name>
        
        
      </author>

      

      
        <category term="quick-tips" />
      
        <category term="dotnet" />
      

      
        <summary type="html">Using public Nuget from Nuget.org is always easy, you just need internet connection. But when you need private Nuget feed it sometimes doesn’t want to work, especially in isolated Docker container.</summary>
      
    </entry>
  
    
    
    
    <entry>
      <title type="html">Disable ctrl+shift shortcut in Windows 10 to stop language switch keyboard layout hot key</title>
      
      <link href="https://www.softwaredeveloper.blog/windows10-disable-language-switch-keyboard-layout-hotkey" rel="alternate" type="text/html" title="Disable ctrl+shift shortcut in Windows 10 to stop language switch keyboard layout hot key" />
      <published>2020-05-01T12:00:00+00:00</published>
      <updated>2020-05-01T12:00:00+00:00</updated>
      <id>https://www.softwaredeveloper.blog/windows10-disable-language-switch-keyboard-layout-hotkey</id>
      <content type="html" xml:base="https://www.softwaredeveloper.blog/windows10-disable-language-switch-keyboard-layout-hotkey">&lt;p&gt;Every &lt;em&gt;Windows&lt;/em&gt; user knows that typing &lt;em&gt;CTRL&lt;/em&gt; + &lt;em&gt;SHIFT&lt;/em&gt; changes keyboard layout and that typing it by mistake is easy, which can be really annoying.
Luckily this can be changed.&lt;/p&gt;

&lt;h3 id=&quot;removing-ctrl--shift-shortcut-hot-key-in-old-windows-version&quot;&gt;Removing &lt;em&gt;CTRL&lt;/em&gt; + &lt;em&gt;SHIFT&lt;/em&gt; shortcut hot key in old Windows version&lt;/h3&gt;
&lt;p&gt;We used to change this behaviour in following location:&lt;br /&gt;
&lt;em&gt;Control Panel&lt;/em&gt; » &lt;em&gt;All Control Panel items&lt;/em&gt; » &lt;em&gt;Language&lt;/em&gt; » &lt;em&gt;Advanced settings&lt;/em&gt; » &lt;em&gt;Change language bar hot keys&lt;/em&gt; » &lt;em&gt;Advanced Key Settings&lt;/em&gt; » &lt;em&gt;Between input languages&lt;/em&gt; » &lt;em&gt;Change Key Sequence…&lt;/em&gt;&lt;/p&gt;

&lt;h3 id=&quot;windows-10-solution-which-didnt-work-in-my-case&quot;&gt;Windows 10 solution which didn’t work in my case&lt;/h3&gt;
&lt;p&gt;With new Windows 10 installation (which happened to me) I tried to disable this language hot keys, but the way which
I found on the internet didn’t work in my case (configuration in given location didn’t exist).&lt;br /&gt;
There is a chance that it will work for you, so just in case I’ll write it here:
&lt;em&gt;Control Panel\Clock, Language and Region\Language\Advanced settings\Change Language Bar hot keys&lt;/em&gt;.&lt;/p&gt;

&lt;h2 id=&quot;change-language-hot-keys-to-switch-keyboard-layout-in-windows-10&quot;&gt;Change language hot keys to switch keyboard layout in Windows 10&lt;/h2&gt;
&lt;p&gt;After spending a while doing manual searching in all Windows configuration places, I’ve finally found it.
I’ve disabled &lt;em&gt;CTRL&lt;/em&gt; + &lt;em&gt;SHIFT&lt;/em&gt; shortcut here:&lt;br /&gt;
&lt;em&gt;Advanced keyboard settings&lt;/em&gt; (you can find it with &lt;em&gt;Start&lt;/em&gt; search or with &lt;em&gt;Windows Settings&lt;/em&gt; search),
choose &lt;em&gt;Input language hot keys&lt;/em&gt;, next &lt;em&gt;Advanced Key Settings&lt;/em&gt;, then &lt;em&gt;Between input languages&lt;/em&gt; and 
set &lt;em&gt;Not Assigned&lt;/em&gt;, or replace with other keys combination.&lt;br /&gt;
Like in following screenshot:
&lt;img src=&quot;/assets/images/windows-switch-language-hot-key.png&quot; alt=&quot;Screenshot with Windows keyboard setting, showing where to find switch keyboard layout shortcut&quot; title=&quot;Disable CTRL+SHIFT switch keyboard layout hot key&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;
&lt;p&gt;If you don’t need to switch keyboard layout often, you can easily disable this hot key.
Those who do need to change language keyboard layout on a daily basis (working with multiple languages at the same time)
may leave this untouched or change shortcut to version which is less likely to type by mistake.&lt;/p&gt;

&lt;p&gt;If your version of Windows have this setting in yet other location, please share it with others in comment :)&lt;/p&gt;</content>

      
      
      
      
      

      <author>
          <name>Tometchy</name>
        
        
      </author>

      

      
        <category term="quick-tips" />
      

      
        <summary type="html">Every Windows user knows that typing CTRL + SHIFT changes keyboard layout and that typing it by mistake is easy, which can be really annoying. Luckily this can be changed.</summary>
      
    </entry>
  
    
    
    
    <entry>
      <title type="html">Error in MSSMS: Attempt to retrieve data for object failed. Invalid Urn filter…</title>
      
      <link href="https://www.softwaredeveloper.blog/mssms-invalid-urn-filter-on-server" rel="alternate" type="text/html" title="Error in MSSMS: Attempt to retrieve data for object failed. Invalid Urn filter..." />
      <published>2019-12-30T06:00:00+00:00</published>
      <updated>2019-12-30T06:00:00+00:00</updated>
      <id>https://www.softwaredeveloper.blog/mssms-invalid-urn-filter-on-server</id>
      <content type="html" xml:base="https://www.softwaredeveloper.blog/mssms-invalid-urn-filter-on-server">&lt;p&gt;When you work with &lt;em&gt;MS SQL Server&lt;/em&gt; in &lt;em&gt;Docker&lt;/em&gt; container, you may come across problem with Microsoft SQL Server Management Studio. See what’s going on.&lt;/p&gt;

&lt;h3 id=&quot;how-invalid-urn-filter-error-looks-like&quot;&gt;How &lt;em&gt;Invalid Urn Filter&lt;/em&gt; error looks like&lt;/h3&gt;
&lt;p&gt;What you see when error occurs is &lt;em&gt;Microsoft SQL Server Management Studio&lt;/em&gt; message box saying:&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;Attempt to retrieve data for object failed for Server ‘PC-NAME’.  (Microsoft.SqlServer.Smo)&lt;/p&gt;

  &lt;p&gt;Additional information:
Invalid Urn filter on server level: filter must be empty, or server attribute must be equal with the true server name. (Microsoft.SqlServer.Smo)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/mssms-urn-filter.jpg&quot; alt=&quot;MSSMS screenshot with invalid urn filter Message box&quot; title=&quot;Invalid Urn filter exception&quot; /&gt;&lt;/p&gt;

&lt;p&gt;When you press &lt;em&gt;Copy message text&lt;/em&gt; you will have the same message extended with &lt;em&gt;For help, click: http://go.microsoft.com/fwlink?ProdName=…&lt;/em&gt; but in my
case this url doesn’t work.&lt;/p&gt;

&lt;p&gt;When you press &lt;em&gt;Show technical details&lt;/em&gt; you will see &lt;em&gt;Advanced information&lt;/em&gt;:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;===================================

Attempt to retrieve data for object failed for Server &apos;PC-NAME&apos;.  (Microsoft.SqlServer.Smo)

------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&amp;amp;ProdVer=14.0.17230.0+((SSMS_Rel_17_4).180313-0650)&amp;amp;EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&amp;amp;EvtID=Attempt+to+retrieve+data+for+object+Server&amp;amp;LinkId=20476

------------------------------
Program Location:

   at Microsoft.SqlServer.Management.Smo.Server.GetSmoObject(Urn urn)
   at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.OpenTableHelperClass.SelectFromTableOrView(Server server, Urn urn, Int32 topNValue, Boolean scriptForSelectingRows, Boolean isDw)
   at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.OpenTableHelperClass.GetScriptForTopNRows(NodeContext parentContext, Int32 topNValue, Boolean scriptForSelectingRows)
   at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.OpenTableHelperClass.SelectTopNRows(NodeContext parentContext, Int32 topNValue)
   at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.SelectTopNRows.Invoke()
   at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ToolsMenuItemBase.MenuInvokedHandler(Object sender, EventArgs args)

===================================

Invalid Urn filter on server level: filter must be empty, or server attribute must be equal with the true server name. (Microsoft.SqlServer.Smo)

------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&amp;amp;ProdVer=14.0.17230.0+((SSMS_Rel_17_4).180313-0650)&amp;amp;LinkId=20476

------------------------------
Program Location:

   at Microsoft.SqlServer.Management.Smo.Server.CheckValidUrnServerLevel(XPathExpressionBlock xb)
   at Microsoft.SqlServer.Management.Smo.Server.GetSmoObjectRec(Urn urn)
   at Microsoft.SqlServer.Management.Smo.Server.GetSmoObjectRec(Urn urn)
   at Microsoft.SqlServer.Management.Smo.Server.GetSmoObjectRec(Urn urn)
   at Microsoft.SqlServer.Management.Smo.Server.GetSmoObject(Urn urn)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;why-mssms-with-ms-sql-server-in-docker-container-causes-problems&quot;&gt;Why &lt;em&gt;MSSMS&lt;/em&gt; with &lt;em&gt;MS SQL Server&lt;/em&gt; in &lt;em&gt;Docker&lt;/em&gt; container causes problems&lt;/h3&gt;
&lt;p&gt;When you recreate &lt;em&gt;Docker&lt;/em&gt; container with &lt;em&gt;Microsoft SQL Server&lt;/em&gt; from scratch, it’s like you create new virtual machine,
with whole new &lt;em&gt;SQL Server&lt;/em&gt; installation. As far as I know, &lt;em&gt;MSSMS&lt;/em&gt; was not designed for such situation (even in virtualization era it was not 
usual case, like it is in containerization era), and it has some internal state cached. It’s probably &lt;em&gt;SQL Server&lt;/em&gt; internal instance name, which
isn’t the same for new &lt;em&gt;installation&lt;/em&gt;, that’s why you see message: &lt;em&gt;server attribute must be equal with the true server name&lt;/em&gt;.&lt;/p&gt;

&lt;h2 id=&quot;how-to-resolve-mssms-error-attempt-to-retrieve-data-for-object-failed-for-server-invalid-urn-filter-on-server-level&quot;&gt;How to resolve &lt;em&gt;MSSMS&lt;/em&gt; error: &lt;em&gt;Attempt to retrieve data for object failed for Server, Invalid Urn filter on server level&lt;/em&gt;&lt;/h2&gt;
&lt;p&gt;Unfortunately at the time of writing I didn’t find permanent solution. All you can do is to restart &lt;em&gt;Microsoft SQL Server Management Studio&lt;/em&gt; every time you
recreate &lt;em&gt;Docker&lt;/em&gt; container. But what you should do first is to install the newest version, maybe some upgrade will fix this.
Moreover, I don’t remember exactly what was the case, but older &lt;em&gt;MSSMS&lt;/em&gt; versions got some other related issue, which got fixed.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;
&lt;p&gt;To summarize: install the newest &lt;em&gt;MSSMS&lt;/em&gt; version, but you will probably still need to restart &lt;em&gt;Management Studio&lt;/em&gt; every time you start new instance of &lt;em&gt;SQL Server&lt;/em&gt; in
&lt;em&gt;Docker&lt;/em&gt; container.&lt;/p&gt;

&lt;p&gt;If you know something more, please let me know in comment, and of course if you have some questions :)&lt;br /&gt;
And share it with others who deals with &lt;em&gt;SQL Server&lt;/em&gt; in &lt;em&gt;Docker&lt;/em&gt; container too.&lt;/p&gt;</content>

      
      
      
      
      

      <author>
          <name>Tometchy</name>
        
        
      </author>

      

      
        <category term="quick-tips" />
      
        <category term="sql" />
      

      
        <summary type="html">When you work with MS SQL Server in Docker container, you may come across problem with Microsoft SQL Server Management Studio. See what’s going on.</summary>
      
    </entry>
  
    
    
    
    <entry>
      <title type="html">Docker run problem no such file or directory (or other strange message)</title>
      
      <link href="https://www.softwaredeveloper.blog/docker-run-problem-no-such-file-or-directory-or-other-strange-message" rel="alternate" type="text/html" title="Docker run problem no such file or directory (or other strange message)" />
      <published>2019-12-23T08:00:00+00:00</published>
      <updated>2019-12-23T08:00:00+00:00</updated>
      <id>https://www.softwaredeveloper.blog/docker-run-problem-no-such-file-or-directory-or-other-strange-message</id>
      <content type="html" xml:base="https://www.softwaredeveloper.blog/docker-run-problem-no-such-file-or-directory-or-other-strange-message">&lt;p&gt;When you cannot start Docker container correctly and have problems like &lt;em&gt;No such file or directory&lt;/em&gt; or some other unintuitive message, there is one thing you should check first…&lt;/p&gt;

&lt;h2 id=&quot;correct-line-endings-eol-in-files-copied-to-docker&quot;&gt;Correct line endings (&lt;em&gt;EOL&lt;/em&gt;) in files copied to Docker&lt;/h2&gt;
&lt;p&gt;Check if you pass to Docker image scripts (or other text files) with &lt;em&gt;Unix&lt;/em&gt; line endings (&lt;em&gt;LF&lt;/em&gt;)!
&lt;img src=&quot;/assets/images/notepadpp-unix-line-endings.png&quot; alt=&quot;Notepad++ screenshot with Unix EOL conversion option shown&quot; title=&quot;Set Unix EOL&quot; /&gt;&lt;/p&gt;

&lt;p&gt;With wrong &lt;em&gt;EOL&lt;/em&gt; you will be lucky if message somehow indicates it, for example:&lt;br /&gt;
&lt;em&gt;line 3: &lt;strong&gt;$’\r’:&lt;/strong&gt; command not found&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;but it often looks in a way which gives no clue, what is wrong.&lt;/p&gt;

&lt;p&gt;I once spent more than 2 hours because of it, so I hope that with this blog post you will not have to :)&lt;/p&gt;

&lt;p&gt;If you have problem which looks similar but is not caused by wrong &lt;em&gt;EOL&lt;/em&gt;, please share it in comment, I will try to help you figure it out,
then update this post for others.&lt;/p&gt;</content>

      
      
      
      
      

      <author>
          <name>Tometchy</name>
        
        
      </author>

      

      
        <category term="quick-tips" />
      
        <category term="docker" />
      

      
        <summary type="html">When you cannot start Docker container correctly and have problems like No such file or directory or some other unintuitive message, there is one thing you should check first…</summary>
      
    </entry>
  
    
    
    
    <entry>
      <title type="html">Docker logs from last run container</title>
      
      <link href="https://www.softwaredeveloper.blog/docker-logs-from-last-run-container" rel="alternate" type="text/html" title="Docker logs from last run container" />
      <published>2019-12-23T06:00:00+00:00</published>
      <updated>2019-12-23T06:00:00+00:00</updated>
      <id>https://www.softwaredeveloper.blog/docker-logs-from-last-run-container</id>
      <content type="html" xml:base="https://www.softwaredeveloper.blog/docker-logs-from-last-run-container">&lt;p&gt;Running Docker containers is what we do often, so it’s good to know how to do it to see Docker logs immediately.&lt;/p&gt;

&lt;h3 id=&quot;running-docker-container-in-foreground-mode&quot;&gt;Running Docker container in foreground mode&lt;/h3&gt;
&lt;p&gt;When you run container without &lt;em&gt;detach&lt;/em&gt; flag (&lt;em&gt;-d&lt;/em&gt;) then you usually need to stop container when you want to
close terminal or type another command. You can &lt;a href=&quot;https://docs.docker.com/engine/reference/run/#foreground&quot;&gt;manipulate this with &lt;em&gt;-a&lt;/em&gt; flag&lt;/a&gt;,
but it’s easier just to run in &lt;em&gt;detached&lt;/em&gt; mode.&lt;/p&gt;

&lt;h3 id=&quot;running-docker-container-in-detached-mode&quot;&gt;Running Docker container in detached mode&lt;/h3&gt;
&lt;p&gt;When you run container in &lt;em&gt;detached&lt;/em&gt; mode (with &lt;em&gt;–detach&lt;/em&gt;, &lt;em&gt;-d&lt;/em&gt; or &lt;em&gt;-d=true&lt;/em&gt; flag) you can safely close
terminal or type another command without affecting running containers, but in this mode by default you don’t see logs.&lt;/p&gt;

&lt;p&gt;If you know your container name you can quickly run &lt;em&gt;docker logs -f CONTAINER_NAME&lt;/em&gt; but when you don’t know it (which is often the case), 
then many people usually end up with this solution: quickly run &lt;em&gt;docker ps&lt;/em&gt;, check container name, and quickly pass it to &lt;em&gt;docker logs&lt;/em&gt; command.
With terminal with poor autocompletion this takes long.&lt;/p&gt;

&lt;h2 id=&quot;how-to-see-docker-logs-from-last-ran-container&quot;&gt;How to see docker logs from last ran container?&lt;/h2&gt;
&lt;p&gt;We usually don’t focus on &lt;em&gt;Docker run&lt;/em&gt; output, which in detached mode is… container ID.
So we don’t need to use &lt;em&gt;Docker ps&lt;/em&gt; to check container name which just got started, we already have it’s ID, which can be used in &lt;em&gt;Docker logs&lt;/em&gt; command
as well. So we can copy and paste it after &lt;em&gt;Docker run&lt;/em&gt;. Example:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;docker run &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; app
d6a2d30a9a85abf110192e944963bb0ce157dde143139c24abb4bbf038403451
&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;docker logs &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; d6a2d30a9a85abf110192e944963bb0ce157dde143139c24abb4bbf038403451
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It’s already more convenient, but… better solution is to use it without need to do copy and paste.
How? Simply use &lt;em&gt;xargs&lt;/em&gt; to pass &lt;em&gt;Docker run&lt;/em&gt; output (container id), to &lt;em&gt;Docker logs&lt;/em&gt;. Example:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;docker run &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; app | xargs docker logs &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;And we have it :) Very simple, very convenient.&lt;/p&gt;

&lt;h3 id=&quot;why-pass--f-flag-to-docker-logs-command&quot;&gt;Why pass &lt;em&gt;-f&lt;/em&gt; flag to Docker logs command?&lt;/h3&gt;
&lt;p&gt;In all previous examples I have passed &lt;em&gt;-f&lt;/em&gt; flag to &lt;em&gt;Docker logs&lt;/em&gt; command, which stand for &lt;em&gt;follow&lt;/em&gt;.
It’s not necessary, but without it Docker will only show already created logs.
With &lt;em&gt;follow&lt;/em&gt; option, it will show already created logs and will attach our terminal to see new logs, which is what we usually want, to monitor what is going on.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;
&lt;p&gt;As Docker comes from Linux world it’s meant to be used from command line and is optimized for this.
So having container ID returned from &lt;em&gt;Docker run&lt;/em&gt; command (in detached mode) is probably meant to be passed to next command (or script), so we can
safely use it to follow logs immediately.&lt;/p&gt;

&lt;p&gt;Let me know in comment if you like this trick or share it with others with following buttons or direct url :)&lt;/p&gt;</content>

      
      
      
      
      

      <author>
          <name>Tometchy</name>
        
        
      </author>

      

      
        <category term="quick-tips" />
      
        <category term="docker" />
      

      
        <summary type="html">Running Docker containers is what we do often, so it’s good to know how to do it to see Docker logs immediately.</summary>
      
    </entry>
  
    
    
    
    <entry>
      <title type="html">Error 459 - permission denied while trying to run git bisect with script</title>
      
      <link href="https://www.softwaredeveloper.blog/git-bisect-permission-denied-459" rel="alternate" type="text/html" title="Error 459 - permission denied while trying to run git bisect with script" />
      <published>2019-11-16T06:00:00+00:00</published>
      <updated>2019-11-16T06:00:00+00:00</updated>
      <id>https://www.softwaredeveloper.blog/git-bisect-permission-denied-459</id>
      <content type="html" xml:base="https://www.softwaredeveloper.blog/git-bisect-permission-denied-459">&lt;p&gt;How to fix error occurring during &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git bisect run&lt;/code&gt; - &lt;em&gt;459: /usr/lib/git-core/git-bisect: script.sh: Permission denied&lt;/em&gt;.&lt;/p&gt;

&lt;h3 id=&quot;full-logs-of-git-bisect-with-459-error&quot;&gt;Full logs of &lt;em&gt;git-bisect&lt;/em&gt; with 459 error&lt;/h3&gt;
&lt;p&gt;As you see, problem with running script doesn’t stop &lt;em&gt;git-bisect&lt;/em&gt; so it finishes job. I hope in the future Git team will improve this, to stop when something goes wrong - such result is not reliable, there is no point to continue process.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-log&quot; data-lang=&quot;log&quot;&gt;~/Projects/app ((no branch, bisect started on fix_bug)) $ git bisect run /usr/lib/git-core/scripts/check-app.sh
running /usr/lib/git-core/scripts/check-app.sh
/usr/lib/git-core/git-bisect: 459: /usr/lib/git-core/git-bisect: /usr/lib/git-core/scripts/check-app.sh: Permission denied
Bisecting: 3 revisions left to test after this (roughly 2 steps)
[0e804f177d84772564ef74cb3905c4c1147d2f78] commit title
running /usr/lib/git-core/scripts/check-app.sh
/usr/lib/git-core/git-bisect: 459: /usr/lib/git-core/git-bisect: /usr/lib/git-core/scripts/check-app.sh: Permission denied
Bisecting: 1 revision left to test after this (roughly 1 step)
[e02f6d38ed24ee37caddd494e04742dcfa2eef84] another commit title
running /usr/lib/git-core/scripts/check-app.sh
/usr/lib/git-core/git-bisect: 459: /usr/lib/git-core/git-bisect: /usr/lib/git-core/scripts/check-app.sh: Permission denied
Bisecting: 0 revisions left to test after this (roughly 0 steps)
[4abe5155e0b4781b3247b289ebea23c081889150] yet another commit title
running /usr/lib/git-core/scripts/check-app.sh
/usr/lib/git-core/git-bisect: 459: /usr/lib/git-core/git-bisect: /usr/lib/git-core/scripts/check-app.sh: Permission denied
4abe5155e0b4781b3247b289ebea23c081889150 is the first bad commit
commit 4abe5155e0b4781b3247b289ebea23c081889150
(COMMIT DETAILS)
:040000 040000 92dfff033a3f883db1311fe9a8a3b50a5c901cbd a60d2bf636421197930d7194fbd56b954880e50e
bisect run success&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h2 id=&quot;quick-solution&quot;&gt;Quick solution&lt;/h2&gt;
&lt;p&gt;Quick solution is to allow everyone to access directory with script.&lt;br /&gt;
To do so you just need to use &lt;em&gt;chmod&lt;/em&gt; command like this:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Make directory available for all &lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;chmod&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-R&lt;/span&gt; 777 PATH_TO_DIRECTORY
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In my case it was fine, I have even moved whole script to &lt;em&gt;/usr/lib/git-core/scripts&lt;/em&gt; directory, so it’s globally available now, so I didn’t investigate what exactly has gone wrong.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;
&lt;p&gt;To summarize: &lt;em&gt;459&lt;/em&gt; access problem can be fixed without investigation, but only if giving permission for every user is acceptable in your case.
If this quick solution is not enough for you or doesn’t work in your case, please share your own with others in comments :)&lt;/p&gt;</content>

      
      
      
      
      

      <author>
          <name>Tometchy</name>
        
        
      </author>

      

      
        <category term="quick-tips" />
      
        <category term="git" />
      

      
        <summary type="html">How to fix error occurring during git bisect run - 459: /usr/lib/git-core/git-bisect: script.sh: Permission denied.</summary>
      
    </entry>
  
    
    
    
    <entry>
      <title type="html">TFS Linux Agent with error: The user’s home directory could not be determined</title>
      
      <link href="https://www.softwaredeveloper.blog/tfs-linux-agent-dotnet-home-directory-could-not-be-determined" rel="alternate" type="text/html" title="TFS Linux Agent with error: The user&apos;s home directory could not be determined" />
      <published>2019-06-08T06:00:00+00:00</published>
      <updated>2019-06-08T06:00:00+00:00</updated>
      <id>https://www.softwaredeveloper.blog/tfs-linux-agent-dotnet-home-directory-could-not-be-determined</id>
      <content type="html" xml:base="https://www.softwaredeveloper.blog/tfs-linux-agent-dotnet-home-directory-could-not-be-determined">&lt;p&gt;How to fix problem with dotnet restore on TFS 2017 Linux agent - &lt;em&gt;The user’s home directory could not be determined&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;I have recently configured Linux agent for Team Foundation Server 2017 to be able to run dotnet core project there.
But during &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dotnet restore&lt;/code&gt; step error was thrown: &lt;em&gt;Error: /usr/bin/dotnet failed with return code: 1&lt;/em&gt; with more explanation:
&lt;em&gt;The user’s home directory could not be determined. Set the ‘DOTNET_CLI_HOME’ environment variable to specify the directory to use.&lt;/em&gt;
It may occur also on newer versions of TFS and on its online version - Visual Studio Team Services (VSTS), currently called Azure DevOps.&lt;/p&gt;

&lt;p&gt;After quick search I knew that dotnet needs to know where home is located for some operations.&lt;/p&gt;

&lt;h3 id=&quot;agent-logs&quot;&gt;Agent logs&lt;/h3&gt;
&lt;p&gt;Full agent logs for dotnet restore step:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-log&quot; data-lang=&quot;log&quot;&gt;[section]Starting: Restore
==============================================================================
Task         : .NET Core
Description  : Build, test and publish using dotnet core command-line.
Version      : 1.0.1
Author       : Microsoft Corporation
Help         : [More Information](https://go.microsoft.com/fwlink/?linkid=832194)
==============================================================================
[command] /usr/bin/dotnet restore /home/tfs-agent/PS-TFS-AGENT-LNX01_agent01/_work/2/s/ProjectName/ProjectName.csproj
The user&apos;s home directory could not be determined. Set the &apos;DOTNET_CLI_HOME&apos; environment variable to specify the directory to use.
[error] Error: /usr/bin/dotnet failed with return code: 1
[error] Dotnet command failed with non-zero exit code on the following projects : /home/tfs-agent/PS-TFS-AGENT-LNX01_agent01/_work/2/s/ProjectName/ProjectName.csproj
[section] Finishing: Restore&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;what-didnt-help&quot;&gt;What didn’t help&lt;/h3&gt;
&lt;p&gt;First I checked if &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$HOME&lt;/code&gt; variable can be seen on this Linux Machine, logged in as user which is given for TFS.
It was ok. Then I set &lt;em&gt;DOTNET_CLI_HOME&lt;/em&gt; as Linux environment variable, pointing to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$HOME&lt;/code&gt;. It didn’t help.
There were much more solutions to check, looking through the internet, but next one worked for me.&lt;/p&gt;

&lt;h3 id=&quot;solution&quot;&gt;Solution&lt;/h3&gt;
&lt;p&gt;This solutions is not elegant, but it works and in my view is acceptable, and it has one big advantage - it doesn’t require access to Linux Machine ssh.
I set &lt;em&gt;DOTNET_CLI_HOME&lt;/em&gt; as build definition variable, pointing to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/tmp&lt;/code&gt; directory. That’s it, now dotnet restore and build works :)
&lt;img src=&quot;/assets/images/tfs-dotnet-cli-home-variable.png&quot; alt=&quot;TFS 2017 build definition variables screenshot&quot; title=&quot;DOTNET_CLI_HOME as build definition variable&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;
&lt;p&gt;I don’t know if this solution will work for everyone, but it takes only 2 clicks to try, so definitely it’s good to start with :)&lt;/p&gt;</content>

      
      
      
      
      

      <author>
          <name>Tometchy</name>
        
        
      </author>

      

      
        <category term="quick-tips" />
      
        <category term="linux" />
      

      
        <summary type="html">How to fix problem with dotnet restore on TFS 2017 Linux agent - The user’s home directory could not be determined.</summary>
      
    </entry>
  
    
    
    
    <entry>
      <title type="html">Error using jquery-csv: $.csv is undefined</title>
      
      <link href="https://www.softwaredeveloper.blog/jquery-csv-is-undefined" rel="alternate" type="text/html" title="Error using jquery-csv: $.csv is undefined" />
      <published>2019-05-15T06:00:00+00:00</published>
      <updated>2019-05-15T06:00:00+00:00</updated>
      <id>https://www.softwaredeveloper.blog/jquery-csv-is-undefined</id>
      <content type="html" xml:base="https://www.softwaredeveloper.blog/jquery-csv-is-undefined">&lt;p&gt;Javascript has nice tool to read and transform csv data, with handy api but with unexpected inconvenience as well.&lt;/p&gt;

&lt;p&gt;Recently in one web project I had to convert csv data to javascript objects.
Quick DuckDuckGo research has shown me library which suits my needs: &lt;a href=&quot;https://github.com/typeiii/jquery-csv&quot;&gt;jquery-csv&lt;/a&gt;.
I did everything the same way as in official demo, but exception &lt;code&gt;$.csv is undefined&lt;/code&gt; kept blocking me.
My IDE was able to go to declaration without any problems, still browser was unable to got it.&lt;/p&gt;

&lt;h2 id=&quot;solutions&quot;&gt;Solutions&lt;/h2&gt;
&lt;h3 id=&quot;wait-till-document-is-ready&quot;&gt;Wait till document is ready&lt;/h3&gt;
&lt;p&gt;The only solution which I found on the internet was to wait till document is ready.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-javascript&quot; data-lang=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ready&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// Use jquery-csv here&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;Unfortunately this was not my case, I already did it.&lt;/p&gt;

&lt;h3 id=&quot;check-libraries-load-order&quot;&gt;Check libraries load order&lt;/h3&gt;
&lt;p&gt;Finally, comparing my code with demo line by line, I found the solution.
I had &lt;em&gt;jquery-csv&lt;/em&gt; import after usual &lt;em&gt;jQuery&lt;/em&gt;. So all I had to do was moving &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;script src=&quot;jquery-csv.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt; line after 
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;script src=&quot;jquery-3.4.0.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt;. That’s because this library tries to follow &lt;em&gt;jQuery&lt;/em&gt; api, which seems to be convenient idea,
but practice shows that it has big disadvantage - &lt;em&gt;jQuery&lt;/em&gt; deletes or mutates library namespace.&lt;/p&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;
&lt;p&gt;That’s it, but coming to this point took me some time and internet was not helpful back then, so I decided to share this solution. It
might be helpful for people stuck in the same situation :)&lt;/p&gt;</content>

      
      
      
      
      

      <author>
          <name>Tometchy</name>
        
        
      </author>

      

      
        <category term="quick-tips" />
      

      
        <summary type="html">Javascript has nice tool to read and transform csv data, with handy api but with unexpected inconvenience as well.</summary>
      
    </entry>
  
</feed>
