James G
James G
CC#
Created by RSC☆Lele on 4/2/2025 in #help
'Emoji Translator': emoji-api.com doesn't work
7 replies
CC#
Created by RSC☆Lele on 4/2/2025 in #help
'Emoji Translator': emoji-api.com doesn't work
Your issue is you're matching the exact text to an emoji slug or unicodeName, when really the text is a substring of either. ie pizza actually has a unicodeName of E0.6 Pizza which is your key in the dictionary _emojis. What you need to do is use your wordRegex against the key in _emojis:
var keyValuePair = EmojiLib.Emojis.FirstOrDefault(kvp => Regex.IsMatch(kvp.Key, text));

return keyValuePair.Value;
var keyValuePair = EmojiLib.Emojis.FirstOrDefault(kvp => Regex.IsMatch(kvp.Key, text));

return keyValuePair.Value;
7 replies
CC#
Created by morry329# on 3/30/2025 in #help
Cannot return null from an action method with a return type of 'Microsoft.AspNetCore.Mvc.JsonResult'
Generally I'd recommend using the return type IActionResult unless you have specific requirements too, ie public async Task<IActionResult> CreateUser
8 replies
CC#
Created by morry329# on 3/30/2025 in #help
Cannot return null from an action method with a return type of 'Microsoft.AspNetCore.Mvc.JsonResult'
var name = "James";

return Ok(name);
var name = "James";

return Ok(name);
would show:
James
James
8 replies
CC#
Created by morry329# on 3/30/2025 in #help
Cannot return null from an action method with a return type of 'Microsoft.AspNetCore.Mvc.JsonResult'
Do be aware though if you return a string or int (or any other value type) with Ok() it wont serialize it for you.
8 replies
CC#
Created by morry329# on 3/30/2025 in #help
Cannot return null from an action method with a return type of 'Microsoft.AspNetCore.Mvc.JsonResult'
For example Ok has an underlying type OkObjectResult which you could use but it's a lot easier to just return Ok(model) instead of return new OkObjectResult(model)
8 replies
CC#
Created by morry329# on 3/30/2025 in #help
Cannot return null from an action method with a return type of 'Microsoft.AspNetCore.Mvc.JsonResult'
if you return Ok(model) it will serialize it to JSON for you and null values are permitted then. You generally shouldn't need to use the underlying XXXResult objects
8 replies
CC#
Created by Ratn on 3/29/2025 in #help
Package Error
can you run dotnet --list-sdks and paste the output here please?
70 replies
CC#
Created by Ratn on 3/29/2025 in #help
Package Error
have you got .NET 8 installed?
70 replies
CC#
Created by Ratn on 3/29/2025 in #help
Package Error
Yeah they're all inverted, but it currently builds fine. It'll just not work as expected when anything gets implemented
70 replies
CC#
Created by Ratn on 3/29/2025 in #help
Package Error
🤝
70 replies
CC#
Created by Ratn on 3/29/2025 in #help
Package Error
@Ratn I will say your csproj references look to be the wrong way around, I'd assume Repositories should reference Models and not the other way around
70 replies
CC#
Created by Ratn on 3/29/2025 in #help
Package Error
There's this ref in the web project:
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.7" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.7" />
70 replies
CC#
Created by Ratn on 3/29/2025 in #help
Package Error
oh gotcha, thought you were telling me you said above there was no issue (ie why am I doing the same) :kekW: got very confused
70 replies
CC#
Created by Ratn on 3/29/2025 in #help
Package Error
I dont understand mate
70 replies
CC#
Created by Ratn on 3/29/2025 in #help
Package Error
Yep, just trying to understand why it would work my end and not theirs is all
70 replies
CC#
Created by Ratn on 3/29/2025 in #help
Package Error
Close visual studio, go into your project directory and delete the .vs folder, reopen the solution in visual studio and restore/build
70 replies
CC#
Created by Ratn on 3/29/2025 in #help
Package Error
Have you removed code from this repo? It restores and builds fine for me.
70 replies
CC#
Created by Ratn on 3/29/2025 in #help
Package Error
Or you've got a sub-dependency installed that's a version lower than required for the Identity package you're installing
70 replies
CC#
Created by Ratn on 3/29/2025 in #help
Package Error
Check the package details -> dependencies for the version of Identity you're installing. If you're trying to use the most recent version on a .NET version that isn't compatible you'll get that error
70 replies